@maxim_mazurok/gapi.client.iap-v1beta1 0.0.20220805

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 ADDED
@@ -0,0 +1,228 @@
1
+ /* Type definitions for non-npm package Cloud Identity-Aware Proxy API v1beta1 0.0 */
2
+ // Project: https://cloud.google.com/iap
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://iap.googleapis.com/$discovery/rest?version=v1beta1
13
+ // Revision: 20220805
14
+
15
+ /// <reference types="gapi.client" />
16
+
17
+ declare namespace gapi.client {
18
+ /** Load Cloud Identity-Aware Proxy API v1beta1 */
19
+ function load(urlOrObject: "https://iap.googleapis.com/$discovery/rest?version=v1beta1"): Promise<void>;
20
+ /** @deprecated Please load APIs with discovery documents. */
21
+ function load(name: "iap", version: "v1beta1"): Promise<void>;
22
+ /** @deprecated Please load APIs with discovery documents. */
23
+ function load(name: "iap", version: "v1beta1", callback: () => any): void;
24
+
25
+ namespace iap {
26
+ interface Binding {
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?: Expr;
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 Expr {
53
+ /** Optional. Description of the expression. This is a longer text which describes the expression, e.g. when hovered over it in a UI. */
54
+ description?: string;
55
+ /** Textual representation of an expression in Common Expression Language syntax. */
56
+ expression?: string;
57
+ /** Optional. String indicating the location of the expression for error reporting, e.g. a file name and a position in the file. */
58
+ location?: string;
59
+ /** 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. */
60
+ title?: string;
61
+ }
62
+ interface GetIamPolicyRequest {
63
+ /** OPTIONAL: A `GetPolicyOptions` object for specifying options to `GetIamPolicy`. */
64
+ options?: GetPolicyOptions;
65
+ }
66
+ interface GetPolicyOptions {
67
+ /**
68
+ * Optional. The maximum policy version that will be used to format the policy. Valid values are 0, 1, and 3. Requests specifying an invalid value will be rejected. Requests for
69
+ * policies with any conditional role bindings must specify version 3. Policies with no conditional role bindings may specify any valid value or leave the field unset. The policy in
70
+ * the response might use the policy version that you specified, or it might use a lower policy version. For example, if you specify version 3, but the policy has no conditional role
71
+ * bindings, the response uses version 1. To learn which resources support conditions in their IAM policies, see the [IAM
72
+ * documentation](https://cloud.google.com/iam/help/conditions/resource-policies).
73
+ */
74
+ requestedPolicyVersion?: number;
75
+ }
76
+ interface Policy {
77
+ /**
78
+ * Associates a list of `members`, or principals, with a `role`. Optionally, may specify a `condition` that determines how and when the `bindings` are applied. Each of the `bindings`
79
+ * must contain at least one principal. The `bindings` in a `Policy` can refer to up to 1,500 principals; up to 250 of these principals can be Google groups. Each occurrence of a
80
+ * principal counts towards these limits. For example, if the `bindings` grant 50 different roles to `user:alice@example.com`, and not to any other principal, then you can add another
81
+ * 1,450 principals to the `bindings` in the `Policy`.
82
+ */
83
+ bindings?: Binding[];
84
+ /**
85
+ * `etag` is used for optimistic concurrency control as a way to help prevent simultaneous updates of a policy from overwriting each other. It is strongly suggested that systems make
86
+ * use of the `etag` in the read-modify-write cycle to perform policy updates in order to avoid race conditions: An `etag` is returned in the response to `getIamPolicy`, and systems
87
+ * are expected to put that etag in the request to `setIamPolicy` to ensure that their change will be applied to the same version of the policy. **Important:** If you use IAM
88
+ * Conditions, you must include the `etag` field whenever you call `setIamPolicy`. If you omit this field, then IAM allows you to overwrite a version `3` policy with a version `1`
89
+ * policy, and all of the conditions in the version `3` policy are lost.
90
+ */
91
+ etag?: string;
92
+ /**
93
+ * Specifies the format of the policy. Valid values are `0`, `1`, and `3`. Requests that specify an invalid value are rejected. Any operation that affects conditional role bindings
94
+ * must specify version `3`. This requirement applies to the following operations: * Getting a policy that includes a conditional role binding * Adding a conditional role binding to a
95
+ * policy * Changing a conditional role binding in a policy * Removing any role binding, with or without a condition, from a policy that includes conditions **Important:** If you use
96
+ * IAM Conditions, you must include the `etag` field whenever you call `setIamPolicy`. If you omit this field, then IAM allows you to overwrite a version `3` policy with a version `1`
97
+ * policy, and all of the conditions in the version `3` policy are lost. If a policy does not include any conditions, operations on that policy may specify any valid version or leave
98
+ * the field unset. To learn which resources support conditions in their IAM policies, see the [IAM documentation](https://cloud.google.com/iam/help/conditions/resource-policies).
99
+ */
100
+ version?: number;
101
+ }
102
+ interface SetIamPolicyRequest {
103
+ /**
104
+ * REQUIRED: The complete policy to be applied to the `resource`. The size of the policy is limited to a few 10s of KB. An empty policy is a valid policy but certain Google Cloud
105
+ * services (such as Projects) might reject them.
106
+ */
107
+ policy?: Policy;
108
+ }
109
+ interface TestIamPermissionsRequest {
110
+ /**
111
+ * The set of permissions to check for the `resource`. Permissions with wildcards (such as `*` or `storage.*`) are not allowed. For more information see [IAM
112
+ * Overview](https://cloud.google.com/iam/docs/overview#permissions).
113
+ */
114
+ permissions?: string[];
115
+ }
116
+ interface TestIamPermissionsResponse {
117
+ /** A subset of `TestPermissionsRequest.permissions` that the caller is allowed. */
118
+ permissions?: string[];
119
+ }
120
+ interface V1beta1Resource {
121
+ /**
122
+ * Gets the access control policy for an Identity-Aware Proxy protected resource. More information about managing access via IAP can be found at:
123
+ * https://cloud.google.com/iap/docs/managing-access#managing_access_via_the_api
124
+ */
125
+ getIamPolicy(request: {
126
+ /** V1 error format. */
127
+ "$.xgafv"?: string;
128
+ /** OAuth access token. */
129
+ access_token?: string;
130
+ /** Data format for response. */
131
+ alt?: string;
132
+ /** JSONP */
133
+ callback?: string;
134
+ /** Selector specifying which fields to include in a partial response. */
135
+ fields?: string;
136
+ /** 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. */
137
+ key?: string;
138
+ /** OAuth 2.0 token for the current user. */
139
+ oauth_token?: string;
140
+ /** Returns response with indentations and line breaks. */
141
+ prettyPrint?: boolean;
142
+ /** 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. */
143
+ quotaUser?: string;
144
+ /**
145
+ * REQUIRED: The resource for which the policy is being requested. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this
146
+ * field.
147
+ */
148
+ resource: string;
149
+ /** Upload protocol for media (e.g. "raw", "multipart"). */
150
+ upload_protocol?: string;
151
+ /** Legacy upload protocol for media (e.g. "media", "multipart"). */
152
+ uploadType?: string;
153
+ },
154
+ body: GetIamPolicyRequest): Request<Policy>;
155
+ /**
156
+ * Sets the access control policy for an Identity-Aware Proxy protected resource. Replaces any existing policy. More information about managing access via IAP can be found at:
157
+ * https://cloud.google.com/iap/docs/managing-access#managing_access_via_the_api
158
+ */
159
+ setIamPolicy(request: {
160
+ /** V1 error format. */
161
+ "$.xgafv"?: string;
162
+ /** OAuth access token. */
163
+ access_token?: string;
164
+ /** Data format for response. */
165
+ alt?: string;
166
+ /** JSONP */
167
+ callback?: string;
168
+ /** Selector specifying which fields to include in a partial response. */
169
+ fields?: string;
170
+ /** 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. */
171
+ key?: string;
172
+ /** OAuth 2.0 token for the current user. */
173
+ oauth_token?: string;
174
+ /** Returns response with indentations and line breaks. */
175
+ prettyPrint?: boolean;
176
+ /** 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. */
177
+ quotaUser?: string;
178
+ /**
179
+ * REQUIRED: The resource for which the policy is being specified. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this
180
+ * field.
181
+ */
182
+ resource: string;
183
+ /** Upload protocol for media (e.g. "raw", "multipart"). */
184
+ upload_protocol?: string;
185
+ /** Legacy upload protocol for media (e.g. "media", "multipart"). */
186
+ uploadType?: string;
187
+ },
188
+ body: SetIamPolicyRequest): Request<Policy>;
189
+ /**
190
+ * Returns permissions that a caller has on the Identity-Aware Proxy protected resource. If the resource does not exist or the caller does not have Identity-Aware Proxy permissions a
191
+ * [google.rpc.Code.PERMISSION_DENIED] will be returned. More information about managing access via IAP can be found at:
192
+ * https://cloud.google.com/iap/docs/managing-access#managing_access_via_the_api
193
+ */
194
+ testIamPermissions(request: {
195
+ /** V1 error format. */
196
+ "$.xgafv"?: string;
197
+ /** OAuth access token. */
198
+ access_token?: string;
199
+ /** Data format for response. */
200
+ alt?: string;
201
+ /** JSONP */
202
+ callback?: string;
203
+ /** Selector specifying which fields to include in a partial response. */
204
+ fields?: string;
205
+ /** 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. */
206
+ key?: string;
207
+ /** OAuth 2.0 token for the current user. */
208
+ oauth_token?: string;
209
+ /** Returns response with indentations and line breaks. */
210
+ prettyPrint?: boolean;
211
+ /** 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. */
212
+ quotaUser?: string;
213
+ /**
214
+ * REQUIRED: The resource for which the policy detail is being requested. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for
215
+ * this field.
216
+ */
217
+ resource: string;
218
+ /** Upload protocol for media (e.g. "raw", "multipart"). */
219
+ upload_protocol?: string;
220
+ /** Legacy upload protocol for media (e.g. "media", "multipart"). */
221
+ uploadType?: string;
222
+ },
223
+ body: TestIamPermissionsRequest): Request<TestIamPermissionsResponse>;
224
+ }
225
+
226
+ const v1beta1: V1beta1Resource;
227
+ }
228
+ }
package/package.json ADDED
@@ -0,0 +1,20 @@
1
+ {
2
+ "name": "@maxim_mazurok/gapi.client.iap-v1beta1",
3
+ "version": "0.0.20220805",
4
+ "description": "TypeScript typings for Cloud Identity-Aware Proxy API v1beta1",
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,83 @@
1
+ # TypeScript typings for Cloud Identity-Aware Proxy API v1beta1
2
+
3
+ Controls access to cloud applications running on Google Cloud Platform.
4
+ For detailed description please check [documentation](https://cloud.google.com/iap).
5
+
6
+ ## Installing
7
+
8
+ Install typings for Cloud Identity-Aware Proxy API:
9
+
10
+ ```
11
+ npm install @types/gapi.client.iap-v1beta1 --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://iap.googleapis.com/$discovery/rest?version=v1beta1', () => {
29
+ // now we can use:
30
+ // gapi.client.iap
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('iap', 'v1beta1', () => {
37
+ // now we can use:
38
+ // gapi.client.iap
39
+ });
40
+ ```
41
+
42
+ Don't forget to authenticate your client before sending any request to resources:
43
+
44
+ ```typescript
45
+ // declare client_id registered in Google Developers Console
46
+ var client_id = '',
47
+ scope = [
48
+ // See, edit, configure, and delete your Google Cloud data and see the email address for your Google Account.
49
+ 'https://www.googleapis.com/auth/cloud-platform',
50
+ ],
51
+ immediate = true;
52
+ // ...
53
+
54
+ gapi.auth.authorize(
55
+ { client_id: client_id, scope: scope, immediate: immediate },
56
+ authResult => {
57
+ if (authResult && !authResult.error) {
58
+ /* handle successful authorization */
59
+ } else {
60
+ /* handle authorization error */
61
+ }
62
+ });
63
+ ```
64
+
65
+ After that you can use Cloud Identity-Aware Proxy API resources: <!-- TODO: make this work for multiple namespaces -->
66
+
67
+ ```typescript
68
+
69
+ /*
70
+ Gets the access control policy for an Identity-Aware Proxy protected resource. More information about managing access via IAP can be found at: https://cloud.google.com/iap/docs/managing-access#managing_access_via_the_api
71
+ */
72
+ await gapi.client.iap.getIamPolicy({ resource: "resource", });
73
+
74
+ /*
75
+ Sets the access control policy for an Identity-Aware Proxy protected resource. Replaces any existing policy. More information about managing access via IAP can be found at: https://cloud.google.com/iap/docs/managing-access#managing_access_via_the_api
76
+ */
77
+ await gapi.client.iap.setIamPolicy({ resource: "resource", });
78
+
79
+ /*
80
+ Returns permissions that a caller has on the Identity-Aware Proxy protected resource. If the resource does not exist or the caller does not have Identity-Aware Proxy permissions a [google.rpc.Code.PERMISSION_DENIED] will be returned. More information about managing access via IAP can be found at: https://cloud.google.com/iap/docs/managing-access#managing_access_via_the_api
81
+ */
82
+ await gapi.client.iap.testIamPermissions({ resource: "resource", });
83
+ ```
package/tests.ts ADDED
@@ -0,0 +1,82 @@
1
+ /* This is stub file for gapi.client.iap-v1beta1 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: 20220805
7
+
8
+ gapi.load('client', async () => {
9
+ /** now we can use gapi.client */
10
+
11
+ await gapi.client.load('https://iap.googleapis.com/$discovery/rest?version=v1beta1');
12
+ /** now we can use gapi.client.iap */
13
+
14
+ /** don't forget to authenticate your client before sending any request to resources: */
15
+ /** declare client_id registered in Google Developers Console */
16
+ const client_id = '<<PUT YOUR CLIENT ID HERE>>';
17
+ const scope = [
18
+ /** See, edit, configure, and delete your Google Cloud data and see the email address for your Google Account. */
19
+ 'https://www.googleapis.com/auth/cloud-platform',
20
+ ];
21
+ const immediate = false;
22
+ gapi.auth.authorize({ client_id, scope, immediate }, authResult => {
23
+ if (authResult && !authResult.error) {
24
+ /** handle successful authorization */
25
+ run();
26
+ } else {
27
+ /** handle authorization error */
28
+ }
29
+ });
30
+
31
+ async function run() {
32
+ /**
33
+ * Gets the access control policy for an Identity-Aware Proxy protected resource. More information about managing access via IAP can be found at:
34
+ * https://cloud.google.com/iap/docs/managing-access#managing_access_via_the_api
35
+ */
36
+ await gapi.client.iap.v1beta1.getIamPolicy({
37
+ resource: "Test string",
38
+ }, {
39
+ options: {
40
+ requestedPolicyVersion: 42,
41
+ },
42
+ });
43
+ /**
44
+ * Sets the access control policy for an Identity-Aware Proxy protected resource. Replaces any existing policy. More information about managing access via IAP can be found at:
45
+ * https://cloud.google.com/iap/docs/managing-access#managing_access_via_the_api
46
+ */
47
+ await gapi.client.iap.v1beta1.setIamPolicy({
48
+ resource: "Test string",
49
+ }, {
50
+ policy: {
51
+ bindings: [
52
+ {
53
+ condition: {
54
+ description: "Test string",
55
+ expression: "Test string",
56
+ location: "Test string",
57
+ title: "Test string",
58
+ },
59
+ members: [
60
+ "Test string"
61
+ ],
62
+ role: "Test string",
63
+ }
64
+ ],
65
+ etag: "Test string",
66
+ version: 42,
67
+ },
68
+ });
69
+ /**
70
+ * Returns permissions that a caller has on the Identity-Aware Proxy protected resource. If the resource does not exist or the caller does not have Identity-Aware Proxy permissions a
71
+ * [google.rpc.Code.PERMISSION_DENIED] will be returned. More information about managing access via IAP can be found at:
72
+ * https://cloud.google.com/iap/docs/managing-access#managing_access_via_the_api
73
+ */
74
+ await gapi.client.iap.v1beta1.testIamPermissions({
75
+ resource: "Test string",
76
+ }, {
77
+ permissions: [
78
+ "Test string"
79
+ ],
80
+ });
81
+ }
82
+ });
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
+ }
package/tslint.json ADDED
@@ -0,0 +1,6 @@
1
+ {
2
+ "extends": "dtslint/dtslint.json",
3
+ "rules": {
4
+ "no-redundant-jsdoc": false
5
+ }
6
+ }