terraform-provider-stackitp.../pkg/cdnbeta/model_get_custom_domain_response_certificate.go
Marcel S. Henselin 9f41c4da7f
Some checks failed
Publish / Check GoReleaser config (push) Successful in 4s
Release / goreleaser (push) Failing after 29s
Publish / Publish provider (push) Failing after 4m24s
feat: auto generated files and new structure (#4)
## Description

<!-- **Please link some issue here describing what you are trying to achieve.**

In case there is no issue present for your PR, please consider creating one.
At least please give us some description what you are trying to achieve and why your change is needed. -->

relates to #1234

## Checklist

- [ ] Issue was linked above
- [ ] Code format was applied: `make fmt`
- [ ] Examples were added / adjusted (see `examples/` directory)
- [x] Docs are up-to-date: `make generate-docs` (will be checked by CI)
- [ ] Unit tests got implemented or updated
- [ ] Acceptance tests got implemented or updated (see e.g. [here](f5f99d1709/stackit/internal/services/dns/dns_acc_test.go))
- [x] Unit tests are passing: `make test` (will be checked by CI)
- [x] No linter issues: `make lint` (will be checked by CI)

Reviewed-on: #4
Reviewed-by: Andre_Harms <andre.harms@stackit.cloud>
Co-authored-by: Marcel S. Henselin <marcel.henselin@stackit.cloud>
Co-committed-by: Marcel S. Henselin <marcel.henselin@stackit.cloud>
2026-01-29 14:10:25 +00:00

163 lines
5.8 KiB
Go

/*
CDN API
API used to create and manage your CDN distributions.
API version: 1beta2.0.0
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package cdnbeta
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)
}