-
Notifications
You must be signed in to change notification settings - Fork 1.1k
/
cloudcommerceprocurement-gen.go
2866 lines (2623 loc) · 104 KB
/
cloudcommerceprocurement-gen.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
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// Copyright 2022 Google LLC.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Code generated file. DO NOT EDIT.
// Package cloudcommerceprocurement provides access to the Cloud Commerce Partner Procurement API.
//
// For product documentation, see: https://cloud.google.com/marketplace/docs/partners/
//
// # Creating a client
//
// Usage example:
//
// import "google.golang.org/api/cloudcommerceprocurement/v1"
// ...
// ctx := context.Background()
// cloudcommerceprocurementService, err := cloudcommerceprocurement.NewService(ctx)
//
// In this example, Google Application Default Credentials are used for authentication.
//
// For information on how to create and obtain Application Default Credentials, see https://developers.google.com/identity/protocols/application-default-credentials.
//
// # Other authentication options
//
// To use an API key for authentication (note: some APIs do not support API keys), use option.WithAPIKey:
//
// cloudcommerceprocurementService, err := cloudcommerceprocurement.NewService(ctx, option.WithAPIKey("AIza..."))
//
// To use an OAuth token (e.g., a user token obtained via a three-legged OAuth flow), use option.WithTokenSource:
//
// config := &oauth2.Config{...}
// // ...
// token, err := config.Exchange(ctx, ...)
// cloudcommerceprocurementService, err := cloudcommerceprocurement.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token)))
//
// See https://godoc.org/google.golang.org/api/option/ for details on options.
package cloudcommerceprocurement // import "google.golang.org/api/cloudcommerceprocurement/v1"
import (
"bytes"
"context"
"encoding/json"
"errors"
"fmt"
"io"
"net/http"
"net/url"
"strconv"
"strings"
googleapi "google.golang.org/api/googleapi"
internal "google.golang.org/api/internal"
gensupport "google.golang.org/api/internal/gensupport"
option "google.golang.org/api/option"
internaloption "google.golang.org/api/option/internaloption"
htransport "google.golang.org/api/transport/http"
)
// Always reference these packages, just in case the auto-generated code
// below doesn't.
var _ = bytes.NewBuffer
var _ = strconv.Itoa
var _ = fmt.Sprintf
var _ = json.NewDecoder
var _ = io.Copy
var _ = url.Parse
var _ = gensupport.MarshalJSON
var _ = googleapi.Version
var _ = errors.New
var _ = strings.Replace
var _ = context.Canceled
var _ = internaloption.WithDefaultEndpoint
const apiId = "cloudcommerceprocurement:v1"
const apiName = "cloudcommerceprocurement"
const apiVersion = "v1"
const basePath = "https://cloudcommerceprocurement.googleapis.com/"
const mtlsBasePath = "https://cloudcommerceprocurement.mtls.googleapis.com/"
// OAuth2 scopes used by this API.
const (
// See, edit, configure, and delete your Google Cloud data and see the
// email address for your Google Account.
CloudPlatformScope = "https://www.googleapis.com/auth/cloud-platform"
)
// NewService creates a new Service.
func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) {
scopesOption := internaloption.WithDefaultScopes(
"https://www.googleapis.com/auth/cloud-platform",
)
// NOTE: prepend, so we don't override user-specified scopes.
opts = append([]option.ClientOption{scopesOption}, opts...)
opts = append(opts, internaloption.WithDefaultEndpoint(basePath))
opts = append(opts, internaloption.WithDefaultMTLSEndpoint(mtlsBasePath))
client, endpoint, err := htransport.NewClient(ctx, opts...)
if err != nil {
return nil, err
}
s, err := New(client)
if err != nil {
return nil, err
}
if endpoint != "" {
s.BasePath = endpoint
}
return s, nil
}
// New creates a new Service. It uses the provided http.Client for requests.
//
// Deprecated: please use NewService instead.
// To provide a custom HTTP client, use option.WithHTTPClient.
// If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead.
func New(client *http.Client) (*Service, error) {
if client == nil {
return nil, errors.New("client is nil")
}
s := &Service{client: client, BasePath: basePath}
s.Providers = NewProvidersService(s)
return s, nil
}
type Service struct {
client *http.Client
BasePath string // API endpoint base URL
UserAgent string // optional additional User-Agent fragment
Providers *ProvidersService
}
func (s *Service) userAgent() string {
if s.UserAgent == "" {
return googleapi.UserAgent
}
return googleapi.UserAgent + " " + s.UserAgent
}
func NewProvidersService(s *Service) *ProvidersService {
rs := &ProvidersService{s: s}
rs.Accounts = NewProvidersAccountsService(s)
rs.Entitlements = NewProvidersEntitlementsService(s)
return rs
}
type ProvidersService struct {
s *Service
Accounts *ProvidersAccountsService
Entitlements *ProvidersEntitlementsService
}
func NewProvidersAccountsService(s *Service) *ProvidersAccountsService {
rs := &ProvidersAccountsService{s: s}
return rs
}
type ProvidersAccountsService struct {
s *Service
}
func NewProvidersEntitlementsService(s *Service) *ProvidersEntitlementsService {
rs := &ProvidersEntitlementsService{s: s}
return rs
}
type ProvidersEntitlementsService struct {
s *Service
}
// Account: Represents an account that was established by the customer
// on the service provider's system.
type Account struct {
// Approvals: Output only. The approvals for this account. These
// approvals are used to track actions that are permitted or have been
// completed by a customer within the context of the provider. This
// might include a sign up flow or a provisioning step, for example,
// that the provider can admit to having happened.
Approvals []*Approval `json:"approvals,omitempty"`
// CreateTime: Output only. The creation timestamp.
CreateTime string `json:"createTime,omitempty"`
// InputProperties: Output only. The custom properties that were
// collected from the user to create this account.
InputProperties googleapi.RawMessage `json:"inputProperties,omitempty"`
// Name: Output only. The resource name of the account. Account names
// have the form `accounts/{account_id}`.
Name string `json:"name,omitempty"`
// Provider: Output only. The identifier of the service provider that
// this account was created against. Each service provider is assigned a
// unique provider value when they onboard with Cloud Commerce platform.
Provider string `json:"provider,omitempty"`
// State: Output only. The state of the account. This is used to decide
// whether the customer is in good standing with the provider and is
// able to make purchases. An account might not be able to make a
// purchase if the billing account is suspended, for example.
//
// Possible values:
// "ACCOUNT_STATE_UNSPECIFIED" - Default state of the account. It's
// only set to this value when the account is first created and has not
// been initialized.
// "ACCOUNT_ACTIVATION_REQUESTED" - The customer has requested the
// creation of the account resource, and the provider notification
// message is dispatched. This state has been deprecated, as accounts
// now immediately transition to AccountState.ACCOUNT_ACTIVE.
// "ACCOUNT_ACTIVE" - The account is active and ready for use. The
// next possible states are: - Account getting deleted: After the user
// invokes delete from another API.
State string `json:"state,omitempty"`
// UpdateTime: Output only. The last update timestamp.
UpdateTime string `json:"updateTime,omitempty"`
// ServerResponse contains the HTTP response code and headers from the
// server.
googleapi.ServerResponse `json:"-"`
// ForceSendFields is a list of field names (e.g. "Approvals") to
// unconditionally include in API requests. By default, fields with
// empty or default values are omitted from API requests. However, any
// non-pointer, non-interface field appearing in ForceSendFields will be
// sent to the server regardless of whether the field is empty or not.
// This may be used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "Approvals") to include in
// API requests with the JSON null value. By default, fields with empty
// values are omitted from API requests. However, any field with an
// empty value appearing in NullFields will be sent to the server as
// null. It is an error if a field in this list has a non-empty value.
// This may be used to include null fields in Patch requests.
NullFields []string `json:"-"`
}
func (s *Account) MarshalJSON() ([]byte, error) {
type NoMethod Account
raw := NoMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
// Approval: An approval for some action on an account.
type Approval struct {
// Name: Output only. The name of the approval.
Name string `json:"name,omitempty"`
// Reason: Output only. An explanation for the state of the approval.
Reason string `json:"reason,omitempty"`
// State: Output only. The state of the approval.
//
// Possible values:
// "STATE_UNSPECIFIED" - Sentinel value; do not use.
// "PENDING" - The approval is pending response from the provider. The
// approval state can transition to Account.Approval.State.APPROVED or
// Account.Approval.State.REJECTED.
// "APPROVED" - The approval has been granted by the provider.
// "REJECTED" - The approval has been rejected by the provider. A
// provider may choose to approve a previously rejected approval, so is
// it possible to transition to Account.Approval.State.APPROVED.
State string `json:"state,omitempty"`
// UpdateTime: Optional. The last update timestamp of the approval.
UpdateTime string `json:"updateTime,omitempty"`
// ForceSendFields is a list of field names (e.g. "Name") to
// unconditionally include in API requests. By default, fields with
// empty or default values are omitted from API requests. However, any
// non-pointer, non-interface field appearing in ForceSendFields will be
// sent to the server regardless of whether the field is empty or not.
// This may be used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "Name") to include in API
// requests with the JSON null value. By default, fields with empty
// values are omitted from API requests. However, any field with an
// empty value appearing in NullFields will be sent to the server as
// null. It is an error if a field in this list has a non-empty value.
// This may be used to include null fields in Patch requests.
NullFields []string `json:"-"`
}
func (s *Approval) MarshalJSON() ([]byte, error) {
type NoMethod Approval
raw := NoMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
// ApproveAccountRequest: Request message for
// PartnerProcurementService.ApproveAccount.
type ApproveAccountRequest struct {
// ApprovalName: The name of the approval being approved. If absent and
// there is only one approval possible, that approval will be granted.
// If absent and there are many approvals possible, the request will
// fail with a 400 Bad Request. Optional.
ApprovalName string `json:"approvalName,omitempty"`
// Properties: Set of properties that should be associated with the
// account. Optional.
Properties map[string]string `json:"properties,omitempty"`
// Reason: Free form text string explaining the approval reason.
// Optional. Max allowed length: 256 bytes. Longer strings will be
// truncated.
Reason string `json:"reason,omitempty"`
// ForceSendFields is a list of field names (e.g. "ApprovalName") to
// unconditionally include in API requests. By default, fields with
// empty or default values are omitted from API requests. However, any
// non-pointer, non-interface field appearing in ForceSendFields will be
// sent to the server regardless of whether the field is empty or not.
// This may be used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "ApprovalName") to include
// in API requests with the JSON null value. By default, fields with
// empty values are omitted from API requests. However, any field with
// an empty value appearing in NullFields will be sent to the server as
// null. It is an error if a field in this list has a non-empty value.
// This may be used to include null fields in Patch requests.
NullFields []string `json:"-"`
}
func (s *ApproveAccountRequest) MarshalJSON() ([]byte, error) {
type NoMethod ApproveAccountRequest
raw := NoMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
// ApproveEntitlementPlanChangeRequest: Request message for
// [PartnerProcurementService.ApproveEntitlementPlanChange[].
type ApproveEntitlementPlanChangeRequest struct {
// PendingPlanName: Name of the pending plan that is being approved.
// Required.
PendingPlanName string `json:"pendingPlanName,omitempty"`
// ForceSendFields is a list of field names (e.g. "PendingPlanName") to
// unconditionally include in API requests. By default, fields with
// empty or default values are omitted from API requests. However, any
// non-pointer, non-interface field appearing in ForceSendFields will be
// sent to the server regardless of whether the field is empty or not.
// This may be used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "PendingPlanName") to
// include in API requests with the JSON null value. By default, fields
// with empty values are omitted from API requests. However, any field
// with an empty value appearing in NullFields will be sent to the
// server as null. It is an error if a field in this list has a
// non-empty value. This may be used to include null fields in Patch
// requests.
NullFields []string `json:"-"`
}
func (s *ApproveEntitlementPlanChangeRequest) MarshalJSON() ([]byte, error) {
type NoMethod ApproveEntitlementPlanChangeRequest
raw := NoMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
// ApproveEntitlementRequest: Request message for
// [PartnerProcurementService.ApproveEntitlement[].
type ApproveEntitlementRequest struct {
// EntitlementMigrated: Optional. The resource name of the entitlement
// that was migrated. Format:
// providers/{provider_id}/entitlements/{entitlement_id}. Should only be
// sent when resources have been migrated from entitlement_migrated to
// the new entitlement. Optional.
EntitlementMigrated string `json:"entitlementMigrated,omitempty"`
// Properties: Set of properties that should be associated with the
// entitlement. Optional.
Properties map[string]string `json:"properties,omitempty"`
// ForceSendFields is a list of field names (e.g. "EntitlementMigrated")
// to unconditionally include in API requests. By default, fields with
// empty or default values are omitted from API requests. However, any
// non-pointer, non-interface field appearing in ForceSendFields will be
// sent to the server regardless of whether the field is empty or not.
// This may be used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "EntitlementMigrated") to
// include in API requests with the JSON null value. By default, fields
// with empty values are omitted from API requests. However, any field
// with an empty value appearing in NullFields will be sent to the
// server as null. It is an error if a field in this list has a
// non-empty value. This may be used to include null fields in Patch
// requests.
NullFields []string `json:"-"`
}
func (s *ApproveEntitlementRequest) MarshalJSON() ([]byte, error) {
type NoMethod ApproveEntitlementRequest
raw := NoMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
// Consumer: A resource using (consuming) this entitlement.
type Consumer struct {
// Project: A project name with format `projects/`.
Project string `json:"project,omitempty"`
// ForceSendFields is a list of field names (e.g. "Project") to
// unconditionally include in API requests. By default, fields with
// empty or default values are omitted from API requests. However, any
// non-pointer, non-interface field appearing in ForceSendFields will be
// sent to the server regardless of whether the field is empty or not.
// This may be used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "Project") to include in
// API requests with the JSON null value. By default, fields with empty
// values are omitted from API requests. However, any field with an
// empty value appearing in NullFields will be sent to the server as
// null. It is an error if a field in this list has a non-empty value.
// This may be used to include null fields in Patch requests.
NullFields []string `json:"-"`
}
func (s *Consumer) MarshalJSON() ([]byte, error) {
type NoMethod Consumer
raw := NoMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
// Empty: A generic empty message that you can re-use to avoid defining
// duplicated empty messages in your APIs. A typical example is to use
// it as the request or the response type of an API method. For
// instance: service Foo { rpc Bar(google.protobuf.Empty) returns
// (google.protobuf.Empty); }
type Empty struct {
// ServerResponse contains the HTTP response code and headers from the
// server.
googleapi.ServerResponse `json:"-"`
}
// Entitlement: Represents a procured product of a customer.
type Entitlement struct {
// Account: Output only. The resource name of the account that this
// entitlement is based on, if any.
Account string `json:"account,omitempty"`
// Consumers: Output only. The resources using this entitlement, if
// applicable.
Consumers []*Consumer `json:"consumers,omitempty"`
// CreateTime: Output only. The creation timestamp.
CreateTime string `json:"createTime,omitempty"`
// InputProperties: Output only. The custom properties that were
// collected from the user to create this entitlement.
InputProperties googleapi.RawMessage `json:"inputProperties,omitempty"`
// MessageToUser: Provider-supplied message that is displayed to the end
// user. Currently this is used to communicate progress and ETA for
// provisioning. This field can be updated only when a user is waiting
// for an action from the provider, i.e. entitlement state is
// EntitlementState.ENTITLEMENT_ACTIVATION_REQUESTED or
// EntitlementState.ENTITLEMENT_PENDING_PLAN_CHANGE_APPROVAL. This field
// is cleared automatically when the entitlement state changes.
MessageToUser string `json:"messageToUser,omitempty"`
// Name: Output only. The resource name of the entitlement. Entitlement
// names have the form
// `providers/{provider_id}/entitlements/{entitlement_id}`.
Name string `json:"name,omitempty"`
// NewPendingOffer: Output only. The name of the offer the entitlement
// is switching to upon a pending plan change. Only exists if the
// pending plan change is moving to an offer. Format:
// 'projects/{project}/services/{service}/privateOffers/{offer-id}' OR
// 'projects/{project}/services/{service}/standardOffers/{offer-id}',
// depending on whether the offer is private or public.
NewPendingOffer string `json:"newPendingOffer,omitempty"`
// NewPendingOfferDuration: Output only. The offer duration of the new
// offer in ISO 8601 duration format. Field is empty if the pending plan
// change is not moving to an offer since the entitlement is not
// pending, only the plan change is pending.
NewPendingOfferDuration string `json:"newPendingOfferDuration,omitempty"`
// NewPendingPlan: Output only. The identifier of the pending new plan.
// Required if the product has plans and the entitlement has a pending
// plan change.
NewPendingPlan string `json:"newPendingPlan,omitempty"`
// Offer: Output only. The name of the offer that was procured. Field is
// empty if order was not made using an offer. Format:
// 'projects/{project}/services/{service}/privateOffers/{offer-id}' OR
// 'projects/{project}/services/{service}/standardOffers/{offer-id}',
// depending on whether the offer is private or public.
Offer string `json:"offer,omitempty"`
// OfferDuration: Output only. The offer duration of the current offer
// in ISO 8601 duration format. Field is empty if entitlement was not
// made using an offer.
OfferDuration string `json:"offerDuration,omitempty"`
// OfferEndTime: Output only. End time for the Offer association
// corresponding to this entitlement. The field is only populated if the
// entitlement is currently associated with an Offer.
OfferEndTime string `json:"offerEndTime,omitempty"`
// Plan: Output only. The identifier of the plan that was procured.
// Required if the product has plans.
Plan string `json:"plan,omitempty"`
// Product: Output only. The identifier of the entity that was
// purchased. This may actually represent a product, quote, or offer. It
// is highly recommended to use the more explicit fields
// productExternalName, quoteExternalName, or offer listed below based
// on your needs.
Product string `json:"product,omitempty"`
// ProductExternalName: Output only. The identifier of the product that
// was procured.
ProductExternalName string `json:"productExternalName,omitempty"`
// Provider: Output only. The identifier of the service provider that
// this entitlement was created against. Each service provider is
// assigned a unique provider value when they onboard with Cloud
// Commerce platform.
Provider string `json:"provider,omitempty"`
// QuoteExternalName: Output only. The identifier of the quote that was
// used to procure. Empty if the order is not purchased using a quote.
QuoteExternalName string `json:"quoteExternalName,omitempty"`
// State: Output only. The state of the entitlement.
//
// Possible values:
// "ENTITLEMENT_STATE_UNSPECIFIED" - Default state of the entitlement.
// It's only set to this value when the entitlement is first created and
// has not been initialized.
// "ENTITLEMENT_ACTIVATION_REQUESTED" - Indicates that the entitlement
// is being created and the backend has sent a notification to the
// provider for the activation approval. If the provider approves, then
// the entitlement will transition to the
// EntitlementState.ENTITLEMENT_ACTIVE state. Otherwise, the entitlement
// will be removed. Plan changes are not allowed in this state. Instead
// the entitlement is cancelled and re-created with a new plan name.
// "ENTITLEMENT_ACTIVE" - Indicates that the entitlement is active.
// The procured item is now usable and any associated billing events
// will start occurring. Entitlements in this state WILL renew. The
// analogous state for an unexpired but non-renewing entitlement is
// ENTITLEMENT_PENDING_CANCELLATION. In this state, the customer can
// decide to cancel the entitlement, which would change the state to
// EntitlementState.ENTITLEMENT_PENDING_CANCELLATION, and then
// EntitlementState.ENTITLEMENT_CANCELLED. The user can also request a
// change of plan, which will transition the state to
// EntitlementState.ENTITLEMENT_PENDING_PLAN_CHANGE, and then back to
// EntitlementState.ENTITLEMENT_ACTIVE.
// "ENTITLEMENT_PENDING_CANCELLATION" - Indicates that the entitlement
// will expire at the end of its term. This could mean the customer has
// elected not to renew this entitlement or the customer elected to
// cancel an entitlement that only expires at term end. The entitlement
// typically stays in this state if the entitlement/plan allows use of
// the underlying resource until the end of the current billing cycle.
// Once the billing cycle completes, the resource will transition to
// EntitlementState.ENTITLEMENT_CANCELLED state. The resource cannot be
// modified during this state.
// "ENTITLEMENT_CANCELLED" - Indicates that the entitlement was
// cancelled. The entitlement can now be deleted.
// "ENTITLEMENT_PENDING_PLAN_CHANGE" - Indicates that the entitlement
// is currently active, but there is a pending plan change that is
// requested by the customer. The entitlement typically stays in this
// state, if the entitlement/plan requires the completion of the current
// billing cycle before the plan can be changed. Once the billing cycle
// completes, the resource will transition to
// EntitlementState.ENTITLEMENT_ACTIVE, with its plan changed.
// "ENTITLEMENT_PENDING_PLAN_CHANGE_APPROVAL" - Indicates that the
// entitlement is currently active, but there is a plan change request
// pending provider approval. If the provider approves the plan change,
// then the entitlement will transition either to
// EntitlementState.ENTITLEMENT_ACTIVE or
// EntitlementState.ENTITLEMENT_PENDING_PLAN_CHANGE depending on whether
// current plan requires that the billing cycle completes. If the
// provider rejects the plan change, then the pending plan change
// request is removed and the entitlement stays in
// EntitlementState.ENTITLEMENT_ACTIVE state with the old plan.
// "ENTITLEMENT_SUSPENDED" - Indicates that the entitlement is
// suspended either by Google or provider request. This can be triggered
// for various external reasons (e.g. expiration of credit card on the
// billing account, violation of terms-of-service of the provider etc.).
// As such, any remediating action needs to be taken externally, before
// the entitlement can be activated. This is not yet supported.
State string `json:"state,omitempty"`
// SubscriptionEndTime: Output only. End time for the subscription
// corresponding to this entitlement.
SubscriptionEndTime string `json:"subscriptionEndTime,omitempty"`
// UpdateTime: Output only. The last update timestamp.
UpdateTime string `json:"updateTime,omitempty"`
// UsageReportingId: Output only. The consumerId to use when reporting
// usage through the Service Control API. See the consumerId field at
// Reporting Metrics
// (https://cloud.google.com/service-control/reporting-metrics) for more
// details. This field is present only if the product has usage-based
// billing configured.
UsageReportingId string `json:"usageReportingId,omitempty"`
// ServerResponse contains the HTTP response code and headers from the
// server.
googleapi.ServerResponse `json:"-"`
// ForceSendFields is a list of field names (e.g. "Account") to
// unconditionally include in API requests. By default, fields with
// empty or default values are omitted from API requests. However, any
// non-pointer, non-interface field appearing in ForceSendFields will be
// sent to the server regardless of whether the field is empty or not.
// This may be used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "Account") to include in
// API requests with the JSON null value. By default, fields with empty
// values are omitted from API requests. However, any field with an
// empty value appearing in NullFields will be sent to the server as
// null. It is an error if a field in this list has a non-empty value.
// This may be used to include null fields in Patch requests.
NullFields []string `json:"-"`
}
func (s *Entitlement) MarshalJSON() ([]byte, error) {
type NoMethod Entitlement
raw := NoMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
// ListAccountsResponse: Response message for
// [PartnerProcurementService.ListAccounts[].
type ListAccountsResponse struct {
// Accounts: The list of accounts in this response.
Accounts []*Account `json:"accounts,omitempty"`
// NextPageToken: The token for fetching the next page.
NextPageToken string `json:"nextPageToken,omitempty"`
// ServerResponse contains the HTTP response code and headers from the
// server.
googleapi.ServerResponse `json:"-"`
// ForceSendFields is a list of field names (e.g. "Accounts") to
// unconditionally include in API requests. By default, fields with
// empty or default values are omitted from API requests. However, any
// non-pointer, non-interface field appearing in ForceSendFields will be
// sent to the server regardless of whether the field is empty or not.
// This may be used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "Accounts") to include in
// API requests with the JSON null value. By default, fields with empty
// values are omitted from API requests. However, any field with an
// empty value appearing in NullFields will be sent to the server as
// null. It is an error if a field in this list has a non-empty value.
// This may be used to include null fields in Patch requests.
NullFields []string `json:"-"`
}
func (s *ListAccountsResponse) MarshalJSON() ([]byte, error) {
type NoMethod ListAccountsResponse
raw := NoMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
// ListEntitlementsResponse: Response message for
// PartnerProcurementService.ListEntitlements.
type ListEntitlementsResponse struct {
// Entitlements: The list of entitlements in this response.
Entitlements []*Entitlement `json:"entitlements,omitempty"`
// NextPageToken: The token for fetching the next page.
NextPageToken string `json:"nextPageToken,omitempty"`
// ServerResponse contains the HTTP response code and headers from the
// server.
googleapi.ServerResponse `json:"-"`
// ForceSendFields is a list of field names (e.g. "Entitlements") to
// unconditionally include in API requests. By default, fields with
// empty or default values are omitted from API requests. However, any
// non-pointer, non-interface field appearing in ForceSendFields will be
// sent to the server regardless of whether the field is empty or not.
// This may be used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "Entitlements") to include
// in API requests with the JSON null value. By default, fields with
// empty values are omitted from API requests. However, any field with
// an empty value appearing in NullFields will be sent to the server as
// null. It is an error if a field in this list has a non-empty value.
// This may be used to include null fields in Patch requests.
NullFields []string `json:"-"`
}
func (s *ListEntitlementsResponse) MarshalJSON() ([]byte, error) {
type NoMethod ListEntitlementsResponse
raw := NoMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
// RejectAccountRequest: Request message for
// PartnerProcurementService.RejectAccount.
type RejectAccountRequest struct {
// ApprovalName: The name of the approval being rejected. If absent and
// there is only one approval possible, that approval will be rejected.
// If absent and there are many approvals possible, the request will
// fail with a 400 Bad Request. Optional.
ApprovalName string `json:"approvalName,omitempty"`
// Reason: Free form text string explaining the rejection reason. Max
// allowed length: 256 bytes. Longer strings will be truncated.
Reason string `json:"reason,omitempty"`
// ForceSendFields is a list of field names (e.g. "ApprovalName") to
// unconditionally include in API requests. By default, fields with
// empty or default values are omitted from API requests. However, any
// non-pointer, non-interface field appearing in ForceSendFields will be
// sent to the server regardless of whether the field is empty or not.
// This may be used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "ApprovalName") to include
// in API requests with the JSON null value. By default, fields with
// empty values are omitted from API requests. However, any field with
// an empty value appearing in NullFields will be sent to the server as
// null. It is an error if a field in this list has a non-empty value.
// This may be used to include null fields in Patch requests.
NullFields []string `json:"-"`
}
func (s *RejectAccountRequest) MarshalJSON() ([]byte, error) {
type NoMethod RejectAccountRequest
raw := NoMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
// RejectEntitlementPlanChangeRequest: Request message for
// PartnerProcurementService.RejectEntitlementPlanChange.
type RejectEntitlementPlanChangeRequest struct {
// PendingPlanName: Name of the pending plan that is being rejected.
// Required.
PendingPlanName string `json:"pendingPlanName,omitempty"`
// Reason: Free form text string explaining the rejection reason. Max
// allowed length: 256 bytes. Longer strings will be truncated.
Reason string `json:"reason,omitempty"`
// ForceSendFields is a list of field names (e.g. "PendingPlanName") to
// unconditionally include in API requests. By default, fields with
// empty or default values are omitted from API requests. However, any
// non-pointer, non-interface field appearing in ForceSendFields will be
// sent to the server regardless of whether the field is empty or not.
// This may be used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "PendingPlanName") to
// include in API requests with the JSON null value. By default, fields
// with empty values are omitted from API requests. However, any field
// with an empty value appearing in NullFields will be sent to the
// server as null. It is an error if a field in this list has a
// non-empty value. This may be used to include null fields in Patch
// requests.
NullFields []string `json:"-"`
}
func (s *RejectEntitlementPlanChangeRequest) MarshalJSON() ([]byte, error) {
type NoMethod RejectEntitlementPlanChangeRequest
raw := NoMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
// RejectEntitlementRequest: Request message for
// PartnerProcurementService.RejectEntitlement.
type RejectEntitlementRequest struct {
// Reason: Free form text string explaining the rejection reason. Max
// allowed length: 256 bytes. Longer strings will be truncated.
Reason string `json:"reason,omitempty"`
// ForceSendFields is a list of field names (e.g. "Reason") to
// unconditionally include in API requests. By default, fields with
// empty or default values are omitted from API requests. However, any
// non-pointer, non-interface field appearing in ForceSendFields will be
// sent to the server regardless of whether the field is empty or not.
// This may be used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "Reason") to include in API
// requests with the JSON null value. By default, fields with empty
// values are omitted from API requests. However, any field with an
// empty value appearing in NullFields will be sent to the server as
// null. It is an error if a field in this list has a non-empty value.
// This may be used to include null fields in Patch requests.
NullFields []string `json:"-"`
}
func (s *RejectEntitlementRequest) MarshalJSON() ([]byte, error) {
type NoMethod RejectEntitlementRequest
raw := NoMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
// ResetAccountRequest: Request message for for
// PartnerProcurementService.ResetAccount.
type ResetAccountRequest struct {
}
// SuspendEntitlementRequest: Request message for
// ParterProcurementService.SuspendEntitlement. This is not yet
// supported.
type SuspendEntitlementRequest struct {
// Reason: A free-form reason string, explaining the reason for
// suspension request.
Reason string `json:"reason,omitempty"`
// ForceSendFields is a list of field names (e.g. "Reason") to
// unconditionally include in API requests. By default, fields with
// empty or default values are omitted from API requests. However, any
// non-pointer, non-interface field appearing in ForceSendFields will be
// sent to the server regardless of whether the field is empty or not.
// This may be used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "Reason") to include in API
// requests with the JSON null value. By default, fields with empty
// values are omitted from API requests. However, any field with an
// empty value appearing in NullFields will be sent to the server as
// null. It is an error if a field in this list has a non-empty value.
// This may be used to include null fields in Patch requests.
NullFields []string `json:"-"`
}
func (s *SuspendEntitlementRequest) MarshalJSON() ([]byte, error) {
type NoMethod SuspendEntitlementRequest
raw := NoMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
// method id "cloudcommerceprocurement.providers.accounts.approve":
type ProvidersAccountsApproveCall struct {
s *Service
name string
approveaccountrequest *ApproveAccountRequest
urlParams_ gensupport.URLParams
ctx_ context.Context
header_ http.Header
}
// Approve: Grants an approval on an Account.
//
// - name: The resource name of the account.
func (r *ProvidersAccountsService) Approve(name string, approveaccountrequest *ApproveAccountRequest) *ProvidersAccountsApproveCall {
c := &ProvidersAccountsApproveCall{s: r.s, urlParams_: make(gensupport.URLParams)}
c.name = name
c.approveaccountrequest = approveaccountrequest
return c
}
// Fields allows partial responses to be retrieved. See
// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
// for more information.
func (c *ProvidersAccountsApproveCall) Fields(s ...googleapi.Field) *ProvidersAccountsApproveCall {
c.urlParams_.Set("fields", googleapi.CombineFields(s))
return c
}
// Context sets the context to be used in this call's Do method. Any
// pending HTTP request will be aborted if the provided context is
// canceled.
func (c *ProvidersAccountsApproveCall) Context(ctx context.Context) *ProvidersAccountsApproveCall {
c.ctx_ = ctx
return c
}
// Header returns an http.Header that can be modified by the caller to
// add HTTP headers to the request.
func (c *ProvidersAccountsApproveCall) Header() http.Header {
if c.header_ == nil {
c.header_ = make(http.Header)
}
return c.header_
}
func (c *ProvidersAccountsApproveCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/"+internal.Version)
for k, v := range c.header_ {
reqHeaders[k] = v
}
reqHeaders.Set("User-Agent", c.s.userAgent())
var body io.Reader = nil
body, err := googleapi.WithoutDataWrapper.JSONReader(c.approveaccountrequest)
if err != nil {
return nil, err
}
reqHeaders.Set("Content-Type", "application/json")
c.urlParams_.Set("alt", alt)
c.urlParams_.Set("prettyPrint", "false")
urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}:approve")
urls += "?" + c.urlParams_.Encode()
req, err := http.NewRequest("POST", urls, body)
if err != nil {
return nil, err
}
req.Header = reqHeaders
googleapi.Expand(req.URL, map[string]string{
"name": c.name,
})
return gensupport.SendRequest(c.ctx_, c.s.client, req)
}
// Do executes the "cloudcommerceprocurement.providers.accounts.approve" call.
// Exactly one of *Empty or error will be non-nil. Any non-2xx status
// code is an error. Response headers are in either
// *Empty.ServerResponse.Header or (if a response was returned at all)
// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
// check whether the returned error was because http.StatusNotModified
// was returned.
func (c *ProvidersAccountsApproveCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
gensupport.SetOptions(c.urlParams_, opts...)
res, err := c.doRequest("json")
if res != nil && res.StatusCode == http.StatusNotModified {
if res.Body != nil {
res.Body.Close()
}
return nil, &googleapi.Error{
Code: res.StatusCode,
Header: res.Header,
}
}
if err != nil {
return nil, err
}
defer googleapi.CloseBody(res)
if err := googleapi.CheckResponse(res); err != nil {
return nil, err
}
ret := &Empty{
ServerResponse: googleapi.ServerResponse{
Header: res.Header,
HTTPStatusCode: res.StatusCode,
},
}
target := &ret
if err := gensupport.DecodeResponse(target, res); err != nil {
return nil, err
}
return ret, nil
// {
// "description": "Grants an approval on an Account.",
// "flatPath": "v1/providers/{providersId}/accounts/{accountsId}:approve",
// "httpMethod": "POST",
// "id": "cloudcommerceprocurement.providers.accounts.approve",
// "parameterOrder": [
// "name"
// ],
// "parameters": {
// "name": {
// "description": "The resource name of the account. Required.",
// "location": "path",
// "pattern": "^providers/[^/]+/accounts/[^/]+$",
// "required": true,
// "type": "string"
// }
// },
// "path": "v1/{+name}:approve",
// "request": {
// "$ref": "ApproveAccountRequest"
// },
// "response": {
// "$ref": "Empty"
// },
// "scopes": [
// "https://www.googleapis.com/auth/cloud-platform"
// ]
// }
}
// method id "cloudcommerceprocurement.providers.accounts.get":
type ProvidersAccountsGetCall struct {
s *Service
name string
urlParams_ gensupport.URLParams
ifNoneMatch_ string
ctx_ context.Context
header_ http.Header
}
// Get: Gets a requested Account resource.
//