create method
- DatabaseConnection request,
- String parent, {
- String? databaseConnectionId,
- String? requestId,
- String? $fields,
Creates a new DatabaseConnection in a given project and location.
request - The metadata request object.
Request parameters:
parent - Required. The parent value for the DatabaseConnection in the
following format: projects/{project}/locations/{location}.
Value must have pattern ^projects/\[^/\]+/locations/\[^/\]+$.
databaseConnectionId - Required. The ID of the DatabaseConnection to
create. This value is restricted to
(^[a-z]([a-z0-9-]{0,61}[a-z0-9])?$) and must be a maximum of 63
characters in length. The value must start with a letter and end with a
letter or a number.
requestId - Optional. An optional ID to identify the request. This value
is used to identify duplicate requests. If you make a request with the
same request ID and the original request is still in progress or
completed, the server ignores the second request. This prevents clients
from accidentally creating duplicate commitments. The request ID must be a
valid UUID with the exception that zero UUID is not supported
(00000000-0000-0000-0000-000000000000).
$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> create(
DatabaseConnection request,
core.String parent, {
core.String? databaseConnectionId,
core.String? requestId,
core.String? $fields,
}) async {
final body_ = convert.json.encode(request);
final queryParams_ = <core.String, core.List<core.String>>{
'databaseConnectionId': ?databaseConnectionId == null
? null
: [databaseConnectionId],
'requestId': ?requestId == null ? null : [requestId],
'fields': ?$fields == null ? null : [$fields],
};
final url_ =
'v1/' + core.Uri.encodeFull('$parent') + '/databaseConnections';
final response_ = await _requester.request(
url_,
'POST',
body: body_,
queryParams: queryParams_,
);
return Operation.fromJson(response_ as core.Map<core.String, core.dynamic>);
}