forked from MyPureCloud/platform-client-sdk-go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
scimv2createuser.go
208 lines (138 loc) · 6.82 KB
/
scimv2createuser.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
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
package platformclientv2
import (
"github.com/leekchan/timeutil"
"encoding/json"
"fmt"
"strconv"
"strings"
)
// Scimv2createuser - Defines the creation of a SCIM user.
type Scimv2createuser struct {
// Schemas - The list of supported schemas.
Schemas *[]string `json:"schemas,omitempty"`
// Active - Indicates whether the user's administrative status is active.
Active *bool `json:"active,omitempty"`
// UserName - The user's Genesys Cloud email address. Must be unique.
UserName *string `json:"userName,omitempty"`
// DisplayName - The display name of the user.
DisplayName *string `json:"displayName,omitempty"`
// Password - The new password for the Genesys Cloud user. Does not return an existing password. When creating a user, if a password is not supplied, then a password will be randomly generated that is 40 characters in length and contains five characters from each of the password policy groups.
Password *string `json:"password,omitempty"`
// Title - The user's title.
Title *string `json:"title,omitempty"`
// PhoneNumbers - The list of the user's phone numbers.
PhoneNumbers *[]Scimphonenumber `json:"phoneNumbers"`
// Emails - The list of the user's email addresses.
Emails *[]Scimemail `json:"emails"`
// ExternalId - The external ID of the user. Set by the provisioning client. \"caseExact\" is set to \"true\". \"mutability\" is set to \"readWrite\".
ExternalId *string `json:"externalId,omitempty"`
// Groups - The list of groups that the user is a member of.
Groups *[]Scimv2groupreference `json:"groups"`
// Roles - The list of roles assigned to the user.
Roles *[]Scimuserrole `json:"roles"`
// UrnIetfParamsScimSchemasExtensionEnterprise20User - The URI of the schema for the enterprise user.
UrnIetfParamsScimSchemasExtensionEnterprise20User *Scimv2enterpriseuser `json:"urn:ietf:params:scim:schemas:extension:enterprise:2.0:User"`
// UrnIetfParamsScimSchemasExtensionGenesysPurecloud20User - The URI of the schema for the Genesys Cloud user.
UrnIetfParamsScimSchemasExtensionGenesysPurecloud20User *Scimuserextensions `json:"urn:ietf:params:scim:schemas:extension:genesys:purecloud:2.0:User"`
}
func (o *Scimv2createuser) MarshalJSON() ([]byte, error) {
// Redundant initialization to avoid unused import errors for models with no Time values
_ = timeutil.Timedelta{}
type Alias Scimv2createuser
return json.Marshal(&struct {
Schemas *[]string `json:"schemas,omitempty"`
Active *bool `json:"active,omitempty"`
UserName *string `json:"userName,omitempty"`
DisplayName *string `json:"displayName,omitempty"`
Password *string `json:"password,omitempty"`
Title *string `json:"title,omitempty"`
PhoneNumbers *[]Scimphonenumber `json:"phoneNumbers"`
Emails *[]Scimemail `json:"emails"`
ExternalId *string `json:"externalId,omitempty"`
Groups *[]Scimv2groupreference `json:"groups"`
Roles *[]Scimuserrole `json:"roles"`
UrnIetfParamsScimSchemasExtensionEnterprise20User *Scimv2enterpriseuser `json:"urn:ietf:params:scim:schemas:extension:enterprise:2.0:User"`
UrnIetfParamsScimSchemasExtensionGenesysPurecloud20User *Scimuserextensions `json:"urn:ietf:params:scim:schemas:extension:genesys:purecloud:2.0:User"`
*Alias
}{
Schemas: o.Schemas,
Active: o.Active,
UserName: o.UserName,
DisplayName: o.DisplayName,
Password: o.Password,
Title: o.Title,
PhoneNumbers: o.PhoneNumbers,
Emails: o.Emails,
ExternalId: o.ExternalId,
Groups: o.Groups,
Roles: o.Roles,
UrnIetfParamsScimSchemasExtensionEnterprise20User: o.UrnIetfParamsScimSchemasExtensionEnterprise20User,
UrnIetfParamsScimSchemasExtensionGenesysPurecloud20User: o.UrnIetfParamsScimSchemasExtensionGenesysPurecloud20User,
Alias: (*Alias)(o),
})
}
func (o *Scimv2createuser) UnmarshalJSON(b []byte) error {
var Scimv2createuserMap map[string]interface{}
err := json.Unmarshal(b, &Scimv2createuserMap)
if err != nil {
return err
}
if Schemas, ok := Scimv2createuserMap["schemas"].([]interface{}); ok {
SchemasString, _ := json.Marshal(Schemas)
json.Unmarshal(SchemasString, &o.Schemas)
}
if Active, ok := Scimv2createuserMap["active"].(bool); ok {
o.Active = &Active
}
if UserName, ok := Scimv2createuserMap["userName"].(string); ok {
o.UserName = &UserName
}
if DisplayName, ok := Scimv2createuserMap["displayName"].(string); ok {
o.DisplayName = &DisplayName
}
if Password, ok := Scimv2createuserMap["password"].(string); ok {
o.Password = &Password
}
if Title, ok := Scimv2createuserMap["title"].(string); ok {
o.Title = &Title
}
if PhoneNumbers, ok := Scimv2createuserMap["phoneNumbers"].([]interface{}); ok {
PhoneNumbersString, _ := json.Marshal(PhoneNumbers)
json.Unmarshal(PhoneNumbersString, &o.PhoneNumbers)
}
if Emails, ok := Scimv2createuserMap["emails"].([]interface{}); ok {
EmailsString, _ := json.Marshal(Emails)
json.Unmarshal(EmailsString, &o.Emails)
}
if ExternalId, ok := Scimv2createuserMap["externalId"].(string); ok {
o.ExternalId = &ExternalId
}
if Groups, ok := Scimv2createuserMap["groups"].([]interface{}); ok {
GroupsString, _ := json.Marshal(Groups)
json.Unmarshal(GroupsString, &o.Groups)
}
if Roles, ok := Scimv2createuserMap["roles"].([]interface{}); ok {
RolesString, _ := json.Marshal(Roles)
json.Unmarshal(RolesString, &o.Roles)
}
if UrnIetfParamsScimSchemasExtensionEnterprise20User, ok := Scimv2createuserMap["urn:ietf:params:scim:schemas:extension:enterprise:2.0:User"].(map[string]interface{}); ok {
UrnIetfParamsScimSchemasExtensionEnterprise20UserString, _ := json.Marshal(UrnIetfParamsScimSchemasExtensionEnterprise20User)
json.Unmarshal(UrnIetfParamsScimSchemasExtensionEnterprise20UserString, &o.UrnIetfParamsScimSchemasExtensionEnterprise20User)
}
if UrnIetfParamsScimSchemasExtensionGenesysPurecloud20User, ok := Scimv2createuserMap["urn:ietf:params:scim:schemas:extension:genesys:purecloud:2.0:User"].(map[string]interface{}); ok {
UrnIetfParamsScimSchemasExtensionGenesysPurecloud20UserString, _ := json.Marshal(UrnIetfParamsScimSchemasExtensionGenesysPurecloud20User)
json.Unmarshal(UrnIetfParamsScimSchemasExtensionGenesysPurecloud20UserString, &o.UrnIetfParamsScimSchemasExtensionGenesysPurecloud20User)
}
return nil
}
// String returns a JSON representation of the model
func (o *Scimv2createuser) String() string {
j, _ := json.Marshal(o)
str, _ := strconv.Unquote(strings.Replace(strconv.Quote(string(j)), `\\u`, `\u`, -1))
str = strings.Replace(str, strconv.Quote(*NullString()), "null", -1)
str = strings.Replace(str, fmt.Sprintf("%v", *NullInt()), "null", -1)
str = strings.Replace(str, fmt.Sprintf("%v", *NullFloat32()), "null", -1)
str = strings.Replace(str, fmt.Sprintf("%v", *NullFloat64()), "null", -1)
str = strings.Replace(str, fmt.Sprintf("%v", NullTime().Format("2006-01-02T15:04:05Z07:00")), "null", -1)
return str
}