1// Copyright 2019 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 cloudkms provides access to the Cloud Key Management Service (KMS) API. 8// 9// This package is DEPRECATED. Use package cloud.google.com/go/kms/apiv1 instead. 10// 11// For product documentation, see: https://cloud.google.com/kms/ 12// 13// Creating a client 14// 15// Usage example: 16// 17// import "google.golang.org/api/cloudkms/v1" 18// ... 19// ctx := context.Background() 20// cloudkmsService, err := cloudkms.NewService(ctx) 21// 22// In this example, Google Application Default Credentials are used for authentication. 23// 24// For information on how to create and obtain Application Default Credentials, see https://developers.google.com/identity/protocols/application-default-credentials. 25// 26// Other authentication options 27// 28// By default, all available scopes (see "Constants") are used to authenticate. To restrict scopes, use option.WithScopes: 29// 30// cloudkmsService, err := cloudkms.NewService(ctx, option.WithScopes(cloudkms.CloudkmsScope)) 31// 32// To use an API key for authentication (note: some APIs do not support API keys), use option.WithAPIKey: 33// 34// cloudkmsService, err := cloudkms.NewService(ctx, option.WithAPIKey("AIza...")) 35// 36// To use an OAuth token (e.g., a user token obtained via a three-legged OAuth flow), use option.WithTokenSource: 37// 38// config := &oauth2.Config{...} 39// // ... 40// token, err := config.Exchange(ctx, ...) 41// cloudkmsService, err := cloudkms.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token))) 42// 43// See https://godoc.org/google.golang.org/api/option/ for details on options. 44package cloudkms // import "google.golang.org/api/cloudkms/v1" 45 46import ( 47 "bytes" 48 "context" 49 "encoding/json" 50 "errors" 51 "fmt" 52 "io" 53 "net/http" 54 "net/url" 55 "strconv" 56 "strings" 57 58 googleapi "google.golang.org/api/googleapi" 59 gensupport "google.golang.org/api/internal/gensupport" 60 option "google.golang.org/api/option" 61 htransport "google.golang.org/api/transport/http" 62) 63 64// Always reference these packages, just in case the auto-generated code 65// below doesn't. 66var _ = bytes.NewBuffer 67var _ = strconv.Itoa 68var _ = fmt.Sprintf 69var _ = json.NewDecoder 70var _ = io.Copy 71var _ = url.Parse 72var _ = gensupport.MarshalJSON 73var _ = googleapi.Version 74var _ = errors.New 75var _ = strings.Replace 76var _ = context.Canceled 77 78const apiId = "cloudkms:v1" 79const apiName = "cloudkms" 80const apiVersion = "v1" 81const basePath = "https://cloudkms.googleapis.com/" 82 83// OAuth2 scopes used by this API. 84const ( 85 // View and manage your data across Google Cloud Platform services 86 CloudPlatformScope = "https://www.googleapis.com/auth/cloud-platform" 87 88 // View and manage your keys and secrets stored in Cloud Key Management 89 // Service 90 CloudkmsScope = "https://www.googleapis.com/auth/cloudkms" 91) 92 93// NewService creates a new Service. 94func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) { 95 scopesOption := option.WithScopes( 96 "https://www.googleapis.com/auth/cloud-platform", 97 "https://www.googleapis.com/auth/cloudkms", 98 ) 99 // NOTE: prepend, so we don't override user-specified scopes. 100 opts = append([]option.ClientOption{scopesOption}, opts...) 101 client, endpoint, err := htransport.NewClient(ctx, opts...) 102 if err != nil { 103 return nil, err 104 } 105 s, err := New(client) 106 if err != nil { 107 return nil, err 108 } 109 if endpoint != "" { 110 s.BasePath = endpoint 111 } 112 return s, nil 113} 114 115// New creates a new Service. It uses the provided http.Client for requests. 116// 117// Deprecated: please use NewService instead. 118// To provide a custom HTTP client, use option.WithHTTPClient. 119// If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead. 120func New(client *http.Client) (*Service, error) { 121 if client == nil { 122 return nil, errors.New("client is nil") 123 } 124 s := &Service{client: client, BasePath: basePath} 125 s.Projects = NewProjectsService(s) 126 return s, nil 127} 128 129type Service struct { 130 client *http.Client 131 BasePath string // API endpoint base URL 132 UserAgent string // optional additional User-Agent fragment 133 134 Projects *ProjectsService 135} 136 137func (s *Service) userAgent() string { 138 if s.UserAgent == "" { 139 return googleapi.UserAgent 140 } 141 return googleapi.UserAgent + " " + s.UserAgent 142} 143 144func NewProjectsService(s *Service) *ProjectsService { 145 rs := &ProjectsService{s: s} 146 rs.Locations = NewProjectsLocationsService(s) 147 return rs 148} 149 150type ProjectsService struct { 151 s *Service 152 153 Locations *ProjectsLocationsService 154} 155 156func NewProjectsLocationsService(s *Service) *ProjectsLocationsService { 157 rs := &ProjectsLocationsService{s: s} 158 rs.KeyRings = NewProjectsLocationsKeyRingsService(s) 159 return rs 160} 161 162type ProjectsLocationsService struct { 163 s *Service 164 165 KeyRings *ProjectsLocationsKeyRingsService 166} 167 168func NewProjectsLocationsKeyRingsService(s *Service) *ProjectsLocationsKeyRingsService { 169 rs := &ProjectsLocationsKeyRingsService{s: s} 170 rs.CryptoKeys = NewProjectsLocationsKeyRingsCryptoKeysService(s) 171 rs.ImportJobs = NewProjectsLocationsKeyRingsImportJobsService(s) 172 return rs 173} 174 175type ProjectsLocationsKeyRingsService struct { 176 s *Service 177 178 CryptoKeys *ProjectsLocationsKeyRingsCryptoKeysService 179 180 ImportJobs *ProjectsLocationsKeyRingsImportJobsService 181} 182 183func NewProjectsLocationsKeyRingsCryptoKeysService(s *Service) *ProjectsLocationsKeyRingsCryptoKeysService { 184 rs := &ProjectsLocationsKeyRingsCryptoKeysService{s: s} 185 rs.CryptoKeyVersions = NewProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsService(s) 186 return rs 187} 188 189type ProjectsLocationsKeyRingsCryptoKeysService struct { 190 s *Service 191 192 CryptoKeyVersions *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsService 193} 194 195func NewProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsService(s *Service) *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsService { 196 rs := &ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsService{s: s} 197 return rs 198} 199 200type ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsService struct { 201 s *Service 202} 203 204func NewProjectsLocationsKeyRingsImportJobsService(s *Service) *ProjectsLocationsKeyRingsImportJobsService { 205 rs := &ProjectsLocationsKeyRingsImportJobsService{s: s} 206 return rs 207} 208 209type ProjectsLocationsKeyRingsImportJobsService struct { 210 s *Service 211} 212 213// AsymmetricDecryptRequest: Request message for 214// KeyManagementService.AsymmetricDecrypt. 215type AsymmetricDecryptRequest struct { 216 // Ciphertext: Required. The data encrypted with the named 217 // CryptoKeyVersion's public 218 // key using OAEP. 219 Ciphertext string `json:"ciphertext,omitempty"` 220 221 // ForceSendFields is a list of field names (e.g. "Ciphertext") to 222 // unconditionally include in API requests. By default, fields with 223 // empty values are omitted from API requests. However, any non-pointer, 224 // non-interface field appearing in ForceSendFields will be sent to the 225 // server regardless of whether the field is empty or not. This may be 226 // used to include empty fields in Patch requests. 227 ForceSendFields []string `json:"-"` 228 229 // NullFields is a list of field names (e.g. "Ciphertext") to include in 230 // API requests with the JSON null value. By default, fields with empty 231 // values are omitted from API requests. However, any field with an 232 // empty value appearing in NullFields will be sent to the server as 233 // null. It is an error if a field in this list has a non-empty value. 234 // This may be used to include null fields in Patch requests. 235 NullFields []string `json:"-"` 236} 237 238func (s *AsymmetricDecryptRequest) MarshalJSON() ([]byte, error) { 239 type NoMethod AsymmetricDecryptRequest 240 raw := NoMethod(*s) 241 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 242} 243 244// AsymmetricDecryptResponse: Response message for 245// KeyManagementService.AsymmetricDecrypt. 246type AsymmetricDecryptResponse struct { 247 // Plaintext: The decrypted data originally encrypted with the matching 248 // public key. 249 Plaintext string `json:"plaintext,omitempty"` 250 251 // ServerResponse contains the HTTP response code and headers from the 252 // server. 253 googleapi.ServerResponse `json:"-"` 254 255 // ForceSendFields is a list of field names (e.g. "Plaintext") to 256 // unconditionally include in API requests. By default, fields with 257 // empty values are omitted from API requests. However, any non-pointer, 258 // non-interface field appearing in ForceSendFields will be sent to the 259 // server regardless of whether the field is empty or not. This may be 260 // used to include empty fields in Patch requests. 261 ForceSendFields []string `json:"-"` 262 263 // NullFields is a list of field names (e.g. "Plaintext") to include in 264 // API requests with the JSON null value. By default, fields with empty 265 // values are omitted from API requests. However, any field with an 266 // empty value appearing in NullFields will be sent to the server as 267 // null. It is an error if a field in this list has a non-empty value. 268 // This may be used to include null fields in Patch requests. 269 NullFields []string `json:"-"` 270} 271 272func (s *AsymmetricDecryptResponse) MarshalJSON() ([]byte, error) { 273 type NoMethod AsymmetricDecryptResponse 274 raw := NoMethod(*s) 275 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 276} 277 278// AsymmetricSignRequest: Request message for 279// KeyManagementService.AsymmetricSign. 280type AsymmetricSignRequest struct { 281 // Digest: Required. The digest of the data to sign. The digest must be 282 // produced with 283 // the same digest algorithm as specified by the key 284 // version's 285 // algorithm. 286 Digest *Digest `json:"digest,omitempty"` 287 288 // ForceSendFields is a list of field names (e.g. "Digest") to 289 // unconditionally include in API requests. By default, fields with 290 // empty values are omitted from API requests. However, any non-pointer, 291 // non-interface field appearing in ForceSendFields will be sent to the 292 // server regardless of whether the field is empty or not. This may be 293 // used to include empty fields in Patch requests. 294 ForceSendFields []string `json:"-"` 295 296 // NullFields is a list of field names (e.g. "Digest") to include in API 297 // requests with the JSON null value. By default, fields with empty 298 // values are omitted from API requests. However, any field with an 299 // empty value appearing in NullFields will be sent to the server as 300 // null. It is an error if a field in this list has a non-empty value. 301 // This may be used to include null fields in Patch requests. 302 NullFields []string `json:"-"` 303} 304 305func (s *AsymmetricSignRequest) MarshalJSON() ([]byte, error) { 306 type NoMethod AsymmetricSignRequest 307 raw := NoMethod(*s) 308 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 309} 310 311// AsymmetricSignResponse: Response message for 312// KeyManagementService.AsymmetricSign. 313type AsymmetricSignResponse struct { 314 // Signature: The created signature. 315 Signature string `json:"signature,omitempty"` 316 317 // ServerResponse contains the HTTP response code and headers from the 318 // server. 319 googleapi.ServerResponse `json:"-"` 320 321 // ForceSendFields is a list of field names (e.g. "Signature") to 322 // unconditionally include in API requests. By default, fields with 323 // empty values are omitted from API requests. However, any non-pointer, 324 // non-interface field appearing in ForceSendFields will be sent to the 325 // server regardless of whether the field is empty or not. This may be 326 // used to include empty fields in Patch requests. 327 ForceSendFields []string `json:"-"` 328 329 // NullFields is a list of field names (e.g. "Signature") to include in 330 // API requests with the JSON null value. By default, fields with empty 331 // values are omitted from API requests. However, any field with an 332 // empty value appearing in NullFields will be sent to the server as 333 // null. It is an error if a field in this list has a non-empty value. 334 // This may be used to include null fields in Patch requests. 335 NullFields []string `json:"-"` 336} 337 338func (s *AsymmetricSignResponse) MarshalJSON() ([]byte, error) { 339 type NoMethod AsymmetricSignResponse 340 raw := NoMethod(*s) 341 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 342} 343 344// AuditConfig: Specifies the audit configuration for a service. 345// The configuration determines which permission types are logged, and 346// what 347// identities, if any, are exempted from logging. 348// An AuditConfig must have one or more AuditLogConfigs. 349// 350// If there are AuditConfigs for both `allServices` and a specific 351// service, 352// the union of the two AuditConfigs is used for that service: the 353// log_types 354// specified in each AuditConfig are enabled, and the exempted_members 355// in each 356// AuditLogConfig are exempted. 357// 358// Example Policy with multiple AuditConfigs: 359// 360// { 361// "audit_configs": [ 362// { 363// "service": "allServices" 364// "audit_log_configs": [ 365// { 366// "log_type": "DATA_READ", 367// "exempted_members": [ 368// "user:jose@example.com" 369// ] 370// }, 371// { 372// "log_type": "DATA_WRITE", 373// }, 374// { 375// "log_type": "ADMIN_READ", 376// } 377// ] 378// }, 379// { 380// "service": "sampleservice.googleapis.com" 381// "audit_log_configs": [ 382// { 383// "log_type": "DATA_READ", 384// }, 385// { 386// "log_type": "DATA_WRITE", 387// "exempted_members": [ 388// "user:aliya@example.com" 389// ] 390// } 391// ] 392// } 393// ] 394// } 395// 396// For sampleservice, this policy enables DATA_READ, DATA_WRITE and 397// ADMIN_READ 398// logging. It also exempts jose@example.com from DATA_READ logging, 399// and 400// aliya@example.com from DATA_WRITE logging. 401type AuditConfig struct { 402 // AuditLogConfigs: The configuration for logging of each type of 403 // permission. 404 AuditLogConfigs []*AuditLogConfig `json:"auditLogConfigs,omitempty"` 405 406 // Service: Specifies a service that will be enabled for audit 407 // logging. 408 // For example, `storage.googleapis.com`, 409 // `cloudsql.googleapis.com`. 410 // `allServices` is a special value that covers all services. 411 Service string `json:"service,omitempty"` 412 413 // ForceSendFields is a list of field names (e.g. "AuditLogConfigs") to 414 // unconditionally include in API requests. By default, fields with 415 // empty values are omitted from API requests. However, any non-pointer, 416 // non-interface field appearing in ForceSendFields will be sent to the 417 // server regardless of whether the field is empty or not. This may be 418 // used to include empty fields in Patch requests. 419 ForceSendFields []string `json:"-"` 420 421 // NullFields is a list of field names (e.g. "AuditLogConfigs") to 422 // include in API requests with the JSON null value. By default, fields 423 // with empty values are omitted from API requests. However, any field 424 // with an empty value appearing in NullFields will be sent to the 425 // server as null. It is an error if a field in this list has a 426 // non-empty value. This may be used to include null fields in Patch 427 // requests. 428 NullFields []string `json:"-"` 429} 430 431func (s *AuditConfig) MarshalJSON() ([]byte, error) { 432 type NoMethod AuditConfig 433 raw := NoMethod(*s) 434 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 435} 436 437// AuditLogConfig: Provides the configuration for logging a type of 438// permissions. 439// Example: 440// 441// { 442// "audit_log_configs": [ 443// { 444// "log_type": "DATA_READ", 445// "exempted_members": [ 446// "user:jose@example.com" 447// ] 448// }, 449// { 450// "log_type": "DATA_WRITE", 451// } 452// ] 453// } 454// 455// This enables 'DATA_READ' and 'DATA_WRITE' logging, while 456// exempting 457// jose@example.com from DATA_READ logging. 458type AuditLogConfig struct { 459 // ExemptedMembers: Specifies the identities that do not cause logging 460 // for this type of 461 // permission. 462 // Follows the same format of Binding.members. 463 ExemptedMembers []string `json:"exemptedMembers,omitempty"` 464 465 // LogType: The log type that this config enables. 466 // 467 // Possible values: 468 // "LOG_TYPE_UNSPECIFIED" - Default case. Should never be this. 469 // "ADMIN_READ" - Admin reads. Example: CloudIAM getIamPolicy 470 // "DATA_WRITE" - Data writes. Example: CloudSQL Users create 471 // "DATA_READ" - Data reads. Example: CloudSQL Users list 472 LogType string `json:"logType,omitempty"` 473 474 // ForceSendFields is a list of field names (e.g. "ExemptedMembers") to 475 // unconditionally include in API requests. By default, fields with 476 // empty values are omitted from API requests. However, any non-pointer, 477 // non-interface field appearing in ForceSendFields will be sent to the 478 // server regardless of whether the field is empty or not. This may be 479 // used to include empty fields in Patch requests. 480 ForceSendFields []string `json:"-"` 481 482 // NullFields is a list of field names (e.g. "ExemptedMembers") to 483 // include in API requests with the JSON null value. By default, fields 484 // with empty values are omitted from API requests. However, any field 485 // with an empty value appearing in NullFields will be sent to the 486 // server as null. It is an error if a field in this list has a 487 // non-empty value. This may be used to include null fields in Patch 488 // requests. 489 NullFields []string `json:"-"` 490} 491 492func (s *AuditLogConfig) MarshalJSON() ([]byte, error) { 493 type NoMethod AuditLogConfig 494 raw := NoMethod(*s) 495 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 496} 497 498// Binding: Associates `members` with a `role`. 499type Binding struct { 500 // Condition: The condition that is associated with this binding. 501 // NOTE: An unsatisfied condition will not allow user access via 502 // current 503 // binding. Different bindings, including their conditions, are 504 // examined 505 // independently. 506 Condition *Expr `json:"condition,omitempty"` 507 508 // Members: Specifies the identities requesting access for a Cloud 509 // Platform resource. 510 // `members` can have the following values: 511 // 512 // * `allUsers`: A special identifier that represents anyone who is 513 // on the internet; with or without a Google account. 514 // 515 // * `allAuthenticatedUsers`: A special identifier that represents 516 // anyone 517 // who is authenticated with a Google account or a service 518 // account. 519 // 520 // * `user:{emailid}`: An email address that represents a specific 521 // Google 522 // account. For example, `alice@example.com` . 523 // 524 // 525 // * `serviceAccount:{emailid}`: An email address that represents a 526 // service 527 // account. For example, 528 // `my-other-app@appspot.gserviceaccount.com`. 529 // 530 // * `group:{emailid}`: An email address that represents a Google 531 // group. 532 // For example, `admins@example.com`. 533 // 534 // 535 // * `domain:{domain}`: The G Suite domain (primary) that represents all 536 // the 537 // users of that domain. For example, `google.com` or 538 // `example.com`. 539 // 540 // 541 Members []string `json:"members,omitempty"` 542 543 // Role: Role that is assigned to `members`. 544 // For example, `roles/viewer`, `roles/editor`, or `roles/owner`. 545 Role string `json:"role,omitempty"` 546 547 // ForceSendFields is a list of field names (e.g. "Condition") to 548 // unconditionally include in API requests. By default, fields with 549 // empty values are omitted from API requests. However, any non-pointer, 550 // non-interface field appearing in ForceSendFields will be sent to the 551 // server regardless of whether the field is empty or not. This may be 552 // used to include empty fields in Patch requests. 553 ForceSendFields []string `json:"-"` 554 555 // NullFields is a list of field names (e.g. "Condition") to include in 556 // API requests with the JSON null value. By default, fields with empty 557 // values are omitted from API requests. However, any field with an 558 // empty value appearing in NullFields will be sent to the server as 559 // null. It is an error if a field in this list has a non-empty value. 560 // This may be used to include null fields in Patch requests. 561 NullFields []string `json:"-"` 562} 563 564func (s *Binding) MarshalJSON() ([]byte, error) { 565 type NoMethod Binding 566 raw := NoMethod(*s) 567 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 568} 569 570// CryptoKey: A CryptoKey represents a logical key that can be used for 571// cryptographic 572// operations. 573// 574// A CryptoKey is made up of one or more versions, which 575// represent the actual key material used in cryptographic operations. 576type CryptoKey struct { 577 // CreateTime: Output only. The time at which this CryptoKey was 578 // created. 579 CreateTime string `json:"createTime,omitempty"` 580 581 // Labels: Labels with user-defined metadata. For more information, 582 // see 583 // [Labeling Keys](/kms/docs/labeling-keys). 584 Labels map[string]string `json:"labels,omitempty"` 585 586 // Name: Output only. The resource name for this CryptoKey in the 587 // format 588 // `projects/*/locations/*/keyRings/*/cryptoKeys/*`. 589 Name string `json:"name,omitempty"` 590 591 // NextRotationTime: At next_rotation_time, the Key Management Service 592 // will automatically: 593 // 594 // 1. Create a new version of this CryptoKey. 595 // 2. Mark the new version as primary. 596 // 597 // Key rotations performed manually via 598 // CreateCryptoKeyVersion and 599 // UpdateCryptoKeyPrimaryVersion 600 // do not affect next_rotation_time. 601 // 602 // Keys with purpose 603 // ENCRYPT_DECRYPT support 604 // automatic rotation. For other keys, this field must be omitted. 605 NextRotationTime string `json:"nextRotationTime,omitempty"` 606 607 // Primary: Output only. A copy of the "primary" CryptoKeyVersion that 608 // will be used 609 // by Encrypt when this CryptoKey is given 610 // in EncryptRequest.name. 611 // 612 // The CryptoKey's primary version can be updated 613 // via 614 // UpdateCryptoKeyPrimaryVersion. 615 // 616 // All keys with purpose 617 // ENCRYPT_DECRYPT have a 618 // primary. For other keys, this field will be omitted. 619 Primary *CryptoKeyVersion `json:"primary,omitempty"` 620 621 // Purpose: Immutable. The immutable purpose of this CryptoKey. 622 // 623 // Possible values: 624 // "CRYPTO_KEY_PURPOSE_UNSPECIFIED" - Not specified. 625 // "ENCRYPT_DECRYPT" - CryptoKeys with this purpose may be used 626 // with 627 // Encrypt and 628 // Decrypt. 629 // "ASYMMETRIC_SIGN" - CryptoKeys with this purpose may be used 630 // with 631 // AsymmetricSign and 632 // GetPublicKey. 633 // "ASYMMETRIC_DECRYPT" - CryptoKeys with this purpose may be used 634 // with 635 // AsymmetricDecrypt and 636 // GetPublicKey. 637 Purpose string `json:"purpose,omitempty"` 638 639 // RotationPeriod: next_rotation_time will be advanced by this period 640 // when the service 641 // automatically rotates a key. Must be at least 24 hours and at 642 // most 643 // 876,000 hours. 644 // 645 // If rotation_period is set, next_rotation_time must also be set. 646 // 647 // Keys with purpose 648 // ENCRYPT_DECRYPT support 649 // automatic rotation. For other keys, this field must be omitted. 650 RotationPeriod string `json:"rotationPeriod,omitempty"` 651 652 // VersionTemplate: A template describing settings for new 653 // CryptoKeyVersion instances. 654 // The properties of new CryptoKeyVersion instances created by 655 // either 656 // CreateCryptoKeyVersion or 657 // auto-rotation are controlled by this template. 658 VersionTemplate *CryptoKeyVersionTemplate `json:"versionTemplate,omitempty"` 659 660 // ServerResponse contains the HTTP response code and headers from the 661 // server. 662 googleapi.ServerResponse `json:"-"` 663 664 // ForceSendFields is a list of field names (e.g. "CreateTime") to 665 // unconditionally include in API requests. By default, fields with 666 // empty values are omitted from API requests. However, any non-pointer, 667 // non-interface field appearing in ForceSendFields will be sent to the 668 // server regardless of whether the field is empty or not. This may be 669 // used to include empty fields in Patch requests. 670 ForceSendFields []string `json:"-"` 671 672 // NullFields is a list of field names (e.g. "CreateTime") to include in 673 // API requests with the JSON null value. By default, fields with empty 674 // values are omitted from API requests. However, any field with an 675 // empty value appearing in NullFields will be sent to the server as 676 // null. It is an error if a field in this list has a non-empty value. 677 // This may be used to include null fields in Patch requests. 678 NullFields []string `json:"-"` 679} 680 681func (s *CryptoKey) MarshalJSON() ([]byte, error) { 682 type NoMethod CryptoKey 683 raw := NoMethod(*s) 684 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 685} 686 687// CryptoKeyVersion: A CryptoKeyVersion represents an individual 688// cryptographic key, and the 689// associated key material. 690// 691// An ENABLED version can be 692// used for cryptographic operations. 693// 694// For security reasons, the raw cryptographic key material represented 695// by a 696// CryptoKeyVersion can never be viewed or exported. It can only be used 697// to 698// encrypt, decrypt, or sign data when an authorized user or application 699// invokes 700// Cloud KMS. 701type CryptoKeyVersion struct { 702 // Algorithm: Output only. The CryptoKeyVersionAlgorithm that 703 // this 704 // CryptoKeyVersion supports. 705 // 706 // Possible values: 707 // "CRYPTO_KEY_VERSION_ALGORITHM_UNSPECIFIED" - Not specified. 708 // "GOOGLE_SYMMETRIC_ENCRYPTION" - Creates symmetric encryption keys. 709 // "RSA_SIGN_PSS_2048_SHA256" - RSASSA-PSS 2048 bit key with a SHA256 710 // digest. 711 // "RSA_SIGN_PSS_3072_SHA256" - RSASSA-PSS 3072 bit key with a SHA256 712 // digest. 713 // "RSA_SIGN_PSS_4096_SHA256" - RSASSA-PSS 4096 bit key with a SHA256 714 // digest. 715 // "RSA_SIGN_PSS_4096_SHA512" - RSASSA-PSS 4096 bit key with a SHA512 716 // digest. 717 // "RSA_SIGN_PKCS1_2048_SHA256" - RSASSA-PKCS1-v1_5 with a 2048 bit 718 // key and a SHA256 digest. 719 // "RSA_SIGN_PKCS1_3072_SHA256" - RSASSA-PKCS1-v1_5 with a 3072 bit 720 // key and a SHA256 digest. 721 // "RSA_SIGN_PKCS1_4096_SHA256" - RSASSA-PKCS1-v1_5 with a 4096 bit 722 // key and a SHA256 digest. 723 // "RSA_SIGN_PKCS1_4096_SHA512" - RSASSA-PKCS1-v1_5 with a 4096 bit 724 // key and a SHA512 digest. 725 // "RSA_DECRYPT_OAEP_2048_SHA256" - RSAES-OAEP 2048 bit key with a 726 // SHA256 digest. 727 // "RSA_DECRYPT_OAEP_3072_SHA256" - RSAES-OAEP 3072 bit key with a 728 // SHA256 digest. 729 // "RSA_DECRYPT_OAEP_4096_SHA256" - RSAES-OAEP 4096 bit key with a 730 // SHA256 digest. 731 // "RSA_DECRYPT_OAEP_4096_SHA512" - RSAES-OAEP 4096 bit key with a 732 // SHA512 digest. 733 // "EC_SIGN_P256_SHA256" - ECDSA on the NIST P-256 curve with a SHA256 734 // digest. 735 // "EC_SIGN_P384_SHA384" - ECDSA on the NIST P-384 curve with a SHA384 736 // digest. 737 Algorithm string `json:"algorithm,omitempty"` 738 739 // Attestation: Output only. Statement that was generated and signed by 740 // the HSM at key 741 // creation time. Use this statement to verify attributes of the key as 742 // stored 743 // on the HSM, independently of Google. Only provided for key versions 744 // with 745 // protection_level HSM. 746 Attestation *KeyOperationAttestation `json:"attestation,omitempty"` 747 748 // CreateTime: Output only. The time at which this CryptoKeyVersion was 749 // created. 750 CreateTime string `json:"createTime,omitempty"` 751 752 // DestroyEventTime: Output only. The time this CryptoKeyVersion's key 753 // material was 754 // destroyed. Only present if state is 755 // DESTROYED. 756 DestroyEventTime string `json:"destroyEventTime,omitempty"` 757 758 // DestroyTime: Output only. The time this CryptoKeyVersion's key 759 // material is scheduled 760 // for destruction. Only present if state is 761 // DESTROY_SCHEDULED. 762 DestroyTime string `json:"destroyTime,omitempty"` 763 764 // GenerateTime: Output only. The time this CryptoKeyVersion's key 765 // material was 766 // generated. 767 GenerateTime string `json:"generateTime,omitempty"` 768 769 // ImportFailureReason: Output only. The root cause of an import 770 // failure. Only present if 771 // state is 772 // IMPORT_FAILED. 773 ImportFailureReason string `json:"importFailureReason,omitempty"` 774 775 // ImportJob: Output only. The name of the ImportJob used to import 776 // this 777 // CryptoKeyVersion. Only present if the underlying key material 778 // was 779 // imported. 780 ImportJob string `json:"importJob,omitempty"` 781 782 // ImportTime: Output only. The time at which this CryptoKeyVersion's 783 // key material 784 // was imported. 785 ImportTime string `json:"importTime,omitempty"` 786 787 // Name: Output only. The resource name for this CryptoKeyVersion in the 788 // format 789 // `projects/*/locations/*/keyRings/*/cryptoKeys/*/cryptoKeyVersio 790 // ns/*`. 791 Name string `json:"name,omitempty"` 792 793 // ProtectionLevel: Output only. The ProtectionLevel describing how 794 // crypto operations are 795 // performed with this CryptoKeyVersion. 796 // 797 // Possible values: 798 // "PROTECTION_LEVEL_UNSPECIFIED" - Not specified. 799 // "SOFTWARE" - Crypto operations are performed in software. 800 // "HSM" - Crypto operations are performed in a Hardware Security 801 // Module. 802 ProtectionLevel string `json:"protectionLevel,omitempty"` 803 804 // State: The current state of the CryptoKeyVersion. 805 // 806 // Possible values: 807 // "CRYPTO_KEY_VERSION_STATE_UNSPECIFIED" - Not specified. 808 // "PENDING_GENERATION" - This version is still being generated. It 809 // may not be used, enabled, 810 // disabled, or destroyed yet. Cloud KMS will automatically mark 811 // this 812 // version ENABLED as soon as the version is ready. 813 // "ENABLED" - This version may be used for cryptographic operations. 814 // "DISABLED" - This version may not be used, but the key material is 815 // still available, 816 // and the version can be placed back into the ENABLED state. 817 // "DESTROYED" - This version is destroyed, and the key material is no 818 // longer stored. 819 // A version may not leave this state once entered. 820 // "DESTROY_SCHEDULED" - This version is scheduled for destruction, 821 // and will be destroyed soon. 822 // Call 823 // RestoreCryptoKeyVersion 824 // to put it back into the DISABLED state. 825 // "PENDING_IMPORT" - This version is still being imported. It may not 826 // be used, enabled, 827 // disabled, or destroyed yet. Cloud KMS will automatically mark 828 // this 829 // version ENABLED as soon as the version is ready. 830 // "IMPORT_FAILED" - This version was not imported successfully. It 831 // may not be used, enabled, 832 // disabled, or destroyed. The submitted key material has been 833 // discarded. 834 // Additional details can be found 835 // in 836 // CryptoKeyVersion.import_failure_reason. 837 State string `json:"state,omitempty"` 838 839 // ServerResponse contains the HTTP response code and headers from the 840 // server. 841 googleapi.ServerResponse `json:"-"` 842 843 // ForceSendFields is a list of field names (e.g. "Algorithm") to 844 // unconditionally include in API requests. By default, fields with 845 // empty values are omitted from API requests. However, any non-pointer, 846 // non-interface field appearing in ForceSendFields will be sent to the 847 // server regardless of whether the field is empty or not. This may be 848 // used to include empty fields in Patch requests. 849 ForceSendFields []string `json:"-"` 850 851 // NullFields is a list of field names (e.g. "Algorithm") to include in 852 // API requests with the JSON null value. By default, fields with empty 853 // values are omitted from API requests. However, any field with an 854 // empty value appearing in NullFields will be sent to the server as 855 // null. It is an error if a field in this list has a non-empty value. 856 // This may be used to include null fields in Patch requests. 857 NullFields []string `json:"-"` 858} 859 860func (s *CryptoKeyVersion) MarshalJSON() ([]byte, error) { 861 type NoMethod CryptoKeyVersion 862 raw := NoMethod(*s) 863 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 864} 865 866// CryptoKeyVersionTemplate: A CryptoKeyVersionTemplate specifies the 867// properties to use when creating 868// a new CryptoKeyVersion, either manually with 869// CreateCryptoKeyVersion or 870// automatically as a result of auto-rotation. 871type CryptoKeyVersionTemplate struct { 872 // Algorithm: Required. Algorithm to use 873 // when creating a CryptoKeyVersion based on this template. 874 // 875 // For backwards compatibility, GOOGLE_SYMMETRIC_ENCRYPTION is implied 876 // if both 877 // this field is omitted and CryptoKey.purpose is 878 // ENCRYPT_DECRYPT. 879 // 880 // Possible values: 881 // "CRYPTO_KEY_VERSION_ALGORITHM_UNSPECIFIED" - Not specified. 882 // "GOOGLE_SYMMETRIC_ENCRYPTION" - Creates symmetric encryption keys. 883 // "RSA_SIGN_PSS_2048_SHA256" - RSASSA-PSS 2048 bit key with a SHA256 884 // digest. 885 // "RSA_SIGN_PSS_3072_SHA256" - RSASSA-PSS 3072 bit key with a SHA256 886 // digest. 887 // "RSA_SIGN_PSS_4096_SHA256" - RSASSA-PSS 4096 bit key with a SHA256 888 // digest. 889 // "RSA_SIGN_PSS_4096_SHA512" - RSASSA-PSS 4096 bit key with a SHA512 890 // digest. 891 // "RSA_SIGN_PKCS1_2048_SHA256" - RSASSA-PKCS1-v1_5 with a 2048 bit 892 // key and a SHA256 digest. 893 // "RSA_SIGN_PKCS1_3072_SHA256" - RSASSA-PKCS1-v1_5 with a 3072 bit 894 // key and a SHA256 digest. 895 // "RSA_SIGN_PKCS1_4096_SHA256" - RSASSA-PKCS1-v1_5 with a 4096 bit 896 // key and a SHA256 digest. 897 // "RSA_SIGN_PKCS1_4096_SHA512" - RSASSA-PKCS1-v1_5 with a 4096 bit 898 // key and a SHA512 digest. 899 // "RSA_DECRYPT_OAEP_2048_SHA256" - RSAES-OAEP 2048 bit key with a 900 // SHA256 digest. 901 // "RSA_DECRYPT_OAEP_3072_SHA256" - RSAES-OAEP 3072 bit key with a 902 // SHA256 digest. 903 // "RSA_DECRYPT_OAEP_4096_SHA256" - RSAES-OAEP 4096 bit key with a 904 // SHA256 digest. 905 // "RSA_DECRYPT_OAEP_4096_SHA512" - RSAES-OAEP 4096 bit key with a 906 // SHA512 digest. 907 // "EC_SIGN_P256_SHA256" - ECDSA on the NIST P-256 curve with a SHA256 908 // digest. 909 // "EC_SIGN_P384_SHA384" - ECDSA on the NIST P-384 curve with a SHA384 910 // digest. 911 Algorithm string `json:"algorithm,omitempty"` 912 913 // ProtectionLevel: ProtectionLevel to use when creating a 914 // CryptoKeyVersion based on 915 // this template. Immutable. Defaults to SOFTWARE. 916 // 917 // Possible values: 918 // "PROTECTION_LEVEL_UNSPECIFIED" - Not specified. 919 // "SOFTWARE" - Crypto operations are performed in software. 920 // "HSM" - Crypto operations are performed in a Hardware Security 921 // Module. 922 ProtectionLevel string `json:"protectionLevel,omitempty"` 923 924 // ForceSendFields is a list of field names (e.g. "Algorithm") to 925 // unconditionally include in API requests. By default, fields with 926 // empty values are omitted from API requests. However, any non-pointer, 927 // non-interface field appearing in ForceSendFields will be sent to the 928 // server regardless of whether the field is empty or not. This may be 929 // used to include empty fields in Patch requests. 930 ForceSendFields []string `json:"-"` 931 932 // NullFields is a list of field names (e.g. "Algorithm") to include in 933 // API requests with the JSON null value. By default, fields with empty 934 // values are omitted from API requests. However, any field with an 935 // empty value appearing in NullFields will be sent to the server as 936 // null. It is an error if a field in this list has a non-empty value. 937 // This may be used to include null fields in Patch requests. 938 NullFields []string `json:"-"` 939} 940 941func (s *CryptoKeyVersionTemplate) MarshalJSON() ([]byte, error) { 942 type NoMethod CryptoKeyVersionTemplate 943 raw := NoMethod(*s) 944 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 945} 946 947// DecryptRequest: Request message for KeyManagementService.Decrypt. 948type DecryptRequest struct { 949 // AdditionalAuthenticatedData: Optional. Optional data that must match 950 // the data originally supplied 951 // in 952 // EncryptRequest.additional_authenticated_data. 953 AdditionalAuthenticatedData string `json:"additionalAuthenticatedData,omitempty"` 954 955 // Ciphertext: Required. The encrypted data originally returned 956 // in 957 // EncryptResponse.ciphertext. 958 Ciphertext string `json:"ciphertext,omitempty"` 959 960 // ForceSendFields is a list of field names (e.g. 961 // "AdditionalAuthenticatedData") to unconditionally include in API 962 // requests. By default, fields with empty values are omitted from API 963 // requests. However, any non-pointer, non-interface field appearing in 964 // ForceSendFields will be sent to the server regardless of whether the 965 // field is empty or not. This may be used to include empty fields in 966 // Patch requests. 967 ForceSendFields []string `json:"-"` 968 969 // NullFields is a list of field names (e.g. 970 // "AdditionalAuthenticatedData") to include in API requests with the 971 // JSON null value. By default, fields with empty values are omitted 972 // from API requests. However, any field with an empty value appearing 973 // in NullFields will be sent to the server as null. It is an error if a 974 // field in this list has a non-empty value. This may be used to include 975 // null fields in Patch requests. 976 NullFields []string `json:"-"` 977} 978 979func (s *DecryptRequest) MarshalJSON() ([]byte, error) { 980 type NoMethod DecryptRequest 981 raw := NoMethod(*s) 982 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 983} 984 985// DecryptResponse: Response message for KeyManagementService.Decrypt. 986type DecryptResponse struct { 987 // Plaintext: The decrypted data originally supplied in 988 // EncryptRequest.plaintext. 989 Plaintext string `json:"plaintext,omitempty"` 990 991 // ServerResponse contains the HTTP response code and headers from the 992 // server. 993 googleapi.ServerResponse `json:"-"` 994 995 // ForceSendFields is a list of field names (e.g. "Plaintext") to 996 // unconditionally include in API requests. By default, fields with 997 // empty values are omitted from API requests. However, any non-pointer, 998 // non-interface field appearing in ForceSendFields will be sent to the 999 // server regardless of whether the field is empty or not. This may be 1000 // used to include empty fields in Patch requests. 1001 ForceSendFields []string `json:"-"` 1002 1003 // NullFields is a list of field names (e.g. "Plaintext") to include in 1004 // API requests with the JSON null value. By default, fields with empty 1005 // values are omitted from API requests. However, any field with an 1006 // empty value appearing in NullFields will be sent to the server as 1007 // null. It is an error if a field in this list has a non-empty value. 1008 // This may be used to include null fields in Patch requests. 1009 NullFields []string `json:"-"` 1010} 1011 1012func (s *DecryptResponse) MarshalJSON() ([]byte, error) { 1013 type NoMethod DecryptResponse 1014 raw := NoMethod(*s) 1015 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1016} 1017 1018// DestroyCryptoKeyVersionRequest: Request message for 1019// KeyManagementService.DestroyCryptoKeyVersion. 1020type DestroyCryptoKeyVersionRequest struct { 1021} 1022 1023// Digest: A Digest holds a cryptographic message digest. 1024type Digest struct { 1025 // Sha256: A message digest produced with the SHA-256 algorithm. 1026 Sha256 string `json:"sha256,omitempty"` 1027 1028 // Sha384: A message digest produced with the SHA-384 algorithm. 1029 Sha384 string `json:"sha384,omitempty"` 1030 1031 // Sha512: A message digest produced with the SHA-512 algorithm. 1032 Sha512 string `json:"sha512,omitempty"` 1033 1034 // ForceSendFields is a list of field names (e.g. "Sha256") to 1035 // unconditionally include in API requests. By default, fields with 1036 // empty values are omitted from API requests. However, any non-pointer, 1037 // non-interface field appearing in ForceSendFields will be sent to the 1038 // server regardless of whether the field is empty or not. This may be 1039 // used to include empty fields in Patch requests. 1040 ForceSendFields []string `json:"-"` 1041 1042 // NullFields is a list of field names (e.g. "Sha256") to include in API 1043 // requests with the JSON null value. By default, fields with empty 1044 // values are omitted from API requests. However, any field with an 1045 // empty value appearing in NullFields will be sent to the server as 1046 // null. It is an error if a field in this list has a non-empty value. 1047 // This may be used to include null fields in Patch requests. 1048 NullFields []string `json:"-"` 1049} 1050 1051func (s *Digest) MarshalJSON() ([]byte, error) { 1052 type NoMethod Digest 1053 raw := NoMethod(*s) 1054 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1055} 1056 1057// EncryptRequest: Request message for KeyManagementService.Encrypt. 1058type EncryptRequest struct { 1059 // AdditionalAuthenticatedData: Optional. Optional data that, if 1060 // specified, must also be provided during decryption 1061 // through DecryptRequest.additional_authenticated_data. 1062 // 1063 // The maximum size depends on the key version's 1064 // protection_level. For 1065 // SOFTWARE keys, the AAD must be no larger than 1066 // 64KiB. For HSM keys, the combined length of the 1067 // plaintext and additional_authenticated_data fields must be no larger 1068 // than 1069 // 8KiB. 1070 AdditionalAuthenticatedData string `json:"additionalAuthenticatedData,omitempty"` 1071 1072 // Plaintext: Required. The data to encrypt. Must be no larger than 1073 // 64KiB. 1074 // 1075 // The maximum size depends on the key version's 1076 // protection_level. For 1077 // SOFTWARE keys, the plaintext must be no larger 1078 // than 64KiB. For HSM keys, the combined length of the 1079 // plaintext and additional_authenticated_data fields must be no larger 1080 // than 1081 // 8KiB. 1082 Plaintext string `json:"plaintext,omitempty"` 1083 1084 // ForceSendFields is a list of field names (e.g. 1085 // "AdditionalAuthenticatedData") to unconditionally include in API 1086 // requests. By default, fields with empty values are omitted from API 1087 // requests. However, any non-pointer, non-interface field appearing in 1088 // ForceSendFields will be sent to the server regardless of whether the 1089 // field is empty or not. This may be used to include empty fields in 1090 // Patch requests. 1091 ForceSendFields []string `json:"-"` 1092 1093 // NullFields is a list of field names (e.g. 1094 // "AdditionalAuthenticatedData") to include in API requests with the 1095 // JSON null value. By default, fields with empty values are omitted 1096 // from API requests. However, any field with an empty value appearing 1097 // in NullFields will be sent to the server as null. It is an error if a 1098 // field in this list has a non-empty value. This may be used to include 1099 // null fields in Patch requests. 1100 NullFields []string `json:"-"` 1101} 1102 1103func (s *EncryptRequest) MarshalJSON() ([]byte, error) { 1104 type NoMethod EncryptRequest 1105 raw := NoMethod(*s) 1106 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1107} 1108 1109// EncryptResponse: Response message for KeyManagementService.Encrypt. 1110type EncryptResponse struct { 1111 // Ciphertext: The encrypted data. 1112 Ciphertext string `json:"ciphertext,omitempty"` 1113 1114 // Name: The resource name of the CryptoKeyVersion used in encryption. 1115 // Check 1116 // this field to verify that the intended resource was used for 1117 // encryption. 1118 Name string `json:"name,omitempty"` 1119 1120 // ServerResponse contains the HTTP response code and headers from the 1121 // server. 1122 googleapi.ServerResponse `json:"-"` 1123 1124 // ForceSendFields is a list of field names (e.g. "Ciphertext") to 1125 // unconditionally include in API requests. By default, fields with 1126 // empty values are omitted from API requests. However, any non-pointer, 1127 // non-interface field appearing in ForceSendFields will be sent to the 1128 // server regardless of whether the field is empty or not. This may be 1129 // used to include empty fields in Patch requests. 1130 ForceSendFields []string `json:"-"` 1131 1132 // NullFields is a list of field names (e.g. "Ciphertext") to include in 1133 // API requests with the JSON null value. By default, fields with empty 1134 // values are omitted from API requests. However, any field with an 1135 // empty value appearing in NullFields will be sent to the server as 1136 // null. It is an error if a field in this list has a non-empty value. 1137 // This may be used to include null fields in Patch requests. 1138 NullFields []string `json:"-"` 1139} 1140 1141func (s *EncryptResponse) MarshalJSON() ([]byte, error) { 1142 type NoMethod EncryptResponse 1143 raw := NoMethod(*s) 1144 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1145} 1146 1147// Expr: Represents an expression text. Example: 1148// 1149// title: "User account presence" 1150// description: "Determines whether the request has a user account" 1151// expression: "size(request.user) > 0" 1152type Expr struct { 1153 // Description: An optional description of the expression. This is a 1154 // longer text which 1155 // describes the expression, e.g. when hovered over it in a UI. 1156 Description string `json:"description,omitempty"` 1157 1158 // Expression: Textual representation of an expression in 1159 // Common Expression Language syntax. 1160 // 1161 // The application context of the containing message determines 1162 // which 1163 // well-known feature set of CEL is supported. 1164 Expression string `json:"expression,omitempty"` 1165 1166 // Location: An optional string indicating the location of the 1167 // expression for error 1168 // reporting, e.g. a file name and a position in the file. 1169 Location string `json:"location,omitempty"` 1170 1171 // Title: An optional title for the expression, i.e. a short string 1172 // describing 1173 // its purpose. This can be used e.g. in UIs which allow to enter 1174 // the 1175 // expression. 1176 Title string `json:"title,omitempty"` 1177 1178 // ForceSendFields is a list of field names (e.g. "Description") to 1179 // unconditionally include in API requests. By default, fields with 1180 // empty values are omitted from API requests. However, any non-pointer, 1181 // non-interface field appearing in ForceSendFields will be sent to the 1182 // server regardless of whether the field is empty or not. This may be 1183 // used to include empty fields in Patch requests. 1184 ForceSendFields []string `json:"-"` 1185 1186 // NullFields is a list of field names (e.g. "Description") to include 1187 // in API requests with the JSON null value. By default, fields with 1188 // empty values are omitted from API requests. However, any field with 1189 // an empty value appearing in NullFields will be sent to the server as 1190 // null. It is an error if a field in this list has a non-empty value. 1191 // This may be used to include null fields in Patch requests. 1192 NullFields []string `json:"-"` 1193} 1194 1195func (s *Expr) MarshalJSON() ([]byte, error) { 1196 type NoMethod Expr 1197 raw := NoMethod(*s) 1198 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1199} 1200 1201// ImportCryptoKeyVersionRequest: Request message for 1202// KeyManagementService.ImportCryptoKeyVersion. 1203type ImportCryptoKeyVersionRequest struct { 1204 // Algorithm: Required. The algorithm of 1205 // the key being imported. This does not need to match 1206 // the 1207 // version_template of the CryptoKey this 1208 // version imports into. 1209 // 1210 // Possible values: 1211 // "CRYPTO_KEY_VERSION_ALGORITHM_UNSPECIFIED" - Not specified. 1212 // "GOOGLE_SYMMETRIC_ENCRYPTION" - Creates symmetric encryption keys. 1213 // "RSA_SIGN_PSS_2048_SHA256" - RSASSA-PSS 2048 bit key with a SHA256 1214 // digest. 1215 // "RSA_SIGN_PSS_3072_SHA256" - RSASSA-PSS 3072 bit key with a SHA256 1216 // digest. 1217 // "RSA_SIGN_PSS_4096_SHA256" - RSASSA-PSS 4096 bit key with a SHA256 1218 // digest. 1219 // "RSA_SIGN_PSS_4096_SHA512" - RSASSA-PSS 4096 bit key with a SHA512 1220 // digest. 1221 // "RSA_SIGN_PKCS1_2048_SHA256" - RSASSA-PKCS1-v1_5 with a 2048 bit 1222 // key and a SHA256 digest. 1223 // "RSA_SIGN_PKCS1_3072_SHA256" - RSASSA-PKCS1-v1_5 with a 3072 bit 1224 // key and a SHA256 digest. 1225 // "RSA_SIGN_PKCS1_4096_SHA256" - RSASSA-PKCS1-v1_5 with a 4096 bit 1226 // key and a SHA256 digest. 1227 // "RSA_SIGN_PKCS1_4096_SHA512" - RSASSA-PKCS1-v1_5 with a 4096 bit 1228 // key and a SHA512 digest. 1229 // "RSA_DECRYPT_OAEP_2048_SHA256" - RSAES-OAEP 2048 bit key with a 1230 // SHA256 digest. 1231 // "RSA_DECRYPT_OAEP_3072_SHA256" - RSAES-OAEP 3072 bit key with a 1232 // SHA256 digest. 1233 // "RSA_DECRYPT_OAEP_4096_SHA256" - RSAES-OAEP 4096 bit key with a 1234 // SHA256 digest. 1235 // "RSA_DECRYPT_OAEP_4096_SHA512" - RSAES-OAEP 4096 bit key with a 1236 // SHA512 digest. 1237 // "EC_SIGN_P256_SHA256" - ECDSA on the NIST P-256 curve with a SHA256 1238 // digest. 1239 // "EC_SIGN_P384_SHA384" - ECDSA on the NIST P-384 curve with a SHA384 1240 // digest. 1241 Algorithm string `json:"algorithm,omitempty"` 1242 1243 // ImportJob: Required. The name of the ImportJob that was used to 1244 // wrap this key material. 1245 ImportJob string `json:"importJob,omitempty"` 1246 1247 // RsaAesWrappedKey: Wrapped key material produced 1248 // with 1249 // RSA_OAEP_3072_SHA1_AES_256 1250 // or 1251 // RSA_OAEP_4096_SHA1_AES_256. 1252 // 1253 // This field contains the concatenation of two wrapped keys: 1254 // <ol> 1255 // <li>An ephemeral AES-256 wrapping key wrapped with the 1256 // public_key using RSAES-OAEP with SHA-1, 1257 // MGF1 with SHA-1, and an empty label. 1258 // </li> 1259 // <li>The key to be imported, wrapped with the ephemeral AES-256 key 1260 // using AES-KWP (RFC 5649). 1261 // </li> 1262 // </ol> 1263 // 1264 // If importing symmetric key material, it is expected that the 1265 // unwrapped 1266 // key contains plain bytes. If importing asymmetric key material, it 1267 // is 1268 // expected that the unwrapped key is in PKCS#8-encoded DER format 1269 // (the 1270 // PrivateKeyInfo structure from RFC 5208). 1271 // 1272 // This format is the same as the format produced by PKCS#11 1273 // mechanism 1274 // CKM_RSA_AES_KEY_WRAP. 1275 RsaAesWrappedKey string `json:"rsaAesWrappedKey,omitempty"` 1276 1277 // ForceSendFields is a list of field names (e.g. "Algorithm") to 1278 // unconditionally include in API requests. By default, fields with 1279 // empty values are omitted from API requests. However, any non-pointer, 1280 // non-interface field appearing in ForceSendFields will be sent to the 1281 // server regardless of whether the field is empty or not. This may be 1282 // used to include empty fields in Patch requests. 1283 ForceSendFields []string `json:"-"` 1284 1285 // NullFields is a list of field names (e.g. "Algorithm") to include in 1286 // API requests with the JSON null value. By default, fields with empty 1287 // values are omitted from API requests. However, any field with an 1288 // empty value appearing in NullFields will be sent to the server as 1289 // null. It is an error if a field in this list has a non-empty value. 1290 // This may be used to include null fields in Patch requests. 1291 NullFields []string `json:"-"` 1292} 1293 1294func (s *ImportCryptoKeyVersionRequest) MarshalJSON() ([]byte, error) { 1295 type NoMethod ImportCryptoKeyVersionRequest 1296 raw := NoMethod(*s) 1297 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1298} 1299 1300// ImportJob: An ImportJob can be used to create CryptoKeys 1301// and 1302// CryptoKeyVersions using pre-existing key material, 1303// generated outside of Cloud KMS. 1304// 1305// When an ImportJob is created, Cloud KMS will generate a "wrapping 1306// key", 1307// which is a public/private key pair. You use the wrapping key to 1308// encrypt (also 1309// known as wrap) the pre-existing key material to protect it during the 1310// import 1311// process. The nature of the wrapping key depends on the choice 1312// of 1313// import_method. When the wrapping key generation 1314// is complete, the state will be set to 1315// ACTIVE and the public_key 1316// can be fetched. The fetched public key can then be used to wrap 1317// your 1318// pre-existing key material. 1319// 1320// Once the key material is wrapped, it can be imported into a 1321// new 1322// CryptoKeyVersion in an existing CryptoKey by 1323// calling 1324// ImportCryptoKeyVersion. 1325// Multiple CryptoKeyVersions can be imported with a single 1326// ImportJob. Cloud KMS uses the private key portion of the wrapping key 1327// to 1328// unwrap the key material. Only Cloud KMS has access to the private 1329// key. 1330// 1331// An ImportJob expires 3 days after it is created. Once expired, Cloud 1332// KMS 1333// will no longer be able to import or unwrap any key material that was 1334// wrapped 1335// with the ImportJob's public key. 1336// 1337// For more information, see 1338// [Importing a key](https://cloud.google.com/kms/docs/importing-a-key). 1339type ImportJob struct { 1340 // Attestation: Output only. Statement that was generated and signed by 1341 // the key creator 1342 // (for example, an HSM) at key creation time. Use this statement to 1343 // verify 1344 // attributes of the key as stored on the HSM, independently of 1345 // Google. 1346 // Only present if the chosen ImportMethod is one with a 1347 // protection 1348 // level of HSM. 1349 Attestation *KeyOperationAttestation `json:"attestation,omitempty"` 1350 1351 // CreateTime: Output only. The time at which this ImportJob was 1352 // created. 1353 CreateTime string `json:"createTime,omitempty"` 1354 1355 // ExpireEventTime: Output only. The time this ImportJob expired. Only 1356 // present if 1357 // state is EXPIRED. 1358 ExpireEventTime string `json:"expireEventTime,omitempty"` 1359 1360 // ExpireTime: Output only. The time at which this ImportJob is 1361 // scheduled for 1362 // expiration and can no longer be used to import key material. 1363 ExpireTime string `json:"expireTime,omitempty"` 1364 1365 // GenerateTime: Output only. The time this ImportJob's key material was 1366 // generated. 1367 GenerateTime string `json:"generateTime,omitempty"` 1368 1369 // ImportMethod: Required. Immutable. The wrapping method to be used for 1370 // incoming key material. 1371 // 1372 // Possible values: 1373 // "IMPORT_METHOD_UNSPECIFIED" - Not specified. 1374 // "RSA_OAEP_3072_SHA1_AES_256" - This ImportMethod represents the 1375 // CKM_RSA_AES_KEY_WRAP key wrapping 1376 // scheme defined in the PKCS #11 standard. In summary, this 1377 // involves 1378 // wrapping the raw key with an ephemeral AES key, and wrapping 1379 // the 1380 // ephemeral AES key with a 3072 bit RSA key. For more details, see 1381 // [RSA AES key 1382 // wrap 1383 // mechanism](http://docs.oasis-open.org/pkcs11/pkcs11-curr/v2.40/co 1384 // s01/pkcs11-curr-v2.40-cos01.html#_Toc408226908). 1385 // "RSA_OAEP_4096_SHA1_AES_256" - This ImportMethod represents the 1386 // CKM_RSA_AES_KEY_WRAP key wrapping 1387 // scheme defined in the PKCS #11 standard. In summary, this 1388 // involves 1389 // wrapping the raw key with an ephemeral AES key, and wrapping 1390 // the 1391 // ephemeral AES key with a 4096 bit RSA key. For more details, see 1392 // [RSA AES key 1393 // wrap 1394 // mechanism](http://docs.oasis-open.org/pkcs11/pkcs11-curr/v2.40/co 1395 // s01/pkcs11-curr-v2.40-cos01.html#_Toc408226908). 1396 ImportMethod string `json:"importMethod,omitempty"` 1397 1398 // Name: Output only. The resource name for this ImportJob in the 1399 // format 1400 // `projects/*/locations/*/keyRings/*/importJobs/*`. 1401 Name string `json:"name,omitempty"` 1402 1403 // ProtectionLevel: Required. Immutable. The protection level of the 1404 // ImportJob. This must match the 1405 // protection_level of the 1406 // version_template on the CryptoKey you 1407 // attempt to import into. 1408 // 1409 // Possible values: 1410 // "PROTECTION_LEVEL_UNSPECIFIED" - Not specified. 1411 // "SOFTWARE" - Crypto operations are performed in software. 1412 // "HSM" - Crypto operations are performed in a Hardware Security 1413 // Module. 1414 ProtectionLevel string `json:"protectionLevel,omitempty"` 1415 1416 // PublicKey: Output only. The public key with which to wrap key 1417 // material prior to 1418 // import. Only returned if state is 1419 // ACTIVE. 1420 PublicKey *WrappingPublicKey `json:"publicKey,omitempty"` 1421 1422 // State: Output only. The current state of the ImportJob, indicating if 1423 // it can 1424 // be used. 1425 // 1426 // Possible values: 1427 // "IMPORT_JOB_STATE_UNSPECIFIED" - Not specified. 1428 // "PENDING_GENERATION" - The wrapping key for this job is still being 1429 // generated. It may not be 1430 // used. Cloud KMS will automatically mark this job as 1431 // ACTIVE as soon as the wrapping key is generated. 1432 // "ACTIVE" - This job may be used in 1433 // CreateCryptoKey and 1434 // CreateCryptoKeyVersion 1435 // requests. 1436 // "EXPIRED" - This job can no longer be used and may not leave this 1437 // state once entered. 1438 State string `json:"state,omitempty"` 1439 1440 // ServerResponse contains the HTTP response code and headers from the 1441 // server. 1442 googleapi.ServerResponse `json:"-"` 1443 1444 // ForceSendFields is a list of field names (e.g. "Attestation") to 1445 // unconditionally include in API requests. By default, fields with 1446 // empty values are omitted from API requests. However, any non-pointer, 1447 // non-interface field appearing in ForceSendFields will be sent to the 1448 // server regardless of whether the field is empty or not. This may be 1449 // used to include empty fields in Patch requests. 1450 ForceSendFields []string `json:"-"` 1451 1452 // NullFields is a list of field names (e.g. "Attestation") to include 1453 // in API requests with the JSON null value. By default, fields with 1454 // empty values are omitted from API requests. However, any field with 1455 // an empty value appearing in NullFields will be sent to the server as 1456 // null. It is an error if a field in this list has a non-empty value. 1457 // This may be used to include null fields in Patch requests. 1458 NullFields []string `json:"-"` 1459} 1460 1461func (s *ImportJob) MarshalJSON() ([]byte, error) { 1462 type NoMethod ImportJob 1463 raw := NoMethod(*s) 1464 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1465} 1466 1467// KeyOperationAttestation: Contains an HSM-generated attestation about 1468// a key operation. For more 1469// information, see [Verifying 1470// attestations] 1471// (https://cloud.google.com/kms/docs/attest-key). 1472type KeyOperationAttestation struct { 1473 // Content: Output only. The attestation data provided by the HSM when 1474 // the key 1475 // operation was performed. 1476 Content string `json:"content,omitempty"` 1477 1478 // Format: Output only. The format of the attestation data. 1479 // 1480 // Possible values: 1481 // "ATTESTATION_FORMAT_UNSPECIFIED" - Not specified. 1482 // "CAVIUM_V1_COMPRESSED" - Cavium HSM attestation compressed with 1483 // gzip. Note that this format is 1484 // defined by Cavium and subject to change at any time. 1485 // "CAVIUM_V2_COMPRESSED" - Cavium HSM attestation V2 compressed with 1486 // gzip. This is a new format 1487 // introduced in Cavium's version 3.2-08. 1488 Format string `json:"format,omitempty"` 1489 1490 // ForceSendFields is a list of field names (e.g. "Content") to 1491 // unconditionally include in API requests. By default, fields with 1492 // empty values are omitted from API requests. However, any non-pointer, 1493 // non-interface field appearing in ForceSendFields will be sent to the 1494 // server regardless of whether the field is empty or not. This may be 1495 // used to include empty fields in Patch requests. 1496 ForceSendFields []string `json:"-"` 1497 1498 // NullFields is a list of field names (e.g. "Content") to include in 1499 // API requests with the JSON null value. By default, fields with empty 1500 // values are omitted from API requests. However, any field with an 1501 // empty value appearing in NullFields will be sent to the server as 1502 // null. It is an error if a field in this list has a non-empty value. 1503 // This may be used to include null fields in Patch requests. 1504 NullFields []string `json:"-"` 1505} 1506 1507func (s *KeyOperationAttestation) MarshalJSON() ([]byte, error) { 1508 type NoMethod KeyOperationAttestation 1509 raw := NoMethod(*s) 1510 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1511} 1512 1513// KeyRing: A KeyRing is a toplevel logical grouping of CryptoKeys. 1514type KeyRing struct { 1515 // CreateTime: Output only. The time at which this KeyRing was created. 1516 CreateTime string `json:"createTime,omitempty"` 1517 1518 // Name: Output only. The resource name for the KeyRing in the 1519 // format 1520 // `projects/*/locations/*/keyRings/*`. 1521 Name string `json:"name,omitempty"` 1522 1523 // ServerResponse contains the HTTP response code and headers from the 1524 // server. 1525 googleapi.ServerResponse `json:"-"` 1526 1527 // ForceSendFields is a list of field names (e.g. "CreateTime") to 1528 // unconditionally include in API requests. By default, fields with 1529 // empty values are omitted from API requests. However, any non-pointer, 1530 // non-interface field appearing in ForceSendFields will be sent to the 1531 // server regardless of whether the field is empty or not. This may be 1532 // used to include empty fields in Patch requests. 1533 ForceSendFields []string `json:"-"` 1534 1535 // NullFields is a list of field names (e.g. "CreateTime") to include in 1536 // API requests with the JSON null value. By default, fields with empty 1537 // values are omitted from API requests. However, any field with an 1538 // empty value appearing in NullFields will be sent to the server as 1539 // null. It is an error if a field in this list has a non-empty value. 1540 // This may be used to include null fields in Patch requests. 1541 NullFields []string `json:"-"` 1542} 1543 1544func (s *KeyRing) MarshalJSON() ([]byte, error) { 1545 type NoMethod KeyRing 1546 raw := NoMethod(*s) 1547 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1548} 1549 1550// ListCryptoKeyVersionsResponse: Response message for 1551// KeyManagementService.ListCryptoKeyVersions. 1552type ListCryptoKeyVersionsResponse struct { 1553 // CryptoKeyVersions: The list of CryptoKeyVersions. 1554 CryptoKeyVersions []*CryptoKeyVersion `json:"cryptoKeyVersions,omitempty"` 1555 1556 // NextPageToken: A token to retrieve next page of results. Pass this 1557 // value in 1558 // ListCryptoKeyVersionsRequest.page_token to retrieve the next page 1559 // of 1560 // results. 1561 NextPageToken string `json:"nextPageToken,omitempty"` 1562 1563 // TotalSize: The total number of CryptoKeyVersions that matched 1564 // the 1565 // query. 1566 TotalSize int64 `json:"totalSize,omitempty"` 1567 1568 // ServerResponse contains the HTTP response code and headers from the 1569 // server. 1570 googleapi.ServerResponse `json:"-"` 1571 1572 // ForceSendFields is a list of field names (e.g. "CryptoKeyVersions") 1573 // to unconditionally include in API requests. By default, fields with 1574 // empty values are omitted from API requests. However, any non-pointer, 1575 // non-interface field appearing in ForceSendFields will be sent to the 1576 // server regardless of whether the field is empty or not. This may be 1577 // used to include empty fields in Patch requests. 1578 ForceSendFields []string `json:"-"` 1579 1580 // NullFields is a list of field names (e.g. "CryptoKeyVersions") to 1581 // include in API requests with the JSON null value. By default, fields 1582 // with empty values are omitted from API requests. However, any field 1583 // with an empty value appearing in NullFields will be sent to the 1584 // server as null. It is an error if a field in this list has a 1585 // non-empty value. This may be used to include null fields in Patch 1586 // requests. 1587 NullFields []string `json:"-"` 1588} 1589 1590func (s *ListCryptoKeyVersionsResponse) MarshalJSON() ([]byte, error) { 1591 type NoMethod ListCryptoKeyVersionsResponse 1592 raw := NoMethod(*s) 1593 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1594} 1595 1596// ListCryptoKeysResponse: Response message for 1597// KeyManagementService.ListCryptoKeys. 1598type ListCryptoKeysResponse struct { 1599 // CryptoKeys: The list of CryptoKeys. 1600 CryptoKeys []*CryptoKey `json:"cryptoKeys,omitempty"` 1601 1602 // NextPageToken: A token to retrieve next page of results. Pass this 1603 // value in 1604 // ListCryptoKeysRequest.page_token to retrieve the next page of 1605 // results. 1606 NextPageToken string `json:"nextPageToken,omitempty"` 1607 1608 // TotalSize: The total number of CryptoKeys that matched the query. 1609 TotalSize int64 `json:"totalSize,omitempty"` 1610 1611 // ServerResponse contains the HTTP response code and headers from the 1612 // server. 1613 googleapi.ServerResponse `json:"-"` 1614 1615 // ForceSendFields is a list of field names (e.g. "CryptoKeys") to 1616 // unconditionally include in API requests. By default, fields with 1617 // empty values are omitted from API requests. However, any non-pointer, 1618 // non-interface field appearing in ForceSendFields will be sent to the 1619 // server regardless of whether the field is empty or not. This may be 1620 // used to include empty fields in Patch requests. 1621 ForceSendFields []string `json:"-"` 1622 1623 // NullFields is a list of field names (e.g. "CryptoKeys") to include in 1624 // API requests with the JSON null value. By default, fields with empty 1625 // values are omitted from API requests. However, any field with an 1626 // empty value appearing in NullFields will be sent to the server as 1627 // null. It is an error if a field in this list has a non-empty value. 1628 // This may be used to include null fields in Patch requests. 1629 NullFields []string `json:"-"` 1630} 1631 1632func (s *ListCryptoKeysResponse) MarshalJSON() ([]byte, error) { 1633 type NoMethod ListCryptoKeysResponse 1634 raw := NoMethod(*s) 1635 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1636} 1637 1638// ListImportJobsResponse: Response message for 1639// KeyManagementService.ListImportJobs. 1640type ListImportJobsResponse struct { 1641 // ImportJobs: The list of ImportJobs. 1642 ImportJobs []*ImportJob `json:"importJobs,omitempty"` 1643 1644 // NextPageToken: A token to retrieve next page of results. Pass this 1645 // value in 1646 // ListImportJobsRequest.page_token to retrieve the next page of 1647 // results. 1648 NextPageToken string `json:"nextPageToken,omitempty"` 1649 1650 // TotalSize: The total number of ImportJobs that matched the query. 1651 TotalSize int64 `json:"totalSize,omitempty"` 1652 1653 // ServerResponse contains the HTTP response code and headers from the 1654 // server. 1655 googleapi.ServerResponse `json:"-"` 1656 1657 // ForceSendFields is a list of field names (e.g. "ImportJobs") to 1658 // unconditionally include in API requests. By default, fields with 1659 // empty values are omitted from API requests. However, any non-pointer, 1660 // non-interface field appearing in ForceSendFields will be sent to the 1661 // server regardless of whether the field is empty or not. This may be 1662 // used to include empty fields in Patch requests. 1663 ForceSendFields []string `json:"-"` 1664 1665 // NullFields is a list of field names (e.g. "ImportJobs") to include in 1666 // API requests with the JSON null value. By default, fields with empty 1667 // values are omitted from API requests. However, any field with an 1668 // empty value appearing in NullFields will be sent to the server as 1669 // null. It is an error if a field in this list has a non-empty value. 1670 // This may be used to include null fields in Patch requests. 1671 NullFields []string `json:"-"` 1672} 1673 1674func (s *ListImportJobsResponse) MarshalJSON() ([]byte, error) { 1675 type NoMethod ListImportJobsResponse 1676 raw := NoMethod(*s) 1677 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1678} 1679 1680// ListKeyRingsResponse: Response message for 1681// KeyManagementService.ListKeyRings. 1682type ListKeyRingsResponse struct { 1683 // KeyRings: The list of KeyRings. 1684 KeyRings []*KeyRing `json:"keyRings,omitempty"` 1685 1686 // NextPageToken: A token to retrieve next page of results. Pass this 1687 // value in 1688 // ListKeyRingsRequest.page_token to retrieve the next page of results. 1689 NextPageToken string `json:"nextPageToken,omitempty"` 1690 1691 // TotalSize: The total number of KeyRings that matched the query. 1692 TotalSize int64 `json:"totalSize,omitempty"` 1693 1694 // ServerResponse contains the HTTP response code and headers from the 1695 // server. 1696 googleapi.ServerResponse `json:"-"` 1697 1698 // ForceSendFields is a list of field names (e.g. "KeyRings") to 1699 // unconditionally include in API requests. By default, fields with 1700 // empty values are omitted from API requests. However, any non-pointer, 1701 // non-interface field appearing in ForceSendFields will be sent to the 1702 // server regardless of whether the field is empty or not. This may be 1703 // used to include empty fields in Patch requests. 1704 ForceSendFields []string `json:"-"` 1705 1706 // NullFields is a list of field names (e.g. "KeyRings") to include in 1707 // API requests with the JSON null value. By default, fields with empty 1708 // values are omitted from API requests. However, any field with an 1709 // empty value appearing in NullFields will be sent to the server as 1710 // null. It is an error if a field in this list has a non-empty value. 1711 // This may be used to include null fields in Patch requests. 1712 NullFields []string `json:"-"` 1713} 1714 1715func (s *ListKeyRingsResponse) MarshalJSON() ([]byte, error) { 1716 type NoMethod ListKeyRingsResponse 1717 raw := NoMethod(*s) 1718 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1719} 1720 1721// ListLocationsResponse: The response message for 1722// Locations.ListLocations. 1723type ListLocationsResponse struct { 1724 // Locations: A list of locations that matches the specified filter in 1725 // the request. 1726 Locations []*Location `json:"locations,omitempty"` 1727 1728 // NextPageToken: The standard List next-page token. 1729 NextPageToken string `json:"nextPageToken,omitempty"` 1730 1731 // ServerResponse contains the HTTP response code and headers from the 1732 // server. 1733 googleapi.ServerResponse `json:"-"` 1734 1735 // ForceSendFields is a list of field names (e.g. "Locations") to 1736 // unconditionally include in API requests. By default, fields with 1737 // empty values are omitted from API requests. However, any non-pointer, 1738 // non-interface field appearing in ForceSendFields will be sent to the 1739 // server regardless of whether the field is empty or not. This may be 1740 // used to include empty fields in Patch requests. 1741 ForceSendFields []string `json:"-"` 1742 1743 // NullFields is a list of field names (e.g. "Locations") to include in 1744 // API requests with the JSON null value. By default, fields with empty 1745 // values are omitted from API requests. However, any field with an 1746 // empty value appearing in NullFields will be sent to the server as 1747 // null. It is an error if a field in this list has a non-empty value. 1748 // This may be used to include null fields in Patch requests. 1749 NullFields []string `json:"-"` 1750} 1751 1752func (s *ListLocationsResponse) MarshalJSON() ([]byte, error) { 1753 type NoMethod ListLocationsResponse 1754 raw := NoMethod(*s) 1755 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1756} 1757 1758// Location: A resource that represents Google Cloud Platform location. 1759type Location struct { 1760 // DisplayName: The friendly name for this location, typically a nearby 1761 // city name. 1762 // For example, "Tokyo". 1763 DisplayName string `json:"displayName,omitempty"` 1764 1765 // Labels: Cross-service attributes for the location. For example 1766 // 1767 // {"cloud.googleapis.com/region": "us-east1"} 1768 Labels map[string]string `json:"labels,omitempty"` 1769 1770 // LocationId: The canonical id for this location. For example: 1771 // "us-east1". 1772 LocationId string `json:"locationId,omitempty"` 1773 1774 // Metadata: Service-specific metadata. For example the available 1775 // capacity at the given 1776 // location. 1777 Metadata googleapi.RawMessage `json:"metadata,omitempty"` 1778 1779 // Name: Resource name for the location, which may vary between 1780 // implementations. 1781 // For example: "projects/example-project/locations/us-east1" 1782 Name string `json:"name,omitempty"` 1783 1784 // ServerResponse contains the HTTP response code and headers from the 1785 // server. 1786 googleapi.ServerResponse `json:"-"` 1787 1788 // ForceSendFields is a list of field names (e.g. "DisplayName") to 1789 // unconditionally include in API requests. By default, fields with 1790 // empty values are omitted from API requests. However, any non-pointer, 1791 // non-interface field appearing in ForceSendFields will be sent to the 1792 // server regardless of whether the field is empty or not. This may be 1793 // used to include empty fields in Patch requests. 1794 ForceSendFields []string `json:"-"` 1795 1796 // NullFields is a list of field names (e.g. "DisplayName") to include 1797 // in API requests with the JSON null value. By default, fields with 1798 // empty values are omitted from API requests. However, any field with 1799 // an empty value appearing in NullFields will be sent to the server as 1800 // null. It is an error if a field in this list has a non-empty value. 1801 // This may be used to include null fields in Patch requests. 1802 NullFields []string `json:"-"` 1803} 1804 1805func (s *Location) MarshalJSON() ([]byte, error) { 1806 type NoMethod Location 1807 raw := NoMethod(*s) 1808 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1809} 1810 1811// LocationMetadata: Cloud KMS metadata for the given 1812// google.cloud.location.Location. 1813type LocationMetadata struct { 1814 // HsmAvailable: Indicates whether CryptoKeys with 1815 // protection_level 1816 // HSM can be created in this location. 1817 HsmAvailable bool `json:"hsmAvailable,omitempty"` 1818 1819 // ForceSendFields is a list of field names (e.g. "HsmAvailable") to 1820 // unconditionally include in API requests. By default, fields with 1821 // empty values are omitted from API requests. However, any non-pointer, 1822 // non-interface field appearing in ForceSendFields will be sent to the 1823 // server regardless of whether the field is empty or not. This may be 1824 // used to include empty fields in Patch requests. 1825 ForceSendFields []string `json:"-"` 1826 1827 // NullFields is a list of field names (e.g. "HsmAvailable") to include 1828 // in API requests with the JSON null value. By default, fields with 1829 // empty values are omitted from API requests. However, any field with 1830 // an empty value appearing in NullFields will be sent to the server as 1831 // null. It is an error if a field in this list has a non-empty value. 1832 // This may be used to include null fields in Patch requests. 1833 NullFields []string `json:"-"` 1834} 1835 1836func (s *LocationMetadata) MarshalJSON() ([]byte, error) { 1837 type NoMethod LocationMetadata 1838 raw := NoMethod(*s) 1839 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1840} 1841 1842// Policy: Defines an Identity and Access Management (IAM) policy. It is 1843// used to 1844// specify access control policies for Cloud Platform resources. 1845// 1846// 1847// A `Policy` is a collection of `bindings`. A `binding` binds one or 1848// more 1849// `members` to a single `role`. Members can be user accounts, service 1850// accounts, 1851// Google groups, and domains (such as G Suite). A `role` is a named 1852// list of 1853// permissions (defined by IAM or configured by users). A `binding` 1854// can 1855// optionally specify a `condition`, which is a logic expression that 1856// further 1857// constrains the role binding based on attributes about the request 1858// and/or 1859// target resource. 1860// 1861// **JSON Example** 1862// 1863// { 1864// "bindings": [ 1865// { 1866// "role": "roles/resourcemanager.organizationAdmin", 1867// "members": [ 1868// "user:mike@example.com", 1869// "group:admins@example.com", 1870// "domain:google.com", 1871// 1872// "serviceAccount:my-project-id@appspot.gserviceaccount.com" 1873// ] 1874// }, 1875// { 1876// "role": "roles/resourcemanager.organizationViewer", 1877// "members": ["user:eve@example.com"], 1878// "condition": { 1879// "title": "expirable access", 1880// "description": "Does not grant access after Sep 2020", 1881// "expression": "request.time < 1882// timestamp('2020-10-01T00:00:00.000Z')", 1883// } 1884// } 1885// ] 1886// } 1887// 1888// **YAML Example** 1889// 1890// bindings: 1891// - members: 1892// - user:mike@example.com 1893// - group:admins@example.com 1894// - domain:google.com 1895// - serviceAccount:my-project-id@appspot.gserviceaccount.com 1896// role: roles/resourcemanager.organizationAdmin 1897// - members: 1898// - user:eve@example.com 1899// role: roles/resourcemanager.organizationViewer 1900// condition: 1901// title: expirable access 1902// description: Does not grant access after Sep 2020 1903// expression: request.time < 1904// timestamp('2020-10-01T00:00:00.000Z') 1905// 1906// For a description of IAM and its features, see the 1907// [IAM developer's guide](https://cloud.google.com/iam/docs). 1908type Policy struct { 1909 // AuditConfigs: Specifies cloud audit logging configuration for this 1910 // policy. 1911 AuditConfigs []*AuditConfig `json:"auditConfigs,omitempty"` 1912 1913 // Bindings: Associates a list of `members` to a `role`. Optionally may 1914 // specify a 1915 // `condition` that determines when binding is in effect. 1916 // `bindings` with no members will result in an error. 1917 Bindings []*Binding `json:"bindings,omitempty"` 1918 1919 // Etag: `etag` is used for optimistic concurrency control as a way to 1920 // help 1921 // prevent simultaneous updates of a policy from overwriting each 1922 // other. 1923 // It is strongly suggested that systems make use of the `etag` in 1924 // the 1925 // read-modify-write cycle to perform policy updates in order to avoid 1926 // race 1927 // conditions: An `etag` is returned in the response to `getIamPolicy`, 1928 // and 1929 // systems are expected to put that etag in the request to 1930 // `setIamPolicy` to 1931 // ensure that their change will be applied to the same version of the 1932 // policy. 1933 // 1934 // If no `etag` is provided in the call to `setIamPolicy`, then the 1935 // existing 1936 // policy is overwritten. Due to blind-set semantics of an etag-less 1937 // policy, 1938 // 'setIamPolicy' will not fail even if either of incoming or stored 1939 // policy 1940 // does not meet the version requirements. 1941 Etag string `json:"etag,omitempty"` 1942 1943 // Version: Specifies the format of the policy. 1944 // 1945 // Valid values are 0, 1, and 3. Requests specifying an invalid value 1946 // will be 1947 // rejected. 1948 // 1949 // Operations affecting conditional bindings must specify version 3. 1950 // This can 1951 // be either setting a conditional policy, modifying a conditional 1952 // binding, 1953 // or removing a conditional binding from the stored conditional 1954 // policy. 1955 // Operations on non-conditional policies may specify any valid value 1956 // or 1957 // leave the field unset. 1958 // 1959 // If no etag is provided in the call to `setIamPolicy`, any 1960 // version 1961 // compliance checks on the incoming and/or stored policy is skipped. 1962 Version int64 `json:"version,omitempty"` 1963 1964 // ServerResponse contains the HTTP response code and headers from the 1965 // server. 1966 googleapi.ServerResponse `json:"-"` 1967 1968 // ForceSendFields is a list of field names (e.g. "AuditConfigs") to 1969 // unconditionally include in API requests. By default, fields with 1970 // empty values are omitted from API requests. However, any non-pointer, 1971 // non-interface field appearing in ForceSendFields will be sent to the 1972 // server regardless of whether the field is empty or not. This may be 1973 // used to include empty fields in Patch requests. 1974 ForceSendFields []string `json:"-"` 1975 1976 // NullFields is a list of field names (e.g. "AuditConfigs") to include 1977 // in API requests with the JSON null value. By default, fields with 1978 // empty values are omitted from API requests. However, any field with 1979 // an empty value appearing in NullFields will be sent to the server as 1980 // null. It is an error if a field in this list has a non-empty value. 1981 // This may be used to include null fields in Patch requests. 1982 NullFields []string `json:"-"` 1983} 1984 1985func (s *Policy) MarshalJSON() ([]byte, error) { 1986 type NoMethod Policy 1987 raw := NoMethod(*s) 1988 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1989} 1990 1991// PublicKey: The public key for a given CryptoKeyVersion. Obtained 1992// via 1993// GetPublicKey. 1994type PublicKey struct { 1995 // Algorithm: The Algorithm associated 1996 // with this key. 1997 // 1998 // Possible values: 1999 // "CRYPTO_KEY_VERSION_ALGORITHM_UNSPECIFIED" - Not specified. 2000 // "GOOGLE_SYMMETRIC_ENCRYPTION" - Creates symmetric encryption keys. 2001 // "RSA_SIGN_PSS_2048_SHA256" - RSASSA-PSS 2048 bit key with a SHA256 2002 // digest. 2003 // "RSA_SIGN_PSS_3072_SHA256" - RSASSA-PSS 3072 bit key with a SHA256 2004 // digest. 2005 // "RSA_SIGN_PSS_4096_SHA256" - RSASSA-PSS 4096 bit key with a SHA256 2006 // digest. 2007 // "RSA_SIGN_PSS_4096_SHA512" - RSASSA-PSS 4096 bit key with a SHA512 2008 // digest. 2009 // "RSA_SIGN_PKCS1_2048_SHA256" - RSASSA-PKCS1-v1_5 with a 2048 bit 2010 // key and a SHA256 digest. 2011 // "RSA_SIGN_PKCS1_3072_SHA256" - RSASSA-PKCS1-v1_5 with a 3072 bit 2012 // key and a SHA256 digest. 2013 // "RSA_SIGN_PKCS1_4096_SHA256" - RSASSA-PKCS1-v1_5 with a 4096 bit 2014 // key and a SHA256 digest. 2015 // "RSA_SIGN_PKCS1_4096_SHA512" - RSASSA-PKCS1-v1_5 with a 4096 bit 2016 // key and a SHA512 digest. 2017 // "RSA_DECRYPT_OAEP_2048_SHA256" - RSAES-OAEP 2048 bit key with a 2018 // SHA256 digest. 2019 // "RSA_DECRYPT_OAEP_3072_SHA256" - RSAES-OAEP 3072 bit key with a 2020 // SHA256 digest. 2021 // "RSA_DECRYPT_OAEP_4096_SHA256" - RSAES-OAEP 4096 bit key with a 2022 // SHA256 digest. 2023 // "RSA_DECRYPT_OAEP_4096_SHA512" - RSAES-OAEP 4096 bit key with a 2024 // SHA512 digest. 2025 // "EC_SIGN_P256_SHA256" - ECDSA on the NIST P-256 curve with a SHA256 2026 // digest. 2027 // "EC_SIGN_P384_SHA384" - ECDSA on the NIST P-384 curve with a SHA384 2028 // digest. 2029 Algorithm string `json:"algorithm,omitempty"` 2030 2031 // Pem: The public key, encoded in PEM format. For more information, see 2032 // the 2033 // [RFC 7468](https://tools.ietf.org/html/rfc7468) sections for 2034 // [General 2035 // Considerations](https://tools.ietf.org/html/rfc7468#section-2) 2036 // and 2037 // [Textual Encoding of Subject Public Key 2038 // Info] 2039 // (https://tools.ietf.org/html/rfc7468#section-13). 2040 Pem string `json:"pem,omitempty"` 2041 2042 // ServerResponse contains the HTTP response code and headers from the 2043 // server. 2044 googleapi.ServerResponse `json:"-"` 2045 2046 // ForceSendFields is a list of field names (e.g. "Algorithm") to 2047 // unconditionally include in API requests. By default, fields with 2048 // empty values are omitted from API requests. However, any non-pointer, 2049 // non-interface field appearing in ForceSendFields will be sent to the 2050 // server regardless of whether the field is empty or not. This may be 2051 // used to include empty fields in Patch requests. 2052 ForceSendFields []string `json:"-"` 2053 2054 // NullFields is a list of field names (e.g. "Algorithm") to include in 2055 // API requests with the JSON null value. By default, fields with empty 2056 // values are omitted from API requests. However, any field with an 2057 // empty value appearing in NullFields will be sent to the server as 2058 // null. It is an error if a field in this list has a non-empty value. 2059 // This may be used to include null fields in Patch requests. 2060 NullFields []string `json:"-"` 2061} 2062 2063func (s *PublicKey) MarshalJSON() ([]byte, error) { 2064 type NoMethod PublicKey 2065 raw := NoMethod(*s) 2066 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2067} 2068 2069// RestoreCryptoKeyVersionRequest: Request message for 2070// KeyManagementService.RestoreCryptoKeyVersion. 2071type RestoreCryptoKeyVersionRequest struct { 2072} 2073 2074// SetIamPolicyRequest: Request message for `SetIamPolicy` method. 2075type SetIamPolicyRequest struct { 2076 // Policy: REQUIRED: The complete policy to be applied to the 2077 // `resource`. The size of 2078 // the policy is limited to a few 10s of KB. An empty policy is a 2079 // valid policy but certain Cloud Platform services (such as 2080 // Projects) 2081 // might reject them. 2082 Policy *Policy `json:"policy,omitempty"` 2083 2084 // UpdateMask: OPTIONAL: A FieldMask specifying which fields of the 2085 // policy to modify. Only 2086 // the fields in the mask will be modified. If no mask is provided, 2087 // the 2088 // following default mask is used: 2089 // paths: "bindings, etag" 2090 // This field is only used by Cloud IAM. 2091 UpdateMask string `json:"updateMask,omitempty"` 2092 2093 // ForceSendFields is a list of field names (e.g. "Policy") to 2094 // unconditionally include in API requests. By default, fields with 2095 // empty values are omitted from API requests. However, any non-pointer, 2096 // non-interface field appearing in ForceSendFields will be sent to the 2097 // server regardless of whether the field is empty or not. This may be 2098 // used to include empty fields in Patch requests. 2099 ForceSendFields []string `json:"-"` 2100 2101 // NullFields is a list of field names (e.g. "Policy") to include in API 2102 // requests with the JSON null value. By default, fields with empty 2103 // values are omitted from API requests. However, any field with an 2104 // empty value appearing in NullFields will be sent to the server as 2105 // null. It is an error if a field in this list has a non-empty value. 2106 // This may be used to include null fields in Patch requests. 2107 NullFields []string `json:"-"` 2108} 2109 2110func (s *SetIamPolicyRequest) MarshalJSON() ([]byte, error) { 2111 type NoMethod SetIamPolicyRequest 2112 raw := NoMethod(*s) 2113 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2114} 2115 2116// TestIamPermissionsRequest: Request message for `TestIamPermissions` 2117// method. 2118type TestIamPermissionsRequest struct { 2119 // Permissions: The set of permissions to check for the `resource`. 2120 // Permissions with 2121 // wildcards (such as '*' or 'storage.*') are not allowed. For 2122 // more 2123 // information see 2124 // [IAM 2125 // Overview](https://cloud.google.com/iam/docs/overview#permissions). 2126 Permissions []string `json:"permissions,omitempty"` 2127 2128 // ForceSendFields is a list of field names (e.g. "Permissions") to 2129 // unconditionally include in API requests. By default, fields with 2130 // empty values are omitted from API requests. However, any non-pointer, 2131 // non-interface field appearing in ForceSendFields will be sent to the 2132 // server regardless of whether the field is empty or not. This may be 2133 // used to include empty fields in Patch requests. 2134 ForceSendFields []string `json:"-"` 2135 2136 // NullFields is a list of field names (e.g. "Permissions") to include 2137 // in API requests with the JSON null value. By default, fields with 2138 // empty values are omitted from API requests. However, any field with 2139 // an empty value appearing in NullFields will be sent to the server as 2140 // null. It is an error if a field in this list has a non-empty value. 2141 // This may be used to include null fields in Patch requests. 2142 NullFields []string `json:"-"` 2143} 2144 2145func (s *TestIamPermissionsRequest) MarshalJSON() ([]byte, error) { 2146 type NoMethod TestIamPermissionsRequest 2147 raw := NoMethod(*s) 2148 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2149} 2150 2151// TestIamPermissionsResponse: Response message for `TestIamPermissions` 2152// method. 2153type TestIamPermissionsResponse struct { 2154 // Permissions: A subset of `TestPermissionsRequest.permissions` that 2155 // the caller is 2156 // allowed. 2157 Permissions []string `json:"permissions,omitempty"` 2158 2159 // ServerResponse contains the HTTP response code and headers from the 2160 // server. 2161 googleapi.ServerResponse `json:"-"` 2162 2163 // ForceSendFields is a list of field names (e.g. "Permissions") to 2164 // unconditionally include in API requests. By default, fields with 2165 // empty values are omitted from API requests. However, any non-pointer, 2166 // non-interface field appearing in ForceSendFields will be sent to the 2167 // server regardless of whether the field is empty or not. This may be 2168 // used to include empty fields in Patch requests. 2169 ForceSendFields []string `json:"-"` 2170 2171 // NullFields is a list of field names (e.g. "Permissions") to include 2172 // in API requests with the JSON null value. By default, fields with 2173 // empty values are omitted from API requests. However, any field with 2174 // an empty value appearing in NullFields will be sent to the server as 2175 // null. It is an error if a field in this list has a non-empty value. 2176 // This may be used to include null fields in Patch requests. 2177 NullFields []string `json:"-"` 2178} 2179 2180func (s *TestIamPermissionsResponse) MarshalJSON() ([]byte, error) { 2181 type NoMethod TestIamPermissionsResponse 2182 raw := NoMethod(*s) 2183 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2184} 2185 2186// UpdateCryptoKeyPrimaryVersionRequest: Request message for 2187// KeyManagementService.UpdateCryptoKeyPrimaryVersion. 2188type UpdateCryptoKeyPrimaryVersionRequest struct { 2189 // CryptoKeyVersionId: Required. The id of the child CryptoKeyVersion to 2190 // use as primary. 2191 CryptoKeyVersionId string `json:"cryptoKeyVersionId,omitempty"` 2192 2193 // ForceSendFields is a list of field names (e.g. "CryptoKeyVersionId") 2194 // to unconditionally include in API requests. By default, fields with 2195 // empty values are omitted from API requests. However, any non-pointer, 2196 // non-interface field appearing in ForceSendFields will be sent to the 2197 // server regardless of whether the field is empty or not. This may be 2198 // used to include empty fields in Patch requests. 2199 ForceSendFields []string `json:"-"` 2200 2201 // NullFields is a list of field names (e.g. "CryptoKeyVersionId") to 2202 // include in API requests with the JSON null value. By default, fields 2203 // with empty values are omitted from API requests. However, any field 2204 // with an empty value appearing in NullFields will be sent to the 2205 // server as null. It is an error if a field in this list has a 2206 // non-empty value. This may be used to include null fields in Patch 2207 // requests. 2208 NullFields []string `json:"-"` 2209} 2210 2211func (s *UpdateCryptoKeyPrimaryVersionRequest) MarshalJSON() ([]byte, error) { 2212 type NoMethod UpdateCryptoKeyPrimaryVersionRequest 2213 raw := NoMethod(*s) 2214 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2215} 2216 2217// WrappingPublicKey: The public key component of the wrapping key. For 2218// details of the type of 2219// key this public key corresponds to, see the ImportMethod. 2220type WrappingPublicKey struct { 2221 // Pem: The public key, encoded in PEM format. For more information, see 2222 // the [RFC 2223 // 7468](https://tools.ietf.org/html/rfc7468) sections for 2224 // [General 2225 // Considerations](https://tools.ietf.org/html/rfc7468#section-2 2226 // ) and 2227 // [Textual Encoding of Subject Public Key 2228 // Info] 2229 // (https://tools.ietf.org/html/rfc7468#section-13). 2230 Pem string `json:"pem,omitempty"` 2231 2232 // ForceSendFields is a list of field names (e.g. "Pem") to 2233 // unconditionally include in API requests. By default, fields with 2234 // empty values are omitted from API requests. However, any non-pointer, 2235 // non-interface field appearing in ForceSendFields will be sent to the 2236 // server regardless of whether the field is empty or not. This may be 2237 // used to include empty fields in Patch requests. 2238 ForceSendFields []string `json:"-"` 2239 2240 // NullFields is a list of field names (e.g. "Pem") to include in API 2241 // requests with the JSON null value. By default, fields with empty 2242 // values are omitted from API requests. However, any field with an 2243 // empty value appearing in NullFields will be sent to the server as 2244 // null. It is an error if a field in this list has a non-empty value. 2245 // This may be used to include null fields in Patch requests. 2246 NullFields []string `json:"-"` 2247} 2248 2249func (s *WrappingPublicKey) MarshalJSON() ([]byte, error) { 2250 type NoMethod WrappingPublicKey 2251 raw := NoMethod(*s) 2252 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2253} 2254 2255// method id "cloudkms.projects.locations.get": 2256 2257type ProjectsLocationsGetCall struct { 2258 s *Service 2259 name string 2260 urlParams_ gensupport.URLParams 2261 ifNoneMatch_ string 2262 ctx_ context.Context 2263 header_ http.Header 2264} 2265 2266// Get: Gets information about a location. 2267func (r *ProjectsLocationsService) Get(name string) *ProjectsLocationsGetCall { 2268 c := &ProjectsLocationsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 2269 c.name = name 2270 return c 2271} 2272 2273// Fields allows partial responses to be retrieved. See 2274// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 2275// for more information. 2276func (c *ProjectsLocationsGetCall) Fields(s ...googleapi.Field) *ProjectsLocationsGetCall { 2277 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 2278 return c 2279} 2280 2281// IfNoneMatch sets the optional parameter which makes the operation 2282// fail if the object's ETag matches the given value. This is useful for 2283// getting updates only after the object has changed since the last 2284// request. Use googleapi.IsNotModified to check whether the response 2285// error from Do is the result of In-None-Match. 2286func (c *ProjectsLocationsGetCall) IfNoneMatch(entityTag string) *ProjectsLocationsGetCall { 2287 c.ifNoneMatch_ = entityTag 2288 return c 2289} 2290 2291// Context sets the context to be used in this call's Do method. Any 2292// pending HTTP request will be aborted if the provided context is 2293// canceled. 2294func (c *ProjectsLocationsGetCall) Context(ctx context.Context) *ProjectsLocationsGetCall { 2295 c.ctx_ = ctx 2296 return c 2297} 2298 2299// Header returns an http.Header that can be modified by the caller to 2300// add HTTP headers to the request. 2301func (c *ProjectsLocationsGetCall) Header() http.Header { 2302 if c.header_ == nil { 2303 c.header_ = make(http.Header) 2304 } 2305 return c.header_ 2306} 2307 2308func (c *ProjectsLocationsGetCall) doRequest(alt string) (*http.Response, error) { 2309 reqHeaders := make(http.Header) 2310 reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190926") 2311 for k, v := range c.header_ { 2312 reqHeaders[k] = v 2313 } 2314 reqHeaders.Set("User-Agent", c.s.userAgent()) 2315 if c.ifNoneMatch_ != "" { 2316 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 2317 } 2318 var body io.Reader = nil 2319 c.urlParams_.Set("alt", alt) 2320 c.urlParams_.Set("prettyPrint", "false") 2321 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}") 2322 urls += "?" + c.urlParams_.Encode() 2323 req, err := http.NewRequest("GET", urls, body) 2324 if err != nil { 2325 return nil, err 2326 } 2327 req.Header = reqHeaders 2328 googleapi.Expand(req.URL, map[string]string{ 2329 "name": c.name, 2330 }) 2331 return gensupport.SendRequest(c.ctx_, c.s.client, req) 2332} 2333 2334// Do executes the "cloudkms.projects.locations.get" call. 2335// Exactly one of *Location or error will be non-nil. Any non-2xx status 2336// code is an error. Response headers are in either 2337// *Location.ServerResponse.Header or (if a response was returned at 2338// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 2339// to check whether the returned error was because 2340// http.StatusNotModified was returned. 2341func (c *ProjectsLocationsGetCall) Do(opts ...googleapi.CallOption) (*Location, error) { 2342 gensupport.SetOptions(c.urlParams_, opts...) 2343 res, err := c.doRequest("json") 2344 if res != nil && res.StatusCode == http.StatusNotModified { 2345 if res.Body != nil { 2346 res.Body.Close() 2347 } 2348 return nil, &googleapi.Error{ 2349 Code: res.StatusCode, 2350 Header: res.Header, 2351 } 2352 } 2353 if err != nil { 2354 return nil, err 2355 } 2356 defer googleapi.CloseBody(res) 2357 if err := googleapi.CheckResponse(res); err != nil { 2358 return nil, err 2359 } 2360 ret := &Location{ 2361 ServerResponse: googleapi.ServerResponse{ 2362 Header: res.Header, 2363 HTTPStatusCode: res.StatusCode, 2364 }, 2365 } 2366 target := &ret 2367 if err := gensupport.DecodeResponse(target, res); err != nil { 2368 return nil, err 2369 } 2370 return ret, nil 2371 // { 2372 // "description": "Gets information about a location.", 2373 // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}", 2374 // "httpMethod": "GET", 2375 // "id": "cloudkms.projects.locations.get", 2376 // "parameterOrder": [ 2377 // "name" 2378 // ], 2379 // "parameters": { 2380 // "name": { 2381 // "description": "Resource name for the location.", 2382 // "location": "path", 2383 // "pattern": "^projects/[^/]+/locations/[^/]+$", 2384 // "required": true, 2385 // "type": "string" 2386 // } 2387 // }, 2388 // "path": "v1/{+name}", 2389 // "response": { 2390 // "$ref": "Location" 2391 // }, 2392 // "scopes": [ 2393 // "https://www.googleapis.com/auth/cloud-platform", 2394 // "https://www.googleapis.com/auth/cloudkms" 2395 // ] 2396 // } 2397 2398} 2399 2400// method id "cloudkms.projects.locations.list": 2401 2402type ProjectsLocationsListCall struct { 2403 s *Service 2404 name string 2405 urlParams_ gensupport.URLParams 2406 ifNoneMatch_ string 2407 ctx_ context.Context 2408 header_ http.Header 2409} 2410 2411// List: Lists information about the supported locations for this 2412// service. 2413func (r *ProjectsLocationsService) List(name string) *ProjectsLocationsListCall { 2414 c := &ProjectsLocationsListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 2415 c.name = name 2416 return c 2417} 2418 2419// Filter sets the optional parameter "filter": The standard list 2420// filter. 2421func (c *ProjectsLocationsListCall) Filter(filter string) *ProjectsLocationsListCall { 2422 c.urlParams_.Set("filter", filter) 2423 return c 2424} 2425 2426// PageSize sets the optional parameter "pageSize": The standard list 2427// page size. 2428func (c *ProjectsLocationsListCall) PageSize(pageSize int64) *ProjectsLocationsListCall { 2429 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize)) 2430 return c 2431} 2432 2433// PageToken sets the optional parameter "pageToken": The standard list 2434// page token. 2435func (c *ProjectsLocationsListCall) PageToken(pageToken string) *ProjectsLocationsListCall { 2436 c.urlParams_.Set("pageToken", pageToken) 2437 return c 2438} 2439 2440// Fields allows partial responses to be retrieved. See 2441// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 2442// for more information. 2443func (c *ProjectsLocationsListCall) Fields(s ...googleapi.Field) *ProjectsLocationsListCall { 2444 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 2445 return c 2446} 2447 2448// IfNoneMatch sets the optional parameter which makes the operation 2449// fail if the object's ETag matches the given value. This is useful for 2450// getting updates only after the object has changed since the last 2451// request. Use googleapi.IsNotModified to check whether the response 2452// error from Do is the result of In-None-Match. 2453func (c *ProjectsLocationsListCall) IfNoneMatch(entityTag string) *ProjectsLocationsListCall { 2454 c.ifNoneMatch_ = entityTag 2455 return c 2456} 2457 2458// Context sets the context to be used in this call's Do method. Any 2459// pending HTTP request will be aborted if the provided context is 2460// canceled. 2461func (c *ProjectsLocationsListCall) Context(ctx context.Context) *ProjectsLocationsListCall { 2462 c.ctx_ = ctx 2463 return c 2464} 2465 2466// Header returns an http.Header that can be modified by the caller to 2467// add HTTP headers to the request. 2468func (c *ProjectsLocationsListCall) Header() http.Header { 2469 if c.header_ == nil { 2470 c.header_ = make(http.Header) 2471 } 2472 return c.header_ 2473} 2474 2475func (c *ProjectsLocationsListCall) doRequest(alt string) (*http.Response, error) { 2476 reqHeaders := make(http.Header) 2477 reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190926") 2478 for k, v := range c.header_ { 2479 reqHeaders[k] = v 2480 } 2481 reqHeaders.Set("User-Agent", c.s.userAgent()) 2482 if c.ifNoneMatch_ != "" { 2483 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 2484 } 2485 var body io.Reader = nil 2486 c.urlParams_.Set("alt", alt) 2487 c.urlParams_.Set("prettyPrint", "false") 2488 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}/locations") 2489 urls += "?" + c.urlParams_.Encode() 2490 req, err := http.NewRequest("GET", urls, body) 2491 if err != nil { 2492 return nil, err 2493 } 2494 req.Header = reqHeaders 2495 googleapi.Expand(req.URL, map[string]string{ 2496 "name": c.name, 2497 }) 2498 return gensupport.SendRequest(c.ctx_, c.s.client, req) 2499} 2500 2501// Do executes the "cloudkms.projects.locations.list" call. 2502// Exactly one of *ListLocationsResponse or error will be non-nil. Any 2503// non-2xx status code is an error. Response headers are in either 2504// *ListLocationsResponse.ServerResponse.Header or (if a response was 2505// returned at all) in error.(*googleapi.Error).Header. Use 2506// googleapi.IsNotModified to check whether the returned error was 2507// because http.StatusNotModified was returned. 2508func (c *ProjectsLocationsListCall) Do(opts ...googleapi.CallOption) (*ListLocationsResponse, error) { 2509 gensupport.SetOptions(c.urlParams_, opts...) 2510 res, err := c.doRequest("json") 2511 if res != nil && res.StatusCode == http.StatusNotModified { 2512 if res.Body != nil { 2513 res.Body.Close() 2514 } 2515 return nil, &googleapi.Error{ 2516 Code: res.StatusCode, 2517 Header: res.Header, 2518 } 2519 } 2520 if err != nil { 2521 return nil, err 2522 } 2523 defer googleapi.CloseBody(res) 2524 if err := googleapi.CheckResponse(res); err != nil { 2525 return nil, err 2526 } 2527 ret := &ListLocationsResponse{ 2528 ServerResponse: googleapi.ServerResponse{ 2529 Header: res.Header, 2530 HTTPStatusCode: res.StatusCode, 2531 }, 2532 } 2533 target := &ret 2534 if err := gensupport.DecodeResponse(target, res); err != nil { 2535 return nil, err 2536 } 2537 return ret, nil 2538 // { 2539 // "description": "Lists information about the supported locations for this service.", 2540 // "flatPath": "v1/projects/{projectsId}/locations", 2541 // "httpMethod": "GET", 2542 // "id": "cloudkms.projects.locations.list", 2543 // "parameterOrder": [ 2544 // "name" 2545 // ], 2546 // "parameters": { 2547 // "filter": { 2548 // "description": "The standard list filter.", 2549 // "location": "query", 2550 // "type": "string" 2551 // }, 2552 // "name": { 2553 // "description": "The resource that owns the locations collection, if applicable.", 2554 // "location": "path", 2555 // "pattern": "^projects/[^/]+$", 2556 // "required": true, 2557 // "type": "string" 2558 // }, 2559 // "pageSize": { 2560 // "description": "The standard list page size.", 2561 // "format": "int32", 2562 // "location": "query", 2563 // "type": "integer" 2564 // }, 2565 // "pageToken": { 2566 // "description": "The standard list page token.", 2567 // "location": "query", 2568 // "type": "string" 2569 // } 2570 // }, 2571 // "path": "v1/{+name}/locations", 2572 // "response": { 2573 // "$ref": "ListLocationsResponse" 2574 // }, 2575 // "scopes": [ 2576 // "https://www.googleapis.com/auth/cloud-platform", 2577 // "https://www.googleapis.com/auth/cloudkms" 2578 // ] 2579 // } 2580 2581} 2582 2583// Pages invokes f for each page of results. 2584// A non-nil error returned from f will halt the iteration. 2585// The provided context supersedes any context provided to the Context method. 2586func (c *ProjectsLocationsListCall) Pages(ctx context.Context, f func(*ListLocationsResponse) error) error { 2587 c.ctx_ = ctx 2588 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 2589 for { 2590 x, err := c.Do() 2591 if err != nil { 2592 return err 2593 } 2594 if err := f(x); err != nil { 2595 return err 2596 } 2597 if x.NextPageToken == "" { 2598 return nil 2599 } 2600 c.PageToken(x.NextPageToken) 2601 } 2602} 2603 2604// method id "cloudkms.projects.locations.keyRings.create": 2605 2606type ProjectsLocationsKeyRingsCreateCall struct { 2607 s *Service 2608 parent string 2609 keyring *KeyRing 2610 urlParams_ gensupport.URLParams 2611 ctx_ context.Context 2612 header_ http.Header 2613} 2614 2615// Create: Create a new KeyRing in a given Project and Location. 2616func (r *ProjectsLocationsKeyRingsService) Create(parent string, keyring *KeyRing) *ProjectsLocationsKeyRingsCreateCall { 2617 c := &ProjectsLocationsKeyRingsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)} 2618 c.parent = parent 2619 c.keyring = keyring 2620 return c 2621} 2622 2623// KeyRingId sets the optional parameter "keyRingId": Required. It must 2624// be unique within a location and match the regular 2625// expression `[a-zA-Z0-9_-]{1,63}` 2626func (c *ProjectsLocationsKeyRingsCreateCall) KeyRingId(keyRingId string) *ProjectsLocationsKeyRingsCreateCall { 2627 c.urlParams_.Set("keyRingId", keyRingId) 2628 return c 2629} 2630 2631// Fields allows partial responses to be retrieved. See 2632// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 2633// for more information. 2634func (c *ProjectsLocationsKeyRingsCreateCall) Fields(s ...googleapi.Field) *ProjectsLocationsKeyRingsCreateCall { 2635 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 2636 return c 2637} 2638 2639// Context sets the context to be used in this call's Do method. Any 2640// pending HTTP request will be aborted if the provided context is 2641// canceled. 2642func (c *ProjectsLocationsKeyRingsCreateCall) Context(ctx context.Context) *ProjectsLocationsKeyRingsCreateCall { 2643 c.ctx_ = ctx 2644 return c 2645} 2646 2647// Header returns an http.Header that can be modified by the caller to 2648// add HTTP headers to the request. 2649func (c *ProjectsLocationsKeyRingsCreateCall) Header() http.Header { 2650 if c.header_ == nil { 2651 c.header_ = make(http.Header) 2652 } 2653 return c.header_ 2654} 2655 2656func (c *ProjectsLocationsKeyRingsCreateCall) doRequest(alt string) (*http.Response, error) { 2657 reqHeaders := make(http.Header) 2658 reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190926") 2659 for k, v := range c.header_ { 2660 reqHeaders[k] = v 2661 } 2662 reqHeaders.Set("User-Agent", c.s.userAgent()) 2663 var body io.Reader = nil 2664 body, err := googleapi.WithoutDataWrapper.JSONReader(c.keyring) 2665 if err != nil { 2666 return nil, err 2667 } 2668 reqHeaders.Set("Content-Type", "application/json") 2669 c.urlParams_.Set("alt", alt) 2670 c.urlParams_.Set("prettyPrint", "false") 2671 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}/keyRings") 2672 urls += "?" + c.urlParams_.Encode() 2673 req, err := http.NewRequest("POST", urls, body) 2674 if err != nil { 2675 return nil, err 2676 } 2677 req.Header = reqHeaders 2678 googleapi.Expand(req.URL, map[string]string{ 2679 "parent": c.parent, 2680 }) 2681 return gensupport.SendRequest(c.ctx_, c.s.client, req) 2682} 2683 2684// Do executes the "cloudkms.projects.locations.keyRings.create" call. 2685// Exactly one of *KeyRing or error will be non-nil. Any non-2xx status 2686// code is an error. Response headers are in either 2687// *KeyRing.ServerResponse.Header or (if a response was returned at all) 2688// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 2689// check whether the returned error was because http.StatusNotModified 2690// was returned. 2691func (c *ProjectsLocationsKeyRingsCreateCall) Do(opts ...googleapi.CallOption) (*KeyRing, error) { 2692 gensupport.SetOptions(c.urlParams_, opts...) 2693 res, err := c.doRequest("json") 2694 if res != nil && res.StatusCode == http.StatusNotModified { 2695 if res.Body != nil { 2696 res.Body.Close() 2697 } 2698 return nil, &googleapi.Error{ 2699 Code: res.StatusCode, 2700 Header: res.Header, 2701 } 2702 } 2703 if err != nil { 2704 return nil, err 2705 } 2706 defer googleapi.CloseBody(res) 2707 if err := googleapi.CheckResponse(res); err != nil { 2708 return nil, err 2709 } 2710 ret := &KeyRing{ 2711 ServerResponse: googleapi.ServerResponse{ 2712 Header: res.Header, 2713 HTTPStatusCode: res.StatusCode, 2714 }, 2715 } 2716 target := &ret 2717 if err := gensupport.DecodeResponse(target, res); err != nil { 2718 return nil, err 2719 } 2720 return ret, nil 2721 // { 2722 // "description": "Create a new KeyRing in a given Project and Location.", 2723 // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/keyRings", 2724 // "httpMethod": "POST", 2725 // "id": "cloudkms.projects.locations.keyRings.create", 2726 // "parameterOrder": [ 2727 // "parent" 2728 // ], 2729 // "parameters": { 2730 // "keyRingId": { 2731 // "description": "Required. It must be unique within a location and match the regular\nexpression `[a-zA-Z0-9_-]{1,63}`", 2732 // "location": "query", 2733 // "type": "string" 2734 // }, 2735 // "parent": { 2736 // "description": "Required. The resource name of the location associated with the\nKeyRings, in the format `projects/*/locations/*`.", 2737 // "location": "path", 2738 // "pattern": "^projects/[^/]+/locations/[^/]+$", 2739 // "required": true, 2740 // "type": "string" 2741 // } 2742 // }, 2743 // "path": "v1/{+parent}/keyRings", 2744 // "request": { 2745 // "$ref": "KeyRing" 2746 // }, 2747 // "response": { 2748 // "$ref": "KeyRing" 2749 // }, 2750 // "scopes": [ 2751 // "https://www.googleapis.com/auth/cloud-platform", 2752 // "https://www.googleapis.com/auth/cloudkms" 2753 // ] 2754 // } 2755 2756} 2757 2758// method id "cloudkms.projects.locations.keyRings.get": 2759 2760type ProjectsLocationsKeyRingsGetCall struct { 2761 s *Service 2762 name string 2763 urlParams_ gensupport.URLParams 2764 ifNoneMatch_ string 2765 ctx_ context.Context 2766 header_ http.Header 2767} 2768 2769// Get: Returns metadata for a given KeyRing. 2770func (r *ProjectsLocationsKeyRingsService) Get(name string) *ProjectsLocationsKeyRingsGetCall { 2771 c := &ProjectsLocationsKeyRingsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 2772 c.name = name 2773 return c 2774} 2775 2776// Fields allows partial responses to be retrieved. See 2777// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 2778// for more information. 2779func (c *ProjectsLocationsKeyRingsGetCall) Fields(s ...googleapi.Field) *ProjectsLocationsKeyRingsGetCall { 2780 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 2781 return c 2782} 2783 2784// IfNoneMatch sets the optional parameter which makes the operation 2785// fail if the object's ETag matches the given value. This is useful for 2786// getting updates only after the object has changed since the last 2787// request. Use googleapi.IsNotModified to check whether the response 2788// error from Do is the result of In-None-Match. 2789func (c *ProjectsLocationsKeyRingsGetCall) IfNoneMatch(entityTag string) *ProjectsLocationsKeyRingsGetCall { 2790 c.ifNoneMatch_ = entityTag 2791 return c 2792} 2793 2794// Context sets the context to be used in this call's Do method. Any 2795// pending HTTP request will be aborted if the provided context is 2796// canceled. 2797func (c *ProjectsLocationsKeyRingsGetCall) Context(ctx context.Context) *ProjectsLocationsKeyRingsGetCall { 2798 c.ctx_ = ctx 2799 return c 2800} 2801 2802// Header returns an http.Header that can be modified by the caller to 2803// add HTTP headers to the request. 2804func (c *ProjectsLocationsKeyRingsGetCall) Header() http.Header { 2805 if c.header_ == nil { 2806 c.header_ = make(http.Header) 2807 } 2808 return c.header_ 2809} 2810 2811func (c *ProjectsLocationsKeyRingsGetCall) doRequest(alt string) (*http.Response, error) { 2812 reqHeaders := make(http.Header) 2813 reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190926") 2814 for k, v := range c.header_ { 2815 reqHeaders[k] = v 2816 } 2817 reqHeaders.Set("User-Agent", c.s.userAgent()) 2818 if c.ifNoneMatch_ != "" { 2819 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 2820 } 2821 var body io.Reader = nil 2822 c.urlParams_.Set("alt", alt) 2823 c.urlParams_.Set("prettyPrint", "false") 2824 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}") 2825 urls += "?" + c.urlParams_.Encode() 2826 req, err := http.NewRequest("GET", urls, body) 2827 if err != nil { 2828 return nil, err 2829 } 2830 req.Header = reqHeaders 2831 googleapi.Expand(req.URL, map[string]string{ 2832 "name": c.name, 2833 }) 2834 return gensupport.SendRequest(c.ctx_, c.s.client, req) 2835} 2836 2837// Do executes the "cloudkms.projects.locations.keyRings.get" call. 2838// Exactly one of *KeyRing or error will be non-nil. Any non-2xx status 2839// code is an error. Response headers are in either 2840// *KeyRing.ServerResponse.Header or (if a response was returned at all) 2841// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 2842// check whether the returned error was because http.StatusNotModified 2843// was returned. 2844func (c *ProjectsLocationsKeyRingsGetCall) Do(opts ...googleapi.CallOption) (*KeyRing, error) { 2845 gensupport.SetOptions(c.urlParams_, opts...) 2846 res, err := c.doRequest("json") 2847 if res != nil && res.StatusCode == http.StatusNotModified { 2848 if res.Body != nil { 2849 res.Body.Close() 2850 } 2851 return nil, &googleapi.Error{ 2852 Code: res.StatusCode, 2853 Header: res.Header, 2854 } 2855 } 2856 if err != nil { 2857 return nil, err 2858 } 2859 defer googleapi.CloseBody(res) 2860 if err := googleapi.CheckResponse(res); err != nil { 2861 return nil, err 2862 } 2863 ret := &KeyRing{ 2864 ServerResponse: googleapi.ServerResponse{ 2865 Header: res.Header, 2866 HTTPStatusCode: res.StatusCode, 2867 }, 2868 } 2869 target := &ret 2870 if err := gensupport.DecodeResponse(target, res); err != nil { 2871 return nil, err 2872 } 2873 return ret, nil 2874 // { 2875 // "description": "Returns metadata for a given KeyRing.", 2876 // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/keyRings/{keyRingsId}", 2877 // "httpMethod": "GET", 2878 // "id": "cloudkms.projects.locations.keyRings.get", 2879 // "parameterOrder": [ 2880 // "name" 2881 // ], 2882 // "parameters": { 2883 // "name": { 2884 // "description": "Required. The name of the KeyRing to get.", 2885 // "location": "path", 2886 // "pattern": "^projects/[^/]+/locations/[^/]+/keyRings/[^/]+$", 2887 // "required": true, 2888 // "type": "string" 2889 // } 2890 // }, 2891 // "path": "v1/{+name}", 2892 // "response": { 2893 // "$ref": "KeyRing" 2894 // }, 2895 // "scopes": [ 2896 // "https://www.googleapis.com/auth/cloud-platform", 2897 // "https://www.googleapis.com/auth/cloudkms" 2898 // ] 2899 // } 2900 2901} 2902 2903// method id "cloudkms.projects.locations.keyRings.getIamPolicy": 2904 2905type ProjectsLocationsKeyRingsGetIamPolicyCall struct { 2906 s *Service 2907 resource string 2908 urlParams_ gensupport.URLParams 2909 ifNoneMatch_ string 2910 ctx_ context.Context 2911 header_ http.Header 2912} 2913 2914// GetIamPolicy: Gets the access control policy for a resource. 2915// Returns an empty policy if the resource exists and does not have a 2916// policy 2917// set. 2918func (r *ProjectsLocationsKeyRingsService) GetIamPolicy(resource string) *ProjectsLocationsKeyRingsGetIamPolicyCall { 2919 c := &ProjectsLocationsKeyRingsGetIamPolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)} 2920 c.resource = resource 2921 return c 2922} 2923 2924// OptionsRequestedPolicyVersion sets the optional parameter 2925// "options.requestedPolicyVersion": The policy format version to be 2926// returned. 2927// 2928// Valid values are 0, 1, and 3. Requests specifying an invalid value 2929// will be 2930// rejected. 2931// 2932// Requests for policies with any conditional bindings must specify 2933// version 3. 2934// Policies without any conditional bindings may specify any valid value 2935// or 2936// leave the field unset. 2937func (c *ProjectsLocationsKeyRingsGetIamPolicyCall) OptionsRequestedPolicyVersion(optionsRequestedPolicyVersion int64) *ProjectsLocationsKeyRingsGetIamPolicyCall { 2938 c.urlParams_.Set("options.requestedPolicyVersion", fmt.Sprint(optionsRequestedPolicyVersion)) 2939 return c 2940} 2941 2942// Fields allows partial responses to be retrieved. See 2943// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 2944// for more information. 2945func (c *ProjectsLocationsKeyRingsGetIamPolicyCall) Fields(s ...googleapi.Field) *ProjectsLocationsKeyRingsGetIamPolicyCall { 2946 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 2947 return c 2948} 2949 2950// IfNoneMatch sets the optional parameter which makes the operation 2951// fail if the object's ETag matches the given value. This is useful for 2952// getting updates only after the object has changed since the last 2953// request. Use googleapi.IsNotModified to check whether the response 2954// error from Do is the result of In-None-Match. 2955func (c *ProjectsLocationsKeyRingsGetIamPolicyCall) IfNoneMatch(entityTag string) *ProjectsLocationsKeyRingsGetIamPolicyCall { 2956 c.ifNoneMatch_ = entityTag 2957 return c 2958} 2959 2960// Context sets the context to be used in this call's Do method. Any 2961// pending HTTP request will be aborted if the provided context is 2962// canceled. 2963func (c *ProjectsLocationsKeyRingsGetIamPolicyCall) Context(ctx context.Context) *ProjectsLocationsKeyRingsGetIamPolicyCall { 2964 c.ctx_ = ctx 2965 return c 2966} 2967 2968// Header returns an http.Header that can be modified by the caller to 2969// add HTTP headers to the request. 2970func (c *ProjectsLocationsKeyRingsGetIamPolicyCall) Header() http.Header { 2971 if c.header_ == nil { 2972 c.header_ = make(http.Header) 2973 } 2974 return c.header_ 2975} 2976 2977func (c *ProjectsLocationsKeyRingsGetIamPolicyCall) doRequest(alt string) (*http.Response, error) { 2978 reqHeaders := make(http.Header) 2979 reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190926") 2980 for k, v := range c.header_ { 2981 reqHeaders[k] = v 2982 } 2983 reqHeaders.Set("User-Agent", c.s.userAgent()) 2984 if c.ifNoneMatch_ != "" { 2985 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 2986 } 2987 var body io.Reader = nil 2988 c.urlParams_.Set("alt", alt) 2989 c.urlParams_.Set("prettyPrint", "false") 2990 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+resource}:getIamPolicy") 2991 urls += "?" + c.urlParams_.Encode() 2992 req, err := http.NewRequest("GET", urls, body) 2993 if err != nil { 2994 return nil, err 2995 } 2996 req.Header = reqHeaders 2997 googleapi.Expand(req.URL, map[string]string{ 2998 "resource": c.resource, 2999 }) 3000 return gensupport.SendRequest(c.ctx_, c.s.client, req) 3001} 3002 3003// Do executes the "cloudkms.projects.locations.keyRings.getIamPolicy" call. 3004// Exactly one of *Policy or error will be non-nil. Any non-2xx status 3005// code is an error. Response headers are in either 3006// *Policy.ServerResponse.Header or (if a response was returned at all) 3007// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 3008// check whether the returned error was because http.StatusNotModified 3009// was returned. 3010func (c *ProjectsLocationsKeyRingsGetIamPolicyCall) Do(opts ...googleapi.CallOption) (*Policy, error) { 3011 gensupport.SetOptions(c.urlParams_, opts...) 3012 res, err := c.doRequest("json") 3013 if res != nil && res.StatusCode == http.StatusNotModified { 3014 if res.Body != nil { 3015 res.Body.Close() 3016 } 3017 return nil, &googleapi.Error{ 3018 Code: res.StatusCode, 3019 Header: res.Header, 3020 } 3021 } 3022 if err != nil { 3023 return nil, err 3024 } 3025 defer googleapi.CloseBody(res) 3026 if err := googleapi.CheckResponse(res); err != nil { 3027 return nil, err 3028 } 3029 ret := &Policy{ 3030 ServerResponse: googleapi.ServerResponse{ 3031 Header: res.Header, 3032 HTTPStatusCode: res.StatusCode, 3033 }, 3034 } 3035 target := &ret 3036 if err := gensupport.DecodeResponse(target, res); err != nil { 3037 return nil, err 3038 } 3039 return ret, nil 3040 // { 3041 // "description": "Gets the access control policy for a resource.\nReturns an empty policy if the resource exists and does not have a policy\nset.", 3042 // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/keyRings/{keyRingsId}:getIamPolicy", 3043 // "httpMethod": "GET", 3044 // "id": "cloudkms.projects.locations.keyRings.getIamPolicy", 3045 // "parameterOrder": [ 3046 // "resource" 3047 // ], 3048 // "parameters": { 3049 // "options.requestedPolicyVersion": { 3050 // "description": "Optional. The policy format version to be returned.\n\nValid values are 0, 1, and 3. Requests specifying an invalid value will be\nrejected.\n\nRequests for policies with any conditional bindings must specify version 3.\nPolicies without any conditional bindings may specify any valid value or\nleave the field unset.", 3051 // "format": "int32", 3052 // "location": "query", 3053 // "type": "integer" 3054 // }, 3055 // "resource": { 3056 // "description": "REQUIRED: The resource for which the policy is being requested.\nSee the operation documentation for the appropriate value for this field.", 3057 // "location": "path", 3058 // "pattern": "^projects/[^/]+/locations/[^/]+/keyRings/[^/]+$", 3059 // "required": true, 3060 // "type": "string" 3061 // } 3062 // }, 3063 // "path": "v1/{+resource}:getIamPolicy", 3064 // "response": { 3065 // "$ref": "Policy" 3066 // }, 3067 // "scopes": [ 3068 // "https://www.googleapis.com/auth/cloud-platform", 3069 // "https://www.googleapis.com/auth/cloudkms" 3070 // ] 3071 // } 3072 3073} 3074 3075// method id "cloudkms.projects.locations.keyRings.list": 3076 3077type ProjectsLocationsKeyRingsListCall struct { 3078 s *Service 3079 parent string 3080 urlParams_ gensupport.URLParams 3081 ifNoneMatch_ string 3082 ctx_ context.Context 3083 header_ http.Header 3084} 3085 3086// List: Lists KeyRings. 3087func (r *ProjectsLocationsKeyRingsService) List(parent string) *ProjectsLocationsKeyRingsListCall { 3088 c := &ProjectsLocationsKeyRingsListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 3089 c.parent = parent 3090 return c 3091} 3092 3093// Filter sets the optional parameter "filter": Only include resources 3094// that match the filter in the response. For 3095// more information, see 3096// [Sorting and filtering 3097// list 3098// results](https://cloud.google.com/kms/docs/sorting-and-filtering) 3099// . 3100func (c *ProjectsLocationsKeyRingsListCall) Filter(filter string) *ProjectsLocationsKeyRingsListCall { 3101 c.urlParams_.Set("filter", filter) 3102 return c 3103} 3104 3105// OrderBy sets the optional parameter "orderBy": Specify how the 3106// results should be sorted. If not specified, the 3107// results will be sorted in the default order. For more information, 3108// see 3109// [Sorting and filtering 3110// list 3111// results](https://cloud.google.com/kms/docs/sorting-and-filtering) 3112// . 3113func (c *ProjectsLocationsKeyRingsListCall) OrderBy(orderBy string) *ProjectsLocationsKeyRingsListCall { 3114 c.urlParams_.Set("orderBy", orderBy) 3115 return c 3116} 3117 3118// PageSize sets the optional parameter "pageSize": Optional limit on 3119// the number of KeyRings to include in the 3120// response. Further KeyRings can subsequently be obtained by 3121// including the ListKeyRingsResponse.next_page_token in a 3122// subsequent 3123// request. If unspecified, the server will pick an appropriate 3124// default. 3125func (c *ProjectsLocationsKeyRingsListCall) PageSize(pageSize int64) *ProjectsLocationsKeyRingsListCall { 3126 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize)) 3127 return c 3128} 3129 3130// PageToken sets the optional parameter "pageToken": Optional 3131// pagination token, returned earlier 3132// via 3133// ListKeyRingsResponse.next_page_token. 3134func (c *ProjectsLocationsKeyRingsListCall) PageToken(pageToken string) *ProjectsLocationsKeyRingsListCall { 3135 c.urlParams_.Set("pageToken", pageToken) 3136 return c 3137} 3138 3139// Fields allows partial responses to be retrieved. See 3140// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 3141// for more information. 3142func (c *ProjectsLocationsKeyRingsListCall) Fields(s ...googleapi.Field) *ProjectsLocationsKeyRingsListCall { 3143 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 3144 return c 3145} 3146 3147// IfNoneMatch sets the optional parameter which makes the operation 3148// fail if the object's ETag matches the given value. This is useful for 3149// getting updates only after the object has changed since the last 3150// request. Use googleapi.IsNotModified to check whether the response 3151// error from Do is the result of In-None-Match. 3152func (c *ProjectsLocationsKeyRingsListCall) IfNoneMatch(entityTag string) *ProjectsLocationsKeyRingsListCall { 3153 c.ifNoneMatch_ = entityTag 3154 return c 3155} 3156 3157// Context sets the context to be used in this call's Do method. Any 3158// pending HTTP request will be aborted if the provided context is 3159// canceled. 3160func (c *ProjectsLocationsKeyRingsListCall) Context(ctx context.Context) *ProjectsLocationsKeyRingsListCall { 3161 c.ctx_ = ctx 3162 return c 3163} 3164 3165// Header returns an http.Header that can be modified by the caller to 3166// add HTTP headers to the request. 3167func (c *ProjectsLocationsKeyRingsListCall) Header() http.Header { 3168 if c.header_ == nil { 3169 c.header_ = make(http.Header) 3170 } 3171 return c.header_ 3172} 3173 3174func (c *ProjectsLocationsKeyRingsListCall) doRequest(alt string) (*http.Response, error) { 3175 reqHeaders := make(http.Header) 3176 reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190926") 3177 for k, v := range c.header_ { 3178 reqHeaders[k] = v 3179 } 3180 reqHeaders.Set("User-Agent", c.s.userAgent()) 3181 if c.ifNoneMatch_ != "" { 3182 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 3183 } 3184 var body io.Reader = nil 3185 c.urlParams_.Set("alt", alt) 3186 c.urlParams_.Set("prettyPrint", "false") 3187 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}/keyRings") 3188 urls += "?" + c.urlParams_.Encode() 3189 req, err := http.NewRequest("GET", urls, body) 3190 if err != nil { 3191 return nil, err 3192 } 3193 req.Header = reqHeaders 3194 googleapi.Expand(req.URL, map[string]string{ 3195 "parent": c.parent, 3196 }) 3197 return gensupport.SendRequest(c.ctx_, c.s.client, req) 3198} 3199 3200// Do executes the "cloudkms.projects.locations.keyRings.list" call. 3201// Exactly one of *ListKeyRingsResponse or error will be non-nil. Any 3202// non-2xx status code is an error. Response headers are in either 3203// *ListKeyRingsResponse.ServerResponse.Header or (if a response was 3204// returned at all) in error.(*googleapi.Error).Header. Use 3205// googleapi.IsNotModified to check whether the returned error was 3206// because http.StatusNotModified was returned. 3207func (c *ProjectsLocationsKeyRingsListCall) Do(opts ...googleapi.CallOption) (*ListKeyRingsResponse, error) { 3208 gensupport.SetOptions(c.urlParams_, opts...) 3209 res, err := c.doRequest("json") 3210 if res != nil && res.StatusCode == http.StatusNotModified { 3211 if res.Body != nil { 3212 res.Body.Close() 3213 } 3214 return nil, &googleapi.Error{ 3215 Code: res.StatusCode, 3216 Header: res.Header, 3217 } 3218 } 3219 if err != nil { 3220 return nil, err 3221 } 3222 defer googleapi.CloseBody(res) 3223 if err := googleapi.CheckResponse(res); err != nil { 3224 return nil, err 3225 } 3226 ret := &ListKeyRingsResponse{ 3227 ServerResponse: googleapi.ServerResponse{ 3228 Header: res.Header, 3229 HTTPStatusCode: res.StatusCode, 3230 }, 3231 } 3232 target := &ret 3233 if err := gensupport.DecodeResponse(target, res); err != nil { 3234 return nil, err 3235 } 3236 return ret, nil 3237 // { 3238 // "description": "Lists KeyRings.", 3239 // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/keyRings", 3240 // "httpMethod": "GET", 3241 // "id": "cloudkms.projects.locations.keyRings.list", 3242 // "parameterOrder": [ 3243 // "parent" 3244 // ], 3245 // "parameters": { 3246 // "filter": { 3247 // "description": "Optional. Only include resources that match the filter in the response. For\nmore information, see\n[Sorting and filtering list\nresults](https://cloud.google.com/kms/docs/sorting-and-filtering).", 3248 // "location": "query", 3249 // "type": "string" 3250 // }, 3251 // "orderBy": { 3252 // "description": "Optional. Specify how the results should be sorted. If not specified, the\nresults will be sorted in the default order. For more information, see\n[Sorting and filtering list\nresults](https://cloud.google.com/kms/docs/sorting-and-filtering).", 3253 // "location": "query", 3254 // "type": "string" 3255 // }, 3256 // "pageSize": { 3257 // "description": "Optional. Optional limit on the number of KeyRings to include in the\nresponse. Further KeyRings can subsequently be obtained by\nincluding the ListKeyRingsResponse.next_page_token in a subsequent\nrequest. If unspecified, the server will pick an appropriate default.", 3258 // "format": "int32", 3259 // "location": "query", 3260 // "type": "integer" 3261 // }, 3262 // "pageToken": { 3263 // "description": "Optional. Optional pagination token, returned earlier via\nListKeyRingsResponse.next_page_token.", 3264 // "location": "query", 3265 // "type": "string" 3266 // }, 3267 // "parent": { 3268 // "description": "Required. The resource name of the location associated with the\nKeyRings, in the format `projects/*/locations/*`.", 3269 // "location": "path", 3270 // "pattern": "^projects/[^/]+/locations/[^/]+$", 3271 // "required": true, 3272 // "type": "string" 3273 // } 3274 // }, 3275 // "path": "v1/{+parent}/keyRings", 3276 // "response": { 3277 // "$ref": "ListKeyRingsResponse" 3278 // }, 3279 // "scopes": [ 3280 // "https://www.googleapis.com/auth/cloud-platform", 3281 // "https://www.googleapis.com/auth/cloudkms" 3282 // ] 3283 // } 3284 3285} 3286 3287// Pages invokes f for each page of results. 3288// A non-nil error returned from f will halt the iteration. 3289// The provided context supersedes any context provided to the Context method. 3290func (c *ProjectsLocationsKeyRingsListCall) Pages(ctx context.Context, f func(*ListKeyRingsResponse) error) error { 3291 c.ctx_ = ctx 3292 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 3293 for { 3294 x, err := c.Do() 3295 if err != nil { 3296 return err 3297 } 3298 if err := f(x); err != nil { 3299 return err 3300 } 3301 if x.NextPageToken == "" { 3302 return nil 3303 } 3304 c.PageToken(x.NextPageToken) 3305 } 3306} 3307 3308// method id "cloudkms.projects.locations.keyRings.setIamPolicy": 3309 3310type ProjectsLocationsKeyRingsSetIamPolicyCall struct { 3311 s *Service 3312 resource string 3313 setiampolicyrequest *SetIamPolicyRequest 3314 urlParams_ gensupport.URLParams 3315 ctx_ context.Context 3316 header_ http.Header 3317} 3318 3319// SetIamPolicy: Sets the access control policy on the specified 3320// resource. Replaces any 3321// existing policy. 3322func (r *ProjectsLocationsKeyRingsService) SetIamPolicy(resource string, setiampolicyrequest *SetIamPolicyRequest) *ProjectsLocationsKeyRingsSetIamPolicyCall { 3323 c := &ProjectsLocationsKeyRingsSetIamPolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)} 3324 c.resource = resource 3325 c.setiampolicyrequest = setiampolicyrequest 3326 return c 3327} 3328 3329// Fields allows partial responses to be retrieved. See 3330// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 3331// for more information. 3332func (c *ProjectsLocationsKeyRingsSetIamPolicyCall) Fields(s ...googleapi.Field) *ProjectsLocationsKeyRingsSetIamPolicyCall { 3333 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 3334 return c 3335} 3336 3337// Context sets the context to be used in this call's Do method. Any 3338// pending HTTP request will be aborted if the provided context is 3339// canceled. 3340func (c *ProjectsLocationsKeyRingsSetIamPolicyCall) Context(ctx context.Context) *ProjectsLocationsKeyRingsSetIamPolicyCall { 3341 c.ctx_ = ctx 3342 return c 3343} 3344 3345// Header returns an http.Header that can be modified by the caller to 3346// add HTTP headers to the request. 3347func (c *ProjectsLocationsKeyRingsSetIamPolicyCall) Header() http.Header { 3348 if c.header_ == nil { 3349 c.header_ = make(http.Header) 3350 } 3351 return c.header_ 3352} 3353 3354func (c *ProjectsLocationsKeyRingsSetIamPolicyCall) doRequest(alt string) (*http.Response, error) { 3355 reqHeaders := make(http.Header) 3356 reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190926") 3357 for k, v := range c.header_ { 3358 reqHeaders[k] = v 3359 } 3360 reqHeaders.Set("User-Agent", c.s.userAgent()) 3361 var body io.Reader = nil 3362 body, err := googleapi.WithoutDataWrapper.JSONReader(c.setiampolicyrequest) 3363 if err != nil { 3364 return nil, err 3365 } 3366 reqHeaders.Set("Content-Type", "application/json") 3367 c.urlParams_.Set("alt", alt) 3368 c.urlParams_.Set("prettyPrint", "false") 3369 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+resource}:setIamPolicy") 3370 urls += "?" + c.urlParams_.Encode() 3371 req, err := http.NewRequest("POST", urls, body) 3372 if err != nil { 3373 return nil, err 3374 } 3375 req.Header = reqHeaders 3376 googleapi.Expand(req.URL, map[string]string{ 3377 "resource": c.resource, 3378 }) 3379 return gensupport.SendRequest(c.ctx_, c.s.client, req) 3380} 3381 3382// Do executes the "cloudkms.projects.locations.keyRings.setIamPolicy" call. 3383// Exactly one of *Policy or error will be non-nil. Any non-2xx status 3384// code is an error. Response headers are in either 3385// *Policy.ServerResponse.Header or (if a response was returned at all) 3386// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 3387// check whether the returned error was because http.StatusNotModified 3388// was returned. 3389func (c *ProjectsLocationsKeyRingsSetIamPolicyCall) Do(opts ...googleapi.CallOption) (*Policy, error) { 3390 gensupport.SetOptions(c.urlParams_, opts...) 3391 res, err := c.doRequest("json") 3392 if res != nil && res.StatusCode == http.StatusNotModified { 3393 if res.Body != nil { 3394 res.Body.Close() 3395 } 3396 return nil, &googleapi.Error{ 3397 Code: res.StatusCode, 3398 Header: res.Header, 3399 } 3400 } 3401 if err != nil { 3402 return nil, err 3403 } 3404 defer googleapi.CloseBody(res) 3405 if err := googleapi.CheckResponse(res); err != nil { 3406 return nil, err 3407 } 3408 ret := &Policy{ 3409 ServerResponse: googleapi.ServerResponse{ 3410 Header: res.Header, 3411 HTTPStatusCode: res.StatusCode, 3412 }, 3413 } 3414 target := &ret 3415 if err := gensupport.DecodeResponse(target, res); err != nil { 3416 return nil, err 3417 } 3418 return ret, nil 3419 // { 3420 // "description": "Sets the access control policy on the specified resource. Replaces any\nexisting policy.", 3421 // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/keyRings/{keyRingsId}:setIamPolicy", 3422 // "httpMethod": "POST", 3423 // "id": "cloudkms.projects.locations.keyRings.setIamPolicy", 3424 // "parameterOrder": [ 3425 // "resource" 3426 // ], 3427 // "parameters": { 3428 // "resource": { 3429 // "description": "REQUIRED: The resource for which the policy is being specified.\nSee the operation documentation for the appropriate value for this field.", 3430 // "location": "path", 3431 // "pattern": "^projects/[^/]+/locations/[^/]+/keyRings/[^/]+$", 3432 // "required": true, 3433 // "type": "string" 3434 // } 3435 // }, 3436 // "path": "v1/{+resource}:setIamPolicy", 3437 // "request": { 3438 // "$ref": "SetIamPolicyRequest" 3439 // }, 3440 // "response": { 3441 // "$ref": "Policy" 3442 // }, 3443 // "scopes": [ 3444 // "https://www.googleapis.com/auth/cloud-platform", 3445 // "https://www.googleapis.com/auth/cloudkms" 3446 // ] 3447 // } 3448 3449} 3450 3451// method id "cloudkms.projects.locations.keyRings.testIamPermissions": 3452 3453type ProjectsLocationsKeyRingsTestIamPermissionsCall struct { 3454 s *Service 3455 resource string 3456 testiampermissionsrequest *TestIamPermissionsRequest 3457 urlParams_ gensupport.URLParams 3458 ctx_ context.Context 3459 header_ http.Header 3460} 3461 3462// TestIamPermissions: Returns permissions that a caller has on the 3463// specified resource. 3464// If the resource does not exist, this will return an empty set 3465// of 3466// permissions, not a NOT_FOUND error. 3467// 3468// Note: This operation is designed to be used for building 3469// permission-aware 3470// UIs and command-line tools, not for authorization checking. This 3471// operation 3472// may "fail open" without warning. 3473func (r *ProjectsLocationsKeyRingsService) TestIamPermissions(resource string, testiampermissionsrequest *TestIamPermissionsRequest) *ProjectsLocationsKeyRingsTestIamPermissionsCall { 3474 c := &ProjectsLocationsKeyRingsTestIamPermissionsCall{s: r.s, urlParams_: make(gensupport.URLParams)} 3475 c.resource = resource 3476 c.testiampermissionsrequest = testiampermissionsrequest 3477 return c 3478} 3479 3480// Fields allows partial responses to be retrieved. See 3481// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 3482// for more information. 3483func (c *ProjectsLocationsKeyRingsTestIamPermissionsCall) Fields(s ...googleapi.Field) *ProjectsLocationsKeyRingsTestIamPermissionsCall { 3484 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 3485 return c 3486} 3487 3488// Context sets the context to be used in this call's Do method. Any 3489// pending HTTP request will be aborted if the provided context is 3490// canceled. 3491func (c *ProjectsLocationsKeyRingsTestIamPermissionsCall) Context(ctx context.Context) *ProjectsLocationsKeyRingsTestIamPermissionsCall { 3492 c.ctx_ = ctx 3493 return c 3494} 3495 3496// Header returns an http.Header that can be modified by the caller to 3497// add HTTP headers to the request. 3498func (c *ProjectsLocationsKeyRingsTestIamPermissionsCall) Header() http.Header { 3499 if c.header_ == nil { 3500 c.header_ = make(http.Header) 3501 } 3502 return c.header_ 3503} 3504 3505func (c *ProjectsLocationsKeyRingsTestIamPermissionsCall) doRequest(alt string) (*http.Response, error) { 3506 reqHeaders := make(http.Header) 3507 reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190926") 3508 for k, v := range c.header_ { 3509 reqHeaders[k] = v 3510 } 3511 reqHeaders.Set("User-Agent", c.s.userAgent()) 3512 var body io.Reader = nil 3513 body, err := googleapi.WithoutDataWrapper.JSONReader(c.testiampermissionsrequest) 3514 if err != nil { 3515 return nil, err 3516 } 3517 reqHeaders.Set("Content-Type", "application/json") 3518 c.urlParams_.Set("alt", alt) 3519 c.urlParams_.Set("prettyPrint", "false") 3520 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+resource}:testIamPermissions") 3521 urls += "?" + c.urlParams_.Encode() 3522 req, err := http.NewRequest("POST", urls, body) 3523 if err != nil { 3524 return nil, err 3525 } 3526 req.Header = reqHeaders 3527 googleapi.Expand(req.URL, map[string]string{ 3528 "resource": c.resource, 3529 }) 3530 return gensupport.SendRequest(c.ctx_, c.s.client, req) 3531} 3532 3533// Do executes the "cloudkms.projects.locations.keyRings.testIamPermissions" call. 3534// Exactly one of *TestIamPermissionsResponse or error will be non-nil. 3535// Any non-2xx status code is an error. Response headers are in either 3536// *TestIamPermissionsResponse.ServerResponse.Header or (if a response 3537// was returned at all) in error.(*googleapi.Error).Header. Use 3538// googleapi.IsNotModified to check whether the returned error was 3539// because http.StatusNotModified was returned. 3540func (c *ProjectsLocationsKeyRingsTestIamPermissionsCall) Do(opts ...googleapi.CallOption) (*TestIamPermissionsResponse, error) { 3541 gensupport.SetOptions(c.urlParams_, opts...) 3542 res, err := c.doRequest("json") 3543 if res != nil && res.StatusCode == http.StatusNotModified { 3544 if res.Body != nil { 3545 res.Body.Close() 3546 } 3547 return nil, &googleapi.Error{ 3548 Code: res.StatusCode, 3549 Header: res.Header, 3550 } 3551 } 3552 if err != nil { 3553 return nil, err 3554 } 3555 defer googleapi.CloseBody(res) 3556 if err := googleapi.CheckResponse(res); err != nil { 3557 return nil, err 3558 } 3559 ret := &TestIamPermissionsResponse{ 3560 ServerResponse: googleapi.ServerResponse{ 3561 Header: res.Header, 3562 HTTPStatusCode: res.StatusCode, 3563 }, 3564 } 3565 target := &ret 3566 if err := gensupport.DecodeResponse(target, res); err != nil { 3567 return nil, err 3568 } 3569 return ret, nil 3570 // { 3571 // "description": "Returns permissions that a caller has on the specified resource.\nIf the resource does not exist, this will return an empty set of\npermissions, not a NOT_FOUND error.\n\nNote: This operation is designed to be used for building permission-aware\nUIs and command-line tools, not for authorization checking. This operation\nmay \"fail open\" without warning.", 3572 // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/keyRings/{keyRingsId}:testIamPermissions", 3573 // "httpMethod": "POST", 3574 // "id": "cloudkms.projects.locations.keyRings.testIamPermissions", 3575 // "parameterOrder": [ 3576 // "resource" 3577 // ], 3578 // "parameters": { 3579 // "resource": { 3580 // "description": "REQUIRED: The resource for which the policy detail is being requested.\nSee the operation documentation for the appropriate value for this field.", 3581 // "location": "path", 3582 // "pattern": "^projects/[^/]+/locations/[^/]+/keyRings/[^/]+$", 3583 // "required": true, 3584 // "type": "string" 3585 // } 3586 // }, 3587 // "path": "v1/{+resource}:testIamPermissions", 3588 // "request": { 3589 // "$ref": "TestIamPermissionsRequest" 3590 // }, 3591 // "response": { 3592 // "$ref": "TestIamPermissionsResponse" 3593 // }, 3594 // "scopes": [ 3595 // "https://www.googleapis.com/auth/cloud-platform", 3596 // "https://www.googleapis.com/auth/cloudkms" 3597 // ] 3598 // } 3599 3600} 3601 3602// method id "cloudkms.projects.locations.keyRings.cryptoKeys.create": 3603 3604type ProjectsLocationsKeyRingsCryptoKeysCreateCall struct { 3605 s *Service 3606 parent string 3607 cryptokey *CryptoKey 3608 urlParams_ gensupport.URLParams 3609 ctx_ context.Context 3610 header_ http.Header 3611} 3612 3613// Create: Create a new CryptoKey within a KeyRing. 3614// 3615// CryptoKey.purpose and 3616// CryptoKey.version_template.algorithm 3617// are required. 3618func (r *ProjectsLocationsKeyRingsCryptoKeysService) Create(parent string, cryptokey *CryptoKey) *ProjectsLocationsKeyRingsCryptoKeysCreateCall { 3619 c := &ProjectsLocationsKeyRingsCryptoKeysCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)} 3620 c.parent = parent 3621 c.cryptokey = cryptokey 3622 return c 3623} 3624 3625// CryptoKeyId sets the optional parameter "cryptoKeyId": Required. It 3626// must be unique within a KeyRing and match the regular 3627// expression `[a-zA-Z0-9_-]{1,63}` 3628func (c *ProjectsLocationsKeyRingsCryptoKeysCreateCall) CryptoKeyId(cryptoKeyId string) *ProjectsLocationsKeyRingsCryptoKeysCreateCall { 3629 c.urlParams_.Set("cryptoKeyId", cryptoKeyId) 3630 return c 3631} 3632 3633// SkipInitialVersionCreation sets the optional parameter 3634// "skipInitialVersionCreation": If set to true, the request will create 3635// a CryptoKey without any 3636// CryptoKeyVersions. You must manually call 3637// CreateCryptoKeyVersion or 3638// ImportCryptoKeyVersion 3639// before you can use this CryptoKey. 3640func (c *ProjectsLocationsKeyRingsCryptoKeysCreateCall) SkipInitialVersionCreation(skipInitialVersionCreation bool) *ProjectsLocationsKeyRingsCryptoKeysCreateCall { 3641 c.urlParams_.Set("skipInitialVersionCreation", fmt.Sprint(skipInitialVersionCreation)) 3642 return c 3643} 3644 3645// Fields allows partial responses to be retrieved. See 3646// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 3647// for more information. 3648func (c *ProjectsLocationsKeyRingsCryptoKeysCreateCall) Fields(s ...googleapi.Field) *ProjectsLocationsKeyRingsCryptoKeysCreateCall { 3649 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 3650 return c 3651} 3652 3653// Context sets the context to be used in this call's Do method. Any 3654// pending HTTP request will be aborted if the provided context is 3655// canceled. 3656func (c *ProjectsLocationsKeyRingsCryptoKeysCreateCall) Context(ctx context.Context) *ProjectsLocationsKeyRingsCryptoKeysCreateCall { 3657 c.ctx_ = ctx 3658 return c 3659} 3660 3661// Header returns an http.Header that can be modified by the caller to 3662// add HTTP headers to the request. 3663func (c *ProjectsLocationsKeyRingsCryptoKeysCreateCall) Header() http.Header { 3664 if c.header_ == nil { 3665 c.header_ = make(http.Header) 3666 } 3667 return c.header_ 3668} 3669 3670func (c *ProjectsLocationsKeyRingsCryptoKeysCreateCall) doRequest(alt string) (*http.Response, error) { 3671 reqHeaders := make(http.Header) 3672 reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190926") 3673 for k, v := range c.header_ { 3674 reqHeaders[k] = v 3675 } 3676 reqHeaders.Set("User-Agent", c.s.userAgent()) 3677 var body io.Reader = nil 3678 body, err := googleapi.WithoutDataWrapper.JSONReader(c.cryptokey) 3679 if err != nil { 3680 return nil, err 3681 } 3682 reqHeaders.Set("Content-Type", "application/json") 3683 c.urlParams_.Set("alt", alt) 3684 c.urlParams_.Set("prettyPrint", "false") 3685 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}/cryptoKeys") 3686 urls += "?" + c.urlParams_.Encode() 3687 req, err := http.NewRequest("POST", urls, body) 3688 if err != nil { 3689 return nil, err 3690 } 3691 req.Header = reqHeaders 3692 googleapi.Expand(req.URL, map[string]string{ 3693 "parent": c.parent, 3694 }) 3695 return gensupport.SendRequest(c.ctx_, c.s.client, req) 3696} 3697 3698// Do executes the "cloudkms.projects.locations.keyRings.cryptoKeys.create" call. 3699// Exactly one of *CryptoKey or error will be non-nil. Any non-2xx 3700// status code is an error. Response headers are in either 3701// *CryptoKey.ServerResponse.Header or (if a response was returned at 3702// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 3703// to check whether the returned error was because 3704// http.StatusNotModified was returned. 3705func (c *ProjectsLocationsKeyRingsCryptoKeysCreateCall) Do(opts ...googleapi.CallOption) (*CryptoKey, error) { 3706 gensupport.SetOptions(c.urlParams_, opts...) 3707 res, err := c.doRequest("json") 3708 if res != nil && res.StatusCode == http.StatusNotModified { 3709 if res.Body != nil { 3710 res.Body.Close() 3711 } 3712 return nil, &googleapi.Error{ 3713 Code: res.StatusCode, 3714 Header: res.Header, 3715 } 3716 } 3717 if err != nil { 3718 return nil, err 3719 } 3720 defer googleapi.CloseBody(res) 3721 if err := googleapi.CheckResponse(res); err != nil { 3722 return nil, err 3723 } 3724 ret := &CryptoKey{ 3725 ServerResponse: googleapi.ServerResponse{ 3726 Header: res.Header, 3727 HTTPStatusCode: res.StatusCode, 3728 }, 3729 } 3730 target := &ret 3731 if err := gensupport.DecodeResponse(target, res); err != nil { 3732 return nil, err 3733 } 3734 return ret, nil 3735 // { 3736 // "description": "Create a new CryptoKey within a KeyRing.\n\nCryptoKey.purpose and\nCryptoKey.version_template.algorithm\nare required.", 3737 // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/keyRings/{keyRingsId}/cryptoKeys", 3738 // "httpMethod": "POST", 3739 // "id": "cloudkms.projects.locations.keyRings.cryptoKeys.create", 3740 // "parameterOrder": [ 3741 // "parent" 3742 // ], 3743 // "parameters": { 3744 // "cryptoKeyId": { 3745 // "description": "Required. It must be unique within a KeyRing and match the regular\nexpression `[a-zA-Z0-9_-]{1,63}`", 3746 // "location": "query", 3747 // "type": "string" 3748 // }, 3749 // "parent": { 3750 // "description": "Required. The name of the KeyRing associated with the\nCryptoKeys.", 3751 // "location": "path", 3752 // "pattern": "^projects/[^/]+/locations/[^/]+/keyRings/[^/]+$", 3753 // "required": true, 3754 // "type": "string" 3755 // }, 3756 // "skipInitialVersionCreation": { 3757 // "description": "If set to true, the request will create a CryptoKey without any\nCryptoKeyVersions. You must manually call\nCreateCryptoKeyVersion or\nImportCryptoKeyVersion\nbefore you can use this CryptoKey.", 3758 // "location": "query", 3759 // "type": "boolean" 3760 // } 3761 // }, 3762 // "path": "v1/{+parent}/cryptoKeys", 3763 // "request": { 3764 // "$ref": "CryptoKey" 3765 // }, 3766 // "response": { 3767 // "$ref": "CryptoKey" 3768 // }, 3769 // "scopes": [ 3770 // "https://www.googleapis.com/auth/cloud-platform", 3771 // "https://www.googleapis.com/auth/cloudkms" 3772 // ] 3773 // } 3774 3775} 3776 3777// method id "cloudkms.projects.locations.keyRings.cryptoKeys.decrypt": 3778 3779type ProjectsLocationsKeyRingsCryptoKeysDecryptCall struct { 3780 s *Service 3781 name string 3782 decryptrequest *DecryptRequest 3783 urlParams_ gensupport.URLParams 3784 ctx_ context.Context 3785 header_ http.Header 3786} 3787 3788// Decrypt: Decrypts data that was protected by Encrypt. The 3789// CryptoKey.purpose 3790// must be ENCRYPT_DECRYPT. 3791func (r *ProjectsLocationsKeyRingsCryptoKeysService) Decrypt(name string, decryptrequest *DecryptRequest) *ProjectsLocationsKeyRingsCryptoKeysDecryptCall { 3792 c := &ProjectsLocationsKeyRingsCryptoKeysDecryptCall{s: r.s, urlParams_: make(gensupport.URLParams)} 3793 c.name = name 3794 c.decryptrequest = decryptrequest 3795 return c 3796} 3797 3798// Fields allows partial responses to be retrieved. See 3799// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 3800// for more information. 3801func (c *ProjectsLocationsKeyRingsCryptoKeysDecryptCall) Fields(s ...googleapi.Field) *ProjectsLocationsKeyRingsCryptoKeysDecryptCall { 3802 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 3803 return c 3804} 3805 3806// Context sets the context to be used in this call's Do method. Any 3807// pending HTTP request will be aborted if the provided context is 3808// canceled. 3809func (c *ProjectsLocationsKeyRingsCryptoKeysDecryptCall) Context(ctx context.Context) *ProjectsLocationsKeyRingsCryptoKeysDecryptCall { 3810 c.ctx_ = ctx 3811 return c 3812} 3813 3814// Header returns an http.Header that can be modified by the caller to 3815// add HTTP headers to the request. 3816func (c *ProjectsLocationsKeyRingsCryptoKeysDecryptCall) Header() http.Header { 3817 if c.header_ == nil { 3818 c.header_ = make(http.Header) 3819 } 3820 return c.header_ 3821} 3822 3823func (c *ProjectsLocationsKeyRingsCryptoKeysDecryptCall) doRequest(alt string) (*http.Response, error) { 3824 reqHeaders := make(http.Header) 3825 reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190926") 3826 for k, v := range c.header_ { 3827 reqHeaders[k] = v 3828 } 3829 reqHeaders.Set("User-Agent", c.s.userAgent()) 3830 var body io.Reader = nil 3831 body, err := googleapi.WithoutDataWrapper.JSONReader(c.decryptrequest) 3832 if err != nil { 3833 return nil, err 3834 } 3835 reqHeaders.Set("Content-Type", "application/json") 3836 c.urlParams_.Set("alt", alt) 3837 c.urlParams_.Set("prettyPrint", "false") 3838 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}:decrypt") 3839 urls += "?" + c.urlParams_.Encode() 3840 req, err := http.NewRequest("POST", urls, body) 3841 if err != nil { 3842 return nil, err 3843 } 3844 req.Header = reqHeaders 3845 googleapi.Expand(req.URL, map[string]string{ 3846 "name": c.name, 3847 }) 3848 return gensupport.SendRequest(c.ctx_, c.s.client, req) 3849} 3850 3851// Do executes the "cloudkms.projects.locations.keyRings.cryptoKeys.decrypt" call. 3852// Exactly one of *DecryptResponse or error will be non-nil. Any non-2xx 3853// status code is an error. Response headers are in either 3854// *DecryptResponse.ServerResponse.Header or (if a response was returned 3855// at all) in error.(*googleapi.Error).Header. Use 3856// googleapi.IsNotModified to check whether the returned error was 3857// because http.StatusNotModified was returned. 3858func (c *ProjectsLocationsKeyRingsCryptoKeysDecryptCall) Do(opts ...googleapi.CallOption) (*DecryptResponse, error) { 3859 gensupport.SetOptions(c.urlParams_, opts...) 3860 res, err := c.doRequest("json") 3861 if res != nil && res.StatusCode == http.StatusNotModified { 3862 if res.Body != nil { 3863 res.Body.Close() 3864 } 3865 return nil, &googleapi.Error{ 3866 Code: res.StatusCode, 3867 Header: res.Header, 3868 } 3869 } 3870 if err != nil { 3871 return nil, err 3872 } 3873 defer googleapi.CloseBody(res) 3874 if err := googleapi.CheckResponse(res); err != nil { 3875 return nil, err 3876 } 3877 ret := &DecryptResponse{ 3878 ServerResponse: googleapi.ServerResponse{ 3879 Header: res.Header, 3880 HTTPStatusCode: res.StatusCode, 3881 }, 3882 } 3883 target := &ret 3884 if err := gensupport.DecodeResponse(target, res); err != nil { 3885 return nil, err 3886 } 3887 return ret, nil 3888 // { 3889 // "description": "Decrypts data that was protected by Encrypt. The CryptoKey.purpose\nmust be ENCRYPT_DECRYPT.", 3890 // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/keyRings/{keyRingsId}/cryptoKeys/{cryptoKeysId}:decrypt", 3891 // "httpMethod": "POST", 3892 // "id": "cloudkms.projects.locations.keyRings.cryptoKeys.decrypt", 3893 // "parameterOrder": [ 3894 // "name" 3895 // ], 3896 // "parameters": { 3897 // "name": { 3898 // "description": "Required. The resource name of the CryptoKey to use for decryption.\nThe server will choose the appropriate version.", 3899 // "location": "path", 3900 // "pattern": "^projects/[^/]+/locations/[^/]+/keyRings/[^/]+/cryptoKeys/[^/]+$", 3901 // "required": true, 3902 // "type": "string" 3903 // } 3904 // }, 3905 // "path": "v1/{+name}:decrypt", 3906 // "request": { 3907 // "$ref": "DecryptRequest" 3908 // }, 3909 // "response": { 3910 // "$ref": "DecryptResponse" 3911 // }, 3912 // "scopes": [ 3913 // "https://www.googleapis.com/auth/cloud-platform", 3914 // "https://www.googleapis.com/auth/cloudkms" 3915 // ] 3916 // } 3917 3918} 3919 3920// method id "cloudkms.projects.locations.keyRings.cryptoKeys.encrypt": 3921 3922type ProjectsLocationsKeyRingsCryptoKeysEncryptCall struct { 3923 s *Service 3924 name string 3925 encryptrequest *EncryptRequest 3926 urlParams_ gensupport.URLParams 3927 ctx_ context.Context 3928 header_ http.Header 3929} 3930 3931// Encrypt: Encrypts data, so that it can only be recovered by a call to 3932// Decrypt. 3933// The CryptoKey.purpose must be 3934// ENCRYPT_DECRYPT. 3935func (r *ProjectsLocationsKeyRingsCryptoKeysService) Encrypt(name string, encryptrequest *EncryptRequest) *ProjectsLocationsKeyRingsCryptoKeysEncryptCall { 3936 c := &ProjectsLocationsKeyRingsCryptoKeysEncryptCall{s: r.s, urlParams_: make(gensupport.URLParams)} 3937 c.name = name 3938 c.encryptrequest = encryptrequest 3939 return c 3940} 3941 3942// Fields allows partial responses to be retrieved. See 3943// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 3944// for more information. 3945func (c *ProjectsLocationsKeyRingsCryptoKeysEncryptCall) Fields(s ...googleapi.Field) *ProjectsLocationsKeyRingsCryptoKeysEncryptCall { 3946 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 3947 return c 3948} 3949 3950// Context sets the context to be used in this call's Do method. Any 3951// pending HTTP request will be aborted if the provided context is 3952// canceled. 3953func (c *ProjectsLocationsKeyRingsCryptoKeysEncryptCall) Context(ctx context.Context) *ProjectsLocationsKeyRingsCryptoKeysEncryptCall { 3954 c.ctx_ = ctx 3955 return c 3956} 3957 3958// Header returns an http.Header that can be modified by the caller to 3959// add HTTP headers to the request. 3960func (c *ProjectsLocationsKeyRingsCryptoKeysEncryptCall) Header() http.Header { 3961 if c.header_ == nil { 3962 c.header_ = make(http.Header) 3963 } 3964 return c.header_ 3965} 3966 3967func (c *ProjectsLocationsKeyRingsCryptoKeysEncryptCall) doRequest(alt string) (*http.Response, error) { 3968 reqHeaders := make(http.Header) 3969 reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190926") 3970 for k, v := range c.header_ { 3971 reqHeaders[k] = v 3972 } 3973 reqHeaders.Set("User-Agent", c.s.userAgent()) 3974 var body io.Reader = nil 3975 body, err := googleapi.WithoutDataWrapper.JSONReader(c.encryptrequest) 3976 if err != nil { 3977 return nil, err 3978 } 3979 reqHeaders.Set("Content-Type", "application/json") 3980 c.urlParams_.Set("alt", alt) 3981 c.urlParams_.Set("prettyPrint", "false") 3982 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}:encrypt") 3983 urls += "?" + c.urlParams_.Encode() 3984 req, err := http.NewRequest("POST", urls, body) 3985 if err != nil { 3986 return nil, err 3987 } 3988 req.Header = reqHeaders 3989 googleapi.Expand(req.URL, map[string]string{ 3990 "name": c.name, 3991 }) 3992 return gensupport.SendRequest(c.ctx_, c.s.client, req) 3993} 3994 3995// Do executes the "cloudkms.projects.locations.keyRings.cryptoKeys.encrypt" call. 3996// Exactly one of *EncryptResponse or error will be non-nil. Any non-2xx 3997// status code is an error. Response headers are in either 3998// *EncryptResponse.ServerResponse.Header or (if a response was returned 3999// at all) in error.(*googleapi.Error).Header. Use 4000// googleapi.IsNotModified to check whether the returned error was 4001// because http.StatusNotModified was returned. 4002func (c *ProjectsLocationsKeyRingsCryptoKeysEncryptCall) Do(opts ...googleapi.CallOption) (*EncryptResponse, error) { 4003 gensupport.SetOptions(c.urlParams_, opts...) 4004 res, err := c.doRequest("json") 4005 if res != nil && res.StatusCode == http.StatusNotModified { 4006 if res.Body != nil { 4007 res.Body.Close() 4008 } 4009 return nil, &googleapi.Error{ 4010 Code: res.StatusCode, 4011 Header: res.Header, 4012 } 4013 } 4014 if err != nil { 4015 return nil, err 4016 } 4017 defer googleapi.CloseBody(res) 4018 if err := googleapi.CheckResponse(res); err != nil { 4019 return nil, err 4020 } 4021 ret := &EncryptResponse{ 4022 ServerResponse: googleapi.ServerResponse{ 4023 Header: res.Header, 4024 HTTPStatusCode: res.StatusCode, 4025 }, 4026 } 4027 target := &ret 4028 if err := gensupport.DecodeResponse(target, res); err != nil { 4029 return nil, err 4030 } 4031 return ret, nil 4032 // { 4033 // "description": "Encrypts data, so that it can only be recovered by a call to Decrypt.\nThe CryptoKey.purpose must be\nENCRYPT_DECRYPT.", 4034 // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/keyRings/{keyRingsId}/cryptoKeys/{cryptoKeysId}:encrypt", 4035 // "httpMethod": "POST", 4036 // "id": "cloudkms.projects.locations.keyRings.cryptoKeys.encrypt", 4037 // "parameterOrder": [ 4038 // "name" 4039 // ], 4040 // "parameters": { 4041 // "name": { 4042 // "description": "Required. The resource name of the CryptoKey or CryptoKeyVersion\nto use for encryption.\n\nIf a CryptoKey is specified, the server will use its\nprimary version.", 4043 // "location": "path", 4044 // "pattern": "^projects/[^/]+/locations/[^/]+/keyRings/[^/]+/cryptoKeys/.+$", 4045 // "required": true, 4046 // "type": "string" 4047 // } 4048 // }, 4049 // "path": "v1/{+name}:encrypt", 4050 // "request": { 4051 // "$ref": "EncryptRequest" 4052 // }, 4053 // "response": { 4054 // "$ref": "EncryptResponse" 4055 // }, 4056 // "scopes": [ 4057 // "https://www.googleapis.com/auth/cloud-platform", 4058 // "https://www.googleapis.com/auth/cloudkms" 4059 // ] 4060 // } 4061 4062} 4063 4064// method id "cloudkms.projects.locations.keyRings.cryptoKeys.get": 4065 4066type ProjectsLocationsKeyRingsCryptoKeysGetCall struct { 4067 s *Service 4068 name string 4069 urlParams_ gensupport.URLParams 4070 ifNoneMatch_ string 4071 ctx_ context.Context 4072 header_ http.Header 4073} 4074 4075// Get: Returns metadata for a given CryptoKey, as well as its 4076// primary CryptoKeyVersion. 4077func (r *ProjectsLocationsKeyRingsCryptoKeysService) Get(name string) *ProjectsLocationsKeyRingsCryptoKeysGetCall { 4078 c := &ProjectsLocationsKeyRingsCryptoKeysGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 4079 c.name = name 4080 return c 4081} 4082 4083// Fields allows partial responses to be retrieved. See 4084// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 4085// for more information. 4086func (c *ProjectsLocationsKeyRingsCryptoKeysGetCall) Fields(s ...googleapi.Field) *ProjectsLocationsKeyRingsCryptoKeysGetCall { 4087 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 4088 return c 4089} 4090 4091// IfNoneMatch sets the optional parameter which makes the operation 4092// fail if the object's ETag matches the given value. This is useful for 4093// getting updates only after the object has changed since the last 4094// request. Use googleapi.IsNotModified to check whether the response 4095// error from Do is the result of In-None-Match. 4096func (c *ProjectsLocationsKeyRingsCryptoKeysGetCall) IfNoneMatch(entityTag string) *ProjectsLocationsKeyRingsCryptoKeysGetCall { 4097 c.ifNoneMatch_ = entityTag 4098 return c 4099} 4100 4101// Context sets the context to be used in this call's Do method. Any 4102// pending HTTP request will be aborted if the provided context is 4103// canceled. 4104func (c *ProjectsLocationsKeyRingsCryptoKeysGetCall) Context(ctx context.Context) *ProjectsLocationsKeyRingsCryptoKeysGetCall { 4105 c.ctx_ = ctx 4106 return c 4107} 4108 4109// Header returns an http.Header that can be modified by the caller to 4110// add HTTP headers to the request. 4111func (c *ProjectsLocationsKeyRingsCryptoKeysGetCall) Header() http.Header { 4112 if c.header_ == nil { 4113 c.header_ = make(http.Header) 4114 } 4115 return c.header_ 4116} 4117 4118func (c *ProjectsLocationsKeyRingsCryptoKeysGetCall) doRequest(alt string) (*http.Response, error) { 4119 reqHeaders := make(http.Header) 4120 reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190926") 4121 for k, v := range c.header_ { 4122 reqHeaders[k] = v 4123 } 4124 reqHeaders.Set("User-Agent", c.s.userAgent()) 4125 if c.ifNoneMatch_ != "" { 4126 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 4127 } 4128 var body io.Reader = nil 4129 c.urlParams_.Set("alt", alt) 4130 c.urlParams_.Set("prettyPrint", "false") 4131 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}") 4132 urls += "?" + c.urlParams_.Encode() 4133 req, err := http.NewRequest("GET", urls, body) 4134 if err != nil { 4135 return nil, err 4136 } 4137 req.Header = reqHeaders 4138 googleapi.Expand(req.URL, map[string]string{ 4139 "name": c.name, 4140 }) 4141 return gensupport.SendRequest(c.ctx_, c.s.client, req) 4142} 4143 4144// Do executes the "cloudkms.projects.locations.keyRings.cryptoKeys.get" call. 4145// Exactly one of *CryptoKey or error will be non-nil. Any non-2xx 4146// status code is an error. Response headers are in either 4147// *CryptoKey.ServerResponse.Header or (if a response was returned at 4148// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 4149// to check whether the returned error was because 4150// http.StatusNotModified was returned. 4151func (c *ProjectsLocationsKeyRingsCryptoKeysGetCall) Do(opts ...googleapi.CallOption) (*CryptoKey, error) { 4152 gensupport.SetOptions(c.urlParams_, opts...) 4153 res, err := c.doRequest("json") 4154 if res != nil && res.StatusCode == http.StatusNotModified { 4155 if res.Body != nil { 4156 res.Body.Close() 4157 } 4158 return nil, &googleapi.Error{ 4159 Code: res.StatusCode, 4160 Header: res.Header, 4161 } 4162 } 4163 if err != nil { 4164 return nil, err 4165 } 4166 defer googleapi.CloseBody(res) 4167 if err := googleapi.CheckResponse(res); err != nil { 4168 return nil, err 4169 } 4170 ret := &CryptoKey{ 4171 ServerResponse: googleapi.ServerResponse{ 4172 Header: res.Header, 4173 HTTPStatusCode: res.StatusCode, 4174 }, 4175 } 4176 target := &ret 4177 if err := gensupport.DecodeResponse(target, res); err != nil { 4178 return nil, err 4179 } 4180 return ret, nil 4181 // { 4182 // "description": "Returns metadata for a given CryptoKey, as well as its\nprimary CryptoKeyVersion.", 4183 // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/keyRings/{keyRingsId}/cryptoKeys/{cryptoKeysId}", 4184 // "httpMethod": "GET", 4185 // "id": "cloudkms.projects.locations.keyRings.cryptoKeys.get", 4186 // "parameterOrder": [ 4187 // "name" 4188 // ], 4189 // "parameters": { 4190 // "name": { 4191 // "description": "Required. The name of the CryptoKey to get.", 4192 // "location": "path", 4193 // "pattern": "^projects/[^/]+/locations/[^/]+/keyRings/[^/]+/cryptoKeys/[^/]+$", 4194 // "required": true, 4195 // "type": "string" 4196 // } 4197 // }, 4198 // "path": "v1/{+name}", 4199 // "response": { 4200 // "$ref": "CryptoKey" 4201 // }, 4202 // "scopes": [ 4203 // "https://www.googleapis.com/auth/cloud-platform", 4204 // "https://www.googleapis.com/auth/cloudkms" 4205 // ] 4206 // } 4207 4208} 4209 4210// method id "cloudkms.projects.locations.keyRings.cryptoKeys.getIamPolicy": 4211 4212type ProjectsLocationsKeyRingsCryptoKeysGetIamPolicyCall struct { 4213 s *Service 4214 resource string 4215 urlParams_ gensupport.URLParams 4216 ifNoneMatch_ string 4217 ctx_ context.Context 4218 header_ http.Header 4219} 4220 4221// GetIamPolicy: Gets the access control policy for a resource. 4222// Returns an empty policy if the resource exists and does not have a 4223// policy 4224// set. 4225func (r *ProjectsLocationsKeyRingsCryptoKeysService) GetIamPolicy(resource string) *ProjectsLocationsKeyRingsCryptoKeysGetIamPolicyCall { 4226 c := &ProjectsLocationsKeyRingsCryptoKeysGetIamPolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)} 4227 c.resource = resource 4228 return c 4229} 4230 4231// OptionsRequestedPolicyVersion sets the optional parameter 4232// "options.requestedPolicyVersion": The policy format version to be 4233// returned. 4234// 4235// Valid values are 0, 1, and 3. Requests specifying an invalid value 4236// will be 4237// rejected. 4238// 4239// Requests for policies with any conditional bindings must specify 4240// version 3. 4241// Policies without any conditional bindings may specify any valid value 4242// or 4243// leave the field unset. 4244func (c *ProjectsLocationsKeyRingsCryptoKeysGetIamPolicyCall) OptionsRequestedPolicyVersion(optionsRequestedPolicyVersion int64) *ProjectsLocationsKeyRingsCryptoKeysGetIamPolicyCall { 4245 c.urlParams_.Set("options.requestedPolicyVersion", fmt.Sprint(optionsRequestedPolicyVersion)) 4246 return c 4247} 4248 4249// Fields allows partial responses to be retrieved. See 4250// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 4251// for more information. 4252func (c *ProjectsLocationsKeyRingsCryptoKeysGetIamPolicyCall) Fields(s ...googleapi.Field) *ProjectsLocationsKeyRingsCryptoKeysGetIamPolicyCall { 4253 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 4254 return c 4255} 4256 4257// IfNoneMatch sets the optional parameter which makes the operation 4258// fail if the object's ETag matches the given value. This is useful for 4259// getting updates only after the object has changed since the last 4260// request. Use googleapi.IsNotModified to check whether the response 4261// error from Do is the result of In-None-Match. 4262func (c *ProjectsLocationsKeyRingsCryptoKeysGetIamPolicyCall) IfNoneMatch(entityTag string) *ProjectsLocationsKeyRingsCryptoKeysGetIamPolicyCall { 4263 c.ifNoneMatch_ = entityTag 4264 return c 4265} 4266 4267// Context sets the context to be used in this call's Do method. Any 4268// pending HTTP request will be aborted if the provided context is 4269// canceled. 4270func (c *ProjectsLocationsKeyRingsCryptoKeysGetIamPolicyCall) Context(ctx context.Context) *ProjectsLocationsKeyRingsCryptoKeysGetIamPolicyCall { 4271 c.ctx_ = ctx 4272 return c 4273} 4274 4275// Header returns an http.Header that can be modified by the caller to 4276// add HTTP headers to the request. 4277func (c *ProjectsLocationsKeyRingsCryptoKeysGetIamPolicyCall) Header() http.Header { 4278 if c.header_ == nil { 4279 c.header_ = make(http.Header) 4280 } 4281 return c.header_ 4282} 4283 4284func (c *ProjectsLocationsKeyRingsCryptoKeysGetIamPolicyCall) doRequest(alt string) (*http.Response, error) { 4285 reqHeaders := make(http.Header) 4286 reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190926") 4287 for k, v := range c.header_ { 4288 reqHeaders[k] = v 4289 } 4290 reqHeaders.Set("User-Agent", c.s.userAgent()) 4291 if c.ifNoneMatch_ != "" { 4292 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 4293 } 4294 var body io.Reader = nil 4295 c.urlParams_.Set("alt", alt) 4296 c.urlParams_.Set("prettyPrint", "false") 4297 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+resource}:getIamPolicy") 4298 urls += "?" + c.urlParams_.Encode() 4299 req, err := http.NewRequest("GET", urls, body) 4300 if err != nil { 4301 return nil, err 4302 } 4303 req.Header = reqHeaders 4304 googleapi.Expand(req.URL, map[string]string{ 4305 "resource": c.resource, 4306 }) 4307 return gensupport.SendRequest(c.ctx_, c.s.client, req) 4308} 4309 4310// Do executes the "cloudkms.projects.locations.keyRings.cryptoKeys.getIamPolicy" call. 4311// Exactly one of *Policy or error will be non-nil. Any non-2xx status 4312// code is an error. Response headers are in either 4313// *Policy.ServerResponse.Header or (if a response was returned at all) 4314// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 4315// check whether the returned error was because http.StatusNotModified 4316// was returned. 4317func (c *ProjectsLocationsKeyRingsCryptoKeysGetIamPolicyCall) Do(opts ...googleapi.CallOption) (*Policy, error) { 4318 gensupport.SetOptions(c.urlParams_, opts...) 4319 res, err := c.doRequest("json") 4320 if res != nil && res.StatusCode == http.StatusNotModified { 4321 if res.Body != nil { 4322 res.Body.Close() 4323 } 4324 return nil, &googleapi.Error{ 4325 Code: res.StatusCode, 4326 Header: res.Header, 4327 } 4328 } 4329 if err != nil { 4330 return nil, err 4331 } 4332 defer googleapi.CloseBody(res) 4333 if err := googleapi.CheckResponse(res); err != nil { 4334 return nil, err 4335 } 4336 ret := &Policy{ 4337 ServerResponse: googleapi.ServerResponse{ 4338 Header: res.Header, 4339 HTTPStatusCode: res.StatusCode, 4340 }, 4341 } 4342 target := &ret 4343 if err := gensupport.DecodeResponse(target, res); err != nil { 4344 return nil, err 4345 } 4346 return ret, nil 4347 // { 4348 // "description": "Gets the access control policy for a resource.\nReturns an empty policy if the resource exists and does not have a policy\nset.", 4349 // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/keyRings/{keyRingsId}/cryptoKeys/{cryptoKeysId}:getIamPolicy", 4350 // "httpMethod": "GET", 4351 // "id": "cloudkms.projects.locations.keyRings.cryptoKeys.getIamPolicy", 4352 // "parameterOrder": [ 4353 // "resource" 4354 // ], 4355 // "parameters": { 4356 // "options.requestedPolicyVersion": { 4357 // "description": "Optional. The policy format version to be returned.\n\nValid values are 0, 1, and 3. Requests specifying an invalid value will be\nrejected.\n\nRequests for policies with any conditional bindings must specify version 3.\nPolicies without any conditional bindings may specify any valid value or\nleave the field unset.", 4358 // "format": "int32", 4359 // "location": "query", 4360 // "type": "integer" 4361 // }, 4362 // "resource": { 4363 // "description": "REQUIRED: The resource for which the policy is being requested.\nSee the operation documentation for the appropriate value for this field.", 4364 // "location": "path", 4365 // "pattern": "^projects/[^/]+/locations/[^/]+/keyRings/[^/]+/cryptoKeys/[^/]+$", 4366 // "required": true, 4367 // "type": "string" 4368 // } 4369 // }, 4370 // "path": "v1/{+resource}:getIamPolicy", 4371 // "response": { 4372 // "$ref": "Policy" 4373 // }, 4374 // "scopes": [ 4375 // "https://www.googleapis.com/auth/cloud-platform", 4376 // "https://www.googleapis.com/auth/cloudkms" 4377 // ] 4378 // } 4379 4380} 4381 4382// method id "cloudkms.projects.locations.keyRings.cryptoKeys.list": 4383 4384type ProjectsLocationsKeyRingsCryptoKeysListCall struct { 4385 s *Service 4386 parent string 4387 urlParams_ gensupport.URLParams 4388 ifNoneMatch_ string 4389 ctx_ context.Context 4390 header_ http.Header 4391} 4392 4393// List: Lists CryptoKeys. 4394func (r *ProjectsLocationsKeyRingsCryptoKeysService) List(parent string) *ProjectsLocationsKeyRingsCryptoKeysListCall { 4395 c := &ProjectsLocationsKeyRingsCryptoKeysListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 4396 c.parent = parent 4397 return c 4398} 4399 4400// Filter sets the optional parameter "filter": Only include resources 4401// that match the filter in the response. For 4402// more information, see 4403// [Sorting and filtering 4404// list 4405// results](https://cloud.google.com/kms/docs/sorting-and-filtering) 4406// . 4407func (c *ProjectsLocationsKeyRingsCryptoKeysListCall) Filter(filter string) *ProjectsLocationsKeyRingsCryptoKeysListCall { 4408 c.urlParams_.Set("filter", filter) 4409 return c 4410} 4411 4412// OrderBy sets the optional parameter "orderBy": Specify how the 4413// results should be sorted. If not specified, the 4414// results will be sorted in the default order. For more information, 4415// see 4416// [Sorting and filtering 4417// list 4418// results](https://cloud.google.com/kms/docs/sorting-and-filtering) 4419// . 4420func (c *ProjectsLocationsKeyRingsCryptoKeysListCall) OrderBy(orderBy string) *ProjectsLocationsKeyRingsCryptoKeysListCall { 4421 c.urlParams_.Set("orderBy", orderBy) 4422 return c 4423} 4424 4425// PageSize sets the optional parameter "pageSize": Optional limit on 4426// the number of CryptoKeys to include in the 4427// response. Further CryptoKeys can subsequently be obtained 4428// by 4429// including the ListCryptoKeysResponse.next_page_token in a 4430// subsequent 4431// request. If unspecified, the server will pick an appropriate 4432// default. 4433func (c *ProjectsLocationsKeyRingsCryptoKeysListCall) PageSize(pageSize int64) *ProjectsLocationsKeyRingsCryptoKeysListCall { 4434 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize)) 4435 return c 4436} 4437 4438// PageToken sets the optional parameter "pageToken": Optional 4439// pagination token, returned earlier 4440// via 4441// ListCryptoKeysResponse.next_page_token. 4442func (c *ProjectsLocationsKeyRingsCryptoKeysListCall) PageToken(pageToken string) *ProjectsLocationsKeyRingsCryptoKeysListCall { 4443 c.urlParams_.Set("pageToken", pageToken) 4444 return c 4445} 4446 4447// VersionView sets the optional parameter "versionView": The fields of 4448// the primary version to include in the response. 4449// 4450// Possible values: 4451// "CRYPTO_KEY_VERSION_VIEW_UNSPECIFIED" 4452// "FULL" 4453func (c *ProjectsLocationsKeyRingsCryptoKeysListCall) VersionView(versionView string) *ProjectsLocationsKeyRingsCryptoKeysListCall { 4454 c.urlParams_.Set("versionView", versionView) 4455 return c 4456} 4457 4458// Fields allows partial responses to be retrieved. See 4459// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 4460// for more information. 4461func (c *ProjectsLocationsKeyRingsCryptoKeysListCall) Fields(s ...googleapi.Field) *ProjectsLocationsKeyRingsCryptoKeysListCall { 4462 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 4463 return c 4464} 4465 4466// IfNoneMatch sets the optional parameter which makes the operation 4467// fail if the object's ETag matches the given value. This is useful for 4468// getting updates only after the object has changed since the last 4469// request. Use googleapi.IsNotModified to check whether the response 4470// error from Do is the result of In-None-Match. 4471func (c *ProjectsLocationsKeyRingsCryptoKeysListCall) IfNoneMatch(entityTag string) *ProjectsLocationsKeyRingsCryptoKeysListCall { 4472 c.ifNoneMatch_ = entityTag 4473 return c 4474} 4475 4476// Context sets the context to be used in this call's Do method. Any 4477// pending HTTP request will be aborted if the provided context is 4478// canceled. 4479func (c *ProjectsLocationsKeyRingsCryptoKeysListCall) Context(ctx context.Context) *ProjectsLocationsKeyRingsCryptoKeysListCall { 4480 c.ctx_ = ctx 4481 return c 4482} 4483 4484// Header returns an http.Header that can be modified by the caller to 4485// add HTTP headers to the request. 4486func (c *ProjectsLocationsKeyRingsCryptoKeysListCall) Header() http.Header { 4487 if c.header_ == nil { 4488 c.header_ = make(http.Header) 4489 } 4490 return c.header_ 4491} 4492 4493func (c *ProjectsLocationsKeyRingsCryptoKeysListCall) doRequest(alt string) (*http.Response, error) { 4494 reqHeaders := make(http.Header) 4495 reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190926") 4496 for k, v := range c.header_ { 4497 reqHeaders[k] = v 4498 } 4499 reqHeaders.Set("User-Agent", c.s.userAgent()) 4500 if c.ifNoneMatch_ != "" { 4501 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 4502 } 4503 var body io.Reader = nil 4504 c.urlParams_.Set("alt", alt) 4505 c.urlParams_.Set("prettyPrint", "false") 4506 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}/cryptoKeys") 4507 urls += "?" + c.urlParams_.Encode() 4508 req, err := http.NewRequest("GET", urls, body) 4509 if err != nil { 4510 return nil, err 4511 } 4512 req.Header = reqHeaders 4513 googleapi.Expand(req.URL, map[string]string{ 4514 "parent": c.parent, 4515 }) 4516 return gensupport.SendRequest(c.ctx_, c.s.client, req) 4517} 4518 4519// Do executes the "cloudkms.projects.locations.keyRings.cryptoKeys.list" call. 4520// Exactly one of *ListCryptoKeysResponse or error will be non-nil. Any 4521// non-2xx status code is an error. Response headers are in either 4522// *ListCryptoKeysResponse.ServerResponse.Header or (if a response was 4523// returned at all) in error.(*googleapi.Error).Header. Use 4524// googleapi.IsNotModified to check whether the returned error was 4525// because http.StatusNotModified was returned. 4526func (c *ProjectsLocationsKeyRingsCryptoKeysListCall) Do(opts ...googleapi.CallOption) (*ListCryptoKeysResponse, error) { 4527 gensupport.SetOptions(c.urlParams_, opts...) 4528 res, err := c.doRequest("json") 4529 if res != nil && res.StatusCode == http.StatusNotModified { 4530 if res.Body != nil { 4531 res.Body.Close() 4532 } 4533 return nil, &googleapi.Error{ 4534 Code: res.StatusCode, 4535 Header: res.Header, 4536 } 4537 } 4538 if err != nil { 4539 return nil, err 4540 } 4541 defer googleapi.CloseBody(res) 4542 if err := googleapi.CheckResponse(res); err != nil { 4543 return nil, err 4544 } 4545 ret := &ListCryptoKeysResponse{ 4546 ServerResponse: googleapi.ServerResponse{ 4547 Header: res.Header, 4548 HTTPStatusCode: res.StatusCode, 4549 }, 4550 } 4551 target := &ret 4552 if err := gensupport.DecodeResponse(target, res); err != nil { 4553 return nil, err 4554 } 4555 return ret, nil 4556 // { 4557 // "description": "Lists CryptoKeys.", 4558 // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/keyRings/{keyRingsId}/cryptoKeys", 4559 // "httpMethod": "GET", 4560 // "id": "cloudkms.projects.locations.keyRings.cryptoKeys.list", 4561 // "parameterOrder": [ 4562 // "parent" 4563 // ], 4564 // "parameters": { 4565 // "filter": { 4566 // "description": "Optional. Only include resources that match the filter in the response. For\nmore information, see\n[Sorting and filtering list\nresults](https://cloud.google.com/kms/docs/sorting-and-filtering).", 4567 // "location": "query", 4568 // "type": "string" 4569 // }, 4570 // "orderBy": { 4571 // "description": "Optional. Specify how the results should be sorted. If not specified, the\nresults will be sorted in the default order. For more information, see\n[Sorting and filtering list\nresults](https://cloud.google.com/kms/docs/sorting-and-filtering).", 4572 // "location": "query", 4573 // "type": "string" 4574 // }, 4575 // "pageSize": { 4576 // "description": "Optional. Optional limit on the number of CryptoKeys to include in the\nresponse. Further CryptoKeys can subsequently be obtained by\nincluding the ListCryptoKeysResponse.next_page_token in a subsequent\nrequest. If unspecified, the server will pick an appropriate default.", 4577 // "format": "int32", 4578 // "location": "query", 4579 // "type": "integer" 4580 // }, 4581 // "pageToken": { 4582 // "description": "Optional. Optional pagination token, returned earlier via\nListCryptoKeysResponse.next_page_token.", 4583 // "location": "query", 4584 // "type": "string" 4585 // }, 4586 // "parent": { 4587 // "description": "Required. The resource name of the KeyRing to list, in the format\n`projects/*/locations/*/keyRings/*`.", 4588 // "location": "path", 4589 // "pattern": "^projects/[^/]+/locations/[^/]+/keyRings/[^/]+$", 4590 // "required": true, 4591 // "type": "string" 4592 // }, 4593 // "versionView": { 4594 // "description": "The fields of the primary version to include in the response.", 4595 // "enum": [ 4596 // "CRYPTO_KEY_VERSION_VIEW_UNSPECIFIED", 4597 // "FULL" 4598 // ], 4599 // "location": "query", 4600 // "type": "string" 4601 // } 4602 // }, 4603 // "path": "v1/{+parent}/cryptoKeys", 4604 // "response": { 4605 // "$ref": "ListCryptoKeysResponse" 4606 // }, 4607 // "scopes": [ 4608 // "https://www.googleapis.com/auth/cloud-platform", 4609 // "https://www.googleapis.com/auth/cloudkms" 4610 // ] 4611 // } 4612 4613} 4614 4615// Pages invokes f for each page of results. 4616// A non-nil error returned from f will halt the iteration. 4617// The provided context supersedes any context provided to the Context method. 4618func (c *ProjectsLocationsKeyRingsCryptoKeysListCall) Pages(ctx context.Context, f func(*ListCryptoKeysResponse) error) error { 4619 c.ctx_ = ctx 4620 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 4621 for { 4622 x, err := c.Do() 4623 if err != nil { 4624 return err 4625 } 4626 if err := f(x); err != nil { 4627 return err 4628 } 4629 if x.NextPageToken == "" { 4630 return nil 4631 } 4632 c.PageToken(x.NextPageToken) 4633 } 4634} 4635 4636// method id "cloudkms.projects.locations.keyRings.cryptoKeys.patch": 4637 4638type ProjectsLocationsKeyRingsCryptoKeysPatchCall struct { 4639 s *Service 4640 name string 4641 cryptokey *CryptoKey 4642 urlParams_ gensupport.URLParams 4643 ctx_ context.Context 4644 header_ http.Header 4645} 4646 4647// Patch: Update a CryptoKey. 4648func (r *ProjectsLocationsKeyRingsCryptoKeysService) Patch(name string, cryptokey *CryptoKey) *ProjectsLocationsKeyRingsCryptoKeysPatchCall { 4649 c := &ProjectsLocationsKeyRingsCryptoKeysPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)} 4650 c.name = name 4651 c.cryptokey = cryptokey 4652 return c 4653} 4654 4655// UpdateMask sets the optional parameter "updateMask": Required. List 4656// of fields to be updated in this request. 4657func (c *ProjectsLocationsKeyRingsCryptoKeysPatchCall) UpdateMask(updateMask string) *ProjectsLocationsKeyRingsCryptoKeysPatchCall { 4658 c.urlParams_.Set("updateMask", updateMask) 4659 return c 4660} 4661 4662// Fields allows partial responses to be retrieved. See 4663// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 4664// for more information. 4665func (c *ProjectsLocationsKeyRingsCryptoKeysPatchCall) Fields(s ...googleapi.Field) *ProjectsLocationsKeyRingsCryptoKeysPatchCall { 4666 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 4667 return c 4668} 4669 4670// Context sets the context to be used in this call's Do method. Any 4671// pending HTTP request will be aborted if the provided context is 4672// canceled. 4673func (c *ProjectsLocationsKeyRingsCryptoKeysPatchCall) Context(ctx context.Context) *ProjectsLocationsKeyRingsCryptoKeysPatchCall { 4674 c.ctx_ = ctx 4675 return c 4676} 4677 4678// Header returns an http.Header that can be modified by the caller to 4679// add HTTP headers to the request. 4680func (c *ProjectsLocationsKeyRingsCryptoKeysPatchCall) Header() http.Header { 4681 if c.header_ == nil { 4682 c.header_ = make(http.Header) 4683 } 4684 return c.header_ 4685} 4686 4687func (c *ProjectsLocationsKeyRingsCryptoKeysPatchCall) doRequest(alt string) (*http.Response, error) { 4688 reqHeaders := make(http.Header) 4689 reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190926") 4690 for k, v := range c.header_ { 4691 reqHeaders[k] = v 4692 } 4693 reqHeaders.Set("User-Agent", c.s.userAgent()) 4694 var body io.Reader = nil 4695 body, err := googleapi.WithoutDataWrapper.JSONReader(c.cryptokey) 4696 if err != nil { 4697 return nil, err 4698 } 4699 reqHeaders.Set("Content-Type", "application/json") 4700 c.urlParams_.Set("alt", alt) 4701 c.urlParams_.Set("prettyPrint", "false") 4702 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}") 4703 urls += "?" + c.urlParams_.Encode() 4704 req, err := http.NewRequest("PATCH", urls, body) 4705 if err != nil { 4706 return nil, err 4707 } 4708 req.Header = reqHeaders 4709 googleapi.Expand(req.URL, map[string]string{ 4710 "name": c.name, 4711 }) 4712 return gensupport.SendRequest(c.ctx_, c.s.client, req) 4713} 4714 4715// Do executes the "cloudkms.projects.locations.keyRings.cryptoKeys.patch" call. 4716// Exactly one of *CryptoKey or error will be non-nil. Any non-2xx 4717// status code is an error. Response headers are in either 4718// *CryptoKey.ServerResponse.Header or (if a response was returned at 4719// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 4720// to check whether the returned error was because 4721// http.StatusNotModified was returned. 4722func (c *ProjectsLocationsKeyRingsCryptoKeysPatchCall) Do(opts ...googleapi.CallOption) (*CryptoKey, error) { 4723 gensupport.SetOptions(c.urlParams_, opts...) 4724 res, err := c.doRequest("json") 4725 if res != nil && res.StatusCode == http.StatusNotModified { 4726 if res.Body != nil { 4727 res.Body.Close() 4728 } 4729 return nil, &googleapi.Error{ 4730 Code: res.StatusCode, 4731 Header: res.Header, 4732 } 4733 } 4734 if err != nil { 4735 return nil, err 4736 } 4737 defer googleapi.CloseBody(res) 4738 if err := googleapi.CheckResponse(res); err != nil { 4739 return nil, err 4740 } 4741 ret := &CryptoKey{ 4742 ServerResponse: googleapi.ServerResponse{ 4743 Header: res.Header, 4744 HTTPStatusCode: res.StatusCode, 4745 }, 4746 } 4747 target := &ret 4748 if err := gensupport.DecodeResponse(target, res); err != nil { 4749 return nil, err 4750 } 4751 return ret, nil 4752 // { 4753 // "description": "Update a CryptoKey.", 4754 // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/keyRings/{keyRingsId}/cryptoKeys/{cryptoKeysId}", 4755 // "httpMethod": "PATCH", 4756 // "id": "cloudkms.projects.locations.keyRings.cryptoKeys.patch", 4757 // "parameterOrder": [ 4758 // "name" 4759 // ], 4760 // "parameters": { 4761 // "name": { 4762 // "description": "Output only. The resource name for this CryptoKey in the format\n`projects/*/locations/*/keyRings/*/cryptoKeys/*`.", 4763 // "location": "path", 4764 // "pattern": "^projects/[^/]+/locations/[^/]+/keyRings/[^/]+/cryptoKeys/[^/]+$", 4765 // "required": true, 4766 // "type": "string" 4767 // }, 4768 // "updateMask": { 4769 // "description": "Required. List of fields to be updated in this request.", 4770 // "format": "google-fieldmask", 4771 // "location": "query", 4772 // "type": "string" 4773 // } 4774 // }, 4775 // "path": "v1/{+name}", 4776 // "request": { 4777 // "$ref": "CryptoKey" 4778 // }, 4779 // "response": { 4780 // "$ref": "CryptoKey" 4781 // }, 4782 // "scopes": [ 4783 // "https://www.googleapis.com/auth/cloud-platform", 4784 // "https://www.googleapis.com/auth/cloudkms" 4785 // ] 4786 // } 4787 4788} 4789 4790// method id "cloudkms.projects.locations.keyRings.cryptoKeys.setIamPolicy": 4791 4792type ProjectsLocationsKeyRingsCryptoKeysSetIamPolicyCall struct { 4793 s *Service 4794 resource string 4795 setiampolicyrequest *SetIamPolicyRequest 4796 urlParams_ gensupport.URLParams 4797 ctx_ context.Context 4798 header_ http.Header 4799} 4800 4801// SetIamPolicy: Sets the access control policy on the specified 4802// resource. Replaces any 4803// existing policy. 4804func (r *ProjectsLocationsKeyRingsCryptoKeysService) SetIamPolicy(resource string, setiampolicyrequest *SetIamPolicyRequest) *ProjectsLocationsKeyRingsCryptoKeysSetIamPolicyCall { 4805 c := &ProjectsLocationsKeyRingsCryptoKeysSetIamPolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)} 4806 c.resource = resource 4807 c.setiampolicyrequest = setiampolicyrequest 4808 return c 4809} 4810 4811// Fields allows partial responses to be retrieved. See 4812// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 4813// for more information. 4814func (c *ProjectsLocationsKeyRingsCryptoKeysSetIamPolicyCall) Fields(s ...googleapi.Field) *ProjectsLocationsKeyRingsCryptoKeysSetIamPolicyCall { 4815 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 4816 return c 4817} 4818 4819// Context sets the context to be used in this call's Do method. Any 4820// pending HTTP request will be aborted if the provided context is 4821// canceled. 4822func (c *ProjectsLocationsKeyRingsCryptoKeysSetIamPolicyCall) Context(ctx context.Context) *ProjectsLocationsKeyRingsCryptoKeysSetIamPolicyCall { 4823 c.ctx_ = ctx 4824 return c 4825} 4826 4827// Header returns an http.Header that can be modified by the caller to 4828// add HTTP headers to the request. 4829func (c *ProjectsLocationsKeyRingsCryptoKeysSetIamPolicyCall) Header() http.Header { 4830 if c.header_ == nil { 4831 c.header_ = make(http.Header) 4832 } 4833 return c.header_ 4834} 4835 4836func (c *ProjectsLocationsKeyRingsCryptoKeysSetIamPolicyCall) doRequest(alt string) (*http.Response, error) { 4837 reqHeaders := make(http.Header) 4838 reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190926") 4839 for k, v := range c.header_ { 4840 reqHeaders[k] = v 4841 } 4842 reqHeaders.Set("User-Agent", c.s.userAgent()) 4843 var body io.Reader = nil 4844 body, err := googleapi.WithoutDataWrapper.JSONReader(c.setiampolicyrequest) 4845 if err != nil { 4846 return nil, err 4847 } 4848 reqHeaders.Set("Content-Type", "application/json") 4849 c.urlParams_.Set("alt", alt) 4850 c.urlParams_.Set("prettyPrint", "false") 4851 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+resource}:setIamPolicy") 4852 urls += "?" + c.urlParams_.Encode() 4853 req, err := http.NewRequest("POST", urls, body) 4854 if err != nil { 4855 return nil, err 4856 } 4857 req.Header = reqHeaders 4858 googleapi.Expand(req.URL, map[string]string{ 4859 "resource": c.resource, 4860 }) 4861 return gensupport.SendRequest(c.ctx_, c.s.client, req) 4862} 4863 4864// Do executes the "cloudkms.projects.locations.keyRings.cryptoKeys.setIamPolicy" call. 4865// Exactly one of *Policy or error will be non-nil. Any non-2xx status 4866// code is an error. Response headers are in either 4867// *Policy.ServerResponse.Header or (if a response was returned at all) 4868// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 4869// check whether the returned error was because http.StatusNotModified 4870// was returned. 4871func (c *ProjectsLocationsKeyRingsCryptoKeysSetIamPolicyCall) Do(opts ...googleapi.CallOption) (*Policy, error) { 4872 gensupport.SetOptions(c.urlParams_, opts...) 4873 res, err := c.doRequest("json") 4874 if res != nil && res.StatusCode == http.StatusNotModified { 4875 if res.Body != nil { 4876 res.Body.Close() 4877 } 4878 return nil, &googleapi.Error{ 4879 Code: res.StatusCode, 4880 Header: res.Header, 4881 } 4882 } 4883 if err != nil { 4884 return nil, err 4885 } 4886 defer googleapi.CloseBody(res) 4887 if err := googleapi.CheckResponse(res); err != nil { 4888 return nil, err 4889 } 4890 ret := &Policy{ 4891 ServerResponse: googleapi.ServerResponse{ 4892 Header: res.Header, 4893 HTTPStatusCode: res.StatusCode, 4894 }, 4895 } 4896 target := &ret 4897 if err := gensupport.DecodeResponse(target, res); err != nil { 4898 return nil, err 4899 } 4900 return ret, nil 4901 // { 4902 // "description": "Sets the access control policy on the specified resource. Replaces any\nexisting policy.", 4903 // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/keyRings/{keyRingsId}/cryptoKeys/{cryptoKeysId}:setIamPolicy", 4904 // "httpMethod": "POST", 4905 // "id": "cloudkms.projects.locations.keyRings.cryptoKeys.setIamPolicy", 4906 // "parameterOrder": [ 4907 // "resource" 4908 // ], 4909 // "parameters": { 4910 // "resource": { 4911 // "description": "REQUIRED: The resource for which the policy is being specified.\nSee the operation documentation for the appropriate value for this field.", 4912 // "location": "path", 4913 // "pattern": "^projects/[^/]+/locations/[^/]+/keyRings/[^/]+/cryptoKeys/[^/]+$", 4914 // "required": true, 4915 // "type": "string" 4916 // } 4917 // }, 4918 // "path": "v1/{+resource}:setIamPolicy", 4919 // "request": { 4920 // "$ref": "SetIamPolicyRequest" 4921 // }, 4922 // "response": { 4923 // "$ref": "Policy" 4924 // }, 4925 // "scopes": [ 4926 // "https://www.googleapis.com/auth/cloud-platform", 4927 // "https://www.googleapis.com/auth/cloudkms" 4928 // ] 4929 // } 4930 4931} 4932 4933// method id "cloudkms.projects.locations.keyRings.cryptoKeys.testIamPermissions": 4934 4935type ProjectsLocationsKeyRingsCryptoKeysTestIamPermissionsCall struct { 4936 s *Service 4937 resource string 4938 testiampermissionsrequest *TestIamPermissionsRequest 4939 urlParams_ gensupport.URLParams 4940 ctx_ context.Context 4941 header_ http.Header 4942} 4943 4944// TestIamPermissions: Returns permissions that a caller has on the 4945// specified resource. 4946// If the resource does not exist, this will return an empty set 4947// of 4948// permissions, not a NOT_FOUND error. 4949// 4950// Note: This operation is designed to be used for building 4951// permission-aware 4952// UIs and command-line tools, not for authorization checking. This 4953// operation 4954// may "fail open" without warning. 4955func (r *ProjectsLocationsKeyRingsCryptoKeysService) TestIamPermissions(resource string, testiampermissionsrequest *TestIamPermissionsRequest) *ProjectsLocationsKeyRingsCryptoKeysTestIamPermissionsCall { 4956 c := &ProjectsLocationsKeyRingsCryptoKeysTestIamPermissionsCall{s: r.s, urlParams_: make(gensupport.URLParams)} 4957 c.resource = resource 4958 c.testiampermissionsrequest = testiampermissionsrequest 4959 return c 4960} 4961 4962// Fields allows partial responses to be retrieved. See 4963// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 4964// for more information. 4965func (c *ProjectsLocationsKeyRingsCryptoKeysTestIamPermissionsCall) Fields(s ...googleapi.Field) *ProjectsLocationsKeyRingsCryptoKeysTestIamPermissionsCall { 4966 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 4967 return c 4968} 4969 4970// Context sets the context to be used in this call's Do method. Any 4971// pending HTTP request will be aborted if the provided context is 4972// canceled. 4973func (c *ProjectsLocationsKeyRingsCryptoKeysTestIamPermissionsCall) Context(ctx context.Context) *ProjectsLocationsKeyRingsCryptoKeysTestIamPermissionsCall { 4974 c.ctx_ = ctx 4975 return c 4976} 4977 4978// Header returns an http.Header that can be modified by the caller to 4979// add HTTP headers to the request. 4980func (c *ProjectsLocationsKeyRingsCryptoKeysTestIamPermissionsCall) Header() http.Header { 4981 if c.header_ == nil { 4982 c.header_ = make(http.Header) 4983 } 4984 return c.header_ 4985} 4986 4987func (c *ProjectsLocationsKeyRingsCryptoKeysTestIamPermissionsCall) doRequest(alt string) (*http.Response, error) { 4988 reqHeaders := make(http.Header) 4989 reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190926") 4990 for k, v := range c.header_ { 4991 reqHeaders[k] = v 4992 } 4993 reqHeaders.Set("User-Agent", c.s.userAgent()) 4994 var body io.Reader = nil 4995 body, err := googleapi.WithoutDataWrapper.JSONReader(c.testiampermissionsrequest) 4996 if err != nil { 4997 return nil, err 4998 } 4999 reqHeaders.Set("Content-Type", "application/json") 5000 c.urlParams_.Set("alt", alt) 5001 c.urlParams_.Set("prettyPrint", "false") 5002 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+resource}:testIamPermissions") 5003 urls += "?" + c.urlParams_.Encode() 5004 req, err := http.NewRequest("POST", urls, body) 5005 if err != nil { 5006 return nil, err 5007 } 5008 req.Header = reqHeaders 5009 googleapi.Expand(req.URL, map[string]string{ 5010 "resource": c.resource, 5011 }) 5012 return gensupport.SendRequest(c.ctx_, c.s.client, req) 5013} 5014 5015// Do executes the "cloudkms.projects.locations.keyRings.cryptoKeys.testIamPermissions" call. 5016// Exactly one of *TestIamPermissionsResponse or error will be non-nil. 5017// Any non-2xx status code is an error. Response headers are in either 5018// *TestIamPermissionsResponse.ServerResponse.Header or (if a response 5019// was returned at all) in error.(*googleapi.Error).Header. Use 5020// googleapi.IsNotModified to check whether the returned error was 5021// because http.StatusNotModified was returned. 5022func (c *ProjectsLocationsKeyRingsCryptoKeysTestIamPermissionsCall) Do(opts ...googleapi.CallOption) (*TestIamPermissionsResponse, error) { 5023 gensupport.SetOptions(c.urlParams_, opts...) 5024 res, err := c.doRequest("json") 5025 if res != nil && res.StatusCode == http.StatusNotModified { 5026 if res.Body != nil { 5027 res.Body.Close() 5028 } 5029 return nil, &googleapi.Error{ 5030 Code: res.StatusCode, 5031 Header: res.Header, 5032 } 5033 } 5034 if err != nil { 5035 return nil, err 5036 } 5037 defer googleapi.CloseBody(res) 5038 if err := googleapi.CheckResponse(res); err != nil { 5039 return nil, err 5040 } 5041 ret := &TestIamPermissionsResponse{ 5042 ServerResponse: googleapi.ServerResponse{ 5043 Header: res.Header, 5044 HTTPStatusCode: res.StatusCode, 5045 }, 5046 } 5047 target := &ret 5048 if err := gensupport.DecodeResponse(target, res); err != nil { 5049 return nil, err 5050 } 5051 return ret, nil 5052 // { 5053 // "description": "Returns permissions that a caller has on the specified resource.\nIf the resource does not exist, this will return an empty set of\npermissions, not a NOT_FOUND error.\n\nNote: This operation is designed to be used for building permission-aware\nUIs and command-line tools, not for authorization checking. This operation\nmay \"fail open\" without warning.", 5054 // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/keyRings/{keyRingsId}/cryptoKeys/{cryptoKeysId}:testIamPermissions", 5055 // "httpMethod": "POST", 5056 // "id": "cloudkms.projects.locations.keyRings.cryptoKeys.testIamPermissions", 5057 // "parameterOrder": [ 5058 // "resource" 5059 // ], 5060 // "parameters": { 5061 // "resource": { 5062 // "description": "REQUIRED: The resource for which the policy detail is being requested.\nSee the operation documentation for the appropriate value for this field.", 5063 // "location": "path", 5064 // "pattern": "^projects/[^/]+/locations/[^/]+/keyRings/[^/]+/cryptoKeys/[^/]+$", 5065 // "required": true, 5066 // "type": "string" 5067 // } 5068 // }, 5069 // "path": "v1/{+resource}:testIamPermissions", 5070 // "request": { 5071 // "$ref": "TestIamPermissionsRequest" 5072 // }, 5073 // "response": { 5074 // "$ref": "TestIamPermissionsResponse" 5075 // }, 5076 // "scopes": [ 5077 // "https://www.googleapis.com/auth/cloud-platform", 5078 // "https://www.googleapis.com/auth/cloudkms" 5079 // ] 5080 // } 5081 5082} 5083 5084// method id "cloudkms.projects.locations.keyRings.cryptoKeys.updatePrimaryVersion": 5085 5086type ProjectsLocationsKeyRingsCryptoKeysUpdatePrimaryVersionCall struct { 5087 s *Service 5088 name string 5089 updatecryptokeyprimaryversionrequest *UpdateCryptoKeyPrimaryVersionRequest 5090 urlParams_ gensupport.URLParams 5091 ctx_ context.Context 5092 header_ http.Header 5093} 5094 5095// UpdatePrimaryVersion: Update the version of a CryptoKey that will be 5096// used in Encrypt. 5097// 5098// Returns an error if called on an asymmetric key. 5099func (r *ProjectsLocationsKeyRingsCryptoKeysService) UpdatePrimaryVersion(name string, updatecryptokeyprimaryversionrequest *UpdateCryptoKeyPrimaryVersionRequest) *ProjectsLocationsKeyRingsCryptoKeysUpdatePrimaryVersionCall { 5100 c := &ProjectsLocationsKeyRingsCryptoKeysUpdatePrimaryVersionCall{s: r.s, urlParams_: make(gensupport.URLParams)} 5101 c.name = name 5102 c.updatecryptokeyprimaryversionrequest = updatecryptokeyprimaryversionrequest 5103 return c 5104} 5105 5106// Fields allows partial responses to be retrieved. See 5107// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 5108// for more information. 5109func (c *ProjectsLocationsKeyRingsCryptoKeysUpdatePrimaryVersionCall) Fields(s ...googleapi.Field) *ProjectsLocationsKeyRingsCryptoKeysUpdatePrimaryVersionCall { 5110 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 5111 return c 5112} 5113 5114// Context sets the context to be used in this call's Do method. Any 5115// pending HTTP request will be aborted if the provided context is 5116// canceled. 5117func (c *ProjectsLocationsKeyRingsCryptoKeysUpdatePrimaryVersionCall) Context(ctx context.Context) *ProjectsLocationsKeyRingsCryptoKeysUpdatePrimaryVersionCall { 5118 c.ctx_ = ctx 5119 return c 5120} 5121 5122// Header returns an http.Header that can be modified by the caller to 5123// add HTTP headers to the request. 5124func (c *ProjectsLocationsKeyRingsCryptoKeysUpdatePrimaryVersionCall) Header() http.Header { 5125 if c.header_ == nil { 5126 c.header_ = make(http.Header) 5127 } 5128 return c.header_ 5129} 5130 5131func (c *ProjectsLocationsKeyRingsCryptoKeysUpdatePrimaryVersionCall) doRequest(alt string) (*http.Response, error) { 5132 reqHeaders := make(http.Header) 5133 reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190926") 5134 for k, v := range c.header_ { 5135 reqHeaders[k] = v 5136 } 5137 reqHeaders.Set("User-Agent", c.s.userAgent()) 5138 var body io.Reader = nil 5139 body, err := googleapi.WithoutDataWrapper.JSONReader(c.updatecryptokeyprimaryversionrequest) 5140 if err != nil { 5141 return nil, err 5142 } 5143 reqHeaders.Set("Content-Type", "application/json") 5144 c.urlParams_.Set("alt", alt) 5145 c.urlParams_.Set("prettyPrint", "false") 5146 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}:updatePrimaryVersion") 5147 urls += "?" + c.urlParams_.Encode() 5148 req, err := http.NewRequest("POST", urls, body) 5149 if err != nil { 5150 return nil, err 5151 } 5152 req.Header = reqHeaders 5153 googleapi.Expand(req.URL, map[string]string{ 5154 "name": c.name, 5155 }) 5156 return gensupport.SendRequest(c.ctx_, c.s.client, req) 5157} 5158 5159// Do executes the "cloudkms.projects.locations.keyRings.cryptoKeys.updatePrimaryVersion" call. 5160// Exactly one of *CryptoKey or error will be non-nil. Any non-2xx 5161// status code is an error. Response headers are in either 5162// *CryptoKey.ServerResponse.Header or (if a response was returned at 5163// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 5164// to check whether the returned error was because 5165// http.StatusNotModified was returned. 5166func (c *ProjectsLocationsKeyRingsCryptoKeysUpdatePrimaryVersionCall) Do(opts ...googleapi.CallOption) (*CryptoKey, error) { 5167 gensupport.SetOptions(c.urlParams_, opts...) 5168 res, err := c.doRequest("json") 5169 if res != nil && res.StatusCode == http.StatusNotModified { 5170 if res.Body != nil { 5171 res.Body.Close() 5172 } 5173 return nil, &googleapi.Error{ 5174 Code: res.StatusCode, 5175 Header: res.Header, 5176 } 5177 } 5178 if err != nil { 5179 return nil, err 5180 } 5181 defer googleapi.CloseBody(res) 5182 if err := googleapi.CheckResponse(res); err != nil { 5183 return nil, err 5184 } 5185 ret := &CryptoKey{ 5186 ServerResponse: googleapi.ServerResponse{ 5187 Header: res.Header, 5188 HTTPStatusCode: res.StatusCode, 5189 }, 5190 } 5191 target := &ret 5192 if err := gensupport.DecodeResponse(target, res); err != nil { 5193 return nil, err 5194 } 5195 return ret, nil 5196 // { 5197 // "description": "Update the version of a CryptoKey that will be used in Encrypt.\n\nReturns an error if called on an asymmetric key.", 5198 // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/keyRings/{keyRingsId}/cryptoKeys/{cryptoKeysId}:updatePrimaryVersion", 5199 // "httpMethod": "POST", 5200 // "id": "cloudkms.projects.locations.keyRings.cryptoKeys.updatePrimaryVersion", 5201 // "parameterOrder": [ 5202 // "name" 5203 // ], 5204 // "parameters": { 5205 // "name": { 5206 // "description": "Required. The resource name of the CryptoKey to update.", 5207 // "location": "path", 5208 // "pattern": "^projects/[^/]+/locations/[^/]+/keyRings/[^/]+/cryptoKeys/[^/]+$", 5209 // "required": true, 5210 // "type": "string" 5211 // } 5212 // }, 5213 // "path": "v1/{+name}:updatePrimaryVersion", 5214 // "request": { 5215 // "$ref": "UpdateCryptoKeyPrimaryVersionRequest" 5216 // }, 5217 // "response": { 5218 // "$ref": "CryptoKey" 5219 // }, 5220 // "scopes": [ 5221 // "https://www.googleapis.com/auth/cloud-platform", 5222 // "https://www.googleapis.com/auth/cloudkms" 5223 // ] 5224 // } 5225 5226} 5227 5228// method id "cloudkms.projects.locations.keyRings.cryptoKeys.cryptoKeyVersions.asymmetricDecrypt": 5229 5230type ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsAsymmetricDecryptCall struct { 5231 s *Service 5232 name string 5233 asymmetricdecryptrequest *AsymmetricDecryptRequest 5234 urlParams_ gensupport.URLParams 5235 ctx_ context.Context 5236 header_ http.Header 5237} 5238 5239// AsymmetricDecrypt: Decrypts data that was encrypted with a public key 5240// retrieved from 5241// GetPublicKey corresponding to a CryptoKeyVersion 5242// with 5243// CryptoKey.purpose ASYMMETRIC_DECRYPT. 5244func (r *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsService) AsymmetricDecrypt(name string, asymmetricdecryptrequest *AsymmetricDecryptRequest) *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsAsymmetricDecryptCall { 5245 c := &ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsAsymmetricDecryptCall{s: r.s, urlParams_: make(gensupport.URLParams)} 5246 c.name = name 5247 c.asymmetricdecryptrequest = asymmetricdecryptrequest 5248 return c 5249} 5250 5251// Fields allows partial responses to be retrieved. See 5252// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 5253// for more information. 5254func (c *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsAsymmetricDecryptCall) Fields(s ...googleapi.Field) *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsAsymmetricDecryptCall { 5255 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 5256 return c 5257} 5258 5259// Context sets the context to be used in this call's Do method. Any 5260// pending HTTP request will be aborted if the provided context is 5261// canceled. 5262func (c *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsAsymmetricDecryptCall) Context(ctx context.Context) *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsAsymmetricDecryptCall { 5263 c.ctx_ = ctx 5264 return c 5265} 5266 5267// Header returns an http.Header that can be modified by the caller to 5268// add HTTP headers to the request. 5269func (c *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsAsymmetricDecryptCall) Header() http.Header { 5270 if c.header_ == nil { 5271 c.header_ = make(http.Header) 5272 } 5273 return c.header_ 5274} 5275 5276func (c *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsAsymmetricDecryptCall) doRequest(alt string) (*http.Response, error) { 5277 reqHeaders := make(http.Header) 5278 reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190926") 5279 for k, v := range c.header_ { 5280 reqHeaders[k] = v 5281 } 5282 reqHeaders.Set("User-Agent", c.s.userAgent()) 5283 var body io.Reader = nil 5284 body, err := googleapi.WithoutDataWrapper.JSONReader(c.asymmetricdecryptrequest) 5285 if err != nil { 5286 return nil, err 5287 } 5288 reqHeaders.Set("Content-Type", "application/json") 5289 c.urlParams_.Set("alt", alt) 5290 c.urlParams_.Set("prettyPrint", "false") 5291 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}:asymmetricDecrypt") 5292 urls += "?" + c.urlParams_.Encode() 5293 req, err := http.NewRequest("POST", urls, body) 5294 if err != nil { 5295 return nil, err 5296 } 5297 req.Header = reqHeaders 5298 googleapi.Expand(req.URL, map[string]string{ 5299 "name": c.name, 5300 }) 5301 return gensupport.SendRequest(c.ctx_, c.s.client, req) 5302} 5303 5304// Do executes the "cloudkms.projects.locations.keyRings.cryptoKeys.cryptoKeyVersions.asymmetricDecrypt" call. 5305// Exactly one of *AsymmetricDecryptResponse or error will be non-nil. 5306// Any non-2xx status code is an error. Response headers are in either 5307// *AsymmetricDecryptResponse.ServerResponse.Header or (if a response 5308// was returned at all) in error.(*googleapi.Error).Header. Use 5309// googleapi.IsNotModified to check whether the returned error was 5310// because http.StatusNotModified was returned. 5311func (c *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsAsymmetricDecryptCall) Do(opts ...googleapi.CallOption) (*AsymmetricDecryptResponse, error) { 5312 gensupport.SetOptions(c.urlParams_, opts...) 5313 res, err := c.doRequest("json") 5314 if res != nil && res.StatusCode == http.StatusNotModified { 5315 if res.Body != nil { 5316 res.Body.Close() 5317 } 5318 return nil, &googleapi.Error{ 5319 Code: res.StatusCode, 5320 Header: res.Header, 5321 } 5322 } 5323 if err != nil { 5324 return nil, err 5325 } 5326 defer googleapi.CloseBody(res) 5327 if err := googleapi.CheckResponse(res); err != nil { 5328 return nil, err 5329 } 5330 ret := &AsymmetricDecryptResponse{ 5331 ServerResponse: googleapi.ServerResponse{ 5332 Header: res.Header, 5333 HTTPStatusCode: res.StatusCode, 5334 }, 5335 } 5336 target := &ret 5337 if err := gensupport.DecodeResponse(target, res); err != nil { 5338 return nil, err 5339 } 5340 return ret, nil 5341 // { 5342 // "description": "Decrypts data that was encrypted with a public key retrieved from\nGetPublicKey corresponding to a CryptoKeyVersion with\nCryptoKey.purpose ASYMMETRIC_DECRYPT.", 5343 // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/keyRings/{keyRingsId}/cryptoKeys/{cryptoKeysId}/cryptoKeyVersions/{cryptoKeyVersionsId}:asymmetricDecrypt", 5344 // "httpMethod": "POST", 5345 // "id": "cloudkms.projects.locations.keyRings.cryptoKeys.cryptoKeyVersions.asymmetricDecrypt", 5346 // "parameterOrder": [ 5347 // "name" 5348 // ], 5349 // "parameters": { 5350 // "name": { 5351 // "description": "Required. The resource name of the CryptoKeyVersion to use for\ndecryption.", 5352 // "location": "path", 5353 // "pattern": "^projects/[^/]+/locations/[^/]+/keyRings/[^/]+/cryptoKeys/[^/]+/cryptoKeyVersions/[^/]+$", 5354 // "required": true, 5355 // "type": "string" 5356 // } 5357 // }, 5358 // "path": "v1/{+name}:asymmetricDecrypt", 5359 // "request": { 5360 // "$ref": "AsymmetricDecryptRequest" 5361 // }, 5362 // "response": { 5363 // "$ref": "AsymmetricDecryptResponse" 5364 // }, 5365 // "scopes": [ 5366 // "https://www.googleapis.com/auth/cloud-platform", 5367 // "https://www.googleapis.com/auth/cloudkms" 5368 // ] 5369 // } 5370 5371} 5372 5373// method id "cloudkms.projects.locations.keyRings.cryptoKeys.cryptoKeyVersions.asymmetricSign": 5374 5375type ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsAsymmetricSignCall struct { 5376 s *Service 5377 name string 5378 asymmetricsignrequest *AsymmetricSignRequest 5379 urlParams_ gensupport.URLParams 5380 ctx_ context.Context 5381 header_ http.Header 5382} 5383 5384// AsymmetricSign: Signs data using a CryptoKeyVersion with 5385// CryptoKey.purpose 5386// ASYMMETRIC_SIGN, producing a signature that can be verified with the 5387// public 5388// key retrieved from GetPublicKey. 5389func (r *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsService) AsymmetricSign(name string, asymmetricsignrequest *AsymmetricSignRequest) *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsAsymmetricSignCall { 5390 c := &ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsAsymmetricSignCall{s: r.s, urlParams_: make(gensupport.URLParams)} 5391 c.name = name 5392 c.asymmetricsignrequest = asymmetricsignrequest 5393 return c 5394} 5395 5396// Fields allows partial responses to be retrieved. See 5397// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 5398// for more information. 5399func (c *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsAsymmetricSignCall) Fields(s ...googleapi.Field) *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsAsymmetricSignCall { 5400 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 5401 return c 5402} 5403 5404// Context sets the context to be used in this call's Do method. Any 5405// pending HTTP request will be aborted if the provided context is 5406// canceled. 5407func (c *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsAsymmetricSignCall) Context(ctx context.Context) *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsAsymmetricSignCall { 5408 c.ctx_ = ctx 5409 return c 5410} 5411 5412// Header returns an http.Header that can be modified by the caller to 5413// add HTTP headers to the request. 5414func (c *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsAsymmetricSignCall) Header() http.Header { 5415 if c.header_ == nil { 5416 c.header_ = make(http.Header) 5417 } 5418 return c.header_ 5419} 5420 5421func (c *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsAsymmetricSignCall) doRequest(alt string) (*http.Response, error) { 5422 reqHeaders := make(http.Header) 5423 reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190926") 5424 for k, v := range c.header_ { 5425 reqHeaders[k] = v 5426 } 5427 reqHeaders.Set("User-Agent", c.s.userAgent()) 5428 var body io.Reader = nil 5429 body, err := googleapi.WithoutDataWrapper.JSONReader(c.asymmetricsignrequest) 5430 if err != nil { 5431 return nil, err 5432 } 5433 reqHeaders.Set("Content-Type", "application/json") 5434 c.urlParams_.Set("alt", alt) 5435 c.urlParams_.Set("prettyPrint", "false") 5436 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}:asymmetricSign") 5437 urls += "?" + c.urlParams_.Encode() 5438 req, err := http.NewRequest("POST", urls, body) 5439 if err != nil { 5440 return nil, err 5441 } 5442 req.Header = reqHeaders 5443 googleapi.Expand(req.URL, map[string]string{ 5444 "name": c.name, 5445 }) 5446 return gensupport.SendRequest(c.ctx_, c.s.client, req) 5447} 5448 5449// Do executes the "cloudkms.projects.locations.keyRings.cryptoKeys.cryptoKeyVersions.asymmetricSign" call. 5450// Exactly one of *AsymmetricSignResponse or error will be non-nil. Any 5451// non-2xx status code is an error. Response headers are in either 5452// *AsymmetricSignResponse.ServerResponse.Header or (if a response was 5453// returned at all) in error.(*googleapi.Error).Header. Use 5454// googleapi.IsNotModified to check whether the returned error was 5455// because http.StatusNotModified was returned. 5456func (c *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsAsymmetricSignCall) Do(opts ...googleapi.CallOption) (*AsymmetricSignResponse, error) { 5457 gensupport.SetOptions(c.urlParams_, opts...) 5458 res, err := c.doRequest("json") 5459 if res != nil && res.StatusCode == http.StatusNotModified { 5460 if res.Body != nil { 5461 res.Body.Close() 5462 } 5463 return nil, &googleapi.Error{ 5464 Code: res.StatusCode, 5465 Header: res.Header, 5466 } 5467 } 5468 if err != nil { 5469 return nil, err 5470 } 5471 defer googleapi.CloseBody(res) 5472 if err := googleapi.CheckResponse(res); err != nil { 5473 return nil, err 5474 } 5475 ret := &AsymmetricSignResponse{ 5476 ServerResponse: googleapi.ServerResponse{ 5477 Header: res.Header, 5478 HTTPStatusCode: res.StatusCode, 5479 }, 5480 } 5481 target := &ret 5482 if err := gensupport.DecodeResponse(target, res); err != nil { 5483 return nil, err 5484 } 5485 return ret, nil 5486 // { 5487 // "description": "Signs data using a CryptoKeyVersion with CryptoKey.purpose\nASYMMETRIC_SIGN, producing a signature that can be verified with the public\nkey retrieved from GetPublicKey.", 5488 // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/keyRings/{keyRingsId}/cryptoKeys/{cryptoKeysId}/cryptoKeyVersions/{cryptoKeyVersionsId}:asymmetricSign", 5489 // "httpMethod": "POST", 5490 // "id": "cloudkms.projects.locations.keyRings.cryptoKeys.cryptoKeyVersions.asymmetricSign", 5491 // "parameterOrder": [ 5492 // "name" 5493 // ], 5494 // "parameters": { 5495 // "name": { 5496 // "description": "Required. The resource name of the CryptoKeyVersion to use for signing.", 5497 // "location": "path", 5498 // "pattern": "^projects/[^/]+/locations/[^/]+/keyRings/[^/]+/cryptoKeys/[^/]+/cryptoKeyVersions/[^/]+$", 5499 // "required": true, 5500 // "type": "string" 5501 // } 5502 // }, 5503 // "path": "v1/{+name}:asymmetricSign", 5504 // "request": { 5505 // "$ref": "AsymmetricSignRequest" 5506 // }, 5507 // "response": { 5508 // "$ref": "AsymmetricSignResponse" 5509 // }, 5510 // "scopes": [ 5511 // "https://www.googleapis.com/auth/cloud-platform", 5512 // "https://www.googleapis.com/auth/cloudkms" 5513 // ] 5514 // } 5515 5516} 5517 5518// method id "cloudkms.projects.locations.keyRings.cryptoKeys.cryptoKeyVersions.create": 5519 5520type ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsCreateCall struct { 5521 s *Service 5522 parent string 5523 cryptokeyversion *CryptoKeyVersion 5524 urlParams_ gensupport.URLParams 5525 ctx_ context.Context 5526 header_ http.Header 5527} 5528 5529// Create: Create a new CryptoKeyVersion in a CryptoKey. 5530// 5531// The server will assign the next sequential id. If unset, 5532// state will be set to 5533// ENABLED. 5534func (r *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsService) Create(parent string, cryptokeyversion *CryptoKeyVersion) *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsCreateCall { 5535 c := &ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)} 5536 c.parent = parent 5537 c.cryptokeyversion = cryptokeyversion 5538 return c 5539} 5540 5541// Fields allows partial responses to be retrieved. See 5542// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 5543// for more information. 5544func (c *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsCreateCall) Fields(s ...googleapi.Field) *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsCreateCall { 5545 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 5546 return c 5547} 5548 5549// Context sets the context to be used in this call's Do method. Any 5550// pending HTTP request will be aborted if the provided context is 5551// canceled. 5552func (c *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsCreateCall) Context(ctx context.Context) *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsCreateCall { 5553 c.ctx_ = ctx 5554 return c 5555} 5556 5557// Header returns an http.Header that can be modified by the caller to 5558// add HTTP headers to the request. 5559func (c *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsCreateCall) Header() http.Header { 5560 if c.header_ == nil { 5561 c.header_ = make(http.Header) 5562 } 5563 return c.header_ 5564} 5565 5566func (c *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsCreateCall) doRequest(alt string) (*http.Response, error) { 5567 reqHeaders := make(http.Header) 5568 reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190926") 5569 for k, v := range c.header_ { 5570 reqHeaders[k] = v 5571 } 5572 reqHeaders.Set("User-Agent", c.s.userAgent()) 5573 var body io.Reader = nil 5574 body, err := googleapi.WithoutDataWrapper.JSONReader(c.cryptokeyversion) 5575 if err != nil { 5576 return nil, err 5577 } 5578 reqHeaders.Set("Content-Type", "application/json") 5579 c.urlParams_.Set("alt", alt) 5580 c.urlParams_.Set("prettyPrint", "false") 5581 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}/cryptoKeyVersions") 5582 urls += "?" + c.urlParams_.Encode() 5583 req, err := http.NewRequest("POST", urls, body) 5584 if err != nil { 5585 return nil, err 5586 } 5587 req.Header = reqHeaders 5588 googleapi.Expand(req.URL, map[string]string{ 5589 "parent": c.parent, 5590 }) 5591 return gensupport.SendRequest(c.ctx_, c.s.client, req) 5592} 5593 5594// Do executes the "cloudkms.projects.locations.keyRings.cryptoKeys.cryptoKeyVersions.create" call. 5595// Exactly one of *CryptoKeyVersion or error will be non-nil. Any 5596// non-2xx status code is an error. Response headers are in either 5597// *CryptoKeyVersion.ServerResponse.Header or (if a response was 5598// returned at all) in error.(*googleapi.Error).Header. Use 5599// googleapi.IsNotModified to check whether the returned error was 5600// because http.StatusNotModified was returned. 5601func (c *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsCreateCall) Do(opts ...googleapi.CallOption) (*CryptoKeyVersion, error) { 5602 gensupport.SetOptions(c.urlParams_, opts...) 5603 res, err := c.doRequest("json") 5604 if res != nil && res.StatusCode == http.StatusNotModified { 5605 if res.Body != nil { 5606 res.Body.Close() 5607 } 5608 return nil, &googleapi.Error{ 5609 Code: res.StatusCode, 5610 Header: res.Header, 5611 } 5612 } 5613 if err != nil { 5614 return nil, err 5615 } 5616 defer googleapi.CloseBody(res) 5617 if err := googleapi.CheckResponse(res); err != nil { 5618 return nil, err 5619 } 5620 ret := &CryptoKeyVersion{ 5621 ServerResponse: googleapi.ServerResponse{ 5622 Header: res.Header, 5623 HTTPStatusCode: res.StatusCode, 5624 }, 5625 } 5626 target := &ret 5627 if err := gensupport.DecodeResponse(target, res); err != nil { 5628 return nil, err 5629 } 5630 return ret, nil 5631 // { 5632 // "description": "Create a new CryptoKeyVersion in a CryptoKey.\n\nThe server will assign the next sequential id. If unset,\nstate will be set to\nENABLED.", 5633 // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/keyRings/{keyRingsId}/cryptoKeys/{cryptoKeysId}/cryptoKeyVersions", 5634 // "httpMethod": "POST", 5635 // "id": "cloudkms.projects.locations.keyRings.cryptoKeys.cryptoKeyVersions.create", 5636 // "parameterOrder": [ 5637 // "parent" 5638 // ], 5639 // "parameters": { 5640 // "parent": { 5641 // "description": "Required. The name of the CryptoKey associated with\nthe CryptoKeyVersions.", 5642 // "location": "path", 5643 // "pattern": "^projects/[^/]+/locations/[^/]+/keyRings/[^/]+/cryptoKeys/[^/]+$", 5644 // "required": true, 5645 // "type": "string" 5646 // } 5647 // }, 5648 // "path": "v1/{+parent}/cryptoKeyVersions", 5649 // "request": { 5650 // "$ref": "CryptoKeyVersion" 5651 // }, 5652 // "response": { 5653 // "$ref": "CryptoKeyVersion" 5654 // }, 5655 // "scopes": [ 5656 // "https://www.googleapis.com/auth/cloud-platform", 5657 // "https://www.googleapis.com/auth/cloudkms" 5658 // ] 5659 // } 5660 5661} 5662 5663// method id "cloudkms.projects.locations.keyRings.cryptoKeys.cryptoKeyVersions.destroy": 5664 5665type ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsDestroyCall struct { 5666 s *Service 5667 name string 5668 destroycryptokeyversionrequest *DestroyCryptoKeyVersionRequest 5669 urlParams_ gensupport.URLParams 5670 ctx_ context.Context 5671 header_ http.Header 5672} 5673 5674// Destroy: Schedule a CryptoKeyVersion for destruction. 5675// 5676// Upon calling this method, CryptoKeyVersion.state will be set 5677// to 5678// DESTROY_SCHEDULED 5679// and destroy_time will be set to a time 24 5680// hours in the future, at which point the state 5681// will be changed to 5682// DESTROYED, and the key 5683// material will be irrevocably destroyed. 5684// 5685// Before the destroy_time is reached, 5686// RestoreCryptoKeyVersion may be called to reverse the process. 5687func (r *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsService) Destroy(name string, destroycryptokeyversionrequest *DestroyCryptoKeyVersionRequest) *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsDestroyCall { 5688 c := &ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsDestroyCall{s: r.s, urlParams_: make(gensupport.URLParams)} 5689 c.name = name 5690 c.destroycryptokeyversionrequest = destroycryptokeyversionrequest 5691 return c 5692} 5693 5694// Fields allows partial responses to be retrieved. See 5695// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 5696// for more information. 5697func (c *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsDestroyCall) Fields(s ...googleapi.Field) *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsDestroyCall { 5698 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 5699 return c 5700} 5701 5702// Context sets the context to be used in this call's Do method. Any 5703// pending HTTP request will be aborted if the provided context is 5704// canceled. 5705func (c *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsDestroyCall) Context(ctx context.Context) *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsDestroyCall { 5706 c.ctx_ = ctx 5707 return c 5708} 5709 5710// Header returns an http.Header that can be modified by the caller to 5711// add HTTP headers to the request. 5712func (c *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsDestroyCall) Header() http.Header { 5713 if c.header_ == nil { 5714 c.header_ = make(http.Header) 5715 } 5716 return c.header_ 5717} 5718 5719func (c *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsDestroyCall) doRequest(alt string) (*http.Response, error) { 5720 reqHeaders := make(http.Header) 5721 reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190926") 5722 for k, v := range c.header_ { 5723 reqHeaders[k] = v 5724 } 5725 reqHeaders.Set("User-Agent", c.s.userAgent()) 5726 var body io.Reader = nil 5727 body, err := googleapi.WithoutDataWrapper.JSONReader(c.destroycryptokeyversionrequest) 5728 if err != nil { 5729 return nil, err 5730 } 5731 reqHeaders.Set("Content-Type", "application/json") 5732 c.urlParams_.Set("alt", alt) 5733 c.urlParams_.Set("prettyPrint", "false") 5734 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}:destroy") 5735 urls += "?" + c.urlParams_.Encode() 5736 req, err := http.NewRequest("POST", urls, body) 5737 if err != nil { 5738 return nil, err 5739 } 5740 req.Header = reqHeaders 5741 googleapi.Expand(req.URL, map[string]string{ 5742 "name": c.name, 5743 }) 5744 return gensupport.SendRequest(c.ctx_, c.s.client, req) 5745} 5746 5747// Do executes the "cloudkms.projects.locations.keyRings.cryptoKeys.cryptoKeyVersions.destroy" call. 5748// Exactly one of *CryptoKeyVersion or error will be non-nil. Any 5749// non-2xx status code is an error. Response headers are in either 5750// *CryptoKeyVersion.ServerResponse.Header or (if a response was 5751// returned at all) in error.(*googleapi.Error).Header. Use 5752// googleapi.IsNotModified to check whether the returned error was 5753// because http.StatusNotModified was returned. 5754func (c *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsDestroyCall) Do(opts ...googleapi.CallOption) (*CryptoKeyVersion, error) { 5755 gensupport.SetOptions(c.urlParams_, opts...) 5756 res, err := c.doRequest("json") 5757 if res != nil && res.StatusCode == http.StatusNotModified { 5758 if res.Body != nil { 5759 res.Body.Close() 5760 } 5761 return nil, &googleapi.Error{ 5762 Code: res.StatusCode, 5763 Header: res.Header, 5764 } 5765 } 5766 if err != nil { 5767 return nil, err 5768 } 5769 defer googleapi.CloseBody(res) 5770 if err := googleapi.CheckResponse(res); err != nil { 5771 return nil, err 5772 } 5773 ret := &CryptoKeyVersion{ 5774 ServerResponse: googleapi.ServerResponse{ 5775 Header: res.Header, 5776 HTTPStatusCode: res.StatusCode, 5777 }, 5778 } 5779 target := &ret 5780 if err := gensupport.DecodeResponse(target, res); err != nil { 5781 return nil, err 5782 } 5783 return ret, nil 5784 // { 5785 // "description": "Schedule a CryptoKeyVersion for destruction.\n\nUpon calling this method, CryptoKeyVersion.state will be set to\nDESTROY_SCHEDULED\nand destroy_time will be set to a time 24\nhours in the future, at which point the state\nwill be changed to\nDESTROYED, and the key\nmaterial will be irrevocably destroyed.\n\nBefore the destroy_time is reached,\nRestoreCryptoKeyVersion may be called to reverse the process.", 5786 // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/keyRings/{keyRingsId}/cryptoKeys/{cryptoKeysId}/cryptoKeyVersions/{cryptoKeyVersionsId}:destroy", 5787 // "httpMethod": "POST", 5788 // "id": "cloudkms.projects.locations.keyRings.cryptoKeys.cryptoKeyVersions.destroy", 5789 // "parameterOrder": [ 5790 // "name" 5791 // ], 5792 // "parameters": { 5793 // "name": { 5794 // "description": "Required. The resource name of the CryptoKeyVersion to destroy.", 5795 // "location": "path", 5796 // "pattern": "^projects/[^/]+/locations/[^/]+/keyRings/[^/]+/cryptoKeys/[^/]+/cryptoKeyVersions/[^/]+$", 5797 // "required": true, 5798 // "type": "string" 5799 // } 5800 // }, 5801 // "path": "v1/{+name}:destroy", 5802 // "request": { 5803 // "$ref": "DestroyCryptoKeyVersionRequest" 5804 // }, 5805 // "response": { 5806 // "$ref": "CryptoKeyVersion" 5807 // }, 5808 // "scopes": [ 5809 // "https://www.googleapis.com/auth/cloud-platform", 5810 // "https://www.googleapis.com/auth/cloudkms" 5811 // ] 5812 // } 5813 5814} 5815 5816// method id "cloudkms.projects.locations.keyRings.cryptoKeys.cryptoKeyVersions.get": 5817 5818type ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsGetCall struct { 5819 s *Service 5820 name string 5821 urlParams_ gensupport.URLParams 5822 ifNoneMatch_ string 5823 ctx_ context.Context 5824 header_ http.Header 5825} 5826 5827// Get: Returns metadata for a given CryptoKeyVersion. 5828func (r *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsService) Get(name string) *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsGetCall { 5829 c := &ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 5830 c.name = name 5831 return c 5832} 5833 5834// Fields allows partial responses to be retrieved. See 5835// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 5836// for more information. 5837func (c *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsGetCall) Fields(s ...googleapi.Field) *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsGetCall { 5838 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 5839 return c 5840} 5841 5842// IfNoneMatch sets the optional parameter which makes the operation 5843// fail if the object's ETag matches the given value. This is useful for 5844// getting updates only after the object has changed since the last 5845// request. Use googleapi.IsNotModified to check whether the response 5846// error from Do is the result of In-None-Match. 5847func (c *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsGetCall) IfNoneMatch(entityTag string) *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsGetCall { 5848 c.ifNoneMatch_ = entityTag 5849 return c 5850} 5851 5852// Context sets the context to be used in this call's Do method. Any 5853// pending HTTP request will be aborted if the provided context is 5854// canceled. 5855func (c *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsGetCall) Context(ctx context.Context) *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsGetCall { 5856 c.ctx_ = ctx 5857 return c 5858} 5859 5860// Header returns an http.Header that can be modified by the caller to 5861// add HTTP headers to the request. 5862func (c *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsGetCall) Header() http.Header { 5863 if c.header_ == nil { 5864 c.header_ = make(http.Header) 5865 } 5866 return c.header_ 5867} 5868 5869func (c *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsGetCall) doRequest(alt string) (*http.Response, error) { 5870 reqHeaders := make(http.Header) 5871 reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190926") 5872 for k, v := range c.header_ { 5873 reqHeaders[k] = v 5874 } 5875 reqHeaders.Set("User-Agent", c.s.userAgent()) 5876 if c.ifNoneMatch_ != "" { 5877 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 5878 } 5879 var body io.Reader = nil 5880 c.urlParams_.Set("alt", alt) 5881 c.urlParams_.Set("prettyPrint", "false") 5882 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}") 5883 urls += "?" + c.urlParams_.Encode() 5884 req, err := http.NewRequest("GET", urls, body) 5885 if err != nil { 5886 return nil, err 5887 } 5888 req.Header = reqHeaders 5889 googleapi.Expand(req.URL, map[string]string{ 5890 "name": c.name, 5891 }) 5892 return gensupport.SendRequest(c.ctx_, c.s.client, req) 5893} 5894 5895// Do executes the "cloudkms.projects.locations.keyRings.cryptoKeys.cryptoKeyVersions.get" call. 5896// Exactly one of *CryptoKeyVersion or error will be non-nil. Any 5897// non-2xx status code is an error. Response headers are in either 5898// *CryptoKeyVersion.ServerResponse.Header or (if a response was 5899// returned at all) in error.(*googleapi.Error).Header. Use 5900// googleapi.IsNotModified to check whether the returned error was 5901// because http.StatusNotModified was returned. 5902func (c *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsGetCall) Do(opts ...googleapi.CallOption) (*CryptoKeyVersion, error) { 5903 gensupport.SetOptions(c.urlParams_, opts...) 5904 res, err := c.doRequest("json") 5905 if res != nil && res.StatusCode == http.StatusNotModified { 5906 if res.Body != nil { 5907 res.Body.Close() 5908 } 5909 return nil, &googleapi.Error{ 5910 Code: res.StatusCode, 5911 Header: res.Header, 5912 } 5913 } 5914 if err != nil { 5915 return nil, err 5916 } 5917 defer googleapi.CloseBody(res) 5918 if err := googleapi.CheckResponse(res); err != nil { 5919 return nil, err 5920 } 5921 ret := &CryptoKeyVersion{ 5922 ServerResponse: googleapi.ServerResponse{ 5923 Header: res.Header, 5924 HTTPStatusCode: res.StatusCode, 5925 }, 5926 } 5927 target := &ret 5928 if err := gensupport.DecodeResponse(target, res); err != nil { 5929 return nil, err 5930 } 5931 return ret, nil 5932 // { 5933 // "description": "Returns metadata for a given CryptoKeyVersion.", 5934 // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/keyRings/{keyRingsId}/cryptoKeys/{cryptoKeysId}/cryptoKeyVersions/{cryptoKeyVersionsId}", 5935 // "httpMethod": "GET", 5936 // "id": "cloudkms.projects.locations.keyRings.cryptoKeys.cryptoKeyVersions.get", 5937 // "parameterOrder": [ 5938 // "name" 5939 // ], 5940 // "parameters": { 5941 // "name": { 5942 // "description": "Required. The name of the CryptoKeyVersion to get.", 5943 // "location": "path", 5944 // "pattern": "^projects/[^/]+/locations/[^/]+/keyRings/[^/]+/cryptoKeys/[^/]+/cryptoKeyVersions/[^/]+$", 5945 // "required": true, 5946 // "type": "string" 5947 // } 5948 // }, 5949 // "path": "v1/{+name}", 5950 // "response": { 5951 // "$ref": "CryptoKeyVersion" 5952 // }, 5953 // "scopes": [ 5954 // "https://www.googleapis.com/auth/cloud-platform", 5955 // "https://www.googleapis.com/auth/cloudkms" 5956 // ] 5957 // } 5958 5959} 5960 5961// method id "cloudkms.projects.locations.keyRings.cryptoKeys.cryptoKeyVersions.getPublicKey": 5962 5963type ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsGetPublicKeyCall struct { 5964 s *Service 5965 name string 5966 urlParams_ gensupport.URLParams 5967 ifNoneMatch_ string 5968 ctx_ context.Context 5969 header_ http.Header 5970} 5971 5972// GetPublicKey: Returns the public key for the given CryptoKeyVersion. 5973// The 5974// CryptoKey.purpose must be 5975// ASYMMETRIC_SIGN or 5976// ASYMMETRIC_DECRYPT. 5977func (r *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsService) GetPublicKey(name string) *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsGetPublicKeyCall { 5978 c := &ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsGetPublicKeyCall{s: r.s, urlParams_: make(gensupport.URLParams)} 5979 c.name = name 5980 return c 5981} 5982 5983// Fields allows partial responses to be retrieved. See 5984// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 5985// for more information. 5986func (c *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsGetPublicKeyCall) Fields(s ...googleapi.Field) *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsGetPublicKeyCall { 5987 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 5988 return c 5989} 5990 5991// IfNoneMatch sets the optional parameter which makes the operation 5992// fail if the object's ETag matches the given value. This is useful for 5993// getting updates only after the object has changed since the last 5994// request. Use googleapi.IsNotModified to check whether the response 5995// error from Do is the result of In-None-Match. 5996func (c *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsGetPublicKeyCall) IfNoneMatch(entityTag string) *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsGetPublicKeyCall { 5997 c.ifNoneMatch_ = entityTag 5998 return c 5999} 6000 6001// Context sets the context to be used in this call's Do method. Any 6002// pending HTTP request will be aborted if the provided context is 6003// canceled. 6004func (c *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsGetPublicKeyCall) Context(ctx context.Context) *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsGetPublicKeyCall { 6005 c.ctx_ = ctx 6006 return c 6007} 6008 6009// Header returns an http.Header that can be modified by the caller to 6010// add HTTP headers to the request. 6011func (c *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsGetPublicKeyCall) Header() http.Header { 6012 if c.header_ == nil { 6013 c.header_ = make(http.Header) 6014 } 6015 return c.header_ 6016} 6017 6018func (c *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsGetPublicKeyCall) doRequest(alt string) (*http.Response, error) { 6019 reqHeaders := make(http.Header) 6020 reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190926") 6021 for k, v := range c.header_ { 6022 reqHeaders[k] = v 6023 } 6024 reqHeaders.Set("User-Agent", c.s.userAgent()) 6025 if c.ifNoneMatch_ != "" { 6026 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 6027 } 6028 var body io.Reader = nil 6029 c.urlParams_.Set("alt", alt) 6030 c.urlParams_.Set("prettyPrint", "false") 6031 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}/publicKey") 6032 urls += "?" + c.urlParams_.Encode() 6033 req, err := http.NewRequest("GET", urls, body) 6034 if err != nil { 6035 return nil, err 6036 } 6037 req.Header = reqHeaders 6038 googleapi.Expand(req.URL, map[string]string{ 6039 "name": c.name, 6040 }) 6041 return gensupport.SendRequest(c.ctx_, c.s.client, req) 6042} 6043 6044// Do executes the "cloudkms.projects.locations.keyRings.cryptoKeys.cryptoKeyVersions.getPublicKey" call. 6045// Exactly one of *PublicKey or error will be non-nil. Any non-2xx 6046// status code is an error. Response headers are in either 6047// *PublicKey.ServerResponse.Header or (if a response was returned at 6048// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 6049// to check whether the returned error was because 6050// http.StatusNotModified was returned. 6051func (c *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsGetPublicKeyCall) Do(opts ...googleapi.CallOption) (*PublicKey, error) { 6052 gensupport.SetOptions(c.urlParams_, opts...) 6053 res, err := c.doRequest("json") 6054 if res != nil && res.StatusCode == http.StatusNotModified { 6055 if res.Body != nil { 6056 res.Body.Close() 6057 } 6058 return nil, &googleapi.Error{ 6059 Code: res.StatusCode, 6060 Header: res.Header, 6061 } 6062 } 6063 if err != nil { 6064 return nil, err 6065 } 6066 defer googleapi.CloseBody(res) 6067 if err := googleapi.CheckResponse(res); err != nil { 6068 return nil, err 6069 } 6070 ret := &PublicKey{ 6071 ServerResponse: googleapi.ServerResponse{ 6072 Header: res.Header, 6073 HTTPStatusCode: res.StatusCode, 6074 }, 6075 } 6076 target := &ret 6077 if err := gensupport.DecodeResponse(target, res); err != nil { 6078 return nil, err 6079 } 6080 return ret, nil 6081 // { 6082 // "description": "Returns the public key for the given CryptoKeyVersion. The\nCryptoKey.purpose must be\nASYMMETRIC_SIGN or\nASYMMETRIC_DECRYPT.", 6083 // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/keyRings/{keyRingsId}/cryptoKeys/{cryptoKeysId}/cryptoKeyVersions/{cryptoKeyVersionsId}/publicKey", 6084 // "httpMethod": "GET", 6085 // "id": "cloudkms.projects.locations.keyRings.cryptoKeys.cryptoKeyVersions.getPublicKey", 6086 // "parameterOrder": [ 6087 // "name" 6088 // ], 6089 // "parameters": { 6090 // "name": { 6091 // "description": "Required. The name of the CryptoKeyVersion public key to\nget.", 6092 // "location": "path", 6093 // "pattern": "^projects/[^/]+/locations/[^/]+/keyRings/[^/]+/cryptoKeys/[^/]+/cryptoKeyVersions/[^/]+$", 6094 // "required": true, 6095 // "type": "string" 6096 // } 6097 // }, 6098 // "path": "v1/{+name}/publicKey", 6099 // "response": { 6100 // "$ref": "PublicKey" 6101 // }, 6102 // "scopes": [ 6103 // "https://www.googleapis.com/auth/cloud-platform", 6104 // "https://www.googleapis.com/auth/cloudkms" 6105 // ] 6106 // } 6107 6108} 6109 6110// method id "cloudkms.projects.locations.keyRings.cryptoKeys.cryptoKeyVersions.import": 6111 6112type ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsImportCall struct { 6113 s *Service 6114 parent string 6115 importcryptokeyversionrequest *ImportCryptoKeyVersionRequest 6116 urlParams_ gensupport.URLParams 6117 ctx_ context.Context 6118 header_ http.Header 6119} 6120 6121// Import: Imports a new CryptoKeyVersion into an existing CryptoKey 6122// using the 6123// wrapped key material provided in the request. 6124// 6125// The version ID will be assigned the next sequential id within 6126// the 6127// CryptoKey. 6128func (r *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsService) Import(parent string, importcryptokeyversionrequest *ImportCryptoKeyVersionRequest) *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsImportCall { 6129 c := &ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsImportCall{s: r.s, urlParams_: make(gensupport.URLParams)} 6130 c.parent = parent 6131 c.importcryptokeyversionrequest = importcryptokeyversionrequest 6132 return c 6133} 6134 6135// Fields allows partial responses to be retrieved. See 6136// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 6137// for more information. 6138func (c *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsImportCall) Fields(s ...googleapi.Field) *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsImportCall { 6139 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 6140 return c 6141} 6142 6143// Context sets the context to be used in this call's Do method. Any 6144// pending HTTP request will be aborted if the provided context is 6145// canceled. 6146func (c *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsImportCall) Context(ctx context.Context) *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsImportCall { 6147 c.ctx_ = ctx 6148 return c 6149} 6150 6151// Header returns an http.Header that can be modified by the caller to 6152// add HTTP headers to the request. 6153func (c *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsImportCall) Header() http.Header { 6154 if c.header_ == nil { 6155 c.header_ = make(http.Header) 6156 } 6157 return c.header_ 6158} 6159 6160func (c *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsImportCall) doRequest(alt string) (*http.Response, error) { 6161 reqHeaders := make(http.Header) 6162 reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190926") 6163 for k, v := range c.header_ { 6164 reqHeaders[k] = v 6165 } 6166 reqHeaders.Set("User-Agent", c.s.userAgent()) 6167 var body io.Reader = nil 6168 body, err := googleapi.WithoutDataWrapper.JSONReader(c.importcryptokeyversionrequest) 6169 if err != nil { 6170 return nil, err 6171 } 6172 reqHeaders.Set("Content-Type", "application/json") 6173 c.urlParams_.Set("alt", alt) 6174 c.urlParams_.Set("prettyPrint", "false") 6175 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}/cryptoKeyVersions:import") 6176 urls += "?" + c.urlParams_.Encode() 6177 req, err := http.NewRequest("POST", urls, body) 6178 if err != nil { 6179 return nil, err 6180 } 6181 req.Header = reqHeaders 6182 googleapi.Expand(req.URL, map[string]string{ 6183 "parent": c.parent, 6184 }) 6185 return gensupport.SendRequest(c.ctx_, c.s.client, req) 6186} 6187 6188// Do executes the "cloudkms.projects.locations.keyRings.cryptoKeys.cryptoKeyVersions.import" call. 6189// Exactly one of *CryptoKeyVersion or error will be non-nil. Any 6190// non-2xx status code is an error. Response headers are in either 6191// *CryptoKeyVersion.ServerResponse.Header or (if a response was 6192// returned at all) in error.(*googleapi.Error).Header. Use 6193// googleapi.IsNotModified to check whether the returned error was 6194// because http.StatusNotModified was returned. 6195func (c *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsImportCall) Do(opts ...googleapi.CallOption) (*CryptoKeyVersion, error) { 6196 gensupport.SetOptions(c.urlParams_, opts...) 6197 res, err := c.doRequest("json") 6198 if res != nil && res.StatusCode == http.StatusNotModified { 6199 if res.Body != nil { 6200 res.Body.Close() 6201 } 6202 return nil, &googleapi.Error{ 6203 Code: res.StatusCode, 6204 Header: res.Header, 6205 } 6206 } 6207 if err != nil { 6208 return nil, err 6209 } 6210 defer googleapi.CloseBody(res) 6211 if err := googleapi.CheckResponse(res); err != nil { 6212 return nil, err 6213 } 6214 ret := &CryptoKeyVersion{ 6215 ServerResponse: googleapi.ServerResponse{ 6216 Header: res.Header, 6217 HTTPStatusCode: res.StatusCode, 6218 }, 6219 } 6220 target := &ret 6221 if err := gensupport.DecodeResponse(target, res); err != nil { 6222 return nil, err 6223 } 6224 return ret, nil 6225 // { 6226 // "description": "Imports a new CryptoKeyVersion into an existing CryptoKey using the\nwrapped key material provided in the request.\n\nThe version ID will be assigned the next sequential id within the\nCryptoKey.", 6227 // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/keyRings/{keyRingsId}/cryptoKeys/{cryptoKeysId}/cryptoKeyVersions:import", 6228 // "httpMethod": "POST", 6229 // "id": "cloudkms.projects.locations.keyRings.cryptoKeys.cryptoKeyVersions.import", 6230 // "parameterOrder": [ 6231 // "parent" 6232 // ], 6233 // "parameters": { 6234 // "parent": { 6235 // "description": "Required. The name of the CryptoKey to\nbe imported into.", 6236 // "location": "path", 6237 // "pattern": "^projects/[^/]+/locations/[^/]+/keyRings/[^/]+/cryptoKeys/[^/]+$", 6238 // "required": true, 6239 // "type": "string" 6240 // } 6241 // }, 6242 // "path": "v1/{+parent}/cryptoKeyVersions:import", 6243 // "request": { 6244 // "$ref": "ImportCryptoKeyVersionRequest" 6245 // }, 6246 // "response": { 6247 // "$ref": "CryptoKeyVersion" 6248 // }, 6249 // "scopes": [ 6250 // "https://www.googleapis.com/auth/cloud-platform", 6251 // "https://www.googleapis.com/auth/cloudkms" 6252 // ] 6253 // } 6254 6255} 6256 6257// method id "cloudkms.projects.locations.keyRings.cryptoKeys.cryptoKeyVersions.list": 6258 6259type ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsListCall struct { 6260 s *Service 6261 parent string 6262 urlParams_ gensupport.URLParams 6263 ifNoneMatch_ string 6264 ctx_ context.Context 6265 header_ http.Header 6266} 6267 6268// List: Lists CryptoKeyVersions. 6269func (r *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsService) List(parent string) *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsListCall { 6270 c := &ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 6271 c.parent = parent 6272 return c 6273} 6274 6275// Filter sets the optional parameter "filter": Only include resources 6276// that match the filter in the response. For 6277// more information, see 6278// [Sorting and filtering 6279// list 6280// results](https://cloud.google.com/kms/docs/sorting-and-filtering) 6281// . 6282func (c *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsListCall) Filter(filter string) *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsListCall { 6283 c.urlParams_.Set("filter", filter) 6284 return c 6285} 6286 6287// OrderBy sets the optional parameter "orderBy": Specify how the 6288// results should be sorted. If not specified, the 6289// results will be sorted in the default order. For more information, 6290// see 6291// [Sorting and filtering 6292// list 6293// results](https://cloud.google.com/kms/docs/sorting-and-filtering) 6294// . 6295func (c *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsListCall) OrderBy(orderBy string) *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsListCall { 6296 c.urlParams_.Set("orderBy", orderBy) 6297 return c 6298} 6299 6300// PageSize sets the optional parameter "pageSize": Optional limit on 6301// the number of CryptoKeyVersions to 6302// include in the response. Further CryptoKeyVersions can 6303// subsequently be obtained by including 6304// the 6305// ListCryptoKeyVersionsResponse.next_page_token in a subsequent 6306// request. 6307// If unspecified, the server will pick an appropriate default. 6308func (c *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsListCall) PageSize(pageSize int64) *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsListCall { 6309 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize)) 6310 return c 6311} 6312 6313// PageToken sets the optional parameter "pageToken": Optional 6314// pagination token, returned earlier 6315// via 6316// ListCryptoKeyVersionsResponse.next_page_token. 6317func (c *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsListCall) PageToken(pageToken string) *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsListCall { 6318 c.urlParams_.Set("pageToken", pageToken) 6319 return c 6320} 6321 6322// View sets the optional parameter "view": The fields to include in the 6323// response. 6324// 6325// Possible values: 6326// "CRYPTO_KEY_VERSION_VIEW_UNSPECIFIED" 6327// "FULL" 6328func (c *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsListCall) View(view string) *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsListCall { 6329 c.urlParams_.Set("view", view) 6330 return c 6331} 6332 6333// Fields allows partial responses to be retrieved. See 6334// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 6335// for more information. 6336func (c *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsListCall) Fields(s ...googleapi.Field) *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsListCall { 6337 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 6338 return c 6339} 6340 6341// IfNoneMatch sets the optional parameter which makes the operation 6342// fail if the object's ETag matches the given value. This is useful for 6343// getting updates only after the object has changed since the last 6344// request. Use googleapi.IsNotModified to check whether the response 6345// error from Do is the result of In-None-Match. 6346func (c *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsListCall) IfNoneMatch(entityTag string) *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsListCall { 6347 c.ifNoneMatch_ = entityTag 6348 return c 6349} 6350 6351// Context sets the context to be used in this call's Do method. Any 6352// pending HTTP request will be aborted if the provided context is 6353// canceled. 6354func (c *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsListCall) Context(ctx context.Context) *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsListCall { 6355 c.ctx_ = ctx 6356 return c 6357} 6358 6359// Header returns an http.Header that can be modified by the caller to 6360// add HTTP headers to the request. 6361func (c *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsListCall) Header() http.Header { 6362 if c.header_ == nil { 6363 c.header_ = make(http.Header) 6364 } 6365 return c.header_ 6366} 6367 6368func (c *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsListCall) doRequest(alt string) (*http.Response, error) { 6369 reqHeaders := make(http.Header) 6370 reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190926") 6371 for k, v := range c.header_ { 6372 reqHeaders[k] = v 6373 } 6374 reqHeaders.Set("User-Agent", c.s.userAgent()) 6375 if c.ifNoneMatch_ != "" { 6376 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 6377 } 6378 var body io.Reader = nil 6379 c.urlParams_.Set("alt", alt) 6380 c.urlParams_.Set("prettyPrint", "false") 6381 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}/cryptoKeyVersions") 6382 urls += "?" + c.urlParams_.Encode() 6383 req, err := http.NewRequest("GET", urls, body) 6384 if err != nil { 6385 return nil, err 6386 } 6387 req.Header = reqHeaders 6388 googleapi.Expand(req.URL, map[string]string{ 6389 "parent": c.parent, 6390 }) 6391 return gensupport.SendRequest(c.ctx_, c.s.client, req) 6392} 6393 6394// Do executes the "cloudkms.projects.locations.keyRings.cryptoKeys.cryptoKeyVersions.list" call. 6395// Exactly one of *ListCryptoKeyVersionsResponse or error will be 6396// non-nil. Any non-2xx status code is an error. Response headers are in 6397// either *ListCryptoKeyVersionsResponse.ServerResponse.Header or (if a 6398// response was returned at all) in error.(*googleapi.Error).Header. Use 6399// googleapi.IsNotModified to check whether the returned error was 6400// because http.StatusNotModified was returned. 6401func (c *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsListCall) Do(opts ...googleapi.CallOption) (*ListCryptoKeyVersionsResponse, error) { 6402 gensupport.SetOptions(c.urlParams_, opts...) 6403 res, err := c.doRequest("json") 6404 if res != nil && res.StatusCode == http.StatusNotModified { 6405 if res.Body != nil { 6406 res.Body.Close() 6407 } 6408 return nil, &googleapi.Error{ 6409 Code: res.StatusCode, 6410 Header: res.Header, 6411 } 6412 } 6413 if err != nil { 6414 return nil, err 6415 } 6416 defer googleapi.CloseBody(res) 6417 if err := googleapi.CheckResponse(res); err != nil { 6418 return nil, err 6419 } 6420 ret := &ListCryptoKeyVersionsResponse{ 6421 ServerResponse: googleapi.ServerResponse{ 6422 Header: res.Header, 6423 HTTPStatusCode: res.StatusCode, 6424 }, 6425 } 6426 target := &ret 6427 if err := gensupport.DecodeResponse(target, res); err != nil { 6428 return nil, err 6429 } 6430 return ret, nil 6431 // { 6432 // "description": "Lists CryptoKeyVersions.", 6433 // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/keyRings/{keyRingsId}/cryptoKeys/{cryptoKeysId}/cryptoKeyVersions", 6434 // "httpMethod": "GET", 6435 // "id": "cloudkms.projects.locations.keyRings.cryptoKeys.cryptoKeyVersions.list", 6436 // "parameterOrder": [ 6437 // "parent" 6438 // ], 6439 // "parameters": { 6440 // "filter": { 6441 // "description": "Optional. Only include resources that match the filter in the response. For\nmore information, see\n[Sorting and filtering list\nresults](https://cloud.google.com/kms/docs/sorting-and-filtering).", 6442 // "location": "query", 6443 // "type": "string" 6444 // }, 6445 // "orderBy": { 6446 // "description": "Optional. Specify how the results should be sorted. If not specified, the\nresults will be sorted in the default order. For more information, see\n[Sorting and filtering list\nresults](https://cloud.google.com/kms/docs/sorting-and-filtering).", 6447 // "location": "query", 6448 // "type": "string" 6449 // }, 6450 // "pageSize": { 6451 // "description": "Optional. Optional limit on the number of CryptoKeyVersions to\ninclude in the response. Further CryptoKeyVersions can\nsubsequently be obtained by including the\nListCryptoKeyVersionsResponse.next_page_token in a subsequent request.\nIf unspecified, the server will pick an appropriate default.", 6452 // "format": "int32", 6453 // "location": "query", 6454 // "type": "integer" 6455 // }, 6456 // "pageToken": { 6457 // "description": "Optional. Optional pagination token, returned earlier via\nListCryptoKeyVersionsResponse.next_page_token.", 6458 // "location": "query", 6459 // "type": "string" 6460 // }, 6461 // "parent": { 6462 // "description": "Required. The resource name of the CryptoKey to list, in the format\n`projects/*/locations/*/keyRings/*/cryptoKeys/*`.", 6463 // "location": "path", 6464 // "pattern": "^projects/[^/]+/locations/[^/]+/keyRings/[^/]+/cryptoKeys/[^/]+$", 6465 // "required": true, 6466 // "type": "string" 6467 // }, 6468 // "view": { 6469 // "description": "The fields to include in the response.", 6470 // "enum": [ 6471 // "CRYPTO_KEY_VERSION_VIEW_UNSPECIFIED", 6472 // "FULL" 6473 // ], 6474 // "location": "query", 6475 // "type": "string" 6476 // } 6477 // }, 6478 // "path": "v1/{+parent}/cryptoKeyVersions", 6479 // "response": { 6480 // "$ref": "ListCryptoKeyVersionsResponse" 6481 // }, 6482 // "scopes": [ 6483 // "https://www.googleapis.com/auth/cloud-platform", 6484 // "https://www.googleapis.com/auth/cloudkms" 6485 // ] 6486 // } 6487 6488} 6489 6490// Pages invokes f for each page of results. 6491// A non-nil error returned from f will halt the iteration. 6492// The provided context supersedes any context provided to the Context method. 6493func (c *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsListCall) Pages(ctx context.Context, f func(*ListCryptoKeyVersionsResponse) error) error { 6494 c.ctx_ = ctx 6495 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 6496 for { 6497 x, err := c.Do() 6498 if err != nil { 6499 return err 6500 } 6501 if err := f(x); err != nil { 6502 return err 6503 } 6504 if x.NextPageToken == "" { 6505 return nil 6506 } 6507 c.PageToken(x.NextPageToken) 6508 } 6509} 6510 6511// method id "cloudkms.projects.locations.keyRings.cryptoKeys.cryptoKeyVersions.patch": 6512 6513type ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsPatchCall struct { 6514 s *Service 6515 name string 6516 cryptokeyversion *CryptoKeyVersion 6517 urlParams_ gensupport.URLParams 6518 ctx_ context.Context 6519 header_ http.Header 6520} 6521 6522// Patch: Update a CryptoKeyVersion's metadata. 6523// 6524// state may be changed between 6525// ENABLED and 6526// DISABLED using this 6527// method. See DestroyCryptoKeyVersion and RestoreCryptoKeyVersion 6528// to 6529// move between other states. 6530func (r *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsService) Patch(name string, cryptokeyversion *CryptoKeyVersion) *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsPatchCall { 6531 c := &ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)} 6532 c.name = name 6533 c.cryptokeyversion = cryptokeyversion 6534 return c 6535} 6536 6537// UpdateMask sets the optional parameter "updateMask": Required. List 6538// of fields to be updated in this request. 6539func (c *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsPatchCall) UpdateMask(updateMask string) *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsPatchCall { 6540 c.urlParams_.Set("updateMask", updateMask) 6541 return c 6542} 6543 6544// Fields allows partial responses to be retrieved. See 6545// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 6546// for more information. 6547func (c *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsPatchCall) Fields(s ...googleapi.Field) *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsPatchCall { 6548 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 6549 return c 6550} 6551 6552// Context sets the context to be used in this call's Do method. Any 6553// pending HTTP request will be aborted if the provided context is 6554// canceled. 6555func (c *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsPatchCall) Context(ctx context.Context) *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsPatchCall { 6556 c.ctx_ = ctx 6557 return c 6558} 6559 6560// Header returns an http.Header that can be modified by the caller to 6561// add HTTP headers to the request. 6562func (c *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsPatchCall) Header() http.Header { 6563 if c.header_ == nil { 6564 c.header_ = make(http.Header) 6565 } 6566 return c.header_ 6567} 6568 6569func (c *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsPatchCall) doRequest(alt string) (*http.Response, error) { 6570 reqHeaders := make(http.Header) 6571 reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190926") 6572 for k, v := range c.header_ { 6573 reqHeaders[k] = v 6574 } 6575 reqHeaders.Set("User-Agent", c.s.userAgent()) 6576 var body io.Reader = nil 6577 body, err := googleapi.WithoutDataWrapper.JSONReader(c.cryptokeyversion) 6578 if err != nil { 6579 return nil, err 6580 } 6581 reqHeaders.Set("Content-Type", "application/json") 6582 c.urlParams_.Set("alt", alt) 6583 c.urlParams_.Set("prettyPrint", "false") 6584 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}") 6585 urls += "?" + c.urlParams_.Encode() 6586 req, err := http.NewRequest("PATCH", urls, body) 6587 if err != nil { 6588 return nil, err 6589 } 6590 req.Header = reqHeaders 6591 googleapi.Expand(req.URL, map[string]string{ 6592 "name": c.name, 6593 }) 6594 return gensupport.SendRequest(c.ctx_, c.s.client, req) 6595} 6596 6597// Do executes the "cloudkms.projects.locations.keyRings.cryptoKeys.cryptoKeyVersions.patch" call. 6598// Exactly one of *CryptoKeyVersion or error will be non-nil. Any 6599// non-2xx status code is an error. Response headers are in either 6600// *CryptoKeyVersion.ServerResponse.Header or (if a response was 6601// returned at all) in error.(*googleapi.Error).Header. Use 6602// googleapi.IsNotModified to check whether the returned error was 6603// because http.StatusNotModified was returned. 6604func (c *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsPatchCall) Do(opts ...googleapi.CallOption) (*CryptoKeyVersion, error) { 6605 gensupport.SetOptions(c.urlParams_, opts...) 6606 res, err := c.doRequest("json") 6607 if res != nil && res.StatusCode == http.StatusNotModified { 6608 if res.Body != nil { 6609 res.Body.Close() 6610 } 6611 return nil, &googleapi.Error{ 6612 Code: res.StatusCode, 6613 Header: res.Header, 6614 } 6615 } 6616 if err != nil { 6617 return nil, err 6618 } 6619 defer googleapi.CloseBody(res) 6620 if err := googleapi.CheckResponse(res); err != nil { 6621 return nil, err 6622 } 6623 ret := &CryptoKeyVersion{ 6624 ServerResponse: googleapi.ServerResponse{ 6625 Header: res.Header, 6626 HTTPStatusCode: res.StatusCode, 6627 }, 6628 } 6629 target := &ret 6630 if err := gensupport.DecodeResponse(target, res); err != nil { 6631 return nil, err 6632 } 6633 return ret, nil 6634 // { 6635 // "description": "Update a CryptoKeyVersion's metadata.\n\nstate may be changed between\nENABLED and\nDISABLED using this\nmethod. See DestroyCryptoKeyVersion and RestoreCryptoKeyVersion to\nmove between other states.", 6636 // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/keyRings/{keyRingsId}/cryptoKeys/{cryptoKeysId}/cryptoKeyVersions/{cryptoKeyVersionsId}", 6637 // "httpMethod": "PATCH", 6638 // "id": "cloudkms.projects.locations.keyRings.cryptoKeys.cryptoKeyVersions.patch", 6639 // "parameterOrder": [ 6640 // "name" 6641 // ], 6642 // "parameters": { 6643 // "name": { 6644 // "description": "Output only. The resource name for this CryptoKeyVersion in the format\n`projects/*/locations/*/keyRings/*/cryptoKeys/*/cryptoKeyVersions/*`.", 6645 // "location": "path", 6646 // "pattern": "^projects/[^/]+/locations/[^/]+/keyRings/[^/]+/cryptoKeys/[^/]+/cryptoKeyVersions/[^/]+$", 6647 // "required": true, 6648 // "type": "string" 6649 // }, 6650 // "updateMask": { 6651 // "description": "Required. List of fields to be updated in this request.", 6652 // "format": "google-fieldmask", 6653 // "location": "query", 6654 // "type": "string" 6655 // } 6656 // }, 6657 // "path": "v1/{+name}", 6658 // "request": { 6659 // "$ref": "CryptoKeyVersion" 6660 // }, 6661 // "response": { 6662 // "$ref": "CryptoKeyVersion" 6663 // }, 6664 // "scopes": [ 6665 // "https://www.googleapis.com/auth/cloud-platform", 6666 // "https://www.googleapis.com/auth/cloudkms" 6667 // ] 6668 // } 6669 6670} 6671 6672// method id "cloudkms.projects.locations.keyRings.cryptoKeys.cryptoKeyVersions.restore": 6673 6674type ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsRestoreCall struct { 6675 s *Service 6676 name string 6677 restorecryptokeyversionrequest *RestoreCryptoKeyVersionRequest 6678 urlParams_ gensupport.URLParams 6679 ctx_ context.Context 6680 header_ http.Header 6681} 6682 6683// Restore: Restore a CryptoKeyVersion in 6684// the 6685// DESTROY_SCHEDULED 6686// state. 6687// 6688// Upon restoration of the CryptoKeyVersion, state 6689// will be set to DISABLED, 6690// and destroy_time will be cleared. 6691func (r *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsService) Restore(name string, restorecryptokeyversionrequest *RestoreCryptoKeyVersionRequest) *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsRestoreCall { 6692 c := &ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsRestoreCall{s: r.s, urlParams_: make(gensupport.URLParams)} 6693 c.name = name 6694 c.restorecryptokeyversionrequest = restorecryptokeyversionrequest 6695 return c 6696} 6697 6698// Fields allows partial responses to be retrieved. See 6699// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 6700// for more information. 6701func (c *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsRestoreCall) Fields(s ...googleapi.Field) *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsRestoreCall { 6702 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 6703 return c 6704} 6705 6706// Context sets the context to be used in this call's Do method. Any 6707// pending HTTP request will be aborted if the provided context is 6708// canceled. 6709func (c *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsRestoreCall) Context(ctx context.Context) *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsRestoreCall { 6710 c.ctx_ = ctx 6711 return c 6712} 6713 6714// Header returns an http.Header that can be modified by the caller to 6715// add HTTP headers to the request. 6716func (c *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsRestoreCall) Header() http.Header { 6717 if c.header_ == nil { 6718 c.header_ = make(http.Header) 6719 } 6720 return c.header_ 6721} 6722 6723func (c *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsRestoreCall) doRequest(alt string) (*http.Response, error) { 6724 reqHeaders := make(http.Header) 6725 reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190926") 6726 for k, v := range c.header_ { 6727 reqHeaders[k] = v 6728 } 6729 reqHeaders.Set("User-Agent", c.s.userAgent()) 6730 var body io.Reader = nil 6731 body, err := googleapi.WithoutDataWrapper.JSONReader(c.restorecryptokeyversionrequest) 6732 if err != nil { 6733 return nil, err 6734 } 6735 reqHeaders.Set("Content-Type", "application/json") 6736 c.urlParams_.Set("alt", alt) 6737 c.urlParams_.Set("prettyPrint", "false") 6738 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}:restore") 6739 urls += "?" + c.urlParams_.Encode() 6740 req, err := http.NewRequest("POST", urls, body) 6741 if err != nil { 6742 return nil, err 6743 } 6744 req.Header = reqHeaders 6745 googleapi.Expand(req.URL, map[string]string{ 6746 "name": c.name, 6747 }) 6748 return gensupport.SendRequest(c.ctx_, c.s.client, req) 6749} 6750 6751// Do executes the "cloudkms.projects.locations.keyRings.cryptoKeys.cryptoKeyVersions.restore" call. 6752// Exactly one of *CryptoKeyVersion or error will be non-nil. Any 6753// non-2xx status code is an error. Response headers are in either 6754// *CryptoKeyVersion.ServerResponse.Header or (if a response was 6755// returned at all) in error.(*googleapi.Error).Header. Use 6756// googleapi.IsNotModified to check whether the returned error was 6757// because http.StatusNotModified was returned. 6758func (c *ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsRestoreCall) Do(opts ...googleapi.CallOption) (*CryptoKeyVersion, error) { 6759 gensupport.SetOptions(c.urlParams_, opts...) 6760 res, err := c.doRequest("json") 6761 if res != nil && res.StatusCode == http.StatusNotModified { 6762 if res.Body != nil { 6763 res.Body.Close() 6764 } 6765 return nil, &googleapi.Error{ 6766 Code: res.StatusCode, 6767 Header: res.Header, 6768 } 6769 } 6770 if err != nil { 6771 return nil, err 6772 } 6773 defer googleapi.CloseBody(res) 6774 if err := googleapi.CheckResponse(res); err != nil { 6775 return nil, err 6776 } 6777 ret := &CryptoKeyVersion{ 6778 ServerResponse: googleapi.ServerResponse{ 6779 Header: res.Header, 6780 HTTPStatusCode: res.StatusCode, 6781 }, 6782 } 6783 target := &ret 6784 if err := gensupport.DecodeResponse(target, res); err != nil { 6785 return nil, err 6786 } 6787 return ret, nil 6788 // { 6789 // "description": "Restore a CryptoKeyVersion in the\nDESTROY_SCHEDULED\nstate.\n\nUpon restoration of the CryptoKeyVersion, state\nwill be set to DISABLED,\nand destroy_time will be cleared.", 6790 // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/keyRings/{keyRingsId}/cryptoKeys/{cryptoKeysId}/cryptoKeyVersions/{cryptoKeyVersionsId}:restore", 6791 // "httpMethod": "POST", 6792 // "id": "cloudkms.projects.locations.keyRings.cryptoKeys.cryptoKeyVersions.restore", 6793 // "parameterOrder": [ 6794 // "name" 6795 // ], 6796 // "parameters": { 6797 // "name": { 6798 // "description": "Required. The resource name of the CryptoKeyVersion to restore.", 6799 // "location": "path", 6800 // "pattern": "^projects/[^/]+/locations/[^/]+/keyRings/[^/]+/cryptoKeys/[^/]+/cryptoKeyVersions/[^/]+$", 6801 // "required": true, 6802 // "type": "string" 6803 // } 6804 // }, 6805 // "path": "v1/{+name}:restore", 6806 // "request": { 6807 // "$ref": "RestoreCryptoKeyVersionRequest" 6808 // }, 6809 // "response": { 6810 // "$ref": "CryptoKeyVersion" 6811 // }, 6812 // "scopes": [ 6813 // "https://www.googleapis.com/auth/cloud-platform", 6814 // "https://www.googleapis.com/auth/cloudkms" 6815 // ] 6816 // } 6817 6818} 6819 6820// method id "cloudkms.projects.locations.keyRings.importJobs.create": 6821 6822type ProjectsLocationsKeyRingsImportJobsCreateCall struct { 6823 s *Service 6824 parent string 6825 importjob *ImportJob 6826 urlParams_ gensupport.URLParams 6827 ctx_ context.Context 6828 header_ http.Header 6829} 6830 6831// Create: Create a new ImportJob within a 6832// KeyRing. 6833// 6834// ImportJob.import_method is required. 6835func (r *ProjectsLocationsKeyRingsImportJobsService) Create(parent string, importjob *ImportJob) *ProjectsLocationsKeyRingsImportJobsCreateCall { 6836 c := &ProjectsLocationsKeyRingsImportJobsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)} 6837 c.parent = parent 6838 c.importjob = importjob 6839 return c 6840} 6841 6842// ImportJobId sets the optional parameter "importJobId": Required. It 6843// must be unique within a KeyRing and match the regular 6844// expression `[a-zA-Z0-9_-]{1,63}` 6845func (c *ProjectsLocationsKeyRingsImportJobsCreateCall) ImportJobId(importJobId string) *ProjectsLocationsKeyRingsImportJobsCreateCall { 6846 c.urlParams_.Set("importJobId", importJobId) 6847 return c 6848} 6849 6850// Fields allows partial responses to be retrieved. See 6851// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 6852// for more information. 6853func (c *ProjectsLocationsKeyRingsImportJobsCreateCall) Fields(s ...googleapi.Field) *ProjectsLocationsKeyRingsImportJobsCreateCall { 6854 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 6855 return c 6856} 6857 6858// Context sets the context to be used in this call's Do method. Any 6859// pending HTTP request will be aborted if the provided context is 6860// canceled. 6861func (c *ProjectsLocationsKeyRingsImportJobsCreateCall) Context(ctx context.Context) *ProjectsLocationsKeyRingsImportJobsCreateCall { 6862 c.ctx_ = ctx 6863 return c 6864} 6865 6866// Header returns an http.Header that can be modified by the caller to 6867// add HTTP headers to the request. 6868func (c *ProjectsLocationsKeyRingsImportJobsCreateCall) Header() http.Header { 6869 if c.header_ == nil { 6870 c.header_ = make(http.Header) 6871 } 6872 return c.header_ 6873} 6874 6875func (c *ProjectsLocationsKeyRingsImportJobsCreateCall) doRequest(alt string) (*http.Response, error) { 6876 reqHeaders := make(http.Header) 6877 reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190926") 6878 for k, v := range c.header_ { 6879 reqHeaders[k] = v 6880 } 6881 reqHeaders.Set("User-Agent", c.s.userAgent()) 6882 var body io.Reader = nil 6883 body, err := googleapi.WithoutDataWrapper.JSONReader(c.importjob) 6884 if err != nil { 6885 return nil, err 6886 } 6887 reqHeaders.Set("Content-Type", "application/json") 6888 c.urlParams_.Set("alt", alt) 6889 c.urlParams_.Set("prettyPrint", "false") 6890 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}/importJobs") 6891 urls += "?" + c.urlParams_.Encode() 6892 req, err := http.NewRequest("POST", urls, body) 6893 if err != nil { 6894 return nil, err 6895 } 6896 req.Header = reqHeaders 6897 googleapi.Expand(req.URL, map[string]string{ 6898 "parent": c.parent, 6899 }) 6900 return gensupport.SendRequest(c.ctx_, c.s.client, req) 6901} 6902 6903// Do executes the "cloudkms.projects.locations.keyRings.importJobs.create" call. 6904// Exactly one of *ImportJob or error will be non-nil. Any non-2xx 6905// status code is an error. Response headers are in either 6906// *ImportJob.ServerResponse.Header or (if a response was returned at 6907// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 6908// to check whether the returned error was because 6909// http.StatusNotModified was returned. 6910func (c *ProjectsLocationsKeyRingsImportJobsCreateCall) Do(opts ...googleapi.CallOption) (*ImportJob, error) { 6911 gensupport.SetOptions(c.urlParams_, opts...) 6912 res, err := c.doRequest("json") 6913 if res != nil && res.StatusCode == http.StatusNotModified { 6914 if res.Body != nil { 6915 res.Body.Close() 6916 } 6917 return nil, &googleapi.Error{ 6918 Code: res.StatusCode, 6919 Header: res.Header, 6920 } 6921 } 6922 if err != nil { 6923 return nil, err 6924 } 6925 defer googleapi.CloseBody(res) 6926 if err := googleapi.CheckResponse(res); err != nil { 6927 return nil, err 6928 } 6929 ret := &ImportJob{ 6930 ServerResponse: googleapi.ServerResponse{ 6931 Header: res.Header, 6932 HTTPStatusCode: res.StatusCode, 6933 }, 6934 } 6935 target := &ret 6936 if err := gensupport.DecodeResponse(target, res); err != nil { 6937 return nil, err 6938 } 6939 return ret, nil 6940 // { 6941 // "description": "Create a new ImportJob within a KeyRing.\n\nImportJob.import_method is required.", 6942 // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/keyRings/{keyRingsId}/importJobs", 6943 // "httpMethod": "POST", 6944 // "id": "cloudkms.projects.locations.keyRings.importJobs.create", 6945 // "parameterOrder": [ 6946 // "parent" 6947 // ], 6948 // "parameters": { 6949 // "importJobId": { 6950 // "description": "Required. It must be unique within a KeyRing and match the regular\nexpression `[a-zA-Z0-9_-]{1,63}`", 6951 // "location": "query", 6952 // "type": "string" 6953 // }, 6954 // "parent": { 6955 // "description": "Required. The name of the KeyRing associated with the\nImportJobs.", 6956 // "location": "path", 6957 // "pattern": "^projects/[^/]+/locations/[^/]+/keyRings/[^/]+$", 6958 // "required": true, 6959 // "type": "string" 6960 // } 6961 // }, 6962 // "path": "v1/{+parent}/importJobs", 6963 // "request": { 6964 // "$ref": "ImportJob" 6965 // }, 6966 // "response": { 6967 // "$ref": "ImportJob" 6968 // }, 6969 // "scopes": [ 6970 // "https://www.googleapis.com/auth/cloud-platform", 6971 // "https://www.googleapis.com/auth/cloudkms" 6972 // ] 6973 // } 6974 6975} 6976 6977// method id "cloudkms.projects.locations.keyRings.importJobs.get": 6978 6979type ProjectsLocationsKeyRingsImportJobsGetCall struct { 6980 s *Service 6981 name string 6982 urlParams_ gensupport.URLParams 6983 ifNoneMatch_ string 6984 ctx_ context.Context 6985 header_ http.Header 6986} 6987 6988// Get: Returns metadata for a given ImportJob. 6989func (r *ProjectsLocationsKeyRingsImportJobsService) Get(name string) *ProjectsLocationsKeyRingsImportJobsGetCall { 6990 c := &ProjectsLocationsKeyRingsImportJobsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 6991 c.name = name 6992 return c 6993} 6994 6995// Fields allows partial responses to be retrieved. See 6996// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 6997// for more information. 6998func (c *ProjectsLocationsKeyRingsImportJobsGetCall) Fields(s ...googleapi.Field) *ProjectsLocationsKeyRingsImportJobsGetCall { 6999 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 7000 return c 7001} 7002 7003// IfNoneMatch sets the optional parameter which makes the operation 7004// fail if the object's ETag matches the given value. This is useful for 7005// getting updates only after the object has changed since the last 7006// request. Use googleapi.IsNotModified to check whether the response 7007// error from Do is the result of In-None-Match. 7008func (c *ProjectsLocationsKeyRingsImportJobsGetCall) IfNoneMatch(entityTag string) *ProjectsLocationsKeyRingsImportJobsGetCall { 7009 c.ifNoneMatch_ = entityTag 7010 return c 7011} 7012 7013// Context sets the context to be used in this call's Do method. Any 7014// pending HTTP request will be aborted if the provided context is 7015// canceled. 7016func (c *ProjectsLocationsKeyRingsImportJobsGetCall) Context(ctx context.Context) *ProjectsLocationsKeyRingsImportJobsGetCall { 7017 c.ctx_ = ctx 7018 return c 7019} 7020 7021// Header returns an http.Header that can be modified by the caller to 7022// add HTTP headers to the request. 7023func (c *ProjectsLocationsKeyRingsImportJobsGetCall) Header() http.Header { 7024 if c.header_ == nil { 7025 c.header_ = make(http.Header) 7026 } 7027 return c.header_ 7028} 7029 7030func (c *ProjectsLocationsKeyRingsImportJobsGetCall) doRequest(alt string) (*http.Response, error) { 7031 reqHeaders := make(http.Header) 7032 reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190926") 7033 for k, v := range c.header_ { 7034 reqHeaders[k] = v 7035 } 7036 reqHeaders.Set("User-Agent", c.s.userAgent()) 7037 if c.ifNoneMatch_ != "" { 7038 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 7039 } 7040 var body io.Reader = nil 7041 c.urlParams_.Set("alt", alt) 7042 c.urlParams_.Set("prettyPrint", "false") 7043 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}") 7044 urls += "?" + c.urlParams_.Encode() 7045 req, err := http.NewRequest("GET", urls, body) 7046 if err != nil { 7047 return nil, err 7048 } 7049 req.Header = reqHeaders 7050 googleapi.Expand(req.URL, map[string]string{ 7051 "name": c.name, 7052 }) 7053 return gensupport.SendRequest(c.ctx_, c.s.client, req) 7054} 7055 7056// Do executes the "cloudkms.projects.locations.keyRings.importJobs.get" call. 7057// Exactly one of *ImportJob or error will be non-nil. Any non-2xx 7058// status code is an error. Response headers are in either 7059// *ImportJob.ServerResponse.Header or (if a response was returned at 7060// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 7061// to check whether the returned error was because 7062// http.StatusNotModified was returned. 7063func (c *ProjectsLocationsKeyRingsImportJobsGetCall) Do(opts ...googleapi.CallOption) (*ImportJob, error) { 7064 gensupport.SetOptions(c.urlParams_, opts...) 7065 res, err := c.doRequest("json") 7066 if res != nil && res.StatusCode == http.StatusNotModified { 7067 if res.Body != nil { 7068 res.Body.Close() 7069 } 7070 return nil, &googleapi.Error{ 7071 Code: res.StatusCode, 7072 Header: res.Header, 7073 } 7074 } 7075 if err != nil { 7076 return nil, err 7077 } 7078 defer googleapi.CloseBody(res) 7079 if err := googleapi.CheckResponse(res); err != nil { 7080 return nil, err 7081 } 7082 ret := &ImportJob{ 7083 ServerResponse: googleapi.ServerResponse{ 7084 Header: res.Header, 7085 HTTPStatusCode: res.StatusCode, 7086 }, 7087 } 7088 target := &ret 7089 if err := gensupport.DecodeResponse(target, res); err != nil { 7090 return nil, err 7091 } 7092 return ret, nil 7093 // { 7094 // "description": "Returns metadata for a given ImportJob.", 7095 // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/keyRings/{keyRingsId}/importJobs/{importJobsId}", 7096 // "httpMethod": "GET", 7097 // "id": "cloudkms.projects.locations.keyRings.importJobs.get", 7098 // "parameterOrder": [ 7099 // "name" 7100 // ], 7101 // "parameters": { 7102 // "name": { 7103 // "description": "Required. The name of the ImportJob to get.", 7104 // "location": "path", 7105 // "pattern": "^projects/[^/]+/locations/[^/]+/keyRings/[^/]+/importJobs/[^/]+$", 7106 // "required": true, 7107 // "type": "string" 7108 // } 7109 // }, 7110 // "path": "v1/{+name}", 7111 // "response": { 7112 // "$ref": "ImportJob" 7113 // }, 7114 // "scopes": [ 7115 // "https://www.googleapis.com/auth/cloud-platform", 7116 // "https://www.googleapis.com/auth/cloudkms" 7117 // ] 7118 // } 7119 7120} 7121 7122// method id "cloudkms.projects.locations.keyRings.importJobs.getIamPolicy": 7123 7124type ProjectsLocationsKeyRingsImportJobsGetIamPolicyCall struct { 7125 s *Service 7126 resource string 7127 urlParams_ gensupport.URLParams 7128 ifNoneMatch_ string 7129 ctx_ context.Context 7130 header_ http.Header 7131} 7132 7133// GetIamPolicy: Gets the access control policy for a resource. 7134// Returns an empty policy if the resource exists and does not have a 7135// policy 7136// set. 7137func (r *ProjectsLocationsKeyRingsImportJobsService) GetIamPolicy(resource string) *ProjectsLocationsKeyRingsImportJobsGetIamPolicyCall { 7138 c := &ProjectsLocationsKeyRingsImportJobsGetIamPolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)} 7139 c.resource = resource 7140 return c 7141} 7142 7143// OptionsRequestedPolicyVersion sets the optional parameter 7144// "options.requestedPolicyVersion": The policy format version to be 7145// returned. 7146// 7147// Valid values are 0, 1, and 3. Requests specifying an invalid value 7148// will be 7149// rejected. 7150// 7151// Requests for policies with any conditional bindings must specify 7152// version 3. 7153// Policies without any conditional bindings may specify any valid value 7154// or 7155// leave the field unset. 7156func (c *ProjectsLocationsKeyRingsImportJobsGetIamPolicyCall) OptionsRequestedPolicyVersion(optionsRequestedPolicyVersion int64) *ProjectsLocationsKeyRingsImportJobsGetIamPolicyCall { 7157 c.urlParams_.Set("options.requestedPolicyVersion", fmt.Sprint(optionsRequestedPolicyVersion)) 7158 return c 7159} 7160 7161// Fields allows partial responses to be retrieved. See 7162// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 7163// for more information. 7164func (c *ProjectsLocationsKeyRingsImportJobsGetIamPolicyCall) Fields(s ...googleapi.Field) *ProjectsLocationsKeyRingsImportJobsGetIamPolicyCall { 7165 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 7166 return c 7167} 7168 7169// IfNoneMatch sets the optional parameter which makes the operation 7170// fail if the object's ETag matches the given value. This is useful for 7171// getting updates only after the object has changed since the last 7172// request. Use googleapi.IsNotModified to check whether the response 7173// error from Do is the result of In-None-Match. 7174func (c *ProjectsLocationsKeyRingsImportJobsGetIamPolicyCall) IfNoneMatch(entityTag string) *ProjectsLocationsKeyRingsImportJobsGetIamPolicyCall { 7175 c.ifNoneMatch_ = entityTag 7176 return c 7177} 7178 7179// Context sets the context to be used in this call's Do method. Any 7180// pending HTTP request will be aborted if the provided context is 7181// canceled. 7182func (c *ProjectsLocationsKeyRingsImportJobsGetIamPolicyCall) Context(ctx context.Context) *ProjectsLocationsKeyRingsImportJobsGetIamPolicyCall { 7183 c.ctx_ = ctx 7184 return c 7185} 7186 7187// Header returns an http.Header that can be modified by the caller to 7188// add HTTP headers to the request. 7189func (c *ProjectsLocationsKeyRingsImportJobsGetIamPolicyCall) Header() http.Header { 7190 if c.header_ == nil { 7191 c.header_ = make(http.Header) 7192 } 7193 return c.header_ 7194} 7195 7196func (c *ProjectsLocationsKeyRingsImportJobsGetIamPolicyCall) doRequest(alt string) (*http.Response, error) { 7197 reqHeaders := make(http.Header) 7198 reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190926") 7199 for k, v := range c.header_ { 7200 reqHeaders[k] = v 7201 } 7202 reqHeaders.Set("User-Agent", c.s.userAgent()) 7203 if c.ifNoneMatch_ != "" { 7204 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 7205 } 7206 var body io.Reader = nil 7207 c.urlParams_.Set("alt", alt) 7208 c.urlParams_.Set("prettyPrint", "false") 7209 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+resource}:getIamPolicy") 7210 urls += "?" + c.urlParams_.Encode() 7211 req, err := http.NewRequest("GET", urls, body) 7212 if err != nil { 7213 return nil, err 7214 } 7215 req.Header = reqHeaders 7216 googleapi.Expand(req.URL, map[string]string{ 7217 "resource": c.resource, 7218 }) 7219 return gensupport.SendRequest(c.ctx_, c.s.client, req) 7220} 7221 7222// Do executes the "cloudkms.projects.locations.keyRings.importJobs.getIamPolicy" call. 7223// Exactly one of *Policy or error will be non-nil. Any non-2xx status 7224// code is an error. Response headers are in either 7225// *Policy.ServerResponse.Header or (if a response was returned at all) 7226// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 7227// check whether the returned error was because http.StatusNotModified 7228// was returned. 7229func (c *ProjectsLocationsKeyRingsImportJobsGetIamPolicyCall) Do(opts ...googleapi.CallOption) (*Policy, error) { 7230 gensupport.SetOptions(c.urlParams_, opts...) 7231 res, err := c.doRequest("json") 7232 if res != nil && res.StatusCode == http.StatusNotModified { 7233 if res.Body != nil { 7234 res.Body.Close() 7235 } 7236 return nil, &googleapi.Error{ 7237 Code: res.StatusCode, 7238 Header: res.Header, 7239 } 7240 } 7241 if err != nil { 7242 return nil, err 7243 } 7244 defer googleapi.CloseBody(res) 7245 if err := googleapi.CheckResponse(res); err != nil { 7246 return nil, err 7247 } 7248 ret := &Policy{ 7249 ServerResponse: googleapi.ServerResponse{ 7250 Header: res.Header, 7251 HTTPStatusCode: res.StatusCode, 7252 }, 7253 } 7254 target := &ret 7255 if err := gensupport.DecodeResponse(target, res); err != nil { 7256 return nil, err 7257 } 7258 return ret, nil 7259 // { 7260 // "description": "Gets the access control policy for a resource.\nReturns an empty policy if the resource exists and does not have a policy\nset.", 7261 // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/keyRings/{keyRingsId}/importJobs/{importJobsId}:getIamPolicy", 7262 // "httpMethod": "GET", 7263 // "id": "cloudkms.projects.locations.keyRings.importJobs.getIamPolicy", 7264 // "parameterOrder": [ 7265 // "resource" 7266 // ], 7267 // "parameters": { 7268 // "options.requestedPolicyVersion": { 7269 // "description": "Optional. The policy format version to be returned.\n\nValid values are 0, 1, and 3. Requests specifying an invalid value will be\nrejected.\n\nRequests for policies with any conditional bindings must specify version 3.\nPolicies without any conditional bindings may specify any valid value or\nleave the field unset.", 7270 // "format": "int32", 7271 // "location": "query", 7272 // "type": "integer" 7273 // }, 7274 // "resource": { 7275 // "description": "REQUIRED: The resource for which the policy is being requested.\nSee the operation documentation for the appropriate value for this field.", 7276 // "location": "path", 7277 // "pattern": "^projects/[^/]+/locations/[^/]+/keyRings/[^/]+/importJobs/[^/]+$", 7278 // "required": true, 7279 // "type": "string" 7280 // } 7281 // }, 7282 // "path": "v1/{+resource}:getIamPolicy", 7283 // "response": { 7284 // "$ref": "Policy" 7285 // }, 7286 // "scopes": [ 7287 // "https://www.googleapis.com/auth/cloud-platform", 7288 // "https://www.googleapis.com/auth/cloudkms" 7289 // ] 7290 // } 7291 7292} 7293 7294// method id "cloudkms.projects.locations.keyRings.importJobs.list": 7295 7296type ProjectsLocationsKeyRingsImportJobsListCall struct { 7297 s *Service 7298 parent string 7299 urlParams_ gensupport.URLParams 7300 ifNoneMatch_ string 7301 ctx_ context.Context 7302 header_ http.Header 7303} 7304 7305// List: Lists ImportJobs. 7306func (r *ProjectsLocationsKeyRingsImportJobsService) List(parent string) *ProjectsLocationsKeyRingsImportJobsListCall { 7307 c := &ProjectsLocationsKeyRingsImportJobsListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 7308 c.parent = parent 7309 return c 7310} 7311 7312// Filter sets the optional parameter "filter": Only include resources 7313// that match the filter in the response. For 7314// more information, see 7315// [Sorting and filtering 7316// list 7317// results](https://cloud.google.com/kms/docs/sorting-and-filtering) 7318// . 7319func (c *ProjectsLocationsKeyRingsImportJobsListCall) Filter(filter string) *ProjectsLocationsKeyRingsImportJobsListCall { 7320 c.urlParams_.Set("filter", filter) 7321 return c 7322} 7323 7324// OrderBy sets the optional parameter "orderBy": Specify how the 7325// results should be sorted. If not specified, the 7326// results will be sorted in the default order. For more information, 7327// see 7328// [Sorting and filtering 7329// list 7330// results](https://cloud.google.com/kms/docs/sorting-and-filtering) 7331// . 7332func (c *ProjectsLocationsKeyRingsImportJobsListCall) OrderBy(orderBy string) *ProjectsLocationsKeyRingsImportJobsListCall { 7333 c.urlParams_.Set("orderBy", orderBy) 7334 return c 7335} 7336 7337// PageSize sets the optional parameter "pageSize": Optional limit on 7338// the number of ImportJobs to include in the 7339// response. Further ImportJobs can subsequently be obtained 7340// by 7341// including the ListImportJobsResponse.next_page_token in a 7342// subsequent 7343// request. If unspecified, the server will pick an appropriate default. 7344func (c *ProjectsLocationsKeyRingsImportJobsListCall) PageSize(pageSize int64) *ProjectsLocationsKeyRingsImportJobsListCall { 7345 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize)) 7346 return c 7347} 7348 7349// PageToken sets the optional parameter "pageToken": Optional 7350// pagination token, returned earlier 7351// via 7352// ListImportJobsResponse.next_page_token. 7353func (c *ProjectsLocationsKeyRingsImportJobsListCall) PageToken(pageToken string) *ProjectsLocationsKeyRingsImportJobsListCall { 7354 c.urlParams_.Set("pageToken", pageToken) 7355 return c 7356} 7357 7358// Fields allows partial responses to be retrieved. See 7359// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 7360// for more information. 7361func (c *ProjectsLocationsKeyRingsImportJobsListCall) Fields(s ...googleapi.Field) *ProjectsLocationsKeyRingsImportJobsListCall { 7362 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 7363 return c 7364} 7365 7366// IfNoneMatch sets the optional parameter which makes the operation 7367// fail if the object's ETag matches the given value. This is useful for 7368// getting updates only after the object has changed since the last 7369// request. Use googleapi.IsNotModified to check whether the response 7370// error from Do is the result of In-None-Match. 7371func (c *ProjectsLocationsKeyRingsImportJobsListCall) IfNoneMatch(entityTag string) *ProjectsLocationsKeyRingsImportJobsListCall { 7372 c.ifNoneMatch_ = entityTag 7373 return c 7374} 7375 7376// Context sets the context to be used in this call's Do method. Any 7377// pending HTTP request will be aborted if the provided context is 7378// canceled. 7379func (c *ProjectsLocationsKeyRingsImportJobsListCall) Context(ctx context.Context) *ProjectsLocationsKeyRingsImportJobsListCall { 7380 c.ctx_ = ctx 7381 return c 7382} 7383 7384// Header returns an http.Header that can be modified by the caller to 7385// add HTTP headers to the request. 7386func (c *ProjectsLocationsKeyRingsImportJobsListCall) Header() http.Header { 7387 if c.header_ == nil { 7388 c.header_ = make(http.Header) 7389 } 7390 return c.header_ 7391} 7392 7393func (c *ProjectsLocationsKeyRingsImportJobsListCall) doRequest(alt string) (*http.Response, error) { 7394 reqHeaders := make(http.Header) 7395 reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190926") 7396 for k, v := range c.header_ { 7397 reqHeaders[k] = v 7398 } 7399 reqHeaders.Set("User-Agent", c.s.userAgent()) 7400 if c.ifNoneMatch_ != "" { 7401 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 7402 } 7403 var body io.Reader = nil 7404 c.urlParams_.Set("alt", alt) 7405 c.urlParams_.Set("prettyPrint", "false") 7406 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}/importJobs") 7407 urls += "?" + c.urlParams_.Encode() 7408 req, err := http.NewRequest("GET", urls, body) 7409 if err != nil { 7410 return nil, err 7411 } 7412 req.Header = reqHeaders 7413 googleapi.Expand(req.URL, map[string]string{ 7414 "parent": c.parent, 7415 }) 7416 return gensupport.SendRequest(c.ctx_, c.s.client, req) 7417} 7418 7419// Do executes the "cloudkms.projects.locations.keyRings.importJobs.list" call. 7420// Exactly one of *ListImportJobsResponse or error will be non-nil. Any 7421// non-2xx status code is an error. Response headers are in either 7422// *ListImportJobsResponse.ServerResponse.Header or (if a response was 7423// returned at all) in error.(*googleapi.Error).Header. Use 7424// googleapi.IsNotModified to check whether the returned error was 7425// because http.StatusNotModified was returned. 7426func (c *ProjectsLocationsKeyRingsImportJobsListCall) Do(opts ...googleapi.CallOption) (*ListImportJobsResponse, error) { 7427 gensupport.SetOptions(c.urlParams_, opts...) 7428 res, err := c.doRequest("json") 7429 if res != nil && res.StatusCode == http.StatusNotModified { 7430 if res.Body != nil { 7431 res.Body.Close() 7432 } 7433 return nil, &googleapi.Error{ 7434 Code: res.StatusCode, 7435 Header: res.Header, 7436 } 7437 } 7438 if err != nil { 7439 return nil, err 7440 } 7441 defer googleapi.CloseBody(res) 7442 if err := googleapi.CheckResponse(res); err != nil { 7443 return nil, err 7444 } 7445 ret := &ListImportJobsResponse{ 7446 ServerResponse: googleapi.ServerResponse{ 7447 Header: res.Header, 7448 HTTPStatusCode: res.StatusCode, 7449 }, 7450 } 7451 target := &ret 7452 if err := gensupport.DecodeResponse(target, res); err != nil { 7453 return nil, err 7454 } 7455 return ret, nil 7456 // { 7457 // "description": "Lists ImportJobs.", 7458 // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/keyRings/{keyRingsId}/importJobs", 7459 // "httpMethod": "GET", 7460 // "id": "cloudkms.projects.locations.keyRings.importJobs.list", 7461 // "parameterOrder": [ 7462 // "parent" 7463 // ], 7464 // "parameters": { 7465 // "filter": { 7466 // "description": "Optional. Only include resources that match the filter in the response. For\nmore information, see\n[Sorting and filtering list\nresults](https://cloud.google.com/kms/docs/sorting-and-filtering).", 7467 // "location": "query", 7468 // "type": "string" 7469 // }, 7470 // "orderBy": { 7471 // "description": "Optional. Specify how the results should be sorted. If not specified, the\nresults will be sorted in the default order. For more information, see\n[Sorting and filtering list\nresults](https://cloud.google.com/kms/docs/sorting-and-filtering).", 7472 // "location": "query", 7473 // "type": "string" 7474 // }, 7475 // "pageSize": { 7476 // "description": "Optional. Optional limit on the number of ImportJobs to include in the\nresponse. Further ImportJobs can subsequently be obtained by\nincluding the ListImportJobsResponse.next_page_token in a subsequent\nrequest. If unspecified, the server will pick an appropriate default.", 7477 // "format": "int32", 7478 // "location": "query", 7479 // "type": "integer" 7480 // }, 7481 // "pageToken": { 7482 // "description": "Optional. Optional pagination token, returned earlier via\nListImportJobsResponse.next_page_token.", 7483 // "location": "query", 7484 // "type": "string" 7485 // }, 7486 // "parent": { 7487 // "description": "Required. The resource name of the KeyRing to list, in the format\n`projects/*/locations/*/keyRings/*`.", 7488 // "location": "path", 7489 // "pattern": "^projects/[^/]+/locations/[^/]+/keyRings/[^/]+$", 7490 // "required": true, 7491 // "type": "string" 7492 // } 7493 // }, 7494 // "path": "v1/{+parent}/importJobs", 7495 // "response": { 7496 // "$ref": "ListImportJobsResponse" 7497 // }, 7498 // "scopes": [ 7499 // "https://www.googleapis.com/auth/cloud-platform", 7500 // "https://www.googleapis.com/auth/cloudkms" 7501 // ] 7502 // } 7503 7504} 7505 7506// Pages invokes f for each page of results. 7507// A non-nil error returned from f will halt the iteration. 7508// The provided context supersedes any context provided to the Context method. 7509func (c *ProjectsLocationsKeyRingsImportJobsListCall) Pages(ctx context.Context, f func(*ListImportJobsResponse) error) error { 7510 c.ctx_ = ctx 7511 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 7512 for { 7513 x, err := c.Do() 7514 if err != nil { 7515 return err 7516 } 7517 if err := f(x); err != nil { 7518 return err 7519 } 7520 if x.NextPageToken == "" { 7521 return nil 7522 } 7523 c.PageToken(x.NextPageToken) 7524 } 7525} 7526 7527// method id "cloudkms.projects.locations.keyRings.importJobs.setIamPolicy": 7528 7529type ProjectsLocationsKeyRingsImportJobsSetIamPolicyCall struct { 7530 s *Service 7531 resource string 7532 setiampolicyrequest *SetIamPolicyRequest 7533 urlParams_ gensupport.URLParams 7534 ctx_ context.Context 7535 header_ http.Header 7536} 7537 7538// SetIamPolicy: Sets the access control policy on the specified 7539// resource. Replaces any 7540// existing policy. 7541func (r *ProjectsLocationsKeyRingsImportJobsService) SetIamPolicy(resource string, setiampolicyrequest *SetIamPolicyRequest) *ProjectsLocationsKeyRingsImportJobsSetIamPolicyCall { 7542 c := &ProjectsLocationsKeyRingsImportJobsSetIamPolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)} 7543 c.resource = resource 7544 c.setiampolicyrequest = setiampolicyrequest 7545 return c 7546} 7547 7548// Fields allows partial responses to be retrieved. See 7549// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 7550// for more information. 7551func (c *ProjectsLocationsKeyRingsImportJobsSetIamPolicyCall) Fields(s ...googleapi.Field) *ProjectsLocationsKeyRingsImportJobsSetIamPolicyCall { 7552 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 7553 return c 7554} 7555 7556// Context sets the context to be used in this call's Do method. Any 7557// pending HTTP request will be aborted if the provided context is 7558// canceled. 7559func (c *ProjectsLocationsKeyRingsImportJobsSetIamPolicyCall) Context(ctx context.Context) *ProjectsLocationsKeyRingsImportJobsSetIamPolicyCall { 7560 c.ctx_ = ctx 7561 return c 7562} 7563 7564// Header returns an http.Header that can be modified by the caller to 7565// add HTTP headers to the request. 7566func (c *ProjectsLocationsKeyRingsImportJobsSetIamPolicyCall) Header() http.Header { 7567 if c.header_ == nil { 7568 c.header_ = make(http.Header) 7569 } 7570 return c.header_ 7571} 7572 7573func (c *ProjectsLocationsKeyRingsImportJobsSetIamPolicyCall) doRequest(alt string) (*http.Response, error) { 7574 reqHeaders := make(http.Header) 7575 reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190926") 7576 for k, v := range c.header_ { 7577 reqHeaders[k] = v 7578 } 7579 reqHeaders.Set("User-Agent", c.s.userAgent()) 7580 var body io.Reader = nil 7581 body, err := googleapi.WithoutDataWrapper.JSONReader(c.setiampolicyrequest) 7582 if err != nil { 7583 return nil, err 7584 } 7585 reqHeaders.Set("Content-Type", "application/json") 7586 c.urlParams_.Set("alt", alt) 7587 c.urlParams_.Set("prettyPrint", "false") 7588 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+resource}:setIamPolicy") 7589 urls += "?" + c.urlParams_.Encode() 7590 req, err := http.NewRequest("POST", urls, body) 7591 if err != nil { 7592 return nil, err 7593 } 7594 req.Header = reqHeaders 7595 googleapi.Expand(req.URL, map[string]string{ 7596 "resource": c.resource, 7597 }) 7598 return gensupport.SendRequest(c.ctx_, c.s.client, req) 7599} 7600 7601// Do executes the "cloudkms.projects.locations.keyRings.importJobs.setIamPolicy" call. 7602// Exactly one of *Policy or error will be non-nil. Any non-2xx status 7603// code is an error. Response headers are in either 7604// *Policy.ServerResponse.Header or (if a response was returned at all) 7605// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 7606// check whether the returned error was because http.StatusNotModified 7607// was returned. 7608func (c *ProjectsLocationsKeyRingsImportJobsSetIamPolicyCall) Do(opts ...googleapi.CallOption) (*Policy, error) { 7609 gensupport.SetOptions(c.urlParams_, opts...) 7610 res, err := c.doRequest("json") 7611 if res != nil && res.StatusCode == http.StatusNotModified { 7612 if res.Body != nil { 7613 res.Body.Close() 7614 } 7615 return nil, &googleapi.Error{ 7616 Code: res.StatusCode, 7617 Header: res.Header, 7618 } 7619 } 7620 if err != nil { 7621 return nil, err 7622 } 7623 defer googleapi.CloseBody(res) 7624 if err := googleapi.CheckResponse(res); err != nil { 7625 return nil, err 7626 } 7627 ret := &Policy{ 7628 ServerResponse: googleapi.ServerResponse{ 7629 Header: res.Header, 7630 HTTPStatusCode: res.StatusCode, 7631 }, 7632 } 7633 target := &ret 7634 if err := gensupport.DecodeResponse(target, res); err != nil { 7635 return nil, err 7636 } 7637 return ret, nil 7638 // { 7639 // "description": "Sets the access control policy on the specified resource. Replaces any\nexisting policy.", 7640 // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/keyRings/{keyRingsId}/importJobs/{importJobsId}:setIamPolicy", 7641 // "httpMethod": "POST", 7642 // "id": "cloudkms.projects.locations.keyRings.importJobs.setIamPolicy", 7643 // "parameterOrder": [ 7644 // "resource" 7645 // ], 7646 // "parameters": { 7647 // "resource": { 7648 // "description": "REQUIRED: The resource for which the policy is being specified.\nSee the operation documentation for the appropriate value for this field.", 7649 // "location": "path", 7650 // "pattern": "^projects/[^/]+/locations/[^/]+/keyRings/[^/]+/importJobs/[^/]+$", 7651 // "required": true, 7652 // "type": "string" 7653 // } 7654 // }, 7655 // "path": "v1/{+resource}:setIamPolicy", 7656 // "request": { 7657 // "$ref": "SetIamPolicyRequest" 7658 // }, 7659 // "response": { 7660 // "$ref": "Policy" 7661 // }, 7662 // "scopes": [ 7663 // "https://www.googleapis.com/auth/cloud-platform", 7664 // "https://www.googleapis.com/auth/cloudkms" 7665 // ] 7666 // } 7667 7668} 7669 7670// method id "cloudkms.projects.locations.keyRings.importJobs.testIamPermissions": 7671 7672type ProjectsLocationsKeyRingsImportJobsTestIamPermissionsCall struct { 7673 s *Service 7674 resource string 7675 testiampermissionsrequest *TestIamPermissionsRequest 7676 urlParams_ gensupport.URLParams 7677 ctx_ context.Context 7678 header_ http.Header 7679} 7680 7681// TestIamPermissions: Returns permissions that a caller has on the 7682// specified resource. 7683// If the resource does not exist, this will return an empty set 7684// of 7685// permissions, not a NOT_FOUND error. 7686// 7687// Note: This operation is designed to be used for building 7688// permission-aware 7689// UIs and command-line tools, not for authorization checking. This 7690// operation 7691// may "fail open" without warning. 7692func (r *ProjectsLocationsKeyRingsImportJobsService) TestIamPermissions(resource string, testiampermissionsrequest *TestIamPermissionsRequest) *ProjectsLocationsKeyRingsImportJobsTestIamPermissionsCall { 7693 c := &ProjectsLocationsKeyRingsImportJobsTestIamPermissionsCall{s: r.s, urlParams_: make(gensupport.URLParams)} 7694 c.resource = resource 7695 c.testiampermissionsrequest = testiampermissionsrequest 7696 return c 7697} 7698 7699// Fields allows partial responses to be retrieved. See 7700// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 7701// for more information. 7702func (c *ProjectsLocationsKeyRingsImportJobsTestIamPermissionsCall) Fields(s ...googleapi.Field) *ProjectsLocationsKeyRingsImportJobsTestIamPermissionsCall { 7703 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 7704 return c 7705} 7706 7707// Context sets the context to be used in this call's Do method. Any 7708// pending HTTP request will be aborted if the provided context is 7709// canceled. 7710func (c *ProjectsLocationsKeyRingsImportJobsTestIamPermissionsCall) Context(ctx context.Context) *ProjectsLocationsKeyRingsImportJobsTestIamPermissionsCall { 7711 c.ctx_ = ctx 7712 return c 7713} 7714 7715// Header returns an http.Header that can be modified by the caller to 7716// add HTTP headers to the request. 7717func (c *ProjectsLocationsKeyRingsImportJobsTestIamPermissionsCall) Header() http.Header { 7718 if c.header_ == nil { 7719 c.header_ = make(http.Header) 7720 } 7721 return c.header_ 7722} 7723 7724func (c *ProjectsLocationsKeyRingsImportJobsTestIamPermissionsCall) doRequest(alt string) (*http.Response, error) { 7725 reqHeaders := make(http.Header) 7726 reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190926") 7727 for k, v := range c.header_ { 7728 reqHeaders[k] = v 7729 } 7730 reqHeaders.Set("User-Agent", c.s.userAgent()) 7731 var body io.Reader = nil 7732 body, err := googleapi.WithoutDataWrapper.JSONReader(c.testiampermissionsrequest) 7733 if err != nil { 7734 return nil, err 7735 } 7736 reqHeaders.Set("Content-Type", "application/json") 7737 c.urlParams_.Set("alt", alt) 7738 c.urlParams_.Set("prettyPrint", "false") 7739 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+resource}:testIamPermissions") 7740 urls += "?" + c.urlParams_.Encode() 7741 req, err := http.NewRequest("POST", urls, body) 7742 if err != nil { 7743 return nil, err 7744 } 7745 req.Header = reqHeaders 7746 googleapi.Expand(req.URL, map[string]string{ 7747 "resource": c.resource, 7748 }) 7749 return gensupport.SendRequest(c.ctx_, c.s.client, req) 7750} 7751 7752// Do executes the "cloudkms.projects.locations.keyRings.importJobs.testIamPermissions" call. 7753// Exactly one of *TestIamPermissionsResponse or error will be non-nil. 7754// Any non-2xx status code is an error. Response headers are in either 7755// *TestIamPermissionsResponse.ServerResponse.Header or (if a response 7756// was returned at all) in error.(*googleapi.Error).Header. Use 7757// googleapi.IsNotModified to check whether the returned error was 7758// because http.StatusNotModified was returned. 7759func (c *ProjectsLocationsKeyRingsImportJobsTestIamPermissionsCall) Do(opts ...googleapi.CallOption) (*TestIamPermissionsResponse, error) { 7760 gensupport.SetOptions(c.urlParams_, opts...) 7761 res, err := c.doRequest("json") 7762 if res != nil && res.StatusCode == http.StatusNotModified { 7763 if res.Body != nil { 7764 res.Body.Close() 7765 } 7766 return nil, &googleapi.Error{ 7767 Code: res.StatusCode, 7768 Header: res.Header, 7769 } 7770 } 7771 if err != nil { 7772 return nil, err 7773 } 7774 defer googleapi.CloseBody(res) 7775 if err := googleapi.CheckResponse(res); err != nil { 7776 return nil, err 7777 } 7778 ret := &TestIamPermissionsResponse{ 7779 ServerResponse: googleapi.ServerResponse{ 7780 Header: res.Header, 7781 HTTPStatusCode: res.StatusCode, 7782 }, 7783 } 7784 target := &ret 7785 if err := gensupport.DecodeResponse(target, res); err != nil { 7786 return nil, err 7787 } 7788 return ret, nil 7789 // { 7790 // "description": "Returns permissions that a caller has on the specified resource.\nIf the resource does not exist, this will return an empty set of\npermissions, not a NOT_FOUND error.\n\nNote: This operation is designed to be used for building permission-aware\nUIs and command-line tools, not for authorization checking. This operation\nmay \"fail open\" without warning.", 7791 // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/keyRings/{keyRingsId}/importJobs/{importJobsId}:testIamPermissions", 7792 // "httpMethod": "POST", 7793 // "id": "cloudkms.projects.locations.keyRings.importJobs.testIamPermissions", 7794 // "parameterOrder": [ 7795 // "resource" 7796 // ], 7797 // "parameters": { 7798 // "resource": { 7799 // "description": "REQUIRED: The resource for which the policy detail is being requested.\nSee the operation documentation for the appropriate value for this field.", 7800 // "location": "path", 7801 // "pattern": "^projects/[^/]+/locations/[^/]+/keyRings/[^/]+/importJobs/[^/]+$", 7802 // "required": true, 7803 // "type": "string" 7804 // } 7805 // }, 7806 // "path": "v1/{+resource}:testIamPermissions", 7807 // "request": { 7808 // "$ref": "TestIamPermissionsRequest" 7809 // }, 7810 // "response": { 7811 // "$ref": "TestIamPermissionsResponse" 7812 // }, 7813 // "scopes": [ 7814 // "https://www.googleapis.com/auth/cloud-platform", 7815 // "https://www.googleapis.com/auth/cloudkms" 7816 // ] 7817 // } 7818 7819} 7820