forked from huaweicloud/huaweicloud-sdk-go-v3
-
Notifications
You must be signed in to change notification settings - Fork 0
/
model_api_func.go
152 lines (120 loc) · 3.71 KB
/
model_api_func.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
package model
import (
"errors"
"github.com/dysodeng/huaweicloud-sdk-go-v3/core/converter"
"github.com/dysodeng/huaweicloud-sdk-go-v3/core/sdktime"
"github.com/dysodeng/huaweicloud-sdk-go-v3/core/utils"
"strings"
)
// ApiFunc 函数工作流后端详情
type ApiFunc struct {
// 函数URN
FunctionUrn string `json:"function_urn"`
// 描述信息。长度不超过255个字符 > 中文字符必须为UTF-8或者unicode编码。
Remark *string `json:"remark,omitempty"`
// 调用类型 - async: 异步 - sync:同步
InvocationType ApiFuncInvocationType `json:"invocation_type"`
// 对接函数的网络架构类型 - V1:非VPC网络架构 - V2:VPC网络架构
NetworkType ApiFuncNetworkType `json:"network_type"`
// 函数版本 当函数别名URN和函数版本同时传入时,函数版本将被忽略,只会使用函数别名URN
Version *string `json:"version,omitempty"`
// 函数别名URN 当函数别名URN和函数版本同时传入时,函数版本将被忽略,只会使用函数别名URN
AliasUrn *string `json:"alias_urn,omitempty"`
// API网关请求后端服务的超时时间。最大超时时间可通过实例特性backend_timeout配置修改,可修改的上限为600000。 单位:毫秒。
Timeout int32 `json:"timeout"`
// 后端自定义认证ID
AuthorizerId *string `json:"authorizer_id,omitempty"`
// 编号
Id *string `json:"id,omitempty"`
// 注册时间
RegisterTime *sdktime.SdkTime `json:"register_time,omitempty"`
// 后端状态 - 1: 有效
Status *int32 `json:"status,omitempty"`
// 修改时间
UpdateTime *sdktime.SdkTime `json:"update_time,omitempty"`
}
func (o ApiFunc) String() string {
data, err := utils.Marshal(o)
if err != nil {
return "ApiFunc struct{}"
}
return strings.Join([]string{"ApiFunc", string(data)}, " ")
}
type ApiFuncInvocationType struct {
value string
}
type ApiFuncInvocationTypeEnum struct {
ASYNC ApiFuncInvocationType
SYNC ApiFuncInvocationType
}
func GetApiFuncInvocationTypeEnum() ApiFuncInvocationTypeEnum {
return ApiFuncInvocationTypeEnum{
ASYNC: ApiFuncInvocationType{
value: "async",
},
SYNC: ApiFuncInvocationType{
value: "sync",
},
}
}
func (c ApiFuncInvocationType) Value() string {
return c.value
}
func (c ApiFuncInvocationType) MarshalJSON() ([]byte, error) {
return utils.Marshal(c.value)
}
func (c *ApiFuncInvocationType) UnmarshalJSON(b []byte) error {
myConverter := converter.StringConverterFactory("string")
if myConverter == nil {
return errors.New("unsupported StringConverter type: string")
}
interf, err := myConverter.CovertStringToInterface(strings.Trim(string(b[:]), "\""))
if err != nil {
return err
}
if val, ok := interf.(string); ok {
c.value = val
return nil
} else {
return errors.New("convert enum data to string error")
}
}
type ApiFuncNetworkType struct {
value string
}
type ApiFuncNetworkTypeEnum struct {
V1 ApiFuncNetworkType
V2 ApiFuncNetworkType
}
func GetApiFuncNetworkTypeEnum() ApiFuncNetworkTypeEnum {
return ApiFuncNetworkTypeEnum{
V1: ApiFuncNetworkType{
value: "V1",
},
V2: ApiFuncNetworkType{
value: "V2",
},
}
}
func (c ApiFuncNetworkType) Value() string {
return c.value
}
func (c ApiFuncNetworkType) MarshalJSON() ([]byte, error) {
return utils.Marshal(c.value)
}
func (c *ApiFuncNetworkType) UnmarshalJSON(b []byte) error {
myConverter := converter.StringConverterFactory("string")
if myConverter == nil {
return errors.New("unsupported StringConverter type: string")
}
interf, err := myConverter.CovertStringToInterface(strings.Trim(string(b[:]), "\""))
if err != nil {
return err
}
if val, ok := interf.(string); ok {
c.value = val
return nil
} else {
return errors.New("convert enum data to string error")
}
}