From 5510ebcbb8224d8fc8bdd969a1efbe767d4287c1 Mon Sep 17 00:00:00 2001 From: SDK Generator Bot Date: Fri, 25 Jul 2025 12:03:55 +0000 Subject: [PATCH 1/2] Generate cdn --- services/cdn/api_default.go | 72 ++++- services/cdn/model_config.go | 47 ++++ services/cdn/model_config_log_sink.go | 123 +++++++++ services/cdn/model_config_log_sink_test.go | 11 + .../cdn/model_create_distribution_payload.go | 47 ++++ ...el_create_distribution_payload_log_sink.go | 123 +++++++++ ...eate_distribution_payload_log_sink_test.go | 11 + ...el_get_custom_domain_custom_certificate.go | 171 ++++++++++++ ...t_custom_domain_custom_certificate_test.go | 11 + ...l_get_custom_domain_managed_certificate.go | 126 +++++++++ ..._custom_domain_managed_certificate_test.go | 11 + .../cdn/model_get_custom_domain_response.go | 45 ++- ..._get_custom_domain_response_certificate.go | 163 +++++++++++ ...custom_domain_response_certificate_test.go | 11 + services/cdn/model_loki_log_sink.go | 170 ++++++++++++ services/cdn/model_loki_log_sink_test.go | 11 + services/cdn/model_patch_loki_log_sink.go | 258 ++++++++++++++++++ .../cdn/model_patch_loki_log_sink_test.go | 11 + ...el_put_custom_domain_custom_certificate.go | 216 +++++++++++++++ ...t_custom_domain_custom_certificate_test.go | 11 + ...l_put_custom_domain_managed_certificate.go | 126 +++++++++ ..._custom_domain_managed_certificate_test.go | 11 + .../cdn/model_put_custom_domain_payload.go | 47 ++++ ...l_put_custom_domain_payload_certificate.go | 163 +++++++++++ ..._custom_domain_payload_certificate_test.go | 11 + .../cdn/model_put_custom_domain_response.go | 47 ++++ ..._put_custom_domain_response_certificate.go | 163 +++++++++++ ...custom_domain_response_certificate_test.go | 11 + 28 files changed, 2217 insertions(+), 11 deletions(-) create mode 100644 services/cdn/model_config_log_sink.go create mode 100644 services/cdn/model_config_log_sink_test.go create mode 100644 services/cdn/model_create_distribution_payload_log_sink.go create mode 100644 services/cdn/model_create_distribution_payload_log_sink_test.go create mode 100644 services/cdn/model_get_custom_domain_custom_certificate.go create mode 100644 services/cdn/model_get_custom_domain_custom_certificate_test.go create mode 100644 services/cdn/model_get_custom_domain_managed_certificate.go create mode 100644 services/cdn/model_get_custom_domain_managed_certificate_test.go create mode 100644 services/cdn/model_get_custom_domain_response_certificate.go create mode 100644 services/cdn/model_get_custom_domain_response_certificate_test.go create mode 100644 services/cdn/model_loki_log_sink.go create mode 100644 services/cdn/model_loki_log_sink_test.go create mode 100644 services/cdn/model_patch_loki_log_sink.go create mode 100644 services/cdn/model_patch_loki_log_sink_test.go create mode 100644 services/cdn/model_put_custom_domain_custom_certificate.go create mode 100644 services/cdn/model_put_custom_domain_custom_certificate_test.go create mode 100644 services/cdn/model_put_custom_domain_managed_certificate.go create mode 100644 services/cdn/model_put_custom_domain_managed_certificate_test.go create mode 100644 services/cdn/model_put_custom_domain_payload_certificate.go create mode 100644 services/cdn/model_put_custom_domain_payload_certificate_test.go create mode 100644 services/cdn/model_put_custom_domain_response_certificate.go create mode 100644 services/cdn/model_put_custom_domain_response_certificate_test.go diff --git a/services/cdn/api_default.go b/services/cdn/api_default.go index b0f0d6e43..0abb6b4ce 100644 --- a/services/cdn/api_default.go +++ b/services/cdn/api_default.go @@ -372,6 +372,14 @@ type ApiGetLogsRequest interface { // The following sort options exist. We default to `timestamp` - `timestamp` - Sort by log message time stamp. SortBy(sortBy string) ApiGetLogsRequest SortOrder(sortOrder string) ApiGetLogsRequest + // Filters by the CDN data center region that served the request. Can be combined with other filters + DataCenterRegion(dataCenterRegion string) ApiGetLogsRequest + // Filters by the originating country of the user request. Can be combined with other filters + RequestCountryCode(requestCountryCode string) ApiGetLogsRequest + // Filters by the HTTP status code returned to the client. Can be combined with other filters + StatusCode(statusCode int32) ApiGetLogsRequest + // Filters based on whether the request was served from the CDN cache. Can be combined with other filters + CacheHit(cacheHit bool) ApiGetLogsRequest Execute() (*GetLogsResponse, error) } @@ -1696,16 +1704,20 @@ func (a *APIClient) GetDistributionExecute(ctx context.Context, projectId string } type GetLogsRequest struct { - ctx context.Context - apiService *DefaultApiService - projectId string - distributionId string - from *time.Time - to *time.Time - pageSize *int32 - pageIdentifier *string - sortBy *string - sortOrder *string + ctx context.Context + apiService *DefaultApiService + projectId string + distributionId string + from *time.Time + to *time.Time + pageSize *int32 + pageIdentifier *string + sortBy *string + sortOrder *string + dataCenterRegion *string + requestCountryCode *string + statusCode *int32 + cacheHit *bool } // the start of the time range for which logs should be returned @@ -1748,6 +1760,34 @@ func (r GetLogsRequest) SortOrder(sortOrder string) ApiGetLogsRequest { return r } +// Filters by the CDN data center region that served the request. Can be combined with other filters + +func (r GetLogsRequest) DataCenterRegion(dataCenterRegion string) ApiGetLogsRequest { + r.dataCenterRegion = &dataCenterRegion + return r +} + +// Filters by the originating country of the user request. Can be combined with other filters + +func (r GetLogsRequest) RequestCountryCode(requestCountryCode string) ApiGetLogsRequest { + r.requestCountryCode = &requestCountryCode + return r +} + +// Filters by the HTTP status code returned to the client. Can be combined with other filters + +func (r GetLogsRequest) StatusCode(statusCode int32) ApiGetLogsRequest { + r.statusCode = &statusCode + return r +} + +// Filters based on whether the request was served from the CDN cache. Can be combined with other filters + +func (r GetLogsRequest) CacheHit(cacheHit bool) ApiGetLogsRequest { + r.cacheHit = &cacheHit + return r +} + func (r GetLogsRequest) Execute() (*GetLogsResponse, error) { var ( localVarHTTPMethod = http.MethodGet @@ -1791,6 +1831,18 @@ func (r GetLogsRequest) Execute() (*GetLogsResponse, error) { if r.sortOrder != nil { parameterAddToHeaderOrQuery(localVarQueryParams, "sortOrder", r.sortOrder, "") } + if r.dataCenterRegion != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "dataCenterRegion", r.dataCenterRegion, "") + } + if r.requestCountryCode != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "requestCountryCode", r.requestCountryCode, "") + } + if r.statusCode != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "statusCode", r.statusCode, "") + } + if r.cacheHit != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "cacheHit", r.cacheHit, "") + } // to determine the Content-Type header localVarHTTPContentTypes := []string{} diff --git a/services/cdn/model_config.go b/services/cdn/model_config.go index faea4e119..c004ce712 100644 --- a/services/cdn/model_config.go +++ b/services/cdn/model_config.go @@ -102,6 +102,26 @@ func setConfigGetDefaultCacheDurationAttributeType(arg *ConfigGetDefaultCacheDur type ConfigGetDefaultCacheDurationArgType = *string type ConfigGetDefaultCacheDurationRetType = *string +/* + types and functions for logSink +*/ + +// isModel +type ConfigGetLogSinkAttributeType = *ConfigLogSink +type ConfigGetLogSinkArgType = ConfigLogSink +type ConfigGetLogSinkRetType = ConfigLogSink + +func getConfigGetLogSinkAttributeTypeOk(arg ConfigGetLogSinkAttributeType) (ret ConfigGetLogSinkRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setConfigGetLogSinkAttributeType(arg *ConfigGetLogSinkAttributeType, val ConfigGetLogSinkRetType) { + *arg = &val +} + /* types and functions for monthlyLimitBytes */ @@ -174,6 +194,7 @@ type Config struct { BlockedIPs ConfigGetBlockedIPsAttributeType `json:"blockedIPs" required:"true"` // Sets the default cache duration for the distribution. The default cache duration is applied when a 'Cache-Control' header is not presented in the origin's response. We use ISO8601 duration format for cache duration (e.g. P1DT2H30M) DefaultCacheDuration ConfigGetDefaultCacheDurationAttributeType `json:"defaultCacheDuration,omitempty"` + LogSink ConfigGetLogSinkAttributeType `json:"logSink,omitempty"` // Sets the monthly limit of bandwidth in bytes that the pullzone is allowed to use. MonthlyLimitBytes ConfigGetMonthlyLimitBytesAttributeType `json:"monthlyLimitBytes,omitempty"` Optimizer ConfigGetOptimizerAttributeType `json:"optimizer,omitempty"` @@ -289,6 +310,29 @@ func (o *Config) UnsetDefaultCacheDuration() { o.DefaultCacheDuration = nil } +// GetLogSink returns the LogSink field value if set, zero value otherwise. +func (o *Config) GetLogSink() (res ConfigGetLogSinkRetType) { + res, _ = o.GetLogSinkOk() + return +} + +// GetLogSinkOk returns a tuple with the LogSink field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Config) GetLogSinkOk() (ret ConfigGetLogSinkRetType, ok bool) { + return getConfigGetLogSinkAttributeTypeOk(o.LogSink) +} + +// HasLogSink returns a boolean if a field has been set. +func (o *Config) HasLogSink() bool { + _, ok := o.GetLogSinkOk() + return ok +} + +// SetLogSink gets a reference to the given ConfigLogSink and assigns it to the LogSink field. +func (o *Config) SetLogSink(v ConfigGetLogSinkRetType) { + setConfigGetLogSinkAttributeType(&o.LogSink, v) +} + // GetMonthlyLimitBytes returns the MonthlyLimitBytes field value if set, zero value otherwise (both if not set or set to explicit null). func (o *Config) GetMonthlyLimitBytes() (res ConfigGetMonthlyLimitBytesRetType) { res, _ = o.GetMonthlyLimitBytesOk() @@ -377,6 +421,9 @@ func (o Config) ToMap() (map[string]interface{}, error) { if val, ok := getConfigGetDefaultCacheDurationAttributeTypeOk(o.DefaultCacheDuration); ok { toSerialize["DefaultCacheDuration"] = val } + if val, ok := getConfigGetLogSinkAttributeTypeOk(o.LogSink); ok { + toSerialize["LogSink"] = val + } if val, ok := getConfigGetMonthlyLimitBytesAttributeTypeOk(o.MonthlyLimitBytes); ok { toSerialize["MonthlyLimitBytes"] = val } diff --git a/services/cdn/model_config_log_sink.go b/services/cdn/model_config_log_sink.go new file mode 100644 index 000000000..eafafe136 --- /dev/null +++ b/services/cdn/model_config_log_sink.go @@ -0,0 +1,123 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdn + +import ( + "encoding/json" + "fmt" +) + +// ConfigLogSink - struct for ConfigLogSink +type ConfigLogSink struct { + LokiLogSink *LokiLogSink +} + +// LokiLogSinkAsConfigLogSink is a convenience function that returns LokiLogSink wrapped in ConfigLogSink +func LokiLogSinkAsConfigLogSink(v *LokiLogSink) ConfigLogSink { + return ConfigLogSink{ + LokiLogSink: v, + } +} + +// Unmarshal JSON data into one of the pointers in the struct +func (dst *ConfigLogSink) UnmarshalJSON(data []byte) error { + var err error + // use discriminator value to speed up the lookup + var jsonDict map[string]interface{} + err = newStrictDecoder(data).Decode(&jsonDict) + if err != nil { + return fmt.Errorf("failed to unmarshal JSON into map for the discriminator lookup") + } + + // check if the discriminator value is 'LokiLogSink' + if jsonDict["type"] == "LokiLogSink" { + // try to unmarshal JSON data into LokiLogSink + err = json.Unmarshal(data, &dst.LokiLogSink) + if err == nil { + return nil // data stored in dst.LokiLogSink, return on the first match + } else { + dst.LokiLogSink = nil + return fmt.Errorf("failed to unmarshal ConfigLogSink as LokiLogSink: %s", err.Error()) + } + } + + // check if the discriminator value is 'loki' + if jsonDict["type"] == "loki" { + // try to unmarshal JSON data into LokiLogSink + err = json.Unmarshal(data, &dst.LokiLogSink) + if err == nil { + return nil // data stored in dst.LokiLogSink, return on the first match + } else { + dst.LokiLogSink = nil + return fmt.Errorf("failed to unmarshal ConfigLogSink as LokiLogSink: %s", err.Error()) + } + } + + return nil +} + +// Marshal data from the first non-nil pointers in the struct to JSON +func (src ConfigLogSink) MarshalJSON() ([]byte, error) { + if src.LokiLogSink != nil { + return json.Marshal(&src.LokiLogSink) + } + + return []byte("{}"), nil // no data in oneOf schemas => empty JSON object +} + +// Get the actual instance +func (obj *ConfigLogSink) GetActualInstance() interface{} { + if obj == nil { + return nil + } + if obj.LokiLogSink != nil { + return obj.LokiLogSink + } + + // all schemas are nil + return nil +} + +type NullableConfigLogSink struct { + value *ConfigLogSink + isSet bool +} + +func (v NullableConfigLogSink) Get() *ConfigLogSink { + return v.value +} + +func (v *NullableConfigLogSink) Set(val *ConfigLogSink) { + v.value = val + v.isSet = true +} + +func (v NullableConfigLogSink) IsSet() bool { + return v.isSet +} + +func (v *NullableConfigLogSink) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableConfigLogSink(val *ConfigLogSink) *NullableConfigLogSink { + return &NullableConfigLogSink{value: val, isSet: true} +} + +func (v NullableConfigLogSink) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableConfigLogSink) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/cdn/model_config_log_sink_test.go b/services/cdn/model_config_log_sink_test.go new file mode 100644 index 000000000..51fc7c9ea --- /dev/null +++ b/services/cdn/model_config_log_sink_test.go @@ -0,0 +1,11 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdn diff --git a/services/cdn/model_create_distribution_payload.go b/services/cdn/model_create_distribution_payload.go index 85acbbb07..0f12f141b 100644 --- a/services/cdn/model_create_distribution_payload.go +++ b/services/cdn/model_create_distribution_payload.go @@ -99,6 +99,26 @@ func setCreateDistributionPayloadGetIntentIdAttributeType(arg *CreateDistributio type CreateDistributionPayloadGetIntentIdArgType = string type CreateDistributionPayloadGetIntentIdRetType = string +/* + types and functions for logSink +*/ + +// isModel +type CreateDistributionPayloadGetLogSinkAttributeType = *CreateDistributionPayloadLogSink +type CreateDistributionPayloadGetLogSinkArgType = CreateDistributionPayloadLogSink +type CreateDistributionPayloadGetLogSinkRetType = CreateDistributionPayloadLogSink + +func getCreateDistributionPayloadGetLogSinkAttributeTypeOk(arg CreateDistributionPayloadGetLogSinkAttributeType) (ret CreateDistributionPayloadGetLogSinkRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateDistributionPayloadGetLogSinkAttributeType(arg *CreateDistributionPayloadGetLogSinkAttributeType, val CreateDistributionPayloadGetLogSinkRetType) { + *arg = &val +} + /* types and functions for monthlyLimitBytes */ @@ -210,6 +230,7 @@ type CreateDistributionPayload struct { DefaultCacheDuration CreateDistributionPayloadGetDefaultCacheDurationAttributeType `json:"defaultCacheDuration,omitempty"` // While optional, it is greatly encouraged to provide an `intentId`. This is used to deduplicate requests. If multiple POST-Requests with the same `intentId` for a given `projectId` are received, all but the first request are dropped. IntentId CreateDistributionPayloadGetIntentIdAttributeType `json:"intentId,omitempty"` + LogSink CreateDistributionPayloadGetLogSinkAttributeType `json:"logSink,omitempty"` // Sets the monthly limit of bandwidth in bytes that the pullzone is allowed to use. MonthlyLimitBytes CreateDistributionPayloadGetMonthlyLimitBytesAttributeType `json:"monthlyLimitBytes,omitempty"` Optimizer CreateDistributionPayloadGetOptimizerAttributeType `json:"optimizer,omitempty"` @@ -336,6 +357,29 @@ func (o *CreateDistributionPayload) SetIntentId(v CreateDistributionPayloadGetIn setCreateDistributionPayloadGetIntentIdAttributeType(&o.IntentId, v) } +// GetLogSink returns the LogSink field value if set, zero value otherwise. +func (o *CreateDistributionPayload) GetLogSink() (res CreateDistributionPayloadGetLogSinkRetType) { + res, _ = o.GetLogSinkOk() + return +} + +// GetLogSinkOk returns a tuple with the LogSink field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateDistributionPayload) GetLogSinkOk() (ret CreateDistributionPayloadGetLogSinkRetType, ok bool) { + return getCreateDistributionPayloadGetLogSinkAttributeTypeOk(o.LogSink) +} + +// HasLogSink returns a boolean if a field has been set. +func (o *CreateDistributionPayload) HasLogSink() bool { + _, ok := o.GetLogSinkOk() + return ok +} + +// SetLogSink gets a reference to the given CreateDistributionPayloadLogSink and assigns it to the LogSink field. +func (o *CreateDistributionPayload) SetLogSink(v CreateDistributionPayloadGetLogSinkRetType) { + setCreateDistributionPayloadGetLogSinkAttributeType(&o.LogSink, v) +} + // GetMonthlyLimitBytes returns the MonthlyLimitBytes field value if set, zero value otherwise. func (o *CreateDistributionPayload) GetMonthlyLimitBytes() (res CreateDistributionPayloadGetMonthlyLimitBytesRetType) { res, _ = o.GetMonthlyLimitBytesOk() @@ -453,6 +497,9 @@ func (o CreateDistributionPayload) ToMap() (map[string]interface{}, error) { if val, ok := getCreateDistributionPayloadGetIntentIdAttributeTypeOk(o.IntentId); ok { toSerialize["IntentId"] = val } + if val, ok := getCreateDistributionPayloadGetLogSinkAttributeTypeOk(o.LogSink); ok { + toSerialize["LogSink"] = val + } if val, ok := getCreateDistributionPayloadGetMonthlyLimitBytesAttributeTypeOk(o.MonthlyLimitBytes); ok { toSerialize["MonthlyLimitBytes"] = val } diff --git a/services/cdn/model_create_distribution_payload_log_sink.go b/services/cdn/model_create_distribution_payload_log_sink.go new file mode 100644 index 000000000..24c3dcd13 --- /dev/null +++ b/services/cdn/model_create_distribution_payload_log_sink.go @@ -0,0 +1,123 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdn + +import ( + "encoding/json" + "fmt" +) + +// CreateDistributionPayloadLogSink - struct for CreateDistributionPayloadLogSink +type CreateDistributionPayloadLogSink struct { + PatchLokiLogSink *PatchLokiLogSink +} + +// PatchLokiLogSinkAsCreateDistributionPayloadLogSink is a convenience function that returns PatchLokiLogSink wrapped in CreateDistributionPayloadLogSink +func PatchLokiLogSinkAsCreateDistributionPayloadLogSink(v *PatchLokiLogSink) CreateDistributionPayloadLogSink { + return CreateDistributionPayloadLogSink{ + PatchLokiLogSink: v, + } +} + +// Unmarshal JSON data into one of the pointers in the struct +func (dst *CreateDistributionPayloadLogSink) UnmarshalJSON(data []byte) error { + var err error + // use discriminator value to speed up the lookup + var jsonDict map[string]interface{} + err = newStrictDecoder(data).Decode(&jsonDict) + if err != nil { + return fmt.Errorf("failed to unmarshal JSON into map for the discriminator lookup") + } + + // check if the discriminator value is 'PatchLokiLogSink' + if jsonDict["type"] == "PatchLokiLogSink" { + // try to unmarshal JSON data into PatchLokiLogSink + err = json.Unmarshal(data, &dst.PatchLokiLogSink) + if err == nil { + return nil // data stored in dst.PatchLokiLogSink, return on the first match + } else { + dst.PatchLokiLogSink = nil + return fmt.Errorf("failed to unmarshal CreateDistributionPayloadLogSink as PatchLokiLogSink: %s", err.Error()) + } + } + + // check if the discriminator value is 'loki' + if jsonDict["type"] == "loki" { + // try to unmarshal JSON data into PatchLokiLogSink + err = json.Unmarshal(data, &dst.PatchLokiLogSink) + if err == nil { + return nil // data stored in dst.PatchLokiLogSink, return on the first match + } else { + dst.PatchLokiLogSink = nil + return fmt.Errorf("failed to unmarshal CreateDistributionPayloadLogSink as PatchLokiLogSink: %s", err.Error()) + } + } + + return nil +} + +// Marshal data from the first non-nil pointers in the struct to JSON +func (src CreateDistributionPayloadLogSink) MarshalJSON() ([]byte, error) { + if src.PatchLokiLogSink != nil { + return json.Marshal(&src.PatchLokiLogSink) + } + + return []byte("{}"), nil // no data in oneOf schemas => empty JSON object +} + +// Get the actual instance +func (obj *CreateDistributionPayloadLogSink) GetActualInstance() interface{} { + if obj == nil { + return nil + } + if obj.PatchLokiLogSink != nil { + return obj.PatchLokiLogSink + } + + // all schemas are nil + return nil +} + +type NullableCreateDistributionPayloadLogSink struct { + value *CreateDistributionPayloadLogSink + isSet bool +} + +func (v NullableCreateDistributionPayloadLogSink) Get() *CreateDistributionPayloadLogSink { + return v.value +} + +func (v *NullableCreateDistributionPayloadLogSink) Set(val *CreateDistributionPayloadLogSink) { + v.value = val + v.isSet = true +} + +func (v NullableCreateDistributionPayloadLogSink) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateDistributionPayloadLogSink) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateDistributionPayloadLogSink(val *CreateDistributionPayloadLogSink) *NullableCreateDistributionPayloadLogSink { + return &NullableCreateDistributionPayloadLogSink{value: val, isSet: true} +} + +func (v NullableCreateDistributionPayloadLogSink) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateDistributionPayloadLogSink) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/cdn/model_create_distribution_payload_log_sink_test.go b/services/cdn/model_create_distribution_payload_log_sink_test.go new file mode 100644 index 000000000..51fc7c9ea --- /dev/null +++ b/services/cdn/model_create_distribution_payload_log_sink_test.go @@ -0,0 +1,11 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdn diff --git a/services/cdn/model_get_custom_domain_custom_certificate.go b/services/cdn/model_get_custom_domain_custom_certificate.go new file mode 100644 index 000000000..09d2da1e2 --- /dev/null +++ b/services/cdn/model_get_custom_domain_custom_certificate.go @@ -0,0 +1,171 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdn + +import ( + "encoding/json" +) + +// checks if the GetCustomDomainCustomCertificate type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &GetCustomDomainCustomCertificate{} + +/* + types and functions for type +*/ + +// isNotNullableString +type GetCustomDomainCustomCertificateGetTypeAttributeType = *string + +func getGetCustomDomainCustomCertificateGetTypeAttributeTypeOk(arg GetCustomDomainCustomCertificateGetTypeAttributeType) (ret GetCustomDomainCustomCertificateGetTypeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setGetCustomDomainCustomCertificateGetTypeAttributeType(arg *GetCustomDomainCustomCertificateGetTypeAttributeType, val GetCustomDomainCustomCertificateGetTypeRetType) { + *arg = &val +} + +type GetCustomDomainCustomCertificateGetTypeArgType = string +type GetCustomDomainCustomCertificateGetTypeRetType = string + +/* + types and functions for version +*/ + +// isInteger +type GetCustomDomainCustomCertificateGetVersionAttributeType = *int64 +type GetCustomDomainCustomCertificateGetVersionArgType = int64 +type GetCustomDomainCustomCertificateGetVersionRetType = int64 + +func getGetCustomDomainCustomCertificateGetVersionAttributeTypeOk(arg GetCustomDomainCustomCertificateGetVersionAttributeType) (ret GetCustomDomainCustomCertificateGetVersionRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setGetCustomDomainCustomCertificateGetVersionAttributeType(arg *GetCustomDomainCustomCertificateGetVersionAttributeType, val GetCustomDomainCustomCertificateGetVersionRetType) { + *arg = &val +} + +// GetCustomDomainCustomCertificate Returned if a custom certificate is used. Response does not contain the certificate or key. +type GetCustomDomainCustomCertificate struct { + // REQUIRED + Type GetCustomDomainCustomCertificateGetTypeAttributeType `json:"type" required:"true"` + // Whenever a new custom certificate is added the version is increased by 1. + // Can be cast to int32 without loss of precision. + // REQUIRED + Version GetCustomDomainCustomCertificateGetVersionAttributeType `json:"version" required:"true"` +} + +type _GetCustomDomainCustomCertificate GetCustomDomainCustomCertificate + +// NewGetCustomDomainCustomCertificate instantiates a new GetCustomDomainCustomCertificate 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 NewGetCustomDomainCustomCertificate(types GetCustomDomainCustomCertificateGetTypeArgType, version GetCustomDomainCustomCertificateGetVersionArgType) *GetCustomDomainCustomCertificate { + this := GetCustomDomainCustomCertificate{} + setGetCustomDomainCustomCertificateGetTypeAttributeType(&this.Type, types) + setGetCustomDomainCustomCertificateGetVersionAttributeType(&this.Version, version) + return &this +} + +// NewGetCustomDomainCustomCertificateWithDefaults instantiates a new GetCustomDomainCustomCertificate 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 NewGetCustomDomainCustomCertificateWithDefaults() *GetCustomDomainCustomCertificate { + this := GetCustomDomainCustomCertificate{} + return &this +} + +// GetType returns the Type field value +func (o *GetCustomDomainCustomCertificate) GetType() (ret GetCustomDomainCustomCertificateGetTypeRetType) { + ret, _ = o.GetTypeOk() + return ret +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *GetCustomDomainCustomCertificate) GetTypeOk() (ret GetCustomDomainCustomCertificateGetTypeRetType, ok bool) { + return getGetCustomDomainCustomCertificateGetTypeAttributeTypeOk(o.Type) +} + +// SetType sets field value +func (o *GetCustomDomainCustomCertificate) SetType(v GetCustomDomainCustomCertificateGetTypeRetType) { + setGetCustomDomainCustomCertificateGetTypeAttributeType(&o.Type, v) +} + +// GetVersion returns the Version field value +func (o *GetCustomDomainCustomCertificate) GetVersion() (ret GetCustomDomainCustomCertificateGetVersionRetType) { + ret, _ = o.GetVersionOk() + return ret +} + +// GetVersionOk returns a tuple with the Version field value +// and a boolean to check if the value has been set. +func (o *GetCustomDomainCustomCertificate) GetVersionOk() (ret GetCustomDomainCustomCertificateGetVersionRetType, ok bool) { + return getGetCustomDomainCustomCertificateGetVersionAttributeTypeOk(o.Version) +} + +// SetVersion sets field value +func (o *GetCustomDomainCustomCertificate) SetVersion(v GetCustomDomainCustomCertificateGetVersionRetType) { + setGetCustomDomainCustomCertificateGetVersionAttributeType(&o.Version, v) +} + +func (o GetCustomDomainCustomCertificate) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getGetCustomDomainCustomCertificateGetTypeAttributeTypeOk(o.Type); ok { + toSerialize["Type"] = val + } + if val, ok := getGetCustomDomainCustomCertificateGetVersionAttributeTypeOk(o.Version); ok { + toSerialize["Version"] = val + } + return toSerialize, nil +} + +type NullableGetCustomDomainCustomCertificate struct { + value *GetCustomDomainCustomCertificate + isSet bool +} + +func (v NullableGetCustomDomainCustomCertificate) Get() *GetCustomDomainCustomCertificate { + return v.value +} + +func (v *NullableGetCustomDomainCustomCertificate) Set(val *GetCustomDomainCustomCertificate) { + v.value = val + v.isSet = true +} + +func (v NullableGetCustomDomainCustomCertificate) IsSet() bool { + return v.isSet +} + +func (v *NullableGetCustomDomainCustomCertificate) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableGetCustomDomainCustomCertificate(val *GetCustomDomainCustomCertificate) *NullableGetCustomDomainCustomCertificate { + return &NullableGetCustomDomainCustomCertificate{value: val, isSet: true} +} + +func (v NullableGetCustomDomainCustomCertificate) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableGetCustomDomainCustomCertificate) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/cdn/model_get_custom_domain_custom_certificate_test.go b/services/cdn/model_get_custom_domain_custom_certificate_test.go new file mode 100644 index 000000000..51fc7c9ea --- /dev/null +++ b/services/cdn/model_get_custom_domain_custom_certificate_test.go @@ -0,0 +1,11 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdn diff --git a/services/cdn/model_get_custom_domain_managed_certificate.go b/services/cdn/model_get_custom_domain_managed_certificate.go new file mode 100644 index 000000000..a8efa5cd5 --- /dev/null +++ b/services/cdn/model_get_custom_domain_managed_certificate.go @@ -0,0 +1,126 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdn + +import ( + "encoding/json" +) + +// checks if the GetCustomDomainManagedCertificate type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &GetCustomDomainManagedCertificate{} + +/* + types and functions for type +*/ + +// isNotNullableString +type GetCustomDomainManagedCertificateGetTypeAttributeType = *string + +func getGetCustomDomainManagedCertificateGetTypeAttributeTypeOk(arg GetCustomDomainManagedCertificateGetTypeAttributeType) (ret GetCustomDomainManagedCertificateGetTypeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setGetCustomDomainManagedCertificateGetTypeAttributeType(arg *GetCustomDomainManagedCertificateGetTypeAttributeType, val GetCustomDomainManagedCertificateGetTypeRetType) { + *arg = &val +} + +type GetCustomDomainManagedCertificateGetTypeArgType = string +type GetCustomDomainManagedCertificateGetTypeRetType = string + +// GetCustomDomainManagedCertificate This is returned when no custom certificate is used. We provision and manage a Let's Encrypt Certificate for you +type GetCustomDomainManagedCertificate struct { + // REQUIRED + Type GetCustomDomainManagedCertificateGetTypeAttributeType `json:"type" required:"true"` +} + +type _GetCustomDomainManagedCertificate GetCustomDomainManagedCertificate + +// NewGetCustomDomainManagedCertificate instantiates a new GetCustomDomainManagedCertificate 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 NewGetCustomDomainManagedCertificate(types GetCustomDomainManagedCertificateGetTypeArgType) *GetCustomDomainManagedCertificate { + this := GetCustomDomainManagedCertificate{} + setGetCustomDomainManagedCertificateGetTypeAttributeType(&this.Type, types) + return &this +} + +// NewGetCustomDomainManagedCertificateWithDefaults instantiates a new GetCustomDomainManagedCertificate 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 NewGetCustomDomainManagedCertificateWithDefaults() *GetCustomDomainManagedCertificate { + this := GetCustomDomainManagedCertificate{} + return &this +} + +// GetType returns the Type field value +func (o *GetCustomDomainManagedCertificate) GetType() (ret GetCustomDomainManagedCertificateGetTypeRetType) { + ret, _ = o.GetTypeOk() + return ret +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *GetCustomDomainManagedCertificate) GetTypeOk() (ret GetCustomDomainManagedCertificateGetTypeRetType, ok bool) { + return getGetCustomDomainManagedCertificateGetTypeAttributeTypeOk(o.Type) +} + +// SetType sets field value +func (o *GetCustomDomainManagedCertificate) SetType(v GetCustomDomainManagedCertificateGetTypeRetType) { + setGetCustomDomainManagedCertificateGetTypeAttributeType(&o.Type, v) +} + +func (o GetCustomDomainManagedCertificate) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getGetCustomDomainManagedCertificateGetTypeAttributeTypeOk(o.Type); ok { + toSerialize["Type"] = val + } + return toSerialize, nil +} + +type NullableGetCustomDomainManagedCertificate struct { + value *GetCustomDomainManagedCertificate + isSet bool +} + +func (v NullableGetCustomDomainManagedCertificate) Get() *GetCustomDomainManagedCertificate { + return v.value +} + +func (v *NullableGetCustomDomainManagedCertificate) Set(val *GetCustomDomainManagedCertificate) { + v.value = val + v.isSet = true +} + +func (v NullableGetCustomDomainManagedCertificate) IsSet() bool { + return v.isSet +} + +func (v *NullableGetCustomDomainManagedCertificate) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableGetCustomDomainManagedCertificate(val *GetCustomDomainManagedCertificate) *NullableGetCustomDomainManagedCertificate { + return &NullableGetCustomDomainManagedCertificate{value: val, isSet: true} +} + +func (v NullableGetCustomDomainManagedCertificate) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableGetCustomDomainManagedCertificate) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/cdn/model_get_custom_domain_managed_certificate_test.go b/services/cdn/model_get_custom_domain_managed_certificate_test.go new file mode 100644 index 000000000..51fc7c9ea --- /dev/null +++ b/services/cdn/model_get_custom_domain_managed_certificate_test.go @@ -0,0 +1,11 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdn diff --git a/services/cdn/model_get_custom_domain_response.go b/services/cdn/model_get_custom_domain_response.go index bd1235e16..0a7c1b09a 100644 --- a/services/cdn/model_get_custom_domain_response.go +++ b/services/cdn/model_get_custom_domain_response.go @@ -17,6 +17,26 @@ import ( // checks if the GetCustomDomainResponse type satisfies the MappedNullable interface at compile time var _ MappedNullable = &GetCustomDomainResponse{} +/* + types and functions for certificate +*/ + +// isModel +type GetCustomDomainResponseGetCertificateAttributeType = *GetCustomDomainResponseCertificate +type GetCustomDomainResponseGetCertificateArgType = GetCustomDomainResponseCertificate +type GetCustomDomainResponseGetCertificateRetType = GetCustomDomainResponseCertificate + +func getGetCustomDomainResponseGetCertificateAttributeTypeOk(arg GetCustomDomainResponseGetCertificateAttributeType) (ret GetCustomDomainResponseGetCertificateRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setGetCustomDomainResponseGetCertificateAttributeType(arg *GetCustomDomainResponseGetCertificateAttributeType, val GetCustomDomainResponseGetCertificateRetType) { + *arg = &val +} + /* types and functions for customDomain */ @@ -60,6 +80,8 @@ type GetCustomDomainResponseGetDomainRetType = string // GetCustomDomainResponse struct for GetCustomDomainResponse type GetCustomDomainResponse struct { + // REQUIRED + Certificate GetCustomDomainResponseGetCertificateAttributeType `json:"certificate" required:"true"` // REQUIRED CustomDomain GetCustomDomainResponseGetCustomDomainAttributeType `json:"customDomain" required:"true"` // Deprecated: Check the GitHub changelog for alternatives @@ -73,8 +95,9 @@ type _GetCustomDomainResponse GetCustomDomainResponse // 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 NewGetCustomDomainResponse(customDomain GetCustomDomainResponseGetCustomDomainArgType, domain GetCustomDomainResponseGetDomainArgType) *GetCustomDomainResponse { +func NewGetCustomDomainResponse(certificate GetCustomDomainResponseGetCertificateArgType, customDomain GetCustomDomainResponseGetCustomDomainArgType, domain GetCustomDomainResponseGetDomainArgType) *GetCustomDomainResponse { this := GetCustomDomainResponse{} + setGetCustomDomainResponseGetCertificateAttributeType(&this.Certificate, certificate) setGetCustomDomainResponseGetCustomDomainAttributeType(&this.CustomDomain, customDomain) setGetCustomDomainResponseGetDomainAttributeType(&this.Domain, domain) return &this @@ -88,6 +111,23 @@ func NewGetCustomDomainResponseWithDefaults() *GetCustomDomainResponse { return &this } +// GetCertificate returns the Certificate field value +func (o *GetCustomDomainResponse) GetCertificate() (ret GetCustomDomainResponseGetCertificateRetType) { + ret, _ = o.GetCertificateOk() + return ret +} + +// GetCertificateOk returns a tuple with the Certificate field value +// and a boolean to check if the value has been set. +func (o *GetCustomDomainResponse) GetCertificateOk() (ret GetCustomDomainResponseGetCertificateRetType, ok bool) { + return getGetCustomDomainResponseGetCertificateAttributeTypeOk(o.Certificate) +} + +// SetCertificate sets field value +func (o *GetCustomDomainResponse) SetCertificate(v GetCustomDomainResponseGetCertificateRetType) { + setGetCustomDomainResponseGetCertificateAttributeType(&o.Certificate, v) +} + // GetCustomDomain returns the CustomDomain field value func (o *GetCustomDomainResponse) GetCustomDomain() (ret GetCustomDomainResponseGetCustomDomainRetType) { ret, _ = o.GetCustomDomainOk() @@ -127,6 +167,9 @@ func (o *GetCustomDomainResponse) SetDomain(v GetCustomDomainResponseGetDomainRe func (o GetCustomDomainResponse) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} + if val, ok := getGetCustomDomainResponseGetCertificateAttributeTypeOk(o.Certificate); ok { + toSerialize["Certificate"] = val + } if val, ok := getGetCustomDomainResponseGetCustomDomainAttributeTypeOk(o.CustomDomain); ok { toSerialize["CustomDomain"] = val } diff --git a/services/cdn/model_get_custom_domain_response_certificate.go b/services/cdn/model_get_custom_domain_response_certificate.go new file mode 100644 index 000000000..724971638 --- /dev/null +++ b/services/cdn/model_get_custom_domain_response_certificate.go @@ -0,0 +1,163 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdn + +import ( + "encoding/json" + "fmt" +) + +// GetCustomDomainResponseCertificate - struct for GetCustomDomainResponseCertificate +type GetCustomDomainResponseCertificate struct { + GetCustomDomainCustomCertificate *GetCustomDomainCustomCertificate + GetCustomDomainManagedCertificate *GetCustomDomainManagedCertificate +} + +// GetCustomDomainCustomCertificateAsGetCustomDomainResponseCertificate is a convenience function that returns GetCustomDomainCustomCertificate wrapped in GetCustomDomainResponseCertificate +func GetCustomDomainCustomCertificateAsGetCustomDomainResponseCertificate(v *GetCustomDomainCustomCertificate) GetCustomDomainResponseCertificate { + return GetCustomDomainResponseCertificate{ + GetCustomDomainCustomCertificate: v, + } +} + +// GetCustomDomainManagedCertificateAsGetCustomDomainResponseCertificate is a convenience function that returns GetCustomDomainManagedCertificate wrapped in GetCustomDomainResponseCertificate +func GetCustomDomainManagedCertificateAsGetCustomDomainResponseCertificate(v *GetCustomDomainManagedCertificate) GetCustomDomainResponseCertificate { + return GetCustomDomainResponseCertificate{ + GetCustomDomainManagedCertificate: v, + } +} + +// Unmarshal JSON data into one of the pointers in the struct +func (dst *GetCustomDomainResponseCertificate) UnmarshalJSON(data []byte) error { + var err error + // use discriminator value to speed up the lookup + var jsonDict map[string]interface{} + err = newStrictDecoder(data).Decode(&jsonDict) + if err != nil { + return fmt.Errorf("failed to unmarshal JSON into map for the discriminator lookup") + } + + // check if the discriminator value is 'GetCustomDomainCustomCertificate' + if jsonDict["type"] == "GetCustomDomainCustomCertificate" { + // try to unmarshal JSON data into GetCustomDomainCustomCertificate + err = json.Unmarshal(data, &dst.GetCustomDomainCustomCertificate) + if err == nil { + return nil // data stored in dst.GetCustomDomainCustomCertificate, return on the first match + } else { + dst.GetCustomDomainCustomCertificate = nil + return fmt.Errorf("failed to unmarshal GetCustomDomainResponseCertificate as GetCustomDomainCustomCertificate: %s", err.Error()) + } + } + + // check if the discriminator value is 'GetCustomDomainManagedCertificate' + if jsonDict["type"] == "GetCustomDomainManagedCertificate" { + // try to unmarshal JSON data into GetCustomDomainManagedCertificate + err = json.Unmarshal(data, &dst.GetCustomDomainManagedCertificate) + if err == nil { + return nil // data stored in dst.GetCustomDomainManagedCertificate, return on the first match + } else { + dst.GetCustomDomainManagedCertificate = nil + return fmt.Errorf("failed to unmarshal GetCustomDomainResponseCertificate as GetCustomDomainManagedCertificate: %s", err.Error()) + } + } + + // check if the discriminator value is 'custom' + if jsonDict["type"] == "custom" { + // try to unmarshal JSON data into GetCustomDomainCustomCertificate + err = json.Unmarshal(data, &dst.GetCustomDomainCustomCertificate) + if err == nil { + return nil // data stored in dst.GetCustomDomainCustomCertificate, return on the first match + } else { + dst.GetCustomDomainCustomCertificate = nil + return fmt.Errorf("failed to unmarshal GetCustomDomainResponseCertificate as GetCustomDomainCustomCertificate: %s", err.Error()) + } + } + + // check if the discriminator value is 'managed' + if jsonDict["type"] == "managed" { + // try to unmarshal JSON data into GetCustomDomainManagedCertificate + err = json.Unmarshal(data, &dst.GetCustomDomainManagedCertificate) + if err == nil { + return nil // data stored in dst.GetCustomDomainManagedCertificate, return on the first match + } else { + dst.GetCustomDomainManagedCertificate = nil + return fmt.Errorf("failed to unmarshal GetCustomDomainResponseCertificate as GetCustomDomainManagedCertificate: %s", err.Error()) + } + } + + return nil +} + +// Marshal data from the first non-nil pointers in the struct to JSON +func (src GetCustomDomainResponseCertificate) MarshalJSON() ([]byte, error) { + if src.GetCustomDomainCustomCertificate != nil { + return json.Marshal(&src.GetCustomDomainCustomCertificate) + } + + if src.GetCustomDomainManagedCertificate != nil { + return json.Marshal(&src.GetCustomDomainManagedCertificate) + } + + return []byte("{}"), nil // no data in oneOf schemas => empty JSON object +} + +// Get the actual instance +func (obj *GetCustomDomainResponseCertificate) GetActualInstance() interface{} { + if obj == nil { + return nil + } + if obj.GetCustomDomainCustomCertificate != nil { + return obj.GetCustomDomainCustomCertificate + } + + if obj.GetCustomDomainManagedCertificate != nil { + return obj.GetCustomDomainManagedCertificate + } + + // all schemas are nil + return nil +} + +type NullableGetCustomDomainResponseCertificate struct { + value *GetCustomDomainResponseCertificate + isSet bool +} + +func (v NullableGetCustomDomainResponseCertificate) Get() *GetCustomDomainResponseCertificate { + return v.value +} + +func (v *NullableGetCustomDomainResponseCertificate) Set(val *GetCustomDomainResponseCertificate) { + v.value = val + v.isSet = true +} + +func (v NullableGetCustomDomainResponseCertificate) IsSet() bool { + return v.isSet +} + +func (v *NullableGetCustomDomainResponseCertificate) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableGetCustomDomainResponseCertificate(val *GetCustomDomainResponseCertificate) *NullableGetCustomDomainResponseCertificate { + return &NullableGetCustomDomainResponseCertificate{value: val, isSet: true} +} + +func (v NullableGetCustomDomainResponseCertificate) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableGetCustomDomainResponseCertificate) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/cdn/model_get_custom_domain_response_certificate_test.go b/services/cdn/model_get_custom_domain_response_certificate_test.go new file mode 100644 index 000000000..51fc7c9ea --- /dev/null +++ b/services/cdn/model_get_custom_domain_response_certificate_test.go @@ -0,0 +1,11 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdn diff --git a/services/cdn/model_loki_log_sink.go b/services/cdn/model_loki_log_sink.go new file mode 100644 index 000000000..a641b483e --- /dev/null +++ b/services/cdn/model_loki_log_sink.go @@ -0,0 +1,170 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdn + +import ( + "encoding/json" +) + +// checks if the LokiLogSink type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &LokiLogSink{} + +/* + types and functions for pushUrl +*/ + +// isNotNullableString +type LokiLogSinkGetPushUrlAttributeType = *string + +func getLokiLogSinkGetPushUrlAttributeTypeOk(arg LokiLogSinkGetPushUrlAttributeType) (ret LokiLogSinkGetPushUrlRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setLokiLogSinkGetPushUrlAttributeType(arg *LokiLogSinkGetPushUrlAttributeType, val LokiLogSinkGetPushUrlRetType) { + *arg = &val +} + +type LokiLogSinkGetPushUrlArgType = string +type LokiLogSinkGetPushUrlRetType = string + +/* + types and functions for type +*/ + +// isNotNullableString +type LokiLogSinkGetTypeAttributeType = *string + +func getLokiLogSinkGetTypeAttributeTypeOk(arg LokiLogSinkGetTypeAttributeType) (ret LokiLogSinkGetTypeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setLokiLogSinkGetTypeAttributeType(arg *LokiLogSinkGetTypeAttributeType, val LokiLogSinkGetTypeRetType) { + *arg = &val +} + +type LokiLogSinkGetTypeArgType = string +type LokiLogSinkGetTypeRetType = string + +// LokiLogSink struct for LokiLogSink +type LokiLogSink struct { + // REQUIRED + PushUrl LokiLogSinkGetPushUrlAttributeType `json:"pushUrl" required:"true"` + // REQUIRED + Type LokiLogSinkGetTypeAttributeType `json:"type" required:"true"` +} + +type _LokiLogSink LokiLogSink + +// NewLokiLogSink instantiates a new LokiLogSink 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 NewLokiLogSink(pushUrl LokiLogSinkGetPushUrlArgType, types LokiLogSinkGetTypeArgType) *LokiLogSink { + this := LokiLogSink{} + setLokiLogSinkGetPushUrlAttributeType(&this.PushUrl, pushUrl) + setLokiLogSinkGetTypeAttributeType(&this.Type, types) + return &this +} + +// NewLokiLogSinkWithDefaults instantiates a new LokiLogSink 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 NewLokiLogSinkWithDefaults() *LokiLogSink { + this := LokiLogSink{} + return &this +} + +// GetPushUrl returns the PushUrl field value +func (o *LokiLogSink) GetPushUrl() (ret LokiLogSinkGetPushUrlRetType) { + ret, _ = o.GetPushUrlOk() + return ret +} + +// GetPushUrlOk returns a tuple with the PushUrl field value +// and a boolean to check if the value has been set. +func (o *LokiLogSink) GetPushUrlOk() (ret LokiLogSinkGetPushUrlRetType, ok bool) { + return getLokiLogSinkGetPushUrlAttributeTypeOk(o.PushUrl) +} + +// SetPushUrl sets field value +func (o *LokiLogSink) SetPushUrl(v LokiLogSinkGetPushUrlRetType) { + setLokiLogSinkGetPushUrlAttributeType(&o.PushUrl, v) +} + +// GetType returns the Type field value +func (o *LokiLogSink) GetType() (ret LokiLogSinkGetTypeRetType) { + ret, _ = o.GetTypeOk() + return ret +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *LokiLogSink) GetTypeOk() (ret LokiLogSinkGetTypeRetType, ok bool) { + return getLokiLogSinkGetTypeAttributeTypeOk(o.Type) +} + +// SetType sets field value +func (o *LokiLogSink) SetType(v LokiLogSinkGetTypeRetType) { + setLokiLogSinkGetTypeAttributeType(&o.Type, v) +} + +func (o LokiLogSink) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getLokiLogSinkGetPushUrlAttributeTypeOk(o.PushUrl); ok { + toSerialize["PushUrl"] = val + } + if val, ok := getLokiLogSinkGetTypeAttributeTypeOk(o.Type); ok { + toSerialize["Type"] = val + } + return toSerialize, nil +} + +type NullableLokiLogSink struct { + value *LokiLogSink + isSet bool +} + +func (v NullableLokiLogSink) Get() *LokiLogSink { + return v.value +} + +func (v *NullableLokiLogSink) Set(val *LokiLogSink) { + v.value = val + v.isSet = true +} + +func (v NullableLokiLogSink) IsSet() bool { + return v.isSet +} + +func (v *NullableLokiLogSink) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableLokiLogSink(val *LokiLogSink) *NullableLokiLogSink { + return &NullableLokiLogSink{value: val, isSet: true} +} + +func (v NullableLokiLogSink) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableLokiLogSink) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/cdn/model_loki_log_sink_test.go b/services/cdn/model_loki_log_sink_test.go new file mode 100644 index 000000000..51fc7c9ea --- /dev/null +++ b/services/cdn/model_loki_log_sink_test.go @@ -0,0 +1,11 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdn diff --git a/services/cdn/model_patch_loki_log_sink.go b/services/cdn/model_patch_loki_log_sink.go new file mode 100644 index 000000000..b7922a173 --- /dev/null +++ b/services/cdn/model_patch_loki_log_sink.go @@ -0,0 +1,258 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdn + +import ( + "encoding/json" +) + +// checks if the PatchLokiLogSink type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &PatchLokiLogSink{} + +/* + types and functions for password +*/ + +// isNotNullableString +type PatchLokiLogSinkGetPasswordAttributeType = *string + +func getPatchLokiLogSinkGetPasswordAttributeTypeOk(arg PatchLokiLogSinkGetPasswordAttributeType) (ret PatchLokiLogSinkGetPasswordRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setPatchLokiLogSinkGetPasswordAttributeType(arg *PatchLokiLogSinkGetPasswordAttributeType, val PatchLokiLogSinkGetPasswordRetType) { + *arg = &val +} + +type PatchLokiLogSinkGetPasswordArgType = string +type PatchLokiLogSinkGetPasswordRetType = string + +/* + types and functions for pushUrl +*/ + +// isNotNullableString +type PatchLokiLogSinkGetPushUrlAttributeType = *string + +func getPatchLokiLogSinkGetPushUrlAttributeTypeOk(arg PatchLokiLogSinkGetPushUrlAttributeType) (ret PatchLokiLogSinkGetPushUrlRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setPatchLokiLogSinkGetPushUrlAttributeType(arg *PatchLokiLogSinkGetPushUrlAttributeType, val PatchLokiLogSinkGetPushUrlRetType) { + *arg = &val +} + +type PatchLokiLogSinkGetPushUrlArgType = string +type PatchLokiLogSinkGetPushUrlRetType = string + +/* + types and functions for type +*/ + +// isNotNullableString +type PatchLokiLogSinkGetTypeAttributeType = *string + +func getPatchLokiLogSinkGetTypeAttributeTypeOk(arg PatchLokiLogSinkGetTypeAttributeType) (ret PatchLokiLogSinkGetTypeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setPatchLokiLogSinkGetTypeAttributeType(arg *PatchLokiLogSinkGetTypeAttributeType, val PatchLokiLogSinkGetTypeRetType) { + *arg = &val +} + +type PatchLokiLogSinkGetTypeArgType = string +type PatchLokiLogSinkGetTypeRetType = string + +/* + types and functions for username +*/ + +// isNotNullableString +type PatchLokiLogSinkGetUsernameAttributeType = *string + +func getPatchLokiLogSinkGetUsernameAttributeTypeOk(arg PatchLokiLogSinkGetUsernameAttributeType) (ret PatchLokiLogSinkGetUsernameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setPatchLokiLogSinkGetUsernameAttributeType(arg *PatchLokiLogSinkGetUsernameAttributeType, val PatchLokiLogSinkGetUsernameRetType) { + *arg = &val +} + +type PatchLokiLogSinkGetUsernameArgType = string +type PatchLokiLogSinkGetUsernameRetType = string + +// PatchLokiLogSink struct for PatchLokiLogSink +type PatchLokiLogSink struct { + // REQUIRED + Password PatchLokiLogSinkGetPasswordAttributeType `json:"password" required:"true"` + // REQUIRED + PushUrl PatchLokiLogSinkGetPushUrlAttributeType `json:"pushUrl" required:"true"` + // REQUIRED + Type PatchLokiLogSinkGetTypeAttributeType `json:"type" required:"true"` + // REQUIRED + Username PatchLokiLogSinkGetUsernameAttributeType `json:"username" required:"true"` +} + +type _PatchLokiLogSink PatchLokiLogSink + +// NewPatchLokiLogSink instantiates a new PatchLokiLogSink 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 NewPatchLokiLogSink(password PatchLokiLogSinkGetPasswordArgType, pushUrl PatchLokiLogSinkGetPushUrlArgType, types PatchLokiLogSinkGetTypeArgType, username PatchLokiLogSinkGetUsernameArgType) *PatchLokiLogSink { + this := PatchLokiLogSink{} + setPatchLokiLogSinkGetPasswordAttributeType(&this.Password, password) + setPatchLokiLogSinkGetPushUrlAttributeType(&this.PushUrl, pushUrl) + setPatchLokiLogSinkGetTypeAttributeType(&this.Type, types) + setPatchLokiLogSinkGetUsernameAttributeType(&this.Username, username) + return &this +} + +// NewPatchLokiLogSinkWithDefaults instantiates a new PatchLokiLogSink 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 NewPatchLokiLogSinkWithDefaults() *PatchLokiLogSink { + this := PatchLokiLogSink{} + return &this +} + +// GetPassword returns the Password field value +func (o *PatchLokiLogSink) GetPassword() (ret PatchLokiLogSinkGetPasswordRetType) { + ret, _ = o.GetPasswordOk() + return ret +} + +// GetPasswordOk returns a tuple with the Password field value +// and a boolean to check if the value has been set. +func (o *PatchLokiLogSink) GetPasswordOk() (ret PatchLokiLogSinkGetPasswordRetType, ok bool) { + return getPatchLokiLogSinkGetPasswordAttributeTypeOk(o.Password) +} + +// SetPassword sets field value +func (o *PatchLokiLogSink) SetPassword(v PatchLokiLogSinkGetPasswordRetType) { + setPatchLokiLogSinkGetPasswordAttributeType(&o.Password, v) +} + +// GetPushUrl returns the PushUrl field value +func (o *PatchLokiLogSink) GetPushUrl() (ret PatchLokiLogSinkGetPushUrlRetType) { + ret, _ = o.GetPushUrlOk() + return ret +} + +// GetPushUrlOk returns a tuple with the PushUrl field value +// and a boolean to check if the value has been set. +func (o *PatchLokiLogSink) GetPushUrlOk() (ret PatchLokiLogSinkGetPushUrlRetType, ok bool) { + return getPatchLokiLogSinkGetPushUrlAttributeTypeOk(o.PushUrl) +} + +// SetPushUrl sets field value +func (o *PatchLokiLogSink) SetPushUrl(v PatchLokiLogSinkGetPushUrlRetType) { + setPatchLokiLogSinkGetPushUrlAttributeType(&o.PushUrl, v) +} + +// GetType returns the Type field value +func (o *PatchLokiLogSink) GetType() (ret PatchLokiLogSinkGetTypeRetType) { + ret, _ = o.GetTypeOk() + return ret +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *PatchLokiLogSink) GetTypeOk() (ret PatchLokiLogSinkGetTypeRetType, ok bool) { + return getPatchLokiLogSinkGetTypeAttributeTypeOk(o.Type) +} + +// SetType sets field value +func (o *PatchLokiLogSink) SetType(v PatchLokiLogSinkGetTypeRetType) { + setPatchLokiLogSinkGetTypeAttributeType(&o.Type, v) +} + +// GetUsername returns the Username field value +func (o *PatchLokiLogSink) GetUsername() (ret PatchLokiLogSinkGetUsernameRetType) { + ret, _ = o.GetUsernameOk() + return ret +} + +// GetUsernameOk returns a tuple with the Username field value +// and a boolean to check if the value has been set. +func (o *PatchLokiLogSink) GetUsernameOk() (ret PatchLokiLogSinkGetUsernameRetType, ok bool) { + return getPatchLokiLogSinkGetUsernameAttributeTypeOk(o.Username) +} + +// SetUsername sets field value +func (o *PatchLokiLogSink) SetUsername(v PatchLokiLogSinkGetUsernameRetType) { + setPatchLokiLogSinkGetUsernameAttributeType(&o.Username, v) +} + +func (o PatchLokiLogSink) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getPatchLokiLogSinkGetPasswordAttributeTypeOk(o.Password); ok { + toSerialize["Password"] = val + } + if val, ok := getPatchLokiLogSinkGetPushUrlAttributeTypeOk(o.PushUrl); ok { + toSerialize["PushUrl"] = val + } + if val, ok := getPatchLokiLogSinkGetTypeAttributeTypeOk(o.Type); ok { + toSerialize["Type"] = val + } + if val, ok := getPatchLokiLogSinkGetUsernameAttributeTypeOk(o.Username); ok { + toSerialize["Username"] = val + } + return toSerialize, nil +} + +type NullablePatchLokiLogSink struct { + value *PatchLokiLogSink + isSet bool +} + +func (v NullablePatchLokiLogSink) Get() *PatchLokiLogSink { + return v.value +} + +func (v *NullablePatchLokiLogSink) Set(val *PatchLokiLogSink) { + v.value = val + v.isSet = true +} + +func (v NullablePatchLokiLogSink) IsSet() bool { + return v.isSet +} + +func (v *NullablePatchLokiLogSink) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullablePatchLokiLogSink(val *PatchLokiLogSink) *NullablePatchLokiLogSink { + return &NullablePatchLokiLogSink{value: val, isSet: true} +} + +func (v NullablePatchLokiLogSink) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullablePatchLokiLogSink) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/cdn/model_patch_loki_log_sink_test.go b/services/cdn/model_patch_loki_log_sink_test.go new file mode 100644 index 000000000..51fc7c9ea --- /dev/null +++ b/services/cdn/model_patch_loki_log_sink_test.go @@ -0,0 +1,11 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdn diff --git a/services/cdn/model_put_custom_domain_custom_certificate.go b/services/cdn/model_put_custom_domain_custom_certificate.go new file mode 100644 index 000000000..ece790529 --- /dev/null +++ b/services/cdn/model_put_custom_domain_custom_certificate.go @@ -0,0 +1,216 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdn + +import ( + "encoding/json" +) + +// checks if the PutCustomDomainCustomCertificate type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &PutCustomDomainCustomCertificate{} + +/* + types and functions for certificate +*/ + +// isNotNullableString +type PutCustomDomainCustomCertificateGetCertificateAttributeType = *string + +func getPutCustomDomainCustomCertificateGetCertificateAttributeTypeOk(arg PutCustomDomainCustomCertificateGetCertificateAttributeType) (ret PutCustomDomainCustomCertificateGetCertificateRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setPutCustomDomainCustomCertificateGetCertificateAttributeType(arg *PutCustomDomainCustomCertificateGetCertificateAttributeType, val PutCustomDomainCustomCertificateGetCertificateRetType) { + *arg = &val +} + +type PutCustomDomainCustomCertificateGetCertificateArgType = string +type PutCustomDomainCustomCertificateGetCertificateRetType = string + +/* + types and functions for key +*/ + +// isNotNullableString +type PutCustomDomainCustomCertificateGetKeyAttributeType = *string + +func getPutCustomDomainCustomCertificateGetKeyAttributeTypeOk(arg PutCustomDomainCustomCertificateGetKeyAttributeType) (ret PutCustomDomainCustomCertificateGetKeyRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setPutCustomDomainCustomCertificateGetKeyAttributeType(arg *PutCustomDomainCustomCertificateGetKeyAttributeType, val PutCustomDomainCustomCertificateGetKeyRetType) { + *arg = &val +} + +type PutCustomDomainCustomCertificateGetKeyArgType = string +type PutCustomDomainCustomCertificateGetKeyRetType = string + +/* + types and functions for type +*/ + +// isNotNullableString +type PutCustomDomainCustomCertificateGetTypeAttributeType = *string + +func getPutCustomDomainCustomCertificateGetTypeAttributeTypeOk(arg PutCustomDomainCustomCertificateGetTypeAttributeType) (ret PutCustomDomainCustomCertificateGetTypeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setPutCustomDomainCustomCertificateGetTypeAttributeType(arg *PutCustomDomainCustomCertificateGetTypeAttributeType, val PutCustomDomainCustomCertificateGetTypeRetType) { + *arg = &val +} + +type PutCustomDomainCustomCertificateGetTypeArgType = string +type PutCustomDomainCustomCertificateGetTypeRetType = string + +// PutCustomDomainCustomCertificate Returned if a custom certificate is used. Response does not contain the certificate or key. +type PutCustomDomainCustomCertificate struct { + // base64-encoded certificate + // REQUIRED + Certificate PutCustomDomainCustomCertificateGetCertificateAttributeType `json:"certificate" required:"true"` + // base64-encoded key + // REQUIRED + Key PutCustomDomainCustomCertificateGetKeyAttributeType `json:"key" required:"true"` + // REQUIRED + Type PutCustomDomainCustomCertificateGetTypeAttributeType `json:"type" required:"true"` +} + +type _PutCustomDomainCustomCertificate PutCustomDomainCustomCertificate + +// NewPutCustomDomainCustomCertificate instantiates a new PutCustomDomainCustomCertificate 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 NewPutCustomDomainCustomCertificate(certificate PutCustomDomainCustomCertificateGetCertificateArgType, key PutCustomDomainCustomCertificateGetKeyArgType, types PutCustomDomainCustomCertificateGetTypeArgType) *PutCustomDomainCustomCertificate { + this := PutCustomDomainCustomCertificate{} + setPutCustomDomainCustomCertificateGetCertificateAttributeType(&this.Certificate, certificate) + setPutCustomDomainCustomCertificateGetKeyAttributeType(&this.Key, key) + setPutCustomDomainCustomCertificateGetTypeAttributeType(&this.Type, types) + return &this +} + +// NewPutCustomDomainCustomCertificateWithDefaults instantiates a new PutCustomDomainCustomCertificate 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 NewPutCustomDomainCustomCertificateWithDefaults() *PutCustomDomainCustomCertificate { + this := PutCustomDomainCustomCertificate{} + return &this +} + +// GetCertificate returns the Certificate field value +func (o *PutCustomDomainCustomCertificate) GetCertificate() (ret PutCustomDomainCustomCertificateGetCertificateRetType) { + ret, _ = o.GetCertificateOk() + return ret +} + +// GetCertificateOk returns a tuple with the Certificate field value +// and a boolean to check if the value has been set. +func (o *PutCustomDomainCustomCertificate) GetCertificateOk() (ret PutCustomDomainCustomCertificateGetCertificateRetType, ok bool) { + return getPutCustomDomainCustomCertificateGetCertificateAttributeTypeOk(o.Certificate) +} + +// SetCertificate sets field value +func (o *PutCustomDomainCustomCertificate) SetCertificate(v PutCustomDomainCustomCertificateGetCertificateRetType) { + setPutCustomDomainCustomCertificateGetCertificateAttributeType(&o.Certificate, v) +} + +// GetKey returns the Key field value +func (o *PutCustomDomainCustomCertificate) GetKey() (ret PutCustomDomainCustomCertificateGetKeyRetType) { + ret, _ = o.GetKeyOk() + return ret +} + +// GetKeyOk returns a tuple with the Key field value +// and a boolean to check if the value has been set. +func (o *PutCustomDomainCustomCertificate) GetKeyOk() (ret PutCustomDomainCustomCertificateGetKeyRetType, ok bool) { + return getPutCustomDomainCustomCertificateGetKeyAttributeTypeOk(o.Key) +} + +// SetKey sets field value +func (o *PutCustomDomainCustomCertificate) SetKey(v PutCustomDomainCustomCertificateGetKeyRetType) { + setPutCustomDomainCustomCertificateGetKeyAttributeType(&o.Key, v) +} + +// GetType returns the Type field value +func (o *PutCustomDomainCustomCertificate) GetType() (ret PutCustomDomainCustomCertificateGetTypeRetType) { + ret, _ = o.GetTypeOk() + return ret +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *PutCustomDomainCustomCertificate) GetTypeOk() (ret PutCustomDomainCustomCertificateGetTypeRetType, ok bool) { + return getPutCustomDomainCustomCertificateGetTypeAttributeTypeOk(o.Type) +} + +// SetType sets field value +func (o *PutCustomDomainCustomCertificate) SetType(v PutCustomDomainCustomCertificateGetTypeRetType) { + setPutCustomDomainCustomCertificateGetTypeAttributeType(&o.Type, v) +} + +func (o PutCustomDomainCustomCertificate) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getPutCustomDomainCustomCertificateGetCertificateAttributeTypeOk(o.Certificate); ok { + toSerialize["Certificate"] = val + } + if val, ok := getPutCustomDomainCustomCertificateGetKeyAttributeTypeOk(o.Key); ok { + toSerialize["Key"] = val + } + if val, ok := getPutCustomDomainCustomCertificateGetTypeAttributeTypeOk(o.Type); ok { + toSerialize["Type"] = val + } + return toSerialize, nil +} + +type NullablePutCustomDomainCustomCertificate struct { + value *PutCustomDomainCustomCertificate + isSet bool +} + +func (v NullablePutCustomDomainCustomCertificate) Get() *PutCustomDomainCustomCertificate { + return v.value +} + +func (v *NullablePutCustomDomainCustomCertificate) Set(val *PutCustomDomainCustomCertificate) { + v.value = val + v.isSet = true +} + +func (v NullablePutCustomDomainCustomCertificate) IsSet() bool { + return v.isSet +} + +func (v *NullablePutCustomDomainCustomCertificate) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullablePutCustomDomainCustomCertificate(val *PutCustomDomainCustomCertificate) *NullablePutCustomDomainCustomCertificate { + return &NullablePutCustomDomainCustomCertificate{value: val, isSet: true} +} + +func (v NullablePutCustomDomainCustomCertificate) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullablePutCustomDomainCustomCertificate) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/cdn/model_put_custom_domain_custom_certificate_test.go b/services/cdn/model_put_custom_domain_custom_certificate_test.go new file mode 100644 index 000000000..51fc7c9ea --- /dev/null +++ b/services/cdn/model_put_custom_domain_custom_certificate_test.go @@ -0,0 +1,11 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdn diff --git a/services/cdn/model_put_custom_domain_managed_certificate.go b/services/cdn/model_put_custom_domain_managed_certificate.go new file mode 100644 index 000000000..33ab9eed7 --- /dev/null +++ b/services/cdn/model_put_custom_domain_managed_certificate.go @@ -0,0 +1,126 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdn + +import ( + "encoding/json" +) + +// checks if the PutCustomDomainManagedCertificate type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &PutCustomDomainManagedCertificate{} + +/* + types and functions for type +*/ + +// isNotNullableString +type PutCustomDomainManagedCertificateGetTypeAttributeType = *string + +func getPutCustomDomainManagedCertificateGetTypeAttributeTypeOk(arg PutCustomDomainManagedCertificateGetTypeAttributeType) (ret PutCustomDomainManagedCertificateGetTypeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setPutCustomDomainManagedCertificateGetTypeAttributeType(arg *PutCustomDomainManagedCertificateGetTypeAttributeType, val PutCustomDomainManagedCertificateGetTypeRetType) { + *arg = &val +} + +type PutCustomDomainManagedCertificateGetTypeArgType = string +type PutCustomDomainManagedCertificateGetTypeRetType = string + +// PutCustomDomainManagedCertificate This is returned when no custom certificate is used. We provision and manage a Let's Encrypt Certificate for you +type PutCustomDomainManagedCertificate struct { + // REQUIRED + Type PutCustomDomainManagedCertificateGetTypeAttributeType `json:"type" required:"true"` +} + +type _PutCustomDomainManagedCertificate PutCustomDomainManagedCertificate + +// NewPutCustomDomainManagedCertificate instantiates a new PutCustomDomainManagedCertificate 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 NewPutCustomDomainManagedCertificate(types PutCustomDomainManagedCertificateGetTypeArgType) *PutCustomDomainManagedCertificate { + this := PutCustomDomainManagedCertificate{} + setPutCustomDomainManagedCertificateGetTypeAttributeType(&this.Type, types) + return &this +} + +// NewPutCustomDomainManagedCertificateWithDefaults instantiates a new PutCustomDomainManagedCertificate 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 NewPutCustomDomainManagedCertificateWithDefaults() *PutCustomDomainManagedCertificate { + this := PutCustomDomainManagedCertificate{} + return &this +} + +// GetType returns the Type field value +func (o *PutCustomDomainManagedCertificate) GetType() (ret PutCustomDomainManagedCertificateGetTypeRetType) { + ret, _ = o.GetTypeOk() + return ret +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *PutCustomDomainManagedCertificate) GetTypeOk() (ret PutCustomDomainManagedCertificateGetTypeRetType, ok bool) { + return getPutCustomDomainManagedCertificateGetTypeAttributeTypeOk(o.Type) +} + +// SetType sets field value +func (o *PutCustomDomainManagedCertificate) SetType(v PutCustomDomainManagedCertificateGetTypeRetType) { + setPutCustomDomainManagedCertificateGetTypeAttributeType(&o.Type, v) +} + +func (o PutCustomDomainManagedCertificate) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getPutCustomDomainManagedCertificateGetTypeAttributeTypeOk(o.Type); ok { + toSerialize["Type"] = val + } + return toSerialize, nil +} + +type NullablePutCustomDomainManagedCertificate struct { + value *PutCustomDomainManagedCertificate + isSet bool +} + +func (v NullablePutCustomDomainManagedCertificate) Get() *PutCustomDomainManagedCertificate { + return v.value +} + +func (v *NullablePutCustomDomainManagedCertificate) Set(val *PutCustomDomainManagedCertificate) { + v.value = val + v.isSet = true +} + +func (v NullablePutCustomDomainManagedCertificate) IsSet() bool { + return v.isSet +} + +func (v *NullablePutCustomDomainManagedCertificate) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullablePutCustomDomainManagedCertificate(val *PutCustomDomainManagedCertificate) *NullablePutCustomDomainManagedCertificate { + return &NullablePutCustomDomainManagedCertificate{value: val, isSet: true} +} + +func (v NullablePutCustomDomainManagedCertificate) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullablePutCustomDomainManagedCertificate) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/cdn/model_put_custom_domain_managed_certificate_test.go b/services/cdn/model_put_custom_domain_managed_certificate_test.go new file mode 100644 index 000000000..51fc7c9ea --- /dev/null +++ b/services/cdn/model_put_custom_domain_managed_certificate_test.go @@ -0,0 +1,11 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdn diff --git a/services/cdn/model_put_custom_domain_payload.go b/services/cdn/model_put_custom_domain_payload.go index 3d39d5f2a..31ee37272 100644 --- a/services/cdn/model_put_custom_domain_payload.go +++ b/services/cdn/model_put_custom_domain_payload.go @@ -17,6 +17,26 @@ import ( // checks if the PutCustomDomainPayload type satisfies the MappedNullable interface at compile time var _ MappedNullable = &PutCustomDomainPayload{} +/* + types and functions for certificate +*/ + +// isModel +type PutCustomDomainPayloadGetCertificateAttributeType = *PutCustomDomainPayloadCertificate +type PutCustomDomainPayloadGetCertificateArgType = PutCustomDomainPayloadCertificate +type PutCustomDomainPayloadGetCertificateRetType = PutCustomDomainPayloadCertificate + +func getPutCustomDomainPayloadGetCertificateAttributeTypeOk(arg PutCustomDomainPayloadGetCertificateAttributeType) (ret PutCustomDomainPayloadGetCertificateRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setPutCustomDomainPayloadGetCertificateAttributeType(arg *PutCustomDomainPayloadGetCertificateAttributeType, val PutCustomDomainPayloadGetCertificateRetType) { + *arg = &val +} + /* types and functions for intentId */ @@ -40,6 +60,7 @@ type PutCustomDomainPayloadGetIntentIdRetType = string // PutCustomDomainPayload struct for PutCustomDomainPayload type PutCustomDomainPayload struct { + Certificate PutCustomDomainPayloadGetCertificateAttributeType `json:"certificate,omitempty"` // While optional, it is greatly encouraged to provide an `intentId`. This is used to deduplicate requests. If multiple modifying Requests with the same `intentId` for a given `projectId` are received, all but the first request are dropped. IntentId PutCustomDomainPayloadGetIntentIdAttributeType `json:"intentId,omitempty"` } @@ -61,6 +82,29 @@ func NewPutCustomDomainPayloadWithDefaults() *PutCustomDomainPayload { return &this } +// GetCertificate returns the Certificate field value if set, zero value otherwise. +func (o *PutCustomDomainPayload) GetCertificate() (res PutCustomDomainPayloadGetCertificateRetType) { + res, _ = o.GetCertificateOk() + return +} + +// GetCertificateOk returns a tuple with the Certificate field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PutCustomDomainPayload) GetCertificateOk() (ret PutCustomDomainPayloadGetCertificateRetType, ok bool) { + return getPutCustomDomainPayloadGetCertificateAttributeTypeOk(o.Certificate) +} + +// HasCertificate returns a boolean if a field has been set. +func (o *PutCustomDomainPayload) HasCertificate() bool { + _, ok := o.GetCertificateOk() + return ok +} + +// SetCertificate gets a reference to the given PutCustomDomainPayloadCertificate and assigns it to the Certificate field. +func (o *PutCustomDomainPayload) SetCertificate(v PutCustomDomainPayloadGetCertificateRetType) { + setPutCustomDomainPayloadGetCertificateAttributeType(&o.Certificate, v) +} + // GetIntentId returns the IntentId field value if set, zero value otherwise. func (o *PutCustomDomainPayload) GetIntentId() (res PutCustomDomainPayloadGetIntentIdRetType) { res, _ = o.GetIntentIdOk() @@ -86,6 +130,9 @@ func (o *PutCustomDomainPayload) SetIntentId(v PutCustomDomainPayloadGetIntentId func (o PutCustomDomainPayload) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} + if val, ok := getPutCustomDomainPayloadGetCertificateAttributeTypeOk(o.Certificate); ok { + toSerialize["Certificate"] = val + } if val, ok := getPutCustomDomainPayloadGetIntentIdAttributeTypeOk(o.IntentId); ok { toSerialize["IntentId"] = val } diff --git a/services/cdn/model_put_custom_domain_payload_certificate.go b/services/cdn/model_put_custom_domain_payload_certificate.go new file mode 100644 index 000000000..b5d96198c --- /dev/null +++ b/services/cdn/model_put_custom_domain_payload_certificate.go @@ -0,0 +1,163 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdn + +import ( + "encoding/json" + "fmt" +) + +// PutCustomDomainPayloadCertificate - Pass a custom certificate to be served by the CDN when calling the custom domain. Will use a managed certificate when omitted +type PutCustomDomainPayloadCertificate struct { + PutCustomDomainCustomCertificate *PutCustomDomainCustomCertificate + PutCustomDomainManagedCertificate *PutCustomDomainManagedCertificate +} + +// PutCustomDomainCustomCertificateAsPutCustomDomainPayloadCertificate is a convenience function that returns PutCustomDomainCustomCertificate wrapped in PutCustomDomainPayloadCertificate +func PutCustomDomainCustomCertificateAsPutCustomDomainPayloadCertificate(v *PutCustomDomainCustomCertificate) PutCustomDomainPayloadCertificate { + return PutCustomDomainPayloadCertificate{ + PutCustomDomainCustomCertificate: v, + } +} + +// PutCustomDomainManagedCertificateAsPutCustomDomainPayloadCertificate is a convenience function that returns PutCustomDomainManagedCertificate wrapped in PutCustomDomainPayloadCertificate +func PutCustomDomainManagedCertificateAsPutCustomDomainPayloadCertificate(v *PutCustomDomainManagedCertificate) PutCustomDomainPayloadCertificate { + return PutCustomDomainPayloadCertificate{ + PutCustomDomainManagedCertificate: v, + } +} + +// Unmarshal JSON data into one of the pointers in the struct +func (dst *PutCustomDomainPayloadCertificate) UnmarshalJSON(data []byte) error { + var err error + // use discriminator value to speed up the lookup + var jsonDict map[string]interface{} + err = newStrictDecoder(data).Decode(&jsonDict) + if err != nil { + return fmt.Errorf("failed to unmarshal JSON into map for the discriminator lookup") + } + + // check if the discriminator value is 'PutCustomDomainCustomCertificate' + if jsonDict["type"] == "PutCustomDomainCustomCertificate" { + // try to unmarshal JSON data into PutCustomDomainCustomCertificate + err = json.Unmarshal(data, &dst.PutCustomDomainCustomCertificate) + if err == nil { + return nil // data stored in dst.PutCustomDomainCustomCertificate, return on the first match + } else { + dst.PutCustomDomainCustomCertificate = nil + return fmt.Errorf("failed to unmarshal PutCustomDomainPayloadCertificate as PutCustomDomainCustomCertificate: %s", err.Error()) + } + } + + // check if the discriminator value is 'PutCustomDomainManagedCertificate' + if jsonDict["type"] == "PutCustomDomainManagedCertificate" { + // try to unmarshal JSON data into PutCustomDomainManagedCertificate + err = json.Unmarshal(data, &dst.PutCustomDomainManagedCertificate) + if err == nil { + return nil // data stored in dst.PutCustomDomainManagedCertificate, return on the first match + } else { + dst.PutCustomDomainManagedCertificate = nil + return fmt.Errorf("failed to unmarshal PutCustomDomainPayloadCertificate as PutCustomDomainManagedCertificate: %s", err.Error()) + } + } + + // check if the discriminator value is 'custom' + if jsonDict["type"] == "custom" { + // try to unmarshal JSON data into PutCustomDomainCustomCertificate + err = json.Unmarshal(data, &dst.PutCustomDomainCustomCertificate) + if err == nil { + return nil // data stored in dst.PutCustomDomainCustomCertificate, return on the first match + } else { + dst.PutCustomDomainCustomCertificate = nil + return fmt.Errorf("failed to unmarshal PutCustomDomainPayloadCertificate as PutCustomDomainCustomCertificate: %s", err.Error()) + } + } + + // check if the discriminator value is 'managed' + if jsonDict["type"] == "managed" { + // try to unmarshal JSON data into PutCustomDomainManagedCertificate + err = json.Unmarshal(data, &dst.PutCustomDomainManagedCertificate) + if err == nil { + return nil // data stored in dst.PutCustomDomainManagedCertificate, return on the first match + } else { + dst.PutCustomDomainManagedCertificate = nil + return fmt.Errorf("failed to unmarshal PutCustomDomainPayloadCertificate as PutCustomDomainManagedCertificate: %s", err.Error()) + } + } + + return nil +} + +// Marshal data from the first non-nil pointers in the struct to JSON +func (src PutCustomDomainPayloadCertificate) MarshalJSON() ([]byte, error) { + if src.PutCustomDomainCustomCertificate != nil { + return json.Marshal(&src.PutCustomDomainCustomCertificate) + } + + if src.PutCustomDomainManagedCertificate != nil { + return json.Marshal(&src.PutCustomDomainManagedCertificate) + } + + return []byte("{}"), nil // no data in oneOf schemas => empty JSON object +} + +// Get the actual instance +func (obj *PutCustomDomainPayloadCertificate) GetActualInstance() interface{} { + if obj == nil { + return nil + } + if obj.PutCustomDomainCustomCertificate != nil { + return obj.PutCustomDomainCustomCertificate + } + + if obj.PutCustomDomainManagedCertificate != nil { + return obj.PutCustomDomainManagedCertificate + } + + // all schemas are nil + return nil +} + +type NullablePutCustomDomainPayloadCertificate struct { + value *PutCustomDomainPayloadCertificate + isSet bool +} + +func (v NullablePutCustomDomainPayloadCertificate) Get() *PutCustomDomainPayloadCertificate { + return v.value +} + +func (v *NullablePutCustomDomainPayloadCertificate) Set(val *PutCustomDomainPayloadCertificate) { + v.value = val + v.isSet = true +} + +func (v NullablePutCustomDomainPayloadCertificate) IsSet() bool { + return v.isSet +} + +func (v *NullablePutCustomDomainPayloadCertificate) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullablePutCustomDomainPayloadCertificate(val *PutCustomDomainPayloadCertificate) *NullablePutCustomDomainPayloadCertificate { + return &NullablePutCustomDomainPayloadCertificate{value: val, isSet: true} +} + +func (v NullablePutCustomDomainPayloadCertificate) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullablePutCustomDomainPayloadCertificate) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/cdn/model_put_custom_domain_payload_certificate_test.go b/services/cdn/model_put_custom_domain_payload_certificate_test.go new file mode 100644 index 000000000..51fc7c9ea --- /dev/null +++ b/services/cdn/model_put_custom_domain_payload_certificate_test.go @@ -0,0 +1,11 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdn diff --git a/services/cdn/model_put_custom_domain_response.go b/services/cdn/model_put_custom_domain_response.go index 0c0a05cc2..22013ae57 100644 --- a/services/cdn/model_put_custom_domain_response.go +++ b/services/cdn/model_put_custom_domain_response.go @@ -17,6 +17,26 @@ import ( // checks if the PutCustomDomainResponse type satisfies the MappedNullable interface at compile time var _ MappedNullable = &PutCustomDomainResponse{} +/* + types and functions for certificate +*/ + +// isModel +type PutCustomDomainResponseGetCertificateAttributeType = *PutCustomDomainResponseCertificate +type PutCustomDomainResponseGetCertificateArgType = PutCustomDomainResponseCertificate +type PutCustomDomainResponseGetCertificateRetType = PutCustomDomainResponseCertificate + +func getPutCustomDomainResponseGetCertificateAttributeTypeOk(arg PutCustomDomainResponseGetCertificateAttributeType) (ret PutCustomDomainResponseGetCertificateRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setPutCustomDomainResponseGetCertificateAttributeType(arg *PutCustomDomainResponseGetCertificateAttributeType, val PutCustomDomainResponseGetCertificateRetType) { + *arg = &val +} + /* types and functions for customDomain */ @@ -60,6 +80,7 @@ type PutCustomDomainResponseGetDomainRetType = string // PutCustomDomainResponse struct for PutCustomDomainResponse type PutCustomDomainResponse struct { + Certificate PutCustomDomainResponseGetCertificateAttributeType `json:"certificate,omitempty"` // REQUIRED CustomDomain PutCustomDomainResponseGetCustomDomainAttributeType `json:"customDomain" required:"true"` // Deprecated: Check the GitHub changelog for alternatives @@ -88,6 +109,29 @@ func NewPutCustomDomainResponseWithDefaults() *PutCustomDomainResponse { return &this } +// GetCertificate returns the Certificate field value if set, zero value otherwise. +func (o *PutCustomDomainResponse) GetCertificate() (res PutCustomDomainResponseGetCertificateRetType) { + res, _ = o.GetCertificateOk() + return +} + +// GetCertificateOk returns a tuple with the Certificate field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PutCustomDomainResponse) GetCertificateOk() (ret PutCustomDomainResponseGetCertificateRetType, ok bool) { + return getPutCustomDomainResponseGetCertificateAttributeTypeOk(o.Certificate) +} + +// HasCertificate returns a boolean if a field has been set. +func (o *PutCustomDomainResponse) HasCertificate() bool { + _, ok := o.GetCertificateOk() + return ok +} + +// SetCertificate gets a reference to the given PutCustomDomainResponseCertificate and assigns it to the Certificate field. +func (o *PutCustomDomainResponse) SetCertificate(v PutCustomDomainResponseGetCertificateRetType) { + setPutCustomDomainResponseGetCertificateAttributeType(&o.Certificate, v) +} + // GetCustomDomain returns the CustomDomain field value func (o *PutCustomDomainResponse) GetCustomDomain() (ret PutCustomDomainResponseGetCustomDomainRetType) { ret, _ = o.GetCustomDomainOk() @@ -127,6 +171,9 @@ func (o *PutCustomDomainResponse) SetDomain(v PutCustomDomainResponseGetDomainRe func (o PutCustomDomainResponse) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} + if val, ok := getPutCustomDomainResponseGetCertificateAttributeTypeOk(o.Certificate); ok { + toSerialize["Certificate"] = val + } if val, ok := getPutCustomDomainResponseGetCustomDomainAttributeTypeOk(o.CustomDomain); ok { toSerialize["CustomDomain"] = val } diff --git a/services/cdn/model_put_custom_domain_response_certificate.go b/services/cdn/model_put_custom_domain_response_certificate.go new file mode 100644 index 000000000..671ee7065 --- /dev/null +++ b/services/cdn/model_put_custom_domain_response_certificate.go @@ -0,0 +1,163 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdn + +import ( + "encoding/json" + "fmt" +) + +// PutCustomDomainResponseCertificate - Pass a custom certificate to be served by the CDN when calling the custom domain. Will use a managed certificate when omitted +type PutCustomDomainResponseCertificate struct { + GetCustomDomainCustomCertificate *GetCustomDomainCustomCertificate + GetCustomDomainManagedCertificate *GetCustomDomainManagedCertificate +} + +// GetCustomDomainCustomCertificateAsPutCustomDomainResponseCertificate is a convenience function that returns GetCustomDomainCustomCertificate wrapped in PutCustomDomainResponseCertificate +func GetCustomDomainCustomCertificateAsPutCustomDomainResponseCertificate(v *GetCustomDomainCustomCertificate) PutCustomDomainResponseCertificate { + return PutCustomDomainResponseCertificate{ + GetCustomDomainCustomCertificate: v, + } +} + +// GetCustomDomainManagedCertificateAsPutCustomDomainResponseCertificate is a convenience function that returns GetCustomDomainManagedCertificate wrapped in PutCustomDomainResponseCertificate +func GetCustomDomainManagedCertificateAsPutCustomDomainResponseCertificate(v *GetCustomDomainManagedCertificate) PutCustomDomainResponseCertificate { + return PutCustomDomainResponseCertificate{ + GetCustomDomainManagedCertificate: v, + } +} + +// Unmarshal JSON data into one of the pointers in the struct +func (dst *PutCustomDomainResponseCertificate) UnmarshalJSON(data []byte) error { + var err error + // use discriminator value to speed up the lookup + var jsonDict map[string]interface{} + err = newStrictDecoder(data).Decode(&jsonDict) + if err != nil { + return fmt.Errorf("failed to unmarshal JSON into map for the discriminator lookup") + } + + // check if the discriminator value is 'GetCustomDomainCustomCertificate' + if jsonDict["type"] == "GetCustomDomainCustomCertificate" { + // try to unmarshal JSON data into GetCustomDomainCustomCertificate + err = json.Unmarshal(data, &dst.GetCustomDomainCustomCertificate) + if err == nil { + return nil // data stored in dst.GetCustomDomainCustomCertificate, return on the first match + } else { + dst.GetCustomDomainCustomCertificate = nil + return fmt.Errorf("failed to unmarshal PutCustomDomainResponseCertificate as GetCustomDomainCustomCertificate: %s", err.Error()) + } + } + + // check if the discriminator value is 'GetCustomDomainManagedCertificate' + if jsonDict["type"] == "GetCustomDomainManagedCertificate" { + // try to unmarshal JSON data into GetCustomDomainManagedCertificate + err = json.Unmarshal(data, &dst.GetCustomDomainManagedCertificate) + if err == nil { + return nil // data stored in dst.GetCustomDomainManagedCertificate, return on the first match + } else { + dst.GetCustomDomainManagedCertificate = nil + return fmt.Errorf("failed to unmarshal PutCustomDomainResponseCertificate as GetCustomDomainManagedCertificate: %s", err.Error()) + } + } + + // check if the discriminator value is 'custom' + if jsonDict["type"] == "custom" { + // try to unmarshal JSON data into GetCustomDomainCustomCertificate + err = json.Unmarshal(data, &dst.GetCustomDomainCustomCertificate) + if err == nil { + return nil // data stored in dst.GetCustomDomainCustomCertificate, return on the first match + } else { + dst.GetCustomDomainCustomCertificate = nil + return fmt.Errorf("failed to unmarshal PutCustomDomainResponseCertificate as GetCustomDomainCustomCertificate: %s", err.Error()) + } + } + + // check if the discriminator value is 'managed' + if jsonDict["type"] == "managed" { + // try to unmarshal JSON data into GetCustomDomainManagedCertificate + err = json.Unmarshal(data, &dst.GetCustomDomainManagedCertificate) + if err == nil { + return nil // data stored in dst.GetCustomDomainManagedCertificate, return on the first match + } else { + dst.GetCustomDomainManagedCertificate = nil + return fmt.Errorf("failed to unmarshal PutCustomDomainResponseCertificate as GetCustomDomainManagedCertificate: %s", err.Error()) + } + } + + return nil +} + +// Marshal data from the first non-nil pointers in the struct to JSON +func (src PutCustomDomainResponseCertificate) MarshalJSON() ([]byte, error) { + if src.GetCustomDomainCustomCertificate != nil { + return json.Marshal(&src.GetCustomDomainCustomCertificate) + } + + if src.GetCustomDomainManagedCertificate != nil { + return json.Marshal(&src.GetCustomDomainManagedCertificate) + } + + return []byte("{}"), nil // no data in oneOf schemas => empty JSON object +} + +// Get the actual instance +func (obj *PutCustomDomainResponseCertificate) GetActualInstance() interface{} { + if obj == nil { + return nil + } + if obj.GetCustomDomainCustomCertificate != nil { + return obj.GetCustomDomainCustomCertificate + } + + if obj.GetCustomDomainManagedCertificate != nil { + return obj.GetCustomDomainManagedCertificate + } + + // all schemas are nil + return nil +} + +type NullablePutCustomDomainResponseCertificate struct { + value *PutCustomDomainResponseCertificate + isSet bool +} + +func (v NullablePutCustomDomainResponseCertificate) Get() *PutCustomDomainResponseCertificate { + return v.value +} + +func (v *NullablePutCustomDomainResponseCertificate) Set(val *PutCustomDomainResponseCertificate) { + v.value = val + v.isSet = true +} + +func (v NullablePutCustomDomainResponseCertificate) IsSet() bool { + return v.isSet +} + +func (v *NullablePutCustomDomainResponseCertificate) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullablePutCustomDomainResponseCertificate(val *PutCustomDomainResponseCertificate) *NullablePutCustomDomainResponseCertificate { + return &NullablePutCustomDomainResponseCertificate{value: val, isSet: true} +} + +func (v NullablePutCustomDomainResponseCertificate) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullablePutCustomDomainResponseCertificate) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/cdn/model_put_custom_domain_response_certificate_test.go b/services/cdn/model_put_custom_domain_response_certificate_test.go new file mode 100644 index 000000000..51fc7c9ea --- /dev/null +++ b/services/cdn/model_put_custom_domain_response_certificate_test.go @@ -0,0 +1,11 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdn From 22ac5f6e1adda2c2053536139bc240bf7962bc9a Mon Sep 17 00:00:00 2001 From: Alexander Dahmen Date: Mon, 28 Jul 2025 09:27:46 +0200 Subject: [PATCH 2/2] Add changelogs Signed-off-by: Alexander Dahmen --- CHANGELOG.md | 9 +++++++-- services/cdn/CHANGELOG.md | 7 ++++++- services/cdn/VERSION | 2 +- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2fc814552..107006f00 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,8 +7,13 @@ - **Dependencies:** Bump `github.com/golang-jwt/jwt/v5` from `v5.2.2` to `v5.2.3` - `authorization`: [v0.8.1](services/authorization/CHANGELOG.md#v081) - **Dependencies:** Bump `github.com/golang-jwt/jwt/v5` from `v5.2.2` to `v5.2.3` -- `cdn`: [v1.3.2](services/cdn/CHANGELOG.md#v132) - - **Dependencies:** Bump `github.com/golang-jwt/jwt/v5` from `v5.2.2` to `v5.2.3` +- `cdn`: + - [v1.4.0](services/cdn/CHANGELOG.md#v140) + - **Feature:** Added new filter functions `DataCenterRegion`, `RequestCountryCode`, `StatusCode` and `CacheHit` + - **Feature:** Added Attribute `LogSink` and `Certificate` + - **Feature:** Added `ConfigLogSink` and `PatchLokiLogSink` functionality + - [v1.3.2](services/cdn/CHANGELOG.md#v132) + - **Dependencies:** Bump `github.com/golang-jwt/jwt/v5` from `v5.2.2` to `v5.2.3` - `certificates`: [v1.1.1](services/certificates/CHANGELOG.md#v111) - **Dependencies:** Bump `github.com/golang-jwt/jwt/v5` from `v5.2.2` to `v5.2.3` - `dns`: [v0.17.1](services/dns/CHANGELOG.md#v0171) diff --git a/services/cdn/CHANGELOG.md b/services/cdn/CHANGELOG.md index 005c668cb..5505844fc 100644 --- a/services/cdn/CHANGELOG.md +++ b/services/cdn/CHANGELOG.md @@ -1,5 +1,10 @@ +## v1.4.0 +- **Feature:** Added new filter functions `DataCenterRegion`, `RequestCountryCode`, `StatusCode` and `CacheHit` +- **Feature:** Added Attribute `LogSink` and `Certificate` +- **Feature:** Added `ConfigLogSink` and `PatchLokiLogSink` functionality + ## v1.3.2 - - **Dependencies:** Bump `github.com/golang-jwt/jwt/v5` from `v5.2.2` to `v5.2.3` +- **Dependencies:** Bump `github.com/golang-jwt/jwt/v5` from `v5.2.2` to `v5.2.3` ## v1.3.1 - **Improvement:** Improve parsing of oneOf diff --git a/services/cdn/VERSION b/services/cdn/VERSION index bb8edae97..ec7b96782 100644 --- a/services/cdn/VERSION +++ b/services/cdn/VERSION @@ -1 +1 @@ -v1.3.2 \ No newline at end of file +v1.4.0 \ No newline at end of file