diff --git a/services/sfs/oas_commit b/services/sfs/oas_commit index 71a76821d4..6a8ba08d49 100644 --- a/services/sfs/oas_commit +++ b/services/sfs/oas_commit @@ -1 +1 @@ -0afa5e4924e6bf230fdade5cb294ecfd97dd63e5 +ef9232ba8d49c72fc3397a365b09ca1a8205b25e diff --git a/services/sfs/v1api/api_default.go b/services/sfs/v1api/api_default.go index d8abfec3f4..207925cd3e 100644 --- a/services/sfs/v1api/api_default.go +++ b/services/sfs/v1api/api_default.go @@ -635,6 +635,17 @@ func (a *DefaultAPIService) CreateResourcePoolExecute(r ApiCreateResourcePoolReq newErr.Model = v return localVarReturnValue, newErr } + if localVarHTTPResponse.StatusCode == 409 { + var v ConflictError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } if localVarHTTPResponse.StatusCode == 500 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) @@ -801,6 +812,17 @@ func (a *DefaultAPIService) CreateResourcePoolSnapshotExecute(r ApiCreateResourc newErr.Model = v return localVarReturnValue, newErr } + if localVarHTTPResponse.StatusCode == 409 { + var v ConflictError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } if localVarHTTPResponse.StatusCode == 500 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) @@ -967,6 +989,17 @@ func (a *DefaultAPIService) CreateShareExecute(r ApiCreateShareRequest) (*Create newErr.Model = v return localVarReturnValue, newErr } + if localVarHTTPResponse.StatusCode == 409 { + var v ConflictError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } if localVarHTTPResponse.StatusCode == 500 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) @@ -1129,6 +1162,17 @@ func (a *DefaultAPIService) CreateShareExportPolicyExecute(r ApiCreateShareExpor newErr.Model = v return localVarReturnValue, newErr } + if localVarHTTPResponse.StatusCode == 409 { + var v ConflictError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } if localVarHTTPResponse.StatusCode == 500 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) @@ -1284,6 +1328,17 @@ func (a *DefaultAPIService) DeleteResourcePoolExecute(r ApiDeleteResourcePoolReq newErr.Model = v return localVarReturnValue, newErr } + if localVarHTTPResponse.StatusCode == 409 { + var v ConflictError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } if localVarHTTPResponse.StatusCode == 500 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) @@ -1443,6 +1498,17 @@ func (a *DefaultAPIService) DeleteResourcePoolSnapshotExecute(r ApiDeleteResourc newErr.Model = v return localVarReturnValue, newErr } + if localVarHTTPResponse.StatusCode == 409 { + var v ConflictError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } if localVarHTTPResponse.StatusCode == 500 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) @@ -1847,7 +1913,7 @@ func (a *DefaultAPIService) DisableLockExecute(r ApiDisableLockRequest) (map[str } // to determine the Accept header - localVarHTTPHeaderAccepts := []string{"application/json"} + localVarHTTPHeaderAccepts := []string{"application/json", "application/problem+json"} // set Accept header localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) @@ -1886,6 +1952,17 @@ func (a *DefaultAPIService) DisableLockExecute(r ApiDisableLockRequest) (map[str ErrorMessage: localVarHTTPResponse.Status, StatusCode: localVarHTTPResponse.StatusCode, } + if localVarHTTPResponse.StatusCode == 409 { + var v ConflictError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } var v Status err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { @@ -1974,7 +2051,7 @@ func (a *DefaultAPIService) EnableLockExecute(r ApiEnableLockRequest) (*EnableLo } // to determine the Accept header - localVarHTTPHeaderAccepts := []string{"application/json"} + localVarHTTPHeaderAccepts := []string{"application/json", "application/problem+json"} // set Accept header localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) @@ -2013,6 +2090,17 @@ func (a *DefaultAPIService) EnableLockExecute(r ApiEnableLockRequest) (*EnableLo ErrorMessage: localVarHTTPResponse.Status, StatusCode: localVarHTTPResponse.StatusCode, } + if localVarHTTPResponse.StatusCode == 409 { + var v ConflictError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } var v Status err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { @@ -4196,6 +4284,17 @@ func (a *DefaultAPIService) UpdateResourcePoolExecute(r ApiUpdateResourcePoolReq newErr.Model = v return localVarReturnValue, newErr } + if localVarHTTPResponse.StatusCode == 409 { + var v ConflictError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } if localVarHTTPResponse.StatusCode == 500 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) diff --git a/services/sfs/v1api/model_conflict_error.go b/services/sfs/v1api/model_conflict_error.go new file mode 100644 index 0000000000..3c02bb1524 --- /dev/null +++ b/services/sfs/v1api/model_conflict_error.go @@ -0,0 +1,257 @@ +/* +STACKIT File Storage (SFS) + +API used to create and manage NFS Shares. + +API version: 1.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1api + +import ( + "encoding/json" + "fmt" +) + +// checks if the ConflictError type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ConflictError{} + +// ConflictError Conflict error response +type ConflictError struct { + // Human-readable explanation of the specific problem + Detail string `json:"detail"` + // Human-readable string of the error that occurred + ErrorDescription string `json:"error_description"` + // The HTTP status code + StatusCode int32 `json:"status_code"` + // URI Uniquely identifies the error type. It will be in the format of storage.stackit.cloud/ e.g. storage.stackit.cloud/conflict + Type string `json:"type"` + AdditionalProperties map[string]interface{} +} + +type _ConflictError ConflictError + +// NewConflictError instantiates a new ConflictError object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewConflictError(detail string, errorDescription string, statusCode int32, types string) *ConflictError { + this := ConflictError{} + this.Detail = detail + this.ErrorDescription = errorDescription + this.StatusCode = statusCode + this.Type = types + return &this +} + +// NewConflictErrorWithDefaults instantiates a new ConflictError object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewConflictErrorWithDefaults() *ConflictError { + this := ConflictError{} + return &this +} + +// GetDetail returns the Detail field value +func (o *ConflictError) GetDetail() string { + if o == nil { + var ret string + return ret + } + + return o.Detail +} + +// GetDetailOk returns a tuple with the Detail field value +// and a boolean to check if the value has been set. +func (o *ConflictError) GetDetailOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Detail, true +} + +// SetDetail sets field value +func (o *ConflictError) SetDetail(v string) { + o.Detail = v +} + +// GetErrorDescription returns the ErrorDescription field value +func (o *ConflictError) GetErrorDescription() string { + if o == nil { + var ret string + return ret + } + + return o.ErrorDescription +} + +// GetErrorDescriptionOk returns a tuple with the ErrorDescription field value +// and a boolean to check if the value has been set. +func (o *ConflictError) GetErrorDescriptionOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.ErrorDescription, true +} + +// SetErrorDescription sets field value +func (o *ConflictError) SetErrorDescription(v string) { + o.ErrorDescription = v +} + +// GetStatusCode returns the StatusCode field value +func (o *ConflictError) GetStatusCode() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.StatusCode +} + +// GetStatusCodeOk returns a tuple with the StatusCode field value +// and a boolean to check if the value has been set. +func (o *ConflictError) GetStatusCodeOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.StatusCode, true +} + +// SetStatusCode sets field value +func (o *ConflictError) SetStatusCode(v int32) { + o.StatusCode = v +} + +// GetType returns the Type field value +func (o *ConflictError) GetType() string { + if o == nil { + var ret string + return ret + } + + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *ConflictError) GetTypeOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value +func (o *ConflictError) SetType(v string) { + o.Type = v +} + +func (o ConflictError) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ConflictError) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["detail"] = o.Detail + toSerialize["error_description"] = o.ErrorDescription + toSerialize["status_code"] = o.StatusCode + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *ConflictError) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "detail", + "error_description", + "status_code", + "type", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varConflictError := _ConflictError{} + + err = json.Unmarshal(data, &varConflictError) + + if err != nil { + return err + } + + *o = ConflictError(varConflictError) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "detail") + delete(additionalProperties, "error_description") + delete(additionalProperties, "status_code") + delete(additionalProperties, "type") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableConflictError struct { + value *ConflictError + isSet bool +} + +func (v NullableConflictError) Get() *ConflictError { + return v.value +} + +func (v *NullableConflictError) Set(val *ConflictError) { + v.value = val + v.isSet = true +} + +func (v NullableConflictError) IsSet() bool { + return v.isSet +} + +func (v *NullableConflictError) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableConflictError(val *ConflictError) *NullableConflictError { + return &NullableConflictError{value: val, isSet: true} +} + +func (v NullableConflictError) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableConflictError) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/sfs/v1betaapi/api_default.go b/services/sfs/v1betaapi/api_default.go index 5d10e2b8ac..604a664ab2 100644 --- a/services/sfs/v1betaapi/api_default.go +++ b/services/sfs/v1betaapi/api_default.go @@ -516,6 +516,17 @@ func (a *DefaultAPIService) CreateResourcePoolExecute(r ApiCreateResourcePoolReq newErr.Model = v return localVarReturnValue, newErr } + if localVarHTTPResponse.StatusCode == 409 { + var v ConflictError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } if localVarHTTPResponse.StatusCode == 500 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) @@ -682,6 +693,17 @@ func (a *DefaultAPIService) CreateResourcePoolSnapshotExecute(r ApiCreateResourc newErr.Model = v return localVarReturnValue, newErr } + if localVarHTTPResponse.StatusCode == 409 { + var v ConflictError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } if localVarHTTPResponse.StatusCode == 500 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) @@ -848,6 +870,17 @@ func (a *DefaultAPIService) CreateShareExecute(r ApiCreateShareRequest) (*Create newErr.Model = v return localVarReturnValue, newErr } + if localVarHTTPResponse.StatusCode == 409 { + var v ConflictError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } if localVarHTTPResponse.StatusCode == 500 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) @@ -1010,6 +1043,17 @@ func (a *DefaultAPIService) CreateShareExportPolicyExecute(r ApiCreateShareExpor newErr.Model = v return localVarReturnValue, newErr } + if localVarHTTPResponse.StatusCode == 409 { + var v ConflictError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } if localVarHTTPResponse.StatusCode == 500 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) @@ -1165,6 +1209,17 @@ func (a *DefaultAPIService) DeleteResourcePoolExecute(r ApiDeleteResourcePoolReq newErr.Model = v return localVarReturnValue, newErr } + if localVarHTTPResponse.StatusCode == 409 { + var v ConflictError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } if localVarHTTPResponse.StatusCode == 500 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) @@ -1324,6 +1379,17 @@ func (a *DefaultAPIService) DeleteResourcePoolSnapshotExecute(r ApiDeleteResourc newErr.Model = v return localVarReturnValue, newErr } + if localVarHTTPResponse.StatusCode == 409 { + var v ConflictError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } if localVarHTTPResponse.StatusCode == 500 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) @@ -3334,6 +3400,17 @@ func (a *DefaultAPIService) UpdateResourcePoolExecute(r ApiUpdateResourcePoolReq newErr.Model = v return localVarReturnValue, newErr } + if localVarHTTPResponse.StatusCode == 409 { + var v ConflictError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } if localVarHTTPResponse.StatusCode == 500 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) diff --git a/services/sfs/v1betaapi/model_conflict_error.go b/services/sfs/v1betaapi/model_conflict_error.go new file mode 100644 index 0000000000..351960c8c3 --- /dev/null +++ b/services/sfs/v1betaapi/model_conflict_error.go @@ -0,0 +1,257 @@ +/* +STACKIT File Storage (SFS) + +API used to create and manage NFS Shares. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1betaapi + +import ( + "encoding/json" + "fmt" +) + +// checks if the ConflictError type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ConflictError{} + +// ConflictError Conflict error response +type ConflictError struct { + // Human-readable explanation of the specific problem + Detail string `json:"detail"` + // Human-readable string of the error that occurred + ErrorDescription string `json:"error_description"` + // The HTTP status code + StatusCode int32 `json:"status_code"` + // URI Uniquely identifies the error type. It will be in the format of storage.stackit.cloud/ e.g. storage.stackit.cloud/conflict + Type string `json:"type"` + AdditionalProperties map[string]interface{} +} + +type _ConflictError ConflictError + +// NewConflictError instantiates a new ConflictError object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewConflictError(detail string, errorDescription string, statusCode int32, types string) *ConflictError { + this := ConflictError{} + this.Detail = detail + this.ErrorDescription = errorDescription + this.StatusCode = statusCode + this.Type = types + return &this +} + +// NewConflictErrorWithDefaults instantiates a new ConflictError object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewConflictErrorWithDefaults() *ConflictError { + this := ConflictError{} + return &this +} + +// GetDetail returns the Detail field value +func (o *ConflictError) GetDetail() string { + if o == nil { + var ret string + return ret + } + + return o.Detail +} + +// GetDetailOk returns a tuple with the Detail field value +// and a boolean to check if the value has been set. +func (o *ConflictError) GetDetailOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Detail, true +} + +// SetDetail sets field value +func (o *ConflictError) SetDetail(v string) { + o.Detail = v +} + +// GetErrorDescription returns the ErrorDescription field value +func (o *ConflictError) GetErrorDescription() string { + if o == nil { + var ret string + return ret + } + + return o.ErrorDescription +} + +// GetErrorDescriptionOk returns a tuple with the ErrorDescription field value +// and a boolean to check if the value has been set. +func (o *ConflictError) GetErrorDescriptionOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.ErrorDescription, true +} + +// SetErrorDescription sets field value +func (o *ConflictError) SetErrorDescription(v string) { + o.ErrorDescription = v +} + +// GetStatusCode returns the StatusCode field value +func (o *ConflictError) GetStatusCode() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.StatusCode +} + +// GetStatusCodeOk returns a tuple with the StatusCode field value +// and a boolean to check if the value has been set. +func (o *ConflictError) GetStatusCodeOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.StatusCode, true +} + +// SetStatusCode sets field value +func (o *ConflictError) SetStatusCode(v int32) { + o.StatusCode = v +} + +// GetType returns the Type field value +func (o *ConflictError) GetType() string { + if o == nil { + var ret string + return ret + } + + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *ConflictError) GetTypeOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value +func (o *ConflictError) SetType(v string) { + o.Type = v +} + +func (o ConflictError) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ConflictError) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["detail"] = o.Detail + toSerialize["error_description"] = o.ErrorDescription + toSerialize["status_code"] = o.StatusCode + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *ConflictError) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "detail", + "error_description", + "status_code", + "type", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varConflictError := _ConflictError{} + + err = json.Unmarshal(data, &varConflictError) + + if err != nil { + return err + } + + *o = ConflictError(varConflictError) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "detail") + delete(additionalProperties, "error_description") + delete(additionalProperties, "status_code") + delete(additionalProperties, "type") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableConflictError struct { + value *ConflictError + isSet bool +} + +func (v NullableConflictError) Get() *ConflictError { + return v.value +} + +func (v *NullableConflictError) Set(val *ConflictError) { + v.value = val + v.isSet = true +} + +func (v NullableConflictError) IsSet() bool { + return v.isSet +} + +func (v *NullableConflictError) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableConflictError(val *ConflictError) *NullableConflictError { + return &NullableConflictError{value: val, isSet: true} +} + +func (v NullableConflictError) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableConflictError) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +}