@maxim_mazurok/gapi.client.sts-v1beta 0.0.20220806
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.d.ts +286 -0
- package/package.json +20 -0
- package/readme.md +52 -0
- package/tests.ts +33 -0
- package/tsconfig.json +18 -0
- package/tslint.json +6 -0
package/index.d.ts
ADDED
|
@@ -0,0 +1,286 @@
|
|
|
1
|
+
/* Type definitions for non-npm package Security Token Service API v1beta 0.0 */
|
|
2
|
+
// Project: http://cloud.google.com/iam/docs/workload-identity-federation
|
|
3
|
+
// Definitions by: Maxim Mazurok <https://github.com/Maxim-Mazurok>
|
|
4
|
+
// Nick Amoscato <https://github.com/namoscato>
|
|
5
|
+
// Declan Vong <https://github.com/declanvong>
|
|
6
|
+
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
|
7
|
+
// TypeScript Version: 2.8
|
|
8
|
+
|
|
9
|
+
// IMPORTANT
|
|
10
|
+
// This file was generated by https://github.com/Maxim-Mazurok/google-api-typings-generator. Please do not edit it manually.
|
|
11
|
+
// In case of any problems please post issue to https://github.com/Maxim-Mazurok/google-api-typings-generator
|
|
12
|
+
// Generated from: https://sts.googleapis.com/$discovery/rest?version=v1beta
|
|
13
|
+
// Revision: 20220806
|
|
14
|
+
|
|
15
|
+
/// <reference types="gapi.client" />
|
|
16
|
+
|
|
17
|
+
declare namespace gapi.client {
|
|
18
|
+
/** Load Security Token Service API v1beta */
|
|
19
|
+
function load(urlOrObject: "https://sts.googleapis.com/$discovery/rest?version=v1beta"): Promise<void>;
|
|
20
|
+
/** @deprecated Please load APIs with discovery documents. */
|
|
21
|
+
function load(name: "sts", version: "v1beta"): Promise<void>;
|
|
22
|
+
/** @deprecated Please load APIs with discovery documents. */
|
|
23
|
+
function load(name: "sts", version: "v1beta", callback: () => any): void;
|
|
24
|
+
|
|
25
|
+
namespace sts {
|
|
26
|
+
interface GoogleIamV1Binding {
|
|
27
|
+
/**
|
|
28
|
+
* The condition that is associated with this binding. If the condition evaluates to `true`, then this binding applies to the current request. If the condition evaluates to `false`,
|
|
29
|
+
* then this binding does not apply to the current request. However, a different role binding might grant the same role to one or more of the principals in this binding. To learn which
|
|
30
|
+
* resources support conditions in their IAM policies, see the [IAM documentation](https://cloud.google.com/iam/help/conditions/resource-policies).
|
|
31
|
+
*/
|
|
32
|
+
condition?: GoogleTypeExpr;
|
|
33
|
+
/**
|
|
34
|
+
* Specifies the principals requesting access for a Google Cloud resource. `members` can have the following values: * `allUsers`: A special identifier that represents anyone who is on
|
|
35
|
+
* the internet; with or without a Google account. * `allAuthenticatedUsers`: A special identifier that represents anyone who is authenticated with a Google account or a service
|
|
36
|
+
* account. * `user:{emailid}`: An email address that represents a specific Google account. For example, `alice@example.com` . * `serviceAccount:{emailid}`: An email address that
|
|
37
|
+
* represents a Google service account. For example, `my-other-app@appspot.gserviceaccount.com`. * `serviceAccount:{projectid}.svc.id.goog[{namespace}/{kubernetes-sa}]`: An identifier
|
|
38
|
+
* for a [Kubernetes service account](https://cloud.google.com/kubernetes-engine/docs/how-to/kubernetes-service-accounts). For example,
|
|
39
|
+
* `my-project.svc.id.goog[my-namespace/my-kubernetes-sa]`. * `group:{emailid}`: An email address that represents a Google group. For example, `admins@example.com`. *
|
|
40
|
+
* `deleted:user:{emailid}?uid={uniqueid}`: An email address (plus unique identifier) representing a user that has been recently deleted. For example,
|
|
41
|
+
* `alice@example.com?uid=123456789012345678901`. If the user is recovered, this value reverts to `user:{emailid}` and the recovered user retains the role in the binding. *
|
|
42
|
+
* `deleted:serviceAccount:{emailid}?uid={uniqueid}`: An email address (plus unique identifier) representing a service account that has been recently deleted. For example,
|
|
43
|
+
* `my-other-app@appspot.gserviceaccount.com?uid=123456789012345678901`. If the service account is undeleted, this value reverts to `serviceAccount:{emailid}` and the undeleted service
|
|
44
|
+
* account retains the role in the binding. * `deleted:group:{emailid}?uid={uniqueid}`: An email address (plus unique identifier) representing a Google group that has been recently
|
|
45
|
+
* deleted. For example, `admins@example.com?uid=123456789012345678901`. If the group is recovered, this value reverts to `group:{emailid}` and the recovered group retains the role in
|
|
46
|
+
* the binding. * `domain:{domain}`: The G Suite domain (primary) that represents all the users of that domain. For example, `google.com` or `example.com`.
|
|
47
|
+
*/
|
|
48
|
+
members?: string[];
|
|
49
|
+
/** Role that is assigned to the list of `members`, or principals. For example, `roles/viewer`, `roles/editor`, or `roles/owner`. */
|
|
50
|
+
role?: string;
|
|
51
|
+
}
|
|
52
|
+
interface GoogleIdentityStsV1AccessBoundary {
|
|
53
|
+
/**
|
|
54
|
+
* A list of access boundary rules which defines the upper bound of the permission a principal may carry. If multiple rules are specified, the effective access boundary is the union of
|
|
55
|
+
* all the access boundary rules attached. One access boundary can contain at most 10 rules.
|
|
56
|
+
*/
|
|
57
|
+
accessBoundaryRules?: GoogleIdentityStsV1AccessBoundaryRule[];
|
|
58
|
+
}
|
|
59
|
+
interface GoogleIdentityStsV1AccessBoundaryRule {
|
|
60
|
+
/**
|
|
61
|
+
* The availability condition further constrains the access allowed by the access boundary rule. If the condition evaluates to `true`, then this access boundary rule will provide
|
|
62
|
+
* access to the specified resource, assuming the principal has the required permissions for the resource. If the condition does not evaluate to `true`, then access to the specified
|
|
63
|
+
* resource will not be available. Note that all access boundary rules in an access boundary are evaluated together as a union. As such, another access boundary rule may allow access
|
|
64
|
+
* to the resource, even if this access boundary rule does not allow access. To learn which resources support conditions in their IAM policies, see the [IAM
|
|
65
|
+
* documentation](https://cloud.google.com/iam/help/conditions/resource-policies). The maximum length of the `expression` field is 2048 characters.
|
|
66
|
+
*/
|
|
67
|
+
availabilityCondition?: GoogleTypeExpr;
|
|
68
|
+
/**
|
|
69
|
+
* A list of permissions that may be allowed for use on the specified resource. The only supported values in the list are IAM roles, following the format of google.iam.v1.Binding.role.
|
|
70
|
+
* Example value: `inRole:roles/logging.viewer` for predefined roles and `inRole:organizations/{ORGANIZATION_ID}/roles/logging.viewer` for custom roles.
|
|
71
|
+
*/
|
|
72
|
+
availablePermissions?: string[];
|
|
73
|
+
/**
|
|
74
|
+
* The full resource name of a Google Cloud resource entity. The format definition is at https://cloud.google.com/apis/design/resource_names. Example value:
|
|
75
|
+
* `//cloudresourcemanager.googleapis.com/projects/my-project`.
|
|
76
|
+
*/
|
|
77
|
+
availableResource?: string;
|
|
78
|
+
}
|
|
79
|
+
interface GoogleIdentityStsV1betaAccessBoundary {
|
|
80
|
+
/**
|
|
81
|
+
* A list of access boundary rules which defines the upper bound of the permission a principal may carry. If multiple rules are specified, the effective access boundary is the union of
|
|
82
|
+
* all the access boundary rules attached. One access boundary can contain at most 10 rules.
|
|
83
|
+
*/
|
|
84
|
+
accessBoundaryRules?: GoogleIdentityStsV1betaAccessBoundaryRule[];
|
|
85
|
+
}
|
|
86
|
+
interface GoogleIdentityStsV1betaAccessBoundaryRule {
|
|
87
|
+
/**
|
|
88
|
+
* The availability condition further constrains the access allowed by the access boundary rule. If the condition evaluates to `true`, then this access boundary rule will provide
|
|
89
|
+
* access to the specified resource, assuming the principal has the required permissions for the resource. If the condition does not evaluate to `true`, then access to the specified
|
|
90
|
+
* resource will not be available. Note that all access boundary rules in an access boundary are evaluated together as a union. As such, another access boundary rule may allow access
|
|
91
|
+
* to the resource, even if this access boundary rule does not allow access. To learn which resources support conditions in their IAM policies, see the [IAM
|
|
92
|
+
* documentation](https://cloud.google.com/iam/help/conditions/resource-policies). The maximum length of the `expression` field is 2048 characters.
|
|
93
|
+
*/
|
|
94
|
+
availabilityCondition?: GoogleTypeExpr;
|
|
95
|
+
/**
|
|
96
|
+
* A list of permissions that may be allowed for use on the specified resource. The only supported values in the list are IAM roles, following the format of google.iam.v1.Binding.role.
|
|
97
|
+
* Example value: `inRole:roles/logging.viewer` for predefined roles and `inRole:organizations/{ORGANIZATION_ID}/roles/logging.viewer` for custom roles.
|
|
98
|
+
*/
|
|
99
|
+
availablePermissions?: string[];
|
|
100
|
+
/**
|
|
101
|
+
* The full resource name of a Google Cloud resource entity. The format definition is at https://cloud.google.com/apis/design/resource_names. Example value:
|
|
102
|
+
* `//cloudresourcemanager.googleapis.com/projects/my-project`.
|
|
103
|
+
*/
|
|
104
|
+
availableResource?: string;
|
|
105
|
+
}
|
|
106
|
+
interface GoogleIdentityStsV1betaExchangeTokenRequest {
|
|
107
|
+
/**
|
|
108
|
+
* The full resource name of the identity provider. For example, `//iam.googleapis.com/projects//locations/global/workloadIdentityPools//providers/`. Required when exchanging an
|
|
109
|
+
* external credential for a Google access token.
|
|
110
|
+
*/
|
|
111
|
+
audience?: string;
|
|
112
|
+
/** Required. The grant type. Must be `urn:ietf:params:oauth:grant-type:token-exchange`, which indicates a token exchange. */
|
|
113
|
+
grantType?: string;
|
|
114
|
+
/**
|
|
115
|
+
* A set of features that Security Token Service supports, in addition to the standard OAuth 2.0 token exchange, formatted as a serialized JSON object of Options. The size of the
|
|
116
|
+
* parameter value must not exceed 4096 characters.
|
|
117
|
+
*/
|
|
118
|
+
options?: string;
|
|
119
|
+
/** Required. The type of security token. Must be `urn:ietf:params:oauth:token-type:access_token`, which indicates an OAuth 2.0 access token. */
|
|
120
|
+
requestedTokenType?: string;
|
|
121
|
+
/**
|
|
122
|
+
* The OAuth 2.0 scopes to include on the resulting access token, formatted as a list of space-delimited, case-sensitive strings. Required when exchanging an external credential for a
|
|
123
|
+
* Google access token.
|
|
124
|
+
*/
|
|
125
|
+
scope?: string;
|
|
126
|
+
/**
|
|
127
|
+
* Required. The input token. This token is either an external credential issued by a workload identity pool provider, or a short-lived access token issued by Google. If the token is
|
|
128
|
+
* an OIDC JWT, it must use the JWT format defined in [RFC 7523](https://tools.ietf.org/html/rfc7523), and the `subject_token_type` must be either
|
|
129
|
+
* `urn:ietf:params:oauth:token-type:jwt` or `urn:ietf:params:oauth:token-type:id_token`. The following headers are required: - `kid`: The identifier of the signing key securing the
|
|
130
|
+
* JWT. - `alg`: The cryptographic algorithm securing the JWT. Must be `RS256` or `ES256`. The following payload fields are required. For more information, see [RFC 7523, Section
|
|
131
|
+
* 3](https://tools.ietf.org/html/rfc7523#section-3): - `iss`: The issuer of the token. The issuer must provide a discovery document at the URL `/.well-known/openid-configuration`,
|
|
132
|
+
* where `` is the value of this field. The document must be formatted according to section 4.2 of the [OIDC 1.0 Discovery
|
|
133
|
+
* specification](https://openid.net/specs/openid-connect-discovery-1_0.html#ProviderConfigurationResponse). - `iat`: The issue time, in seconds, since the Unix epoch. Must be in the
|
|
134
|
+
* past. - `exp`: The expiration time, in seconds, since the Unix epoch. Must be less than 48 hours after `iat`. Shorter expiration times are more secure. If possible, we recommend
|
|
135
|
+
* setting an expiration time less than 6 hours. - `sub`: The identity asserted in the JWT. - `aud`: For workload identity pools, this must be a value specified in the allowed
|
|
136
|
+
* audiences for the workload identity pool provider, or one of the audiences allowed by default if no audiences were specified. See
|
|
137
|
+
* https://cloud.google.com/iam/docs/reference/rest/v1/projects.locations.workloadIdentityPools.providers#oidc Example header: ``` { "alg": "RS256", "kid": "us-east-11" } ``` Example
|
|
138
|
+
* payload: ``` { "iss": "https://accounts.google.com", "iat": 1517963104, "exp": 1517966704, "aud":
|
|
139
|
+
* "//iam.googleapis.com/projects/1234567890123/locations/global/workloadIdentityPools/my-pool/providers/my-provider", "sub": "113475438248934895348", "my_claims": {
|
|
140
|
+
* "additional_claim": "value" } } ``` If `subject_token` is for AWS, it must be a serialized `GetCallerIdentity` token. This token contains the same information as a request to the
|
|
141
|
+
* AWS [`GetCallerIdentity()`](https://docs.aws.amazon.com/STS/latest/APIReference/API_GetCallerIdentity) method, as well as the AWS
|
|
142
|
+
* [signature](https://docs.aws.amazon.com/general/latest/gr/signing_aws_api_requests.html) for the request information. Use Signature Version 4. Format the request as URL-encoded
|
|
143
|
+
* JSON, and set the `subject_token_type` parameter to `urn:ietf:params:aws:token-type:aws4_request`. The following parameters are required: - `url`: The URL of the AWS STS endpoint
|
|
144
|
+
* for `GetCallerIdentity()`, such as `https://sts.amazonaws.com?Action=GetCallerIdentity&Version=2011-06-15`. Regional endpoints are also supported. - `method`: The HTTP request
|
|
145
|
+
* method: `POST`. - `headers`: The HTTP request headers, which must include: - `Authorization`: The request signature. - `x-amz-date`: The time you will send the request, formatted as
|
|
146
|
+
* an [ISO8601 Basic](https://docs.aws.amazon.com/general/latest/gr/sigv4_elements.html#sigv4_elements_date) string. This value is typically set to the current time and is used to help
|
|
147
|
+
* prevent replay attacks. - `host`: The hostname of the `url` field; for example, `sts.amazonaws.com`. - `x-goog-cloud-target-resource`: The full, canonical resource name of the
|
|
148
|
+
* workload identity pool provider, with or without an `https:` prefix. To help ensure data integrity, we recommend including this header in the `SignedHeaders` field of the signed
|
|
149
|
+
* request. For example: //iam.googleapis.com/projects//locations/global/workloadIdentityPools//providers/
|
|
150
|
+
* https://iam.googleapis.com/projects//locations/global/workloadIdentityPools//providers/ If you are using temporary security credentials provided by AWS, you must also include the
|
|
151
|
+
* header `x-amz-security-token`, with the value set to the session token. The following example shows a `GetCallerIdentity` token: ``` { "headers": [ {"key": "x-amz-date", "value":
|
|
152
|
+
* "20200815T015049Z"}, {"key": "Authorization", "value": "AWS4-HMAC-SHA256+Credential=$credential,+SignedHeaders=host;x-amz-date;x-goog-cloud-target-resource,+Signature=$signature"},
|
|
153
|
+
* {"key": "x-goog-cloud-target-resource", "value": "//iam.googleapis.com/projects//locations/global/workloadIdentityPools//providers/"}, {"key": "host", "value": "sts.amazonaws.com"}
|
|
154
|
+
* . ], "method": "POST", "url": "https://sts.amazonaws.com?Action=GetCallerIdentity&Version=2011-06-15" } ``` You can also use a Google-issued OAuth 2.0 access token with this field
|
|
155
|
+
* to obtain an access token with new security attributes applied, such as a Credential Access Boundary. In this case, set `subject_token_type` to
|
|
156
|
+
* `urn:ietf:params:oauth:token-type:access_token`. If an access token already contains security attributes, you cannot apply additional security attributes.
|
|
157
|
+
*/
|
|
158
|
+
subjectToken?: string;
|
|
159
|
+
/**
|
|
160
|
+
* Required. An identifier that indicates the type of the security token in the `subject_token` parameter. Supported values are `urn:ietf:params:oauth:token-type:jwt`,
|
|
161
|
+
* `urn:ietf:params:oauth:token-type:id_token`, `urn:ietf:params:aws:token-type:aws4_request`, and `urn:ietf:params:oauth:token-type:access_token`.
|
|
162
|
+
*/
|
|
163
|
+
subjectTokenType?: string;
|
|
164
|
+
}
|
|
165
|
+
interface GoogleIdentityStsV1betaExchangeTokenResponse {
|
|
166
|
+
/**
|
|
167
|
+
* An OAuth 2.0 security token, issued by Google, in response to the token exchange request. Tokens can vary in size, depending in part on the size of mapped claims, up to a maximum of
|
|
168
|
+
* 12288 bytes (12 KB). Google reserves the right to change the token size and the maximum length at any time.
|
|
169
|
+
*/
|
|
170
|
+
access_token?: string;
|
|
171
|
+
/**
|
|
172
|
+
* The amount of time, in seconds, between the time when the access token was issued and the time when the access token will expire. This field is absent when the `subject_token` in
|
|
173
|
+
* the request is a Google-issued, short-lived access token. In this case, the access token has the same expiration time as the `subject_token`.
|
|
174
|
+
*/
|
|
175
|
+
expires_in?: number;
|
|
176
|
+
/** The token type. Always matches the value of `requested_token_type` from the request. */
|
|
177
|
+
issued_token_type?: string;
|
|
178
|
+
/** The type of access token. Always has the value `Bearer`. */
|
|
179
|
+
token_type?: string;
|
|
180
|
+
}
|
|
181
|
+
interface GoogleIdentityStsV1betaOptions {
|
|
182
|
+
/**
|
|
183
|
+
* An access boundary that defines the upper bound of permissions the credential may have. The value should be a JSON object of AccessBoundary. The access boundary can include up to 10
|
|
184
|
+
* rules. The size of the parameter value should not exceed 2048 characters.
|
|
185
|
+
*/
|
|
186
|
+
accessBoundary?: GoogleIdentityStsV1betaAccessBoundary;
|
|
187
|
+
/**
|
|
188
|
+
* The intended audience(s) of the credential. The audience value(s) should be the name(s) of services intended to receive the credential. Example: `["https://pubsub.googleapis.com/",
|
|
189
|
+
* "https://storage.googleapis.com/"]`. A maximum of 5 audiences can be included. For each provided audience, the maximum length is 262 characters.
|
|
190
|
+
*/
|
|
191
|
+
audiences?: string[];
|
|
192
|
+
/**
|
|
193
|
+
* A Google project used for quota and billing purposes when the credential is used to access Google APIs. The provided project overrides the project bound to the credential. The value
|
|
194
|
+
* must be a project number or a project ID. Example: `my-sample-project-191923`. The maximum length is 32 characters.
|
|
195
|
+
*/
|
|
196
|
+
userProject?: string;
|
|
197
|
+
}
|
|
198
|
+
interface GoogleIdentityStsV1Options {
|
|
199
|
+
/**
|
|
200
|
+
* An access boundary that defines the upper bound of permissions the credential may have. The value should be a JSON object of AccessBoundary. The access boundary can include up to 10
|
|
201
|
+
* rules. The size of the parameter value should not exceed 2048 characters.
|
|
202
|
+
*/
|
|
203
|
+
accessBoundary?: GoogleIdentityStsV1AccessBoundary;
|
|
204
|
+
/**
|
|
205
|
+
* The intended audience(s) of the credential. The audience value(s) should be the name(s) of services intended to receive the credential. Example: `["https://pubsub.googleapis.com/",
|
|
206
|
+
* "https://storage.googleapis.com/"]`. A maximum of 5 audiences can be included. For each provided audience, the maximum length is 262 characters.
|
|
207
|
+
*/
|
|
208
|
+
audiences?: string[];
|
|
209
|
+
/**
|
|
210
|
+
* A Google project used for quota and billing purposes when the credential is used to access Google APIs. The provided project overrides the project bound to the credential. The value
|
|
211
|
+
* must be a project number or a project ID. Example: `my-sample-project-191923`. The maximum length is 32 characters.
|
|
212
|
+
*/
|
|
213
|
+
userProject?: string;
|
|
214
|
+
}
|
|
215
|
+
interface GoogleTypeExpr {
|
|
216
|
+
/** Optional. Description of the expression. This is a longer text which describes the expression, e.g. when hovered over it in a UI. */
|
|
217
|
+
description?: string;
|
|
218
|
+
/** Textual representation of an expression in Common Expression Language syntax. */
|
|
219
|
+
expression?: string;
|
|
220
|
+
/** Optional. String indicating the location of the expression for error reporting, e.g. a file name and a position in the file. */
|
|
221
|
+
location?: string;
|
|
222
|
+
/** Optional. Title for the expression, i.e. a short string describing its purpose. This can be used e.g. in UIs which allow to enter the expression. */
|
|
223
|
+
title?: string;
|
|
224
|
+
}
|
|
225
|
+
interface V1betaResource {
|
|
226
|
+
/**
|
|
227
|
+
* Exchanges a credential for a Google OAuth 2.0 access token. The token asserts an external identity within a workload identity pool, or it applies a Credential Access Boundary to a
|
|
228
|
+
* Google access token. When you call this method, do not send the `Authorization` HTTP header in the request. This method does not require the `Authorization` header, and using the
|
|
229
|
+
* header can cause the request to fail.
|
|
230
|
+
*/
|
|
231
|
+
token(request: {
|
|
232
|
+
/** V1 error format. */
|
|
233
|
+
"$.xgafv"?: string;
|
|
234
|
+
/** OAuth access token. */
|
|
235
|
+
access_token?: string;
|
|
236
|
+
/** Data format for response. */
|
|
237
|
+
alt?: string;
|
|
238
|
+
/** JSONP */
|
|
239
|
+
callback?: string;
|
|
240
|
+
/** Selector specifying which fields to include in a partial response. */
|
|
241
|
+
fields?: string;
|
|
242
|
+
/** 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. */
|
|
243
|
+
key?: string;
|
|
244
|
+
/** OAuth 2.0 token for the current user. */
|
|
245
|
+
oauth_token?: string;
|
|
246
|
+
/** Returns response with indentations and line breaks. */
|
|
247
|
+
prettyPrint?: boolean;
|
|
248
|
+
/** 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. */
|
|
249
|
+
quotaUser?: string;
|
|
250
|
+
/** Upload protocol for media (e.g. "raw", "multipart"). */
|
|
251
|
+
upload_protocol?: string;
|
|
252
|
+
/** Legacy upload protocol for media (e.g. "media", "multipart"). */
|
|
253
|
+
uploadType?: string;
|
|
254
|
+
/** Request body */
|
|
255
|
+
resource: GoogleIdentityStsV1betaExchangeTokenRequest;
|
|
256
|
+
}): Request<GoogleIdentityStsV1betaExchangeTokenResponse>;
|
|
257
|
+
token(request: {
|
|
258
|
+
/** V1 error format. */
|
|
259
|
+
"$.xgafv"?: string;
|
|
260
|
+
/** OAuth access token. */
|
|
261
|
+
access_token?: string;
|
|
262
|
+
/** Data format for response. */
|
|
263
|
+
alt?: string;
|
|
264
|
+
/** JSONP */
|
|
265
|
+
callback?: string;
|
|
266
|
+
/** Selector specifying which fields to include in a partial response. */
|
|
267
|
+
fields?: string;
|
|
268
|
+
/** 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. */
|
|
269
|
+
key?: string;
|
|
270
|
+
/** OAuth 2.0 token for the current user. */
|
|
271
|
+
oauth_token?: string;
|
|
272
|
+
/** Returns response with indentations and line breaks. */
|
|
273
|
+
prettyPrint?: boolean;
|
|
274
|
+
/** 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. */
|
|
275
|
+
quotaUser?: string;
|
|
276
|
+
/** Upload protocol for media (e.g. "raw", "multipart"). */
|
|
277
|
+
upload_protocol?: string;
|
|
278
|
+
/** Legacy upload protocol for media (e.g. "media", "multipart"). */
|
|
279
|
+
uploadType?: string;
|
|
280
|
+
},
|
|
281
|
+
body: GoogleIdentityStsV1betaExchangeTokenRequest): Request<GoogleIdentityStsV1betaExchangeTokenResponse>;
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
const v1beta: V1betaResource;
|
|
285
|
+
}
|
|
286
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@maxim_mazurok/gapi.client.sts-v1beta",
|
|
3
|
+
"version": "0.0.20220806",
|
|
4
|
+
"description": "TypeScript typings for Security Token Service API v1beta",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"author": {
|
|
7
|
+
"email": "maxim@mazurok.com",
|
|
8
|
+
"name": "Maxim Mazurok",
|
|
9
|
+
"url": "https://maxim.mazurok.com"
|
|
10
|
+
},
|
|
11
|
+
"repository": {
|
|
12
|
+
"type": "git",
|
|
13
|
+
"url": "https://github.com/Maxim-Mazurok/google-api-typings-generator.git"
|
|
14
|
+
},
|
|
15
|
+
"types": "index.d.ts",
|
|
16
|
+
"dependencies": {
|
|
17
|
+
"@types/gapi.client": "*",
|
|
18
|
+
"@types/gapi.client.discovery": "*"
|
|
19
|
+
}
|
|
20
|
+
}
|
package/readme.md
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# TypeScript typings for Security Token Service API v1beta
|
|
2
|
+
|
|
3
|
+
The Security Token Service exchanges Google or third-party credentials for a short-lived access token to Google Cloud resources.
|
|
4
|
+
For detailed description please check [documentation](http://cloud.google.com/iam/docs/workload-identity-federation).
|
|
5
|
+
|
|
6
|
+
## Installing
|
|
7
|
+
|
|
8
|
+
Install typings for Security Token Service API:
|
|
9
|
+
|
|
10
|
+
```
|
|
11
|
+
npm install @types/gapi.client.sts-v1beta --save-dev
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Usage
|
|
15
|
+
|
|
16
|
+
You need to initialize Google API client in your code:
|
|
17
|
+
|
|
18
|
+
```typescript
|
|
19
|
+
gapi.load('client', () => {
|
|
20
|
+
// now we can use gapi.client
|
|
21
|
+
// ...
|
|
22
|
+
});
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Then load api client wrapper:
|
|
26
|
+
|
|
27
|
+
```typescript
|
|
28
|
+
gapi.client.load('https://sts.googleapis.com/$discovery/rest?version=v1beta', () => {
|
|
29
|
+
// now we can use:
|
|
30
|
+
// gapi.client.sts
|
|
31
|
+
});
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
```typescript
|
|
35
|
+
// Deprecated, use discovery document URL, see https://github.com/google/google-api-javascript-client/blob/master/docs/reference.md#----gapiclientloadname----version----callback--
|
|
36
|
+
gapi.client.load('sts', 'v1beta', () => {
|
|
37
|
+
// now we can use:
|
|
38
|
+
// gapi.client.sts
|
|
39
|
+
});
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
After that you can use Security Token Service API resources: <!-- TODO: make this work for multiple namespaces -->
|
|
45
|
+
|
|
46
|
+
```typescript
|
|
47
|
+
|
|
48
|
+
/*
|
|
49
|
+
Exchanges a credential for a Google OAuth 2.0 access token. The token asserts an external identity within a workload identity pool, or it applies a Credential Access Boundary to a Google access token. When you call this method, do not send the `Authorization` HTTP header in the request. This method does not require the `Authorization` header, and using the header can cause the request to fail.
|
|
50
|
+
*/
|
|
51
|
+
await gapi.client.sts.token({ });
|
|
52
|
+
```
|
package/tests.ts
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/* This is stub file for gapi.client.sts-v1beta definition tests */
|
|
2
|
+
// IMPORTANT
|
|
3
|
+
// This file was generated by https://github.com/Maxim-Mazurok/google-api-typings-generator. Please do not edit it manually.
|
|
4
|
+
// In case of any problems please post issue to https://github.com/Maxim-Mazurok/google-api-typings-generator
|
|
5
|
+
|
|
6
|
+
// Revision: 20220806
|
|
7
|
+
|
|
8
|
+
gapi.load('client', async () => {
|
|
9
|
+
/** now we can use gapi.client */
|
|
10
|
+
|
|
11
|
+
await gapi.client.load('https://sts.googleapis.com/$discovery/rest?version=v1beta');
|
|
12
|
+
/** now we can use gapi.client.sts */
|
|
13
|
+
|
|
14
|
+
run();
|
|
15
|
+
|
|
16
|
+
async function run() {
|
|
17
|
+
/**
|
|
18
|
+
* Exchanges a credential for a Google OAuth 2.0 access token. The token asserts an external identity within a workload identity pool, or it applies a Credential Access Boundary to a
|
|
19
|
+
* Google access token. When you call this method, do not send the `Authorization` HTTP header in the request. This method does not require the `Authorization` header, and using the header
|
|
20
|
+
* can cause the request to fail.
|
|
21
|
+
*/
|
|
22
|
+
await gapi.client.sts.v1beta.token({
|
|
23
|
+
}, {
|
|
24
|
+
audience: "Test string",
|
|
25
|
+
grantType: "Test string",
|
|
26
|
+
options: "Test string",
|
|
27
|
+
requestedTokenType: "Test string",
|
|
28
|
+
scope: "Test string",
|
|
29
|
+
subjectToken: "Test string",
|
|
30
|
+
subjectTokenType: "Test string",
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
});
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"module": "commonjs",
|
|
4
|
+
"lib": ["es6", "dom"],
|
|
5
|
+
"noImplicitAny": true,
|
|
6
|
+
"noImplicitThis": true,
|
|
7
|
+
"strictNullChecks": true,
|
|
8
|
+
"baseUrl": "../",
|
|
9
|
+
"typeRoots": [
|
|
10
|
+
"../"
|
|
11
|
+
],
|
|
12
|
+
"types": [],
|
|
13
|
+
"noEmit": true,
|
|
14
|
+
"forceConsistentCasingInFileNames": true,
|
|
15
|
+
"strictFunctionTypes": true
|
|
16
|
+
},
|
|
17
|
+
"files": ["index.d.ts", "tests.ts"]
|
|
18
|
+
}
|