1// Copyright 2021 Google LLC.
2// Use of this source code is governed by a BSD-style
3// license that can be found in the LICENSE file.
4
5// Code generated file. DO NOT EDIT.
6
7// Package apikeys provides access to the API Keys API.
8//
9// For product documentation, see: https://cloud.google.com/api-keys/docs
10//
11// Creating a client
12//
13// Usage example:
14//
15//   import "google.golang.org/api/apikeys/v2"
16//   ...
17//   ctx := context.Background()
18//   apikeysService, err := apikeys.NewService(ctx)
19//
20// In this example, Google Application Default Credentials are used for authentication.
21//
22// For information on how to create and obtain Application Default Credentials, see https://developers.google.com/identity/protocols/application-default-credentials.
23//
24// Other authentication options
25//
26// By default, all available scopes (see "Constants") are used to authenticate. To restrict scopes, use option.WithScopes:
27//
28//   apikeysService, err := apikeys.NewService(ctx, option.WithScopes(apikeys.CloudPlatformReadOnlyScope))
29//
30// To use an API key for authentication (note: some APIs do not support API keys), use option.WithAPIKey:
31//
32//   apikeysService, err := apikeys.NewService(ctx, option.WithAPIKey("AIza..."))
33//
34// To use an OAuth token (e.g., a user token obtained via a three-legged OAuth flow), use option.WithTokenSource:
35//
36//   config := &oauth2.Config{...}
37//   // ...
38//   token, err := config.Exchange(ctx, ...)
39//   apikeysService, err := apikeys.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token)))
40//
41// See https://godoc.org/google.golang.org/api/option/ for details on options.
42package apikeys // import "google.golang.org/api/apikeys/v2"
43
44import (
45	"bytes"
46	"context"
47	"encoding/json"
48	"errors"
49	"fmt"
50	"io"
51	"net/http"
52	"net/url"
53	"strconv"
54	"strings"
55
56	googleapi "google.golang.org/api/googleapi"
57	gensupport "google.golang.org/api/internal/gensupport"
58	option "google.golang.org/api/option"
59	internaloption "google.golang.org/api/option/internaloption"
60	htransport "google.golang.org/api/transport/http"
61)
62
63// Always reference these packages, just in case the auto-generated code
64// below doesn't.
65var _ = bytes.NewBuffer
66var _ = strconv.Itoa
67var _ = fmt.Sprintf
68var _ = json.NewDecoder
69var _ = io.Copy
70var _ = url.Parse
71var _ = gensupport.MarshalJSON
72var _ = googleapi.Version
73var _ = errors.New
74var _ = strings.Replace
75var _ = context.Canceled
76var _ = internaloption.WithDefaultEndpoint
77
78const apiId = "apikeys:v2"
79const apiName = "apikeys"
80const apiVersion = "v2"
81const basePath = "https://apikeys.googleapis.com/"
82const mtlsBasePath = "https://apikeys.mtls.googleapis.com/"
83
84// OAuth2 scopes used by this API.
85const (
86	// See, edit, configure, and delete your Google Cloud Platform data
87	CloudPlatformScope = "https://www.googleapis.com/auth/cloud-platform"
88
89	// View your data across Google Cloud Platform services
90	CloudPlatformReadOnlyScope = "https://www.googleapis.com/auth/cloud-platform.read-only"
91)
92
93// NewService creates a new Service.
94func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) {
95	scopesOption := option.WithScopes(
96		"https://www.googleapis.com/auth/cloud-platform",
97		"https://www.googleapis.com/auth/cloud-platform.read-only",
98	)
99	// NOTE: prepend, so we don't override user-specified scopes.
100	opts = append([]option.ClientOption{scopesOption}, opts...)
101	opts = append(opts, internaloption.WithDefaultEndpoint(basePath))
102	opts = append(opts, internaloption.WithDefaultMTLSEndpoint(mtlsBasePath))
103	client, endpoint, err := htransport.NewClient(ctx, opts...)
104	if err != nil {
105		return nil, err
106	}
107	s, err := New(client)
108	if err != nil {
109		return nil, err
110	}
111	if endpoint != "" {
112		s.BasePath = endpoint
113	}
114	return s, nil
115}
116
117// New creates a new Service. It uses the provided http.Client for requests.
118//
119// Deprecated: please use NewService instead.
120// To provide a custom HTTP client, use option.WithHTTPClient.
121// If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead.
122func New(client *http.Client) (*Service, error) {
123	if client == nil {
124		return nil, errors.New("client is nil")
125	}
126	s := &Service{client: client, BasePath: basePath}
127	s.Keys = NewKeysService(s)
128	s.Operations = NewOperationsService(s)
129	s.Projects = NewProjectsService(s)
130	return s, nil
131}
132
133type Service struct {
134	client    *http.Client
135	BasePath  string // API endpoint base URL
136	UserAgent string // optional additional User-Agent fragment
137
138	Keys *KeysService
139
140	Operations *OperationsService
141
142	Projects *ProjectsService
143}
144
145func (s *Service) userAgent() string {
146	if s.UserAgent == "" {
147		return googleapi.UserAgent
148	}
149	return googleapi.UserAgent + " " + s.UserAgent
150}
151
152func NewKeysService(s *Service) *KeysService {
153	rs := &KeysService{s: s}
154	return rs
155}
156
157type KeysService struct {
158	s *Service
159}
160
161func NewOperationsService(s *Service) *OperationsService {
162	rs := &OperationsService{s: s}
163	return rs
164}
165
166type OperationsService struct {
167	s *Service
168}
169
170func NewProjectsService(s *Service) *ProjectsService {
171	rs := &ProjectsService{s: s}
172	rs.Locations = NewProjectsLocationsService(s)
173	return rs
174}
175
176type ProjectsService struct {
177	s *Service
178
179	Locations *ProjectsLocationsService
180}
181
182func NewProjectsLocationsService(s *Service) *ProjectsLocationsService {
183	rs := &ProjectsLocationsService{s: s}
184	rs.Keys = NewProjectsLocationsKeysService(s)
185	return rs
186}
187
188type ProjectsLocationsService struct {
189	s *Service
190
191	Keys *ProjectsLocationsKeysService
192}
193
194func NewProjectsLocationsKeysService(s *Service) *ProjectsLocationsKeysService {
195	rs := &ProjectsLocationsKeysService{s: s}
196	return rs
197}
198
199type ProjectsLocationsKeysService struct {
200	s *Service
201}
202
203// Operation: This resource represents a long-running operation that is
204// the result of a network API call.
205type Operation struct {
206	// Done: If the value is `false`, it means the operation is still in
207	// progress. If `true`, the operation is completed, and either `error`
208	// or `response` is available.
209	Done bool `json:"done,omitempty"`
210
211	// Error: The error result of the operation in case of failure or
212	// cancellation.
213	Error *Status `json:"error,omitempty"`
214
215	// Metadata: Service-specific metadata associated with the operation. It
216	// typically contains progress information and common metadata such as
217	// create time. Some services might not provide such metadata. Any
218	// method that returns a long-running operation should document the
219	// metadata type, if any.
220	Metadata googleapi.RawMessage `json:"metadata,omitempty"`
221
222	// Name: The server-assigned name, which is only unique within the same
223	// service that originally returns it. If you use the default HTTP
224	// mapping, the `name` should be a resource name ending with
225	// `operations/{unique_id}`.
226	Name string `json:"name,omitempty"`
227
228	// Response: The normal response of the operation in case of success. If
229	// the original method returns no data on success, such as `Delete`, the
230	// response is `google.protobuf.Empty`. If the original method is
231	// standard `Get`/`Create`/`Update`, the response should be the
232	// resource. For other methods, the response should have the type
233	// `XxxResponse`, where `Xxx` is the original method name. For example,
234	// if the original method name is `TakeSnapshot()`, the inferred
235	// response type is `TakeSnapshotResponse`.
236	Response googleapi.RawMessage `json:"response,omitempty"`
237
238	// ServerResponse contains the HTTP response code and headers from the
239	// server.
240	googleapi.ServerResponse `json:"-"`
241
242	// ForceSendFields is a list of field names (e.g. "Done") to
243	// unconditionally include in API requests. By default, fields with
244	// empty values are omitted from API requests. However, any non-pointer,
245	// non-interface field appearing in ForceSendFields will be sent to the
246	// server regardless of whether the field is empty or not. This may be
247	// used to include empty fields in Patch requests.
248	ForceSendFields []string `json:"-"`
249
250	// NullFields is a list of field names (e.g. "Done") to include in API
251	// requests with the JSON null value. By default, fields with empty
252	// values are omitted from API requests. However, any field with an
253	// empty value appearing in NullFields will be sent to the server as
254	// null. It is an error if a field in this list has a non-empty value.
255	// This may be used to include null fields in Patch requests.
256	NullFields []string `json:"-"`
257}
258
259func (s *Operation) MarshalJSON() ([]byte, error) {
260	type NoMethod Operation
261	raw := NoMethod(*s)
262	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
263}
264
265// Status: The `Status` type defines a logical error model that is
266// suitable for different programming environments, including REST APIs
267// and RPC APIs. It is used by gRPC (https://github.com/grpc). Each
268// `Status` message contains three pieces of data: error code, error
269// message, and error details. You can find out more about this error
270// model and how to work with it in the API Design Guide
271// (https://cloud.google.com/apis/design/errors).
272type Status struct {
273	// Code: The status code, which should be an enum value of
274	// google.rpc.Code.
275	Code int64 `json:"code,omitempty"`
276
277	// Details: A list of messages that carry the error details. There is a
278	// common set of message types for APIs to use.
279	Details []googleapi.RawMessage `json:"details,omitempty"`
280
281	// Message: A developer-facing error message, which should be in
282	// English. Any user-facing error message should be localized and sent
283	// in the google.rpc.Status.details field, or localized by the client.
284	Message string `json:"message,omitempty"`
285
286	// ForceSendFields is a list of field names (e.g. "Code") to
287	// unconditionally include in API requests. By default, fields with
288	// empty values are omitted from API requests. However, any non-pointer,
289	// non-interface field appearing in ForceSendFields will be sent to the
290	// server regardless of whether the field is empty or not. This may be
291	// used to include empty fields in Patch requests.
292	ForceSendFields []string `json:"-"`
293
294	// NullFields is a list of field names (e.g. "Code") to include in API
295	// requests with the JSON null value. By default, fields with empty
296	// values are omitted from API requests. However, any field with an
297	// empty value appearing in NullFields will be sent to the server as
298	// null. It is an error if a field in this list has a non-empty value.
299	// This may be used to include null fields in Patch requests.
300	NullFields []string `json:"-"`
301}
302
303func (s *Status) MarshalJSON() ([]byte, error) {
304	type NoMethod Status
305	raw := NoMethod(*s)
306	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
307}
308
309// V2AndroidApplication: Identifier of an Android application for key
310// use.
311type V2AndroidApplication struct {
312	// PackageName: The package name of the application.
313	PackageName string `json:"packageName,omitempty"`
314
315	// Sha1Fingerprint: The SHA1 fingerprint of the application. For
316	// example, both sha1 formats are acceptable :
317	// DA:39:A3:EE:5E:6B:4B:0D:32:55:BF:EF:95:60:18:90:AF:D8:07:09 or
318	// DA39A3EE5E6B4B0D3255BFEF95601890AFD80709. Output format is the
319	// latter.
320	Sha1Fingerprint string `json:"sha1Fingerprint,omitempty"`
321
322	// ForceSendFields is a list of field names (e.g. "PackageName") to
323	// unconditionally include in API requests. By default, fields with
324	// empty values are omitted from API requests. However, any non-pointer,
325	// non-interface field appearing in ForceSendFields will be sent to the
326	// server regardless of whether the field is empty or not. This may be
327	// used to include empty fields in Patch requests.
328	ForceSendFields []string `json:"-"`
329
330	// NullFields is a list of field names (e.g. "PackageName") to include
331	// in API requests with the JSON null value. By default, fields with
332	// empty values are omitted from API requests. However, any field with
333	// an empty value appearing in NullFields will be sent to the server as
334	// null. It is an error if a field in this list has a non-empty value.
335	// This may be used to include null fields in Patch requests.
336	NullFields []string `json:"-"`
337}
338
339func (s *V2AndroidApplication) MarshalJSON() ([]byte, error) {
340	type NoMethod V2AndroidApplication
341	raw := NoMethod(*s)
342	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
343}
344
345// V2AndroidKeyRestrictions: The Android apps that are allowed to use
346// the key.
347type V2AndroidKeyRestrictions struct {
348	// AllowedApplications: A list of Android applications that are allowed
349	// to make API calls with this key.
350	AllowedApplications []*V2AndroidApplication `json:"allowedApplications,omitempty"`
351
352	// ForceSendFields is a list of field names (e.g. "AllowedApplications")
353	// to unconditionally include in API requests. By default, fields with
354	// empty values are omitted from API requests. However, any non-pointer,
355	// non-interface field appearing in ForceSendFields will be sent to the
356	// server regardless of whether the field is empty or not. This may be
357	// used to include empty fields in Patch requests.
358	ForceSendFields []string `json:"-"`
359
360	// NullFields is a list of field names (e.g. "AllowedApplications") to
361	// include in API requests with the JSON null value. By default, fields
362	// with empty values are omitted from API requests. However, any field
363	// with an empty value appearing in NullFields will be sent to the
364	// server as null. It is an error if a field in this list has a
365	// non-empty value. This may be used to include null fields in Patch
366	// requests.
367	NullFields []string `json:"-"`
368}
369
370func (s *V2AndroidKeyRestrictions) MarshalJSON() ([]byte, error) {
371	type NoMethod V2AndroidKeyRestrictions
372	raw := NoMethod(*s)
373	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
374}
375
376// V2ApiTarget: A restriction for a specific service and optionally one
377// or multiple specific methods. Both fields are case insensitive.
378type V2ApiTarget struct {
379	// Methods: Optional. List of one or more methods that can be called. If
380	// empty, all methods for the service are allowed. A wildcard (*) can be
381	// used as the last symbol. Valid examples:
382	// `google.cloud.translate.v2.TranslateService.GetSupportedLanguage`
383	// `TranslateText` `Get*` `translate.googleapis.com.Get*`
384	Methods []string `json:"methods,omitempty"`
385
386	// Service: The service for this restriction. It should be the canonical
387	// service name, for example: `translate.googleapis.com`. You can use
388	// `gcloud services list` (/sdk/gcloud/reference/services/list) to get a
389	// list of services that are enabled in the project.
390	Service string `json:"service,omitempty"`
391
392	// ForceSendFields is a list of field names (e.g. "Methods") to
393	// unconditionally include in API requests. By default, fields with
394	// empty values are omitted from API requests. However, any non-pointer,
395	// non-interface field appearing in ForceSendFields will be sent to the
396	// server regardless of whether the field is empty or not. This may be
397	// used to include empty fields in Patch requests.
398	ForceSendFields []string `json:"-"`
399
400	// NullFields is a list of field names (e.g. "Methods") to include in
401	// API requests with the JSON null value. By default, fields with empty
402	// values are omitted from API requests. However, any field with an
403	// empty value appearing in NullFields will be sent to the server as
404	// null. It is an error if a field in this list has a non-empty value.
405	// This may be used to include null fields in Patch requests.
406	NullFields []string `json:"-"`
407}
408
409func (s *V2ApiTarget) MarshalJSON() ([]byte, error) {
410	type NoMethod V2ApiTarget
411	raw := NoMethod(*s)
412	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
413}
414
415// V2BrowserKeyRestrictions: The HTTP referrers (websites) that are
416// allowed to use the key.
417type V2BrowserKeyRestrictions struct {
418	// AllowedReferrers: A list of regular expressions for the referrer URLs
419	// that are allowed to make API calls with this key.
420	AllowedReferrers []string `json:"allowedReferrers,omitempty"`
421
422	// ForceSendFields is a list of field names (e.g. "AllowedReferrers") to
423	// unconditionally include in API requests. By default, fields with
424	// empty values are omitted from API requests. However, any non-pointer,
425	// non-interface field appearing in ForceSendFields will be sent to the
426	// server regardless of whether the field is empty or not. This may be
427	// used to include empty fields in Patch requests.
428	ForceSendFields []string `json:"-"`
429
430	// NullFields is a list of field names (e.g. "AllowedReferrers") to
431	// include in API requests with the JSON null value. By default, fields
432	// with empty values are omitted from API requests. However, any field
433	// with an empty value appearing in NullFields will be sent to the
434	// server as null. It is an error if a field in this list has a
435	// non-empty value. This may be used to include null fields in Patch
436	// requests.
437	NullFields []string `json:"-"`
438}
439
440func (s *V2BrowserKeyRestrictions) MarshalJSON() ([]byte, error) {
441	type NoMethod V2BrowserKeyRestrictions
442	raw := NoMethod(*s)
443	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
444}
445
446// V2CloneKeyRequest: Request message for `CloneKey` method.
447type V2CloneKeyRequest struct {
448	// KeyId: User specified key id (optional). If specified, it will become
449	// the final component of the key resource name. The id must be unique
450	// within the project, must conform with RFC-1034, is restricted to
451	// lower-cased letters, and has a maximum length of 63 characters. In
452	// another word, the id must match the regular expression:
453	// `[a-z]([a-z0-9-]{0,61}[a-z0-9])?`. The id must NOT be a UUID-like
454	// string.
455	KeyId string `json:"keyId,omitempty"`
456
457	// ForceSendFields is a list of field names (e.g. "KeyId") to
458	// unconditionally include in API requests. By default, fields with
459	// empty values are omitted from API requests. However, any non-pointer,
460	// non-interface field appearing in ForceSendFields will be sent to the
461	// server regardless of whether the field is empty or not. This may be
462	// used to include empty fields in Patch requests.
463	ForceSendFields []string `json:"-"`
464
465	// NullFields is a list of field names (e.g. "KeyId") to include in API
466	// requests with the JSON null value. By default, fields with empty
467	// values are omitted from API requests. However, any field with an
468	// empty value appearing in NullFields will be sent to the server as
469	// null. It is an error if a field in this list has a non-empty value.
470	// This may be used to include null fields in Patch requests.
471	NullFields []string `json:"-"`
472}
473
474func (s *V2CloneKeyRequest) MarshalJSON() ([]byte, error) {
475	type NoMethod V2CloneKeyRequest
476	raw := NoMethod(*s)
477	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
478}
479
480// V2GetKeyStringResponse: Response message for `GetKeyString` method.
481type V2GetKeyStringResponse struct {
482	// KeyString: An encrypted and signed value of the key.
483	KeyString string `json:"keyString,omitempty"`
484
485	// ServerResponse contains the HTTP response code and headers from the
486	// server.
487	googleapi.ServerResponse `json:"-"`
488
489	// ForceSendFields is a list of field names (e.g. "KeyString") to
490	// unconditionally include in API requests. By default, fields with
491	// empty values are omitted from API requests. However, any non-pointer,
492	// non-interface field appearing in ForceSendFields will be sent to the
493	// server regardless of whether the field is empty or not. This may be
494	// used to include empty fields in Patch requests.
495	ForceSendFields []string `json:"-"`
496
497	// NullFields is a list of field names (e.g. "KeyString") to include in
498	// API requests with the JSON null value. By default, fields with empty
499	// values are omitted from API requests. However, any field with an
500	// empty value appearing in NullFields will be sent to the server as
501	// null. It is an error if a field in this list has a non-empty value.
502	// This may be used to include null fields in Patch requests.
503	NullFields []string `json:"-"`
504}
505
506func (s *V2GetKeyStringResponse) MarshalJSON() ([]byte, error) {
507	type NoMethod V2GetKeyStringResponse
508	raw := NoMethod(*s)
509	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
510}
511
512// V2IosKeyRestrictions: The iOS apps that are allowed to use the key.
513type V2IosKeyRestrictions struct {
514	// AllowedBundleIds: A list of bundle IDs that are allowed when making
515	// API calls with this key.
516	AllowedBundleIds []string `json:"allowedBundleIds,omitempty"`
517
518	// ForceSendFields is a list of field names (e.g. "AllowedBundleIds") to
519	// unconditionally include in API requests. By default, fields with
520	// empty values are omitted from API requests. However, any non-pointer,
521	// non-interface field appearing in ForceSendFields will be sent to the
522	// server regardless of whether the field is empty or not. This may be
523	// used to include empty fields in Patch requests.
524	ForceSendFields []string `json:"-"`
525
526	// NullFields is a list of field names (e.g. "AllowedBundleIds") to
527	// include in API requests with the JSON null value. By default, fields
528	// with empty values are omitted from API requests. However, any field
529	// with an empty value appearing in NullFields will be sent to the
530	// server as null. It is an error if a field in this list has a
531	// non-empty value. This may be used to include null fields in Patch
532	// requests.
533	NullFields []string `json:"-"`
534}
535
536func (s *V2IosKeyRestrictions) MarshalJSON() ([]byte, error) {
537	type NoMethod V2IosKeyRestrictions
538	raw := NoMethod(*s)
539	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
540}
541
542// V2Key: The representation of a key managed by the API Keys API.
543type V2Key struct {
544	// CreateTime: Output only. A timestamp identifying the time this key
545	// was originally created.
546	CreateTime string `json:"createTime,omitempty"`
547
548	// DeleteTime: Output only. A timestamp when this key was deleted. If
549	// the resource is not deleted, this must be empty.
550	DeleteTime string `json:"deleteTime,omitempty"`
551
552	// DisplayName: Human-readable display name of this key that you can
553	// modify. The maximum length is 63 characters.
554	DisplayName string `json:"displayName,omitempty"`
555
556	// Etag: Output only. A checksum computed by the server based on the
557	// current value of the Key resource. This may be sent on update and
558	// delete requests to ensure the client has an up-to-date value before
559	// proceeding.
560	Etag string `json:"etag,omitempty"`
561
562	// KeyString: Output only. An encrypted and signed value held by this
563	// key. This field can be accessed only through the `GetKeyString`
564	// method.
565	KeyString string `json:"keyString,omitempty"`
566
567	// Name: Output only. The resource name of the key. The `name` has the
568	// form: `projects//locations/global/keys/`. For example:
569	// `projects/123456867718/locations/global/keys/b7ff1f9f-8275-410a-94dd-3
570	// 855ee9b5dd2` NOTE: Key is a global resource; hence the only supported
571	// value for location is `global`.
572	Name string `json:"name,omitempty"`
573
574	// Restrictions: Key restrictions.
575	Restrictions *V2Restrictions `json:"restrictions,omitempty"`
576
577	// Uid: Output only. Unique id in UUID4 format.
578	Uid string `json:"uid,omitempty"`
579
580	// UpdateTime: Output only. A timestamp identifying the time this key
581	// was last updated.
582	UpdateTime string `json:"updateTime,omitempty"`
583
584	// ServerResponse contains the HTTP response code and headers from the
585	// server.
586	googleapi.ServerResponse `json:"-"`
587
588	// ForceSendFields is a list of field names (e.g. "CreateTime") to
589	// unconditionally include in API requests. By default, fields with
590	// empty values are omitted from API requests. However, any non-pointer,
591	// non-interface field appearing in ForceSendFields will be sent to the
592	// server regardless of whether the field is empty or not. This may be
593	// used to include empty fields in Patch requests.
594	ForceSendFields []string `json:"-"`
595
596	// NullFields is a list of field names (e.g. "CreateTime") to include in
597	// API requests with the JSON null value. By default, fields with empty
598	// values are omitted from API requests. However, any field with an
599	// empty value appearing in NullFields will be sent to the server as
600	// null. It is an error if a field in this list has a non-empty value.
601	// This may be used to include null fields in Patch requests.
602	NullFields []string `json:"-"`
603}
604
605func (s *V2Key) MarshalJSON() ([]byte, error) {
606	type NoMethod V2Key
607	raw := NoMethod(*s)
608	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
609}
610
611// V2ListKeysResponse: Response message for `ListKeys` method.
612type V2ListKeysResponse struct {
613	// Keys: A list of API keys.
614	Keys []*V2Key `json:"keys,omitempty"`
615
616	// NextPageToken: The pagination token for the next page of results.
617	NextPageToken string `json:"nextPageToken,omitempty"`
618
619	// ServerResponse contains the HTTP response code and headers from the
620	// server.
621	googleapi.ServerResponse `json:"-"`
622
623	// ForceSendFields is a list of field names (e.g. "Keys") to
624	// unconditionally include in API requests. By default, fields with
625	// empty values are omitted from API requests. However, any non-pointer,
626	// non-interface field appearing in ForceSendFields will be sent to the
627	// server regardless of whether the field is empty or not. This may be
628	// used to include empty fields in Patch requests.
629	ForceSendFields []string `json:"-"`
630
631	// NullFields is a list of field names (e.g. "Keys") to include in API
632	// requests with the JSON null value. By default, fields with empty
633	// values are omitted from API requests. However, any field with an
634	// empty value appearing in NullFields will be sent to the server as
635	// null. It is an error if a field in this list has a non-empty value.
636	// This may be used to include null fields in Patch requests.
637	NullFields []string `json:"-"`
638}
639
640func (s *V2ListKeysResponse) MarshalJSON() ([]byte, error) {
641	type NoMethod V2ListKeysResponse
642	raw := NoMethod(*s)
643	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
644}
645
646// V2LookupKeyResponse: Response message for `LookupKey` method.
647type V2LookupKeyResponse struct {
648	// Name: The resource name of the API key. If the API key has been
649	// purged, resource name is empty.
650	Name string `json:"name,omitempty"`
651
652	// Parent: The project that owns the key with the value specified in the
653	// request.
654	Parent string `json:"parent,omitempty"`
655
656	// ServerResponse contains the HTTP response code and headers from the
657	// server.
658	googleapi.ServerResponse `json:"-"`
659
660	// ForceSendFields is a list of field names (e.g. "Name") to
661	// unconditionally include in API requests. By default, fields with
662	// empty values are omitted from API requests. However, any non-pointer,
663	// non-interface field appearing in ForceSendFields will be sent to the
664	// server regardless of whether the field is empty or not. This may be
665	// used to include empty fields in Patch requests.
666	ForceSendFields []string `json:"-"`
667
668	// NullFields is a list of field names (e.g. "Name") to include in API
669	// requests with the JSON null value. By default, fields with empty
670	// values are omitted from API requests. However, any field with an
671	// empty value appearing in NullFields will be sent to the server as
672	// null. It is an error if a field in this list has a non-empty value.
673	// This may be used to include null fields in Patch requests.
674	NullFields []string `json:"-"`
675}
676
677func (s *V2LookupKeyResponse) MarshalJSON() ([]byte, error) {
678	type NoMethod V2LookupKeyResponse
679	raw := NoMethod(*s)
680	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
681}
682
683// V2Restrictions: Describes the restrictions on the key.
684type V2Restrictions struct {
685	// AndroidKeyRestrictions: The Android apps that are allowed to use the
686	// key.
687	AndroidKeyRestrictions *V2AndroidKeyRestrictions `json:"androidKeyRestrictions,omitempty"`
688
689	// ApiTargets: A restriction for a specific service and optionally one
690	// or more specific methods. Requests are allowed if they match any of
691	// these restrictions. If no restrictions are specified, all targets are
692	// allowed.
693	ApiTargets []*V2ApiTarget `json:"apiTargets,omitempty"`
694
695	// BrowserKeyRestrictions: The HTTP referrers (websites) that are
696	// allowed to use the key.
697	BrowserKeyRestrictions *V2BrowserKeyRestrictions `json:"browserKeyRestrictions,omitempty"`
698
699	// IosKeyRestrictions: The iOS apps that are allowed to use the key.
700	IosKeyRestrictions *V2IosKeyRestrictions `json:"iosKeyRestrictions,omitempty"`
701
702	// ServerKeyRestrictions: The IP addresses of callers that are allowed
703	// to use the key.
704	ServerKeyRestrictions *V2ServerKeyRestrictions `json:"serverKeyRestrictions,omitempty"`
705
706	// ForceSendFields is a list of field names (e.g.
707	// "AndroidKeyRestrictions") to unconditionally include in API requests.
708	// By default, fields with empty values are omitted from API requests.
709	// However, any non-pointer, non-interface field appearing in
710	// ForceSendFields will be sent to the server regardless of whether the
711	// field is empty or not. This may be used to include empty fields in
712	// Patch requests.
713	ForceSendFields []string `json:"-"`
714
715	// NullFields is a list of field names (e.g. "AndroidKeyRestrictions")
716	// to include in API requests with the JSON null value. By default,
717	// fields with empty values are omitted from API requests. However, any
718	// field with an empty value appearing in NullFields will be sent to the
719	// server as null. It is an error if a field in this list has a
720	// non-empty value. This may be used to include null fields in Patch
721	// requests.
722	NullFields []string `json:"-"`
723}
724
725func (s *V2Restrictions) MarshalJSON() ([]byte, error) {
726	type NoMethod V2Restrictions
727	raw := NoMethod(*s)
728	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
729}
730
731// V2ServerKeyRestrictions: The IP addresses of callers that are allowed
732// to use the key.
733type V2ServerKeyRestrictions struct {
734	// AllowedIps: A list of the caller IP addresses that are allowed to
735	// make API calls with this key.
736	AllowedIps []string `json:"allowedIps,omitempty"`
737
738	// ForceSendFields is a list of field names (e.g. "AllowedIps") to
739	// unconditionally include in API requests. By default, fields with
740	// empty values are omitted from API requests. However, any non-pointer,
741	// non-interface field appearing in ForceSendFields will be sent to the
742	// server regardless of whether the field is empty or not. This may be
743	// used to include empty fields in Patch requests.
744	ForceSendFields []string `json:"-"`
745
746	// NullFields is a list of field names (e.g. "AllowedIps") to include in
747	// API requests with the JSON null value. By default, fields with empty
748	// values are omitted from API requests. However, any field with an
749	// empty value appearing in NullFields will be sent to the server as
750	// null. It is an error if a field in this list has a non-empty value.
751	// This may be used to include null fields in Patch requests.
752	NullFields []string `json:"-"`
753}
754
755func (s *V2ServerKeyRestrictions) MarshalJSON() ([]byte, error) {
756	type NoMethod V2ServerKeyRestrictions
757	raw := NoMethod(*s)
758	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
759}
760
761// V2UndeleteKeyRequest: Request message for `UndeleteKey` method.
762type V2UndeleteKeyRequest struct {
763}
764
765// method id "apikeys.keys.lookupKey":
766
767type KeysLookupKeyCall struct {
768	s            *Service
769	urlParams_   gensupport.URLParams
770	ifNoneMatch_ string
771	ctx_         context.Context
772	header_      http.Header
773}
774
775// LookupKey: Find the parent project and resource name of the API key
776// that matches the key string in the request. If the API key has been
777// purged, resource name will not be set. The service account must have
778// the `apikeys.keys.lookup` permission on the parent project.
779func (r *KeysService) LookupKey() *KeysLookupKeyCall {
780	c := &KeysLookupKeyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
781	return c
782}
783
784// KeyString sets the optional parameter "keyString": Required. Finds
785// the project that owns the key string value.
786func (c *KeysLookupKeyCall) KeyString(keyString string) *KeysLookupKeyCall {
787	c.urlParams_.Set("keyString", keyString)
788	return c
789}
790
791// Fields allows partial responses to be retrieved. See
792// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
793// for more information.
794func (c *KeysLookupKeyCall) Fields(s ...googleapi.Field) *KeysLookupKeyCall {
795	c.urlParams_.Set("fields", googleapi.CombineFields(s))
796	return c
797}
798
799// IfNoneMatch sets the optional parameter which makes the operation
800// fail if the object's ETag matches the given value. This is useful for
801// getting updates only after the object has changed since the last
802// request. Use googleapi.IsNotModified to check whether the response
803// error from Do is the result of In-None-Match.
804func (c *KeysLookupKeyCall) IfNoneMatch(entityTag string) *KeysLookupKeyCall {
805	c.ifNoneMatch_ = entityTag
806	return c
807}
808
809// Context sets the context to be used in this call's Do method. Any
810// pending HTTP request will be aborted if the provided context is
811// canceled.
812func (c *KeysLookupKeyCall) Context(ctx context.Context) *KeysLookupKeyCall {
813	c.ctx_ = ctx
814	return c
815}
816
817// Header returns an http.Header that can be modified by the caller to
818// add HTTP headers to the request.
819func (c *KeysLookupKeyCall) Header() http.Header {
820	if c.header_ == nil {
821		c.header_ = make(http.Header)
822	}
823	return c.header_
824}
825
826func (c *KeysLookupKeyCall) doRequest(alt string) (*http.Response, error) {
827	reqHeaders := make(http.Header)
828	reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210502")
829	for k, v := range c.header_ {
830		reqHeaders[k] = v
831	}
832	reqHeaders.Set("User-Agent", c.s.userAgent())
833	if c.ifNoneMatch_ != "" {
834		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
835	}
836	var body io.Reader = nil
837	c.urlParams_.Set("alt", alt)
838	c.urlParams_.Set("prettyPrint", "false")
839	urls := googleapi.ResolveRelative(c.s.BasePath, "v2/keys:lookupKey")
840	urls += "?" + c.urlParams_.Encode()
841	req, err := http.NewRequest("GET", urls, body)
842	if err != nil {
843		return nil, err
844	}
845	req.Header = reqHeaders
846	return gensupport.SendRequest(c.ctx_, c.s.client, req)
847}
848
849// Do executes the "apikeys.keys.lookupKey" call.
850// Exactly one of *V2LookupKeyResponse or error will be non-nil. Any
851// non-2xx status code is an error. Response headers are in either
852// *V2LookupKeyResponse.ServerResponse.Header or (if a response was
853// returned at all) in error.(*googleapi.Error).Header. Use
854// googleapi.IsNotModified to check whether the returned error was
855// because http.StatusNotModified was returned.
856func (c *KeysLookupKeyCall) Do(opts ...googleapi.CallOption) (*V2LookupKeyResponse, error) {
857	gensupport.SetOptions(c.urlParams_, opts...)
858	res, err := c.doRequest("json")
859	if res != nil && res.StatusCode == http.StatusNotModified {
860		if res.Body != nil {
861			res.Body.Close()
862		}
863		return nil, &googleapi.Error{
864			Code:   res.StatusCode,
865			Header: res.Header,
866		}
867	}
868	if err != nil {
869		return nil, err
870	}
871	defer googleapi.CloseBody(res)
872	if err := googleapi.CheckResponse(res); err != nil {
873		return nil, err
874	}
875	ret := &V2LookupKeyResponse{
876		ServerResponse: googleapi.ServerResponse{
877			Header:         res.Header,
878			HTTPStatusCode: res.StatusCode,
879		},
880	}
881	target := &ret
882	if err := gensupport.DecodeResponse(target, res); err != nil {
883		return nil, err
884	}
885	return ret, nil
886	// {
887	//   "description": "Find the parent project and resource name of the API key that matches the key string in the request. If the API key has been purged, resource name will not be set. The service account must have the `apikeys.keys.lookup` permission on the parent project.",
888	//   "flatPath": "v2/keys:lookupKey",
889	//   "httpMethod": "GET",
890	//   "id": "apikeys.keys.lookupKey",
891	//   "parameterOrder": [],
892	//   "parameters": {
893	//     "keyString": {
894	//       "description": "Required. Finds the project that owns the key string value.",
895	//       "location": "query",
896	//       "type": "string"
897	//     }
898	//   },
899	//   "path": "v2/keys:lookupKey",
900	//   "response": {
901	//     "$ref": "V2LookupKeyResponse"
902	//   },
903	//   "scopes": [
904	//     "https://www.googleapis.com/auth/cloud-platform",
905	//     "https://www.googleapis.com/auth/cloud-platform.read-only"
906	//   ]
907	// }
908
909}
910
911// method id "apikeys.operations.get":
912
913type OperationsGetCall struct {
914	s            *Service
915	name         string
916	urlParams_   gensupport.URLParams
917	ifNoneMatch_ string
918	ctx_         context.Context
919	header_      http.Header
920}
921
922// Get: Gets the latest state of a long-running operation. Clients can
923// use this method to poll the operation result at intervals as
924// recommended by the API service.
925//
926// - name: The name of the operation resource.
927func (r *OperationsService) Get(name string) *OperationsGetCall {
928	c := &OperationsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
929	c.name = name
930	return c
931}
932
933// Fields allows partial responses to be retrieved. See
934// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
935// for more information.
936func (c *OperationsGetCall) Fields(s ...googleapi.Field) *OperationsGetCall {
937	c.urlParams_.Set("fields", googleapi.CombineFields(s))
938	return c
939}
940
941// IfNoneMatch sets the optional parameter which makes the operation
942// fail if the object's ETag matches the given value. This is useful for
943// getting updates only after the object has changed since the last
944// request. Use googleapi.IsNotModified to check whether the response
945// error from Do is the result of In-None-Match.
946func (c *OperationsGetCall) IfNoneMatch(entityTag string) *OperationsGetCall {
947	c.ifNoneMatch_ = entityTag
948	return c
949}
950
951// Context sets the context to be used in this call's Do method. Any
952// pending HTTP request will be aborted if the provided context is
953// canceled.
954func (c *OperationsGetCall) Context(ctx context.Context) *OperationsGetCall {
955	c.ctx_ = ctx
956	return c
957}
958
959// Header returns an http.Header that can be modified by the caller to
960// add HTTP headers to the request.
961func (c *OperationsGetCall) Header() http.Header {
962	if c.header_ == nil {
963		c.header_ = make(http.Header)
964	}
965	return c.header_
966}
967
968func (c *OperationsGetCall) doRequest(alt string) (*http.Response, error) {
969	reqHeaders := make(http.Header)
970	reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210502")
971	for k, v := range c.header_ {
972		reqHeaders[k] = v
973	}
974	reqHeaders.Set("User-Agent", c.s.userAgent())
975	if c.ifNoneMatch_ != "" {
976		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
977	}
978	var body io.Reader = nil
979	c.urlParams_.Set("alt", alt)
980	c.urlParams_.Set("prettyPrint", "false")
981	urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+name}")
982	urls += "?" + c.urlParams_.Encode()
983	req, err := http.NewRequest("GET", urls, body)
984	if err != nil {
985		return nil, err
986	}
987	req.Header = reqHeaders
988	googleapi.Expand(req.URL, map[string]string{
989		"name": c.name,
990	})
991	return gensupport.SendRequest(c.ctx_, c.s.client, req)
992}
993
994// Do executes the "apikeys.operations.get" call.
995// Exactly one of *Operation or error will be non-nil. Any non-2xx
996// status code is an error. Response headers are in either
997// *Operation.ServerResponse.Header or (if a response was returned at
998// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
999// to check whether the returned error was because
1000// http.StatusNotModified was returned.
1001func (c *OperationsGetCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
1002	gensupport.SetOptions(c.urlParams_, opts...)
1003	res, err := c.doRequest("json")
1004	if res != nil && res.StatusCode == http.StatusNotModified {
1005		if res.Body != nil {
1006			res.Body.Close()
1007		}
1008		return nil, &googleapi.Error{
1009			Code:   res.StatusCode,
1010			Header: res.Header,
1011		}
1012	}
1013	if err != nil {
1014		return nil, err
1015	}
1016	defer googleapi.CloseBody(res)
1017	if err := googleapi.CheckResponse(res); err != nil {
1018		return nil, err
1019	}
1020	ret := &Operation{
1021		ServerResponse: googleapi.ServerResponse{
1022			Header:         res.Header,
1023			HTTPStatusCode: res.StatusCode,
1024		},
1025	}
1026	target := &ret
1027	if err := gensupport.DecodeResponse(target, res); err != nil {
1028		return nil, err
1029	}
1030	return ret, nil
1031	// {
1032	//   "description": "Gets the latest state of a long-running operation. Clients can use this method to poll the operation result at intervals as recommended by the API service.",
1033	//   "flatPath": "v2/operations/{operationsId}",
1034	//   "httpMethod": "GET",
1035	//   "id": "apikeys.operations.get",
1036	//   "parameterOrder": [
1037	//     "name"
1038	//   ],
1039	//   "parameters": {
1040	//     "name": {
1041	//       "description": "The name of the operation resource.",
1042	//       "location": "path",
1043	//       "pattern": "^operations/[^/]+$",
1044	//       "required": true,
1045	//       "type": "string"
1046	//     }
1047	//   },
1048	//   "path": "v2/{+name}",
1049	//   "response": {
1050	//     "$ref": "Operation"
1051	//   },
1052	//   "scopes": [
1053	//     "https://www.googleapis.com/auth/cloud-platform",
1054	//     "https://www.googleapis.com/auth/cloud-platform.read-only"
1055	//   ]
1056	// }
1057
1058}
1059
1060// method id "apikeys.projects.locations.keys.clone":
1061
1062type ProjectsLocationsKeysCloneCall struct {
1063	s                 *Service
1064	name              string
1065	v2clonekeyrequest *V2CloneKeyRequest
1066	urlParams_        gensupport.URLParams
1067	ctx_              context.Context
1068	header_           http.Header
1069}
1070
1071// Clone: Clones the existing key's restriction and display name to a
1072// new API key. The service account must have the `apikeys.keys.get` and
1073// `apikeys.keys.create` permissions in the project. NOTE: Key is a
1074// global resource; hence the only supported value for location is
1075// `global`.
1076//
1077// - name: The resource name of the API key to be cloned in the same
1078//   project.
1079func (r *ProjectsLocationsKeysService) Clone(name string, v2clonekeyrequest *V2CloneKeyRequest) *ProjectsLocationsKeysCloneCall {
1080	c := &ProjectsLocationsKeysCloneCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1081	c.name = name
1082	c.v2clonekeyrequest = v2clonekeyrequest
1083	return c
1084}
1085
1086// Fields allows partial responses to be retrieved. See
1087// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
1088// for more information.
1089func (c *ProjectsLocationsKeysCloneCall) Fields(s ...googleapi.Field) *ProjectsLocationsKeysCloneCall {
1090	c.urlParams_.Set("fields", googleapi.CombineFields(s))
1091	return c
1092}
1093
1094// Context sets the context to be used in this call's Do method. Any
1095// pending HTTP request will be aborted if the provided context is
1096// canceled.
1097func (c *ProjectsLocationsKeysCloneCall) Context(ctx context.Context) *ProjectsLocationsKeysCloneCall {
1098	c.ctx_ = ctx
1099	return c
1100}
1101
1102// Header returns an http.Header that can be modified by the caller to
1103// add HTTP headers to the request.
1104func (c *ProjectsLocationsKeysCloneCall) Header() http.Header {
1105	if c.header_ == nil {
1106		c.header_ = make(http.Header)
1107	}
1108	return c.header_
1109}
1110
1111func (c *ProjectsLocationsKeysCloneCall) doRequest(alt string) (*http.Response, error) {
1112	reqHeaders := make(http.Header)
1113	reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210502")
1114	for k, v := range c.header_ {
1115		reqHeaders[k] = v
1116	}
1117	reqHeaders.Set("User-Agent", c.s.userAgent())
1118	var body io.Reader = nil
1119	body, err := googleapi.WithoutDataWrapper.JSONReader(c.v2clonekeyrequest)
1120	if err != nil {
1121		return nil, err
1122	}
1123	reqHeaders.Set("Content-Type", "application/json")
1124	c.urlParams_.Set("alt", alt)
1125	c.urlParams_.Set("prettyPrint", "false")
1126	urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+name}:clone")
1127	urls += "?" + c.urlParams_.Encode()
1128	req, err := http.NewRequest("POST", urls, body)
1129	if err != nil {
1130		return nil, err
1131	}
1132	req.Header = reqHeaders
1133	googleapi.Expand(req.URL, map[string]string{
1134		"name": c.name,
1135	})
1136	return gensupport.SendRequest(c.ctx_, c.s.client, req)
1137}
1138
1139// Do executes the "apikeys.projects.locations.keys.clone" call.
1140// Exactly one of *Operation or error will be non-nil. Any non-2xx
1141// status code is an error. Response headers are in either
1142// *Operation.ServerResponse.Header or (if a response was returned at
1143// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
1144// to check whether the returned error was because
1145// http.StatusNotModified was returned.
1146func (c *ProjectsLocationsKeysCloneCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
1147	gensupport.SetOptions(c.urlParams_, opts...)
1148	res, err := c.doRequest("json")
1149	if res != nil && res.StatusCode == http.StatusNotModified {
1150		if res.Body != nil {
1151			res.Body.Close()
1152		}
1153		return nil, &googleapi.Error{
1154			Code:   res.StatusCode,
1155			Header: res.Header,
1156		}
1157	}
1158	if err != nil {
1159		return nil, err
1160	}
1161	defer googleapi.CloseBody(res)
1162	if err := googleapi.CheckResponse(res); err != nil {
1163		return nil, err
1164	}
1165	ret := &Operation{
1166		ServerResponse: googleapi.ServerResponse{
1167			Header:         res.Header,
1168			HTTPStatusCode: res.StatusCode,
1169		},
1170	}
1171	target := &ret
1172	if err := gensupport.DecodeResponse(target, res); err != nil {
1173		return nil, err
1174	}
1175	return ret, nil
1176	// {
1177	//   "description": "Clones the existing key's restriction and display name to a new API key. The service account must have the `apikeys.keys.get` and `apikeys.keys.create` permissions in the project. NOTE: Key is a global resource; hence the only supported value for location is `global`.",
1178	//   "flatPath": "v2/projects/{projectsId}/locations/{locationsId}/keys/{keysId}:clone",
1179	//   "httpMethod": "POST",
1180	//   "id": "apikeys.projects.locations.keys.clone",
1181	//   "parameterOrder": [
1182	//     "name"
1183	//   ],
1184	//   "parameters": {
1185	//     "name": {
1186	//       "description": "Required. The resource name of the API key to be cloned in the same project.",
1187	//       "location": "path",
1188	//       "pattern": "^projects/[^/]+/locations/[^/]+/keys/[^/]+$",
1189	//       "required": true,
1190	//       "type": "string"
1191	//     }
1192	//   },
1193	//   "path": "v2/{+name}:clone",
1194	//   "request": {
1195	//     "$ref": "V2CloneKeyRequest"
1196	//   },
1197	//   "response": {
1198	//     "$ref": "Operation"
1199	//   },
1200	//   "scopes": [
1201	//     "https://www.googleapis.com/auth/cloud-platform"
1202	//   ]
1203	// }
1204
1205}
1206
1207// method id "apikeys.projects.locations.keys.create":
1208
1209type ProjectsLocationsKeysCreateCall struct {
1210	s          *Service
1211	parent     string
1212	v2key      *V2Key
1213	urlParams_ gensupport.URLParams
1214	ctx_       context.Context
1215	header_    http.Header
1216}
1217
1218// Create: Creates a new API key. NOTE: Key is a global resource; hence
1219// the only supported value for location is `global`.
1220//
1221// - parent: The project in which the API key is created.
1222func (r *ProjectsLocationsKeysService) Create(parent string, v2key *V2Key) *ProjectsLocationsKeysCreateCall {
1223	c := &ProjectsLocationsKeysCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1224	c.parent = parent
1225	c.v2key = v2key
1226	return c
1227}
1228
1229// KeyId sets the optional parameter "keyId": User specified key id
1230// (optional). If specified, it will become the final component of the
1231// key resource name. The id must be unique within the project, must
1232// conform with RFC-1034, is restricted to lower-cased letters, and has
1233// a maximum length of 63 characters. In another word, the id must match
1234// the regular expression: `[a-z]([a-z0-9-]{0,61}[a-z0-9])?`. The id
1235// must NOT be a UUID-like string.
1236func (c *ProjectsLocationsKeysCreateCall) KeyId(keyId string) *ProjectsLocationsKeysCreateCall {
1237	c.urlParams_.Set("keyId", keyId)
1238	return c
1239}
1240
1241// Fields allows partial responses to be retrieved. See
1242// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
1243// for more information.
1244func (c *ProjectsLocationsKeysCreateCall) Fields(s ...googleapi.Field) *ProjectsLocationsKeysCreateCall {
1245	c.urlParams_.Set("fields", googleapi.CombineFields(s))
1246	return c
1247}
1248
1249// Context sets the context to be used in this call's Do method. Any
1250// pending HTTP request will be aborted if the provided context is
1251// canceled.
1252func (c *ProjectsLocationsKeysCreateCall) Context(ctx context.Context) *ProjectsLocationsKeysCreateCall {
1253	c.ctx_ = ctx
1254	return c
1255}
1256
1257// Header returns an http.Header that can be modified by the caller to
1258// add HTTP headers to the request.
1259func (c *ProjectsLocationsKeysCreateCall) Header() http.Header {
1260	if c.header_ == nil {
1261		c.header_ = make(http.Header)
1262	}
1263	return c.header_
1264}
1265
1266func (c *ProjectsLocationsKeysCreateCall) doRequest(alt string) (*http.Response, error) {
1267	reqHeaders := make(http.Header)
1268	reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210502")
1269	for k, v := range c.header_ {
1270		reqHeaders[k] = v
1271	}
1272	reqHeaders.Set("User-Agent", c.s.userAgent())
1273	var body io.Reader = nil
1274	body, err := googleapi.WithoutDataWrapper.JSONReader(c.v2key)
1275	if err != nil {
1276		return nil, err
1277	}
1278	reqHeaders.Set("Content-Type", "application/json")
1279	c.urlParams_.Set("alt", alt)
1280	c.urlParams_.Set("prettyPrint", "false")
1281	urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+parent}/keys")
1282	urls += "?" + c.urlParams_.Encode()
1283	req, err := http.NewRequest("POST", urls, body)
1284	if err != nil {
1285		return nil, err
1286	}
1287	req.Header = reqHeaders
1288	googleapi.Expand(req.URL, map[string]string{
1289		"parent": c.parent,
1290	})
1291	return gensupport.SendRequest(c.ctx_, c.s.client, req)
1292}
1293
1294// Do executes the "apikeys.projects.locations.keys.create" call.
1295// Exactly one of *Operation or error will be non-nil. Any non-2xx
1296// status code is an error. Response headers are in either
1297// *Operation.ServerResponse.Header or (if a response was returned at
1298// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
1299// to check whether the returned error was because
1300// http.StatusNotModified was returned.
1301func (c *ProjectsLocationsKeysCreateCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
1302	gensupport.SetOptions(c.urlParams_, opts...)
1303	res, err := c.doRequest("json")
1304	if res != nil && res.StatusCode == http.StatusNotModified {
1305		if res.Body != nil {
1306			res.Body.Close()
1307		}
1308		return nil, &googleapi.Error{
1309			Code:   res.StatusCode,
1310			Header: res.Header,
1311		}
1312	}
1313	if err != nil {
1314		return nil, err
1315	}
1316	defer googleapi.CloseBody(res)
1317	if err := googleapi.CheckResponse(res); err != nil {
1318		return nil, err
1319	}
1320	ret := &Operation{
1321		ServerResponse: googleapi.ServerResponse{
1322			Header:         res.Header,
1323			HTTPStatusCode: res.StatusCode,
1324		},
1325	}
1326	target := &ret
1327	if err := gensupport.DecodeResponse(target, res); err != nil {
1328		return nil, err
1329	}
1330	return ret, nil
1331	// {
1332	//   "description": "Creates a new API key. NOTE: Key is a global resource; hence the only supported value for location is `global`.",
1333	//   "flatPath": "v2/projects/{projectsId}/locations/{locationsId}/keys",
1334	//   "httpMethod": "POST",
1335	//   "id": "apikeys.projects.locations.keys.create",
1336	//   "parameterOrder": [
1337	//     "parent"
1338	//   ],
1339	//   "parameters": {
1340	//     "keyId": {
1341	//       "description": "User specified key id (optional). If specified, it will become the final component of the key resource name. The id must be unique within the project, must conform with RFC-1034, is restricted to lower-cased letters, and has a maximum length of 63 characters. In another word, the id must match the regular expression: `[a-z]([a-z0-9-]{0,61}[a-z0-9])?`. The id must NOT be a UUID-like string.",
1342	//       "location": "query",
1343	//       "type": "string"
1344	//     },
1345	//     "parent": {
1346	//       "description": "Required. The project in which the API key is created.",
1347	//       "location": "path",
1348	//       "pattern": "^projects/[^/]+/locations/[^/]+$",
1349	//       "required": true,
1350	//       "type": "string"
1351	//     }
1352	//   },
1353	//   "path": "v2/{+parent}/keys",
1354	//   "request": {
1355	//     "$ref": "V2Key"
1356	//   },
1357	//   "response": {
1358	//     "$ref": "Operation"
1359	//   },
1360	//   "scopes": [
1361	//     "https://www.googleapis.com/auth/cloud-platform"
1362	//   ]
1363	// }
1364
1365}
1366
1367// method id "apikeys.projects.locations.keys.delete":
1368
1369type ProjectsLocationsKeysDeleteCall struct {
1370	s          *Service
1371	name       string
1372	urlParams_ gensupport.URLParams
1373	ctx_       context.Context
1374	header_    http.Header
1375}
1376
1377// Delete: Deletes an API key. Deleted key can be retrieved within 30
1378// days of deletion. Afterward, key will be purged from the project.
1379// NOTE: Key is a global resource; hence the only supported value for
1380// location is `global`.
1381//
1382// - name: The resource name of the API key to be deleted.
1383func (r *ProjectsLocationsKeysService) Delete(name string) *ProjectsLocationsKeysDeleteCall {
1384	c := &ProjectsLocationsKeysDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1385	c.name = name
1386	return c
1387}
1388
1389// Etag sets the optional parameter "etag": The etag known to the client
1390// for the expected state of the key. This is to be used for optimistic
1391// concurrency.
1392func (c *ProjectsLocationsKeysDeleteCall) Etag(etag string) *ProjectsLocationsKeysDeleteCall {
1393	c.urlParams_.Set("etag", etag)
1394	return c
1395}
1396
1397// Fields allows partial responses to be retrieved. See
1398// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
1399// for more information.
1400func (c *ProjectsLocationsKeysDeleteCall) Fields(s ...googleapi.Field) *ProjectsLocationsKeysDeleteCall {
1401	c.urlParams_.Set("fields", googleapi.CombineFields(s))
1402	return c
1403}
1404
1405// Context sets the context to be used in this call's Do method. Any
1406// pending HTTP request will be aborted if the provided context is
1407// canceled.
1408func (c *ProjectsLocationsKeysDeleteCall) Context(ctx context.Context) *ProjectsLocationsKeysDeleteCall {
1409	c.ctx_ = ctx
1410	return c
1411}
1412
1413// Header returns an http.Header that can be modified by the caller to
1414// add HTTP headers to the request.
1415func (c *ProjectsLocationsKeysDeleteCall) Header() http.Header {
1416	if c.header_ == nil {
1417		c.header_ = make(http.Header)
1418	}
1419	return c.header_
1420}
1421
1422func (c *ProjectsLocationsKeysDeleteCall) doRequest(alt string) (*http.Response, error) {
1423	reqHeaders := make(http.Header)
1424	reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210502")
1425	for k, v := range c.header_ {
1426		reqHeaders[k] = v
1427	}
1428	reqHeaders.Set("User-Agent", c.s.userAgent())
1429	var body io.Reader = nil
1430	c.urlParams_.Set("alt", alt)
1431	c.urlParams_.Set("prettyPrint", "false")
1432	urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+name}")
1433	urls += "?" + c.urlParams_.Encode()
1434	req, err := http.NewRequest("DELETE", urls, body)
1435	if err != nil {
1436		return nil, err
1437	}
1438	req.Header = reqHeaders
1439	googleapi.Expand(req.URL, map[string]string{
1440		"name": c.name,
1441	})
1442	return gensupport.SendRequest(c.ctx_, c.s.client, req)
1443}
1444
1445// Do executes the "apikeys.projects.locations.keys.delete" call.
1446// Exactly one of *Operation or error will be non-nil. Any non-2xx
1447// status code is an error. Response headers are in either
1448// *Operation.ServerResponse.Header or (if a response was returned at
1449// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
1450// to check whether the returned error was because
1451// http.StatusNotModified was returned.
1452func (c *ProjectsLocationsKeysDeleteCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
1453	gensupport.SetOptions(c.urlParams_, opts...)
1454	res, err := c.doRequest("json")
1455	if res != nil && res.StatusCode == http.StatusNotModified {
1456		if res.Body != nil {
1457			res.Body.Close()
1458		}
1459		return nil, &googleapi.Error{
1460			Code:   res.StatusCode,
1461			Header: res.Header,
1462		}
1463	}
1464	if err != nil {
1465		return nil, err
1466	}
1467	defer googleapi.CloseBody(res)
1468	if err := googleapi.CheckResponse(res); err != nil {
1469		return nil, err
1470	}
1471	ret := &Operation{
1472		ServerResponse: googleapi.ServerResponse{
1473			Header:         res.Header,
1474			HTTPStatusCode: res.StatusCode,
1475		},
1476	}
1477	target := &ret
1478	if err := gensupport.DecodeResponse(target, res); err != nil {
1479		return nil, err
1480	}
1481	return ret, nil
1482	// {
1483	//   "description": "Deletes an API key. Deleted key can be retrieved within 30 days of deletion. Afterward, key will be purged from the project. NOTE: Key is a global resource; hence the only supported value for location is `global`.",
1484	//   "flatPath": "v2/projects/{projectsId}/locations/{locationsId}/keys/{keysId}",
1485	//   "httpMethod": "DELETE",
1486	//   "id": "apikeys.projects.locations.keys.delete",
1487	//   "parameterOrder": [
1488	//     "name"
1489	//   ],
1490	//   "parameters": {
1491	//     "etag": {
1492	//       "description": "Optional. The etag known to the client for the expected state of the key. This is to be used for optimistic concurrency.",
1493	//       "location": "query",
1494	//       "type": "string"
1495	//     },
1496	//     "name": {
1497	//       "description": "Required. The resource name of the API key to be deleted.",
1498	//       "location": "path",
1499	//       "pattern": "^projects/[^/]+/locations/[^/]+/keys/[^/]+$",
1500	//       "required": true,
1501	//       "type": "string"
1502	//     }
1503	//   },
1504	//   "path": "v2/{+name}",
1505	//   "response": {
1506	//     "$ref": "Operation"
1507	//   },
1508	//   "scopes": [
1509	//     "https://www.googleapis.com/auth/cloud-platform"
1510	//   ]
1511	// }
1512
1513}
1514
1515// method id "apikeys.projects.locations.keys.get":
1516
1517type ProjectsLocationsKeysGetCall struct {
1518	s            *Service
1519	name         string
1520	urlParams_   gensupport.URLParams
1521	ifNoneMatch_ string
1522	ctx_         context.Context
1523	header_      http.Header
1524}
1525
1526// Get: Gets the metadata for an API key. The key string of the API key
1527// isn't included in the response. NOTE: Key is a global resource; hence
1528// the only supported value for location is `global`.
1529//
1530// - name: The resource name of the API key to get.
1531func (r *ProjectsLocationsKeysService) Get(name string) *ProjectsLocationsKeysGetCall {
1532	c := &ProjectsLocationsKeysGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1533	c.name = name
1534	return c
1535}
1536
1537// Fields allows partial responses to be retrieved. See
1538// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
1539// for more information.
1540func (c *ProjectsLocationsKeysGetCall) Fields(s ...googleapi.Field) *ProjectsLocationsKeysGetCall {
1541	c.urlParams_.Set("fields", googleapi.CombineFields(s))
1542	return c
1543}
1544
1545// IfNoneMatch sets the optional parameter which makes the operation
1546// fail if the object's ETag matches the given value. This is useful for
1547// getting updates only after the object has changed since the last
1548// request. Use googleapi.IsNotModified to check whether the response
1549// error from Do is the result of In-None-Match.
1550func (c *ProjectsLocationsKeysGetCall) IfNoneMatch(entityTag string) *ProjectsLocationsKeysGetCall {
1551	c.ifNoneMatch_ = entityTag
1552	return c
1553}
1554
1555// Context sets the context to be used in this call's Do method. Any
1556// pending HTTP request will be aborted if the provided context is
1557// canceled.
1558func (c *ProjectsLocationsKeysGetCall) Context(ctx context.Context) *ProjectsLocationsKeysGetCall {
1559	c.ctx_ = ctx
1560	return c
1561}
1562
1563// Header returns an http.Header that can be modified by the caller to
1564// add HTTP headers to the request.
1565func (c *ProjectsLocationsKeysGetCall) Header() http.Header {
1566	if c.header_ == nil {
1567		c.header_ = make(http.Header)
1568	}
1569	return c.header_
1570}
1571
1572func (c *ProjectsLocationsKeysGetCall) doRequest(alt string) (*http.Response, error) {
1573	reqHeaders := make(http.Header)
1574	reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210502")
1575	for k, v := range c.header_ {
1576		reqHeaders[k] = v
1577	}
1578	reqHeaders.Set("User-Agent", c.s.userAgent())
1579	if c.ifNoneMatch_ != "" {
1580		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
1581	}
1582	var body io.Reader = nil
1583	c.urlParams_.Set("alt", alt)
1584	c.urlParams_.Set("prettyPrint", "false")
1585	urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+name}")
1586	urls += "?" + c.urlParams_.Encode()
1587	req, err := http.NewRequest("GET", urls, body)
1588	if err != nil {
1589		return nil, err
1590	}
1591	req.Header = reqHeaders
1592	googleapi.Expand(req.URL, map[string]string{
1593		"name": c.name,
1594	})
1595	return gensupport.SendRequest(c.ctx_, c.s.client, req)
1596}
1597
1598// Do executes the "apikeys.projects.locations.keys.get" call.
1599// Exactly one of *V2Key or error will be non-nil. Any non-2xx status
1600// code is an error. Response headers are in either
1601// *V2Key.ServerResponse.Header or (if a response was returned at all)
1602// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
1603// check whether the returned error was because http.StatusNotModified
1604// was returned.
1605func (c *ProjectsLocationsKeysGetCall) Do(opts ...googleapi.CallOption) (*V2Key, error) {
1606	gensupport.SetOptions(c.urlParams_, opts...)
1607	res, err := c.doRequest("json")
1608	if res != nil && res.StatusCode == http.StatusNotModified {
1609		if res.Body != nil {
1610			res.Body.Close()
1611		}
1612		return nil, &googleapi.Error{
1613			Code:   res.StatusCode,
1614			Header: res.Header,
1615		}
1616	}
1617	if err != nil {
1618		return nil, err
1619	}
1620	defer googleapi.CloseBody(res)
1621	if err := googleapi.CheckResponse(res); err != nil {
1622		return nil, err
1623	}
1624	ret := &V2Key{
1625		ServerResponse: googleapi.ServerResponse{
1626			Header:         res.Header,
1627			HTTPStatusCode: res.StatusCode,
1628		},
1629	}
1630	target := &ret
1631	if err := gensupport.DecodeResponse(target, res); err != nil {
1632		return nil, err
1633	}
1634	return ret, nil
1635	// {
1636	//   "description": "Gets the metadata for an API key. The key string of the API key isn't included in the response. NOTE: Key is a global resource; hence the only supported value for location is `global`.",
1637	//   "flatPath": "v2/projects/{projectsId}/locations/{locationsId}/keys/{keysId}",
1638	//   "httpMethod": "GET",
1639	//   "id": "apikeys.projects.locations.keys.get",
1640	//   "parameterOrder": [
1641	//     "name"
1642	//   ],
1643	//   "parameters": {
1644	//     "name": {
1645	//       "description": "Required. The resource name of the API key to get.",
1646	//       "location": "path",
1647	//       "pattern": "^projects/[^/]+/locations/[^/]+/keys/[^/]+$",
1648	//       "required": true,
1649	//       "type": "string"
1650	//     }
1651	//   },
1652	//   "path": "v2/{+name}",
1653	//   "response": {
1654	//     "$ref": "V2Key"
1655	//   },
1656	//   "scopes": [
1657	//     "https://www.googleapis.com/auth/cloud-platform",
1658	//     "https://www.googleapis.com/auth/cloud-platform.read-only"
1659	//   ]
1660	// }
1661
1662}
1663
1664// method id "apikeys.projects.locations.keys.getKeyString":
1665
1666type ProjectsLocationsKeysGetKeyStringCall struct {
1667	s            *Service
1668	name         string
1669	urlParams_   gensupport.URLParams
1670	ifNoneMatch_ string
1671	ctx_         context.Context
1672	header_      http.Header
1673}
1674
1675// GetKeyString: Get the key string for an API key. NOTE: Key is a
1676// global resource; hence the only supported value for location is
1677// `global`.
1678//
1679// - name: The resource name of the API key to be retrieved.
1680func (r *ProjectsLocationsKeysService) GetKeyString(name string) *ProjectsLocationsKeysGetKeyStringCall {
1681	c := &ProjectsLocationsKeysGetKeyStringCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1682	c.name = name
1683	return c
1684}
1685
1686// Fields allows partial responses to be retrieved. See
1687// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
1688// for more information.
1689func (c *ProjectsLocationsKeysGetKeyStringCall) Fields(s ...googleapi.Field) *ProjectsLocationsKeysGetKeyStringCall {
1690	c.urlParams_.Set("fields", googleapi.CombineFields(s))
1691	return c
1692}
1693
1694// IfNoneMatch sets the optional parameter which makes the operation
1695// fail if the object's ETag matches the given value. This is useful for
1696// getting updates only after the object has changed since the last
1697// request. Use googleapi.IsNotModified to check whether the response
1698// error from Do is the result of In-None-Match.
1699func (c *ProjectsLocationsKeysGetKeyStringCall) IfNoneMatch(entityTag string) *ProjectsLocationsKeysGetKeyStringCall {
1700	c.ifNoneMatch_ = entityTag
1701	return c
1702}
1703
1704// Context sets the context to be used in this call's Do method. Any
1705// pending HTTP request will be aborted if the provided context is
1706// canceled.
1707func (c *ProjectsLocationsKeysGetKeyStringCall) Context(ctx context.Context) *ProjectsLocationsKeysGetKeyStringCall {
1708	c.ctx_ = ctx
1709	return c
1710}
1711
1712// Header returns an http.Header that can be modified by the caller to
1713// add HTTP headers to the request.
1714func (c *ProjectsLocationsKeysGetKeyStringCall) Header() http.Header {
1715	if c.header_ == nil {
1716		c.header_ = make(http.Header)
1717	}
1718	return c.header_
1719}
1720
1721func (c *ProjectsLocationsKeysGetKeyStringCall) doRequest(alt string) (*http.Response, error) {
1722	reqHeaders := make(http.Header)
1723	reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210502")
1724	for k, v := range c.header_ {
1725		reqHeaders[k] = v
1726	}
1727	reqHeaders.Set("User-Agent", c.s.userAgent())
1728	if c.ifNoneMatch_ != "" {
1729		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
1730	}
1731	var body io.Reader = nil
1732	c.urlParams_.Set("alt", alt)
1733	c.urlParams_.Set("prettyPrint", "false")
1734	urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+name}/keyString")
1735	urls += "?" + c.urlParams_.Encode()
1736	req, err := http.NewRequest("GET", urls, body)
1737	if err != nil {
1738		return nil, err
1739	}
1740	req.Header = reqHeaders
1741	googleapi.Expand(req.URL, map[string]string{
1742		"name": c.name,
1743	})
1744	return gensupport.SendRequest(c.ctx_, c.s.client, req)
1745}
1746
1747// Do executes the "apikeys.projects.locations.keys.getKeyString" call.
1748// Exactly one of *V2GetKeyStringResponse or error will be non-nil. Any
1749// non-2xx status code is an error. Response headers are in either
1750// *V2GetKeyStringResponse.ServerResponse.Header or (if a response was
1751// returned at all) in error.(*googleapi.Error).Header. Use
1752// googleapi.IsNotModified to check whether the returned error was
1753// because http.StatusNotModified was returned.
1754func (c *ProjectsLocationsKeysGetKeyStringCall) Do(opts ...googleapi.CallOption) (*V2GetKeyStringResponse, error) {
1755	gensupport.SetOptions(c.urlParams_, opts...)
1756	res, err := c.doRequest("json")
1757	if res != nil && res.StatusCode == http.StatusNotModified {
1758		if res.Body != nil {
1759			res.Body.Close()
1760		}
1761		return nil, &googleapi.Error{
1762			Code:   res.StatusCode,
1763			Header: res.Header,
1764		}
1765	}
1766	if err != nil {
1767		return nil, err
1768	}
1769	defer googleapi.CloseBody(res)
1770	if err := googleapi.CheckResponse(res); err != nil {
1771		return nil, err
1772	}
1773	ret := &V2GetKeyStringResponse{
1774		ServerResponse: googleapi.ServerResponse{
1775			Header:         res.Header,
1776			HTTPStatusCode: res.StatusCode,
1777		},
1778	}
1779	target := &ret
1780	if err := gensupport.DecodeResponse(target, res); err != nil {
1781		return nil, err
1782	}
1783	return ret, nil
1784	// {
1785	//   "description": "Get the key string for an API key. NOTE: Key is a global resource; hence the only supported value for location is `global`.",
1786	//   "flatPath": "v2/projects/{projectsId}/locations/{locationsId}/keys/{keysId}/keyString",
1787	//   "httpMethod": "GET",
1788	//   "id": "apikeys.projects.locations.keys.getKeyString",
1789	//   "parameterOrder": [
1790	//     "name"
1791	//   ],
1792	//   "parameters": {
1793	//     "name": {
1794	//       "description": "Required. The resource name of the API key to be retrieved.",
1795	//       "location": "path",
1796	//       "pattern": "^projects/[^/]+/locations/[^/]+/keys/[^/]+$",
1797	//       "required": true,
1798	//       "type": "string"
1799	//     }
1800	//   },
1801	//   "path": "v2/{+name}/keyString",
1802	//   "response": {
1803	//     "$ref": "V2GetKeyStringResponse"
1804	//   },
1805	//   "scopes": [
1806	//     "https://www.googleapis.com/auth/cloud-platform",
1807	//     "https://www.googleapis.com/auth/cloud-platform.read-only"
1808	//   ]
1809	// }
1810
1811}
1812
1813// method id "apikeys.projects.locations.keys.list":
1814
1815type ProjectsLocationsKeysListCall struct {
1816	s            *Service
1817	parent       string
1818	urlParams_   gensupport.URLParams
1819	ifNoneMatch_ string
1820	ctx_         context.Context
1821	header_      http.Header
1822}
1823
1824// List: Lists the API keys owned by a project. The key string of the
1825// API key isn't included in the response. NOTE: Key is a global
1826// resource; hence the only supported value for location is `global`.
1827//
1828// - parent: Lists all API keys associated with this project.
1829func (r *ProjectsLocationsKeysService) List(parent string) *ProjectsLocationsKeysListCall {
1830	c := &ProjectsLocationsKeysListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1831	c.parent = parent
1832	return c
1833}
1834
1835// Filter sets the optional parameter "filter": Only list keys that
1836// conform to the specified filter. The allowed filter strings are
1837// `state:ACTIVE` and `state:DELETED`. By default, ListKeys returns only
1838// active keys.
1839func (c *ProjectsLocationsKeysListCall) Filter(filter string) *ProjectsLocationsKeysListCall {
1840	c.urlParams_.Set("filter", filter)
1841	return c
1842}
1843
1844// PageSize sets the optional parameter "pageSize": Specifies the
1845// maximum number of results to be returned at a time.
1846func (c *ProjectsLocationsKeysListCall) PageSize(pageSize int64) *ProjectsLocationsKeysListCall {
1847	c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
1848	return c
1849}
1850
1851// PageToken sets the optional parameter "pageToken": Requests a
1852// specific page of results.
1853func (c *ProjectsLocationsKeysListCall) PageToken(pageToken string) *ProjectsLocationsKeysListCall {
1854	c.urlParams_.Set("pageToken", pageToken)
1855	return c
1856}
1857
1858// Fields allows partial responses to be retrieved. See
1859// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
1860// for more information.
1861func (c *ProjectsLocationsKeysListCall) Fields(s ...googleapi.Field) *ProjectsLocationsKeysListCall {
1862	c.urlParams_.Set("fields", googleapi.CombineFields(s))
1863	return c
1864}
1865
1866// IfNoneMatch sets the optional parameter which makes the operation
1867// fail if the object's ETag matches the given value. This is useful for
1868// getting updates only after the object has changed since the last
1869// request. Use googleapi.IsNotModified to check whether the response
1870// error from Do is the result of In-None-Match.
1871func (c *ProjectsLocationsKeysListCall) IfNoneMatch(entityTag string) *ProjectsLocationsKeysListCall {
1872	c.ifNoneMatch_ = entityTag
1873	return c
1874}
1875
1876// Context sets the context to be used in this call's Do method. Any
1877// pending HTTP request will be aborted if the provided context is
1878// canceled.
1879func (c *ProjectsLocationsKeysListCall) Context(ctx context.Context) *ProjectsLocationsKeysListCall {
1880	c.ctx_ = ctx
1881	return c
1882}
1883
1884// Header returns an http.Header that can be modified by the caller to
1885// add HTTP headers to the request.
1886func (c *ProjectsLocationsKeysListCall) Header() http.Header {
1887	if c.header_ == nil {
1888		c.header_ = make(http.Header)
1889	}
1890	return c.header_
1891}
1892
1893func (c *ProjectsLocationsKeysListCall) doRequest(alt string) (*http.Response, error) {
1894	reqHeaders := make(http.Header)
1895	reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210502")
1896	for k, v := range c.header_ {
1897		reqHeaders[k] = v
1898	}
1899	reqHeaders.Set("User-Agent", c.s.userAgent())
1900	if c.ifNoneMatch_ != "" {
1901		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
1902	}
1903	var body io.Reader = nil
1904	c.urlParams_.Set("alt", alt)
1905	c.urlParams_.Set("prettyPrint", "false")
1906	urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+parent}/keys")
1907	urls += "?" + c.urlParams_.Encode()
1908	req, err := http.NewRequest("GET", urls, body)
1909	if err != nil {
1910		return nil, err
1911	}
1912	req.Header = reqHeaders
1913	googleapi.Expand(req.URL, map[string]string{
1914		"parent": c.parent,
1915	})
1916	return gensupport.SendRequest(c.ctx_, c.s.client, req)
1917}
1918
1919// Do executes the "apikeys.projects.locations.keys.list" call.
1920// Exactly one of *V2ListKeysResponse or error will be non-nil. Any
1921// non-2xx status code is an error. Response headers are in either
1922// *V2ListKeysResponse.ServerResponse.Header or (if a response was
1923// returned at all) in error.(*googleapi.Error).Header. Use
1924// googleapi.IsNotModified to check whether the returned error was
1925// because http.StatusNotModified was returned.
1926func (c *ProjectsLocationsKeysListCall) Do(opts ...googleapi.CallOption) (*V2ListKeysResponse, error) {
1927	gensupport.SetOptions(c.urlParams_, opts...)
1928	res, err := c.doRequest("json")
1929	if res != nil && res.StatusCode == http.StatusNotModified {
1930		if res.Body != nil {
1931			res.Body.Close()
1932		}
1933		return nil, &googleapi.Error{
1934			Code:   res.StatusCode,
1935			Header: res.Header,
1936		}
1937	}
1938	if err != nil {
1939		return nil, err
1940	}
1941	defer googleapi.CloseBody(res)
1942	if err := googleapi.CheckResponse(res); err != nil {
1943		return nil, err
1944	}
1945	ret := &V2ListKeysResponse{
1946		ServerResponse: googleapi.ServerResponse{
1947			Header:         res.Header,
1948			HTTPStatusCode: res.StatusCode,
1949		},
1950	}
1951	target := &ret
1952	if err := gensupport.DecodeResponse(target, res); err != nil {
1953		return nil, err
1954	}
1955	return ret, nil
1956	// {
1957	//   "description": "Lists the API keys owned by a project. The key string of the API key isn't included in the response. NOTE: Key is a global resource; hence the only supported value for location is `global`.",
1958	//   "flatPath": "v2/projects/{projectsId}/locations/{locationsId}/keys",
1959	//   "httpMethod": "GET",
1960	//   "id": "apikeys.projects.locations.keys.list",
1961	//   "parameterOrder": [
1962	//     "parent"
1963	//   ],
1964	//   "parameters": {
1965	//     "filter": {
1966	//       "description": "Optional. Only list keys that conform to the specified filter. The allowed filter strings are `state:ACTIVE` and `state:DELETED`. By default, ListKeys returns only active keys.",
1967	//       "location": "query",
1968	//       "type": "string"
1969	//     },
1970	//     "pageSize": {
1971	//       "description": "Optional. Specifies the maximum number of results to be returned at a time.",
1972	//       "format": "int32",
1973	//       "location": "query",
1974	//       "type": "integer"
1975	//     },
1976	//     "pageToken": {
1977	//       "description": "Optional. Requests a specific page of results.",
1978	//       "location": "query",
1979	//       "type": "string"
1980	//     },
1981	//     "parent": {
1982	//       "description": "Required. Lists all API keys associated with this project.",
1983	//       "location": "path",
1984	//       "pattern": "^projects/[^/]+/locations/[^/]+$",
1985	//       "required": true,
1986	//       "type": "string"
1987	//     }
1988	//   },
1989	//   "path": "v2/{+parent}/keys",
1990	//   "response": {
1991	//     "$ref": "V2ListKeysResponse"
1992	//   },
1993	//   "scopes": [
1994	//     "https://www.googleapis.com/auth/cloud-platform",
1995	//     "https://www.googleapis.com/auth/cloud-platform.read-only"
1996	//   ]
1997	// }
1998
1999}
2000
2001// Pages invokes f for each page of results.
2002// A non-nil error returned from f will halt the iteration.
2003// The provided context supersedes any context provided to the Context method.
2004func (c *ProjectsLocationsKeysListCall) Pages(ctx context.Context, f func(*V2ListKeysResponse) error) error {
2005	c.ctx_ = ctx
2006	defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
2007	for {
2008		x, err := c.Do()
2009		if err != nil {
2010			return err
2011		}
2012		if err := f(x); err != nil {
2013			return err
2014		}
2015		if x.NextPageToken == "" {
2016			return nil
2017		}
2018		c.PageToken(x.NextPageToken)
2019	}
2020}
2021
2022// method id "apikeys.projects.locations.keys.patch":
2023
2024type ProjectsLocationsKeysPatchCall struct {
2025	s          *Service
2026	name       string
2027	v2key      *V2Key
2028	urlParams_ gensupport.URLParams
2029	ctx_       context.Context
2030	header_    http.Header
2031}
2032
2033// Patch: Patches the modifiable fields of an API key. The key string of
2034// the API key isn't included in the response. NOTE: Key is a global
2035// resource; hence the only supported value for location is `global`.
2036//
2037// - name: Output only. The resource name of the key. The `name` has the
2038//   form: `projects//locations/global/keys/`. For example:
2039//   `projects/123456867718/locations/global/keys/b7ff1f9f-8275-410a-94dd
2040//   -3855ee9b5dd2` NOTE: Key is a global resource; hence the only
2041//   supported value for location is `global`.
2042func (r *ProjectsLocationsKeysService) Patch(name string, v2key *V2Key) *ProjectsLocationsKeysPatchCall {
2043	c := &ProjectsLocationsKeysPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
2044	c.name = name
2045	c.v2key = v2key
2046	return c
2047}
2048
2049// UpdateMask sets the optional parameter "updateMask": The field mask
2050// specifies which fields to be updated as part of this request. All
2051// other fields are ignored. Mutable fields are: `display_name` and
2052// `restrictions`. If an update mask is not provided, the service treats
2053// it as an implied mask equivalent to all allowed fields that are set
2054// on the wire. If the field mask has a special value "*", the service
2055// treats it equivalent to replace all allowed mutable fields.
2056func (c *ProjectsLocationsKeysPatchCall) UpdateMask(updateMask string) *ProjectsLocationsKeysPatchCall {
2057	c.urlParams_.Set("updateMask", updateMask)
2058	return c
2059}
2060
2061// Fields allows partial responses to be retrieved. See
2062// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
2063// for more information.
2064func (c *ProjectsLocationsKeysPatchCall) Fields(s ...googleapi.Field) *ProjectsLocationsKeysPatchCall {
2065	c.urlParams_.Set("fields", googleapi.CombineFields(s))
2066	return c
2067}
2068
2069// Context sets the context to be used in this call's Do method. Any
2070// pending HTTP request will be aborted if the provided context is
2071// canceled.
2072func (c *ProjectsLocationsKeysPatchCall) Context(ctx context.Context) *ProjectsLocationsKeysPatchCall {
2073	c.ctx_ = ctx
2074	return c
2075}
2076
2077// Header returns an http.Header that can be modified by the caller to
2078// add HTTP headers to the request.
2079func (c *ProjectsLocationsKeysPatchCall) Header() http.Header {
2080	if c.header_ == nil {
2081		c.header_ = make(http.Header)
2082	}
2083	return c.header_
2084}
2085
2086func (c *ProjectsLocationsKeysPatchCall) doRequest(alt string) (*http.Response, error) {
2087	reqHeaders := make(http.Header)
2088	reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210502")
2089	for k, v := range c.header_ {
2090		reqHeaders[k] = v
2091	}
2092	reqHeaders.Set("User-Agent", c.s.userAgent())
2093	var body io.Reader = nil
2094	body, err := googleapi.WithoutDataWrapper.JSONReader(c.v2key)
2095	if err != nil {
2096		return nil, err
2097	}
2098	reqHeaders.Set("Content-Type", "application/json")
2099	c.urlParams_.Set("alt", alt)
2100	c.urlParams_.Set("prettyPrint", "false")
2101	urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+name}")
2102	urls += "?" + c.urlParams_.Encode()
2103	req, err := http.NewRequest("PATCH", urls, body)
2104	if err != nil {
2105		return nil, err
2106	}
2107	req.Header = reqHeaders
2108	googleapi.Expand(req.URL, map[string]string{
2109		"name": c.name,
2110	})
2111	return gensupport.SendRequest(c.ctx_, c.s.client, req)
2112}
2113
2114// Do executes the "apikeys.projects.locations.keys.patch" call.
2115// Exactly one of *Operation or error will be non-nil. Any non-2xx
2116// status code is an error. Response headers are in either
2117// *Operation.ServerResponse.Header or (if a response was returned at
2118// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
2119// to check whether the returned error was because
2120// http.StatusNotModified was returned.
2121func (c *ProjectsLocationsKeysPatchCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
2122	gensupport.SetOptions(c.urlParams_, opts...)
2123	res, err := c.doRequest("json")
2124	if res != nil && res.StatusCode == http.StatusNotModified {
2125		if res.Body != nil {
2126			res.Body.Close()
2127		}
2128		return nil, &googleapi.Error{
2129			Code:   res.StatusCode,
2130			Header: res.Header,
2131		}
2132	}
2133	if err != nil {
2134		return nil, err
2135	}
2136	defer googleapi.CloseBody(res)
2137	if err := googleapi.CheckResponse(res); err != nil {
2138		return nil, err
2139	}
2140	ret := &Operation{
2141		ServerResponse: googleapi.ServerResponse{
2142			Header:         res.Header,
2143			HTTPStatusCode: res.StatusCode,
2144		},
2145	}
2146	target := &ret
2147	if err := gensupport.DecodeResponse(target, res); err != nil {
2148		return nil, err
2149	}
2150	return ret, nil
2151	// {
2152	//   "description": "Patches the modifiable fields of an API key. The key string of the API key isn't included in the response. NOTE: Key is a global resource; hence the only supported value for location is `global`.",
2153	//   "flatPath": "v2/projects/{projectsId}/locations/{locationsId}/keys/{keysId}",
2154	//   "httpMethod": "PATCH",
2155	//   "id": "apikeys.projects.locations.keys.patch",
2156	//   "parameterOrder": [
2157	//     "name"
2158	//   ],
2159	//   "parameters": {
2160	//     "name": {
2161	//       "description": "Output only. The resource name of the key. The `name` has the form: `projects//locations/global/keys/`. For example: `projects/123456867718/locations/global/keys/b7ff1f9f-8275-410a-94dd-3855ee9b5dd2` NOTE: Key is a global resource; hence the only supported value for location is `global`.",
2162	//       "location": "path",
2163	//       "pattern": "^projects/[^/]+/locations/[^/]+/keys/[^/]+$",
2164	//       "required": true,
2165	//       "type": "string"
2166	//     },
2167	//     "updateMask": {
2168	//       "description": "The field mask specifies which fields to be updated as part of this request. All other fields are ignored. Mutable fields are: `display_name` and `restrictions`. If an update mask is not provided, the service treats it as an implied mask equivalent to all allowed fields that are set on the wire. If the field mask has a special value \"*\", the service treats it equivalent to replace all allowed mutable fields.",
2169	//       "format": "google-fieldmask",
2170	//       "location": "query",
2171	//       "type": "string"
2172	//     }
2173	//   },
2174	//   "path": "v2/{+name}",
2175	//   "request": {
2176	//     "$ref": "V2Key"
2177	//   },
2178	//   "response": {
2179	//     "$ref": "Operation"
2180	//   },
2181	//   "scopes": [
2182	//     "https://www.googleapis.com/auth/cloud-platform"
2183	//   ]
2184	// }
2185
2186}
2187
2188// method id "apikeys.projects.locations.keys.undelete":
2189
2190type ProjectsLocationsKeysUndeleteCall struct {
2191	s                    *Service
2192	name                 string
2193	v2undeletekeyrequest *V2UndeleteKeyRequest
2194	urlParams_           gensupport.URLParams
2195	ctx_                 context.Context
2196	header_              http.Header
2197}
2198
2199// Undelete: Undeletes an API key which was deleted within 30 days.
2200// NOTE: Key is a global resource; hence the only supported value for
2201// location is `global`.
2202//
2203// - name: The resource name of the API key to be undeleted.
2204func (r *ProjectsLocationsKeysService) Undelete(name string, v2undeletekeyrequest *V2UndeleteKeyRequest) *ProjectsLocationsKeysUndeleteCall {
2205	c := &ProjectsLocationsKeysUndeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
2206	c.name = name
2207	c.v2undeletekeyrequest = v2undeletekeyrequest
2208	return c
2209}
2210
2211// Fields allows partial responses to be retrieved. See
2212// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
2213// for more information.
2214func (c *ProjectsLocationsKeysUndeleteCall) Fields(s ...googleapi.Field) *ProjectsLocationsKeysUndeleteCall {
2215	c.urlParams_.Set("fields", googleapi.CombineFields(s))
2216	return c
2217}
2218
2219// Context sets the context to be used in this call's Do method. Any
2220// pending HTTP request will be aborted if the provided context is
2221// canceled.
2222func (c *ProjectsLocationsKeysUndeleteCall) Context(ctx context.Context) *ProjectsLocationsKeysUndeleteCall {
2223	c.ctx_ = ctx
2224	return c
2225}
2226
2227// Header returns an http.Header that can be modified by the caller to
2228// add HTTP headers to the request.
2229func (c *ProjectsLocationsKeysUndeleteCall) Header() http.Header {
2230	if c.header_ == nil {
2231		c.header_ = make(http.Header)
2232	}
2233	return c.header_
2234}
2235
2236func (c *ProjectsLocationsKeysUndeleteCall) doRequest(alt string) (*http.Response, error) {
2237	reqHeaders := make(http.Header)
2238	reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210502")
2239	for k, v := range c.header_ {
2240		reqHeaders[k] = v
2241	}
2242	reqHeaders.Set("User-Agent", c.s.userAgent())
2243	var body io.Reader = nil
2244	body, err := googleapi.WithoutDataWrapper.JSONReader(c.v2undeletekeyrequest)
2245	if err != nil {
2246		return nil, err
2247	}
2248	reqHeaders.Set("Content-Type", "application/json")
2249	c.urlParams_.Set("alt", alt)
2250	c.urlParams_.Set("prettyPrint", "false")
2251	urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+name}:undelete")
2252	urls += "?" + c.urlParams_.Encode()
2253	req, err := http.NewRequest("POST", urls, body)
2254	if err != nil {
2255		return nil, err
2256	}
2257	req.Header = reqHeaders
2258	googleapi.Expand(req.URL, map[string]string{
2259		"name": c.name,
2260	})
2261	return gensupport.SendRequest(c.ctx_, c.s.client, req)
2262}
2263
2264// Do executes the "apikeys.projects.locations.keys.undelete" call.
2265// Exactly one of *Operation or error will be non-nil. Any non-2xx
2266// status code is an error. Response headers are in either
2267// *Operation.ServerResponse.Header or (if a response was returned at
2268// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
2269// to check whether the returned error was because
2270// http.StatusNotModified was returned.
2271func (c *ProjectsLocationsKeysUndeleteCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
2272	gensupport.SetOptions(c.urlParams_, opts...)
2273	res, err := c.doRequest("json")
2274	if res != nil && res.StatusCode == http.StatusNotModified {
2275		if res.Body != nil {
2276			res.Body.Close()
2277		}
2278		return nil, &googleapi.Error{
2279			Code:   res.StatusCode,
2280			Header: res.Header,
2281		}
2282	}
2283	if err != nil {
2284		return nil, err
2285	}
2286	defer googleapi.CloseBody(res)
2287	if err := googleapi.CheckResponse(res); err != nil {
2288		return nil, err
2289	}
2290	ret := &Operation{
2291		ServerResponse: googleapi.ServerResponse{
2292			Header:         res.Header,
2293			HTTPStatusCode: res.StatusCode,
2294		},
2295	}
2296	target := &ret
2297	if err := gensupport.DecodeResponse(target, res); err != nil {
2298		return nil, err
2299	}
2300	return ret, nil
2301	// {
2302	//   "description": "Undeletes an API key which was deleted within 30 days. NOTE: Key is a global resource; hence the only supported value for location is `global`.",
2303	//   "flatPath": "v2/projects/{projectsId}/locations/{locationsId}/keys/{keysId}:undelete",
2304	//   "httpMethod": "POST",
2305	//   "id": "apikeys.projects.locations.keys.undelete",
2306	//   "parameterOrder": [
2307	//     "name"
2308	//   ],
2309	//   "parameters": {
2310	//     "name": {
2311	//       "description": "Required. The resource name of the API key to be undeleted.",
2312	//       "location": "path",
2313	//       "pattern": "^projects/[^/]+/locations/[^/]+/keys/[^/]+$",
2314	//       "required": true,
2315	//       "type": "string"
2316	//     }
2317	//   },
2318	//   "path": "v2/{+name}:undelete",
2319	//   "request": {
2320	//     "$ref": "V2UndeleteKeyRequest"
2321	//   },
2322	//   "response": {
2323	//     "$ref": "Operation"
2324	//   },
2325	//   "scopes": [
2326	//     "https://www.googleapis.com/auth/cloud-platform"
2327	//   ]
2328	// }
2329
2330}
2331