GetCalendarState - AWS Systems Manager

GetCalendarState

Gets the state of the AWS Systems Manager Change Calendar at an optional, specified time. If you specify a time, GetCalendarState returns the state of the calendar at a specific time, and returns the next time that the Change Calendar state will transition. If you do not specify a time, GetCalendarState assumes the current time. Change Calendar entries have two possible states: OPEN or CLOSED.

If you specify more than one calendar in a request, the command returns the status of OPEN only if all calendars in the request are open. If one or more calendars in the request are closed, the status returned is CLOSED.

For more information about Systems Manager Change Calendar, see AWS Systems Manager Change Calendar in the AWS Systems Manager User Guide.

Request Syntax

{ "AtTime": "string", "CalendarNames": [ "string" ] }

Request Parameters

For information about the parameters that are common to all actions, see Common Parameters.

The request accepts the following data in JSON format.

AtTime

(Optional) The specific time for which you want to get calendar state information, in ISO 8601 format. If you do not add AtTime, the current time is assumed.

Type: String

Required: No

CalendarNames

The names or Amazon Resource Names (ARNs) of the Systems Manager documents that represent the calendar entries for which you want to get the state.

Type: Array of strings

Required: Yes

Response Syntax

{ "AtTime": "string", "NextTransitionTime": "string", "State": "string" }

Response Elements

If the action is successful, the service sends back an HTTP 200 response.

The following data is returned in JSON format by the service.

AtTime

The time, as an ISO 8601 string, that you specified in your command. If you did not specify a time, GetCalendarState uses the current time.

Type: String

NextTransitionTime

The time, as an ISO 8601 string, that the calendar state will change. If the current calendar state is OPEN, NextTransitionTime indicates when the calendar state changes to CLOSED, and vice-versa.

Type: String

State

The state of the calendar. An OPEN calendar indicates that actions are allowed to proceed, and a CLOSED calendar indicates that actions are not allowed to proceed.

Type: String

Valid Values: OPEN | CLOSED

Errors

For information about the errors that are common to all actions, see Common Errors.

InternalServerError

An error occurred on the server side.

HTTP Status Code: 500

InvalidDocument

The specified document does not exist.

HTTP Status Code: 400

InvalidDocumentType

The document type is not valid. Valid document types are described in the DocumentType property.

HTTP Status Code: 400

UnsupportedCalendarException

The calendar entry contained in the specified Systems Manager document is not supported.

HTTP Status Code: 400

Example

Sample Request

POST / HTTP/1.1 Host: ssm.us-east-2.amazonaws.com Accept-Encoding: identity X-Amz-Target: AmazonSSM.GetCalendarState Content-Type: application/x-amz-json-1.1 User-Agent: aws-cli/2.0.0 Python/3.7.5 Windows/10 botocore/2.0.0dev4 X-Amz-Date: 20200224T191829Z Authorization: AWS4-HMAC-SHA256 Credential=AKIAIOSFODNN7EXAMPLE/20200225/us-east-2/ssm/aws4_request, SignedHeaders=content-type;host;x-amz-date;x-amz-target, Signature=39c3b3042cd2aEXAMPLE Content-Length: 67 { "CalendarNames": [ "MyCalendar" ], "AtTime": "2020-02-25T19:05:47Z" }

Sample Response

{ "AtTime": "2020-02-25T19:05:47Z", "State": "OPEN" }

See Also

For more information about using this API in one of the language-specific AWS SDKs, see the following: