Service Control v1 API - Class ServiceControllerClient (2.4.0)

public abstract class ServiceControllerClient

Reference documentation and code samples for the Service Control v1 API class ServiceControllerClient.

ServiceController client wrapper, for convenient use.

Inheritance

object > ServiceControllerClient

Namespace

Google.Cloud.ServiceControl.V1

Assembly

Google.Cloud.ServiceControl.V1.dll

Remarks

Google Service Control API

Lets clients check and report operations against a managed service.

Properties

DefaultEndpoint

public static string DefaultEndpoint { get; }

The default endpoint for the ServiceController service, which is a host of "servicecontrol.googleapis.com" and a port of 443.

Property Value
Type Description
string

DefaultScopes

public static IReadOnlyList<string> DefaultScopes { get; }

The default ServiceController scopes.

Property Value
Type Description
IReadOnlyListstring
Remarks

GrpcClient

public virtual ServiceController.ServiceControllerClient GrpcClient { get; }

The underlying gRPC ServiceController client

Property Value
Type Description
ServiceControllerServiceControllerClient

ServiceMetadata

public static ServiceMetadata ServiceMetadata { get; }

The service metadata associated with this client type.

Property Value
Type Description
ServiceMetadata

Methods

Check(CheckRequest, CallSettings)

public virtual CheckResponse Check(CheckRequest request, CallSettings callSettings = null)

Checks whether an operation on a service should be allowed to proceed based on the configuration of the service and related policies. It must be called before the operation is executed.

If feasible, the client should cache the check results and reuse them for 60 seconds. In case of any server errors, the client should rely on the cached results for much longer time to avoid outage. WARNING: There is general 60s delay for the configuration and policy propagation, therefore callers MUST NOT depend on the Check method having the latest policy information.

NOTE: the [CheckRequest][google.api.servicecontrol.v1.CheckRequest] has the size limit (wire-format byte size) of 1MB.

This method requires the servicemanagement.services.check permission on the specified service. For more information, see Cloud IAM.

Parameters
Name Description
request CheckRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
CheckResponse

The RPC response.

Example
// Create client
ServiceControllerClient serviceControllerClient = ServiceControllerClient.Create();
// Initialize request argument(s)
CheckRequest request = new CheckRequest
{
    ServiceName = "",
    Operation = new Operation(),
    ServiceConfigId = "",
};
// Make the request
CheckResponse response = serviceControllerClient.Check(request);

CheckAsync(CheckRequest, CallSettings)

public virtual Task<CheckResponse> CheckAsync(CheckRequest request, CallSettings callSettings = null)

Checks whether an operation on a service should be allowed to proceed based on the configuration of the service and related policies. It must be called before the operation is executed.

If feasible, the client should cache the check results and reuse them for 60 seconds. In case of any server errors, the client should rely on the cached results for much longer time to avoid outage. WARNING: There is general 60s delay for the configuration and policy propagation, therefore callers MUST NOT depend on the Check method having the latest policy information.

NOTE: the [CheckRequest][google.api.servicecontrol.v1.CheckRequest] has the size limit (wire-format byte size) of 1MB.

This method requires the servicemanagement.services.check permission on the specified service. For more information, see Cloud IAM.

Parameters
Name Description
request CheckRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskCheckResponse

A Task containing the RPC response.

Example
// Create client
ServiceControllerClient serviceControllerClient = await ServiceControllerClient.CreateAsync();
// Initialize request argument(s)
CheckRequest request = new CheckRequest
{
    ServiceName = "",
    Operation = new Operation(),
    ServiceConfigId = "",
};
// Make the request
CheckResponse response = await serviceControllerClient.CheckAsync(request);

CheckAsync(CheckRequest, CancellationToken)

public virtual Task<CheckResponse> CheckAsync(CheckRequest request, CancellationToken cancellationToken)

Checks whether an operation on a service should be allowed to proceed based on the configuration of the service and related policies. It must be called before the operation is executed.

If feasible, the client should cache the check results and reuse them for 60 seconds. In case of any server errors, the client should rely on the cached results for much longer time to avoid outage. WARNING: There is general 60s delay for the configuration and policy propagation, therefore callers MUST NOT depend on the Check method having the latest policy information.

NOTE: the [CheckRequest][google.api.servicecontrol.v1.CheckRequest] has the size limit (wire-format byte size) of 1MB.

This method requires the servicemanagement.services.check permission on the specified service. For more information, see Cloud IAM.

Parameters
Name Description
request CheckRequest

The request object containing all of the parameters for the API call.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskCheckResponse

A Task containing the RPC response.

Example
// Create client
ServiceControllerClient serviceControllerClient = await ServiceControllerClient.CreateAsync();
// Initialize request argument(s)
CheckRequest request = new CheckRequest
{
    ServiceName = "",
    Operation = new Operation(),
    ServiceConfigId = "",
};
// Make the request
CheckResponse response = await serviceControllerClient.CheckAsync(request);

Create()

public static ServiceControllerClient Create()

Synchronously creates a ServiceControllerClient using the default credentials, endpoint and settings. To specify custom credentials or other settings, use ServiceControllerClientBuilder.

Returns
Type Description
ServiceControllerClient

The created ServiceControllerClient.

CreateAsync(CancellationToken)

public static Task<ServiceControllerClient> CreateAsync(CancellationToken cancellationToken = default)

Asynchronously creates a ServiceControllerClient using the default credentials, endpoint and settings. To specify custom credentials or other settings, use ServiceControllerClientBuilder.

Parameter
Name Description
cancellationToken CancellationToken

The CancellationToken to use while creating the client.

Returns
Type Description
TaskServiceControllerClient

The task representing the created ServiceControllerClient.

Report(ReportRequest, CallSettings)

public virtual ReportResponse Report(ReportRequest request, CallSettings callSettings = null)

Reports operation results to Google Service Control, such as logs and metrics. It should be called after an operation is completed.

If feasible, the client should aggregate reporting data for up to 5 seconds to reduce API traffic. Limiting aggregation to 5 seconds is to reduce data loss during client crashes. Clients should carefully choose the aggregation time window to avoid data loss risk more than 0.01% for business and compliance reasons.

NOTE: the [ReportRequest][google.api.servicecontrol.v1.ReportRequest] has the size limit (wire-format byte size) of 1MB.

This method requires the servicemanagement.services.report permission on the specified service. For more information, see Google Cloud IAM.

Parameters
Name Description
request ReportRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
ReportResponse

The RPC response.

Example
// Create client
ServiceControllerClient serviceControllerClient = ServiceControllerClient.Create();
// Initialize request argument(s)
ReportRequest request = new ReportRequest
{
    ServiceName = "",
    Operations = { new Operation(), },
    ServiceConfigId = "",
};
// Make the request
ReportResponse response = serviceControllerClient.Report(request);

ReportAsync(ReportRequest, CallSettings)

public virtual Task<ReportResponse> ReportAsync(ReportRequest request, CallSettings callSettings = null)

Reports operation results to Google Service Control, such as logs and metrics. It should be called after an operation is completed.

If feasible, the client should aggregate reporting data for up to 5 seconds to reduce API traffic. Limiting aggregation to 5 seconds is to reduce data loss during client crashes. Clients should carefully choose the aggregation time window to avoid data loss risk more than 0.01% for business and compliance reasons.

NOTE: the [ReportRequest][google.api.servicecontrol.v1.ReportRequest] has the size limit (wire-format byte size) of 1MB.

This method requires the servicemanagement.services.report permission on the specified service. For more information, see Google Cloud IAM.

Parameters
Name Description
request ReportRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskReportResponse

A Task containing the RPC response.

Example
// Create client
ServiceControllerClient serviceControllerClient = await ServiceControllerClient.CreateAsync();
// Initialize request argument(s)
ReportRequest request = new ReportRequest
{
    ServiceName = "",
    Operations = { new Operation(), },
    ServiceConfigId = "",
};
// Make the request
ReportResponse response = await serviceControllerClient.ReportAsync(request);

ReportAsync(ReportRequest, CancellationToken)

public virtual Task<ReportResponse> ReportAsync(ReportRequest request, CancellationToken cancellationToken)

Reports operation results to Google Service Control, such as logs and metrics. It should be called after an operation is completed.

If feasible, the client should aggregate reporting data for up to 5 seconds to reduce API traffic. Limiting aggregation to 5 seconds is to reduce data loss during client crashes. Clients should carefully choose the aggregation time window to avoid data loss risk more than 0.01% for business and compliance reasons.

NOTE: the [ReportRequest][google.api.servicecontrol.v1.ReportRequest] has the size limit (wire-format byte size) of 1MB.

This method requires the servicemanagement.services.report permission on the specified service. For more information, see Google Cloud IAM.

Parameters
Name Description
request ReportRequest

The request object containing all of the parameters for the API call.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskReportResponse

A Task containing the RPC response.

Example
// Create client
ServiceControllerClient serviceControllerClient = await ServiceControllerClient.CreateAsync();
// Initialize request argument(s)
ReportRequest request = new ReportRequest
{
    ServiceName = "",
    Operations = { new Operation(), },
    ServiceConfigId = "",
};
// Make the request
ReportResponse response = await serviceControllerClient.ReportAsync(request);

ShutdownDefaultChannelsAsync()

public static Task ShutdownDefaultChannelsAsync()

Shuts down any channels automatically created by Create() and CreateAsync(CancellationToken). Channels which weren't automatically created are not affected.

Returns
Type Description
Task

A task representing the asynchronous shutdown operation.

Remarks

After calling this method, further calls to Create() and CreateAsync(CancellationToken) will create new channels, which could in turn be shut down by another call to this method.