create method

Future<SupportEventSubscription> create(
  1. SupportEventSubscription request,
  2. String parent, {
  3. String? $fields,
})

Creates a support event subscription for an organization.

EXAMPLES: cURL: shell parent="organizations/123456789" curl \ --request POST \ --header "Authorization: Bearer $(gcloud auth print-access-token)" \ --header 'Content-Type: application/json' \ --data '{ "pub_sub_topic": "projects/my-project/topics/my-topic" }' \ "https://cloudsupport.googleapis.com/v2/$parent/supportEventSubscriptions" Python: python import googleapiclient.discovery api_version = "v2" supportApiService = googleapiclient.discovery.build( serviceName="cloudsupport", version=api_version, discoveryServiceUrl=f"https://cloudsupport.googleapis.com/$discovery/rest?version={api_version}", ) request = supportApiService.supportEventSubscriptions().create( parent="organizations/123456789", body={ "pub_sub_topic": "projects/my-project/topics/my-topic" }, ) print(request.execute())

request - The metadata request object.

Request parameters:

parent - Required. The parent resource name where the support event subscription will be created. Format: organizations/{organization_id} Value must have pattern ^organizations/\[^/\]+$.

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

Completes with a SupportEventSubscription.

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<SupportEventSubscription> create(
  SupportEventSubscription request,
  core.String parent, {
  core.String? $fields,
}) async {
  final body_ = convert.json.encode(request);
  final queryParams_ = <core.String, core.List<core.String>>{
    'fields': ?$fields == null ? null : [$fields],
  };

  final url_ =
      'v2/' + core.Uri.encodeFull('$parent') + '/supportEventSubscriptions';

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