{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}
module Amazonka.SSM.GetCalendarState
(
GetCalendarState (..),
newGetCalendarState,
getCalendarState_atTime,
getCalendarState_calendarNames,
GetCalendarStateResponse (..),
newGetCalendarStateResponse,
getCalendarStateResponse_state,
getCalendarStateResponse_nextTransitionTime,
getCalendarStateResponse_atTime,
getCalendarStateResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
import Amazonka.SSM.Types
data GetCalendarState = GetCalendarState'
{
GetCalendarState -> Maybe Text
atTime :: Prelude.Maybe Prelude.Text,
GetCalendarState -> [Text]
calendarNames :: [Prelude.Text]
}
deriving (GetCalendarState -> GetCalendarState -> Bool
(GetCalendarState -> GetCalendarState -> Bool)
-> (GetCalendarState -> GetCalendarState -> Bool)
-> Eq GetCalendarState
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetCalendarState -> GetCalendarState -> Bool
$c/= :: GetCalendarState -> GetCalendarState -> Bool
== :: GetCalendarState -> GetCalendarState -> Bool
$c== :: GetCalendarState -> GetCalendarState -> Bool
Prelude.Eq, ReadPrec [GetCalendarState]
ReadPrec GetCalendarState
Int -> ReadS GetCalendarState
ReadS [GetCalendarState]
(Int -> ReadS GetCalendarState)
-> ReadS [GetCalendarState]
-> ReadPrec GetCalendarState
-> ReadPrec [GetCalendarState]
-> Read GetCalendarState
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetCalendarState]
$creadListPrec :: ReadPrec [GetCalendarState]
readPrec :: ReadPrec GetCalendarState
$creadPrec :: ReadPrec GetCalendarState
readList :: ReadS [GetCalendarState]
$creadList :: ReadS [GetCalendarState]
readsPrec :: Int -> ReadS GetCalendarState
$creadsPrec :: Int -> ReadS GetCalendarState
Prelude.Read, Int -> GetCalendarState -> ShowS
[GetCalendarState] -> ShowS
GetCalendarState -> String
(Int -> GetCalendarState -> ShowS)
-> (GetCalendarState -> String)
-> ([GetCalendarState] -> ShowS)
-> Show GetCalendarState
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetCalendarState] -> ShowS
$cshowList :: [GetCalendarState] -> ShowS
show :: GetCalendarState -> String
$cshow :: GetCalendarState -> String
showsPrec :: Int -> GetCalendarState -> ShowS
$cshowsPrec :: Int -> GetCalendarState -> ShowS
Prelude.Show, (forall x. GetCalendarState -> Rep GetCalendarState x)
-> (forall x. Rep GetCalendarState x -> GetCalendarState)
-> Generic GetCalendarState
forall x. Rep GetCalendarState x -> GetCalendarState
forall x. GetCalendarState -> Rep GetCalendarState x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetCalendarState x -> GetCalendarState
$cfrom :: forall x. GetCalendarState -> Rep GetCalendarState x
Prelude.Generic)
newGetCalendarState ::
GetCalendarState
newGetCalendarState :: GetCalendarState
newGetCalendarState =
GetCalendarState' :: Maybe Text -> [Text] -> GetCalendarState
GetCalendarState'
{ $sel:atTime:GetCalendarState' :: Maybe Text
atTime = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:calendarNames:GetCalendarState' :: [Text]
calendarNames = [Text]
forall a. Monoid a => a
Prelude.mempty
}
getCalendarState_atTime :: Lens.Lens' GetCalendarState (Prelude.Maybe Prelude.Text)
getCalendarState_atTime :: (Maybe Text -> f (Maybe Text))
-> GetCalendarState -> f GetCalendarState
getCalendarState_atTime = (GetCalendarState -> Maybe Text)
-> (GetCalendarState -> Maybe Text -> GetCalendarState)
-> Lens GetCalendarState GetCalendarState (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetCalendarState' {Maybe Text
atTime :: Maybe Text
$sel:atTime:GetCalendarState' :: GetCalendarState -> Maybe Text
atTime} -> Maybe Text
atTime) (\s :: GetCalendarState
s@GetCalendarState' {} Maybe Text
a -> GetCalendarState
s {$sel:atTime:GetCalendarState' :: Maybe Text
atTime = Maybe Text
a} :: GetCalendarState)
getCalendarState_calendarNames :: Lens.Lens' GetCalendarState [Prelude.Text]
getCalendarState_calendarNames :: ([Text] -> f [Text]) -> GetCalendarState -> f GetCalendarState
getCalendarState_calendarNames = (GetCalendarState -> [Text])
-> (GetCalendarState -> [Text] -> GetCalendarState)
-> Lens GetCalendarState GetCalendarState [Text] [Text]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetCalendarState' {[Text]
calendarNames :: [Text]
$sel:calendarNames:GetCalendarState' :: GetCalendarState -> [Text]
calendarNames} -> [Text]
calendarNames) (\s :: GetCalendarState
s@GetCalendarState' {} [Text]
a -> GetCalendarState
s {$sel:calendarNames:GetCalendarState' :: [Text]
calendarNames = [Text]
a} :: GetCalendarState) (([Text] -> f [Text]) -> GetCalendarState -> f GetCalendarState)
-> (([Text] -> f [Text]) -> [Text] -> f [Text])
-> ([Text] -> f [Text])
-> GetCalendarState
-> f GetCalendarState
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([Text] -> f [Text]) -> [Text] -> f [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.AWSRequest GetCalendarState where
type
AWSResponse GetCalendarState =
GetCalendarStateResponse
request :: GetCalendarState -> Request GetCalendarState
request = Service -> GetCalendarState -> Request GetCalendarState
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy GetCalendarState
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetCalendarState)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetCalendarState))
-> Logger
-> Service
-> Proxy GetCalendarState
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetCalendarState)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Maybe CalendarState
-> Maybe Text -> Maybe Text -> Int -> GetCalendarStateResponse
GetCalendarStateResponse'
(Maybe CalendarState
-> Maybe Text -> Maybe Text -> Int -> GetCalendarStateResponse)
-> Either String (Maybe CalendarState)
-> Either
String
(Maybe Text -> Maybe Text -> Int -> GetCalendarStateResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe CalendarState)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"State")
Either
String
(Maybe Text -> Maybe Text -> Int -> GetCalendarStateResponse)
-> Either String (Maybe Text)
-> Either String (Maybe Text -> Int -> GetCalendarStateResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"NextTransitionTime")
Either String (Maybe Text -> Int -> GetCalendarStateResponse)
-> Either String (Maybe Text)
-> Either String (Int -> GetCalendarStateResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"AtTime")
Either String (Int -> GetCalendarStateResponse)
-> Either String Int -> Either String GetCalendarStateResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance Prelude.Hashable GetCalendarState
instance Prelude.NFData GetCalendarState
instance Core.ToHeaders GetCalendarState where
toHeaders :: GetCalendarState -> ResponseHeaders
toHeaders =
ResponseHeaders -> GetCalendarState -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# (ByteString
"AmazonSSM.GetCalendarState" :: Prelude.ByteString),
HeaderName
"Content-Type"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Core.ToJSON GetCalendarState where
toJSON :: GetCalendarState -> Value
toJSON GetCalendarState' {[Text]
Maybe Text
calendarNames :: [Text]
atTime :: Maybe Text
$sel:calendarNames:GetCalendarState' :: GetCalendarState -> [Text]
$sel:atTime:GetCalendarState' :: GetCalendarState -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"AtTime" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
atTime,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"CalendarNames" Text -> [Text] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= [Text]
calendarNames)
]
)
instance Core.ToPath GetCalendarState where
toPath :: GetCalendarState -> ByteString
toPath = ByteString -> GetCalendarState -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery GetCalendarState where
toQuery :: GetCalendarState -> QueryString
toQuery = QueryString -> GetCalendarState -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data GetCalendarStateResponse = GetCalendarStateResponse'
{
GetCalendarStateResponse -> Maybe CalendarState
state :: Prelude.Maybe CalendarState,
GetCalendarStateResponse -> Maybe Text
nextTransitionTime :: Prelude.Maybe Prelude.Text,
GetCalendarStateResponse -> Maybe Text
atTime :: Prelude.Maybe Prelude.Text,
GetCalendarStateResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetCalendarStateResponse -> GetCalendarStateResponse -> Bool
(GetCalendarStateResponse -> GetCalendarStateResponse -> Bool)
-> (GetCalendarStateResponse -> GetCalendarStateResponse -> Bool)
-> Eq GetCalendarStateResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetCalendarStateResponse -> GetCalendarStateResponse -> Bool
$c/= :: GetCalendarStateResponse -> GetCalendarStateResponse -> Bool
== :: GetCalendarStateResponse -> GetCalendarStateResponse -> Bool
$c== :: GetCalendarStateResponse -> GetCalendarStateResponse -> Bool
Prelude.Eq, ReadPrec [GetCalendarStateResponse]
ReadPrec GetCalendarStateResponse
Int -> ReadS GetCalendarStateResponse
ReadS [GetCalendarStateResponse]
(Int -> ReadS GetCalendarStateResponse)
-> ReadS [GetCalendarStateResponse]
-> ReadPrec GetCalendarStateResponse
-> ReadPrec [GetCalendarStateResponse]
-> Read GetCalendarStateResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetCalendarStateResponse]
$creadListPrec :: ReadPrec [GetCalendarStateResponse]
readPrec :: ReadPrec GetCalendarStateResponse
$creadPrec :: ReadPrec GetCalendarStateResponse
readList :: ReadS [GetCalendarStateResponse]
$creadList :: ReadS [GetCalendarStateResponse]
readsPrec :: Int -> ReadS GetCalendarStateResponse
$creadsPrec :: Int -> ReadS GetCalendarStateResponse
Prelude.Read, Int -> GetCalendarStateResponse -> ShowS
[GetCalendarStateResponse] -> ShowS
GetCalendarStateResponse -> String
(Int -> GetCalendarStateResponse -> ShowS)
-> (GetCalendarStateResponse -> String)
-> ([GetCalendarStateResponse] -> ShowS)
-> Show GetCalendarStateResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetCalendarStateResponse] -> ShowS
$cshowList :: [GetCalendarStateResponse] -> ShowS
show :: GetCalendarStateResponse -> String
$cshow :: GetCalendarStateResponse -> String
showsPrec :: Int -> GetCalendarStateResponse -> ShowS
$cshowsPrec :: Int -> GetCalendarStateResponse -> ShowS
Prelude.Show, (forall x.
GetCalendarStateResponse -> Rep GetCalendarStateResponse x)
-> (forall x.
Rep GetCalendarStateResponse x -> GetCalendarStateResponse)
-> Generic GetCalendarStateResponse
forall x.
Rep GetCalendarStateResponse x -> GetCalendarStateResponse
forall x.
GetCalendarStateResponse -> Rep GetCalendarStateResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetCalendarStateResponse x -> GetCalendarStateResponse
$cfrom :: forall x.
GetCalendarStateResponse -> Rep GetCalendarStateResponse x
Prelude.Generic)
newGetCalendarStateResponse ::
Prelude.Int ->
GetCalendarStateResponse
newGetCalendarStateResponse :: Int -> GetCalendarStateResponse
newGetCalendarStateResponse Int
pHttpStatus_ =
GetCalendarStateResponse' :: Maybe CalendarState
-> Maybe Text -> Maybe Text -> Int -> GetCalendarStateResponse
GetCalendarStateResponse'
{ $sel:state:GetCalendarStateResponse' :: Maybe CalendarState
state = Maybe CalendarState
forall a. Maybe a
Prelude.Nothing,
$sel:nextTransitionTime:GetCalendarStateResponse' :: Maybe Text
nextTransitionTime = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:atTime:GetCalendarStateResponse' :: Maybe Text
atTime = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetCalendarStateResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getCalendarStateResponse_state :: Lens.Lens' GetCalendarStateResponse (Prelude.Maybe CalendarState)
getCalendarStateResponse_state :: (Maybe CalendarState -> f (Maybe CalendarState))
-> GetCalendarStateResponse -> f GetCalendarStateResponse
getCalendarStateResponse_state = (GetCalendarStateResponse -> Maybe CalendarState)
-> (GetCalendarStateResponse
-> Maybe CalendarState -> GetCalendarStateResponse)
-> Lens
GetCalendarStateResponse
GetCalendarStateResponse
(Maybe CalendarState)
(Maybe CalendarState)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetCalendarStateResponse' {Maybe CalendarState
state :: Maybe CalendarState
$sel:state:GetCalendarStateResponse' :: GetCalendarStateResponse -> Maybe CalendarState
state} -> Maybe CalendarState
state) (\s :: GetCalendarStateResponse
s@GetCalendarStateResponse' {} Maybe CalendarState
a -> GetCalendarStateResponse
s {$sel:state:GetCalendarStateResponse' :: Maybe CalendarState
state = Maybe CalendarState
a} :: GetCalendarStateResponse)
getCalendarStateResponse_nextTransitionTime :: Lens.Lens' GetCalendarStateResponse (Prelude.Maybe Prelude.Text)
getCalendarStateResponse_nextTransitionTime :: (Maybe Text -> f (Maybe Text))
-> GetCalendarStateResponse -> f GetCalendarStateResponse
getCalendarStateResponse_nextTransitionTime = (GetCalendarStateResponse -> Maybe Text)
-> (GetCalendarStateResponse
-> Maybe Text -> GetCalendarStateResponse)
-> Lens
GetCalendarStateResponse
GetCalendarStateResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetCalendarStateResponse' {Maybe Text
nextTransitionTime :: Maybe Text
$sel:nextTransitionTime:GetCalendarStateResponse' :: GetCalendarStateResponse -> Maybe Text
nextTransitionTime} -> Maybe Text
nextTransitionTime) (\s :: GetCalendarStateResponse
s@GetCalendarStateResponse' {} Maybe Text
a -> GetCalendarStateResponse
s {$sel:nextTransitionTime:GetCalendarStateResponse' :: Maybe Text
nextTransitionTime = Maybe Text
a} :: GetCalendarStateResponse)
getCalendarStateResponse_atTime :: Lens.Lens' GetCalendarStateResponse (Prelude.Maybe Prelude.Text)
getCalendarStateResponse_atTime :: (Maybe Text -> f (Maybe Text))
-> GetCalendarStateResponse -> f GetCalendarStateResponse
getCalendarStateResponse_atTime = (GetCalendarStateResponse -> Maybe Text)
-> (GetCalendarStateResponse
-> Maybe Text -> GetCalendarStateResponse)
-> Lens
GetCalendarStateResponse
GetCalendarStateResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetCalendarStateResponse' {Maybe Text
atTime :: Maybe Text
$sel:atTime:GetCalendarStateResponse' :: GetCalendarStateResponse -> Maybe Text
atTime} -> Maybe Text
atTime) (\s :: GetCalendarStateResponse
s@GetCalendarStateResponse' {} Maybe Text
a -> GetCalendarStateResponse
s {$sel:atTime:GetCalendarStateResponse' :: Maybe Text
atTime = Maybe Text
a} :: GetCalendarStateResponse)
getCalendarStateResponse_httpStatus :: Lens.Lens' GetCalendarStateResponse Prelude.Int
getCalendarStateResponse_httpStatus :: (Int -> f Int)
-> GetCalendarStateResponse -> f GetCalendarStateResponse
getCalendarStateResponse_httpStatus = (GetCalendarStateResponse -> Int)
-> (GetCalendarStateResponse -> Int -> GetCalendarStateResponse)
-> Lens GetCalendarStateResponse GetCalendarStateResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetCalendarStateResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetCalendarStateResponse' :: GetCalendarStateResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetCalendarStateResponse
s@GetCalendarStateResponse' {} Int
a -> GetCalendarStateResponse
s {$sel:httpStatus:GetCalendarStateResponse' :: Int
httpStatus = Int
a} :: GetCalendarStateResponse)
instance Prelude.NFData GetCalendarStateResponse