create method
Creates an instance configuration and begins preparing it to be used.
The returned long-running operation can be used to track the progress of
preparing the new instance configuration. The instance configuration name
is assigned by the caller. If the named instance configuration already
exists, CreateInstanceConfig
returns ALREADY_EXISTS
. Immediately after
the request returns: * The instance configuration is readable via the API,
with all requested attributes. The instance configuration's reconciling
field is set to true. Its state is CREATING
. While the operation is
pending: * Cancelling the operation renders the instance configuration
immediately unreadable via the API. * Except for deleting the creating
resource, all other attempts to modify the instance configuration are
rejected. Upon completion of the returned operation: * Instances can be
created using the instance configuration. * The instance configuration's
reconciling field becomes false. Its state becomes READY
. The returned
long-running operation will have a name of the format /operations/
and
can be used to track creation of the instance configuration. The metadata
field type is CreateInstanceConfigMetadata. The response field type is
InstanceConfig, if successful. Authorization requires
spanner.instanceConfigs.create
permission on the resource parent.
request
- The metadata request object.
Request parameters:
parent
- Required. The name of the project in which to create the
instance configuration. Values are of the form projects/
.
Value must have pattern ^projects/\[^/\]+$
.
$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(
CreateInstanceConfigRequest request,
core.String parent, {
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('$parent') + '/instanceConfigs';
final response_ = await _requester.request(
url_,
'POST',
body: body_,
queryParams: queryParams_,
);
return Operation.fromJson(response_ as core.Map<core.String, core.dynamic>);
}