disable method

Future<Operation> disable(
  1. DisableServiceRequest request,
  2. String name, {
  3. String? $fields,
})

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.

request - The metadata request object.

Request parameters:

name - Name of the consumer and service to disable the service on. The enable and disable methods currently only support projects. An example name would be: projects/123/services/serviceusage.googleapis.com where 123 is the project number. Value must have pattern ^\[^/\]+/\[^/\]+/services/\[^/\]+$.

$fields - Selector specifying which fields to include in a partial response.

Completes with a Operation.

Completes with a commons.ApiRequestError if the API endpoint returned an error.

If the used http.Client completes with an error when making a REST call, this method will complete with the same error.

Implementation

async.Future<Operation> disable(
  DisableServiceRequest request,
  core.String name, {
  core.String? $fields,
}) async {
  final body_ = convert.json.encode(request);
  final queryParams_ = <core.String, core.List<core.String>>{
    if ($fields != null) 'fields': [$fields],
  };

  final url_ = 'v1/' + core.Uri.encodeFull('$name') + ':disable';

  final response_ = await _requester.request(
    url_,
    'POST',
    body: body_,
    queryParams: queryParams_,
  );
  return Operation.fromJson(response_ as core.Map<core.String, core.dynamic>);
}