createInstance method

Future<CreateInstanceResponse> createInstance({
  1. required DirectoryType identityManagementType,
  2. required bool inboundCallsEnabled,
  3. required bool outboundCallsEnabled,
  4. String? clientToken,
  5. String? directoryId,
  6. String? instanceAlias,
})

This API is in preview release for Amazon Connect and is subject to change.

Initiates an Amazon Connect instance with all the supported channels enabled. It does not attach any storage (such as Amazon S3, or Kinesis) or allow for any configurations on features such as Contact Lens for Amazon Connect.

May throw InvalidRequestException. May throw ServiceQuotaExceededException. May throw ThrottlingException. May throw ResourceNotFoundException. May throw InternalServiceException.

Parameter identityManagementType : The type of identity management for your Amazon Connect users.

Parameter inboundCallsEnabled : Whether your contact center handles incoming contacts.

Parameter outboundCallsEnabled : Whether your contact center allows outbound calls.

Parameter clientToken : The idempotency token.

Parameter directoryId : The identifier for the directory.

Parameter instanceAlias : The name for your instance.

Implementation

Future<CreateInstanceResponse> createInstance({
  required DirectoryType identityManagementType,
  required bool inboundCallsEnabled,
  required bool outboundCallsEnabled,
  String? clientToken,
  String? directoryId,
  String? instanceAlias,
}) async {
  ArgumentError.checkNotNull(
      identityManagementType, 'identityManagementType');
  ArgumentError.checkNotNull(inboundCallsEnabled, 'inboundCallsEnabled');
  ArgumentError.checkNotNull(outboundCallsEnabled, 'outboundCallsEnabled');
  _s.validateStringLength(
    'clientToken',
    clientToken,
    0,
    500,
  );
  _s.validateStringLength(
    'directoryId',
    directoryId,
    12,
    12,
  );
  _s.validateStringLength(
    'instanceAlias',
    instanceAlias,
    1,
    62,
  );
  final $payload = <String, dynamic>{
    'IdentityManagementType': identityManagementType.toValue(),
    'InboundCallsEnabled': inboundCallsEnabled,
    'OutboundCallsEnabled': outboundCallsEnabled,
    if (clientToken != null) 'ClientToken': clientToken,
    if (directoryId != null) 'DirectoryId': directoryId,
    if (instanceAlias != null) 'InstanceAlias': instanceAlias,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'PUT',
    requestUri: '/instance',
    exceptionFnMap: _exceptionFns,
  );
  return CreateInstanceResponse.fromJson(response);
}