1 // Copyright 2022 Google LLC. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 // Code generated file. DO NOT EDIT. 6 7 // Package cloudcommerceprocurement provides access to the Cloud Commerce Partner Procurement API. 8 // 9 // For product documentation, see: https://cloud.google.com/marketplace/docs/partners/ 10 // 11 // # Creating a client 12 // 13 // Usage example: 14 // 15 // import "google.golang.org/api/cloudcommerceprocurement/v1" 16 // ... 17 // ctx := context.Background() 18 // cloudcommerceprocurementService, err := cloudcommerceprocurement.NewService(ctx) 19 // 20 // In this example, Google Application Default Credentials are used for authentication. 21 // 22 // For information on how to create and obtain Application Default Credentials, see https://developers.google.com/identity/protocols/application-default-credentials. 23 // 24 // # Other authentication options 25 // 26 // To use an API key for authentication (note: some APIs do not support API keys), use option.WithAPIKey: 27 // 28 // cloudcommerceprocurementService, err := cloudcommerceprocurement.NewService(ctx, option.WithAPIKey("AIza...")) 29 // 30 // To use an OAuth token (e.g., a user token obtained via a three-legged OAuth flow), use option.WithTokenSource: 31 // 32 // config := &oauth2.Config{...} 33 // // ... 34 // token, err := config.Exchange(ctx, ...) 35 // cloudcommerceprocurementService, err := cloudcommerceprocurement.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token))) 36 // 37 // See https://godoc.org/google.golang.org/api/option/ for details on options. 38 package cloudcommerceprocurement // import "google.golang.org/api/cloudcommerceprocurement/v1" 39 40 import ( 41 "bytes" 42 "context" 43 "encoding/json" 44 "errors" 45 "fmt" 46 "io" 47 "net/http" 48 "net/url" 49 "strconv" 50 "strings" 51 52 googleapi "google.golang.org/api/googleapi" 53 internal "google.golang.org/api/internal" 54 gensupport "google.golang.org/api/internal/gensupport" 55 option "google.golang.org/api/option" 56 internaloption "google.golang.org/api/option/internaloption" 57 htransport "google.golang.org/api/transport/http" 58 ) 59 60 // Always reference these packages, just in case the auto-generated code 61 // below doesn't. 62 var _ = bytes.NewBuffer 63 var _ = strconv.Itoa 64 var _ = fmt.Sprintf 65 var _ = json.NewDecoder 66 var _ = io.Copy 67 var _ = url.Parse 68 var _ = gensupport.MarshalJSON 69 var _ = googleapi.Version 70 var _ = errors.New 71 var _ = strings.Replace 72 var _ = context.Canceled 73 var _ = internaloption.WithDefaultEndpoint 74 75 const apiId = "cloudcommerceprocurement:v1" 76 const apiName = "cloudcommerceprocurement" 77 const apiVersion = "v1" 78 const basePath = "https://cloudcommerceprocurement.googleapis.com/" 79 const mtlsBasePath = "https://cloudcommerceprocurement.mtls.googleapis.com/" 80 81 // OAuth2 scopes used by this API. 82 const ( 83 // See, edit, configure, and delete your Google Cloud data and see the 84 // email address for your Google Account. 85 CloudPlatformScope = "https://www.googleapis.com/auth/cloud-platform" 86 ) 87 88 // NewService creates a new Service. 89 func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) { 90 scopesOption := internaloption.WithDefaultScopes( 91 "https://www.googleapis.com/auth/cloud-platform", 92 ) 93 // NOTE: prepend, so we don't override user-specified scopes. 94 opts = append([]option.ClientOption{scopesOption}, opts...) 95 opts = append(opts, internaloption.WithDefaultEndpoint(basePath)) 96 opts = append(opts, internaloption.WithDefaultMTLSEndpoint(mtlsBasePath)) 97 client, endpoint, err := htransport.NewClient(ctx, opts...) 98 if err != nil { 99 return nil, err 100 } 101 s, err := New(client) 102 if err != nil { 103 return nil, err 104 } 105 if endpoint != "" { 106 s.BasePath = endpoint 107 } 108 return s, nil 109 } 110 111 // New creates a new Service. It uses the provided http.Client for requests. 112 // 113 // Deprecated: please use NewService instead. 114 // To provide a custom HTTP client, use option.WithHTTPClient. 115 // If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead. 116 func New(client *http.Client) (*Service, error) { 117 if client == nil { 118 return nil, errors.New("client is nil") 119 } 120 s := &Service{client: client, BasePath: basePath} 121 s.Providers = NewProvidersService(s) 122 return s, nil 123 } 124 125 type Service struct { 126 client *http.Client 127 BasePath string // API endpoint base URL 128 UserAgent string // optional additional User-Agent fragment 129 130 Providers *ProvidersService 131 } 132 133 func (s *Service) userAgent() string { 134 if s.UserAgent == "" { 135 return googleapi.UserAgent 136 } 137 return googleapi.UserAgent + " " + s.UserAgent 138 } 139 140 func NewProvidersService(s *Service) *ProvidersService { 141 rs := &ProvidersService{s: s} 142 rs.Accounts = NewProvidersAccountsService(s) 143 rs.Entitlements = NewProvidersEntitlementsService(s) 144 return rs 145 } 146 147 type ProvidersService struct { 148 s *Service 149 150 Accounts *ProvidersAccountsService 151 152 Entitlements *ProvidersEntitlementsService 153 } 154 155 func NewProvidersAccountsService(s *Service) *ProvidersAccountsService { 156 rs := &ProvidersAccountsService{s: s} 157 return rs 158 } 159 160 type ProvidersAccountsService struct { 161 s *Service 162 } 163 164 func NewProvidersEntitlementsService(s *Service) *ProvidersEntitlementsService { 165 rs := &ProvidersEntitlementsService{s: s} 166 return rs 167 } 168 169 type ProvidersEntitlementsService struct { 170 s *Service 171 } 172 173 // Account: Represents an account that was established by the customer 174 // on the service provider's system. 175 type Account struct { 176 // Approvals: Output only. The approvals for this account. These 177 // approvals are used to track actions that are permitted or have been 178 // completed by a customer within the context of the provider. This 179 // might include a sign up flow or a provisioning step, for example, 180 // that the provider can admit to having happened. 181 Approvals []*Approval `json:"approvals,omitempty"` 182 183 // CreateTime: Output only. The creation timestamp. 184 CreateTime string `json:"createTime,omitempty"` 185 186 // InputProperties: Output only. The custom properties that were 187 // collected from the user to create this account. 188 InputProperties googleapi.RawMessage `json:"inputProperties,omitempty"` 189 190 // Name: Output only. The resource name of the account. Account names 191 // have the form `accounts/{account_id}`. 192 Name string `json:"name,omitempty"` 193 194 // Provider: Output only. The identifier of the service provider that 195 // this account was created against. Each service provider is assigned a 196 // unique provider value when they onboard with Cloud Commerce platform. 197 Provider string `json:"provider,omitempty"` 198 199 // State: Output only. The state of the account. This is used to decide 200 // whether the customer is in good standing with the provider and is 201 // able to make purchases. An account might not be able to make a 202 // purchase if the billing account is suspended, for example. 203 // 204 // Possible values: 205 // "ACCOUNT_STATE_UNSPECIFIED" - Default state of the account. It's 206 // only set to this value when the account is first created and has not 207 // been initialized. 208 // "ACCOUNT_ACTIVATION_REQUESTED" - The customer has requested the 209 // creation of the account resource, and the provider notification 210 // message is dispatched. This state has been deprecated, as accounts 211 // now immediately transition to AccountState.ACCOUNT_ACTIVE. 212 // "ACCOUNT_ACTIVE" - The account is active and ready for use. The 213 // next possible states are: - Account getting deleted: After the user 214 // invokes delete from another API. 215 State string `json:"state,omitempty"` 216 217 // UpdateTime: Output only. The last update timestamp. 218 UpdateTime string `json:"updateTime,omitempty"` 219 220 // ServerResponse contains the HTTP response code and headers from the 221 // server. 222 googleapi.ServerResponse `json:"-"` 223 224 // ForceSendFields is a list of field names (e.g. "Approvals") to 225 // unconditionally include in API requests. By default, fields with 226 // empty or default values are omitted from API requests. However, any 227 // non-pointer, non-interface field appearing in ForceSendFields will be 228 // sent to the server regardless of whether the field is empty or not. 229 // This may be used to include empty fields in Patch requests. 230 ForceSendFields []string `json:"-"` 231 232 // NullFields is a list of field names (e.g. "Approvals") to include in 233 // API requests with the JSON null value. By default, fields with empty 234 // values are omitted from API requests. However, any field with an 235 // empty value appearing in NullFields will be sent to the server as 236 // null. It is an error if a field in this list has a non-empty value. 237 // This may be used to include null fields in Patch requests. 238 NullFields []string `json:"-"` 239 } 240 241 func (s *Account) MarshalJSON() ([]byte, error) { 242 type NoMethod Account 243 raw := NoMethod(*s) 244 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 245 } 246 247 // Approval: An approval for some action on an account. 248 type Approval struct { 249 // Name: Output only. The name of the approval. 250 Name string `json:"name,omitempty"` 251 252 // Reason: Output only. An explanation for the state of the approval. 253 Reason string `json:"reason,omitempty"` 254 255 // State: Output only. The state of the approval. 256 // 257 // Possible values: 258 // "STATE_UNSPECIFIED" - Sentinel value; do not use. 259 // "PENDING" - The approval is pending response from the provider. The 260 // approval state can transition to Account.Approval.State.APPROVED or 261 // Account.Approval.State.REJECTED. 262 // "APPROVED" - The approval has been granted by the provider. 263 // "REJECTED" - The approval has been rejected by the provider. A 264 // provider may choose to approve a previously rejected approval, so is 265 // it possible to transition to Account.Approval.State.APPROVED. 266 State string `json:"state,omitempty"` 267 268 // UpdateTime: Optional. The last update timestamp of the approval. 269 UpdateTime string `json:"updateTime,omitempty"` 270 271 // ForceSendFields is a list of field names (e.g. "Name") to 272 // unconditionally include in API requests. By default, fields with 273 // empty or default values are omitted from API requests. However, any 274 // non-pointer, non-interface field appearing in ForceSendFields will be 275 // sent to the server regardless of whether the field is empty or not. 276 // This may be used to include empty fields in Patch requests. 277 ForceSendFields []string `json:"-"` 278 279 // NullFields is a list of field names (e.g. "Name") to include in API 280 // requests with the JSON null value. By default, fields with empty 281 // values are omitted from API requests. However, any field with an 282 // empty value appearing in NullFields will be sent to the server as 283 // null. It is an error if a field in this list has a non-empty value. 284 // This may be used to include null fields in Patch requests. 285 NullFields []string `json:"-"` 286 } 287 288 func (s *Approval) MarshalJSON() ([]byte, error) { 289 type NoMethod Approval 290 raw := NoMethod(*s) 291 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 292 } 293 294 // ApproveAccountRequest: Request message for 295 // PartnerProcurementService.ApproveAccount. 296 type ApproveAccountRequest struct { 297 // ApprovalName: The name of the approval being approved. If absent and 298 // there is only one approval possible, that approval will be granted. 299 // If absent and there are many approvals possible, the request will 300 // fail with a 400 Bad Request. Optional. 301 ApprovalName string `json:"approvalName,omitempty"` 302 303 // Properties: Set of properties that should be associated with the 304 // account. Optional. 305 Properties map[string]string `json:"properties,omitempty"` 306 307 // Reason: Free form text string explaining the approval reason. 308 // Optional. Max allowed length: 256 bytes. Longer strings will be 309 // truncated. 310 Reason string `json:"reason,omitempty"` 311 312 // ForceSendFields is a list of field names (e.g. "ApprovalName") to 313 // unconditionally include in API requests. By default, fields with 314 // empty or default values are omitted from API requests. However, any 315 // non-pointer, non-interface field appearing in ForceSendFields will be 316 // sent to the server regardless of whether the field is empty or not. 317 // This may be used to include empty fields in Patch requests. 318 ForceSendFields []string `json:"-"` 319 320 // NullFields is a list of field names (e.g. "ApprovalName") to include 321 // in API requests with the JSON null value. By default, fields with 322 // empty values are omitted from API requests. However, any field with 323 // an empty value appearing in NullFields will be sent to the server as 324 // null. It is an error if a field in this list has a non-empty value. 325 // This may be used to include null fields in Patch requests. 326 NullFields []string `json:"-"` 327 } 328 329 func (s *ApproveAccountRequest) MarshalJSON() ([]byte, error) { 330 type NoMethod ApproveAccountRequest 331 raw := NoMethod(*s) 332 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 333 } 334 335 // ApproveEntitlementPlanChangeRequest: Request message for 336 // [PartnerProcurementService.ApproveEntitlementPlanChange[]. 337 type ApproveEntitlementPlanChangeRequest struct { 338 // PendingPlanName: Name of the pending plan that is being approved. 339 // Required. 340 PendingPlanName string `json:"pendingPlanName,omitempty"` 341 342 // ForceSendFields is a list of field names (e.g. "PendingPlanName") to 343 // unconditionally include in API requests. By default, fields with 344 // empty or default values are omitted from API requests. However, any 345 // non-pointer, non-interface field appearing in ForceSendFields will be 346 // sent to the server regardless of whether the field is empty or not. 347 // This may be used to include empty fields in Patch requests. 348 ForceSendFields []string `json:"-"` 349 350 // NullFields is a list of field names (e.g. "PendingPlanName") to 351 // include in API requests with the JSON null value. By default, fields 352 // with empty values are omitted from API requests. However, any field 353 // with an empty value appearing in NullFields will be sent to the 354 // server as null. It is an error if a field in this list has a 355 // non-empty value. This may be used to include null fields in Patch 356 // requests. 357 NullFields []string `json:"-"` 358 } 359 360 func (s *ApproveEntitlementPlanChangeRequest) MarshalJSON() ([]byte, error) { 361 type NoMethod ApproveEntitlementPlanChangeRequest 362 raw := NoMethod(*s) 363 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 364 } 365 366 // ApproveEntitlementRequest: Request message for 367 // [PartnerProcurementService.ApproveEntitlement[]. 368 type ApproveEntitlementRequest struct { 369 // EntitlementMigrated: Optional. The resource name of the entitlement 370 // that was migrated. Format: 371 // providers/{provider_id}/entitlements/{entitlement_id}. Should only be 372 // sent when resources have been migrated from entitlement_migrated to 373 // the new entitlement. Optional. 374 EntitlementMigrated string `json:"entitlementMigrated,omitempty"` 375 376 // Properties: Set of properties that should be associated with the 377 // entitlement. Optional. 378 Properties map[string]string `json:"properties,omitempty"` 379 380 // ForceSendFields is a list of field names (e.g. "EntitlementMigrated") 381 // to unconditionally include in API requests. By default, fields with 382 // empty or default values are omitted from API requests. However, any 383 // non-pointer, non-interface field appearing in ForceSendFields will be 384 // sent to the server regardless of whether the field is empty or not. 385 // This may be used to include empty fields in Patch requests. 386 ForceSendFields []string `json:"-"` 387 388 // NullFields is a list of field names (e.g. "EntitlementMigrated") to 389 // include in API requests with the JSON null value. By default, fields 390 // with empty values are omitted from API requests. However, any field 391 // with an empty value appearing in NullFields will be sent to the 392 // server as null. It is an error if a field in this list has a 393 // non-empty value. This may be used to include null fields in Patch 394 // requests. 395 NullFields []string `json:"-"` 396 } 397 398 func (s *ApproveEntitlementRequest) MarshalJSON() ([]byte, error) { 399 type NoMethod ApproveEntitlementRequest 400 raw := NoMethod(*s) 401 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 402 } 403 404 // Consumer: A resource using (consuming) this entitlement. 405 type Consumer struct { 406 // Project: A project name with format `projects/`. 407 Project string `json:"project,omitempty"` 408 409 // ForceSendFields is a list of field names (e.g. "Project") to 410 // unconditionally include in API requests. By default, fields with 411 // empty or default values are omitted from API requests. However, any 412 // non-pointer, non-interface field appearing in ForceSendFields will be 413 // sent to the server regardless of whether the field is empty or not. 414 // This may be used to include empty fields in Patch requests. 415 ForceSendFields []string `json:"-"` 416 417 // NullFields is a list of field names (e.g. "Project") to include in 418 // API requests with the JSON null value. By default, fields with empty 419 // values are omitted from API requests. However, any field with an 420 // empty value appearing in NullFields will be sent to the server as 421 // null. It is an error if a field in this list has a non-empty value. 422 // This may be used to include null fields in Patch requests. 423 NullFields []string `json:"-"` 424 } 425 426 func (s *Consumer) MarshalJSON() ([]byte, error) { 427 type NoMethod Consumer 428 raw := NoMethod(*s) 429 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 430 } 431 432 // Empty: A generic empty message that you can re-use to avoid defining 433 // duplicated empty messages in your APIs. A typical example is to use 434 // it as the request or the response type of an API method. For 435 // instance: service Foo { rpc Bar(google.protobuf.Empty) returns 436 // (google.protobuf.Empty); } 437 type Empty struct { 438 // ServerResponse contains the HTTP response code and headers from the 439 // server. 440 googleapi.ServerResponse `json:"-"` 441 } 442 443 // Entitlement: Represents a procured product of a customer. 444 type Entitlement struct { 445 // Account: Output only. The resource name of the account that this 446 // entitlement is based on, if any. 447 Account string `json:"account,omitempty"` 448 449 // Consumers: Output only. The resources using this entitlement, if 450 // applicable. 451 Consumers []*Consumer `json:"consumers,omitempty"` 452 453 // CreateTime: Output only. The creation timestamp. 454 CreateTime string `json:"createTime,omitempty"` 455 456 // InputProperties: Output only. The custom properties that were 457 // collected from the user to create this entitlement. 458 InputProperties googleapi.RawMessage `json:"inputProperties,omitempty"` 459 460 // MessageToUser: Provider-supplied message that is displayed to the end 461 // user. Currently this is used to communicate progress and ETA for 462 // provisioning. This field can be updated only when a user is waiting 463 // for an action from the provider, i.e. entitlement state is 464 // EntitlementState.ENTITLEMENT_ACTIVATION_REQUESTED or 465 // EntitlementState.ENTITLEMENT_PENDING_PLAN_CHANGE_APPROVAL. This field 466 // is cleared automatically when the entitlement state changes. 467 MessageToUser string `json:"messageToUser,omitempty"` 468 469 // Name: Output only. The resource name of the entitlement. Entitlement 470 // names have the form 471 // `providers/{provider_id}/entitlements/{entitlement_id}`. 472 Name string `json:"name,omitempty"` 473 474 // NewPendingOffer: Output only. The name of the offer the entitlement 475 // is switching to upon a pending plan change. Only exists if the 476 // pending plan change is moving to an offer. Format: 477 // 'projects/{project}/services/{service}/privateOffers/{offer-id}' OR 478 // 'projects/{project}/services/{service}/standardOffers/{offer-id}', 479 // depending on whether the offer is private or public. 480 NewPendingOffer string `json:"newPendingOffer,omitempty"` 481 482 // NewPendingOfferDuration: Output only. The offer duration of the new 483 // offer in ISO 8601 duration format. Field is empty if the pending plan 484 // change is not moving to an offer since the entitlement is not 485 // pending, only the plan change is pending. 486 NewPendingOfferDuration string `json:"newPendingOfferDuration,omitempty"` 487 488 // NewPendingPlan: Output only. The identifier of the pending new plan. 489 // Required if the product has plans and the entitlement has a pending 490 // plan change. 491 NewPendingPlan string `json:"newPendingPlan,omitempty"` 492 493 // Offer: Output only. The name of the offer that was procured. Field is 494 // empty if order was not made using an offer. Format: 495 // 'projects/{project}/services/{service}/privateOffers/{offer-id}' OR 496 // 'projects/{project}/services/{service}/standardOffers/{offer-id}', 497 // depending on whether the offer is private or public. 498 Offer string `json:"offer,omitempty"` 499 500 // OfferDuration: Output only. The offer duration of the current offer 501 // in ISO 8601 duration format. Field is empty if entitlement was not 502 // made using an offer. 503 OfferDuration string `json:"offerDuration,omitempty"` 504 505 // OfferEndTime: Output only. End time for the Offer association 506 // corresponding to this entitlement. The field is only populated if the 507 // entitlement is currently associated with an Offer. 508 OfferEndTime string `json:"offerEndTime,omitempty"` 509 510 // Plan: Output only. The identifier of the plan that was procured. 511 // Required if the product has plans. 512 Plan string `json:"plan,omitempty"` 513 514 // Product: Output only. The identifier of the entity that was 515 // purchased. This may actually represent a product, quote, or offer. It 516 // is highly recommended to use the more explicit fields 517 // productExternalName, quoteExternalName, or offer listed below based 518 // on your needs. 519 Product string `json:"product,omitempty"` 520 521 // ProductExternalName: Output only. The identifier of the product that 522 // was procured. 523 ProductExternalName string `json:"productExternalName,omitempty"` 524 525 // Provider: Output only. The identifier of the service provider that 526 // this entitlement was created against. Each service provider is 527 // assigned a unique provider value when they onboard with Cloud 528 // Commerce platform. 529 Provider string `json:"provider,omitempty"` 530 531 // QuoteExternalName: Output only. The identifier of the quote that was 532 // used to procure. Empty if the order is not purchased using a quote. 533 QuoteExternalName string `json:"quoteExternalName,omitempty"` 534 535 // State: Output only. The state of the entitlement. 536 // 537 // Possible values: 538 // "ENTITLEMENT_STATE_UNSPECIFIED" - Default state of the entitlement. 539 // It's only set to this value when the entitlement is first created and 540 // has not been initialized. 541 // "ENTITLEMENT_ACTIVATION_REQUESTED" - Indicates that the entitlement 542 // is being created and the backend has sent a notification to the 543 // provider for the activation approval. If the provider approves, then 544 // the entitlement will transition to the 545 // EntitlementState.ENTITLEMENT_ACTIVE state. Otherwise, the entitlement 546 // will be removed. Plan changes are not allowed in this state. Instead 547 // the entitlement is cancelled and re-created with a new plan name. 548 // "ENTITLEMENT_ACTIVE" - Indicates that the entitlement is active. 549 // The procured item is now usable and any associated billing events 550 // will start occurring. Entitlements in this state WILL renew. The 551 // analogous state for an unexpired but non-renewing entitlement is 552 // ENTITLEMENT_PENDING_CANCELLATION. In this state, the customer can 553 // decide to cancel the entitlement, which would change the state to 554 // EntitlementState.ENTITLEMENT_PENDING_CANCELLATION, and then 555 // EntitlementState.ENTITLEMENT_CANCELLED. The user can also request a 556 // change of plan, which will transition the state to 557 // EntitlementState.ENTITLEMENT_PENDING_PLAN_CHANGE, and then back to 558 // EntitlementState.ENTITLEMENT_ACTIVE. 559 // "ENTITLEMENT_PENDING_CANCELLATION" - Indicates that the entitlement 560 // will expire at the end of its term. This could mean the customer has 561 // elected not to renew this entitlement or the customer elected to 562 // cancel an entitlement that only expires at term end. The entitlement 563 // typically stays in this state if the entitlement/plan allows use of 564 // the underlying resource until the end of the current billing cycle. 565 // Once the billing cycle completes, the resource will transition to 566 // EntitlementState.ENTITLEMENT_CANCELLED state. The resource cannot be 567 // modified during this state. 568 // "ENTITLEMENT_CANCELLED" - Indicates that the entitlement was 569 // cancelled. The entitlement can now be deleted. 570 // "ENTITLEMENT_PENDING_PLAN_CHANGE" - Indicates that the entitlement 571 // is currently active, but there is a pending plan change that is 572 // requested by the customer. The entitlement typically stays in this 573 // state, if the entitlement/plan requires the completion of the current 574 // billing cycle before the plan can be changed. Once the billing cycle 575 // completes, the resource will transition to 576 // EntitlementState.ENTITLEMENT_ACTIVE, with its plan changed. 577 // "ENTITLEMENT_PENDING_PLAN_CHANGE_APPROVAL" - Indicates that the 578 // entitlement is currently active, but there is a plan change request 579 // pending provider approval. If the provider approves the plan change, 580 // then the entitlement will transition either to 581 // EntitlementState.ENTITLEMENT_ACTIVE or 582 // EntitlementState.ENTITLEMENT_PENDING_PLAN_CHANGE depending on whether 583 // current plan requires that the billing cycle completes. If the 584 // provider rejects the plan change, then the pending plan change 585 // request is removed and the entitlement stays in 586 // EntitlementState.ENTITLEMENT_ACTIVE state with the old plan. 587 // "ENTITLEMENT_SUSPENDED" - Indicates that the entitlement is 588 // suspended either by Google or provider request. This can be triggered 589 // for various external reasons (e.g. expiration of credit card on the 590 // billing account, violation of terms-of-service of the provider etc.). 591 // As such, any remediating action needs to be taken externally, before 592 // the entitlement can be activated. This is not yet supported. 593 State string `json:"state,omitempty"` 594 595 // SubscriptionEndTime: Output only. End time for the subscription 596 // corresponding to this entitlement. 597 SubscriptionEndTime string `json:"subscriptionEndTime,omitempty"` 598 599 // UpdateTime: Output only. The last update timestamp. 600 UpdateTime string `json:"updateTime,omitempty"` 601 602 // UsageReportingId: Output only. The consumerId to use when reporting 603 // usage through the Service Control API. See the consumerId field at 604 // Reporting Metrics 605 // (https://cloud.google.com/service-control/reporting-metrics) for more 606 // details. This field is present only if the product has usage-based 607 // billing configured. 608 UsageReportingId string `json:"usageReportingId,omitempty"` 609 610 // ServerResponse contains the HTTP response code and headers from the 611 // server. 612 googleapi.ServerResponse `json:"-"` 613 614 // ForceSendFields is a list of field names (e.g. "Account") to 615 // unconditionally include in API requests. By default, fields with 616 // empty or default values are omitted from API requests. However, any 617 // non-pointer, non-interface field appearing in ForceSendFields will be 618 // sent to the server regardless of whether the field is empty or not. 619 // This may be used to include empty fields in Patch requests. 620 ForceSendFields []string `json:"-"` 621 622 // NullFields is a list of field names (e.g. "Account") to include in 623 // API requests with the JSON null value. By default, fields with empty 624 // values are omitted from API requests. However, any field with an 625 // empty value appearing in NullFields will be sent to the server as 626 // null. It is an error if a field in this list has a non-empty value. 627 // This may be used to include null fields in Patch requests. 628 NullFields []string `json:"-"` 629 } 630 631 func (s *Entitlement) MarshalJSON() ([]byte, error) { 632 type NoMethod Entitlement 633 raw := NoMethod(*s) 634 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 635 } 636 637 // ListAccountsResponse: Response message for 638 // [PartnerProcurementService.ListAccounts[]. 639 type ListAccountsResponse struct { 640 // Accounts: The list of accounts in this response. 641 Accounts []*Account `json:"accounts,omitempty"` 642 643 // NextPageToken: The token for fetching the next page. 644 NextPageToken string `json:"nextPageToken,omitempty"` 645 646 // ServerResponse contains the HTTP response code and headers from the 647 // server. 648 googleapi.ServerResponse `json:"-"` 649 650 // ForceSendFields is a list of field names (e.g. "Accounts") to 651 // unconditionally include in API requests. By default, fields with 652 // empty or default values are omitted from API requests. However, any 653 // non-pointer, non-interface field appearing in ForceSendFields will be 654 // sent to the server regardless of whether the field is empty or not. 655 // This may be used to include empty fields in Patch requests. 656 ForceSendFields []string `json:"-"` 657 658 // NullFields is a list of field names (e.g. "Accounts") to include in 659 // API requests with the JSON null value. By default, fields with empty 660 // values are omitted from API requests. However, any field with an 661 // empty value appearing in NullFields will be sent to the server as 662 // null. It is an error if a field in this list has a non-empty value. 663 // This may be used to include null fields in Patch requests. 664 NullFields []string `json:"-"` 665 } 666 667 func (s *ListAccountsResponse) MarshalJSON() ([]byte, error) { 668 type NoMethod ListAccountsResponse 669 raw := NoMethod(*s) 670 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 671 } 672 673 // ListEntitlementsResponse: Response message for 674 // PartnerProcurementService.ListEntitlements. 675 type ListEntitlementsResponse struct { 676 // Entitlements: The list of entitlements in this response. 677 Entitlements []*Entitlement `json:"entitlements,omitempty"` 678 679 // NextPageToken: The token for fetching the next page. 680 NextPageToken string `json:"nextPageToken,omitempty"` 681 682 // ServerResponse contains the HTTP response code and headers from the 683 // server. 684 googleapi.ServerResponse `json:"-"` 685 686 // ForceSendFields is a list of field names (e.g. "Entitlements") to 687 // unconditionally include in API requests. By default, fields with 688 // empty or default values are omitted from API requests. However, any 689 // non-pointer, non-interface field appearing in ForceSendFields will be 690 // sent to the server regardless of whether the field is empty or not. 691 // This may be used to include empty fields in Patch requests. 692 ForceSendFields []string `json:"-"` 693 694 // NullFields is a list of field names (e.g. "Entitlements") to include 695 // in API requests with the JSON null value. By default, fields with 696 // empty values are omitted from API requests. However, any field with 697 // an empty value appearing in NullFields will be sent to the server as 698 // null. It is an error if a field in this list has a non-empty value. 699 // This may be used to include null fields in Patch requests. 700 NullFields []string `json:"-"` 701 } 702 703 func (s *ListEntitlementsResponse) MarshalJSON() ([]byte, error) { 704 type NoMethod ListEntitlementsResponse 705 raw := NoMethod(*s) 706 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 707 } 708 709 // RejectAccountRequest: Request message for 710 // PartnerProcurementService.RejectAccount. 711 type RejectAccountRequest struct { 712 // ApprovalName: The name of the approval being rejected. If absent and 713 // there is only one approval possible, that approval will be rejected. 714 // If absent and there are many approvals possible, the request will 715 // fail with a 400 Bad Request. Optional. 716 ApprovalName string `json:"approvalName,omitempty"` 717 718 // Reason: Free form text string explaining the rejection reason. Max 719 // allowed length: 256 bytes. Longer strings will be truncated. 720 Reason string `json:"reason,omitempty"` 721 722 // ForceSendFields is a list of field names (e.g. "ApprovalName") to 723 // unconditionally include in API requests. By default, fields with 724 // empty or default values are omitted from API requests. However, any 725 // non-pointer, non-interface field appearing in ForceSendFields will be 726 // sent to the server regardless of whether the field is empty or not. 727 // This may be used to include empty fields in Patch requests. 728 ForceSendFields []string `json:"-"` 729 730 // NullFields is a list of field names (e.g. "ApprovalName") to include 731 // in API requests with the JSON null value. By default, fields with 732 // empty values are omitted from API requests. However, any field with 733 // an empty value appearing in NullFields will be sent to the server as 734 // null. It is an error if a field in this list has a non-empty value. 735 // This may be used to include null fields in Patch requests. 736 NullFields []string `json:"-"` 737 } 738 739 func (s *RejectAccountRequest) MarshalJSON() ([]byte, error) { 740 type NoMethod RejectAccountRequest 741 raw := NoMethod(*s) 742 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 743 } 744 745 // RejectEntitlementPlanChangeRequest: Request message for 746 // PartnerProcurementService.RejectEntitlementPlanChange. 747 type RejectEntitlementPlanChangeRequest struct { 748 // PendingPlanName: Name of the pending plan that is being rejected. 749 // Required. 750 PendingPlanName string `json:"pendingPlanName,omitempty"` 751 752 // Reason: Free form text string explaining the rejection reason. Max 753 // allowed length: 256 bytes. Longer strings will be truncated. 754 Reason string `json:"reason,omitempty"` 755 756 // ForceSendFields is a list of field names (e.g. "PendingPlanName") to 757 // unconditionally include in API requests. By default, fields with 758 // empty or default values are omitted from API requests. However, any 759 // non-pointer, non-interface field appearing in ForceSendFields will be 760 // sent to the server regardless of whether the field is empty or not. 761 // This may be used to include empty fields in Patch requests. 762 ForceSendFields []string `json:"-"` 763 764 // NullFields is a list of field names (e.g. "PendingPlanName") to 765 // include in API requests with the JSON null value. By default, fields 766 // with empty values are omitted from API requests. However, any field 767 // with an empty value appearing in NullFields will be sent to the 768 // server as null. It is an error if a field in this list has a 769 // non-empty value. This may be used to include null fields in Patch 770 // requests. 771 NullFields []string `json:"-"` 772 } 773 774 func (s *RejectEntitlementPlanChangeRequest) MarshalJSON() ([]byte, error) { 775 type NoMethod RejectEntitlementPlanChangeRequest 776 raw := NoMethod(*s) 777 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 778 } 779 780 // RejectEntitlementRequest: Request message for 781 // PartnerProcurementService.RejectEntitlement. 782 type RejectEntitlementRequest struct { 783 // Reason: Free form text string explaining the rejection reason. Max 784 // allowed length: 256 bytes. Longer strings will be truncated. 785 Reason string `json:"reason,omitempty"` 786 787 // ForceSendFields is a list of field names (e.g. "Reason") to 788 // unconditionally include in API requests. By default, fields with 789 // empty or default values are omitted from API requests. However, any 790 // non-pointer, non-interface field appearing in ForceSendFields will be 791 // sent to the server regardless of whether the field is empty or not. 792 // This may be used to include empty fields in Patch requests. 793 ForceSendFields []string `json:"-"` 794 795 // NullFields is a list of field names (e.g. "Reason") to include in API 796 // requests with the JSON null value. By default, fields with empty 797 // values are omitted from API requests. However, any field with an 798 // empty value appearing in NullFields will be sent to the server as 799 // null. It is an error if a field in this list has a non-empty value. 800 // This may be used to include null fields in Patch requests. 801 NullFields []string `json:"-"` 802 } 803 804 func (s *RejectEntitlementRequest) MarshalJSON() ([]byte, error) { 805 type NoMethod RejectEntitlementRequest 806 raw := NoMethod(*s) 807 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 808 } 809 810 // ResetAccountRequest: Request message for for 811 // PartnerProcurementService.ResetAccount. 812 type ResetAccountRequest struct { 813 } 814 815 // SuspendEntitlementRequest: Request message for 816 // ParterProcurementService.SuspendEntitlement. This is not yet 817 // supported. 818 type SuspendEntitlementRequest struct { 819 // Reason: A free-form reason string, explaining the reason for 820 // suspension request. 821 Reason string `json:"reason,omitempty"` 822 823 // ForceSendFields is a list of field names (e.g. "Reason") to 824 // unconditionally include in API requests. By default, fields with 825 // empty or default values are omitted from API requests. However, any 826 // non-pointer, non-interface field appearing in ForceSendFields will be 827 // sent to the server regardless of whether the field is empty or not. 828 // This may be used to include empty fields in Patch requests. 829 ForceSendFields []string `json:"-"` 830 831 // NullFields is a list of field names (e.g. "Reason") to include in API 832 // requests with the JSON null value. By default, fields with empty 833 // values are omitted from API requests. However, any field with an 834 // empty value appearing in NullFields will be sent to the server as 835 // null. It is an error if a field in this list has a non-empty value. 836 // This may be used to include null fields in Patch requests. 837 NullFields []string `json:"-"` 838 } 839 840 func (s *SuspendEntitlementRequest) MarshalJSON() ([]byte, error) { 841 type NoMethod SuspendEntitlementRequest 842 raw := NoMethod(*s) 843 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 844 } 845 846 // method id "cloudcommerceprocurement.providers.accounts.approve": 847 848 type ProvidersAccountsApproveCall struct { 849 s *Service 850 name string 851 approveaccountrequest *ApproveAccountRequest 852 urlParams_ gensupport.URLParams 853 ctx_ context.Context 854 header_ http.Header 855 } 856 857 // Approve: Grants an approval on an Account. 858 // 859 // - name: The resource name of the account. 860 func (r *ProvidersAccountsService) Approve(name string, approveaccountrequest *ApproveAccountRequest) *ProvidersAccountsApproveCall { 861 c := &ProvidersAccountsApproveCall{s: r.s, urlParams_: make(gensupport.URLParams)} 862 c.name = name 863 c.approveaccountrequest = approveaccountrequest 864 return c 865 } 866 867 // Fields allows partial responses to be retrieved. See 868 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 869 // for more information. 870 func (c *ProvidersAccountsApproveCall) Fields(s ...googleapi.Field) *ProvidersAccountsApproveCall { 871 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 872 return c 873 } 874 875 // Context sets the context to be used in this call's Do method. Any 876 // pending HTTP request will be aborted if the provided context is 877 // canceled. 878 func (c *ProvidersAccountsApproveCall) Context(ctx context.Context) *ProvidersAccountsApproveCall { 879 c.ctx_ = ctx 880 return c 881 } 882 883 // Header returns an http.Header that can be modified by the caller to 884 // add HTTP headers to the request. 885 func (c *ProvidersAccountsApproveCall) Header() http.Header { 886 if c.header_ == nil { 887 c.header_ = make(http.Header) 888 } 889 return c.header_ 890 } 891 892 func (c *ProvidersAccountsApproveCall) doRequest(alt string) (*http.Response, error) { 893 reqHeaders := make(http.Header) 894 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/"+internal.Version) 895 for k, v := range c.header_ { 896 reqHeaders[k] = v 897 } 898 reqHeaders.Set("User-Agent", c.s.userAgent()) 899 var body io.Reader = nil 900 body, err := googleapi.WithoutDataWrapper.JSONReader(c.approveaccountrequest) 901 if err != nil { 902 return nil, err 903 } 904 reqHeaders.Set("Content-Type", "application/json") 905 c.urlParams_.Set("alt", alt) 906 c.urlParams_.Set("prettyPrint", "false") 907 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}:approve") 908 urls += "?" + c.urlParams_.Encode() 909 req, err := http.NewRequest("POST", urls, body) 910 if err != nil { 911 return nil, err 912 } 913 req.Header = reqHeaders 914 googleapi.Expand(req.URL, map[string]string{ 915 "name": c.name, 916 }) 917 return gensupport.SendRequest(c.ctx_, c.s.client, req) 918 } 919 920 // Do executes the "cloudcommerceprocurement.providers.accounts.approve" call. 921 // Exactly one of *Empty or error will be non-nil. Any non-2xx status 922 // code is an error. Response headers are in either 923 // *Empty.ServerResponse.Header or (if a response was returned at all) 924 // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 925 // check whether the returned error was because http.StatusNotModified 926 // was returned. 927 func (c *ProvidersAccountsApproveCall) Do(opts ...googleapi.CallOption) (*Empty, error) { 928 gensupport.SetOptions(c.urlParams_, opts...) 929 res, err := c.doRequest("json") 930 if res != nil && res.StatusCode == http.StatusNotModified { 931 if res.Body != nil { 932 res.Body.Close() 933 } 934 return nil, &googleapi.Error{ 935 Code: res.StatusCode, 936 Header: res.Header, 937 } 938 } 939 if err != nil { 940 return nil, err 941 } 942 defer googleapi.CloseBody(res) 943 if err := googleapi.CheckResponse(res); err != nil { 944 return nil, err 945 } 946 ret := &Empty{ 947 ServerResponse: googleapi.ServerResponse{ 948 Header: res.Header, 949 HTTPStatusCode: res.StatusCode, 950 }, 951 } 952 target := &ret 953 if err := gensupport.DecodeResponse(target, res); err != nil { 954 return nil, err 955 } 956 return ret, nil 957 // { 958 // "description": "Grants an approval on an Account.", 959 // "flatPath": "v1/providers/{providersId}/accounts/{accountsId}:approve", 960 // "httpMethod": "POST", 961 // "id": "cloudcommerceprocurement.providers.accounts.approve", 962 // "parameterOrder": [ 963 // "name" 964 // ], 965 // "parameters": { 966 // "name": { 967 // "description": "The resource name of the account. Required.", 968 // "location": "path", 969 // "pattern": "^providers/[^/]+/accounts/[^/]+$", 970 // "required": true, 971 // "type": "string" 972 // } 973 // }, 974 // "path": "v1/{+name}:approve", 975 // "request": { 976 // "$ref": "ApproveAccountRequest" 977 // }, 978 // "response": { 979 // "$ref": "Empty" 980 // }, 981 // "scopes": [ 982 // "https://www.googleapis.com/auth/cloud-platform" 983 // ] 984 // } 985 986 } 987 988 // method id "cloudcommerceprocurement.providers.accounts.get": 989 990 type ProvidersAccountsGetCall struct { 991 s *Service 992 name string 993 urlParams_ gensupport.URLParams 994 ifNoneMatch_ string 995 ctx_ context.Context 996 header_ http.Header 997 } 998 999 // Get: Gets a requested Account resource. 1000 // 1001 // - name: The name of the account to retrieve. 1002 func (r *ProvidersAccountsService) Get(name string) *ProvidersAccountsGetCall { 1003 c := &ProvidersAccountsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1004 c.name = name 1005 return c 1006 } 1007 1008 // Fields allows partial responses to be retrieved. See 1009 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 1010 // for more information. 1011 func (c *ProvidersAccountsGetCall) Fields(s ...googleapi.Field) *ProvidersAccountsGetCall { 1012 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1013 return c 1014 } 1015 1016 // IfNoneMatch sets the optional parameter which makes the operation 1017 // fail if the object's ETag matches the given value. This is useful for 1018 // getting updates only after the object has changed since the last 1019 // request. Use googleapi.IsNotModified to check whether the response 1020 // error from Do is the result of In-None-Match. 1021 func (c *ProvidersAccountsGetCall) IfNoneMatch(entityTag string) *ProvidersAccountsGetCall { 1022 c.ifNoneMatch_ = entityTag 1023 return c 1024 } 1025 1026 // Context sets the context to be used in this call's Do method. Any 1027 // pending HTTP request will be aborted if the provided context is 1028 // canceled. 1029 func (c *ProvidersAccountsGetCall) Context(ctx context.Context) *ProvidersAccountsGetCall { 1030 c.ctx_ = ctx 1031 return c 1032 } 1033 1034 // Header returns an http.Header that can be modified by the caller to 1035 // add HTTP headers to the request. 1036 func (c *ProvidersAccountsGetCall) Header() http.Header { 1037 if c.header_ == nil { 1038 c.header_ = make(http.Header) 1039 } 1040 return c.header_ 1041 } 1042 1043 func (c *ProvidersAccountsGetCall) doRequest(alt string) (*http.Response, error) { 1044 reqHeaders := make(http.Header) 1045 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/"+internal.Version) 1046 for k, v := range c.header_ { 1047 reqHeaders[k] = v 1048 } 1049 reqHeaders.Set("User-Agent", c.s.userAgent()) 1050 if c.ifNoneMatch_ != "" { 1051 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 1052 } 1053 var body io.Reader = nil 1054 c.urlParams_.Set("alt", alt) 1055 c.urlParams_.Set("prettyPrint", "false") 1056 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}") 1057 urls += "?" + c.urlParams_.Encode() 1058 req, err := http.NewRequest("GET", urls, body) 1059 if err != nil { 1060 return nil, err 1061 } 1062 req.Header = reqHeaders 1063 googleapi.Expand(req.URL, map[string]string{ 1064 "name": c.name, 1065 }) 1066 return gensupport.SendRequest(c.ctx_, c.s.client, req) 1067 } 1068 1069 // Do executes the "cloudcommerceprocurement.providers.accounts.get" call. 1070 // Exactly one of *Account or error will be non-nil. Any non-2xx status 1071 // code is an error. Response headers are in either 1072 // *Account.ServerResponse.Header or (if a response was returned at all) 1073 // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 1074 // check whether the returned error was because http.StatusNotModified 1075 // was returned. 1076 func (c *ProvidersAccountsGetCall) Do(opts ...googleapi.CallOption) (*Account, error) { 1077 gensupport.SetOptions(c.urlParams_, opts...) 1078 res, err := c.doRequest("json") 1079 if res != nil && res.StatusCode == http.StatusNotModified { 1080 if res.Body != nil { 1081 res.Body.Close() 1082 } 1083 return nil, &googleapi.Error{ 1084 Code: res.StatusCode, 1085 Header: res.Header, 1086 } 1087 } 1088 if err != nil { 1089 return nil, err 1090 } 1091 defer googleapi.CloseBody(res) 1092 if err := googleapi.CheckResponse(res); err != nil { 1093 return nil, err 1094 } 1095 ret := &Account{ 1096 ServerResponse: googleapi.ServerResponse{ 1097 Header: res.Header, 1098 HTTPStatusCode: res.StatusCode, 1099 }, 1100 } 1101 target := &ret 1102 if err := gensupport.DecodeResponse(target, res); err != nil { 1103 return nil, err 1104 } 1105 return ret, nil 1106 // { 1107 // "description": "Gets a requested Account resource.", 1108 // "flatPath": "v1/providers/{providersId}/accounts/{accountsId}", 1109 // "httpMethod": "GET", 1110 // "id": "cloudcommerceprocurement.providers.accounts.get", 1111 // "parameterOrder": [ 1112 // "name" 1113 // ], 1114 // "parameters": { 1115 // "name": { 1116 // "description": "The name of the account to retrieve.", 1117 // "location": "path", 1118 // "pattern": "^providers/[^/]+/accounts/[^/]+$", 1119 // "required": true, 1120 // "type": "string" 1121 // } 1122 // }, 1123 // "path": "v1/{+name}", 1124 // "response": { 1125 // "$ref": "Account" 1126 // }, 1127 // "scopes": [ 1128 // "https://www.googleapis.com/auth/cloud-platform" 1129 // ] 1130 // } 1131 1132 } 1133 1134 // method id "cloudcommerceprocurement.providers.accounts.list": 1135 1136 type ProvidersAccountsListCall struct { 1137 s *Service 1138 parent string 1139 urlParams_ gensupport.URLParams 1140 ifNoneMatch_ string 1141 ctx_ context.Context 1142 header_ http.Header 1143 } 1144 1145 // List: Lists Accounts that the provider has access to. 1146 // 1147 // - parent: The parent resource name. 1148 func (r *ProvidersAccountsService) List(parent string) *ProvidersAccountsListCall { 1149 c := &ProvidersAccountsListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1150 c.parent = parent 1151 return c 1152 } 1153 1154 // PageSize sets the optional parameter "pageSize": The maximum number 1155 // of entries that are requested The default page size is 25 and the 1156 // maximum page size is 200. 1157 func (c *ProvidersAccountsListCall) PageSize(pageSize int64) *ProvidersAccountsListCall { 1158 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize)) 1159 return c 1160 } 1161 1162 // PageToken sets the optional parameter "pageToken": The token for 1163 // fetching the next page. 1164 func (c *ProvidersAccountsListCall) PageToken(pageToken string) *ProvidersAccountsListCall { 1165 c.urlParams_.Set("pageToken", pageToken) 1166 return c 1167 } 1168 1169 // Fields allows partial responses to be retrieved. See 1170 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 1171 // for more information. 1172 func (c *ProvidersAccountsListCall) Fields(s ...googleapi.Field) *ProvidersAccountsListCall { 1173 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1174 return c 1175 } 1176 1177 // IfNoneMatch sets the optional parameter which makes the operation 1178 // fail if the object's ETag matches the given value. This is useful for 1179 // getting updates only after the object has changed since the last 1180 // request. Use googleapi.IsNotModified to check whether the response 1181 // error from Do is the result of In-None-Match. 1182 func (c *ProvidersAccountsListCall) IfNoneMatch(entityTag string) *ProvidersAccountsListCall { 1183 c.ifNoneMatch_ = entityTag 1184 return c 1185 } 1186 1187 // Context sets the context to be used in this call's Do method. Any 1188 // pending HTTP request will be aborted if the provided context is 1189 // canceled. 1190 func (c *ProvidersAccountsListCall) Context(ctx context.Context) *ProvidersAccountsListCall { 1191 c.ctx_ = ctx 1192 return c 1193 } 1194 1195 // Header returns an http.Header that can be modified by the caller to 1196 // add HTTP headers to the request. 1197 func (c *ProvidersAccountsListCall) Header() http.Header { 1198 if c.header_ == nil { 1199 c.header_ = make(http.Header) 1200 } 1201 return c.header_ 1202 } 1203 1204 func (c *ProvidersAccountsListCall) doRequest(alt string) (*http.Response, error) { 1205 reqHeaders := make(http.Header) 1206 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/"+internal.Version) 1207 for k, v := range c.header_ { 1208 reqHeaders[k] = v 1209 } 1210 reqHeaders.Set("User-Agent", c.s.userAgent()) 1211 if c.ifNoneMatch_ != "" { 1212 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 1213 } 1214 var body io.Reader = nil 1215 c.urlParams_.Set("alt", alt) 1216 c.urlParams_.Set("prettyPrint", "false") 1217 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}/accounts") 1218 urls += "?" + c.urlParams_.Encode() 1219 req, err := http.NewRequest("GET", urls, body) 1220 if err != nil { 1221 return nil, err 1222 } 1223 req.Header = reqHeaders 1224 googleapi.Expand(req.URL, map[string]string{ 1225 "parent": c.parent, 1226 }) 1227 return gensupport.SendRequest(c.ctx_, c.s.client, req) 1228 } 1229 1230 // Do executes the "cloudcommerceprocurement.providers.accounts.list" call. 1231 // Exactly one of *ListAccountsResponse or error will be non-nil. Any 1232 // non-2xx status code is an error. Response headers are in either 1233 // *ListAccountsResponse.ServerResponse.Header or (if a response was 1234 // returned at all) in error.(*googleapi.Error).Header. Use 1235 // googleapi.IsNotModified to check whether the returned error was 1236 // because http.StatusNotModified was returned. 1237 func (c *ProvidersAccountsListCall) Do(opts ...googleapi.CallOption) (*ListAccountsResponse, error) { 1238 gensupport.SetOptions(c.urlParams_, opts...) 1239 res, err := c.doRequest("json") 1240 if res != nil && res.StatusCode == http.StatusNotModified { 1241 if res.Body != nil { 1242 res.Body.Close() 1243 } 1244 return nil, &googleapi.Error{ 1245 Code: res.StatusCode, 1246 Header: res.Header, 1247 } 1248 } 1249 if err != nil { 1250 return nil, err 1251 } 1252 defer googleapi.CloseBody(res) 1253 if err := googleapi.CheckResponse(res); err != nil { 1254 return nil, err 1255 } 1256 ret := &ListAccountsResponse{ 1257 ServerResponse: googleapi.ServerResponse{ 1258 Header: res.Header, 1259 HTTPStatusCode: res.StatusCode, 1260 }, 1261 } 1262 target := &ret 1263 if err := gensupport.DecodeResponse(target, res); err != nil { 1264 return nil, err 1265 } 1266 return ret, nil 1267 // { 1268 // "description": "Lists Accounts that the provider has access to.", 1269 // "flatPath": "v1/providers/{providersId}/accounts", 1270 // "httpMethod": "GET", 1271 // "id": "cloudcommerceprocurement.providers.accounts.list", 1272 // "parameterOrder": [ 1273 // "parent" 1274 // ], 1275 // "parameters": { 1276 // "pageSize": { 1277 // "description": "The maximum number of entries that are requested The default page size is 25 and the maximum page size is 200.", 1278 // "format": "int32", 1279 // "location": "query", 1280 // "type": "integer" 1281 // }, 1282 // "pageToken": { 1283 // "description": "The token for fetching the next page.", 1284 // "location": "query", 1285 // "type": "string" 1286 // }, 1287 // "parent": { 1288 // "description": "The parent resource name.", 1289 // "location": "path", 1290 // "pattern": "^providers/[^/]+$", 1291 // "required": true, 1292 // "type": "string" 1293 // } 1294 // }, 1295 // "path": "v1/{+parent}/accounts", 1296 // "response": { 1297 // "$ref": "ListAccountsResponse" 1298 // }, 1299 // "scopes": [ 1300 // "https://www.googleapis.com/auth/cloud-platform" 1301 // ] 1302 // } 1303 1304 } 1305 1306 // Pages invokes f for each page of results. 1307 // A non-nil error returned from f will halt the iteration. 1308 // The provided context supersedes any context provided to the Context method. 1309 func (c *ProvidersAccountsListCall) Pages(ctx context.Context, f func(*ListAccountsResponse) error) error { 1310 c.ctx_ = ctx 1311 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 1312 for { 1313 x, err := c.Do() 1314 if err != nil { 1315 return err 1316 } 1317 if err := f(x); err != nil { 1318 return err 1319 } 1320 if x.NextPageToken == "" { 1321 return nil 1322 } 1323 c.PageToken(x.NextPageToken) 1324 } 1325 } 1326 1327 // method id "cloudcommerceprocurement.providers.accounts.reject": 1328 1329 type ProvidersAccountsRejectCall struct { 1330 s *Service 1331 name string 1332 rejectaccountrequest *RejectAccountRequest 1333 urlParams_ gensupport.URLParams 1334 ctx_ context.Context 1335 header_ http.Header 1336 } 1337 1338 // Reject: Rejects an approval on an Account. 1339 // 1340 // - name: The resource name of the account. 1341 func (r *ProvidersAccountsService) Reject(name string, rejectaccountrequest *RejectAccountRequest) *ProvidersAccountsRejectCall { 1342 c := &ProvidersAccountsRejectCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1343 c.name = name 1344 c.rejectaccountrequest = rejectaccountrequest 1345 return c 1346 } 1347 1348 // Fields allows partial responses to be retrieved. See 1349 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 1350 // for more information. 1351 func (c *ProvidersAccountsRejectCall) Fields(s ...googleapi.Field) *ProvidersAccountsRejectCall { 1352 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1353 return c 1354 } 1355 1356 // Context sets the context to be used in this call's Do method. Any 1357 // pending HTTP request will be aborted if the provided context is 1358 // canceled. 1359 func (c *ProvidersAccountsRejectCall) Context(ctx context.Context) *ProvidersAccountsRejectCall { 1360 c.ctx_ = ctx 1361 return c 1362 } 1363 1364 // Header returns an http.Header that can be modified by the caller to 1365 // add HTTP headers to the request. 1366 func (c *ProvidersAccountsRejectCall) Header() http.Header { 1367 if c.header_ == nil { 1368 c.header_ = make(http.Header) 1369 } 1370 return c.header_ 1371 } 1372 1373 func (c *ProvidersAccountsRejectCall) doRequest(alt string) (*http.Response, error) { 1374 reqHeaders := make(http.Header) 1375 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/"+internal.Version) 1376 for k, v := range c.header_ { 1377 reqHeaders[k] = v 1378 } 1379 reqHeaders.Set("User-Agent", c.s.userAgent()) 1380 var body io.Reader = nil 1381 body, err := googleapi.WithoutDataWrapper.JSONReader(c.rejectaccountrequest) 1382 if err != nil { 1383 return nil, err 1384 } 1385 reqHeaders.Set("Content-Type", "application/json") 1386 c.urlParams_.Set("alt", alt) 1387 c.urlParams_.Set("prettyPrint", "false") 1388 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}:reject") 1389 urls += "?" + c.urlParams_.Encode() 1390 req, err := http.NewRequest("POST", urls, body) 1391 if err != nil { 1392 return nil, err 1393 } 1394 req.Header = reqHeaders 1395 googleapi.Expand(req.URL, map[string]string{ 1396 "name": c.name, 1397 }) 1398 return gensupport.SendRequest(c.ctx_, c.s.client, req) 1399 } 1400 1401 // Do executes the "cloudcommerceprocurement.providers.accounts.reject" call. 1402 // Exactly one of *Empty or error will be non-nil. Any non-2xx status 1403 // code is an error. Response headers are in either 1404 // *Empty.ServerResponse.Header or (if a response was returned at all) 1405 // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 1406 // check whether the returned error was because http.StatusNotModified 1407 // was returned. 1408 func (c *ProvidersAccountsRejectCall) Do(opts ...googleapi.CallOption) (*Empty, error) { 1409 gensupport.SetOptions(c.urlParams_, opts...) 1410 res, err := c.doRequest("json") 1411 if res != nil && res.StatusCode == http.StatusNotModified { 1412 if res.Body != nil { 1413 res.Body.Close() 1414 } 1415 return nil, &googleapi.Error{ 1416 Code: res.StatusCode, 1417 Header: res.Header, 1418 } 1419 } 1420 if err != nil { 1421 return nil, err 1422 } 1423 defer googleapi.CloseBody(res) 1424 if err := googleapi.CheckResponse(res); err != nil { 1425 return nil, err 1426 } 1427 ret := &Empty{ 1428 ServerResponse: googleapi.ServerResponse{ 1429 Header: res.Header, 1430 HTTPStatusCode: res.StatusCode, 1431 }, 1432 } 1433 target := &ret 1434 if err := gensupport.DecodeResponse(target, res); err != nil { 1435 return nil, err 1436 } 1437 return ret, nil 1438 // { 1439 // "description": "Rejects an approval on an Account.", 1440 // "flatPath": "v1/providers/{providersId}/accounts/{accountsId}:reject", 1441 // "httpMethod": "POST", 1442 // "id": "cloudcommerceprocurement.providers.accounts.reject", 1443 // "parameterOrder": [ 1444 // "name" 1445 // ], 1446 // "parameters": { 1447 // "name": { 1448 // "description": "The resource name of the account. Required.", 1449 // "location": "path", 1450 // "pattern": "^providers/[^/]+/accounts/[^/]+$", 1451 // "required": true, 1452 // "type": "string" 1453 // } 1454 // }, 1455 // "path": "v1/{+name}:reject", 1456 // "request": { 1457 // "$ref": "RejectAccountRequest" 1458 // }, 1459 // "response": { 1460 // "$ref": "Empty" 1461 // }, 1462 // "scopes": [ 1463 // "https://www.googleapis.com/auth/cloud-platform" 1464 // ] 1465 // } 1466 1467 } 1468 1469 // method id "cloudcommerceprocurement.providers.accounts.reset": 1470 1471 type ProvidersAccountsResetCall struct { 1472 s *Service 1473 name string 1474 resetaccountrequest *ResetAccountRequest 1475 urlParams_ gensupport.URLParams 1476 ctx_ context.Context 1477 header_ http.Header 1478 } 1479 1480 // Reset: Resets an Account and cancel all associated Entitlements. 1481 // Partner can only reset accounts they own rather than customer 1482 // accounts. 1483 // 1484 // - name: The resource name of the account. 1485 func (r *ProvidersAccountsService) Reset(name string, resetaccountrequest *ResetAccountRequest) *ProvidersAccountsResetCall { 1486 c := &ProvidersAccountsResetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1487 c.name = name 1488 c.resetaccountrequest = resetaccountrequest 1489 return c 1490 } 1491 1492 // Fields allows partial responses to be retrieved. See 1493 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 1494 // for more information. 1495 func (c *ProvidersAccountsResetCall) Fields(s ...googleapi.Field) *ProvidersAccountsResetCall { 1496 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1497 return c 1498 } 1499 1500 // Context sets the context to be used in this call's Do method. Any 1501 // pending HTTP request will be aborted if the provided context is 1502 // canceled. 1503 func (c *ProvidersAccountsResetCall) Context(ctx context.Context) *ProvidersAccountsResetCall { 1504 c.ctx_ = ctx 1505 return c 1506 } 1507 1508 // Header returns an http.Header that can be modified by the caller to 1509 // add HTTP headers to the request. 1510 func (c *ProvidersAccountsResetCall) Header() http.Header { 1511 if c.header_ == nil { 1512 c.header_ = make(http.Header) 1513 } 1514 return c.header_ 1515 } 1516 1517 func (c *ProvidersAccountsResetCall) doRequest(alt string) (*http.Response, error) { 1518 reqHeaders := make(http.Header) 1519 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/"+internal.Version) 1520 for k, v := range c.header_ { 1521 reqHeaders[k] = v 1522 } 1523 reqHeaders.Set("User-Agent", c.s.userAgent()) 1524 var body io.Reader = nil 1525 body, err := googleapi.WithoutDataWrapper.JSONReader(c.resetaccountrequest) 1526 if err != nil { 1527 return nil, err 1528 } 1529 reqHeaders.Set("Content-Type", "application/json") 1530 c.urlParams_.Set("alt", alt) 1531 c.urlParams_.Set("prettyPrint", "false") 1532 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}:reset") 1533 urls += "?" + c.urlParams_.Encode() 1534 req, err := http.NewRequest("POST", urls, body) 1535 if err != nil { 1536 return nil, err 1537 } 1538 req.Header = reqHeaders 1539 googleapi.Expand(req.URL, map[string]string{ 1540 "name": c.name, 1541 }) 1542 return gensupport.SendRequest(c.ctx_, c.s.client, req) 1543 } 1544 1545 // Do executes the "cloudcommerceprocurement.providers.accounts.reset" call. 1546 // Exactly one of *Empty or error will be non-nil. Any non-2xx status 1547 // code is an error. Response headers are in either 1548 // *Empty.ServerResponse.Header or (if a response was returned at all) 1549 // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 1550 // check whether the returned error was because http.StatusNotModified 1551 // was returned. 1552 func (c *ProvidersAccountsResetCall) Do(opts ...googleapi.CallOption) (*Empty, error) { 1553 gensupport.SetOptions(c.urlParams_, opts...) 1554 res, err := c.doRequest("json") 1555 if res != nil && res.StatusCode == http.StatusNotModified { 1556 if res.Body != nil { 1557 res.Body.Close() 1558 } 1559 return nil, &googleapi.Error{ 1560 Code: res.StatusCode, 1561 Header: res.Header, 1562 } 1563 } 1564 if err != nil { 1565 return nil, err 1566 } 1567 defer googleapi.CloseBody(res) 1568 if err := googleapi.CheckResponse(res); err != nil { 1569 return nil, err 1570 } 1571 ret := &Empty{ 1572 ServerResponse: googleapi.ServerResponse{ 1573 Header: res.Header, 1574 HTTPStatusCode: res.StatusCode, 1575 }, 1576 } 1577 target := &ret 1578 if err := gensupport.DecodeResponse(target, res); err != nil { 1579 return nil, err 1580 } 1581 return ret, nil 1582 // { 1583 // "description": "Resets an Account and cancel all associated Entitlements. Partner can only reset accounts they own rather than customer accounts.", 1584 // "flatPath": "v1/providers/{providersId}/accounts/{accountsId}:reset", 1585 // "httpMethod": "POST", 1586 // "id": "cloudcommerceprocurement.providers.accounts.reset", 1587 // "parameterOrder": [ 1588 // "name" 1589 // ], 1590 // "parameters": { 1591 // "name": { 1592 // "description": "The resource name of the account. Required.", 1593 // "location": "path", 1594 // "pattern": "^providers/[^/]+/accounts/[^/]+$", 1595 // "required": true, 1596 // "type": "string" 1597 // } 1598 // }, 1599 // "path": "v1/{+name}:reset", 1600 // "request": { 1601 // "$ref": "ResetAccountRequest" 1602 // }, 1603 // "response": { 1604 // "$ref": "Empty" 1605 // }, 1606 // "scopes": [ 1607 // "https://www.googleapis.com/auth/cloud-platform" 1608 // ] 1609 // } 1610 1611 } 1612 1613 // method id "cloudcommerceprocurement.providers.entitlements.approve": 1614 1615 type ProvidersEntitlementsApproveCall struct { 1616 s *Service 1617 name string 1618 approveentitlementrequest *ApproveEntitlementRequest 1619 urlParams_ gensupport.URLParams 1620 ctx_ context.Context 1621 header_ http.Header 1622 } 1623 1624 // Approve: Approves an entitlement that is in the 1625 // EntitlementState.ENTITLEMENT_ACTIVATION_REQUESTED state. This method 1626 // is invoked by the provider to approve the creation of the entitlement 1627 // resource. 1628 // 1629 // - name: The resource name of the entitlement. 1630 func (r *ProvidersEntitlementsService) Approve(name string, approveentitlementrequest *ApproveEntitlementRequest) *ProvidersEntitlementsApproveCall { 1631 c := &ProvidersEntitlementsApproveCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1632 c.name = name 1633 c.approveentitlementrequest = approveentitlementrequest 1634 return c 1635 } 1636 1637 // Fields allows partial responses to be retrieved. See 1638 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 1639 // for more information. 1640 func (c *ProvidersEntitlementsApproveCall) Fields(s ...googleapi.Field) *ProvidersEntitlementsApproveCall { 1641 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1642 return c 1643 } 1644 1645 // Context sets the context to be used in this call's Do method. Any 1646 // pending HTTP request will be aborted if the provided context is 1647 // canceled. 1648 func (c *ProvidersEntitlementsApproveCall) Context(ctx context.Context) *ProvidersEntitlementsApproveCall { 1649 c.ctx_ = ctx 1650 return c 1651 } 1652 1653 // Header returns an http.Header that can be modified by the caller to 1654 // add HTTP headers to the request. 1655 func (c *ProvidersEntitlementsApproveCall) Header() http.Header { 1656 if c.header_ == nil { 1657 c.header_ = make(http.Header) 1658 } 1659 return c.header_ 1660 } 1661 1662 func (c *ProvidersEntitlementsApproveCall) doRequest(alt string) (*http.Response, error) { 1663 reqHeaders := make(http.Header) 1664 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/"+internal.Version) 1665 for k, v := range c.header_ { 1666 reqHeaders[k] = v 1667 } 1668 reqHeaders.Set("User-Agent", c.s.userAgent()) 1669 var body io.Reader = nil 1670 body, err := googleapi.WithoutDataWrapper.JSONReader(c.approveentitlementrequest) 1671 if err != nil { 1672 return nil, err 1673 } 1674 reqHeaders.Set("Content-Type", "application/json") 1675 c.urlParams_.Set("alt", alt) 1676 c.urlParams_.Set("prettyPrint", "false") 1677 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}:approve") 1678 urls += "?" + c.urlParams_.Encode() 1679 req, err := http.NewRequest("POST", urls, body) 1680 if err != nil { 1681 return nil, err 1682 } 1683 req.Header = reqHeaders 1684 googleapi.Expand(req.URL, map[string]string{ 1685 "name": c.name, 1686 }) 1687 return gensupport.SendRequest(c.ctx_, c.s.client, req) 1688 } 1689 1690 // Do executes the "cloudcommerceprocurement.providers.entitlements.approve" call. 1691 // Exactly one of *Empty or error will be non-nil. Any non-2xx status 1692 // code is an error. Response headers are in either 1693 // *Empty.ServerResponse.Header or (if a response was returned at all) 1694 // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 1695 // check whether the returned error was because http.StatusNotModified 1696 // was returned. 1697 func (c *ProvidersEntitlementsApproveCall) Do(opts ...googleapi.CallOption) (*Empty, error) { 1698 gensupport.SetOptions(c.urlParams_, opts...) 1699 res, err := c.doRequest("json") 1700 if res != nil && res.StatusCode == http.StatusNotModified { 1701 if res.Body != nil { 1702 res.Body.Close() 1703 } 1704 return nil, &googleapi.Error{ 1705 Code: res.StatusCode, 1706 Header: res.Header, 1707 } 1708 } 1709 if err != nil { 1710 return nil, err 1711 } 1712 defer googleapi.CloseBody(res) 1713 if err := googleapi.CheckResponse(res); err != nil { 1714 return nil, err 1715 } 1716 ret := &Empty{ 1717 ServerResponse: googleapi.ServerResponse{ 1718 Header: res.Header, 1719 HTTPStatusCode: res.StatusCode, 1720 }, 1721 } 1722 target := &ret 1723 if err := gensupport.DecodeResponse(target, res); err != nil { 1724 return nil, err 1725 } 1726 return ret, nil 1727 // { 1728 // "description": "Approves an entitlement that is in the EntitlementState.ENTITLEMENT_ACTIVATION_REQUESTED state. This method is invoked by the provider to approve the creation of the entitlement resource.", 1729 // "flatPath": "v1/providers/{providersId}/entitlements/{entitlementsId}:approve", 1730 // "httpMethod": "POST", 1731 // "id": "cloudcommerceprocurement.providers.entitlements.approve", 1732 // "parameterOrder": [ 1733 // "name" 1734 // ], 1735 // "parameters": { 1736 // "name": { 1737 // "description": "The resource name of the entitlement. Required.", 1738 // "location": "path", 1739 // "pattern": "^providers/[^/]+/entitlements/[^/]+$", 1740 // "required": true, 1741 // "type": "string" 1742 // } 1743 // }, 1744 // "path": "v1/{+name}:approve", 1745 // "request": { 1746 // "$ref": "ApproveEntitlementRequest" 1747 // }, 1748 // "response": { 1749 // "$ref": "Empty" 1750 // }, 1751 // "scopes": [ 1752 // "https://www.googleapis.com/auth/cloud-platform" 1753 // ] 1754 // } 1755 1756 } 1757 1758 // method id "cloudcommerceprocurement.providers.entitlements.approvePlanChange": 1759 1760 type ProvidersEntitlementsApprovePlanChangeCall struct { 1761 s *Service 1762 name string 1763 approveentitlementplanchangerequest *ApproveEntitlementPlanChangeRequest 1764 urlParams_ gensupport.URLParams 1765 ctx_ context.Context 1766 header_ http.Header 1767 } 1768 1769 // ApprovePlanChange: Approves an entitlement plan change that is in the 1770 // EntitlementState.ENTITLEMENT_PENDING_PLAN_CHANGE_APPROVAL state. This 1771 // method is invoked by the provider to approve the plan change on the 1772 // entitlement resource. 1773 // 1774 // - name: The resource name of the entitlement. 1775 func (r *ProvidersEntitlementsService) ApprovePlanChange(name string, approveentitlementplanchangerequest *ApproveEntitlementPlanChangeRequest) *ProvidersEntitlementsApprovePlanChangeCall { 1776 c := &ProvidersEntitlementsApprovePlanChangeCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1777 c.name = name 1778 c.approveentitlementplanchangerequest = approveentitlementplanchangerequest 1779 return c 1780 } 1781 1782 // Fields allows partial responses to be retrieved. See 1783 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 1784 // for more information. 1785 func (c *ProvidersEntitlementsApprovePlanChangeCall) Fields(s ...googleapi.Field) *ProvidersEntitlementsApprovePlanChangeCall { 1786 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1787 return c 1788 } 1789 1790 // Context sets the context to be used in this call's Do method. Any 1791 // pending HTTP request will be aborted if the provided context is 1792 // canceled. 1793 func (c *ProvidersEntitlementsApprovePlanChangeCall) Context(ctx context.Context) *ProvidersEntitlementsApprovePlanChangeCall { 1794 c.ctx_ = ctx 1795 return c 1796 } 1797 1798 // Header returns an http.Header that can be modified by the caller to 1799 // add HTTP headers to the request. 1800 func (c *ProvidersEntitlementsApprovePlanChangeCall) Header() http.Header { 1801 if c.header_ == nil { 1802 c.header_ = make(http.Header) 1803 } 1804 return c.header_ 1805 } 1806 1807 func (c *ProvidersEntitlementsApprovePlanChangeCall) doRequest(alt string) (*http.Response, error) { 1808 reqHeaders := make(http.Header) 1809 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/"+internal.Version) 1810 for k, v := range c.header_ { 1811 reqHeaders[k] = v 1812 } 1813 reqHeaders.Set("User-Agent", c.s.userAgent()) 1814 var body io.Reader = nil 1815 body, err := googleapi.WithoutDataWrapper.JSONReader(c.approveentitlementplanchangerequest) 1816 if err != nil { 1817 return nil, err 1818 } 1819 reqHeaders.Set("Content-Type", "application/json") 1820 c.urlParams_.Set("alt", alt) 1821 c.urlParams_.Set("prettyPrint", "false") 1822 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}:approvePlanChange") 1823 urls += "?" + c.urlParams_.Encode() 1824 req, err := http.NewRequest("POST", urls, body) 1825 if err != nil { 1826 return nil, err 1827 } 1828 req.Header = reqHeaders 1829 googleapi.Expand(req.URL, map[string]string{ 1830 "name": c.name, 1831 }) 1832 return gensupport.SendRequest(c.ctx_, c.s.client, req) 1833 } 1834 1835 // Do executes the "cloudcommerceprocurement.providers.entitlements.approvePlanChange" call. 1836 // Exactly one of *Empty or error will be non-nil. Any non-2xx status 1837 // code is an error. Response headers are in either 1838 // *Empty.ServerResponse.Header or (if a response was returned at all) 1839 // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 1840 // check whether the returned error was because http.StatusNotModified 1841 // was returned. 1842 func (c *ProvidersEntitlementsApprovePlanChangeCall) Do(opts ...googleapi.CallOption) (*Empty, error) { 1843 gensupport.SetOptions(c.urlParams_, opts...) 1844 res, err := c.doRequest("json") 1845 if res != nil && res.StatusCode == http.StatusNotModified { 1846 if res.Body != nil { 1847 res.Body.Close() 1848 } 1849 return nil, &googleapi.Error{ 1850 Code: res.StatusCode, 1851 Header: res.Header, 1852 } 1853 } 1854 if err != nil { 1855 return nil, err 1856 } 1857 defer googleapi.CloseBody(res) 1858 if err := googleapi.CheckResponse(res); err != nil { 1859 return nil, err 1860 } 1861 ret := &Empty{ 1862 ServerResponse: googleapi.ServerResponse{ 1863 Header: res.Header, 1864 HTTPStatusCode: res.StatusCode, 1865 }, 1866 } 1867 target := &ret 1868 if err := gensupport.DecodeResponse(target, res); err != nil { 1869 return nil, err 1870 } 1871 return ret, nil 1872 // { 1873 // "description": "Approves an entitlement plan change that is in the EntitlementState.ENTITLEMENT_PENDING_PLAN_CHANGE_APPROVAL state. This method is invoked by the provider to approve the plan change on the entitlement resource.", 1874 // "flatPath": "v1/providers/{providersId}/entitlements/{entitlementsId}:approvePlanChange", 1875 // "httpMethod": "POST", 1876 // "id": "cloudcommerceprocurement.providers.entitlements.approvePlanChange", 1877 // "parameterOrder": [ 1878 // "name" 1879 // ], 1880 // "parameters": { 1881 // "name": { 1882 // "description": "The resource name of the entitlement. Required.", 1883 // "location": "path", 1884 // "pattern": "^providers/[^/]+/entitlements/[^/]+$", 1885 // "required": true, 1886 // "type": "string" 1887 // } 1888 // }, 1889 // "path": "v1/{+name}:approvePlanChange", 1890 // "request": { 1891 // "$ref": "ApproveEntitlementPlanChangeRequest" 1892 // }, 1893 // "response": { 1894 // "$ref": "Empty" 1895 // }, 1896 // "scopes": [ 1897 // "https://www.googleapis.com/auth/cloud-platform" 1898 // ] 1899 // } 1900 1901 } 1902 1903 // method id "cloudcommerceprocurement.providers.entitlements.get": 1904 1905 type ProvidersEntitlementsGetCall struct { 1906 s *Service 1907 name string 1908 urlParams_ gensupport.URLParams 1909 ifNoneMatch_ string 1910 ctx_ context.Context 1911 header_ http.Header 1912 } 1913 1914 // Get: Gets a requested Entitlement resource. 1915 // 1916 // - name: The name of the entitlement to retrieve. 1917 func (r *ProvidersEntitlementsService) Get(name string) *ProvidersEntitlementsGetCall { 1918 c := &ProvidersEntitlementsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1919 c.name = name 1920 return c 1921 } 1922 1923 // Fields allows partial responses to be retrieved. See 1924 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 1925 // for more information. 1926 func (c *ProvidersEntitlementsGetCall) Fields(s ...googleapi.Field) *ProvidersEntitlementsGetCall { 1927 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1928 return c 1929 } 1930 1931 // IfNoneMatch sets the optional parameter which makes the operation 1932 // fail if the object's ETag matches the given value. This is useful for 1933 // getting updates only after the object has changed since the last 1934 // request. Use googleapi.IsNotModified to check whether the response 1935 // error from Do is the result of In-None-Match. 1936 func (c *ProvidersEntitlementsGetCall) IfNoneMatch(entityTag string) *ProvidersEntitlementsGetCall { 1937 c.ifNoneMatch_ = entityTag 1938 return c 1939 } 1940 1941 // Context sets the context to be used in this call's Do method. Any 1942 // pending HTTP request will be aborted if the provided context is 1943 // canceled. 1944 func (c *ProvidersEntitlementsGetCall) Context(ctx context.Context) *ProvidersEntitlementsGetCall { 1945 c.ctx_ = ctx 1946 return c 1947 } 1948 1949 // Header returns an http.Header that can be modified by the caller to 1950 // add HTTP headers to the request. 1951 func (c *ProvidersEntitlementsGetCall) Header() http.Header { 1952 if c.header_ == nil { 1953 c.header_ = make(http.Header) 1954 } 1955 return c.header_ 1956 } 1957 1958 func (c *ProvidersEntitlementsGetCall) doRequest(alt string) (*http.Response, error) { 1959 reqHeaders := make(http.Header) 1960 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/"+internal.Version) 1961 for k, v := range c.header_ { 1962 reqHeaders[k] = v 1963 } 1964 reqHeaders.Set("User-Agent", c.s.userAgent()) 1965 if c.ifNoneMatch_ != "" { 1966 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 1967 } 1968 var body io.Reader = nil 1969 c.urlParams_.Set("alt", alt) 1970 c.urlParams_.Set("prettyPrint", "false") 1971 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}") 1972 urls += "?" + c.urlParams_.Encode() 1973 req, err := http.NewRequest("GET", urls, body) 1974 if err != nil { 1975 return nil, err 1976 } 1977 req.Header = reqHeaders 1978 googleapi.Expand(req.URL, map[string]string{ 1979 "name": c.name, 1980 }) 1981 return gensupport.SendRequest(c.ctx_, c.s.client, req) 1982 } 1983 1984 // Do executes the "cloudcommerceprocurement.providers.entitlements.get" call. 1985 // Exactly one of *Entitlement or error will be non-nil. Any non-2xx 1986 // status code is an error. Response headers are in either 1987 // *Entitlement.ServerResponse.Header or (if a response was returned at 1988 // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 1989 // to check whether the returned error was because 1990 // http.StatusNotModified was returned. 1991 func (c *ProvidersEntitlementsGetCall) Do(opts ...googleapi.CallOption) (*Entitlement, error) { 1992 gensupport.SetOptions(c.urlParams_, opts...) 1993 res, err := c.doRequest("json") 1994 if res != nil && res.StatusCode == http.StatusNotModified { 1995 if res.Body != nil { 1996 res.Body.Close() 1997 } 1998 return nil, &googleapi.Error{ 1999 Code: res.StatusCode, 2000 Header: res.Header, 2001 } 2002 } 2003 if err != nil { 2004 return nil, err 2005 } 2006 defer googleapi.CloseBody(res) 2007 if err := googleapi.CheckResponse(res); err != nil { 2008 return nil, err 2009 } 2010 ret := &Entitlement{ 2011 ServerResponse: googleapi.ServerResponse{ 2012 Header: res.Header, 2013 HTTPStatusCode: res.StatusCode, 2014 }, 2015 } 2016 target := &ret 2017 if err := gensupport.DecodeResponse(target, res); err != nil { 2018 return nil, err 2019 } 2020 return ret, nil 2021 // { 2022 // "description": "Gets a requested Entitlement resource.", 2023 // "flatPath": "v1/providers/{providersId}/entitlements/{entitlementsId}", 2024 // "httpMethod": "GET", 2025 // "id": "cloudcommerceprocurement.providers.entitlements.get", 2026 // "parameterOrder": [ 2027 // "name" 2028 // ], 2029 // "parameters": { 2030 // "name": { 2031 // "description": "The name of the entitlement to retrieve.", 2032 // "location": "path", 2033 // "pattern": "^providers/[^/]+/entitlements/[^/]+$", 2034 // "required": true, 2035 // "type": "string" 2036 // } 2037 // }, 2038 // "path": "v1/{+name}", 2039 // "response": { 2040 // "$ref": "Entitlement" 2041 // }, 2042 // "scopes": [ 2043 // "https://www.googleapis.com/auth/cloud-platform" 2044 // ] 2045 // } 2046 2047 } 2048 2049 // method id "cloudcommerceprocurement.providers.entitlements.list": 2050 2051 type ProvidersEntitlementsListCall struct { 2052 s *Service 2053 parent string 2054 urlParams_ gensupport.URLParams 2055 ifNoneMatch_ string 2056 ctx_ context.Context 2057 header_ http.Header 2058 } 2059 2060 // List: Lists Entitlements for which the provider has read access. 2061 // 2062 // - parent: The parent resource name. 2063 func (r *ProvidersEntitlementsService) List(parent string) *ProvidersEntitlementsListCall { 2064 c := &ProvidersEntitlementsListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 2065 c.parent = parent 2066 return c 2067 } 2068 2069 // Filter sets the optional parameter "filter": The filter that can be 2070 // used to limit the list request. The filter is a query string that can 2071 // match a selected set of attributes with string values. For example 2072 // `account=E-1234-5678-ABCD-EFGH`, `state=pending_cancellation`, and 2073 // `plan!=foo-plan`. Supported query attributes are * `account` * 2074 // `customer_billing_account` with value in the format of: 2075 // `billingAccounts/{id}` * `product_external_name` * 2076 // `quote_external_name` * `offer` * `new_pending_offer` * `plan` * 2077 // `newPendingPlan` or `new_pending_plan` * `state` * 2078 // `consumers.project` Note that the consumers match works on repeated 2079 // structures, so equality (`consumers.project=projects/123456789`) is 2080 // not supported. Set membership can be expressed with the `:` operator. 2081 // For example, `consumers.project:projects/123456789` finds 2082 // entitlements with at least one consumer with project field equal to 2083 // `projects/123456789`. Also note that the state name match is 2084 // case-insensitive and query can omit the prefix "ENTITLEMENT_". For 2085 // example, `state=active` is equivalent to `state=ENTITLEMENT_ACTIVE`. 2086 // If the query contains some special characters other than letters, 2087 // underscore, or digits, the phrase must be quoted with double quotes. 2088 // For example, `product="providerId:productId", where the product name 2089 // needs to be quoted because it contains special character colon. 2090 // Queries can be combined with `AND`, `OR`, and `NOT` to form more 2091 // complex queries. They can also be grouped to force a desired 2092 // evaluation order. For example, `state=active AND (account=E-1234 OR 2093 // account=5678) AND NOT (product=foo-product)`. Connective `AND` can be 2094 // omitted between two predicates. For example `account=E-1234 2095 // state=active` is equivalent to `account=E-1234 AND state=active`. 2096 func (c *ProvidersEntitlementsListCall) Filter(filter string) *ProvidersEntitlementsListCall { 2097 c.urlParams_.Set("filter", filter) 2098 return c 2099 } 2100 2101 // PageSize sets the optional parameter "pageSize": The maximum number 2102 // of entries that are requested. The default page size is 200. 2103 func (c *ProvidersEntitlementsListCall) PageSize(pageSize int64) *ProvidersEntitlementsListCall { 2104 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize)) 2105 return c 2106 } 2107 2108 // PageToken sets the optional parameter "pageToken": The token for 2109 // fetching the next page. 2110 func (c *ProvidersEntitlementsListCall) PageToken(pageToken string) *ProvidersEntitlementsListCall { 2111 c.urlParams_.Set("pageToken", pageToken) 2112 return c 2113 } 2114 2115 // Fields allows partial responses to be retrieved. See 2116 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 2117 // for more information. 2118 func (c *ProvidersEntitlementsListCall) Fields(s ...googleapi.Field) *ProvidersEntitlementsListCall { 2119 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 2120 return c 2121 } 2122 2123 // IfNoneMatch sets the optional parameter which makes the operation 2124 // fail if the object's ETag matches the given value. This is useful for 2125 // getting updates only after the object has changed since the last 2126 // request. Use googleapi.IsNotModified to check whether the response 2127 // error from Do is the result of In-None-Match. 2128 func (c *ProvidersEntitlementsListCall) IfNoneMatch(entityTag string) *ProvidersEntitlementsListCall { 2129 c.ifNoneMatch_ = entityTag 2130 return c 2131 } 2132 2133 // Context sets the context to be used in this call's Do method. Any 2134 // pending HTTP request will be aborted if the provided context is 2135 // canceled. 2136 func (c *ProvidersEntitlementsListCall) Context(ctx context.Context) *ProvidersEntitlementsListCall { 2137 c.ctx_ = ctx 2138 return c 2139 } 2140 2141 // Header returns an http.Header that can be modified by the caller to 2142 // add HTTP headers to the request. 2143 func (c *ProvidersEntitlementsListCall) Header() http.Header { 2144 if c.header_ == nil { 2145 c.header_ = make(http.Header) 2146 } 2147 return c.header_ 2148 } 2149 2150 func (c *ProvidersEntitlementsListCall) doRequest(alt string) (*http.Response, error) { 2151 reqHeaders := make(http.Header) 2152 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/"+internal.Version) 2153 for k, v := range c.header_ { 2154 reqHeaders[k] = v 2155 } 2156 reqHeaders.Set("User-Agent", c.s.userAgent()) 2157 if c.ifNoneMatch_ != "" { 2158 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 2159 } 2160 var body io.Reader = nil 2161 c.urlParams_.Set("alt", alt) 2162 c.urlParams_.Set("prettyPrint", "false") 2163 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}/entitlements") 2164 urls += "?" + c.urlParams_.Encode() 2165 req, err := http.NewRequest("GET", urls, body) 2166 if err != nil { 2167 return nil, err 2168 } 2169 req.Header = reqHeaders 2170 googleapi.Expand(req.URL, map[string]string{ 2171 "parent": c.parent, 2172 }) 2173 return gensupport.SendRequest(c.ctx_, c.s.client, req) 2174 } 2175 2176 // Do executes the "cloudcommerceprocurement.providers.entitlements.list" call. 2177 // Exactly one of *ListEntitlementsResponse or error will be non-nil. 2178 // Any non-2xx status code is an error. Response headers are in either 2179 // *ListEntitlementsResponse.ServerResponse.Header or (if a response was 2180 // returned at all) in error.(*googleapi.Error).Header. Use 2181 // googleapi.IsNotModified to check whether the returned error was 2182 // because http.StatusNotModified was returned. 2183 func (c *ProvidersEntitlementsListCall) Do(opts ...googleapi.CallOption) (*ListEntitlementsResponse, error) { 2184 gensupport.SetOptions(c.urlParams_, opts...) 2185 res, err := c.doRequest("json") 2186 if res != nil && res.StatusCode == http.StatusNotModified { 2187 if res.Body != nil { 2188 res.Body.Close() 2189 } 2190 return nil, &googleapi.Error{ 2191 Code: res.StatusCode, 2192 Header: res.Header, 2193 } 2194 } 2195 if err != nil { 2196 return nil, err 2197 } 2198 defer googleapi.CloseBody(res) 2199 if err := googleapi.CheckResponse(res); err != nil { 2200 return nil, err 2201 } 2202 ret := &ListEntitlementsResponse{ 2203 ServerResponse: googleapi.ServerResponse{ 2204 Header: res.Header, 2205 HTTPStatusCode: res.StatusCode, 2206 }, 2207 } 2208 target := &ret 2209 if err := gensupport.DecodeResponse(target, res); err != nil { 2210 return nil, err 2211 } 2212 return ret, nil 2213 // { 2214 // "description": "Lists Entitlements for which the provider has read access.", 2215 // "flatPath": "v1/providers/{providersId}/entitlements", 2216 // "httpMethod": "GET", 2217 // "id": "cloudcommerceprocurement.providers.entitlements.list", 2218 // "parameterOrder": [ 2219 // "parent" 2220 // ], 2221 // "parameters": { 2222 // "filter": { 2223 // "description": "The filter that can be used to limit the list request. The filter is a query string that can match a selected set of attributes with string values. For example `account=E-1234-5678-ABCD-EFGH`, `state=pending_cancellation`, and `plan!=foo-plan`. Supported query attributes are * `account` * `customer_billing_account` with value in the format of: `billingAccounts/{id}` * `product_external_name` * `quote_external_name` * `offer` * `new_pending_offer` * `plan` * `newPendingPlan` or `new_pending_plan` * `state` * `consumers.project` Note that the consumers match works on repeated structures, so equality (`consumers.project=projects/123456789`) is not supported. Set membership can be expressed with the `:` operator. For example, `consumers.project:projects/123456789` finds entitlements with at least one consumer with project field equal to `projects/123456789`. Also note that the state name match is case-insensitive and query can omit the prefix \"ENTITLEMENT_\". For example, `state=active` is equivalent to `state=ENTITLEMENT_ACTIVE`. If the query contains some special characters other than letters, underscore, or digits, the phrase must be quoted with double quotes. For example, `product=\"providerId:productId\"`, where the product name needs to be quoted because it contains special character colon. Queries can be combined with `AND`, `OR`, and `NOT` to form more complex queries. They can also be grouped to force a desired evaluation order. For example, `state=active AND (account=E-1234 OR account=5678) AND NOT (product=foo-product)`. Connective `AND` can be omitted between two predicates. For example `account=E-1234 state=active` is equivalent to `account=E-1234 AND state=active`.", 2224 // "location": "query", 2225 // "type": "string" 2226 // }, 2227 // "pageSize": { 2228 // "description": "The maximum number of entries that are requested. The default page size is 200.", 2229 // "format": "int32", 2230 // "location": "query", 2231 // "type": "integer" 2232 // }, 2233 // "pageToken": { 2234 // "description": "The token for fetching the next page.", 2235 // "location": "query", 2236 // "type": "string" 2237 // }, 2238 // "parent": { 2239 // "description": "The parent resource name.", 2240 // "location": "path", 2241 // "pattern": "^providers/[^/]+$", 2242 // "required": true, 2243 // "type": "string" 2244 // } 2245 // }, 2246 // "path": "v1/{+parent}/entitlements", 2247 // "response": { 2248 // "$ref": "ListEntitlementsResponse" 2249 // }, 2250 // "scopes": [ 2251 // "https://www.googleapis.com/auth/cloud-platform" 2252 // ] 2253 // } 2254 2255 } 2256 2257 // Pages invokes f for each page of results. 2258 // A non-nil error returned from f will halt the iteration. 2259 // The provided context supersedes any context provided to the Context method. 2260 func (c *ProvidersEntitlementsListCall) Pages(ctx context.Context, f func(*ListEntitlementsResponse) error) error { 2261 c.ctx_ = ctx 2262 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 2263 for { 2264 x, err := c.Do() 2265 if err != nil { 2266 return err 2267 } 2268 if err := f(x); err != nil { 2269 return err 2270 } 2271 if x.NextPageToken == "" { 2272 return nil 2273 } 2274 c.PageToken(x.NextPageToken) 2275 } 2276 } 2277 2278 // method id "cloudcommerceprocurement.providers.entitlements.patch": 2279 2280 type ProvidersEntitlementsPatchCall struct { 2281 s *Service 2282 name string 2283 entitlement *Entitlement 2284 urlParams_ gensupport.URLParams 2285 ctx_ context.Context 2286 header_ http.Header 2287 } 2288 2289 // Patch: Updates an existing Entitlement. 2290 // 2291 // - name: The name of the entitlement to update. 2292 func (r *ProvidersEntitlementsService) Patch(name string, entitlement *Entitlement) *ProvidersEntitlementsPatchCall { 2293 c := &ProvidersEntitlementsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)} 2294 c.name = name 2295 c.entitlement = entitlement 2296 return c 2297 } 2298 2299 // UpdateMask sets the optional parameter "updateMask": The update mask 2300 // that applies to the resource. See the [FieldMask definition] 2301 // (https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask) 2302 // for more details. 2303 func (c *ProvidersEntitlementsPatchCall) UpdateMask(updateMask string) *ProvidersEntitlementsPatchCall { 2304 c.urlParams_.Set("updateMask", updateMask) 2305 return c 2306 } 2307 2308 // Fields allows partial responses to be retrieved. See 2309 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 2310 // for more information. 2311 func (c *ProvidersEntitlementsPatchCall) Fields(s ...googleapi.Field) *ProvidersEntitlementsPatchCall { 2312 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 2313 return c 2314 } 2315 2316 // Context sets the context to be used in this call's Do method. Any 2317 // pending HTTP request will be aborted if the provided context is 2318 // canceled. 2319 func (c *ProvidersEntitlementsPatchCall) Context(ctx context.Context) *ProvidersEntitlementsPatchCall { 2320 c.ctx_ = ctx 2321 return c 2322 } 2323 2324 // Header returns an http.Header that can be modified by the caller to 2325 // add HTTP headers to the request. 2326 func (c *ProvidersEntitlementsPatchCall) Header() http.Header { 2327 if c.header_ == nil { 2328 c.header_ = make(http.Header) 2329 } 2330 return c.header_ 2331 } 2332 2333 func (c *ProvidersEntitlementsPatchCall) doRequest(alt string) (*http.Response, error) { 2334 reqHeaders := make(http.Header) 2335 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/"+internal.Version) 2336 for k, v := range c.header_ { 2337 reqHeaders[k] = v 2338 } 2339 reqHeaders.Set("User-Agent", c.s.userAgent()) 2340 var body io.Reader = nil 2341 body, err := googleapi.WithoutDataWrapper.JSONReader(c.entitlement) 2342 if err != nil { 2343 return nil, err 2344 } 2345 reqHeaders.Set("Content-Type", "application/json") 2346 c.urlParams_.Set("alt", alt) 2347 c.urlParams_.Set("prettyPrint", "false") 2348 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}") 2349 urls += "?" + c.urlParams_.Encode() 2350 req, err := http.NewRequest("PATCH", urls, body) 2351 if err != nil { 2352 return nil, err 2353 } 2354 req.Header = reqHeaders 2355 googleapi.Expand(req.URL, map[string]string{ 2356 "name": c.name, 2357 }) 2358 return gensupport.SendRequest(c.ctx_, c.s.client, req) 2359 } 2360 2361 // Do executes the "cloudcommerceprocurement.providers.entitlements.patch" call. 2362 // Exactly one of *Entitlement or error will be non-nil. Any non-2xx 2363 // status code is an error. Response headers are in either 2364 // *Entitlement.ServerResponse.Header or (if a response was returned at 2365 // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 2366 // to check whether the returned error was because 2367 // http.StatusNotModified was returned. 2368 func (c *ProvidersEntitlementsPatchCall) Do(opts ...googleapi.CallOption) (*Entitlement, error) { 2369 gensupport.SetOptions(c.urlParams_, opts...) 2370 res, err := c.doRequest("json") 2371 if res != nil && res.StatusCode == http.StatusNotModified { 2372 if res.Body != nil { 2373 res.Body.Close() 2374 } 2375 return nil, &googleapi.Error{ 2376 Code: res.StatusCode, 2377 Header: res.Header, 2378 } 2379 } 2380 if err != nil { 2381 return nil, err 2382 } 2383 defer googleapi.CloseBody(res) 2384 if err := googleapi.CheckResponse(res); err != nil { 2385 return nil, err 2386 } 2387 ret := &Entitlement{ 2388 ServerResponse: googleapi.ServerResponse{ 2389 Header: res.Header, 2390 HTTPStatusCode: res.StatusCode, 2391 }, 2392 } 2393 target := &ret 2394 if err := gensupport.DecodeResponse(target, res); err != nil { 2395 return nil, err 2396 } 2397 return ret, nil 2398 // { 2399 // "description": "Updates an existing Entitlement.", 2400 // "flatPath": "v1/providers/{providersId}/entitlements/{entitlementsId}", 2401 // "httpMethod": "PATCH", 2402 // "id": "cloudcommerceprocurement.providers.entitlements.patch", 2403 // "parameterOrder": [ 2404 // "name" 2405 // ], 2406 // "parameters": { 2407 // "name": { 2408 // "description": "The name of the entitlement to update.", 2409 // "location": "path", 2410 // "pattern": "^providers/[^/]+/entitlements/[^/]+$", 2411 // "required": true, 2412 // "type": "string" 2413 // }, 2414 // "updateMask": { 2415 // "description": "The update mask that applies to the resource. See the [FieldMask definition] (https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask) for more details.", 2416 // "format": "google-fieldmask", 2417 // "location": "query", 2418 // "type": "string" 2419 // } 2420 // }, 2421 // "path": "v1/{+name}", 2422 // "request": { 2423 // "$ref": "Entitlement" 2424 // }, 2425 // "response": { 2426 // "$ref": "Entitlement" 2427 // }, 2428 // "scopes": [ 2429 // "https://www.googleapis.com/auth/cloud-platform" 2430 // ] 2431 // } 2432 2433 } 2434 2435 // method id "cloudcommerceprocurement.providers.entitlements.reject": 2436 2437 type ProvidersEntitlementsRejectCall struct { 2438 s *Service 2439 name string 2440 rejectentitlementrequest *RejectEntitlementRequest 2441 urlParams_ gensupport.URLParams 2442 ctx_ context.Context 2443 header_ http.Header 2444 } 2445 2446 // Reject: Rejects an entitlement that is in the 2447 // EntitlementState.ENTITLEMENT_ACTIVATION_REQUESTED state. This method 2448 // is invoked by the provider to reject the creation of the entitlement 2449 // resource. 2450 // 2451 // - name: The resource name of the entitlement. 2452 func (r *ProvidersEntitlementsService) Reject(name string, rejectentitlementrequest *RejectEntitlementRequest) *ProvidersEntitlementsRejectCall { 2453 c := &ProvidersEntitlementsRejectCall{s: r.s, urlParams_: make(gensupport.URLParams)} 2454 c.name = name 2455 c.rejectentitlementrequest = rejectentitlementrequest 2456 return c 2457 } 2458 2459 // Fields allows partial responses to be retrieved. See 2460 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 2461 // for more information. 2462 func (c *ProvidersEntitlementsRejectCall) Fields(s ...googleapi.Field) *ProvidersEntitlementsRejectCall { 2463 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 2464 return c 2465 } 2466 2467 // Context sets the context to be used in this call's Do method. Any 2468 // pending HTTP request will be aborted if the provided context is 2469 // canceled. 2470 func (c *ProvidersEntitlementsRejectCall) Context(ctx context.Context) *ProvidersEntitlementsRejectCall { 2471 c.ctx_ = ctx 2472 return c 2473 } 2474 2475 // Header returns an http.Header that can be modified by the caller to 2476 // add HTTP headers to the request. 2477 func (c *ProvidersEntitlementsRejectCall) Header() http.Header { 2478 if c.header_ == nil { 2479 c.header_ = make(http.Header) 2480 } 2481 return c.header_ 2482 } 2483 2484 func (c *ProvidersEntitlementsRejectCall) doRequest(alt string) (*http.Response, error) { 2485 reqHeaders := make(http.Header) 2486 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/"+internal.Version) 2487 for k, v := range c.header_ { 2488 reqHeaders[k] = v 2489 } 2490 reqHeaders.Set("User-Agent", c.s.userAgent()) 2491 var body io.Reader = nil 2492 body, err := googleapi.WithoutDataWrapper.JSONReader(c.rejectentitlementrequest) 2493 if err != nil { 2494 return nil, err 2495 } 2496 reqHeaders.Set("Content-Type", "application/json") 2497 c.urlParams_.Set("alt", alt) 2498 c.urlParams_.Set("prettyPrint", "false") 2499 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}:reject") 2500 urls += "?" + c.urlParams_.Encode() 2501 req, err := http.NewRequest("POST", urls, body) 2502 if err != nil { 2503 return nil, err 2504 } 2505 req.Header = reqHeaders 2506 googleapi.Expand(req.URL, map[string]string{ 2507 "name": c.name, 2508 }) 2509 return gensupport.SendRequest(c.ctx_, c.s.client, req) 2510 } 2511 2512 // Do executes the "cloudcommerceprocurement.providers.entitlements.reject" call. 2513 // Exactly one of *Empty or error will be non-nil. Any non-2xx status 2514 // code is an error. Response headers are in either 2515 // *Empty.ServerResponse.Header or (if a response was returned at all) 2516 // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 2517 // check whether the returned error was because http.StatusNotModified 2518 // was returned. 2519 func (c *ProvidersEntitlementsRejectCall) Do(opts ...googleapi.CallOption) (*Empty, error) { 2520 gensupport.SetOptions(c.urlParams_, opts...) 2521 res, err := c.doRequest("json") 2522 if res != nil && res.StatusCode == http.StatusNotModified { 2523 if res.Body != nil { 2524 res.Body.Close() 2525 } 2526 return nil, &googleapi.Error{ 2527 Code: res.StatusCode, 2528 Header: res.Header, 2529 } 2530 } 2531 if err != nil { 2532 return nil, err 2533 } 2534 defer googleapi.CloseBody(res) 2535 if err := googleapi.CheckResponse(res); err != nil { 2536 return nil, err 2537 } 2538 ret := &Empty{ 2539 ServerResponse: googleapi.ServerResponse{ 2540 Header: res.Header, 2541 HTTPStatusCode: res.StatusCode, 2542 }, 2543 } 2544 target := &ret 2545 if err := gensupport.DecodeResponse(target, res); err != nil { 2546 return nil, err 2547 } 2548 return ret, nil 2549 // { 2550 // "description": "Rejects an entitlement that is in the EntitlementState.ENTITLEMENT_ACTIVATION_REQUESTED state. This method is invoked by the provider to reject the creation of the entitlement resource.", 2551 // "flatPath": "v1/providers/{providersId}/entitlements/{entitlementsId}:reject", 2552 // "httpMethod": "POST", 2553 // "id": "cloudcommerceprocurement.providers.entitlements.reject", 2554 // "parameterOrder": [ 2555 // "name" 2556 // ], 2557 // "parameters": { 2558 // "name": { 2559 // "description": "The resource name of the entitlement. Required.", 2560 // "location": "path", 2561 // "pattern": "^providers/[^/]+/entitlements/[^/]+$", 2562 // "required": true, 2563 // "type": "string" 2564 // } 2565 // }, 2566 // "path": "v1/{+name}:reject", 2567 // "request": { 2568 // "$ref": "RejectEntitlementRequest" 2569 // }, 2570 // "response": { 2571 // "$ref": "Empty" 2572 // }, 2573 // "scopes": [ 2574 // "https://www.googleapis.com/auth/cloud-platform" 2575 // ] 2576 // } 2577 2578 } 2579 2580 // method id "cloudcommerceprocurement.providers.entitlements.rejectPlanChange": 2581 2582 type ProvidersEntitlementsRejectPlanChangeCall struct { 2583 s *Service 2584 name string 2585 rejectentitlementplanchangerequest *RejectEntitlementPlanChangeRequest 2586 urlParams_ gensupport.URLParams 2587 ctx_ context.Context 2588 header_ http.Header 2589 } 2590 2591 // RejectPlanChange: Rejects an entitlement plan change that is in the 2592 // EntitlementState.ENTITLEMENT_PENDING_PLAN_CHANGE_APPROVAL state. This 2593 // method is invoked by the provider to reject the plan change on the 2594 // entitlement resource. 2595 // 2596 // - name: The resource name of the entitlement. 2597 func (r *ProvidersEntitlementsService) RejectPlanChange(name string, rejectentitlementplanchangerequest *RejectEntitlementPlanChangeRequest) *ProvidersEntitlementsRejectPlanChangeCall { 2598 c := &ProvidersEntitlementsRejectPlanChangeCall{s: r.s, urlParams_: make(gensupport.URLParams)} 2599 c.name = name 2600 c.rejectentitlementplanchangerequest = rejectentitlementplanchangerequest 2601 return c 2602 } 2603 2604 // Fields allows partial responses to be retrieved. See 2605 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 2606 // for more information. 2607 func (c *ProvidersEntitlementsRejectPlanChangeCall) Fields(s ...googleapi.Field) *ProvidersEntitlementsRejectPlanChangeCall { 2608 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 2609 return c 2610 } 2611 2612 // Context sets the context to be used in this call's Do method. Any 2613 // pending HTTP request will be aborted if the provided context is 2614 // canceled. 2615 func (c *ProvidersEntitlementsRejectPlanChangeCall) Context(ctx context.Context) *ProvidersEntitlementsRejectPlanChangeCall { 2616 c.ctx_ = ctx 2617 return c 2618 } 2619 2620 // Header returns an http.Header that can be modified by the caller to 2621 // add HTTP headers to the request. 2622 func (c *ProvidersEntitlementsRejectPlanChangeCall) Header() http.Header { 2623 if c.header_ == nil { 2624 c.header_ = make(http.Header) 2625 } 2626 return c.header_ 2627 } 2628 2629 func (c *ProvidersEntitlementsRejectPlanChangeCall) doRequest(alt string) (*http.Response, error) { 2630 reqHeaders := make(http.Header) 2631 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/"+internal.Version) 2632 for k, v := range c.header_ { 2633 reqHeaders[k] = v 2634 } 2635 reqHeaders.Set("User-Agent", c.s.userAgent()) 2636 var body io.Reader = nil 2637 body, err := googleapi.WithoutDataWrapper.JSONReader(c.rejectentitlementplanchangerequest) 2638 if err != nil { 2639 return nil, err 2640 } 2641 reqHeaders.Set("Content-Type", "application/json") 2642 c.urlParams_.Set("alt", alt) 2643 c.urlParams_.Set("prettyPrint", "false") 2644 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}:rejectPlanChange") 2645 urls += "?" + c.urlParams_.Encode() 2646 req, err := http.NewRequest("POST", urls, body) 2647 if err != nil { 2648 return nil, err 2649 } 2650 req.Header = reqHeaders 2651 googleapi.Expand(req.URL, map[string]string{ 2652 "name": c.name, 2653 }) 2654 return gensupport.SendRequest(c.ctx_, c.s.client, req) 2655 } 2656 2657 // Do executes the "cloudcommerceprocurement.providers.entitlements.rejectPlanChange" call. 2658 // Exactly one of *Empty or error will be non-nil. Any non-2xx status 2659 // code is an error. Response headers are in either 2660 // *Empty.ServerResponse.Header or (if a response was returned at all) 2661 // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 2662 // check whether the returned error was because http.StatusNotModified 2663 // was returned. 2664 func (c *ProvidersEntitlementsRejectPlanChangeCall) Do(opts ...googleapi.CallOption) (*Empty, error) { 2665 gensupport.SetOptions(c.urlParams_, opts...) 2666 res, err := c.doRequest("json") 2667 if res != nil && res.StatusCode == http.StatusNotModified { 2668 if res.Body != nil { 2669 res.Body.Close() 2670 } 2671 return nil, &googleapi.Error{ 2672 Code: res.StatusCode, 2673 Header: res.Header, 2674 } 2675 } 2676 if err != nil { 2677 return nil, err 2678 } 2679 defer googleapi.CloseBody(res) 2680 if err := googleapi.CheckResponse(res); err != nil { 2681 return nil, err 2682 } 2683 ret := &Empty{ 2684 ServerResponse: googleapi.ServerResponse{ 2685 Header: res.Header, 2686 HTTPStatusCode: res.StatusCode, 2687 }, 2688 } 2689 target := &ret 2690 if err := gensupport.DecodeResponse(target, res); err != nil { 2691 return nil, err 2692 } 2693 return ret, nil 2694 // { 2695 // "description": "Rejects an entitlement plan change that is in the EntitlementState.ENTITLEMENT_PENDING_PLAN_CHANGE_APPROVAL state. This method is invoked by the provider to reject the plan change on the entitlement resource.", 2696 // "flatPath": "v1/providers/{providersId}/entitlements/{entitlementsId}:rejectPlanChange", 2697 // "httpMethod": "POST", 2698 // "id": "cloudcommerceprocurement.providers.entitlements.rejectPlanChange", 2699 // "parameterOrder": [ 2700 // "name" 2701 // ], 2702 // "parameters": { 2703 // "name": { 2704 // "description": "The resource name of the entitlement. Required.", 2705 // "location": "path", 2706 // "pattern": "^providers/[^/]+/entitlements/[^/]+$", 2707 // "required": true, 2708 // "type": "string" 2709 // } 2710 // }, 2711 // "path": "v1/{+name}:rejectPlanChange", 2712 // "request": { 2713 // "$ref": "RejectEntitlementPlanChangeRequest" 2714 // }, 2715 // "response": { 2716 // "$ref": "Empty" 2717 // }, 2718 // "scopes": [ 2719 // "https://www.googleapis.com/auth/cloud-platform" 2720 // ] 2721 // } 2722 2723 } 2724 2725 // method id "cloudcommerceprocurement.providers.entitlements.suspend": 2726 2727 type ProvidersEntitlementsSuspendCall struct { 2728 s *Service 2729 name string 2730 suspendentitlementrequest *SuspendEntitlementRequest 2731 urlParams_ gensupport.URLParams 2732 ctx_ context.Context 2733 header_ http.Header 2734 } 2735 2736 // Suspend: Requests suspension of an active Entitlement. This is not 2737 // yet supported. 2738 // 2739 // - name: The name of the entitlement to suspend. 2740 func (r *ProvidersEntitlementsService) Suspend(name string, suspendentitlementrequest *SuspendEntitlementRequest) *ProvidersEntitlementsSuspendCall { 2741 c := &ProvidersEntitlementsSuspendCall{s: r.s, urlParams_: make(gensupport.URLParams)} 2742 c.name = name 2743 c.suspendentitlementrequest = suspendentitlementrequest 2744 return c 2745 } 2746 2747 // Fields allows partial responses to be retrieved. See 2748 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 2749 // for more information. 2750 func (c *ProvidersEntitlementsSuspendCall) Fields(s ...googleapi.Field) *ProvidersEntitlementsSuspendCall { 2751 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 2752 return c 2753 } 2754 2755 // Context sets the context to be used in this call's Do method. Any 2756 // pending HTTP request will be aborted if the provided context is 2757 // canceled. 2758 func (c *ProvidersEntitlementsSuspendCall) Context(ctx context.Context) *ProvidersEntitlementsSuspendCall { 2759 c.ctx_ = ctx 2760 return c 2761 } 2762 2763 // Header returns an http.Header that can be modified by the caller to 2764 // add HTTP headers to the request. 2765 func (c *ProvidersEntitlementsSuspendCall) Header() http.Header { 2766 if c.header_ == nil { 2767 c.header_ = make(http.Header) 2768 } 2769 return c.header_ 2770 } 2771 2772 func (c *ProvidersEntitlementsSuspendCall) doRequest(alt string) (*http.Response, error) { 2773 reqHeaders := make(http.Header) 2774 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/"+internal.Version) 2775 for k, v := range c.header_ { 2776 reqHeaders[k] = v 2777 } 2778 reqHeaders.Set("User-Agent", c.s.userAgent()) 2779 var body io.Reader = nil 2780 body, err := googleapi.WithoutDataWrapper.JSONReader(c.suspendentitlementrequest) 2781 if err != nil { 2782 return nil, err 2783 } 2784 reqHeaders.Set("Content-Type", "application/json") 2785 c.urlParams_.Set("alt", alt) 2786 c.urlParams_.Set("prettyPrint", "false") 2787 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}:suspend") 2788 urls += "?" + c.urlParams_.Encode() 2789 req, err := http.NewRequest("POST", urls, body) 2790 if err != nil { 2791 return nil, err 2792 } 2793 req.Header = reqHeaders 2794 googleapi.Expand(req.URL, map[string]string{ 2795 "name": c.name, 2796 }) 2797 return gensupport.SendRequest(c.ctx_, c.s.client, req) 2798 } 2799 2800 // Do executes the "cloudcommerceprocurement.providers.entitlements.suspend" call. 2801 // Exactly one of *Empty or error will be non-nil. Any non-2xx status 2802 // code is an error. Response headers are in either 2803 // *Empty.ServerResponse.Header or (if a response was returned at all) 2804 // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 2805 // check whether the returned error was because http.StatusNotModified 2806 // was returned. 2807 func (c *ProvidersEntitlementsSuspendCall) Do(opts ...googleapi.CallOption) (*Empty, error) { 2808 gensupport.SetOptions(c.urlParams_, opts...) 2809 res, err := c.doRequest("json") 2810 if res != nil && res.StatusCode == http.StatusNotModified { 2811 if res.Body != nil { 2812 res.Body.Close() 2813 } 2814 return nil, &googleapi.Error{ 2815 Code: res.StatusCode, 2816 Header: res.Header, 2817 } 2818 } 2819 if err != nil { 2820 return nil, err 2821 } 2822 defer googleapi.CloseBody(res) 2823 if err := googleapi.CheckResponse(res); err != nil { 2824 return nil, err 2825 } 2826 ret := &Empty{ 2827 ServerResponse: googleapi.ServerResponse{ 2828 Header: res.Header, 2829 HTTPStatusCode: res.StatusCode, 2830 }, 2831 } 2832 target := &ret 2833 if err := gensupport.DecodeResponse(target, res); err != nil { 2834 return nil, err 2835 } 2836 return ret, nil 2837 // { 2838 // "description": "Requests suspension of an active Entitlement. This is not yet supported.", 2839 // "flatPath": "v1/providers/{providersId}/entitlements/{entitlementsId}:suspend", 2840 // "httpMethod": "POST", 2841 // "id": "cloudcommerceprocurement.providers.entitlements.suspend", 2842 // "parameterOrder": [ 2843 // "name" 2844 // ], 2845 // "parameters": { 2846 // "name": { 2847 // "description": "The name of the entitlement to suspend.", 2848 // "location": "path", 2849 // "pattern": "^providers/[^/]+/entitlements/[^/]+$", 2850 // "required": true, 2851 // "type": "string" 2852 // } 2853 // }, 2854 // "path": "v1/{+name}:suspend", 2855 // "request": { 2856 // "$ref": "SuspendEntitlementRequest" 2857 // }, 2858 // "response": { 2859 // "$ref": "Empty" 2860 // }, 2861 // "scopes": [ 2862 // "https://www.googleapis.com/auth/cloud-platform" 2863 // ] 2864 // } 2865 2866 } 2867