-
Notifications
You must be signed in to change notification settings - Fork 39
/
Copy pathcompany_subscription.go
499 lines (496 loc) · 18.1 KB
/
company_subscription.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
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
// Code generated by Microsoft Kiota - DO NOT EDIT.
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
package models
import (
i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e "time"
i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91 "github.com/microsoft/kiota-abstractions-go/serialization"
)
type CompanySubscription struct {
Entity
}
// NewCompanySubscription instantiates a new CompanySubscription and sets the default values.
func NewCompanySubscription()(*CompanySubscription) {
m := &CompanySubscription{
Entity: *NewEntity(),
}
return m
}
// CreateCompanySubscriptionFromDiscriminatorValue creates a new instance of the appropriate class based on discriminator value
// returns a Parsable when successful
func CreateCompanySubscriptionFromDiscriminatorValue(parseNode i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, error) {
return NewCompanySubscription(), nil
}
// GetCommerceSubscriptionId gets the commerceSubscriptionId property value. The ID of this subscription in the commerce system. Alternate key.
// returns a *string when successful
func (m *CompanySubscription) GetCommerceSubscriptionId()(*string) {
val, err := m.GetBackingStore().Get("commerceSubscriptionId")
if err != nil {
panic(err)
}
if val != nil {
return val.(*string)
}
return nil
}
// GetCreatedDateTime gets the createdDateTime property value. The date and time when this subscription was created. The DateTimeOffset type represents date and time information using ISO 8601 format and is always in UTC time. For example, midnight UTC on Jan 1, 2014 is 2014-01-01T00:00:00Z.
// returns a *Time when successful
func (m *CompanySubscription) GetCreatedDateTime()(*i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e.Time) {
val, err := m.GetBackingStore().Get("createdDateTime")
if err != nil {
panic(err)
}
if val != nil {
return val.(*i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e.Time)
}
return nil
}
// GetFieldDeserializers the deserialization information for the current model
// returns a map[string]func(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(error) when successful
func (m *CompanySubscription) GetFieldDeserializers()(map[string]func(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(error)) {
res := m.Entity.GetFieldDeserializers()
res["commerceSubscriptionId"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {
val, err := n.GetStringValue()
if err != nil {
return err
}
if val != nil {
m.SetCommerceSubscriptionId(val)
}
return nil
}
res["createdDateTime"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {
val, err := n.GetTimeValue()
if err != nil {
return err
}
if val != nil {
m.SetCreatedDateTime(val)
}
return nil
}
res["isTrial"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {
val, err := n.GetBoolValue()
if err != nil {
return err
}
if val != nil {
m.SetIsTrial(val)
}
return nil
}
res["nextLifecycleDateTime"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {
val, err := n.GetTimeValue()
if err != nil {
return err
}
if val != nil {
m.SetNextLifecycleDateTime(val)
}
return nil
}
res["ownerId"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {
val, err := n.GetStringValue()
if err != nil {
return err
}
if val != nil {
m.SetOwnerId(val)
}
return nil
}
res["ownerTenantId"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {
val, err := n.GetStringValue()
if err != nil {
return err
}
if val != nil {
m.SetOwnerTenantId(val)
}
return nil
}
res["ownerType"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {
val, err := n.GetStringValue()
if err != nil {
return err
}
if val != nil {
m.SetOwnerType(val)
}
return nil
}
res["serviceStatus"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {
val, err := n.GetCollectionOfObjectValues(CreateServicePlanInfoFromDiscriminatorValue)
if err != nil {
return err
}
if val != nil {
res := make([]ServicePlanInfoable, len(val))
for i, v := range val {
if v != nil {
res[i] = v.(ServicePlanInfoable)
}
}
m.SetServiceStatus(res)
}
return nil
}
res["skuId"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {
val, err := n.GetStringValue()
if err != nil {
return err
}
if val != nil {
m.SetSkuId(val)
}
return nil
}
res["skuPartNumber"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {
val, err := n.GetStringValue()
if err != nil {
return err
}
if val != nil {
m.SetSkuPartNumber(val)
}
return nil
}
res["status"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {
val, err := n.GetStringValue()
if err != nil {
return err
}
if val != nil {
m.SetStatus(val)
}
return nil
}
res["totalLicenses"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {
val, err := n.GetInt32Value()
if err != nil {
return err
}
if val != nil {
m.SetTotalLicenses(val)
}
return nil
}
return res
}
// GetIsTrial gets the isTrial property value. Whether the subscription is a free trial or purchased.
// returns a *bool when successful
func (m *CompanySubscription) GetIsTrial()(*bool) {
val, err := m.GetBackingStore().Get("isTrial")
if err != nil {
panic(err)
}
if val != nil {
return val.(*bool)
}
return nil
}
// GetNextLifecycleDateTime gets the nextLifecycleDateTime property value. The date and time when the subscription will move to the next state (as defined by the status property) if not renewed by the tenant. The DateTimeOffset type represents date and time information using ISO 8601 format and is always in UTC time. For example, midnight UTC on Jan 1, 2014 is 2014-01-01T00:00:00Z.
// returns a *Time when successful
func (m *CompanySubscription) GetNextLifecycleDateTime()(*i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e.Time) {
val, err := m.GetBackingStore().Get("nextLifecycleDateTime")
if err != nil {
panic(err)
}
if val != nil {
return val.(*i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e.Time)
}
return nil
}
// GetOwnerId gets the ownerId property value. The object ID of the account admin.
// returns a *string when successful
func (m *CompanySubscription) GetOwnerId()(*string) {
val, err := m.GetBackingStore().Get("ownerId")
if err != nil {
panic(err)
}
if val != nil {
return val.(*string)
}
return nil
}
// GetOwnerTenantId gets the ownerTenantId property value. The unique identifier for the Microsoft partner tenant that created the subscription on a customer tenant.
// returns a *string when successful
func (m *CompanySubscription) GetOwnerTenantId()(*string) {
val, err := m.GetBackingStore().Get("ownerTenantId")
if err != nil {
panic(err)
}
if val != nil {
return val.(*string)
}
return nil
}
// GetOwnerType gets the ownerType property value. Indicates the entity that ownerId belongs to, for example, 'User'.
// returns a *string when successful
func (m *CompanySubscription) GetOwnerType()(*string) {
val, err := m.GetBackingStore().Get("ownerType")
if err != nil {
panic(err)
}
if val != nil {
return val.(*string)
}
return nil
}
// GetServiceStatus gets the serviceStatus property value. The provisioning status of each service included in this subscription.
// returns a []ServicePlanInfoable when successful
func (m *CompanySubscription) GetServiceStatus()([]ServicePlanInfoable) {
val, err := m.GetBackingStore().Get("serviceStatus")
if err != nil {
panic(err)
}
if val != nil {
return val.([]ServicePlanInfoable)
}
return nil
}
// GetSkuId gets the skuId property value. The object ID of the SKU associated with this subscription.
// returns a *string when successful
func (m *CompanySubscription) GetSkuId()(*string) {
val, err := m.GetBackingStore().Get("skuId")
if err != nil {
panic(err)
}
if val != nil {
return val.(*string)
}
return nil
}
// GetSkuPartNumber gets the skuPartNumber property value. The SKU associated with this subscription.
// returns a *string when successful
func (m *CompanySubscription) GetSkuPartNumber()(*string) {
val, err := m.GetBackingStore().Get("skuPartNumber")
if err != nil {
panic(err)
}
if val != nil {
return val.(*string)
}
return nil
}
// GetStatus gets the status property value. The status of this subscription. Possible values are: Enabled, Deleted, Suspended, Warning, LockedOut.
// returns a *string when successful
func (m *CompanySubscription) GetStatus()(*string) {
val, err := m.GetBackingStore().Get("status")
if err != nil {
panic(err)
}
if val != nil {
return val.(*string)
}
return nil
}
// GetTotalLicenses gets the totalLicenses property value. The number of licenses included in this subscription.
// returns a *int32 when successful
func (m *CompanySubscription) GetTotalLicenses()(*int32) {
val, err := m.GetBackingStore().Get("totalLicenses")
if err != nil {
panic(err)
}
if val != nil {
return val.(*int32)
}
return nil
}
// Serialize serializes information the current object
func (m *CompanySubscription) Serialize(writer i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.SerializationWriter)(error) {
err := m.Entity.Serialize(writer)
if err != nil {
return err
}
{
err = writer.WriteStringValue("commerceSubscriptionId", m.GetCommerceSubscriptionId())
if err != nil {
return err
}
}
{
err = writer.WriteTimeValue("createdDateTime", m.GetCreatedDateTime())
if err != nil {
return err
}
}
{
err = writer.WriteBoolValue("isTrial", m.GetIsTrial())
if err != nil {
return err
}
}
{
err = writer.WriteTimeValue("nextLifecycleDateTime", m.GetNextLifecycleDateTime())
if err != nil {
return err
}
}
{
err = writer.WriteStringValue("ownerId", m.GetOwnerId())
if err != nil {
return err
}
}
{
err = writer.WriteStringValue("ownerTenantId", m.GetOwnerTenantId())
if err != nil {
return err
}
}
{
err = writer.WriteStringValue("ownerType", m.GetOwnerType())
if err != nil {
return err
}
}
if m.GetServiceStatus() != nil {
cast := make([]i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, len(m.GetServiceStatus()))
for i, v := range m.GetServiceStatus() {
if v != nil {
cast[i] = v.(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable)
}
}
err = writer.WriteCollectionOfObjectValues("serviceStatus", cast)
if err != nil {
return err
}
}
{
err = writer.WriteStringValue("skuId", m.GetSkuId())
if err != nil {
return err
}
}
{
err = writer.WriteStringValue("skuPartNumber", m.GetSkuPartNumber())
if err != nil {
return err
}
}
{
err = writer.WriteStringValue("status", m.GetStatus())
if err != nil {
return err
}
}
{
err = writer.WriteInt32Value("totalLicenses", m.GetTotalLicenses())
if err != nil {
return err
}
}
return nil
}
// SetCommerceSubscriptionId sets the commerceSubscriptionId property value. The ID of this subscription in the commerce system. Alternate key.
func (m *CompanySubscription) SetCommerceSubscriptionId(value *string)() {
err := m.GetBackingStore().Set("commerceSubscriptionId", value)
if err != nil {
panic(err)
}
}
// SetCreatedDateTime sets the createdDateTime property value. The date and time when this subscription was created. The DateTimeOffset type represents date and time information using ISO 8601 format and is always in UTC time. For example, midnight UTC on Jan 1, 2014 is 2014-01-01T00:00:00Z.
func (m *CompanySubscription) SetCreatedDateTime(value *i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e.Time)() {
err := m.GetBackingStore().Set("createdDateTime", value)
if err != nil {
panic(err)
}
}
// SetIsTrial sets the isTrial property value. Whether the subscription is a free trial or purchased.
func (m *CompanySubscription) SetIsTrial(value *bool)() {
err := m.GetBackingStore().Set("isTrial", value)
if err != nil {
panic(err)
}
}
// SetNextLifecycleDateTime sets the nextLifecycleDateTime property value. The date and time when the subscription will move to the next state (as defined by the status property) if not renewed by the tenant. The DateTimeOffset type represents date and time information using ISO 8601 format and is always in UTC time. For example, midnight UTC on Jan 1, 2014 is 2014-01-01T00:00:00Z.
func (m *CompanySubscription) SetNextLifecycleDateTime(value *i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e.Time)() {
err := m.GetBackingStore().Set("nextLifecycleDateTime", value)
if err != nil {
panic(err)
}
}
// SetOwnerId sets the ownerId property value. The object ID of the account admin.
func (m *CompanySubscription) SetOwnerId(value *string)() {
err := m.GetBackingStore().Set("ownerId", value)
if err != nil {
panic(err)
}
}
// SetOwnerTenantId sets the ownerTenantId property value. The unique identifier for the Microsoft partner tenant that created the subscription on a customer tenant.
func (m *CompanySubscription) SetOwnerTenantId(value *string)() {
err := m.GetBackingStore().Set("ownerTenantId", value)
if err != nil {
panic(err)
}
}
// SetOwnerType sets the ownerType property value. Indicates the entity that ownerId belongs to, for example, 'User'.
func (m *CompanySubscription) SetOwnerType(value *string)() {
err := m.GetBackingStore().Set("ownerType", value)
if err != nil {
panic(err)
}
}
// SetServiceStatus sets the serviceStatus property value. The provisioning status of each service included in this subscription.
func (m *CompanySubscription) SetServiceStatus(value []ServicePlanInfoable)() {
err := m.GetBackingStore().Set("serviceStatus", value)
if err != nil {
panic(err)
}
}
// SetSkuId sets the skuId property value. The object ID of the SKU associated with this subscription.
func (m *CompanySubscription) SetSkuId(value *string)() {
err := m.GetBackingStore().Set("skuId", value)
if err != nil {
panic(err)
}
}
// SetSkuPartNumber sets the skuPartNumber property value. The SKU associated with this subscription.
func (m *CompanySubscription) SetSkuPartNumber(value *string)() {
err := m.GetBackingStore().Set("skuPartNumber", value)
if err != nil {
panic(err)
}
}
// SetStatus sets the status property value. The status of this subscription. Possible values are: Enabled, Deleted, Suspended, Warning, LockedOut.
func (m *CompanySubscription) SetStatus(value *string)() {
err := m.GetBackingStore().Set("status", value)
if err != nil {
panic(err)
}
}
// SetTotalLicenses sets the totalLicenses property value. The number of licenses included in this subscription.
func (m *CompanySubscription) SetTotalLicenses(value *int32)() {
err := m.GetBackingStore().Set("totalLicenses", value)
if err != nil {
panic(err)
}
}
type CompanySubscriptionable interface {
Entityable
i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable
GetCommerceSubscriptionId()(*string)
GetCreatedDateTime()(*i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e.Time)
GetIsTrial()(*bool)
GetNextLifecycleDateTime()(*i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e.Time)
GetOwnerId()(*string)
GetOwnerTenantId()(*string)
GetOwnerType()(*string)
GetServiceStatus()([]ServicePlanInfoable)
GetSkuId()(*string)
GetSkuPartNumber()(*string)
GetStatus()(*string)
GetTotalLicenses()(*int32)
SetCommerceSubscriptionId(value *string)()
SetCreatedDateTime(value *i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e.Time)()
SetIsTrial(value *bool)()
SetNextLifecycleDateTime(value *i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e.Time)()
SetOwnerId(value *string)()
SetOwnerTenantId(value *string)()
SetOwnerType(value *string)()
SetServiceStatus(value []ServicePlanInfoable)()
SetSkuId(value *string)()
SetSkuPartNumber(value *string)()
SetStatus(value *string)()
SetTotalLicenses(value *int32)()
}