1 Star 0 Fork 0

MrCoder/openapi

加入 Gitee
与超过 1400万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
model_resources_ai_ml_nrm.go 7.41 KB
一键复制 编辑 原始数据 按行查看 历史
MrCoder 提交于 2023-12-22 15:27 +08:00 . update
/*
Provisioning MnS
OAS 3.0.1 definition of the Provisioning MnS © 2023, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). All rights reserved.
API version: 17.6.0
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package OpenAPI_ProvMnS
import (
"encoding/json"
"fmt"
)
// ResourcesAiMlNrm - struct for ResourcesAiMlNrm
type ResourcesAiMlNrm struct {
MLTrainingFunctionSingle *MLTrainingFunctionSingle
MLTrainingProcessSingle *MLTrainingProcessSingle
MLTrainingReportSingle *MLTrainingReportSingle
MLTrainingRequestSingle *MLTrainingRequestSingle
ManagedElementSingle4 *ManagedElementSingle4
SubNetworkSingle6 *SubNetworkSingle6
}
// MLTrainingFunctionSingleAsResourcesAiMlNrm is a convenience function that returns MLTrainingFunctionSingle wrapped in ResourcesAiMlNrm
func MLTrainingFunctionSingleAsResourcesAiMlNrm(v *MLTrainingFunctionSingle) ResourcesAiMlNrm {
return ResourcesAiMlNrm{
MLTrainingFunctionSingle: v,
}
}
// MLTrainingProcessSingleAsResourcesAiMlNrm is a convenience function that returns MLTrainingProcessSingle wrapped in ResourcesAiMlNrm
func MLTrainingProcessSingleAsResourcesAiMlNrm(v *MLTrainingProcessSingle) ResourcesAiMlNrm {
return ResourcesAiMlNrm{
MLTrainingProcessSingle: v,
}
}
// MLTrainingReportSingleAsResourcesAiMlNrm is a convenience function that returns MLTrainingReportSingle wrapped in ResourcesAiMlNrm
func MLTrainingReportSingleAsResourcesAiMlNrm(v *MLTrainingReportSingle) ResourcesAiMlNrm {
return ResourcesAiMlNrm{
MLTrainingReportSingle: v,
}
}
// MLTrainingRequestSingleAsResourcesAiMlNrm is a convenience function that returns MLTrainingRequestSingle wrapped in ResourcesAiMlNrm
func MLTrainingRequestSingleAsResourcesAiMlNrm(v *MLTrainingRequestSingle) ResourcesAiMlNrm {
return ResourcesAiMlNrm{
MLTrainingRequestSingle: v,
}
}
// ManagedElementSingle4AsResourcesAiMlNrm is a convenience function that returns ManagedElementSingle4 wrapped in ResourcesAiMlNrm
func ManagedElementSingle4AsResourcesAiMlNrm(v *ManagedElementSingle4) ResourcesAiMlNrm {
return ResourcesAiMlNrm{
ManagedElementSingle4: v,
}
}
// SubNetworkSingle6AsResourcesAiMlNrm is a convenience function that returns SubNetworkSingle6 wrapped in ResourcesAiMlNrm
func SubNetworkSingle6AsResourcesAiMlNrm(v *SubNetworkSingle6) ResourcesAiMlNrm {
return ResourcesAiMlNrm{
SubNetworkSingle6: v,
}
}
// Unmarshal JSON data into one of the pointers in the struct
func (dst *ResourcesAiMlNrm) UnmarshalJSON(data []byte) error {
var err error
match := 0
// try to unmarshal data into MLTrainingFunctionSingle
err = newStrictDecoder(data).Decode(&dst.MLTrainingFunctionSingle)
if err == nil {
jsonMLTrainingFunctionSingle, _ := json.Marshal(dst.MLTrainingFunctionSingle)
if string(jsonMLTrainingFunctionSingle) == "{}" { // empty struct
dst.MLTrainingFunctionSingle = nil
} else {
match++
}
} else {
dst.MLTrainingFunctionSingle = nil
}
// try to unmarshal data into MLTrainingProcessSingle
err = newStrictDecoder(data).Decode(&dst.MLTrainingProcessSingle)
if err == nil {
jsonMLTrainingProcessSingle, _ := json.Marshal(dst.MLTrainingProcessSingle)
if string(jsonMLTrainingProcessSingle) == "{}" { // empty struct
dst.MLTrainingProcessSingle = nil
} else {
match++
}
} else {
dst.MLTrainingProcessSingle = nil
}
// try to unmarshal data into MLTrainingReportSingle
err = newStrictDecoder(data).Decode(&dst.MLTrainingReportSingle)
if err == nil {
jsonMLTrainingReportSingle, _ := json.Marshal(dst.MLTrainingReportSingle)
if string(jsonMLTrainingReportSingle) == "{}" { // empty struct
dst.MLTrainingReportSingle = nil
} else {
match++
}
} else {
dst.MLTrainingReportSingle = nil
}
// try to unmarshal data into MLTrainingRequestSingle
err = newStrictDecoder(data).Decode(&dst.MLTrainingRequestSingle)
if err == nil {
jsonMLTrainingRequestSingle, _ := json.Marshal(dst.MLTrainingRequestSingle)
if string(jsonMLTrainingRequestSingle) == "{}" { // empty struct
dst.MLTrainingRequestSingle = nil
} else {
match++
}
} else {
dst.MLTrainingRequestSingle = nil
}
// try to unmarshal data into ManagedElementSingle4
err = newStrictDecoder(data).Decode(&dst.ManagedElementSingle4)
if err == nil {
jsonManagedElementSingle4, _ := json.Marshal(dst.ManagedElementSingle4)
if string(jsonManagedElementSingle4) == "{}" { // empty struct
dst.ManagedElementSingle4 = nil
} else {
match++
}
} else {
dst.ManagedElementSingle4 = nil
}
// try to unmarshal data into SubNetworkSingle6
err = newStrictDecoder(data).Decode(&dst.SubNetworkSingle6)
if err == nil {
jsonSubNetworkSingle6, _ := json.Marshal(dst.SubNetworkSingle6)
if string(jsonSubNetworkSingle6) == "{}" { // empty struct
dst.SubNetworkSingle6 = nil
} else {
match++
}
} else {
dst.SubNetworkSingle6 = nil
}
if match > 1 { // more than 1 match
// reset to nil
dst.MLTrainingFunctionSingle = nil
dst.MLTrainingProcessSingle = nil
dst.MLTrainingReportSingle = nil
dst.MLTrainingRequestSingle = nil
dst.ManagedElementSingle4 = nil
dst.SubNetworkSingle6 = nil
return fmt.Errorf("data matches more than one schema in oneOf(ResourcesAiMlNrm)")
} else if match == 1 {
return nil // exactly one match
} else { // no match
return fmt.Errorf("data failed to match schemas in oneOf(ResourcesAiMlNrm)")
}
}
// Marshal data from the first non-nil pointers in the struct to JSON
func (src ResourcesAiMlNrm) MarshalJSON() ([]byte, error) {
if src.MLTrainingFunctionSingle != nil {
return json.Marshal(&src.MLTrainingFunctionSingle)
}
if src.MLTrainingProcessSingle != nil {
return json.Marshal(&src.MLTrainingProcessSingle)
}
if src.MLTrainingReportSingle != nil {
return json.Marshal(&src.MLTrainingReportSingle)
}
if src.MLTrainingRequestSingle != nil {
return json.Marshal(&src.MLTrainingRequestSingle)
}
if src.ManagedElementSingle4 != nil {
return json.Marshal(&src.ManagedElementSingle4)
}
if src.SubNetworkSingle6 != nil {
return json.Marshal(&src.SubNetworkSingle6)
}
return nil, nil // no data in oneOf schemas
}
// Get the actual instance
func (obj *ResourcesAiMlNrm) GetActualInstance() interface{} {
if obj == nil {
return nil
}
if obj.MLTrainingFunctionSingle != nil {
return obj.MLTrainingFunctionSingle
}
if obj.MLTrainingProcessSingle != nil {
return obj.MLTrainingProcessSingle
}
if obj.MLTrainingReportSingle != nil {
return obj.MLTrainingReportSingle
}
if obj.MLTrainingRequestSingle != nil {
return obj.MLTrainingRequestSingle
}
if obj.ManagedElementSingle4 != nil {
return obj.ManagedElementSingle4
}
if obj.SubNetworkSingle6 != nil {
return obj.SubNetworkSingle6
}
// all schemas are nil
return nil
}
type NullableResourcesAiMlNrm struct {
value *ResourcesAiMlNrm
isSet bool
}
func (v NullableResourcesAiMlNrm) Get() *ResourcesAiMlNrm {
return v.value
}
func (v *NullableResourcesAiMlNrm) Set(val *ResourcesAiMlNrm) {
v.value = val
v.isSet = true
}
func (v NullableResourcesAiMlNrm) IsSet() bool {
return v.isSet
}
func (v *NullableResourcesAiMlNrm) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableResourcesAiMlNrm(val *ResourcesAiMlNrm) *NullableResourcesAiMlNrm {
return &NullableResourcesAiMlNrm{value: val, isSet: true}
}
func (v NullableResourcesAiMlNrm) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableResourcesAiMlNrm) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/konglinglong/openapi.git
git@gitee.com:konglinglong/openapi.git
konglinglong
openapi
openapi
e403a3c726a4

搜索帮助