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