create method

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

Creates a new connector in a given Connect cluster.

request - The metadata request object.

Request parameters:

parent - Required. The parent Connect cluster in which to create the connector. Structured like projects/{project}/locations/{location}/connectClusters/{connect_cluster_id}. Value must have pattern ^projects/\[^/\]+/locations/\[^/\]+/connectClusters/\[^/\]+$.

connectorId - Required. The ID to use for the connector, which will become the final component of the connector's name. The ID must be 1-63 characters long, and match the regular expression [a-z]([-a-z0-9]*[a-z0-9])? to comply with RFC 1035. This value is structured like: my-connector-id.

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

Completes with a Connector.

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

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

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