@maxim_mazurok/gapi.client.accesscontextmanager-v1 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/package.json ADDED
@@ -0,0 +1,20 @@
1
+ {
2
+ "name": "@maxim_mazurok/gapi.client.accesscontextmanager-v1",
3
+ "version": "0.0.20220806",
4
+ "description": "TypeScript typings for Access Context Manager API v1",
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,128 @@
1
+ # TypeScript typings for Access Context Manager API v1
2
+
3
+ An API for setting attribute based access control to requests to GCP services.
4
+ For detailed description please check [documentation](https://cloud.google.com/access-context-manager/docs/reference/rest/).
5
+
6
+ ## Installing
7
+
8
+ Install typings for Access Context Manager API:
9
+
10
+ ```
11
+ npm install @types/gapi.client.accesscontextmanager-v1 --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://accesscontextmanager.googleapis.com/$discovery/rest?version=v1', () => {
29
+ // now we can use:
30
+ // gapi.client.accesscontextmanager
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('accesscontextmanager', 'v1', () => {
37
+ // now we can use:
38
+ // gapi.client.accesscontextmanager
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 Access Context Manager API resources: <!-- TODO: make this work for multiple namespaces -->
66
+
67
+ ```typescript
68
+
69
+ /*
70
+ Creates an access policy. This method fails if the organization already has an access policy. The long-running operation has a successful status after the access policy propagates to long-lasting storage. Syntactic and basic semantic errors are returned in `metadata` as a BadRequest proto.
71
+ */
72
+ await gapi.client.accesscontextmanager.accessPolicies.create({ });
73
+
74
+ /*
75
+ Deletes an access policy based on the resource name. The long-running operation has a successful status after the access policy is removed from long-lasting storage.
76
+ */
77
+ await gapi.client.accesscontextmanager.accessPolicies.delete({ name: "name", });
78
+
79
+ /*
80
+ Returns an access policy based on the name.
81
+ */
82
+ await gapi.client.accesscontextmanager.accessPolicies.get({ name: "name", });
83
+
84
+ /*
85
+ Gets the IAM policy for the specified Access Context Manager access policy.
86
+ */
87
+ await gapi.client.accesscontextmanager.accessPolicies.getIamPolicy({ resource: "resource", });
88
+
89
+ /*
90
+ Lists all access policies in an organization.
91
+ */
92
+ await gapi.client.accesscontextmanager.accessPolicies.list({ });
93
+
94
+ /*
95
+ Updates an access policy. The long-running operation from this RPC has a successful status after the changes to the access policy propagate to long-lasting storage.
96
+ */
97
+ await gapi.client.accesscontextmanager.accessPolicies.patch({ name: "name", });
98
+
99
+ /*
100
+ Sets the IAM policy for the specified Access Context Manager access policy. This method replaces the existing IAM policy on the access policy. The IAM policy controls the set of users who can perform specific operations on the Access Context Manager access policy.
101
+ */
102
+ await gapi.client.accesscontextmanager.accessPolicies.setIamPolicy({ resource: "resource", });
103
+
104
+ /*
105
+ Returns the IAM permissions that the caller has on the specified Access Context Manager resource. The resource can be an AccessPolicy, AccessLevel, or ServicePerimeter. This method does not support other resources.
106
+ */
107
+ await gapi.client.accesscontextmanager.accessPolicies.testIamPermissions({ resource: "resource", });
108
+
109
+ /*
110
+ Starts asynchronous cancellation on a long-running operation. The server makes a best effort to cancel the operation, but success is not guaranteed. If the server doesn't support this method, it returns `google.rpc.Code.UNIMPLEMENTED`. Clients can use Operations.GetOperation or other methods to check whether the cancellation succeeded or whether the operation completed despite cancellation. On successful cancellation, the operation is not deleted; instead, it becomes an operation with an Operation.error value with a google.rpc.Status.code of 1, corresponding to `Code.CANCELLED`.
111
+ */
112
+ await gapi.client.accesscontextmanager.operations.cancel({ name: "name", });
113
+
114
+ /*
115
+ Deletes a long-running operation. This method indicates that the client is no longer interested in the operation result. It does not cancel the operation. If the server doesn't support this method, it returns `google.rpc.Code.UNIMPLEMENTED`.
116
+ */
117
+ await gapi.client.accesscontextmanager.operations.delete({ name: "name", });
118
+
119
+ /*
120
+ 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.
121
+ */
122
+ await gapi.client.accesscontextmanager.operations.get({ name: "name", });
123
+
124
+ /*
125
+ Lists operations that match the specified filter in the request. If the server doesn't support this method, it returns `UNIMPLEMENTED`. NOTE: the `name` binding allows API services to override the binding to use different resource name schemes, such as `users/*/operations`. To override the binding, API services can add a binding such as `"/v1/{name=users/*}/operations"` to their service configuration. For backwards compatibility, the default name includes the operations collection id, however overriding users must ensure the name binding is the parent resource, without the operations collection id.
126
+ */
127
+ await gapi.client.accesscontextmanager.operations.list({ name: "name", });
128
+ ```