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