createView method
Creates a new view with the possible status of SAVED or
PUBLISHED.
The views will have a unique name for each connect instance.
It performs basic content validation if the status is SAVED
or full content validation if the status is set to PUBLISHED.
An error is returned if validation fails. It associates either the
$SAVED qualifier or both of the $SAVED and
$LATEST qualifiers with the provided view content based on
the status. The view is idempotent if ClientToken is provided.
May throw AccessDeniedException.
May throw DuplicateResourceException.
May throw InternalServiceException.
May throw InvalidParameterException.
May throw InvalidRequestException.
May throw ResourceInUseException.
May throw ResourceNotFoundException.
May throw ServiceQuotaExceededException.
May throw TooManyRequestsException.
Parameter content :
View content containing all content necessary to render a view except for
runtime input data.
The total uncompressed content has a maximum file size of 400kB.
Parameter instanceId :
The identifier of the Connect Customer instance. You can find the
instanceId in the ARN of the instance.
Parameter name :
The name of the view.
Parameter status :
Indicates the view status as either SAVED or
PUBLISHED. The PUBLISHED status will initiate
validation on the content.
Parameter clientToken :
A unique Id for each create view request to avoid duplicate view creation.
For example, the view is idempotent ClientToken is provided.
Parameter description :
The description of the view.
Parameter tags :
The tags associated with the view resource (not specific to view
version).These tags can be used to organize, track, or control access for
this resource. For example, { "tags": {"key1":"value1", "key2":"value2"}
}.
Implementation
Future<CreateViewResponse> createView({
required ViewInputContent content,
required String instanceId,
required String name,
required ViewStatus status,
String? clientToken,
String? description,
Map<String, String>? tags,
}) async {
final $payload = <String, dynamic>{
'Content': content,
'Name': name,
'Status': status.value,
if (clientToken != null) 'ClientToken': clientToken,
if (description != null) 'Description': description,
if (tags != null) 'Tags': tags,
};
final response = await _protocol.send(
payload: $payload,
method: 'PUT',
requestUri: '/views/${Uri.encodeComponent(instanceId)}',
exceptionFnMap: _exceptionFns,
);
return CreateViewResponse.fromJson(response);
}