createServiceInstance method
Create a service instance.
May throw AccessDeniedException.
May throw ConflictException.
May throw InternalServerException.
May throw ResourceNotFoundException.
May throw ThrottlingException.
May throw ValidationException.
Parameter name :
The name of the service instance to create.
Parameter serviceName :
The name of the service the service instance is added to.
Parameter spec :
The spec for the service instance you want to create.
Parameter clientToken :
The client token of the service instance to create.
Parameter tags :
An optional list of metadata items that you can associate with the Proton
service instance. A tag is a key-value pair.
For more information, see Proton resources and tagging in the Proton User Guide.
Parameter templateMajorVersion :
To create a new major and minor version of the service template,
exclude major Version.
Parameter templateMinorVersion :
To create a new minor version of the service template, include a
major Version.
Implementation
Future<CreateServiceInstanceOutput> createServiceInstance({
required String name,
required String serviceName,
required String spec,
String? clientToken,
List<Tag>? tags,
String? templateMajorVersion,
String? templateMinorVersion,
}) async {
final headers = <String, String>{
'Content-Type': 'application/x-amz-json-1.0',
'X-Amz-Target': 'AwsProton20200720.CreateServiceInstance'
};
final jsonResponse = await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
'name': name,
'serviceName': serviceName,
'spec': spec,
'clientToken': clientToken ?? _s.generateIdempotencyToken(),
if (tags != null) 'tags': tags,
if (templateMajorVersion != null)
'templateMajorVersion': templateMajorVersion,
if (templateMinorVersion != null)
'templateMinorVersion': templateMinorVersion,
},
);
return CreateServiceInstanceOutput.fromJson(jsonResponse.body);
}