GetCalendarState - AWS Systems Manager

GetCalendarState

Gets the state of a AWS Systems Manager change calendar at the current time or a specified time. If you specify a time, GetCalendarState returns the state of the calendar at that specific time, and returns the next time that the change calendar state will transition. If you don't specify a time, GetCalendarState uses 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 Change Calendar, a capability of AWS Systems Manager, 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 don't specify a value or AtTime, the current time is used.

Type: String

Required: No

CalendarNames

The names or Amazon Resource Names (ARNs) of the Systems Manager documents (SSM 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 don't 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 aren't 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 SSM document doesn't exist.

HTTP Status Code: 400

InvalidDocumentType

The SSM document type isn't valid. Valid document types are described in the DocumentType property.

HTTP Status Code: 400

UnsupportedCalendarException

The calendar entry contained in the specified SSM document isn't supported.

HTTP Status Code: 400

Examples

Example

This example illustrates one usage of GetCalendarState.

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: 20240224T191829Z Authorization: AWS4-HMAC-SHA256 Credential=AKIAIOSFODNN7EXAMPLE/20240225/us-east-2/ssm/aws4_request, SignedHeaders=content-type;host;x-amz-date;x-amz-target, Signature=39c3b3042cd2aEXAMPLE Content-Length: 67 { "CalendarNames": [ "MyCalendar" ], "AtTime": "2024-02-25T19:05:47Z" }

Sample Response

{ "AtTime": "2024-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: