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