forked from huaweicloud/huaweicloud-sdk-go-v3
-
Notifications
You must be signed in to change notification settings - Fork 0
/
model_api_auth_relations.go
144 lines (114 loc) · 3.4 KB
/
model_api_auth_relations.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
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"
)
type ApiAuthRelations struct {
// API编号
ApiId *string `json:"api_id,omitempty"`
AuthResult *AuthResult `json:"auth_result,omitempty"`
// 授权时间
AuthTime *sdktime.SdkTime `json:"auth_time,omitempty"`
// 授权关系编号
Id *string `json:"id,omitempty"`
// APP编号
AppId *string `json:"app_id,omitempty"`
// 授权者 - PROVIDER:API提供者授权 - CONSUMER:API消费者授权
AuthRole *ApiAuthRelationsAuthRole `json:"auth_role,omitempty"`
// 授权通道类型 - NORMAL:普通通道 - GREEN:绿色通道 暂不支持,默认NORMAL
AuthTunnel *ApiAuthRelationsAuthTunnel `json:"auth_tunnel,omitempty"`
// 绿色通道的白名单配置
AuthWhitelist *[]string `json:"auth_whitelist,omitempty"`
// 绿色通道的黑名单配置
AuthBlacklist *[]string `json:"auth_blacklist,omitempty"`
// 访问参数。
VisitParams *string `json:"visit_params,omitempty"`
}
func (o ApiAuthRelations) String() string {
data, err := utils.Marshal(o)
if err != nil {
return "ApiAuthRelations struct{}"
}
return strings.Join([]string{"ApiAuthRelations", string(data)}, " ")
}
type ApiAuthRelationsAuthRole struct {
value string
}
type ApiAuthRelationsAuthRoleEnum struct {
PROVIDER ApiAuthRelationsAuthRole
CONSUMER ApiAuthRelationsAuthRole
}
func GetApiAuthRelationsAuthRoleEnum() ApiAuthRelationsAuthRoleEnum {
return ApiAuthRelationsAuthRoleEnum{
PROVIDER: ApiAuthRelationsAuthRole{
value: "PROVIDER",
},
CONSUMER: ApiAuthRelationsAuthRole{
value: "CONSUMER",
},
}
}
func (c ApiAuthRelationsAuthRole) Value() string {
return c.value
}
func (c ApiAuthRelationsAuthRole) MarshalJSON() ([]byte, error) {
return utils.Marshal(c.value)
}
func (c *ApiAuthRelationsAuthRole) 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 ApiAuthRelationsAuthTunnel struct {
value string
}
type ApiAuthRelationsAuthTunnelEnum struct {
NORMAL ApiAuthRelationsAuthTunnel
GREEN ApiAuthRelationsAuthTunnel
}
func GetApiAuthRelationsAuthTunnelEnum() ApiAuthRelationsAuthTunnelEnum {
return ApiAuthRelationsAuthTunnelEnum{
NORMAL: ApiAuthRelationsAuthTunnel{
value: "NORMAL",
},
GREEN: ApiAuthRelationsAuthTunnel{
value: "GREEN",
},
}
}
func (c ApiAuthRelationsAuthTunnel) Value() string {
return c.value
}
func (c ApiAuthRelationsAuthTunnel) MarshalJSON() ([]byte, error) {
return utils.Marshal(c.value)
}
func (c *ApiAuthRelationsAuthTunnel) 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")
}
}