createRotation method

Future<CreateRotationResult> createRotation({
  1. required List<String> contactIds,
  2. required String name,
  3. required RecurrenceSettings recurrence,
  4. required String timeZoneId,
  5. String? idempotencyToken,
  6. DateTime? startTime,
  7. List<Tag>? tags,
})

Creates a rotation in an on-call schedule.

May throw AccessDeniedException. May throw InternalServerException. May throw ResourceNotFoundException. May throw ServiceQuotaExceededException. May throw ThrottlingException. May throw ValidationException.

Parameter contactIds : The Amazon Resource Names (ARNs) of the contacts to add to the rotation. The order that you list the contacts in is their shift order in the rotation schedule. To change the order of the contact's shifts, use the UpdateRotation operation.

Parameter name : The name of the rotation.

Parameter recurrence : Information about the rule that specifies when a shift's team members rotate.

Parameter timeZoneId : The time zone to base the rotation’s activity on in Internet Assigned Numbers Authority (IANA) format. For example: "America/Los_Angeles", "UTC", or "Asia/Seoul". For more information, see the Time Zone Database on the IANA website.

Parameter idempotencyToken : A token that ensures that the operation is called only once with the specified details.

Parameter startTime : The date and time that the rotation goes into effect.

Parameter tags : Optional metadata to assign to the rotation. Tags enable you to categorize a resource in different ways, such as by purpose, owner, or environment. For more information, see Tagging Incident Manager resources in the Incident Manager User Guide.

Implementation

Future<CreateRotationResult> createRotation({
  required List<String> contactIds,
  required String name,
  required RecurrenceSettings recurrence,
  required String timeZoneId,
  String? idempotencyToken,
  DateTime? startTime,
  List<Tag>? tags,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'SSMContacts.CreateRotation'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'ContactIds': contactIds,
      'Name': name,
      'Recurrence': recurrence,
      'TimeZoneId': timeZoneId,
      if (idempotencyToken != null) 'IdempotencyToken': idempotencyToken,
      if (startTime != null) 'StartTime': unixTimestampToJson(startTime),
      if (tags != null) 'Tags': tags,
    },
  );

  return CreateRotationResult.fromJson(jsonResponse.body);
}