create method

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

Creates a new data collector.

request - The metadata request object.

Request parameters:

parent - Required. Name of the organization in which to create the data collector in the following format: organizations/{org}. Value must have pattern ^organizations/\[^/\]+$.

dataCollectorId - ID of the data collector. Overrides any ID in the data collector resource. Must be a string beginning with dc_ that contains only letters, numbers, and underscores.

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

Completes with a GoogleCloudApigeeV1DataCollector.

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

  final url_ = 'v1/' + core.Uri.encodeFull('$parent') + '/datacollectors';

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