[Service Control API v2](https://cloud.google.com/service-infrastructure/docs/service-control/access-control)
Private Preview. This feature is only available for approved services.
This API provides admission control and telemetry reporting for services that are integrated with [Service Infrastructure](https://cloud.google.com/service-infrastructure). v2
Package
@google-cloud/service-controlConstructors
(constructor)(opts, gaxInstance)
constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback);
Construct an instance of ServiceControllerClient.
Parameters | |
---|---|
Name | Description |
opts |
ClientOptions
|
gaxInstance |
typeof gax | typeof fallback
: loaded instance of |
Properties
apiEndpoint
get apiEndpoint(): string;
The DNS address for this API service.
apiEndpoint
static get apiEndpoint(): string;
The DNS address for this API service - same as servicePath.
auth
auth: gax.GoogleAuth;
descriptors
descriptors: Descriptors;
innerApiCalls
innerApiCalls: {
[name: string]: Function;
};
port
static get port(): number;
The port for this API service.
scopes
static get scopes(): string[];
The scopes needed to make gRPC calls for every method defined in this service.
serviceControllerStub
serviceControllerStub?: Promise<{
[name: string]: Function;
}>;
servicePath
static get servicePath(): string;
The DNS address for this API service.
universeDomain
get universeDomain(): string;
warn
warn: (code: string, message: string, warnType?: string) => void;
Methods
check(request, options)
check(request?: protos.google.api.servicecontrol.v2.ICheckRequest, options?: CallOptions): Promise<[
protos.google.api.servicecontrol.v2.ICheckResponse,
protos.google.api.servicecontrol.v2.ICheckRequest | undefined,
{} | undefined
]>;
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).
Parameters | |
---|---|
Name | Description |
request |
ICheckRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
Returns | |
---|---|
Type | Description |
Promise<[
protos.google.api.servicecontrol.v2.ICheckResponse,
protos.google.api.servicecontrol.v2.ICheckRequest | undefined,
{} | undefined
]> | {Promise} - The promise which resolves to an array. The first element of the array is an object representing CheckResponse. Please see the documentation for more details and examples. |
/**
* This snippet has been automatically generated and should be regarded as a code template only.
* It will require modifications to work.
* It may require correct/in-range values for request initialization.
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* The service name as specified in its service configuration. For example,
* `"pubsub.googleapis.com"`.
* See
* google.api.Service (https://cloud.google.com/service-management/reference/rpc/google.api#google.api.Service)
* for the definition of a service name.
*/
// const serviceName = 'abc123'
/**
* Specifies the version of the service configuration that should be used to
* process the request. Must not be empty. Set this field to 'latest' to
* specify using the latest configuration.
*/
// const serviceConfigId = 'abc123'
/**
* Describes attributes about the operation being executed by the service.
*/
// const attributes = {}
/**
* Describes the resources and the policies applied to each resource.
*/
// const resources = [1,2,3,4]
/**
* Optional. Contains a comma-separated list of flags.
*/
// const flags = 'abc123'
// Imports the Servicecontrol library
const {ServiceControllerClient} = require('@google-cloud/servicecontrol').v2;
// Instantiates a client
const servicecontrolClient = new ServiceControllerClient();
async function callCheck() {
// Construct request
const request = {
};
// Run request
const response = await servicecontrolClient.check(request);
console.log(response);
}
callCheck();
check(request, options, callback)
check(request: protos.google.api.servicecontrol.v2.ICheckRequest, options: CallOptions, callback: Callback<protos.google.api.servicecontrol.v2.ICheckResponse, protos.google.api.servicecontrol.v2.ICheckRequest | null | undefined, {} | null | undefined>): void;
Parameters | |
---|---|
Name | Description |
request |
ICheckRequest
|
options |
CallOptions
|
callback |
Callback<protos.google.api.servicecontrol.v2.ICheckResponse, protos.google.api.servicecontrol.v2.ICheckRequest | null | undefined, {} | null | undefined>
|
Returns | |
---|---|
Type | Description |
void |
check(request, callback)
check(request: protos.google.api.servicecontrol.v2.ICheckRequest, callback: Callback<protos.google.api.servicecontrol.v2.ICheckResponse, protos.google.api.servicecontrol.v2.ICheckRequest | null | undefined, {} | null | undefined>): void;
Parameters | |
---|---|
Name | Description |
request |
ICheckRequest
|
callback |
Callback<protos.google.api.servicecontrol.v2.ICheckResponse, protos.google.api.servicecontrol.v2.ICheckRequest | null | undefined, {} | null | undefined>
|
Returns | |
---|---|
Type | Description |
void |
close()
close(): Promise<void>;
Terminate the gRPC channel and close the client.
The client will no longer be usable and all future behavior is undefined.
Returns | |
---|---|
Type | Description |
Promise<void> | {Promise} A promise that resolves when the client is closed. |
getProjectId()
getProjectId(): Promise<string>;
Returns | |
---|---|
Type | Description |
Promise<string> |
getProjectId(callback)
getProjectId(callback: Callback<string, undefined, undefined>): void;
Parameter | |
---|---|
Name | Description |
callback |
Callback<string, undefined, undefined>
|
Returns | |
---|---|
Type | Description |
void |
initialize()
initialize(): Promise<{
[name: string]: Function;
}>;
Initialize the client. Performs asynchronous operations (such as authentication) and prepares the client. This function will be called automatically when any class method is called for the first time, but if you need to initialize it before calling an actual method, feel free to call initialize() directly.
You can await on this method if you want to make sure the client is initialized.
Returns | |
---|---|
Type | Description |
Promise<{
[name: string]: Function;
}> | {Promise} A promise that resolves to an authenticated service stub. |
report(request, options)
report(request?: protos.google.api.servicecontrol.v2.IReportRequest, options?: CallOptions): Promise<[
protos.google.api.servicecontrol.v2.IReportResponse,
protos.google.api.servicecontrol.v2.IReportRequest | undefined,
{} | undefined
]>;
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).
Parameters | |
---|---|
Name | Description |
request |
IReportRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
Returns | |
---|---|
Type | Description |
Promise<[
protos.google.api.servicecontrol.v2.IReportResponse,
protos.google.api.servicecontrol.v2.IReportRequest | undefined,
{} | undefined
]> | {Promise} - The promise which resolves to an array. The first element of the array is an object representing ReportResponse. Please see the documentation for more details and examples. |
/**
* This snippet has been automatically generated and should be regarded as a code template only.
* It will require modifications to work.
* It may require correct/in-range values for request initialization.
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* The service name as specified in its service configuration. For example,
* `"pubsub.googleapis.com"`.
* See
* google.api.Service (https://cloud.google.com/service-management/reference/rpc/google.api#google.api.Service)
* for the definition of a service name.
*/
// const serviceName = 'abc123'
/**
* Specifies the version of the service configuration that should be used to
* process the request. Must not be empty. Set this field to 'latest' to
* specify using the latest configuration.
*/
// const serviceConfigId = 'abc123'
/**
* Describes the list of operations to be reported. Each operation is
* represented as an AttributeContext, and contains all attributes around an
* API access.
*/
// const operations = [1,2,3,4]
// Imports the Servicecontrol library
const {ServiceControllerClient} = require('@google-cloud/servicecontrol').v2;
// Instantiates a client
const servicecontrolClient = new ServiceControllerClient();
async function callReport() {
// Construct request
const request = {
};
// Run request
const response = await servicecontrolClient.report(request);
console.log(response);
}
callReport();
report(request, options, callback)
report(request: protos.google.api.servicecontrol.v2.IReportRequest, options: CallOptions, callback: Callback<protos.google.api.servicecontrol.v2.IReportResponse, protos.google.api.servicecontrol.v2.IReportRequest | null | undefined, {} | null | undefined>): void;
Parameters | |
---|---|
Name | Description |
request |
IReportRequest
|
options |
CallOptions
|
callback |
Callback<protos.google.api.servicecontrol.v2.IReportResponse, protos.google.api.servicecontrol.v2.IReportRequest | null | undefined, {} | null | undefined>
|
Returns | |
---|---|
Type | Description |
void |
report(request, callback)
report(request: protos.google.api.servicecontrol.v2.IReportRequest, callback: Callback<protos.google.api.servicecontrol.v2.IReportResponse, protos.google.api.servicecontrol.v2.IReportRequest | null | undefined, {} | null | undefined>): void;
Parameters | |
---|---|
Name | Description |
request |
IReportRequest
|
callback |
Callback<protos.google.api.servicecontrol.v2.IReportResponse, protos.google.api.servicecontrol.v2.IReportRequest | null | undefined, {} | null | undefined>
|
Returns | |
---|---|
Type | Description |
void |