createInstance method
Enables you to programmatically create an Amazon Web Services Supply Chain instance by applying KMS keys and relevant information associated with the API without using the Amazon Web Services console.
This is an asynchronous operation. Upon receiving a CreateInstance request, Amazon Web Services Supply Chain immediately returns the instance resource, instance ID, and the initializing state while simultaneously creating all required Amazon Web Services resources for an instance creation. You can use GetInstance to check the status of the instance. If the instance results in an unhealthy state, you need to check the error message, delete the current instance, and recreate a new one based on the mitigation from the error message.
May throw AccessDeniedException.
May throw ConflictException.
May throw InternalServerException.
May throw ServiceQuotaExceededException.
May throw ThrottlingException.
May throw ValidationException.
Parameter clientToken :
The client token for idempotency.
Parameter instanceDescription :
The AWS Supply Chain instance description.
Parameter instanceName :
The AWS Supply Chain instance name.
Parameter kmsKeyArn :
The ARN (Amazon Resource Name) of the Key Management Service (KMS) key you
provide for encryption. This is required if you do not want to use the
Amazon Web Services owned KMS key. If you don't provide anything here, AWS
Supply Chain uses the Amazon Web Services owned KMS key.
Parameter tags :
The Amazon Web Services tags of an instance to be created.
Parameter webAppDnsDomain :
The DNS subdomain of the web app. This would be "example" in the URL
"example.scn.global.on.aws". You can set this to a custom value, as long
as the domain isn't already being used by someone else. The name may only
include alphanumeric characters and hyphens.
Implementation
Future<CreateInstanceResponse> createInstance({
String? clientToken,
String? instanceDescription,
String? instanceName,
String? kmsKeyArn,
Map<String, String>? tags,
String? webAppDnsDomain,
}) async {
final $payload = <String, dynamic>{
'clientToken': clientToken ?? _s.generateIdempotencyToken(),
if (instanceDescription != null)
'instanceDescription': instanceDescription,
if (instanceName != null) 'instanceName': instanceName,
if (kmsKeyArn != null) 'kmsKeyArn': kmsKeyArn,
if (tags != null) 'tags': tags,
if (webAppDnsDomain != null) 'webAppDnsDomain': webAppDnsDomain,
};
final response = await _protocol.send(
payload: $payload,
method: 'POST',
requestUri: '/api/instance',
exceptionFnMap: _exceptionFns,
);
return CreateInstanceResponse.fromJson(response);
}