{-# 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.OpsWorks.DescribeCommands
(
DescribeCommands (..),
newDescribeCommands,
describeCommands_deploymentId,
describeCommands_instanceId,
describeCommands_commandIds,
DescribeCommandsResponse (..),
newDescribeCommandsResponse,
describeCommandsResponse_commands,
describeCommandsResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.OpsWorks.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data DescribeCommands = DescribeCommands'
{
DescribeCommands -> Maybe Text
deploymentId :: Prelude.Maybe Prelude.Text,
DescribeCommands -> Maybe Text
instanceId :: Prelude.Maybe Prelude.Text,
DescribeCommands -> Maybe [Text]
commandIds :: Prelude.Maybe [Prelude.Text]
}
deriving (DescribeCommands -> DescribeCommands -> Bool
(DescribeCommands -> DescribeCommands -> Bool)
-> (DescribeCommands -> DescribeCommands -> Bool)
-> Eq DescribeCommands
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeCommands -> DescribeCommands -> Bool
$c/= :: DescribeCommands -> DescribeCommands -> Bool
== :: DescribeCommands -> DescribeCommands -> Bool
$c== :: DescribeCommands -> DescribeCommands -> Bool
Prelude.Eq, ReadPrec [DescribeCommands]
ReadPrec DescribeCommands
Int -> ReadS DescribeCommands
ReadS [DescribeCommands]
(Int -> ReadS DescribeCommands)
-> ReadS [DescribeCommands]
-> ReadPrec DescribeCommands
-> ReadPrec [DescribeCommands]
-> Read DescribeCommands
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeCommands]
$creadListPrec :: ReadPrec [DescribeCommands]
readPrec :: ReadPrec DescribeCommands
$creadPrec :: ReadPrec DescribeCommands
readList :: ReadS [DescribeCommands]
$creadList :: ReadS [DescribeCommands]
readsPrec :: Int -> ReadS DescribeCommands
$creadsPrec :: Int -> ReadS DescribeCommands
Prelude.Read, Int -> DescribeCommands -> ShowS
[DescribeCommands] -> ShowS
DescribeCommands -> String
(Int -> DescribeCommands -> ShowS)
-> (DescribeCommands -> String)
-> ([DescribeCommands] -> ShowS)
-> Show DescribeCommands
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeCommands] -> ShowS
$cshowList :: [DescribeCommands] -> ShowS
show :: DescribeCommands -> String
$cshow :: DescribeCommands -> String
showsPrec :: Int -> DescribeCommands -> ShowS
$cshowsPrec :: Int -> DescribeCommands -> ShowS
Prelude.Show, (forall x. DescribeCommands -> Rep DescribeCommands x)
-> (forall x. Rep DescribeCommands x -> DescribeCommands)
-> Generic DescribeCommands
forall x. Rep DescribeCommands x -> DescribeCommands
forall x. DescribeCommands -> Rep DescribeCommands x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeCommands x -> DescribeCommands
$cfrom :: forall x. DescribeCommands -> Rep DescribeCommands x
Prelude.Generic)
newDescribeCommands ::
DescribeCommands
newDescribeCommands :: DescribeCommands
newDescribeCommands =
DescribeCommands' :: Maybe Text -> Maybe Text -> Maybe [Text] -> DescribeCommands
DescribeCommands'
{ $sel:deploymentId:DescribeCommands' :: Maybe Text
deploymentId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:instanceId:DescribeCommands' :: Maybe Text
instanceId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:commandIds:DescribeCommands' :: Maybe [Text]
commandIds = Maybe [Text]
forall a. Maybe a
Prelude.Nothing
}
describeCommands_deploymentId :: Lens.Lens' DescribeCommands (Prelude.Maybe Prelude.Text)
describeCommands_deploymentId :: (Maybe Text -> f (Maybe Text))
-> DescribeCommands -> f DescribeCommands
describeCommands_deploymentId = (DescribeCommands -> Maybe Text)
-> (DescribeCommands -> Maybe Text -> DescribeCommands)
-> Lens DescribeCommands DescribeCommands (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeCommands' {Maybe Text
deploymentId :: Maybe Text
$sel:deploymentId:DescribeCommands' :: DescribeCommands -> Maybe Text
deploymentId} -> Maybe Text
deploymentId) (\s :: DescribeCommands
s@DescribeCommands' {} Maybe Text
a -> DescribeCommands
s {$sel:deploymentId:DescribeCommands' :: Maybe Text
deploymentId = Maybe Text
a} :: DescribeCommands)
describeCommands_instanceId :: Lens.Lens' DescribeCommands (Prelude.Maybe Prelude.Text)
describeCommands_instanceId :: (Maybe Text -> f (Maybe Text))
-> DescribeCommands -> f DescribeCommands
describeCommands_instanceId = (DescribeCommands -> Maybe Text)
-> (DescribeCommands -> Maybe Text -> DescribeCommands)
-> Lens DescribeCommands DescribeCommands (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeCommands' {Maybe Text
instanceId :: Maybe Text
$sel:instanceId:DescribeCommands' :: DescribeCommands -> Maybe Text
instanceId} -> Maybe Text
instanceId) (\s :: DescribeCommands
s@DescribeCommands' {} Maybe Text
a -> DescribeCommands
s {$sel:instanceId:DescribeCommands' :: Maybe Text
instanceId = Maybe Text
a} :: DescribeCommands)
describeCommands_commandIds :: Lens.Lens' DescribeCommands (Prelude.Maybe [Prelude.Text])
describeCommands_commandIds :: (Maybe [Text] -> f (Maybe [Text]))
-> DescribeCommands -> f DescribeCommands
describeCommands_commandIds = (DescribeCommands -> Maybe [Text])
-> (DescribeCommands -> Maybe [Text] -> DescribeCommands)
-> Lens
DescribeCommands DescribeCommands (Maybe [Text]) (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeCommands' {Maybe [Text]
commandIds :: Maybe [Text]
$sel:commandIds:DescribeCommands' :: DescribeCommands -> Maybe [Text]
commandIds} -> Maybe [Text]
commandIds) (\s :: DescribeCommands
s@DescribeCommands' {} Maybe [Text]
a -> DescribeCommands
s {$sel:commandIds:DescribeCommands' :: Maybe [Text]
commandIds = Maybe [Text]
a} :: DescribeCommands) ((Maybe [Text] -> f (Maybe [Text]))
-> DescribeCommands -> f DescribeCommands)
-> ((Maybe [Text] -> f (Maybe [Text]))
-> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> DescribeCommands
-> f DescribeCommands
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.AWSRequest DescribeCommands where
type
AWSResponse DescribeCommands =
DescribeCommandsResponse
request :: DescribeCommands -> Request DescribeCommands
request = Service -> DescribeCommands -> Request DescribeCommands
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy DescribeCommands
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DescribeCommands)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse DescribeCommands))
-> Logger
-> Service
-> Proxy DescribeCommands
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DescribeCommands)))
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 [Command] -> Int -> DescribeCommandsResponse
DescribeCommandsResponse'
(Maybe [Command] -> Int -> DescribeCommandsResponse)
-> Either String (Maybe [Command])
-> Either String (Int -> DescribeCommandsResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe (Maybe [Command]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Commands" Either String (Maybe (Maybe [Command]))
-> Maybe [Command] -> Either String (Maybe [Command])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [Command]
forall a. Monoid a => a
Prelude.mempty)
Either String (Int -> DescribeCommandsResponse)
-> Either String Int -> Either String DescribeCommandsResponse
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 DescribeCommands
instance Prelude.NFData DescribeCommands
instance Core.ToHeaders DescribeCommands where
toHeaders :: DescribeCommands -> ResponseHeaders
toHeaders =
ResponseHeaders -> DescribeCommands -> 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
"OpsWorks_20130218.DescribeCommands" ::
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 DescribeCommands where
toJSON :: DescribeCommands -> Value
toJSON DescribeCommands' {Maybe [Text]
Maybe Text
commandIds :: Maybe [Text]
instanceId :: Maybe Text
deploymentId :: Maybe Text
$sel:commandIds:DescribeCommands' :: DescribeCommands -> Maybe [Text]
$sel:instanceId:DescribeCommands' :: DescribeCommands -> Maybe Text
$sel:deploymentId:DescribeCommands' :: DescribeCommands -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"DeploymentId" 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
deploymentId,
(Text
"InstanceId" 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
instanceId,
(Text
"CommandIds" 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]
commandIds
]
)
instance Core.ToPath DescribeCommands where
toPath :: DescribeCommands -> ByteString
toPath = ByteString -> DescribeCommands -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery DescribeCommands where
toQuery :: DescribeCommands -> QueryString
toQuery = QueryString -> DescribeCommands -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data DescribeCommandsResponse = DescribeCommandsResponse'
{
DescribeCommandsResponse -> Maybe [Command]
commands :: Prelude.Maybe [Command],
DescribeCommandsResponse -> Int
httpStatus :: Prelude.Int
}
deriving (DescribeCommandsResponse -> DescribeCommandsResponse -> Bool
(DescribeCommandsResponse -> DescribeCommandsResponse -> Bool)
-> (DescribeCommandsResponse -> DescribeCommandsResponse -> Bool)
-> Eq DescribeCommandsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeCommandsResponse -> DescribeCommandsResponse -> Bool
$c/= :: DescribeCommandsResponse -> DescribeCommandsResponse -> Bool
== :: DescribeCommandsResponse -> DescribeCommandsResponse -> Bool
$c== :: DescribeCommandsResponse -> DescribeCommandsResponse -> Bool
Prelude.Eq, ReadPrec [DescribeCommandsResponse]
ReadPrec DescribeCommandsResponse
Int -> ReadS DescribeCommandsResponse
ReadS [DescribeCommandsResponse]
(Int -> ReadS DescribeCommandsResponse)
-> ReadS [DescribeCommandsResponse]
-> ReadPrec DescribeCommandsResponse
-> ReadPrec [DescribeCommandsResponse]
-> Read DescribeCommandsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeCommandsResponse]
$creadListPrec :: ReadPrec [DescribeCommandsResponse]
readPrec :: ReadPrec DescribeCommandsResponse
$creadPrec :: ReadPrec DescribeCommandsResponse
readList :: ReadS [DescribeCommandsResponse]
$creadList :: ReadS [DescribeCommandsResponse]
readsPrec :: Int -> ReadS DescribeCommandsResponse
$creadsPrec :: Int -> ReadS DescribeCommandsResponse
Prelude.Read, Int -> DescribeCommandsResponse -> ShowS
[DescribeCommandsResponse] -> ShowS
DescribeCommandsResponse -> String
(Int -> DescribeCommandsResponse -> ShowS)
-> (DescribeCommandsResponse -> String)
-> ([DescribeCommandsResponse] -> ShowS)
-> Show DescribeCommandsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeCommandsResponse] -> ShowS
$cshowList :: [DescribeCommandsResponse] -> ShowS
show :: DescribeCommandsResponse -> String
$cshow :: DescribeCommandsResponse -> String
showsPrec :: Int -> DescribeCommandsResponse -> ShowS
$cshowsPrec :: Int -> DescribeCommandsResponse -> ShowS
Prelude.Show, (forall x.
DescribeCommandsResponse -> Rep DescribeCommandsResponse x)
-> (forall x.
Rep DescribeCommandsResponse x -> DescribeCommandsResponse)
-> Generic DescribeCommandsResponse
forall x.
Rep DescribeCommandsResponse x -> DescribeCommandsResponse
forall x.
DescribeCommandsResponse -> Rep DescribeCommandsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeCommandsResponse x -> DescribeCommandsResponse
$cfrom :: forall x.
DescribeCommandsResponse -> Rep DescribeCommandsResponse x
Prelude.Generic)
newDescribeCommandsResponse ::
Prelude.Int ->
DescribeCommandsResponse
newDescribeCommandsResponse :: Int -> DescribeCommandsResponse
newDescribeCommandsResponse Int
pHttpStatus_ =
DescribeCommandsResponse' :: Maybe [Command] -> Int -> DescribeCommandsResponse
DescribeCommandsResponse'
{ $sel:commands:DescribeCommandsResponse' :: Maybe [Command]
commands =
Maybe [Command]
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:DescribeCommandsResponse' :: Int
httpStatus = Int
pHttpStatus_
}
describeCommandsResponse_commands :: Lens.Lens' DescribeCommandsResponse (Prelude.Maybe [Command])
describeCommandsResponse_commands :: (Maybe [Command] -> f (Maybe [Command]))
-> DescribeCommandsResponse -> f DescribeCommandsResponse
describeCommandsResponse_commands = (DescribeCommandsResponse -> Maybe [Command])
-> (DescribeCommandsResponse
-> Maybe [Command] -> DescribeCommandsResponse)
-> Lens
DescribeCommandsResponse
DescribeCommandsResponse
(Maybe [Command])
(Maybe [Command])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeCommandsResponse' {Maybe [Command]
commands :: Maybe [Command]
$sel:commands:DescribeCommandsResponse' :: DescribeCommandsResponse -> Maybe [Command]
commands} -> Maybe [Command]
commands) (\s :: DescribeCommandsResponse
s@DescribeCommandsResponse' {} Maybe [Command]
a -> DescribeCommandsResponse
s {$sel:commands:DescribeCommandsResponse' :: Maybe [Command]
commands = Maybe [Command]
a} :: DescribeCommandsResponse) ((Maybe [Command] -> f (Maybe [Command]))
-> DescribeCommandsResponse -> f DescribeCommandsResponse)
-> ((Maybe [Command] -> f (Maybe [Command]))
-> Maybe [Command] -> f (Maybe [Command]))
-> (Maybe [Command] -> f (Maybe [Command]))
-> DescribeCommandsResponse
-> f DescribeCommandsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Command] [Command] [Command] [Command]
-> Iso
(Maybe [Command])
(Maybe [Command])
(Maybe [Command])
(Maybe [Command])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso [Command] [Command] [Command] [Command]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
describeCommandsResponse_httpStatus :: Lens.Lens' DescribeCommandsResponse Prelude.Int
describeCommandsResponse_httpStatus :: (Int -> f Int)
-> DescribeCommandsResponse -> f DescribeCommandsResponse
describeCommandsResponse_httpStatus = (DescribeCommandsResponse -> Int)
-> (DescribeCommandsResponse -> Int -> DescribeCommandsResponse)
-> Lens DescribeCommandsResponse DescribeCommandsResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeCommandsResponse' {Int
httpStatus :: Int
$sel:httpStatus:DescribeCommandsResponse' :: DescribeCommandsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DescribeCommandsResponse
s@DescribeCommandsResponse' {} Int
a -> DescribeCommandsResponse
s {$sel:httpStatus:DescribeCommandsResponse' :: Int
httpStatus = Int
a} :: DescribeCommandsResponse)
instance Prelude.NFData DescribeCommandsResponse