Class ServiceControllerClient (1.4.0)

public abstract 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
TypeDescription
String

DefaultScopes

public static IReadOnlyList<string> DefaultScopes { get; }

The default ServiceController scopes.

Property Value
TypeDescription
IReadOnlyList<String>
Remarks

GrpcClient

public virtual ServiceController.ServiceControllerClient GrpcClient { get; }

The underlying gRPC ServiceController client

Property Value
TypeDescription
ServiceController.ServiceControllerClient

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
NameDescription
requestCheckRequest

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
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
NameDescription
requestCheckRequest

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<CheckResponse>

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
NameDescription
requestCheckRequest

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

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<CheckResponse>

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
TypeDescription
ServiceControllerClient

The created ServiceControllerClient.

CreateAsync(CancellationToken)

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

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

Parameter
NameDescription
cancellationTokenCancellationToken

The CancellationToken to use while creating the client.

Returns
TypeDescription
Task<ServiceControllerClient>

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
NameDescription
requestReportRequest

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
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
NameDescription
requestReportRequest

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<ReportResponse>

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
NameDescription
requestReportRequest

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

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<ReportResponse>

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
TypeDescription
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.