createContact method
Contacts are either the contacts that Incident Manager engages during an incident or the escalation plans that Incident Manager uses to engage contacts in phases during an incident.
May throw AccessDeniedException.
May throw ConflictException.
May throw DataEncryptionException.
May throw InternalServerException.
May throw ServiceQuotaExceededException.
May throw ThrottlingException.
May throw ValidationException.
Parameter alias :
The short name to quickly identify a contact or escalation plan. The
contact alias must be unique and identifiable.
Parameter plan :
A list of stages. A contact has an engagement plan with stages that
contact specified contact channels. An escalation plan uses stages that
contact specified contacts.
Parameter type :
The type of contact to create.
-
PERSONAL: A single, individual contact. -
ESCALATION: An escalation plan. -
ONCALL_SCHEDULE: An on-call schedule.
Parameter displayName :
The full name of the contact or escalation plan.
Parameter idempotencyToken :
A token ensuring that the operation is called only once with the specified
details.
Parameter tags :
Adds a tag to the target. You can only tag resources created in the first
Region of your replication set.
Implementation
Future<CreateContactResult> createContact({
required String alias,
required Plan plan,
required ContactType type,
String? displayName,
String? idempotencyToken,
List<Tag>? tags,
}) async {
final headers = <String, String>{
'Content-Type': 'application/x-amz-json-1.1',
'X-Amz-Target': 'SSMContacts.CreateContact'
};
final jsonResponse = await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
'Alias': alias,
'Plan': plan,
'Type': type.value,
if (displayName != null) 'DisplayName': displayName,
'IdempotencyToken': idempotencyToken ?? _s.generateIdempotencyToken(),
if (tags != null) 'Tags': tags,
},
);
return CreateContactResult.fromJson(jsonResponse.body);
}