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