0.0.20240505 • Published 3 days ago

@maxim_mazurok/gapi.client.serviceusage-v1 v0.0.20240505

Weekly downloads
-
License
MIT
Repository
github
Last release
3 days ago

TypeScript typings for Service Usage API v1

Enables services that service consumers want to use on Google Cloud Platform, lists the available or enabled services, or disables services that service consumers no longer use. For detailed description please check documentation.

Installing

Install typings for Service Usage API:

npm install @types/gapi.client.serviceusage-v1 --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://serviceusage.googleapis.com/$discovery/rest?version=v1',
  () => {
    // now we can use:
    // gapi.client.serviceusage
  }
);
// 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('serviceusage', 'v1', () => {
  // now we can use:
  // gapi.client.serviceusage
});

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',

    // Manage your Google API service configuration
    'https://www.googleapis.com/auth/service.management',
  ],
  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 Service Usage API resources:

/*
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`.
*/
await gapi.client.serviceusage.operations.cancel({name: 'name'});

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

/*
Lists operations that match the specified filter in the request. If the server doesn't support this method, it returns `UNIMPLEMENTED`.
*/
await gapi.client.serviceusage.operations.list({});

/*
Enable multiple services on a project. The operation is atomic: if enabling any service fails, then the entire batch fails, and no state changes occur. To enable a single service, use the `EnableService` method instead.
*/
await gapi.client.serviceusage.services.batchEnable({parent: 'parent'});

/*
Returns the service configurations and enabled states for a given list of services.
*/
await gapi.client.serviceusage.services.batchGet({parent: 'parent'});

/*
Disable a service so that it can no longer be used with a project. This prevents unintended usage that may cause unexpected billing charges or security leaks. It is not valid to call the disable method on a service that is not currently enabled. Callers will receive a `FAILED_PRECONDITION` status if the target service is not currently enabled.
*/
await gapi.client.serviceusage.services.disable({name: 'name'});

/*
Enable a service so that it can be used with a project.
*/
await gapi.client.serviceusage.services.enable({name: 'name'});

/*
Returns the service configuration and enabled state for a given service.
*/
await gapi.client.serviceusage.services.get({name: 'name'});

/*
List all services available to the specified project, and the current state of those services with respect to the project. The list includes all public services, all services for which the calling user has the `servicemanagement.services.bind` permission, and all services that have already been enabled on the project. The list can be filtered to only include services in a specific state, for example to only include services enabled on the project. WARNING: If you need to query enabled services frequently or across an organization, you should use [Cloud Asset Inventory API](https://cloud.google.com/asset-inventory/docs/apis), which provides higher throughput and richer filtering capability.
*/
await gapi.client.serviceusage.services.list({parent: 'parent'});
0.0.20240505

3 days ago

0.0.20240429

9 days ago

0.0.20240422

16 days ago

0.0.20240414

24 days ago

0.0.20240331

1 month ago

0.0.20240324

2 months ago

0.0.20240319

2 months ago

0.0.20240317

2 months ago

0.0.20240310

2 months ago

0.0.20240303

2 months ago

0.0.20240226

2 months ago

0.0.20240220

3 months ago

0.0.20240211

3 months ago

0.0.20240206

3 months ago

0.0.20240201

3 months ago

0.0.20240129

3 months ago

0.0.20240125

4 months ago

0.0.20240123

4 months ago

0.0.20240116

4 months ago

0.0.20240115

4 months ago

0.0.20240109

4 months ago

0.0.20240107

4 months ago

0.0.20240103

4 months ago

0.0.20240102

4 months ago

0.0.20231218

5 months ago

0.0.20231217

5 months ago

0.0.20231213

5 months ago

0.0.20231212

5 months ago

0.0.20231211

5 months ago

0.0.20231210

5 months ago

0.0.20231204

5 months ago

0.0.20231203

5 months ago

0.0.20231128

5 months ago

0.0.20230816

9 months ago

0.0.20231106

6 months ago

0.0.20231105

6 months ago

0.0.20230811

9 months ago

0.0.20230815

9 months ago

0.0.20231113

6 months ago

0.0.20231114

6 months ago

0.0.20230807

9 months ago

0.0.20230926

8 months ago

0.0.20230927

7 months ago

0.0.20230806

9 months ago

0.0.20230920

8 months ago

0.0.20230925

8 months ago

0.0.20230923

8 months ago

0.0.20231101

6 months ago

0.0.20230719

10 months ago

0.0.20230717

10 months ago

0.0.20230718

10 months ago

0.0.20230711

10 months ago

0.0.20230712

10 months ago

0.0.20231009

7 months ago

0.0.20230710

10 months ago

0.0.20230716

10 months ago

0.0.20231011

7 months ago

0.0.20231015

7 months ago

0.0.20230708

10 months ago

0.0.20230827

8 months ago

0.0.20230822

9 months ago

0.0.20230820

9 months ago

0.0.20230704

10 months ago

0.0.20230705

10 months ago

0.0.20230823

9 months ago

0.0.20231001

7 months ago

0.0.20231003

7 months ago

0.0.20231002

7 months ago

0.0.20231029

6 months ago

0.0.20230731

9 months ago

0.0.20231031

6 months ago

0.0.20231030

6 months ago

0.0.20230729

9 months ago

0.0.20231018

7 months ago

0.0.20231017

7 months ago

0.0.20230723

10 months ago

0.0.20231019

7 months ago

0.0.20230724

10 months ago

0.0.20230725

10 months ago

0.0.20231025

7 months ago

0.0.20230918

8 months ago

0.0.20230913

8 months ago

0.0.20230912

8 months ago

0.0.20230907

8 months ago

0.0.20230627

11 months ago

0.0.20230625

11 months ago

0.0.20230626

11 months ago

0.0.20230523

12 months ago

0.0.20230531

11 months ago

0.0.20230530

11 months ago

0.0.20230428

1 year ago

0.0.20230619

11 months ago

0.0.20230612

11 months ago

0.0.20230611

11 months ago

0.0.20230620

11 months ago

0.0.20230607

11 months ago

0.0.20230605

11 months ago

0.0.20230603

11 months ago

0.0.20230514

12 months ago

0.0.20230517

12 months ago

0.0.20230515

12 months ago

0.0.20230516

12 months ago

0.0.20230521

12 months ago

0.0.20230508

1 year ago

0.0.20230509

1 year ago

0.0.20230502

1 year ago

0.0.20230503

1 year ago

0.0.20230621

11 months ago

0.0.20230501

1 year ago

0.0.20230510

12 months ago

0.0.20230412

1 year ago

0.0.20230418

1 year ago

0.0.20230419

1 year ago

0.0.20230417

1 year ago

0.0.20230301

1 year ago

0.0.20230409

1 year ago

0.0.20230404

1 year ago

0.0.20230405

1 year ago

0.0.20230328

1 year ago

0.0.20230329

1 year ago

0.0.20230330

1 year ago

0.0.20230410

1 year ago

0.0.20230314

1 year ago

0.0.20230322

1 year ago

0.0.20230304

1 year ago

0.0.20230426

1 year ago

0.0.20230226

1 year ago

0.0.20230309

1 year ago

0.0.20230307

1 year ago

0.0.20230216

1 year ago

0.0.20230214

1 year ago

0.0.20230215

1 year ago

0.0.20230220

1 year ago

0.0.20230221

1 year ago

0.0.20230206

1 year ago

0.0.20230209

1 year ago

0.0.20230207

1 year ago

0.0.20230208

1 year ago

0.0.20230131

1 year ago

0.0.20230212

1 year ago

0.0.20230201

1 year ago

0.0.20221115

1 year ago

0.0.20221114

1 year ago

0.0.20221112

1 year ago

0.0.20221109

1 year ago

0.0.20230103

1 year ago

0.0.20221108

2 years ago

0.0.20221107

2 years ago

0.0.20221106

2 years ago

0.0.20221221

1 year ago

0.0.20221220

1 year ago

0.0.20221219

1 year ago

0.0.20221218

1 year ago

0.0.20221130

1 year ago

0.0.20230117

1 year ago

0.0.20230118

1 year ago

0.0.20230116

1 year ago

0.0.20221212

1 year ago

0.0.20221210

1 year ago

0.0.20230124

1 year ago

0.0.20230125

1 year ago

0.0.20221207

1 year ago

0.0.20230123

1 year ago

0.0.20221204

1 year ago

0.0.20230108

1 year ago

0.0.20230109

1 year ago

0.0.20230110

1 year ago

0.0.20230111

1 year ago

0.0.20221117

1 year ago

0.0.20221031

2 years ago

0.0.20221017

2 years ago

0.0.20221016

2 years ago

0.0.20221029

2 years ago

0.0.20221026

2 years ago

0.0.20221102

2 years ago

0.0.20221025

2 years ago

0.0.20221101

2 years ago

0.0.20221024

2 years ago

0.0.20221023

2 years ago

0.0.20220928

2 years ago

0.0.20220929

2 years ago

0.0.20221019

2 years ago

0.0.20221018

2 years ago

0.0.20220916

2 years ago

0.0.20220829

2 years ago

0.0.20220907

2 years ago

0.0.20220819

2 years ago

0.0.20220919

2 years ago

0.0.20220831

2 years ago

0.0.20220920

2 years ago

0.0.20220921

2 years ago

0.0.20220823

2 years ago

0.0.20220912

2 years ago

0.0.20220914

2 years ago

0.0.20220826

2 years ago

0.0.20220926

2 years ago

0.0.20220817

2 years ago

0.0.20220816

2 years ago

0.0.20220812

2 years ago

0.0.20220811

2 years ago