diff --git a/services/dns/oas_commit b/services/dns/oas_commit index 71a76821d4..6fff488f70 100644 --- a/services/dns/oas_commit +++ b/services/dns/oas_commit @@ -1 +1 @@ -0afa5e4924e6bf230fdade5cb294ecfd97dd63e5 +3ee9e14e4c6744979b66c4dacc822feba649fb0e diff --git a/services/dns/v1api/api_default.go b/services/dns/v1api/api_default.go index 46d65f282b..7f777b4a00 100644 --- a/services/dns/v1api/api_default.go +++ b/services/dns/v1api/api_default.go @@ -175,6 +175,20 @@ type DefaultAPI interface { // @return Message DeleteZoneExecute(r ApiDeleteZoneRequest) (*Message, error) + /* + Dnslookup DNS Lookup Route + + allows the user to lookup a domain on the STACKIT DNS Resolvers + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiDnslookupRequest + */ + Dnslookup(ctx context.Context) ApiDnslookupRequest + + // DnslookupExecute executes the request + // @return DnslookupLookupResponse + DnslookupExecute(r ApiDnslookupRequest) (*DnslookupLookupResponse, error) + /* ExportRecordSets Export all records in a single zone @@ -191,6 +205,20 @@ type DefaultAPI interface { // @return ZoneDataExchange ExportRecordSetsExecute(r ApiExportRecordSetsRequest) (*ZoneDataExchange, error) + /* + Flush Flush Route + + allows the user to flush the cache for a domain on the STACKIT DNS Resolvers + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiFlushRequest + */ + Flush(ctx context.Context) ApiFlushRequest + + // FlushExecute executes the request + // @return FlushCreateFlushResponse + FlushExecute(r ApiFlushRequest) (*FlushCreateFlushResponse, error) + /* GetRecordSet Get a single rrset @@ -1995,6 +2023,161 @@ func (a *DefaultAPIService) DeleteZoneExecute(r ApiDeleteZoneRequest) (*Message, return localVarReturnValue, nil } +type ApiDnslookupRequest struct { + ctx context.Context + ApiService DefaultAPI + dnslookupPayload *DnslookupPayload +} + +// records to lookup +func (r ApiDnslookupRequest) DnslookupPayload(dnslookupPayload DnslookupPayload) ApiDnslookupRequest { + r.dnslookupPayload = &dnslookupPayload + return r +} + +func (r ApiDnslookupRequest) Execute() (*DnslookupLookupResponse, error) { + return r.ApiService.DnslookupExecute(r) +} + +/* +Dnslookup DNS Lookup Route + +allows the user to lookup a domain on the STACKIT DNS Resolvers + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiDnslookupRequest +*/ +func (a *DefaultAPIService) Dnslookup(ctx context.Context) ApiDnslookupRequest { + return ApiDnslookupRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// +// @return DnslookupLookupResponse +func (a *DefaultAPIService) DnslookupExecute(r ApiDnslookupRequest) (*DnslookupLookupResponse, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *DnslookupLookupResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.Dnslookup") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1/dnslookup" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.dnslookupPayload == nil { + return localVarReturnValue, reportError("dnslookupPayload is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.dnslookupPayload + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := a.client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + StatusCode: localVarHTTPResponse.StatusCode, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Message + 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 == 401 { + var v ErrorMessage + 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 == 502 { + var v Message + 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 + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + type ApiExportRecordSetsRequest struct { ctx context.Context ApiService DefaultAPI @@ -2158,6 +2341,161 @@ func (a *DefaultAPIService) ExportRecordSetsExecute(r ApiExportRecordSetsRequest return localVarReturnValue, nil } +type ApiFlushRequest struct { + ctx context.Context + ApiService DefaultAPI + flushPayload *FlushPayload +} + +// domain to flush +func (r ApiFlushRequest) FlushPayload(flushPayload FlushPayload) ApiFlushRequest { + r.flushPayload = &flushPayload + return r +} + +func (r ApiFlushRequest) Execute() (*FlushCreateFlushResponse, error) { + return r.ApiService.FlushExecute(r) +} + +/* +Flush Flush Route + +allows the user to flush the cache for a domain on the STACKIT DNS Resolvers + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiFlushRequest +*/ +func (a *DefaultAPIService) Flush(ctx context.Context) ApiFlushRequest { + return ApiFlushRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// +// @return FlushCreateFlushResponse +func (a *DefaultAPIService) FlushExecute(r ApiFlushRequest) (*FlushCreateFlushResponse, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *FlushCreateFlushResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.Flush") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1/resolver/flush" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.flushPayload == nil { + return localVarReturnValue, reportError("flushPayload is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.flushPayload + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := a.client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + StatusCode: localVarHTTPResponse.StatusCode, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Message + 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 == 401 { + var v ErrorMessage + 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 == 502 { + var v Message + 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 + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + type ApiGetRecordSetRequest struct { ctx context.Context ApiService DefaultAPI diff --git a/services/dns/v1api/api_default_mock.go b/services/dns/v1api/api_default_mock.go index 6f3bcf76a0..eb8eed5033 100644 --- a/services/dns/v1api/api_default_mock.go +++ b/services/dns/v1api/api_default_mock.go @@ -39,8 +39,12 @@ type DefaultAPIServiceMock struct { DeleteRecordSetExecuteMock *func(r ApiDeleteRecordSetRequest) (*Message, error) // DeleteZoneExecuteMock can be populated to implement the behavior of the DeleteZoneExecute function of this mock DeleteZoneExecuteMock *func(r ApiDeleteZoneRequest) (*Message, error) + // DnslookupExecuteMock can be populated to implement the behavior of the DnslookupExecute function of this mock + DnslookupExecuteMock *func(r ApiDnslookupRequest) (*DnslookupLookupResponse, error) // ExportRecordSetsExecuteMock can be populated to implement the behavior of the ExportRecordSetsExecute function of this mock ExportRecordSetsExecuteMock *func(r ApiExportRecordSetsRequest) (*ZoneDataExchange, error) + // FlushExecuteMock can be populated to implement the behavior of the FlushExecute function of this mock + FlushExecuteMock *func(r ApiFlushRequest) (*FlushCreateFlushResponse, error) // GetRecordSetExecuteMock can be populated to implement the behavior of the GetRecordSetExecute function of this mock GetRecordSetExecuteMock *func(r ApiGetRecordSetRequest) (*RecordSetResponse, error) // GetZoneExecuteMock can be populated to implement the behavior of the GetZoneExecute function of this mock @@ -245,6 +249,23 @@ func (a DefaultAPIServiceMock) DeleteZoneExecute(r ApiDeleteZoneRequest) (*Messa return (*a.DeleteZoneExecuteMock)(r) } +func (a DefaultAPIServiceMock) Dnslookup(ctx context.Context) ApiDnslookupRequest { + return ApiDnslookupRequest{ + ApiService: a, + ctx: ctx, + } +} + +// DnslookupExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the DnslookupExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) DnslookupExecute(r ApiDnslookupRequest) (*DnslookupLookupResponse, error) { + if a.DnslookupExecuteMock == nil { + var localVarReturnValue *DnslookupLookupResponse + return localVarReturnValue, nil + } + + return (*a.DnslookupExecuteMock)(r) +} + func (a DefaultAPIServiceMock) ExportRecordSets(ctx context.Context, projectId string, zoneId string) ApiExportRecordSetsRequest { return ApiExportRecordSetsRequest{ ApiService: a, @@ -264,6 +285,23 @@ func (a DefaultAPIServiceMock) ExportRecordSetsExecute(r ApiExportRecordSetsRequ return (*a.ExportRecordSetsExecuteMock)(r) } +func (a DefaultAPIServiceMock) Flush(ctx context.Context) ApiFlushRequest { + return ApiFlushRequest{ + ApiService: a, + ctx: ctx, + } +} + +// FlushExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the FlushExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) FlushExecute(r ApiFlushRequest) (*FlushCreateFlushResponse, error) { + if a.FlushExecuteMock == nil { + var localVarReturnValue *FlushCreateFlushResponse + return localVarReturnValue, nil + } + + return (*a.FlushExecuteMock)(r) +} + func (a DefaultAPIServiceMock) GetRecordSet(ctx context.Context, projectId string, zoneId string, rrSetId string) ApiGetRecordSetRequest { return ApiGetRecordSetRequest{ ApiService: a, diff --git a/services/dns/v1api/model_dnslookup_lookup_response.go b/services/dns/v1api/model_dnslookup_lookup_response.go new file mode 100644 index 0000000000..7758480f29 --- /dev/null +++ b/services/dns/v1api/model_dnslookup_lookup_response.go @@ -0,0 +1,191 @@ +/* +STACKIT DNS API + +This api provides dns + +API version: 1.0 +Contact: dns@stackit.cloud +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1api + +import ( + "encoding/json" +) + +// checks if the DnslookupLookupResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &DnslookupLookupResponse{} + +// DnslookupLookupResponse struct for DnslookupLookupResponse +type DnslookupLookupResponse struct { + Message *string `json:"message,omitempty"` + State []DnslookupModelsLookupResult `json:"state,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _DnslookupLookupResponse DnslookupLookupResponse + +// NewDnslookupLookupResponse instantiates a new DnslookupLookupResponse 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 NewDnslookupLookupResponse() *DnslookupLookupResponse { + this := DnslookupLookupResponse{} + return &this +} + +// NewDnslookupLookupResponseWithDefaults instantiates a new DnslookupLookupResponse 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 NewDnslookupLookupResponseWithDefaults() *DnslookupLookupResponse { + this := DnslookupLookupResponse{} + return &this +} + +// GetMessage returns the Message field value if set, zero value otherwise. +func (o *DnslookupLookupResponse) GetMessage() string { + if o == nil || IsNil(o.Message) { + var ret string + return ret + } + return *o.Message +} + +// GetMessageOk returns a tuple with the Message field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DnslookupLookupResponse) GetMessageOk() (*string, bool) { + if o == nil || IsNil(o.Message) { + return nil, false + } + return o.Message, true +} + +// HasMessage returns a boolean if a field has been set. +func (o *DnslookupLookupResponse) HasMessage() bool { + if o != nil && !IsNil(o.Message) { + return true + } + + return false +} + +// SetMessage gets a reference to the given string and assigns it to the Message field. +func (o *DnslookupLookupResponse) SetMessage(v string) { + o.Message = &v +} + +// GetState returns the State field value if set, zero value otherwise. +func (o *DnslookupLookupResponse) GetState() []DnslookupModelsLookupResult { + if o == nil || IsNil(o.State) { + var ret []DnslookupModelsLookupResult + return ret + } + return o.State +} + +// GetStateOk returns a tuple with the State field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DnslookupLookupResponse) GetStateOk() ([]DnslookupModelsLookupResult, bool) { + if o == nil || IsNil(o.State) { + return nil, false + } + return o.State, true +} + +// HasState returns a boolean if a field has been set. +func (o *DnslookupLookupResponse) HasState() bool { + if o != nil && !IsNil(o.State) { + return true + } + + return false +} + +// SetState gets a reference to the given []DnslookupModelsLookupResult and assigns it to the State field. +func (o *DnslookupLookupResponse) SetState(v []DnslookupModelsLookupResult) { + o.State = v +} + +func (o DnslookupLookupResponse) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o DnslookupLookupResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Message) { + toSerialize["message"] = o.Message + } + if !IsNil(o.State) { + toSerialize["state"] = o.State + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *DnslookupLookupResponse) UnmarshalJSON(data []byte) (err error) { + varDnslookupLookupResponse := _DnslookupLookupResponse{} + + err = json.Unmarshal(data, &varDnslookupLookupResponse) + + if err != nil { + return err + } + + *o = DnslookupLookupResponse(varDnslookupLookupResponse) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "message") + delete(additionalProperties, "state") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableDnslookupLookupResponse struct { + value *DnslookupLookupResponse + isSet bool +} + +func (v NullableDnslookupLookupResponse) Get() *DnslookupLookupResponse { + return v.value +} + +func (v *NullableDnslookupLookupResponse) Set(val *DnslookupLookupResponse) { + v.value = val + v.isSet = true +} + +func (v NullableDnslookupLookupResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableDnslookupLookupResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableDnslookupLookupResponse(val *DnslookupLookupResponse) *NullableDnslookupLookupResponse { + return &NullableDnslookupLookupResponse{value: val, isSet: true} +} + +func (v NullableDnslookupLookupResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableDnslookupLookupResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/dns/v1api/model_dnslookup_models_lookup_record.go b/services/dns/v1api/model_dnslookup_models_lookup_record.go new file mode 100644 index 0000000000..3b170a3c98 --- /dev/null +++ b/services/dns/v1api/model_dnslookup_models_lookup_record.go @@ -0,0 +1,268 @@ +/* +STACKIT DNS API + +This api provides dns + +API version: 1.0 +Contact: dns@stackit.cloud +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1api + +import ( + "encoding/json" +) + +// checks if the DnslookupModelsLookupRecord type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &DnslookupModelsLookupRecord{} + +// DnslookupModelsLookupRecord struct for DnslookupModelsLookupRecord +type DnslookupModelsLookupRecord struct { + // Data contains the record-specific data (e.g., IP address for A records) + Data *string `json:"data,omitempty"` + // Name is the domain name to which this record applies + Name *string `json:"name,omitempty"` + // TTL (Time To Live) is the duration in seconds that the record may be cached + Ttl *int32 `json:"ttl,omitempty"` + Type *DnslookupModelsLookupRecordType `json:"type,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _DnslookupModelsLookupRecord DnslookupModelsLookupRecord + +// NewDnslookupModelsLookupRecord instantiates a new DnslookupModelsLookupRecord 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 NewDnslookupModelsLookupRecord() *DnslookupModelsLookupRecord { + this := DnslookupModelsLookupRecord{} + return &this +} + +// NewDnslookupModelsLookupRecordWithDefaults instantiates a new DnslookupModelsLookupRecord 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 NewDnslookupModelsLookupRecordWithDefaults() *DnslookupModelsLookupRecord { + this := DnslookupModelsLookupRecord{} + return &this +} + +// GetData returns the Data field value if set, zero value otherwise. +func (o *DnslookupModelsLookupRecord) GetData() string { + if o == nil || IsNil(o.Data) { + var ret string + return ret + } + return *o.Data +} + +// GetDataOk returns a tuple with the Data field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DnslookupModelsLookupRecord) GetDataOk() (*string, bool) { + if o == nil || IsNil(o.Data) { + return nil, false + } + return o.Data, true +} + +// HasData returns a boolean if a field has been set. +func (o *DnslookupModelsLookupRecord) HasData() bool { + if o != nil && !IsNil(o.Data) { + return true + } + + return false +} + +// SetData gets a reference to the given string and assigns it to the Data field. +func (o *DnslookupModelsLookupRecord) SetData(v string) { + o.Data = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *DnslookupModelsLookupRecord) GetName() string { + if o == nil || IsNil(o.Name) { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DnslookupModelsLookupRecord) GetNameOk() (*string, bool) { + if o == nil || IsNil(o.Name) { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *DnslookupModelsLookupRecord) HasName() bool { + if o != nil && !IsNil(o.Name) { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *DnslookupModelsLookupRecord) SetName(v string) { + o.Name = &v +} + +// GetTtl returns the Ttl field value if set, zero value otherwise. +func (o *DnslookupModelsLookupRecord) GetTtl() int32 { + if o == nil || IsNil(o.Ttl) { + var ret int32 + return ret + } + return *o.Ttl +} + +// GetTtlOk returns a tuple with the Ttl field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DnslookupModelsLookupRecord) GetTtlOk() (*int32, bool) { + if o == nil || IsNil(o.Ttl) { + return nil, false + } + return o.Ttl, true +} + +// HasTtl returns a boolean if a field has been set. +func (o *DnslookupModelsLookupRecord) HasTtl() bool { + if o != nil && !IsNil(o.Ttl) { + return true + } + + return false +} + +// SetTtl gets a reference to the given int32 and assigns it to the Ttl field. +func (o *DnslookupModelsLookupRecord) SetTtl(v int32) { + o.Ttl = &v +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *DnslookupModelsLookupRecord) GetType() DnslookupModelsLookupRecordType { + if o == nil || IsNil(o.Type) { + var ret DnslookupModelsLookupRecordType + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DnslookupModelsLookupRecord) GetTypeOk() (*DnslookupModelsLookupRecordType, bool) { + if o == nil || IsNil(o.Type) { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *DnslookupModelsLookupRecord) HasType() bool { + if o != nil && !IsNil(o.Type) { + return true + } + + return false +} + +// SetType gets a reference to the given DnslookupModelsLookupRecordType and assigns it to the Type field. +func (o *DnslookupModelsLookupRecord) SetType(v DnslookupModelsLookupRecordType) { + o.Type = &v +} + +func (o DnslookupModelsLookupRecord) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o DnslookupModelsLookupRecord) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Data) { + toSerialize["data"] = o.Data + } + if !IsNil(o.Name) { + toSerialize["name"] = o.Name + } + if !IsNil(o.Ttl) { + toSerialize["ttl"] = o.Ttl + } + if !IsNil(o.Type) { + toSerialize["type"] = o.Type + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *DnslookupModelsLookupRecord) UnmarshalJSON(data []byte) (err error) { + varDnslookupModelsLookupRecord := _DnslookupModelsLookupRecord{} + + err = json.Unmarshal(data, &varDnslookupModelsLookupRecord) + + if err != nil { + return err + } + + *o = DnslookupModelsLookupRecord(varDnslookupModelsLookupRecord) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "data") + delete(additionalProperties, "name") + delete(additionalProperties, "ttl") + delete(additionalProperties, "type") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableDnslookupModelsLookupRecord struct { + value *DnslookupModelsLookupRecord + isSet bool +} + +func (v NullableDnslookupModelsLookupRecord) Get() *DnslookupModelsLookupRecord { + return v.value +} + +func (v *NullableDnslookupModelsLookupRecord) Set(val *DnslookupModelsLookupRecord) { + v.value = val + v.isSet = true +} + +func (v NullableDnslookupModelsLookupRecord) IsSet() bool { + return v.isSet +} + +func (v *NullableDnslookupModelsLookupRecord) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableDnslookupModelsLookupRecord(val *DnslookupModelsLookupRecord) *NullableDnslookupModelsLookupRecord { + return &NullableDnslookupModelsLookupRecord{value: val, isSet: true} +} + +func (v NullableDnslookupModelsLookupRecord) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableDnslookupModelsLookupRecord) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/dns/v1api/model_dnslookup_models_lookup_record_type.go b/services/dns/v1api/model_dnslookup_models_lookup_record_type.go new file mode 100644 index 0000000000..687865a965 --- /dev/null +++ b/services/dns/v1api/model_dnslookup_models_lookup_record_type.go @@ -0,0 +1,160 @@ +/* +STACKIT DNS API + +This api provides dns + +API version: 1.0 +Contact: dns@stackit.cloud +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1api + +import ( + "encoding/json" + "fmt" +) + +// DnslookupModelsLookupRecordType Type is the DNS record type (A, AAAA, MX, etc.) +type DnslookupModelsLookupRecordType string + +// List of dnslookup_models_LookupRecord_type +const ( + DNSLOOKUPMODELSLOOKUPRECORDTYPE_A DnslookupModelsLookupRecordType = "A" + DNSLOOKUPMODELSLOOKUPRECORDTYPE_AAAA DnslookupModelsLookupRecordType = "AAAA" + DNSLOOKUPMODELSLOOKUPRECORDTYPE_SOA DnslookupModelsLookupRecordType = "SOA" + DNSLOOKUPMODELSLOOKUPRECORDTYPE_CNAME DnslookupModelsLookupRecordType = "CNAME" + DNSLOOKUPMODELSLOOKUPRECORDTYPE_NS DnslookupModelsLookupRecordType = "NS" + DNSLOOKUPMODELSLOOKUPRECORDTYPE_MX DnslookupModelsLookupRecordType = "MX" + DNSLOOKUPMODELSLOOKUPRECORDTYPE_TXT DnslookupModelsLookupRecordType = "TXT" + DNSLOOKUPMODELSLOOKUPRECORDTYPE_SRV DnslookupModelsLookupRecordType = "SRV" + DNSLOOKUPMODELSLOOKUPRECORDTYPE_PTR DnslookupModelsLookupRecordType = "PTR" + DNSLOOKUPMODELSLOOKUPRECORDTYPE_ALIAS DnslookupModelsLookupRecordType = "ALIAS" + DNSLOOKUPMODELSLOOKUPRECORDTYPE_DNAME DnslookupModelsLookupRecordType = "DNAME" + DNSLOOKUPMODELSLOOKUPRECORDTYPE_CAA DnslookupModelsLookupRecordType = "CAA" + DNSLOOKUPMODELSLOOKUPRECORDTYPE_DNSKEY DnslookupModelsLookupRecordType = "DNSKEY" + DNSLOOKUPMODELSLOOKUPRECORDTYPE_DS DnslookupModelsLookupRecordType = "DS" + DNSLOOKUPMODELSLOOKUPRECORDTYPE_LOC DnslookupModelsLookupRecordType = "LOC" + DNSLOOKUPMODELSLOOKUPRECORDTYPE_NAPTR DnslookupModelsLookupRecordType = "NAPTR" + DNSLOOKUPMODELSLOOKUPRECORDTYPE_SSHFP DnslookupModelsLookupRecordType = "SSHFP" + DNSLOOKUPMODELSLOOKUPRECORDTYPE_TLSA DnslookupModelsLookupRecordType = "TLSA" + DNSLOOKUPMODELSLOOKUPRECORDTYPE_URI DnslookupModelsLookupRecordType = "URI" + DNSLOOKUPMODELSLOOKUPRECORDTYPE_CERT DnslookupModelsLookupRecordType = "CERT" + DNSLOOKUPMODELSLOOKUPRECORDTYPE_SVCB DnslookupModelsLookupRecordType = "SVCB" + DNSLOOKUPMODELSLOOKUPRECORDTYPE_TYPE DnslookupModelsLookupRecordType = "TYPE" + DNSLOOKUPMODELSLOOKUPRECORDTYPE_CSYNC DnslookupModelsLookupRecordType = "CSYNC" + DNSLOOKUPMODELSLOOKUPRECORDTYPE_HINFO DnslookupModelsLookupRecordType = "HINFO" + DNSLOOKUPMODELSLOOKUPRECORDTYPE_HTTPS DnslookupModelsLookupRecordType = "HTTPS" + DNSLOOKUPMODELSLOOKUPRECORDTYPE_UNKNOWN_DEFAULT_OPEN_API DnslookupModelsLookupRecordType = "unknown_default_open_api" +) + +// All allowed values of DnslookupModelsLookupRecordType enum +var AllowedDnslookupModelsLookupRecordTypeEnumValues = []DnslookupModelsLookupRecordType{ + "A", + "AAAA", + "SOA", + "CNAME", + "NS", + "MX", + "TXT", + "SRV", + "PTR", + "ALIAS", + "DNAME", + "CAA", + "DNSKEY", + "DS", + "LOC", + "NAPTR", + "SSHFP", + "TLSA", + "URI", + "CERT", + "SVCB", + "TYPE", + "CSYNC", + "HINFO", + "HTTPS", + "unknown_default_open_api", +} + +func (v *DnslookupModelsLookupRecordType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := DnslookupModelsLookupRecordType(value) + for _, existing := range AllowedDnslookupModelsLookupRecordTypeEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + *v = DNSLOOKUPMODELSLOOKUPRECORDTYPE_UNKNOWN_DEFAULT_OPEN_API + return nil +} + +// NewDnslookupModelsLookupRecordTypeFromValue returns a pointer to a valid DnslookupModelsLookupRecordType +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewDnslookupModelsLookupRecordTypeFromValue(v string) (*DnslookupModelsLookupRecordType, error) { + ev := DnslookupModelsLookupRecordType(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for DnslookupModelsLookupRecordType: valid values are %v", v, AllowedDnslookupModelsLookupRecordTypeEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v DnslookupModelsLookupRecordType) IsValid() bool { + for _, existing := range AllowedDnslookupModelsLookupRecordTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to dnslookup_models_LookupRecord_type value +func (v DnslookupModelsLookupRecordType) Ptr() *DnslookupModelsLookupRecordType { + return &v +} + +type NullableDnslookupModelsLookupRecordType struct { + value *DnslookupModelsLookupRecordType + isSet bool +} + +func (v NullableDnslookupModelsLookupRecordType) Get() *DnslookupModelsLookupRecordType { + return v.value +} + +func (v *NullableDnslookupModelsLookupRecordType) Set(val *DnslookupModelsLookupRecordType) { + v.value = val + v.isSet = true +} + +func (v NullableDnslookupModelsLookupRecordType) IsSet() bool { + return v.isSet +} + +func (v *NullableDnslookupModelsLookupRecordType) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableDnslookupModelsLookupRecordType(val *DnslookupModelsLookupRecordType) *NullableDnslookupModelsLookupRecordType { + return &NullableDnslookupModelsLookupRecordType{value: val, isSet: true} +} + +func (v NullableDnslookupModelsLookupRecordType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableDnslookupModelsLookupRecordType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/dns/v1api/model_dnslookup_models_lookup_result.go b/services/dns/v1api/model_dnslookup_models_lookup_result.go new file mode 100644 index 0000000000..0ed30ee112 --- /dev/null +++ b/services/dns/v1api/model_dnslookup_models_lookup_result.go @@ -0,0 +1,231 @@ +/* +STACKIT DNS API + +This api provides dns + +API version: 1.0 +Contact: dns@stackit.cloud +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1api + +import ( + "encoding/json" +) + +// checks if the DnslookupModelsLookupResult type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &DnslookupModelsLookupResult{} + +// DnslookupModelsLookupResult struct for DnslookupModelsLookupResult +type DnslookupModelsLookupResult struct { + // RawResponse contains the raw DNS response in a human-readable format (only included when requested) + RawResponse *string `json:"rawResponse,omitempty"` + // Records contains the DNS records returned by the lookup + Records []DnslookupModelsLookupRecord `json:"records,omitempty"` + // ResolverIP is the IP address of the DNS resolver used for the query + ResolverIP *string `json:"resolverIP,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _DnslookupModelsLookupResult DnslookupModelsLookupResult + +// NewDnslookupModelsLookupResult instantiates a new DnslookupModelsLookupResult 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 NewDnslookupModelsLookupResult() *DnslookupModelsLookupResult { + this := DnslookupModelsLookupResult{} + return &this +} + +// NewDnslookupModelsLookupResultWithDefaults instantiates a new DnslookupModelsLookupResult 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 NewDnslookupModelsLookupResultWithDefaults() *DnslookupModelsLookupResult { + this := DnslookupModelsLookupResult{} + return &this +} + +// GetRawResponse returns the RawResponse field value if set, zero value otherwise. +func (o *DnslookupModelsLookupResult) GetRawResponse() string { + if o == nil || IsNil(o.RawResponse) { + var ret string + return ret + } + return *o.RawResponse +} + +// GetRawResponseOk returns a tuple with the RawResponse field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DnslookupModelsLookupResult) GetRawResponseOk() (*string, bool) { + if o == nil || IsNil(o.RawResponse) { + return nil, false + } + return o.RawResponse, true +} + +// HasRawResponse returns a boolean if a field has been set. +func (o *DnslookupModelsLookupResult) HasRawResponse() bool { + if o != nil && !IsNil(o.RawResponse) { + return true + } + + return false +} + +// SetRawResponse gets a reference to the given string and assigns it to the RawResponse field. +func (o *DnslookupModelsLookupResult) SetRawResponse(v string) { + o.RawResponse = &v +} + +// GetRecords returns the Records field value if set, zero value otherwise. +func (o *DnslookupModelsLookupResult) GetRecords() []DnslookupModelsLookupRecord { + if o == nil || IsNil(o.Records) { + var ret []DnslookupModelsLookupRecord + return ret + } + return o.Records +} + +// GetRecordsOk returns a tuple with the Records field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DnslookupModelsLookupResult) GetRecordsOk() ([]DnslookupModelsLookupRecord, bool) { + if o == nil || IsNil(o.Records) { + return nil, false + } + return o.Records, true +} + +// HasRecords returns a boolean if a field has been set. +func (o *DnslookupModelsLookupResult) HasRecords() bool { + if o != nil && !IsNil(o.Records) { + return true + } + + return false +} + +// SetRecords gets a reference to the given []DnslookupModelsLookupRecord and assigns it to the Records field. +func (o *DnslookupModelsLookupResult) SetRecords(v []DnslookupModelsLookupRecord) { + o.Records = v +} + +// GetResolverIP returns the ResolverIP field value if set, zero value otherwise. +func (o *DnslookupModelsLookupResult) GetResolverIP() string { + if o == nil || IsNil(o.ResolverIP) { + var ret string + return ret + } + return *o.ResolverIP +} + +// GetResolverIPOk returns a tuple with the ResolverIP field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DnslookupModelsLookupResult) GetResolverIPOk() (*string, bool) { + if o == nil || IsNil(o.ResolverIP) { + return nil, false + } + return o.ResolverIP, true +} + +// HasResolverIP returns a boolean if a field has been set. +func (o *DnslookupModelsLookupResult) HasResolverIP() bool { + if o != nil && !IsNil(o.ResolverIP) { + return true + } + + return false +} + +// SetResolverIP gets a reference to the given string and assigns it to the ResolverIP field. +func (o *DnslookupModelsLookupResult) SetResolverIP(v string) { + o.ResolverIP = &v +} + +func (o DnslookupModelsLookupResult) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o DnslookupModelsLookupResult) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.RawResponse) { + toSerialize["rawResponse"] = o.RawResponse + } + if !IsNil(o.Records) { + toSerialize["records"] = o.Records + } + if !IsNil(o.ResolverIP) { + toSerialize["resolverIP"] = o.ResolverIP + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *DnslookupModelsLookupResult) UnmarshalJSON(data []byte) (err error) { + varDnslookupModelsLookupResult := _DnslookupModelsLookupResult{} + + err = json.Unmarshal(data, &varDnslookupModelsLookupResult) + + if err != nil { + return err + } + + *o = DnslookupModelsLookupResult(varDnslookupModelsLookupResult) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "rawResponse") + delete(additionalProperties, "records") + delete(additionalProperties, "resolverIP") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableDnslookupModelsLookupResult struct { + value *DnslookupModelsLookupResult + isSet bool +} + +func (v NullableDnslookupModelsLookupResult) Get() *DnslookupModelsLookupResult { + return v.value +} + +func (v *NullableDnslookupModelsLookupResult) Set(val *DnslookupModelsLookupResult) { + v.value = val + v.isSet = true +} + +func (v NullableDnslookupModelsLookupResult) IsSet() bool { + return v.isSet +} + +func (v *NullableDnslookupModelsLookupResult) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableDnslookupModelsLookupResult(val *DnslookupModelsLookupResult) *NullableDnslookupModelsLookupResult { + return &NullableDnslookupModelsLookupResult{value: val, isSet: true} +} + +func (v NullableDnslookupModelsLookupResult) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableDnslookupModelsLookupResult) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/dns/v1api/model_dnslookup_payload.go b/services/dns/v1api/model_dnslookup_payload.go new file mode 100644 index 0000000000..726faa1939 --- /dev/null +++ b/services/dns/v1api/model_dnslookup_payload.go @@ -0,0 +1,317 @@ +/* +STACKIT DNS API + +This api provides dns + +API version: 1.0 +Contact: dns@stackit.cloud +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1api + +import ( + "encoding/json" +) + +// checks if the DnslookupPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &DnslookupPayload{} + +// DnslookupPayload struct for DnslookupPayload +type DnslookupPayload struct { + // Address is the domain name to look up + Address *string `json:"address,omitempty"` + // IncludeRawResponse indicates whether to include the raw DNS response in the result + IncludeRawResponse *bool `json:"includeRawResponse,omitempty"` + RecordType *DnslookupPayloadRecordType `json:"recordType,omitempty"` + // Region optionally specifies a STACKIT region to scope the DNS lookup + Region *string `json:"region,omitempty"` + Type *DnslookupPayloadType `json:"type,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _DnslookupPayload DnslookupPayload + +// NewDnslookupPayload instantiates a new DnslookupPayload 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 NewDnslookupPayload() *DnslookupPayload { + this := DnslookupPayload{} + var includeRawResponse bool = false + this.IncludeRawResponse = &includeRawResponse + var recordType DnslookupPayloadRecordType = DNSLOOKUPPAYLOADRECORDTYPE_A + this.RecordType = &recordType + var types DnslookupPayloadType = DNSLOOKUPPAYLOADTYPE_ONE + this.Type = &types + return &this +} + +// NewDnslookupPayloadWithDefaults instantiates a new DnslookupPayload 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 NewDnslookupPayloadWithDefaults() *DnslookupPayload { + this := DnslookupPayload{} + var includeRawResponse bool = false + this.IncludeRawResponse = &includeRawResponse + var recordType DnslookupPayloadRecordType = DNSLOOKUPPAYLOADRECORDTYPE_A + this.RecordType = &recordType + var types DnslookupPayloadType = DNSLOOKUPPAYLOADTYPE_ONE + this.Type = &types + return &this +} + +// GetAddress returns the Address field value if set, zero value otherwise. +func (o *DnslookupPayload) GetAddress() string { + if o == nil || IsNil(o.Address) { + var ret string + return ret + } + return *o.Address +} + +// GetAddressOk returns a tuple with the Address field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DnslookupPayload) GetAddressOk() (*string, bool) { + if o == nil || IsNil(o.Address) { + return nil, false + } + return o.Address, true +} + +// HasAddress returns a boolean if a field has been set. +func (o *DnslookupPayload) HasAddress() bool { + if o != nil && !IsNil(o.Address) { + return true + } + + return false +} + +// SetAddress gets a reference to the given string and assigns it to the Address field. +func (o *DnslookupPayload) SetAddress(v string) { + o.Address = &v +} + +// GetIncludeRawResponse returns the IncludeRawResponse field value if set, zero value otherwise. +func (o *DnslookupPayload) GetIncludeRawResponse() bool { + if o == nil || IsNil(o.IncludeRawResponse) { + var ret bool + return ret + } + return *o.IncludeRawResponse +} + +// GetIncludeRawResponseOk returns a tuple with the IncludeRawResponse field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DnslookupPayload) GetIncludeRawResponseOk() (*bool, bool) { + if o == nil || IsNil(o.IncludeRawResponse) { + return nil, false + } + return o.IncludeRawResponse, true +} + +// HasIncludeRawResponse returns a boolean if a field has been set. +func (o *DnslookupPayload) HasIncludeRawResponse() bool { + if o != nil && !IsNil(o.IncludeRawResponse) { + return true + } + + return false +} + +// SetIncludeRawResponse gets a reference to the given bool and assigns it to the IncludeRawResponse field. +func (o *DnslookupPayload) SetIncludeRawResponse(v bool) { + o.IncludeRawResponse = &v +} + +// GetRecordType returns the RecordType field value if set, zero value otherwise. +func (o *DnslookupPayload) GetRecordType() DnslookupPayloadRecordType { + if o == nil || IsNil(o.RecordType) { + var ret DnslookupPayloadRecordType + return ret + } + return *o.RecordType +} + +// GetRecordTypeOk returns a tuple with the RecordType field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DnslookupPayload) GetRecordTypeOk() (*DnslookupPayloadRecordType, bool) { + if o == nil || IsNil(o.RecordType) { + return nil, false + } + return o.RecordType, true +} + +// HasRecordType returns a boolean if a field has been set. +func (o *DnslookupPayload) HasRecordType() bool { + if o != nil && !IsNil(o.RecordType) { + return true + } + + return false +} + +// SetRecordType gets a reference to the given DnslookupPayloadRecordType and assigns it to the RecordType field. +func (o *DnslookupPayload) SetRecordType(v DnslookupPayloadRecordType) { + o.RecordType = &v +} + +// GetRegion returns the Region field value if set, zero value otherwise. +func (o *DnslookupPayload) GetRegion() string { + if o == nil || IsNil(o.Region) { + var ret string + return ret + } + return *o.Region +} + +// GetRegionOk returns a tuple with the Region field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DnslookupPayload) GetRegionOk() (*string, bool) { + if o == nil || IsNil(o.Region) { + return nil, false + } + return o.Region, true +} + +// HasRegion returns a boolean if a field has been set. +func (o *DnslookupPayload) HasRegion() bool { + if o != nil && !IsNil(o.Region) { + return true + } + + return false +} + +// SetRegion gets a reference to the given string and assigns it to the Region field. +func (o *DnslookupPayload) SetRegion(v string) { + o.Region = &v +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *DnslookupPayload) GetType() DnslookupPayloadType { + if o == nil || IsNil(o.Type) { + var ret DnslookupPayloadType + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DnslookupPayload) GetTypeOk() (*DnslookupPayloadType, bool) { + if o == nil || IsNil(o.Type) { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *DnslookupPayload) HasType() bool { + if o != nil && !IsNil(o.Type) { + return true + } + + return false +} + +// SetType gets a reference to the given DnslookupPayloadType and assigns it to the Type field. +func (o *DnslookupPayload) SetType(v DnslookupPayloadType) { + o.Type = &v +} + +func (o DnslookupPayload) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o DnslookupPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Address) { + toSerialize["address"] = o.Address + } + if !IsNil(o.IncludeRawResponse) { + toSerialize["includeRawResponse"] = o.IncludeRawResponse + } + if !IsNil(o.RecordType) { + toSerialize["recordType"] = o.RecordType + } + if !IsNil(o.Region) { + toSerialize["region"] = o.Region + } + if !IsNil(o.Type) { + toSerialize["type"] = o.Type + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *DnslookupPayload) UnmarshalJSON(data []byte) (err error) { + varDnslookupPayload := _DnslookupPayload{} + + err = json.Unmarshal(data, &varDnslookupPayload) + + if err != nil { + return err + } + + *o = DnslookupPayload(varDnslookupPayload) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "address") + delete(additionalProperties, "includeRawResponse") + delete(additionalProperties, "recordType") + delete(additionalProperties, "region") + delete(additionalProperties, "type") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableDnslookupPayload struct { + value *DnslookupPayload + isSet bool +} + +func (v NullableDnslookupPayload) Get() *DnslookupPayload { + return v.value +} + +func (v *NullableDnslookupPayload) Set(val *DnslookupPayload) { + v.value = val + v.isSet = true +} + +func (v NullableDnslookupPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableDnslookupPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableDnslookupPayload(val *DnslookupPayload) *NullableDnslookupPayload { + return &NullableDnslookupPayload{value: val, isSet: true} +} + +func (v NullableDnslookupPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableDnslookupPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/dns/v1api/model_dnslookup_payload_record_type.go b/services/dns/v1api/model_dnslookup_payload_record_type.go new file mode 100644 index 0000000000..ffb9499771 --- /dev/null +++ b/services/dns/v1api/model_dnslookup_payload_record_type.go @@ -0,0 +1,162 @@ +/* +STACKIT DNS API + +This api provides dns + +API version: 1.0 +Contact: dns@stackit.cloud +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1api + +import ( + "encoding/json" + "fmt" +) + +// DnslookupPayloadRecordType RecordType specifies the DNS record type to query (A, AAAA, MX, etc.) If omitted, defaults to ANY records +type DnslookupPayloadRecordType string + +// List of dnslookupPayload_recordType +const ( + DNSLOOKUPPAYLOADRECORDTYPE_A DnslookupPayloadRecordType = "A" + DNSLOOKUPPAYLOADRECORDTYPE_AAAA DnslookupPayloadRecordType = "AAAA" + DNSLOOKUPPAYLOADRECORDTYPE_SOA DnslookupPayloadRecordType = "SOA" + DNSLOOKUPPAYLOADRECORDTYPE_CNAME DnslookupPayloadRecordType = "CNAME" + DNSLOOKUPPAYLOADRECORDTYPE_NS DnslookupPayloadRecordType = "NS" + DNSLOOKUPPAYLOADRECORDTYPE_MX DnslookupPayloadRecordType = "MX" + DNSLOOKUPPAYLOADRECORDTYPE_TXT DnslookupPayloadRecordType = "TXT" + DNSLOOKUPPAYLOADRECORDTYPE_SRV DnslookupPayloadRecordType = "SRV" + DNSLOOKUPPAYLOADRECORDTYPE_PTR DnslookupPayloadRecordType = "PTR" + DNSLOOKUPPAYLOADRECORDTYPE_ALIAS DnslookupPayloadRecordType = "ALIAS" + DNSLOOKUPPAYLOADRECORDTYPE_DNAME DnslookupPayloadRecordType = "DNAME" + DNSLOOKUPPAYLOADRECORDTYPE_CAA DnslookupPayloadRecordType = "CAA" + DNSLOOKUPPAYLOADRECORDTYPE_DNSKEY DnslookupPayloadRecordType = "DNSKEY" + DNSLOOKUPPAYLOADRECORDTYPE_DS DnslookupPayloadRecordType = "DS" + DNSLOOKUPPAYLOADRECORDTYPE_LOC DnslookupPayloadRecordType = "LOC" + DNSLOOKUPPAYLOADRECORDTYPE_NAPTR DnslookupPayloadRecordType = "NAPTR" + DNSLOOKUPPAYLOADRECORDTYPE_SSHFP DnslookupPayloadRecordType = "SSHFP" + DNSLOOKUPPAYLOADRECORDTYPE_TLSA DnslookupPayloadRecordType = "TLSA" + DNSLOOKUPPAYLOADRECORDTYPE_URI DnslookupPayloadRecordType = "URI" + DNSLOOKUPPAYLOADRECORDTYPE_CERT DnslookupPayloadRecordType = "CERT" + DNSLOOKUPPAYLOADRECORDTYPE_SVCB DnslookupPayloadRecordType = "SVCB" + DNSLOOKUPPAYLOADRECORDTYPE_TYPE DnslookupPayloadRecordType = "TYPE" + DNSLOOKUPPAYLOADRECORDTYPE_CSYNC DnslookupPayloadRecordType = "CSYNC" + DNSLOOKUPPAYLOADRECORDTYPE_HINFO DnslookupPayloadRecordType = "HINFO" + DNSLOOKUPPAYLOADRECORDTYPE_HTTPS DnslookupPayloadRecordType = "HTTPS" + DNSLOOKUPPAYLOADRECORDTYPE_ANY DnslookupPayloadRecordType = "ANY" + DNSLOOKUPPAYLOADRECORDTYPE_UNKNOWN_DEFAULT_OPEN_API DnslookupPayloadRecordType = "unknown_default_open_api" +) + +// All allowed values of DnslookupPayloadRecordType enum +var AllowedDnslookupPayloadRecordTypeEnumValues = []DnslookupPayloadRecordType{ + "A", + "AAAA", + "SOA", + "CNAME", + "NS", + "MX", + "TXT", + "SRV", + "PTR", + "ALIAS", + "DNAME", + "CAA", + "DNSKEY", + "DS", + "LOC", + "NAPTR", + "SSHFP", + "TLSA", + "URI", + "CERT", + "SVCB", + "TYPE", + "CSYNC", + "HINFO", + "HTTPS", + "ANY", + "unknown_default_open_api", +} + +func (v *DnslookupPayloadRecordType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := DnslookupPayloadRecordType(value) + for _, existing := range AllowedDnslookupPayloadRecordTypeEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + *v = DNSLOOKUPPAYLOADRECORDTYPE_UNKNOWN_DEFAULT_OPEN_API + return nil +} + +// NewDnslookupPayloadRecordTypeFromValue returns a pointer to a valid DnslookupPayloadRecordType +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewDnslookupPayloadRecordTypeFromValue(v string) (*DnslookupPayloadRecordType, error) { + ev := DnslookupPayloadRecordType(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for DnslookupPayloadRecordType: valid values are %v", v, AllowedDnslookupPayloadRecordTypeEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v DnslookupPayloadRecordType) IsValid() bool { + for _, existing := range AllowedDnslookupPayloadRecordTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to dnslookupPayload_recordType value +func (v DnslookupPayloadRecordType) Ptr() *DnslookupPayloadRecordType { + return &v +} + +type NullableDnslookupPayloadRecordType struct { + value *DnslookupPayloadRecordType + isSet bool +} + +func (v NullableDnslookupPayloadRecordType) Get() *DnslookupPayloadRecordType { + return v.value +} + +func (v *NullableDnslookupPayloadRecordType) Set(val *DnslookupPayloadRecordType) { + v.value = val + v.isSet = true +} + +func (v NullableDnslookupPayloadRecordType) IsSet() bool { + return v.isSet +} + +func (v *NullableDnslookupPayloadRecordType) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableDnslookupPayloadRecordType(val *DnslookupPayloadRecordType) *NullableDnslookupPayloadRecordType { + return &NullableDnslookupPayloadRecordType{value: val, isSet: true} +} + +func (v NullableDnslookupPayloadRecordType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableDnslookupPayloadRecordType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/dns/v1api/model_dnslookup_payload_type.go b/services/dns/v1api/model_dnslookup_payload_type.go new file mode 100644 index 0000000000..68318a065a --- /dev/null +++ b/services/dns/v1api/model_dnslookup_payload_type.go @@ -0,0 +1,114 @@ +/* +STACKIT DNS API + +This api provides dns + +API version: 1.0 +Contact: dns@stackit.cloud +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1api + +import ( + "encoding/json" + "fmt" +) + +// DnslookupPayloadType Type specifies whether to query all configured resolvers or just one \"one\" - query a single resolver chosen by round-robin (default) \"all\" - query all configured resolvers +type DnslookupPayloadType string + +// List of dnslookupPayload_type +const ( + DNSLOOKUPPAYLOADTYPE_ALL DnslookupPayloadType = "all" + DNSLOOKUPPAYLOADTYPE_ONE DnslookupPayloadType = "one" + DNSLOOKUPPAYLOADTYPE_UNKNOWN_DEFAULT_OPEN_API DnslookupPayloadType = "unknown_default_open_api" +) + +// All allowed values of DnslookupPayloadType enum +var AllowedDnslookupPayloadTypeEnumValues = []DnslookupPayloadType{ + "all", + "one", + "unknown_default_open_api", +} + +func (v *DnslookupPayloadType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := DnslookupPayloadType(value) + for _, existing := range AllowedDnslookupPayloadTypeEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + *v = DNSLOOKUPPAYLOADTYPE_UNKNOWN_DEFAULT_OPEN_API + return nil +} + +// NewDnslookupPayloadTypeFromValue returns a pointer to a valid DnslookupPayloadType +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewDnslookupPayloadTypeFromValue(v string) (*DnslookupPayloadType, error) { + ev := DnslookupPayloadType(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for DnslookupPayloadType: valid values are %v", v, AllowedDnslookupPayloadTypeEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v DnslookupPayloadType) IsValid() bool { + for _, existing := range AllowedDnslookupPayloadTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to dnslookupPayload_type value +func (v DnslookupPayloadType) Ptr() *DnslookupPayloadType { + return &v +} + +type NullableDnslookupPayloadType struct { + value *DnslookupPayloadType + isSet bool +} + +func (v NullableDnslookupPayloadType) Get() *DnslookupPayloadType { + return v.value +} + +func (v *NullableDnslookupPayloadType) Set(val *DnslookupPayloadType) { + v.value = val + v.isSet = true +} + +func (v NullableDnslookupPayloadType) IsSet() bool { + return v.isSet +} + +func (v *NullableDnslookupPayloadType) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableDnslookupPayloadType(val *DnslookupPayloadType) *NullableDnslookupPayloadType { + return &NullableDnslookupPayloadType{value: val, isSet: true} +} + +func (v NullableDnslookupPayloadType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableDnslookupPayloadType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/dns/v1api/model_flush_create_flush_response.go b/services/dns/v1api/model_flush_create_flush_response.go new file mode 100644 index 0000000000..09a5d12548 --- /dev/null +++ b/services/dns/v1api/model_flush_create_flush_response.go @@ -0,0 +1,154 @@ +/* +STACKIT DNS API + +This api provides dns + +API version: 1.0 +Contact: dns@stackit.cloud +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1api + +import ( + "encoding/json" +) + +// checks if the FlushCreateFlushResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &FlushCreateFlushResponse{} + +// FlushCreateFlushResponse struct for FlushCreateFlushResponse +type FlushCreateFlushResponse struct { + Message *string `json:"message,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _FlushCreateFlushResponse FlushCreateFlushResponse + +// NewFlushCreateFlushResponse instantiates a new FlushCreateFlushResponse 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 NewFlushCreateFlushResponse() *FlushCreateFlushResponse { + this := FlushCreateFlushResponse{} + return &this +} + +// NewFlushCreateFlushResponseWithDefaults instantiates a new FlushCreateFlushResponse 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 NewFlushCreateFlushResponseWithDefaults() *FlushCreateFlushResponse { + this := FlushCreateFlushResponse{} + return &this +} + +// GetMessage returns the Message field value if set, zero value otherwise. +func (o *FlushCreateFlushResponse) GetMessage() string { + if o == nil || IsNil(o.Message) { + var ret string + return ret + } + return *o.Message +} + +// GetMessageOk returns a tuple with the Message field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FlushCreateFlushResponse) GetMessageOk() (*string, bool) { + if o == nil || IsNil(o.Message) { + return nil, false + } + return o.Message, true +} + +// HasMessage returns a boolean if a field has been set. +func (o *FlushCreateFlushResponse) HasMessage() bool { + if o != nil && !IsNil(o.Message) { + return true + } + + return false +} + +// SetMessage gets a reference to the given string and assigns it to the Message field. +func (o *FlushCreateFlushResponse) SetMessage(v string) { + o.Message = &v +} + +func (o FlushCreateFlushResponse) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o FlushCreateFlushResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Message) { + toSerialize["message"] = o.Message + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *FlushCreateFlushResponse) UnmarshalJSON(data []byte) (err error) { + varFlushCreateFlushResponse := _FlushCreateFlushResponse{} + + err = json.Unmarshal(data, &varFlushCreateFlushResponse) + + if err != nil { + return err + } + + *o = FlushCreateFlushResponse(varFlushCreateFlushResponse) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "message") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableFlushCreateFlushResponse struct { + value *FlushCreateFlushResponse + isSet bool +} + +func (v NullableFlushCreateFlushResponse) Get() *FlushCreateFlushResponse { + return v.value +} + +func (v *NullableFlushCreateFlushResponse) Set(val *FlushCreateFlushResponse) { + v.value = val + v.isSet = true +} + +func (v NullableFlushCreateFlushResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableFlushCreateFlushResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableFlushCreateFlushResponse(val *FlushCreateFlushResponse) *NullableFlushCreateFlushResponse { + return &NullableFlushCreateFlushResponse{value: val, isSet: true} +} + +func (v NullableFlushCreateFlushResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableFlushCreateFlushResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/dns/v1api/model_flush_payload.go b/services/dns/v1api/model_flush_payload.go new file mode 100644 index 0000000000..5aa264c2cb --- /dev/null +++ b/services/dns/v1api/model_flush_payload.go @@ -0,0 +1,204 @@ +/* +STACKIT DNS API + +This api provides dns + +API version: 1.0 +Contact: dns@stackit.cloud +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1api + +import ( + "encoding/json" + "fmt" +) + +// checks if the FlushPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &FlushPayload{} + +// FlushPayload struct for FlushPayload +type FlushPayload struct { + Domain string `json:"domain"` + Type *FlushPayloadType `json:"type,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _FlushPayload FlushPayload + +// NewFlushPayload instantiates a new FlushPayload 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 NewFlushPayload(domain string) *FlushPayload { + this := FlushPayload{} + this.Domain = domain + return &this +} + +// NewFlushPayloadWithDefaults instantiates a new FlushPayload 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 NewFlushPayloadWithDefaults() *FlushPayload { + this := FlushPayload{} + return &this +} + +// GetDomain returns the Domain field value +func (o *FlushPayload) GetDomain() string { + if o == nil { + var ret string + return ret + } + + return o.Domain +} + +// GetDomainOk returns a tuple with the Domain field value +// and a boolean to check if the value has been set. +func (o *FlushPayload) GetDomainOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Domain, true +} + +// SetDomain sets field value +func (o *FlushPayload) SetDomain(v string) { + o.Domain = v +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *FlushPayload) GetType() FlushPayloadType { + if o == nil || IsNil(o.Type) { + var ret FlushPayloadType + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FlushPayload) GetTypeOk() (*FlushPayloadType, bool) { + if o == nil || IsNil(o.Type) { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *FlushPayload) HasType() bool { + if o != nil && !IsNil(o.Type) { + return true + } + + return false +} + +// SetType gets a reference to the given FlushPayloadType and assigns it to the Type field. +func (o *FlushPayload) SetType(v FlushPayloadType) { + o.Type = &v +} + +func (o FlushPayload) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o FlushPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["domain"] = o.Domain + if !IsNil(o.Type) { + toSerialize["type"] = o.Type + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *FlushPayload) 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{ + "domain", + } + + 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) + } + } + + varFlushPayload := _FlushPayload{} + + err = json.Unmarshal(data, &varFlushPayload) + + if err != nil { + return err + } + + *o = FlushPayload(varFlushPayload) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "domain") + delete(additionalProperties, "type") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableFlushPayload struct { + value *FlushPayload + isSet bool +} + +func (v NullableFlushPayload) Get() *FlushPayload { + return v.value +} + +func (v *NullableFlushPayload) Set(val *FlushPayload) { + v.value = val + v.isSet = true +} + +func (v NullableFlushPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableFlushPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableFlushPayload(val *FlushPayload) *NullableFlushPayload { + return &NullableFlushPayload{value: val, isSet: true} +} + +func (v NullableFlushPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableFlushPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/dns/v1api/model_flush_payload_type.go b/services/dns/v1api/model_flush_payload_type.go new file mode 100644 index 0000000000..667f26e1f4 --- /dev/null +++ b/services/dns/v1api/model_flush_payload_type.go @@ -0,0 +1,156 @@ +/* +STACKIT DNS API + +This api provides dns + +API version: 1.0 +Contact: dns@stackit.cloud +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1api + +import ( + "encoding/json" + "fmt" +) + +// FlushPayloadType the model 'FlushPayloadType' +type FlushPayloadType string + +// List of flushPayload_type +const ( + FLUSHPAYLOADTYPE_A FlushPayloadType = "A" + FLUSHPAYLOADTYPE_AAAA FlushPayloadType = "AAAA" + FLUSHPAYLOADTYPE_SOA FlushPayloadType = "SOA" + FLUSHPAYLOADTYPE_CNAME FlushPayloadType = "CNAME" + FLUSHPAYLOADTYPE_NS FlushPayloadType = "NS" + FLUSHPAYLOADTYPE_MX FlushPayloadType = "MX" + FLUSHPAYLOADTYPE_TXT FlushPayloadType = "TXT" + FLUSHPAYLOADTYPE_SRV FlushPayloadType = "SRV" + FLUSHPAYLOADTYPE_PTR FlushPayloadType = "PTR" + FLUSHPAYLOADTYPE_DNAME FlushPayloadType = "DNAME" + FLUSHPAYLOADTYPE_CAA FlushPayloadType = "CAA" + FLUSHPAYLOADTYPE_DNSKEY FlushPayloadType = "DNSKEY" + FLUSHPAYLOADTYPE_DS FlushPayloadType = "DS" + FLUSHPAYLOADTYPE_LOC FlushPayloadType = "LOC" + FLUSHPAYLOADTYPE_NAPTR FlushPayloadType = "NAPTR" + FLUSHPAYLOADTYPE_SSHFP FlushPayloadType = "SSHFP" + FLUSHPAYLOADTYPE_TLSA FlushPayloadType = "TLSA" + FLUSHPAYLOADTYPE_URI FlushPayloadType = "URI" + FLUSHPAYLOADTYPE_CERT FlushPayloadType = "CERT" + FLUSHPAYLOADTYPE_SVCB FlushPayloadType = "SVCB" + FLUSHPAYLOADTYPE_CSYNC FlushPayloadType = "CSYNC" + FLUSHPAYLOADTYPE_HINFO FlushPayloadType = "HINFO" + FLUSHPAYLOADTYPE_HTTPS FlushPayloadType = "HTTPS" + FLUSHPAYLOADTYPE_UNKNOWN_DEFAULT_OPEN_API FlushPayloadType = "unknown_default_open_api" +) + +// All allowed values of FlushPayloadType enum +var AllowedFlushPayloadTypeEnumValues = []FlushPayloadType{ + "A", + "AAAA", + "SOA", + "CNAME", + "NS", + "MX", + "TXT", + "SRV", + "PTR", + "DNAME", + "CAA", + "DNSKEY", + "DS", + "LOC", + "NAPTR", + "SSHFP", + "TLSA", + "URI", + "CERT", + "SVCB", + "CSYNC", + "HINFO", + "HTTPS", + "unknown_default_open_api", +} + +func (v *FlushPayloadType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := FlushPayloadType(value) + for _, existing := range AllowedFlushPayloadTypeEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + *v = FLUSHPAYLOADTYPE_UNKNOWN_DEFAULT_OPEN_API + return nil +} + +// NewFlushPayloadTypeFromValue returns a pointer to a valid FlushPayloadType +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewFlushPayloadTypeFromValue(v string) (*FlushPayloadType, error) { + ev := FlushPayloadType(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for FlushPayloadType: valid values are %v", v, AllowedFlushPayloadTypeEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v FlushPayloadType) IsValid() bool { + for _, existing := range AllowedFlushPayloadTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to flushPayload_type value +func (v FlushPayloadType) Ptr() *FlushPayloadType { + return &v +} + +type NullableFlushPayloadType struct { + value *FlushPayloadType + isSet bool +} + +func (v NullableFlushPayloadType) Get() *FlushPayloadType { + return v.value +} + +func (v *NullableFlushPayloadType) Set(val *FlushPayloadType) { + v.value = val + v.isSet = true +} + +func (v NullableFlushPayloadType) IsSet() bool { + return v.isSet +} + +func (v *NullableFlushPayloadType) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableFlushPayloadType(val *FlushPayloadType) *NullableFlushPayloadType { + return &NullableFlushPayloadType{value: val, isSet: true} +} + +func (v NullableFlushPayloadType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableFlushPayloadType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +}