feat: generating code
This commit is contained in:
parent
c329d58970
commit
51663cd8d0
1221 changed files with 271709 additions and 2444 deletions
163
pkg/cdnbeta/model_put_custom_domain_payload_certificate.go
Normal file
163
pkg/cdnbeta/model_put_custom_domain_payload_certificate.go
Normal file
|
|
@ -0,0 +1,163 @@
|
|||
/*
|
||||
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"
|
||||
)
|
||||
|
||||
// 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)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue