v2.d.ts
51.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
/// <reference types="node" />
import { OAuth2Client, JWT, Compute, UserRefreshClient, BaseExternalAccountClient, GaxiosPromise, GoogleConfigurable, MethodOptions, StreamMethodOptions, GlobalOptions, GoogleAuth, BodyResponseCallback, APIRequestContext } from 'googleapis-common';
import { Readable } from 'stream';
export declare namespace apikeys_v2 {
export interface Options extends GlobalOptions {
version: 'v2';
}
interface StandardParameters {
/**
* Auth client or API Key for the request
*/
auth?: string | OAuth2Client | JWT | Compute | UserRefreshClient | BaseExternalAccountClient | GoogleAuth;
/**
* V1 error format.
*/
'$.xgafv'?: string;
/**
* OAuth access token.
*/
access_token?: string;
/**
* Data format for response.
*/
alt?: string;
/**
* JSONP
*/
callback?: string;
/**
* Selector specifying which fields to include in a partial response.
*/
fields?: string;
/**
* API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
*/
key?: string;
/**
* OAuth 2.0 token for the current user.
*/
oauth_token?: string;
/**
* Returns response with indentations and line breaks.
*/
prettyPrint?: boolean;
/**
* Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
*/
quotaUser?: string;
/**
* Legacy upload protocol for media (e.g. "media", "multipart").
*/
uploadType?: string;
/**
* Upload protocol for media (e.g. "raw", "multipart").
*/
upload_protocol?: string;
}
/**
* API Keys API
*
* Manages the API keys associated with developer projects.
*
* @example
* ```js
* const {google} = require('googleapis');
* const apikeys = google.apikeys('v2');
* ```
*/
export class Apikeys {
context: APIRequestContext;
keys: Resource$Keys;
operations: Resource$Operations;
projects: Resource$Projects;
constructor(options: GlobalOptions, google?: GoogleConfigurable);
}
/**
* This resource represents a long-running operation that is the result of a network API call.
*/
export interface Schema$Operation {
/**
* If the value is `false`, it means the operation is still in progress. If `true`, the operation is completed, and either `error` or `response` is available.
*/
done?: boolean | null;
/**
* The error result of the operation in case of failure or cancellation.
*/
error?: Schema$Status;
/**
* Service-specific metadata associated with the operation. It typically contains progress information and common metadata such as create time. Some services might not provide such metadata. Any method that returns a long-running operation should document the metadata type, if any.
*/
metadata?: {
[key: string]: any;
} | null;
/**
* The server-assigned name, which is only unique within the same service that originally returns it. If you use the default HTTP mapping, the `name` should be a resource name ending with `operations/{unique_id\}`.
*/
name?: string | null;
/**
* The normal response of the operation in case of success. If the original method returns no data on success, such as `Delete`, the response is `google.protobuf.Empty`. If the original method is standard `Get`/`Create`/`Update`, the response should be the resource. For other methods, the response should have the type `XxxResponse`, where `Xxx` is the original method name. For example, if the original method name is `TakeSnapshot()`, the inferred response type is `TakeSnapshotResponse`.
*/
response?: {
[key: string]: any;
} | null;
}
/**
* The `Status` type defines a logical error model that is suitable for different programming environments, including REST APIs and RPC APIs. It is used by [gRPC](https://github.com/grpc). Each `Status` message contains three pieces of data: error code, error message, and error details. You can find out more about this error model and how to work with it in the [API Design Guide](https://cloud.google.com/apis/design/errors).
*/
export interface Schema$Status {
/**
* The status code, which should be an enum value of google.rpc.Code.
*/
code?: number | null;
/**
* A list of messages that carry the error details. There is a common set of message types for APIs to use.
*/
details?: Array<{
[key: string]: any;
}> | null;
/**
* A developer-facing error message, which should be in English. Any user-facing error message should be localized and sent in the google.rpc.Status.details field, or localized by the client.
*/
message?: string | null;
}
/**
* Identifier of an Android application for key use.
*/
export interface Schema$V2AndroidApplication {
/**
* The package name of the application.
*/
packageName?: string | null;
/**
* The SHA1 fingerprint of the application. For example, both sha1 formats are acceptable : DA:39:A3:EE:5E:6B:4B:0D:32:55:BF:EF:95:60:18:90:AF:D8:07:09 or DA39A3EE5E6B4B0D3255BFEF95601890AFD80709. Output format is the latter.
*/
sha1Fingerprint?: string | null;
}
/**
* The Android apps that are allowed to use the key.
*/
export interface Schema$V2AndroidKeyRestrictions {
/**
* A list of Android applications that are allowed to make API calls with this key.
*/
allowedApplications?: Schema$V2AndroidApplication[];
}
/**
* A restriction for a specific service and optionally one or multiple specific methods. Both fields are case insensitive.
*/
export interface Schema$V2ApiTarget {
/**
* Optional. List of one or more methods that can be called. If empty, all methods for the service are allowed. A wildcard (*) can be used as the last symbol. Valid examples: `google.cloud.translate.v2.TranslateService.GetSupportedLanguage` `TranslateText` `Get*` `translate.googleapis.com.Get*`
*/
methods?: string[] | null;
/**
* The service for this restriction. It should be the canonical service name, for example: `translate.googleapis.com`. You can use [`gcloud services list`](/sdk/gcloud/reference/services/list) to get a list of services that are enabled in the project.
*/
service?: string | null;
}
/**
* The HTTP referrers (websites) that are allowed to use the key.
*/
export interface Schema$V2BrowserKeyRestrictions {
/**
* A list of regular expressions for the referrer URLs that are allowed to make API calls with this key.
*/
allowedReferrers?: string[] | null;
}
/**
* Request message for `CloneKey` method.
*/
export interface Schema$V2CloneKeyRequest {
/**
* 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.
*/
keyId?: string | null;
}
/**
* Response message for `GetKeyString` method.
*/
export interface Schema$V2GetKeyStringResponse {
/**
* An encrypted and signed value of the key.
*/
keyString?: string | null;
}
/**
* The iOS apps that are allowed to use the key.
*/
export interface Schema$V2IosKeyRestrictions {
/**
* A list of bundle IDs that are allowed when making API calls with this key.
*/
allowedBundleIds?: string[] | null;
}
/**
* The representation of a key managed by the API Keys API.
*/
export interface Schema$V2Key {
/**
* Output only. A timestamp identifying the time this key was originally created.
*/
createTime?: string | null;
/**
* Output only. A timestamp when this key was deleted. If the resource is not deleted, this must be empty.
*/
deleteTime?: string | null;
/**
* Human-readable display name of this key that you can modify. The maximum length is 63 characters.
*/
displayName?: string | null;
/**
* Output only. A checksum computed by the server based on the current value of the Key resource. This may be sent on update and delete requests to ensure the client has an up-to-date value before proceeding.
*/
etag?: string | null;
/**
* Output only. An encrypted and signed value held by this key. This field can be accessed only through the `GetKeyString` method.
*/
keyString?: string | null;
/**
* 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`.
*/
name?: string | null;
/**
* Key restrictions.
*/
restrictions?: Schema$V2Restrictions;
/**
* Output only. Unique id in UUID4 format.
*/
uid?: string | null;
/**
* Output only. A timestamp identifying the time this key was last updated.
*/
updateTime?: string | null;
}
/**
* Response message for `ListKeys` method.
*/
export interface Schema$V2ListKeysResponse {
/**
* A list of API keys.
*/
keys?: Schema$V2Key[];
/**
* The pagination token for the next page of results.
*/
nextPageToken?: string | null;
}
/**
* Response message for `LookupKey` method.
*/
export interface Schema$V2LookupKeyResponse {
/**
* The resource name of the API key. If the API key has been purged, resource name is empty.
*/
name?: string | null;
/**
* The project that owns the key with the value specified in the request.
*/
parent?: string | null;
}
/**
* Describes the restrictions on the key.
*/
export interface Schema$V2Restrictions {
/**
* The Android apps that are allowed to use the key.
*/
androidKeyRestrictions?: Schema$V2AndroidKeyRestrictions;
/**
* A restriction for a specific service and optionally one or more specific methods. Requests are allowed if they match any of these restrictions. If no restrictions are specified, all targets are allowed.
*/
apiTargets?: Schema$V2ApiTarget[];
/**
* The HTTP referrers (websites) that are allowed to use the key.
*/
browserKeyRestrictions?: Schema$V2BrowserKeyRestrictions;
/**
* The iOS apps that are allowed to use the key.
*/
iosKeyRestrictions?: Schema$V2IosKeyRestrictions;
/**
* The IP addresses of callers that are allowed to use the key.
*/
serverKeyRestrictions?: Schema$V2ServerKeyRestrictions;
}
/**
* The IP addresses of callers that are allowed to use the key.
*/
export interface Schema$V2ServerKeyRestrictions {
/**
* A list of the caller IP addresses that are allowed to make API calls with this key.
*/
allowedIps?: string[] | null;
}
/**
* Request message for `UndeleteKey` method.
*/
export interface Schema$V2UndeleteKeyRequest {
}
export class Resource$Keys {
context: APIRequestContext;
constructor(context: APIRequestContext);
/**
* 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.
* @example
* ```js
* // Before running the sample:
* // - Enable the API at:
* // https://console.developers.google.com/apis/api/apikeys.googleapis.com
* // - Login into gcloud by running:
* // `$ gcloud auth application-default login`
* // - Install the npm module by running:
* // `$ npm install googleapis`
*
* const {google} = require('googleapis');
* const apikeys = google.apikeys('v2');
*
* async function main() {
* const auth = new google.auth.GoogleAuth({
* // Scopes can be specified either as an array or as a single, space-delimited string.
* scopes: [
* 'https://www.googleapis.com/auth/cloud-platform',
* 'https://www.googleapis.com/auth/cloud-platform.read-only',
* ],
* });
*
* // Acquire an auth client, and bind it to all future calls
* const authClient = await auth.getClient();
* google.options({auth: authClient});
*
* // Do the magic
* const res = await apikeys.keys.lookupKey({
* // Required. Finds the project that owns the key string value.
* keyString: 'placeholder-value',
* });
* console.log(res.data);
*
* // Example response
* // {
* // "name": "my_name",
* // "parent": "my_parent"
* // }
* }
*
* main().catch(e => {
* console.error(e);
* throw e;
* });
*
* ```
*
* @param params - Parameters for request
* @param options - Optionally override request options, such as `url`, `method`, and `encoding`.
* @param callback - Optional callback that handles the response.
* @returns A promise if used with async/await, or void if used with a callback.
*/
lookupKey(params: Params$Resource$Keys$Lookupkey, options: StreamMethodOptions): GaxiosPromise<Readable>;
lookupKey(params?: Params$Resource$Keys$Lookupkey, options?: MethodOptions): GaxiosPromise<Schema$V2LookupKeyResponse>;
lookupKey(params: Params$Resource$Keys$Lookupkey, options: StreamMethodOptions | BodyResponseCallback<Readable>, callback: BodyResponseCallback<Readable>): void;
lookupKey(params: Params$Resource$Keys$Lookupkey, options: MethodOptions | BodyResponseCallback<Schema$V2LookupKeyResponse>, callback: BodyResponseCallback<Schema$V2LookupKeyResponse>): void;
lookupKey(params: Params$Resource$Keys$Lookupkey, callback: BodyResponseCallback<Schema$V2LookupKeyResponse>): void;
lookupKey(callback: BodyResponseCallback<Schema$V2LookupKeyResponse>): void;
}
export interface Params$Resource$Keys$Lookupkey extends StandardParameters {
/**
* Required. Finds the project that owns the key string value.
*/
keyString?: string;
}
export class Resource$Operations {
context: APIRequestContext;
constructor(context: APIRequestContext);
/**
* 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.
* @example
* ```js
* // Before running the sample:
* // - Enable the API at:
* // https://console.developers.google.com/apis/api/apikeys.googleapis.com
* // - Login into gcloud by running:
* // `$ gcloud auth application-default login`
* // - Install the npm module by running:
* // `$ npm install googleapis`
*
* const {google} = require('googleapis');
* const apikeys = google.apikeys('v2');
*
* async function main() {
* const auth = new google.auth.GoogleAuth({
* // Scopes can be specified either as an array or as a single, space-delimited string.
* scopes: [
* 'https://www.googleapis.com/auth/cloud-platform',
* 'https://www.googleapis.com/auth/cloud-platform.read-only',
* ],
* });
*
* // Acquire an auth client, and bind it to all future calls
* const authClient = await auth.getClient();
* google.options({auth: authClient});
*
* // Do the magic
* const res = await apikeys.operations.get({
* // The name of the operation resource.
* name: 'operations/my-operation',
* });
* console.log(res.data);
*
* // Example response
* // {
* // "done": false,
* // "error": {},
* // "metadata": {},
* // "name": "my_name",
* // "response": {}
* // }
* }
*
* main().catch(e => {
* console.error(e);
* throw e;
* });
*
* ```
*
* @param params - Parameters for request
* @param options - Optionally override request options, such as `url`, `method`, and `encoding`.
* @param callback - Optional callback that handles the response.
* @returns A promise if used with async/await, or void if used with a callback.
*/
get(params: Params$Resource$Operations$Get, options: StreamMethodOptions): GaxiosPromise<Readable>;
get(params?: Params$Resource$Operations$Get, options?: MethodOptions): GaxiosPromise<Schema$Operation>;
get(params: Params$Resource$Operations$Get, options: StreamMethodOptions | BodyResponseCallback<Readable>, callback: BodyResponseCallback<Readable>): void;
get(params: Params$Resource$Operations$Get, options: MethodOptions | BodyResponseCallback<Schema$Operation>, callback: BodyResponseCallback<Schema$Operation>): void;
get(params: Params$Resource$Operations$Get, callback: BodyResponseCallback<Schema$Operation>): void;
get(callback: BodyResponseCallback<Schema$Operation>): void;
}
export interface Params$Resource$Operations$Get extends StandardParameters {
/**
* The name of the operation resource.
*/
name?: string;
}
export class Resource$Projects {
context: APIRequestContext;
locations: Resource$Projects$Locations;
constructor(context: APIRequestContext);
}
export class Resource$Projects$Locations {
context: APIRequestContext;
keys: Resource$Projects$Locations$Keys;
constructor(context: APIRequestContext);
}
export class Resource$Projects$Locations$Keys {
context: APIRequestContext;
constructor(context: APIRequestContext);
/**
* 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`.
* @example
* ```js
* // Before running the sample:
* // - Enable the API at:
* // https://console.developers.google.com/apis/api/apikeys.googleapis.com
* // - Login into gcloud by running:
* // `$ gcloud auth application-default login`
* // - Install the npm module by running:
* // `$ npm install googleapis`
*
* const {google} = require('googleapis');
* const apikeys = google.apikeys('v2');
*
* async function main() {
* const auth = new google.auth.GoogleAuth({
* // Scopes can be specified either as an array or as a single, space-delimited string.
* scopes: ['https://www.googleapis.com/auth/cloud-platform'],
* });
*
* // Acquire an auth client, and bind it to all future calls
* const authClient = await auth.getClient();
* google.options({auth: authClient});
*
* // Do the magic
* const res = await apikeys.projects.locations.keys.clone({
* // Required. The resource name of the API key to be cloned in the same project.
* name: 'projects/my-project/locations/my-location/keys/my-key',
*
* // Request body metadata
* requestBody: {
* // request body parameters
* // {
* // "keyId": "my_keyId"
* // }
* },
* });
* console.log(res.data);
*
* // Example response
* // {
* // "done": false,
* // "error": {},
* // "metadata": {},
* // "name": "my_name",
* // "response": {}
* // }
* }
*
* main().catch(e => {
* console.error(e);
* throw e;
* });
*
* ```
*
* @param params - Parameters for request
* @param options - Optionally override request options, such as `url`, `method`, and `encoding`.
* @param callback - Optional callback that handles the response.
* @returns A promise if used with async/await, or void if used with a callback.
*/
clone(params: Params$Resource$Projects$Locations$Keys$Clone, options: StreamMethodOptions): GaxiosPromise<Readable>;
clone(params?: Params$Resource$Projects$Locations$Keys$Clone, options?: MethodOptions): GaxiosPromise<Schema$Operation>;
clone(params: Params$Resource$Projects$Locations$Keys$Clone, options: StreamMethodOptions | BodyResponseCallback<Readable>, callback: BodyResponseCallback<Readable>): void;
clone(params: Params$Resource$Projects$Locations$Keys$Clone, options: MethodOptions | BodyResponseCallback<Schema$Operation>, callback: BodyResponseCallback<Schema$Operation>): void;
clone(params: Params$Resource$Projects$Locations$Keys$Clone, callback: BodyResponseCallback<Schema$Operation>): void;
clone(callback: BodyResponseCallback<Schema$Operation>): void;
/**
* Creates a new API key. NOTE: Key is a global resource; hence the only supported value for location is `global`.
* @example
* ```js
* // Before running the sample:
* // - Enable the API at:
* // https://console.developers.google.com/apis/api/apikeys.googleapis.com
* // - Login into gcloud by running:
* // `$ gcloud auth application-default login`
* // - Install the npm module by running:
* // `$ npm install googleapis`
*
* const {google} = require('googleapis');
* const apikeys = google.apikeys('v2');
*
* async function main() {
* const auth = new google.auth.GoogleAuth({
* // Scopes can be specified either as an array or as a single, space-delimited string.
* scopes: ['https://www.googleapis.com/auth/cloud-platform'],
* });
*
* // Acquire an auth client, and bind it to all future calls
* const authClient = await auth.getClient();
* google.options({auth: authClient});
*
* // Do the magic
* const res = await apikeys.projects.locations.keys.create({
* // 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.
* keyId: 'placeholder-value',
* // Required. The project in which the API key is created.
* parent: 'projects/my-project/locations/my-location',
*
* // Request body metadata
* requestBody: {
* // request body parameters
* // {
* // "createTime": "my_createTime",
* // "deleteTime": "my_deleteTime",
* // "displayName": "my_displayName",
* // "etag": "my_etag",
* // "keyString": "my_keyString",
* // "name": "my_name",
* // "restrictions": {},
* // "uid": "my_uid",
* // "updateTime": "my_updateTime"
* // }
* },
* });
* console.log(res.data);
*
* // Example response
* // {
* // "done": false,
* // "error": {},
* // "metadata": {},
* // "name": "my_name",
* // "response": {}
* // }
* }
*
* main().catch(e => {
* console.error(e);
* throw e;
* });
*
* ```
*
* @param params - Parameters for request
* @param options - Optionally override request options, such as `url`, `method`, and `encoding`.
* @param callback - Optional callback that handles the response.
* @returns A promise if used with async/await, or void if used with a callback.
*/
create(params: Params$Resource$Projects$Locations$Keys$Create, options: StreamMethodOptions): GaxiosPromise<Readable>;
create(params?: Params$Resource$Projects$Locations$Keys$Create, options?: MethodOptions): GaxiosPromise<Schema$Operation>;
create(params: Params$Resource$Projects$Locations$Keys$Create, options: StreamMethodOptions | BodyResponseCallback<Readable>, callback: BodyResponseCallback<Readable>): void;
create(params: Params$Resource$Projects$Locations$Keys$Create, options: MethodOptions | BodyResponseCallback<Schema$Operation>, callback: BodyResponseCallback<Schema$Operation>): void;
create(params: Params$Resource$Projects$Locations$Keys$Create, callback: BodyResponseCallback<Schema$Operation>): void;
create(callback: BodyResponseCallback<Schema$Operation>): void;
/**
* 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`.
* @example
* ```js
* // Before running the sample:
* // - Enable the API at:
* // https://console.developers.google.com/apis/api/apikeys.googleapis.com
* // - Login into gcloud by running:
* // `$ gcloud auth application-default login`
* // - Install the npm module by running:
* // `$ npm install googleapis`
*
* const {google} = require('googleapis');
* const apikeys = google.apikeys('v2');
*
* async function main() {
* const auth = new google.auth.GoogleAuth({
* // Scopes can be specified either as an array or as a single, space-delimited string.
* scopes: ['https://www.googleapis.com/auth/cloud-platform'],
* });
*
* // Acquire an auth client, and bind it to all future calls
* const authClient = await auth.getClient();
* google.options({auth: authClient});
*
* // Do the magic
* const res = await apikeys.projects.locations.keys.delete({
* // Optional. The etag known to the client for the expected state of the key. This is to be used for optimistic concurrency.
* etag: 'placeholder-value',
* // Required. The resource name of the API key to be deleted.
* name: 'projects/my-project/locations/my-location/keys/my-key',
* });
* console.log(res.data);
*
* // Example response
* // {
* // "done": false,
* // "error": {},
* // "metadata": {},
* // "name": "my_name",
* // "response": {}
* // }
* }
*
* main().catch(e => {
* console.error(e);
* throw e;
* });
*
* ```
*
* @param params - Parameters for request
* @param options - Optionally override request options, such as `url`, `method`, and `encoding`.
* @param callback - Optional callback that handles the response.
* @returns A promise if used with async/await, or void if used with a callback.
*/
delete(params: Params$Resource$Projects$Locations$Keys$Delete, options: StreamMethodOptions): GaxiosPromise<Readable>;
delete(params?: Params$Resource$Projects$Locations$Keys$Delete, options?: MethodOptions): GaxiosPromise<Schema$Operation>;
delete(params: Params$Resource$Projects$Locations$Keys$Delete, options: StreamMethodOptions | BodyResponseCallback<Readable>, callback: BodyResponseCallback<Readable>): void;
delete(params: Params$Resource$Projects$Locations$Keys$Delete, options: MethodOptions | BodyResponseCallback<Schema$Operation>, callback: BodyResponseCallback<Schema$Operation>): void;
delete(params: Params$Resource$Projects$Locations$Keys$Delete, callback: BodyResponseCallback<Schema$Operation>): void;
delete(callback: BodyResponseCallback<Schema$Operation>): void;
/**
* 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`.
* @example
* ```js
* // Before running the sample:
* // - Enable the API at:
* // https://console.developers.google.com/apis/api/apikeys.googleapis.com
* // - Login into gcloud by running:
* // `$ gcloud auth application-default login`
* // - Install the npm module by running:
* // `$ npm install googleapis`
*
* const {google} = require('googleapis');
* const apikeys = google.apikeys('v2');
*
* async function main() {
* const auth = new google.auth.GoogleAuth({
* // Scopes can be specified either as an array or as a single, space-delimited string.
* scopes: [
* 'https://www.googleapis.com/auth/cloud-platform',
* 'https://www.googleapis.com/auth/cloud-platform.read-only',
* ],
* });
*
* // Acquire an auth client, and bind it to all future calls
* const authClient = await auth.getClient();
* google.options({auth: authClient});
*
* // Do the magic
* const res = await apikeys.projects.locations.keys.get({
* // Required. The resource name of the API key to get.
* name: 'projects/my-project/locations/my-location/keys/my-key',
* });
* console.log(res.data);
*
* // Example response
* // {
* // "createTime": "my_createTime",
* // "deleteTime": "my_deleteTime",
* // "displayName": "my_displayName",
* // "etag": "my_etag",
* // "keyString": "my_keyString",
* // "name": "my_name",
* // "restrictions": {},
* // "uid": "my_uid",
* // "updateTime": "my_updateTime"
* // }
* }
*
* main().catch(e => {
* console.error(e);
* throw e;
* });
*
* ```
*
* @param params - Parameters for request
* @param options - Optionally override request options, such as `url`, `method`, and `encoding`.
* @param callback - Optional callback that handles the response.
* @returns A promise if used with async/await, or void if used with a callback.
*/
get(params: Params$Resource$Projects$Locations$Keys$Get, options: StreamMethodOptions): GaxiosPromise<Readable>;
get(params?: Params$Resource$Projects$Locations$Keys$Get, options?: MethodOptions): GaxiosPromise<Schema$V2Key>;
get(params: Params$Resource$Projects$Locations$Keys$Get, options: StreamMethodOptions | BodyResponseCallback<Readable>, callback: BodyResponseCallback<Readable>): void;
get(params: Params$Resource$Projects$Locations$Keys$Get, options: MethodOptions | BodyResponseCallback<Schema$V2Key>, callback: BodyResponseCallback<Schema$V2Key>): void;
get(params: Params$Resource$Projects$Locations$Keys$Get, callback: BodyResponseCallback<Schema$V2Key>): void;
get(callback: BodyResponseCallback<Schema$V2Key>): void;
/**
* Get the key string for an API key. NOTE: Key is a global resource; hence the only supported value for location is `global`.
* @example
* ```js
* // Before running the sample:
* // - Enable the API at:
* // https://console.developers.google.com/apis/api/apikeys.googleapis.com
* // - Login into gcloud by running:
* // `$ gcloud auth application-default login`
* // - Install the npm module by running:
* // `$ npm install googleapis`
*
* const {google} = require('googleapis');
* const apikeys = google.apikeys('v2');
*
* async function main() {
* const auth = new google.auth.GoogleAuth({
* // Scopes can be specified either as an array or as a single, space-delimited string.
* scopes: [
* 'https://www.googleapis.com/auth/cloud-platform',
* 'https://www.googleapis.com/auth/cloud-platform.read-only',
* ],
* });
*
* // Acquire an auth client, and bind it to all future calls
* const authClient = await auth.getClient();
* google.options({auth: authClient});
*
* // Do the magic
* const res = await apikeys.projects.locations.keys.getKeyString({
* // Required. The resource name of the API key to be retrieved.
* name: 'projects/my-project/locations/my-location/keys/my-key',
* });
* console.log(res.data);
*
* // Example response
* // {
* // "keyString": "my_keyString"
* // }
* }
*
* main().catch(e => {
* console.error(e);
* throw e;
* });
*
* ```
*
* @param params - Parameters for request
* @param options - Optionally override request options, such as `url`, `method`, and `encoding`.
* @param callback - Optional callback that handles the response.
* @returns A promise if used with async/await, or void if used with a callback.
*/
getKeyString(params: Params$Resource$Projects$Locations$Keys$Getkeystring, options: StreamMethodOptions): GaxiosPromise<Readable>;
getKeyString(params?: Params$Resource$Projects$Locations$Keys$Getkeystring, options?: MethodOptions): GaxiosPromise<Schema$V2GetKeyStringResponse>;
getKeyString(params: Params$Resource$Projects$Locations$Keys$Getkeystring, options: StreamMethodOptions | BodyResponseCallback<Readable>, callback: BodyResponseCallback<Readable>): void;
getKeyString(params: Params$Resource$Projects$Locations$Keys$Getkeystring, options: MethodOptions | BodyResponseCallback<Schema$V2GetKeyStringResponse>, callback: BodyResponseCallback<Schema$V2GetKeyStringResponse>): void;
getKeyString(params: Params$Resource$Projects$Locations$Keys$Getkeystring, callback: BodyResponseCallback<Schema$V2GetKeyStringResponse>): void;
getKeyString(callback: BodyResponseCallback<Schema$V2GetKeyStringResponse>): void;
/**
* 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`.
* @example
* ```js
* // Before running the sample:
* // - Enable the API at:
* // https://console.developers.google.com/apis/api/apikeys.googleapis.com
* // - Login into gcloud by running:
* // `$ gcloud auth application-default login`
* // - Install the npm module by running:
* // `$ npm install googleapis`
*
* const {google} = require('googleapis');
* const apikeys = google.apikeys('v2');
*
* async function main() {
* const auth = new google.auth.GoogleAuth({
* // Scopes can be specified either as an array or as a single, space-delimited string.
* scopes: [
* 'https://www.googleapis.com/auth/cloud-platform',
* 'https://www.googleapis.com/auth/cloud-platform.read-only',
* ],
* });
*
* // Acquire an auth client, and bind it to all future calls
* const authClient = await auth.getClient();
* google.options({auth: authClient});
*
* // Do the magic
* const res = await apikeys.projects.locations.keys.list({
* // 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.
* filter: 'placeholder-value',
* // Optional. Specifies the maximum number of results to be returned at a time.
* pageSize: 'placeholder-value',
* // Optional. Requests a specific page of results.
* pageToken: 'placeholder-value',
* // Required. Lists all API keys associated with this project.
* parent: 'projects/my-project/locations/my-location',
* });
* console.log(res.data);
*
* // Example response
* // {
* // "keys": [],
* // "nextPageToken": "my_nextPageToken"
* // }
* }
*
* main().catch(e => {
* console.error(e);
* throw e;
* });
*
* ```
*
* @param params - Parameters for request
* @param options - Optionally override request options, such as `url`, `method`, and `encoding`.
* @param callback - Optional callback that handles the response.
* @returns A promise if used with async/await, or void if used with a callback.
*/
list(params: Params$Resource$Projects$Locations$Keys$List, options: StreamMethodOptions): GaxiosPromise<Readable>;
list(params?: Params$Resource$Projects$Locations$Keys$List, options?: MethodOptions): GaxiosPromise<Schema$V2ListKeysResponse>;
list(params: Params$Resource$Projects$Locations$Keys$List, options: StreamMethodOptions | BodyResponseCallback<Readable>, callback: BodyResponseCallback<Readable>): void;
list(params: Params$Resource$Projects$Locations$Keys$List, options: MethodOptions | BodyResponseCallback<Schema$V2ListKeysResponse>, callback: BodyResponseCallback<Schema$V2ListKeysResponse>): void;
list(params: Params$Resource$Projects$Locations$Keys$List, callback: BodyResponseCallback<Schema$V2ListKeysResponse>): void;
list(callback: BodyResponseCallback<Schema$V2ListKeysResponse>): void;
/**
* 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`.
* @example
* ```js
* // Before running the sample:
* // - Enable the API at:
* // https://console.developers.google.com/apis/api/apikeys.googleapis.com
* // - Login into gcloud by running:
* // `$ gcloud auth application-default login`
* // - Install the npm module by running:
* // `$ npm install googleapis`
*
* const {google} = require('googleapis');
* const apikeys = google.apikeys('v2');
*
* async function main() {
* const auth = new google.auth.GoogleAuth({
* // Scopes can be specified either as an array or as a single, space-delimited string.
* scopes: ['https://www.googleapis.com/auth/cloud-platform'],
* });
*
* // Acquire an auth client, and bind it to all future calls
* const authClient = await auth.getClient();
* google.options({auth: authClient});
*
* // Do the magic
* const res = await apikeys.projects.locations.keys.patch({
* // 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`.
* name: 'projects/my-project/locations/my-location/keys/my-key',
* // 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.
* updateMask: 'placeholder-value',
*
* // Request body metadata
* requestBody: {
* // request body parameters
* // {
* // "createTime": "my_createTime",
* // "deleteTime": "my_deleteTime",
* // "displayName": "my_displayName",
* // "etag": "my_etag",
* // "keyString": "my_keyString",
* // "name": "my_name",
* // "restrictions": {},
* // "uid": "my_uid",
* // "updateTime": "my_updateTime"
* // }
* },
* });
* console.log(res.data);
*
* // Example response
* // {
* // "done": false,
* // "error": {},
* // "metadata": {},
* // "name": "my_name",
* // "response": {}
* // }
* }
*
* main().catch(e => {
* console.error(e);
* throw e;
* });
*
* ```
*
* @param params - Parameters for request
* @param options - Optionally override request options, such as `url`, `method`, and `encoding`.
* @param callback - Optional callback that handles the response.
* @returns A promise if used with async/await, or void if used with a callback.
*/
patch(params: Params$Resource$Projects$Locations$Keys$Patch, options: StreamMethodOptions): GaxiosPromise<Readable>;
patch(params?: Params$Resource$Projects$Locations$Keys$Patch, options?: MethodOptions): GaxiosPromise<Schema$Operation>;
patch(params: Params$Resource$Projects$Locations$Keys$Patch, options: StreamMethodOptions | BodyResponseCallback<Readable>, callback: BodyResponseCallback<Readable>): void;
patch(params: Params$Resource$Projects$Locations$Keys$Patch, options: MethodOptions | BodyResponseCallback<Schema$Operation>, callback: BodyResponseCallback<Schema$Operation>): void;
patch(params: Params$Resource$Projects$Locations$Keys$Patch, callback: BodyResponseCallback<Schema$Operation>): void;
patch(callback: BodyResponseCallback<Schema$Operation>): void;
/**
* 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`.
* @example
* ```js
* // Before running the sample:
* // - Enable the API at:
* // https://console.developers.google.com/apis/api/apikeys.googleapis.com
* // - Login into gcloud by running:
* // `$ gcloud auth application-default login`
* // - Install the npm module by running:
* // `$ npm install googleapis`
*
* const {google} = require('googleapis');
* const apikeys = google.apikeys('v2');
*
* async function main() {
* const auth = new google.auth.GoogleAuth({
* // Scopes can be specified either as an array or as a single, space-delimited string.
* scopes: ['https://www.googleapis.com/auth/cloud-platform'],
* });
*
* // Acquire an auth client, and bind it to all future calls
* const authClient = await auth.getClient();
* google.options({auth: authClient});
*
* // Do the magic
* const res = await apikeys.projects.locations.keys.undelete({
* // Required. The resource name of the API key to be undeleted.
* name: 'projects/my-project/locations/my-location/keys/my-key',
*
* // Request body metadata
* requestBody: {
* // request body parameters
* // {}
* },
* });
* console.log(res.data);
*
* // Example response
* // {
* // "done": false,
* // "error": {},
* // "metadata": {},
* // "name": "my_name",
* // "response": {}
* // }
* }
*
* main().catch(e => {
* console.error(e);
* throw e;
* });
*
* ```
*
* @param params - Parameters for request
* @param options - Optionally override request options, such as `url`, `method`, and `encoding`.
* @param callback - Optional callback that handles the response.
* @returns A promise if used with async/await, or void if used with a callback.
*/
undelete(params: Params$Resource$Projects$Locations$Keys$Undelete, options: StreamMethodOptions): GaxiosPromise<Readable>;
undelete(params?: Params$Resource$Projects$Locations$Keys$Undelete, options?: MethodOptions): GaxiosPromise<Schema$Operation>;
undelete(params: Params$Resource$Projects$Locations$Keys$Undelete, options: StreamMethodOptions | BodyResponseCallback<Readable>, callback: BodyResponseCallback<Readable>): void;
undelete(params: Params$Resource$Projects$Locations$Keys$Undelete, options: MethodOptions | BodyResponseCallback<Schema$Operation>, callback: BodyResponseCallback<Schema$Operation>): void;
undelete(params: Params$Resource$Projects$Locations$Keys$Undelete, callback: BodyResponseCallback<Schema$Operation>): void;
undelete(callback: BodyResponseCallback<Schema$Operation>): void;
}
export interface Params$Resource$Projects$Locations$Keys$Clone extends StandardParameters {
/**
* Required. The resource name of the API key to be cloned in the same project.
*/
name?: string;
/**
* Request body metadata
*/
requestBody?: Schema$V2CloneKeyRequest;
}
export interface Params$Resource$Projects$Locations$Keys$Create extends StandardParameters {
/**
* 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.
*/
keyId?: string;
/**
* Required. The project in which the API key is created.
*/
parent?: string;
/**
* Request body metadata
*/
requestBody?: Schema$V2Key;
}
export interface Params$Resource$Projects$Locations$Keys$Delete extends StandardParameters {
/**
* Optional. The etag known to the client for the expected state of the key. This is to be used for optimistic concurrency.
*/
etag?: string;
/**
* Required. The resource name of the API key to be deleted.
*/
name?: string;
}
export interface Params$Resource$Projects$Locations$Keys$Get extends StandardParameters {
/**
* Required. The resource name of the API key to get.
*/
name?: string;
}
export interface Params$Resource$Projects$Locations$Keys$Getkeystring extends StandardParameters {
/**
* Required. The resource name of the API key to be retrieved.
*/
name?: string;
}
export interface Params$Resource$Projects$Locations$Keys$List extends StandardParameters {
/**
* 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.
*/
filter?: string;
/**
* Optional. Specifies the maximum number of results to be returned at a time.
*/
pageSize?: number;
/**
* Optional. Requests a specific page of results.
*/
pageToken?: string;
/**
* Required. Lists all API keys associated with this project.
*/
parent?: string;
}
export interface Params$Resource$Projects$Locations$Keys$Patch extends StandardParameters {
/**
* 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`.
*/
name?: string;
/**
* 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.
*/
updateMask?: string;
/**
* Request body metadata
*/
requestBody?: Schema$V2Key;
}
export interface Params$Resource$Projects$Locations$Keys$Undelete extends StandardParameters {
/**
* Required. The resource name of the API key to be undeleted.
*/
name?: string;
/**
* Request body metadata
*/
requestBody?: Schema$V2UndeleteKeyRequest;
}
export {};
}