0.0.20240514 • Published 1 day ago

@maxim_mazurok/gapi.client.cloudresourcemanager-v2 v0.0.20240514

Weekly downloads
-
License
MIT
Repository
github
Last release
1 day ago

TypeScript typings for Cloud Resource Manager API v2

Creates, reads, and updates metadata for Google Cloud Platform resource containers. For detailed description please check documentation.

Installing

Install typings for Cloud Resource Manager API:

npm install @types/gapi.client.cloudresourcemanager-v2 --save-dev

Usage

You need to initialize Google API client in your code:

gapi.load('client', () => {
  // now we can use gapi.client
  // ...
});

Then load api client wrapper:

gapi.client.load(
  'https://cloudresourcemanager.googleapis.com/$discovery/rest?version=v2',
  () => {
    // now we can use:
    // gapi.client.cloudresourcemanager
  }
);
// Deprecated, use discovery document URL, see https://github.com/google/google-api-javascript-client/blob/master/docs/reference.md#----gapiclientloadname----version----callback--
gapi.client.load('cloudresourcemanager', 'v2', () => {
  // now we can use:
  // gapi.client.cloudresourcemanager
});

Don't forget to authenticate your client before sending any request to resources:

// declare client_id registered in Google Developers Console
var client_id = '',
  scope = [
    // See, edit, configure, and delete your Google Cloud data and see the email address for your Google Account.
    'https://www.googleapis.com/auth/cloud-platform',

    // View your data across Google Cloud services and see the email address of your Google Account
    'https://www.googleapis.com/auth/cloud-platform.read-only',
  ],
  immediate = true;
// ...

gapi.auth.authorize(
  {client_id: client_id, scope: scope, immediate: immediate},
  authResult => {
    if (authResult && !authResult.error) {
      /* handle successful authorization */
    } else {
      /* handle authorization error */
    }
  }
);

After that you can use Cloud Resource Manager API resources:

/*
Creates a Folder in the resource hierarchy. Returns an Operation which can be used to track the progress of the folder creation workflow. Upon success the Operation.response field will be populated with the created Folder. In order to succeed, the addition of this new Folder must not violate the Folder naming, height or fanout constraints. + The Folder's display_name must be distinct from all other Folders that share its parent. + The addition of the Folder must not cause the active Folder hierarchy to exceed a height of 10. Note, the full active + deleted Folder hierarchy is allowed to reach a height of 20; this provides additional headroom when moving folders that contain deleted folders. + The addition of the Folder must not cause the total number of Folders under its parent to exceed 300. If the operation fails due to a folder constraint violation, some errors may be returned by the CreateFolder request, with status code FAILED_PRECONDITION and an error description. Other folder constraint violations will be communicated in the Operation, with the specific PreconditionFailure returned via the details list in the Operation.error field. The caller must have `resourcemanager.folders.create` permission on the identified parent.
*/
await gapi.client.cloudresourcemanager.folders.create({});

/*
Requests deletion of a Folder. The Folder is moved into the DELETE_REQUESTED state immediately, and is deleted approximately 30 days later. This method may only be called on an empty Folder in the ACTIVE state, where a Folder is empty if it doesn't contain any Folders or Projects in the ACTIVE state. The caller must have `resourcemanager.folders.delete` permission on the identified folder.
*/
await gapi.client.cloudresourcemanager.folders.delete({name: 'name'});

/*
Retrieves a Folder identified by the supplied resource name. Valid Folder resource names have the format `folders/{folder_id}` (for example, `folders/1234`). The caller must have `resourcemanager.folders.get` permission on the identified folder.
*/
await gapi.client.cloudresourcemanager.folders.get({name: 'name'});

/*
Gets the access control policy for a Folder. The returned policy may be empty if no such policy or resource exists. The `resource` field should be the Folder's resource name, e.g. "folders/1234". The caller must have `resourcemanager.folders.getIamPolicy` permission on the identified folder.
*/
await gapi.client.cloudresourcemanager.folders.getIamPolicy({
  resource: 'resource',
});

/*
Lists the Folders that are direct descendants of supplied parent resource. List provides a strongly consistent view of the Folders underneath the specified parent resource. List returns Folders sorted based upon the (ascending) lexical ordering of their display_name. The caller must have `resourcemanager.folders.list` permission on the identified parent.
*/
await gapi.client.cloudresourcemanager.folders.list({});

/*
Moves a Folder under a new resource parent. Returns an Operation which can be used to track the progress of the folder move workflow. Upon success the Operation.response field will be populated with the moved Folder. Upon failure, a FolderOperationError categorizing the failure cause will be returned - if the failure occurs synchronously then the FolderOperationError will be returned via the Status.details field and if it occurs asynchronously then the FolderOperation will be returned via the Operation.error field. In addition, the Operation.metadata field will be populated with a FolderOperation message as an aid to stateless clients. Folder moves will be rejected if they violate either the naming, height or fanout constraints described in the CreateFolder documentation. The caller must have `resourcemanager.folders.move` permission on the folder's current and proposed new parent.
*/
await gapi.client.cloudresourcemanager.folders.move({name: 'name'});

/*
Updates a Folder, changing its display_name. Changes to the folder display_name will be rejected if they violate either the display_name formatting rules or naming constraints described in the CreateFolder documentation. The Folder's display name must start and end with a letter or digit, may contain letters, digits, spaces, hyphens and underscores and can be between 3 and 30 characters. This is captured by the regular expression: `\p{L}\p{N}{1,28}[\p{L}\p{N}]`. The caller must have `resourcemanager.folders.update` permission on the identified folder. If the update fails due to the unique name constraint then a PreconditionFailure explaining this violation will be returned in the Status.details field.
*/
await gapi.client.cloudresourcemanager.folders.patch({name: 'name'});

/*
Search for folders that match specific filter criteria. Search provides an eventually consistent view of the folders a user has access to which meet the specified filter criteria. This will only return folders on which the caller has the permission `resourcemanager.folders.get`.
*/
await gapi.client.cloudresourcemanager.folders.search({});

/*
Sets the access control policy on a Folder, replacing any existing policy. The `resource` field should be the Folder's resource name, e.g. "folders/1234". The caller must have `resourcemanager.folders.setIamPolicy` permission on the identified folder.
*/
await gapi.client.cloudresourcemanager.folders.setIamPolicy({
  resource: 'resource',
});

/*
Returns permissions that a caller has on the specified Folder. The `resource` field should be the Folder's resource name, e.g. "folders/1234". There are no permissions required for making this API call.
*/
await gapi.client.cloudresourcemanager.folders.testIamPermissions({
  resource: 'resource',
});

/*
Cancels the deletion request for a Folder. This method may only be called on a Folder in the DELETE_REQUESTED state. In order to succeed, the Folder's parent must be in the ACTIVE state. In addition, reintroducing the folder into the tree must not violate folder naming, height and fanout constraints described in the CreateFolder documentation. The caller must have `resourcemanager.folders.undelete` permission on the identified folder.
*/
await gapi.client.cloudresourcemanager.folders.undelete({name: 'name'});

/*
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.
*/
await gapi.client.cloudresourcemanager.operations.get({name: 'name'});
0.0.20240514

1 day ago

0.0.20240512

8 days ago

0.0.20240502

14 days ago

0.0.20240428

22 days ago

0.0.20240421

29 days ago

0.0.20240414

1 month ago

0.0.20240310

2 months ago

0.0.20240303

3 months ago

0.0.20240222

3 months ago

0.0.20240218

3 months ago

0.0.20240211

3 months ago

0.0.20240204

4 months ago

0.0.20240128

4 months ago

0.0.20240109

4 months ago

0.0.20231208

4 months ago

0.0.20231207

5 months ago

0.0.20231203

6 months ago

0.0.20230917

8 months ago

0.0.20230810

9 months ago

0.0.20230711

10 months ago

0.0.20230910

8 months ago

0.0.20230731

10 months ago

0.0.20231008

8 months ago

0.0.20230930

8 months ago

0.0.20230709

11 months ago

0.0.20230806

10 months ago

0.0.20230723

10 months ago

0.0.20230903

9 months ago

0.0.20231022

7 months ago

0.0.20231102

7 months ago

0.0.20231025

7 months ago

0.0.20230625

11 months ago

0.0.20230514

1 year ago

0.0.20230521

12 months ago

0.0.20230607

11 months ago

0.0.20230528

12 months ago

0.0.20230507

1 year ago

0.0.20230430

1 year ago

0.0.20230416

1 year ago

0.0.20230420

1 year ago

0.0.20230409

1 year ago

0.0.20230403

1 year ago

0.0.20230312

1 year ago

0.0.20230205

1 year ago

0.0.20230129

1 year ago

0.0.20230219

1 year ago

0.0.20230210

1 year ago

0.0.20230115

1 year ago

0.0.20221113

2 years ago

0.0.20230108

1 year ago

0.0.20230103

1 year ago

0.0.20221108

2 years ago

0.0.20230122

1 year ago

0.0.20221020

2 years ago

0.0.20221016

2 years ago

0.0.20220828

2 years ago

0.0.20220821

2 years ago

0.0.20220911

2 years ago

0.0.20220901

2 years ago

0.0.20220925

2 years ago

0.0.20220914

2 years ago

0.0.20220814

2 years ago

0.0.20220807

2 years ago