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