2.0.20220805 • Published 2 years ago

@maxim_mazurok/gapi.client.servicecontrol v2.0.20220805

Weekly downloads
86
License
MIT
Repository
github
Last release
2 years ago

TypeScript typings for Service Control API v2

Provides admission control and telemetry reporting for services integrated with Service Infrastructure. For detailed description please check documentation.

Installing

Install typings for Service Control API:

npm install @types/gapi.client.servicecontrol@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('servicecontrol', 'v2', () => {
  // now we can use gapi.client.servicecontrol
  // ...
});

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

      // Manage your Google Service Control data
      'https://www.googleapis.com/auth/servicecontrol',
    ],
    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 Control API resources:

/*
Private Preview. This feature is only available for approved services. This method provides admission control for services that are integrated with [Service Infrastructure](https://cloud.google.com/service-infrastructure). It checks whether an operation should be allowed based on the service configuration and relevant policies. It must be called before the operation is executed. For more information, see [Admission Control](https://cloud.google.com/service-infrastructure/docs/admission-control). NOTE: The admission control has an expected policy propagation delay of 60s. The caller **must** not depend on the most recent policy changes. NOTE: The admission control has a hard limit of 1 referenced resources per call. If an operation refers to more than 1 resources, the caller must call the Check method multiple times. This method requires the `servicemanagement.services.check` permission on the specified service. For more information, see [Service Control API Access Control](https://cloud.google.com/service-infrastructure/docs/service-control/access-control).
*/
await gapi.client.servicecontrol.services.check({ serviceName: "serviceName",  });

/*
Private Preview. This feature is only available for approved services. This method provides telemetry reporting for services that are integrated with [Service Infrastructure](https://cloud.google.com/service-infrastructure). It reports a list of operations that have occurred on a service. It must be called after the operations have been executed. For more information, see [Telemetry Reporting](https://cloud.google.com/service-infrastructure/docs/telemetry-reporting). NOTE: The telemetry reporting has a hard limit of 1000 operations and 1MB per Report call. It is recommended to have no more than 100 operations per call. This method requires the `servicemanagement.services.report` permission on the specified service. For more information, see [Service Control API Access Control](https://cloud.google.com/service-infrastructure/docs/service-control/access-control).
*/
await gapi.client.servicecontrol.services.report({ serviceName: "serviceName",  });
2.0.20220805

2 years ago

2.0.20220609

2 years ago

2.0.20220729

2 years ago

2.0.20220726

2 years ago

2.0.20220617

2 years ago

2.0.20220707

2 years ago

2.0.20220624

2 years ago

2.0.20220715

2 years ago

2.0.20220602

2 years ago

2.0.20220527

2 years ago

2.0.20220425

2 years ago

2.0.20220513

2 years ago

2.0.20220506

2 years ago

2.0.20220429

2 years ago

2.0.20220523

2 years ago

2.0.20220520

2 years ago

2.0.20220408

2 years ago

2.0.20220415

2 years ago

2.0.20220325

2 years ago

2.0.20220318

2 years ago

2.0.20220304

2 years ago

2.0.20220227

2 years ago

2.0.20220214

2 years ago

2.0.20220215

2 years ago

2.0.20220209

2 years ago

2.0.20211230

2 years ago

2.0.20220105

2 years ago

2.0.20220121

2 years ago

2.0.20211112

2 years ago

2.0.20211203

2 years ago

2.0.20211104

2 years ago

2.0.20211029

2 years ago

2.0.20211022

3 years ago

2.0.20211018

3 years ago

2.0.20210930

3 years ago

2.0.20210924

3 years ago

2.0.20210916

3 years ago

2.0.20210910

3 years ago

2.0.20210907

3 years ago

2.0.20210826

3 years ago

2.0.20210819

3 years ago

2.0.20210818

3 years ago

2.0.20210806

3 years ago

2.0.20210729

3 years ago

2.0.20210716

3 years ago

2.0.20210709

3 years ago

2.0.20210702

3 years ago

2.0.20210625

3 years ago

2.0.20210618

3 years ago

2.0.20210603

3 years ago

2.0.20210527

3 years ago

2.0.20210513

3 years ago

2.0.20210508

3 years ago

2.0.20210430

3 years ago

2.0.20210422

3 years ago

2.0.20210416

3 years ago

2.0.20210409

3 years ago

2.0.20210401

3 years ago

2.0.20210326

3 years ago

2.0.20210318

3 years ago

2.0.20210312

3 years ago

2.0.20210305

3 years ago

2.0.20210226

3 years ago

2.0.20210219

3 years ago

2.0.20210212

3 years ago

2.0.20210205

3 years ago

2.0.20210130

3 years ago

2.0.20210123

3 years ago

2.0.20210115

3 years ago

2.0.20210113

3 years ago

2.0.20201231

3 years ago

2.0.20201207

3 years ago

2.0.20201117

3 years ago

2.0.20201106

3 years ago