diff --git a/services/rabbitmq/model_instance_parameters.go b/services/rabbitmq/model_instance_parameters.go index a4525ea0b..cb3966b45 100644 --- a/services/rabbitmq/model_instance_parameters.go +++ b/services/rabbitmq/model_instance_parameters.go @@ -12,7 +12,6 @@ package rabbitmq import ( "encoding/json" - "fmt" ) // checks if the InstanceParameters type satisfies the MappedNullable interface at compile time @@ -266,114 +265,10 @@ func setInstanceParametersGetTlsCiphersAttributeType(arg *InstanceParametersGetT types and functions for tls-protocols */ -// isEnum - -// InstanceParametersTlsProtocols the model 'InstanceParameters' -// value type for enums -type InstanceParametersTlsProtocols string - -// List of TlsProtocols -const ( - INSTANCEPARAMETERSTLS_PROTOCOLS__2 InstanceParametersTlsProtocols = "tlsv1.2" - INSTANCEPARAMETERSTLS_PROTOCOLS__3 InstanceParametersTlsProtocols = "tlsv1.3" -) - -// All allowed values of InstanceParameters enum -var AllowedInstanceParametersTlsProtocolsEnumValues = []InstanceParametersTlsProtocols{ - "tlsv1.2", - "tlsv1.3", -} - -func (v *InstanceParametersTlsProtocols) UnmarshalJSON(src []byte) error { - // use a type alias to prevent infinite recursion during unmarshal, - // see https://biscuit.ninja/posts/go-avoid-an-infitine-loop-with-custom-json-unmarshallers - type TmpJson InstanceParametersTlsProtocols - var value TmpJson - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - // Allow unmarshalling zero value for testing purposes - var zeroValue TmpJson - if value == zeroValue { - return nil - } - enumTypeValue := InstanceParametersTlsProtocols(value) - for _, existing := range AllowedInstanceParametersTlsProtocolsEnumValues { - if existing == enumTypeValue { - *v = enumTypeValue - return nil - } - } - - return fmt.Errorf("%+v is not a valid InstanceParameters", value) -} - -// NewInstanceParametersTlsProtocolsFromValue returns a pointer to a valid InstanceParametersTlsProtocols -// for the value passed as argument, or an error if the value passed is not allowed by the enum -func NewInstanceParametersTlsProtocolsFromValue(v InstanceParametersTlsProtocols) (*InstanceParametersTlsProtocols, error) { - ev := InstanceParametersTlsProtocols(v) - if ev.IsValid() { - return &ev, nil - } else { - return nil, fmt.Errorf("invalid value '%v' for InstanceParametersTlsProtocols: valid values are %v", v, AllowedInstanceParametersTlsProtocolsEnumValues) - } -} - -// IsValid return true if the value is valid for the enum, false otherwise -func (v InstanceParametersTlsProtocols) IsValid() bool { - for _, existing := range AllowedInstanceParametersTlsProtocolsEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to TlsProtocolsTlsProtocols value -func (v InstanceParametersTlsProtocols) Ptr() *InstanceParametersTlsProtocols { - return &v -} - -type NullableInstanceParametersTlsProtocols struct { - value *InstanceParametersTlsProtocols - isSet bool -} - -func (v NullableInstanceParametersTlsProtocols) Get() *InstanceParametersTlsProtocols { - return v.value -} - -func (v *NullableInstanceParametersTlsProtocols) Set(val *InstanceParametersTlsProtocols) { - v.value = val - v.isSet = true -} - -func (v NullableInstanceParametersTlsProtocols) IsSet() bool { - return v.isSet -} - -func (v *NullableInstanceParametersTlsProtocols) Unset() { - v.value = nil - v.isSet = false -} - -func NewNullableInstanceParametersTlsProtocols(val *InstanceParametersTlsProtocols) *NullableInstanceParametersTlsProtocols { - return &NullableInstanceParametersTlsProtocols{value: val, isSet: true} -} - -func (v NullableInstanceParametersTlsProtocols) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -func (v *NullableInstanceParametersTlsProtocols) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} - -type InstanceParametersGetTlsProtocolsAttributeType = *InstanceParametersTlsProtocols -type InstanceParametersGetTlsProtocolsArgType = InstanceParametersTlsProtocols -type InstanceParametersGetTlsProtocolsRetType = InstanceParametersTlsProtocols +// isArray +type InstanceParametersGetTlsProtocolsAttributeType = *[]string +type InstanceParametersGetTlsProtocolsArgType = []string +type InstanceParametersGetTlsProtocolsRetType = []string func getInstanceParametersGetTlsProtocolsAttributeTypeOk(arg InstanceParametersGetTlsProtocolsAttributeType) (ret InstanceParametersGetTlsProtocolsRetType, ok bool) { if arg == nil { @@ -731,7 +626,7 @@ func (o *InstanceParameters) HasTlsProtocols() bool { return ok } -// SetTlsProtocols gets a reference to the given string and assigns it to the TlsProtocols field. +// SetTlsProtocols gets a reference to the given []string and assigns it to the TlsProtocols field. func (o *InstanceParameters) SetTlsProtocols(v InstanceParametersGetTlsProtocolsRetType) { setInstanceParametersGetTlsProtocolsAttributeType(&o.TlsProtocols, v) } diff --git a/services/rabbitmq/model_instance_parameters_test.go b/services/rabbitmq/model_instance_parameters_test.go index 8e03cab41..36793fa7a 100644 --- a/services/rabbitmq/model_instance_parameters_test.go +++ b/services/rabbitmq/model_instance_parameters_test.go @@ -9,50 +9,3 @@ API version: 1.1.0 // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. package rabbitmq - -import ( - "testing" -) - -// isEnum - -func TestInstanceParametersTlsProtocols_UnmarshalJSON(t *testing.T) { - type args struct { - src []byte - } - tests := []struct { - name string - args args - wantErr bool - }{ - { - name: `success - possible enum value no. 1`, - args: args{ - src: []byte(`"tlsv1.2"`), - }, - wantErr: false, - }, - { - name: `success - possible enum value no. 2`, - args: args{ - src: []byte(`"tlsv1.3"`), - }, - wantErr: false, - }, - { - name: "fail", - args: args{ - src: []byte("\"FOOBAR\""), - }, - wantErr: true, - }, - } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - v := InstanceParametersTlsProtocols("") - if err := v.UnmarshalJSON(tt.args.src); (err != nil) != tt.wantErr { - t.Errorf("UnmarshalJSON() error = %v, wantErr %v", err, tt.wantErr) - } - }) - } -} diff --git a/services/rabbitmq/oas_commit b/services/rabbitmq/oas_commit new file mode 100644 index 000000000..b5eeb3597 --- /dev/null +++ b/services/rabbitmq/oas_commit @@ -0,0 +1 @@ +4015d2570616297d92f852b84f352e729a4370ba