{-# 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.DescribeInstances
(
DescribeInstances (..),
newDescribeInstances,
describeInstances_instanceIds,
describeInstances_stackId,
describeInstances_layerId,
DescribeInstancesResponse (..),
newDescribeInstancesResponse,
describeInstancesResponse_instances,
describeInstancesResponse_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 DescribeInstances = DescribeInstances'
{
DescribeInstances -> Maybe [Text]
instanceIds :: Prelude.Maybe [Prelude.Text],
DescribeInstances -> Maybe Text
stackId :: Prelude.Maybe Prelude.Text,
DescribeInstances -> Maybe Text
layerId :: Prelude.Maybe Prelude.Text
}
deriving (DescribeInstances -> DescribeInstances -> Bool
(DescribeInstances -> DescribeInstances -> Bool)
-> (DescribeInstances -> DescribeInstances -> Bool)
-> Eq DescribeInstances
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeInstances -> DescribeInstances -> Bool
$c/= :: DescribeInstances -> DescribeInstances -> Bool
== :: DescribeInstances -> DescribeInstances -> Bool
$c== :: DescribeInstances -> DescribeInstances -> Bool
Prelude.Eq, ReadPrec [DescribeInstances]
ReadPrec DescribeInstances
Int -> ReadS DescribeInstances
ReadS [DescribeInstances]
(Int -> ReadS DescribeInstances)
-> ReadS [DescribeInstances]
-> ReadPrec DescribeInstances
-> ReadPrec [DescribeInstances]
-> Read DescribeInstances
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeInstances]
$creadListPrec :: ReadPrec [DescribeInstances]
readPrec :: ReadPrec DescribeInstances
$creadPrec :: ReadPrec DescribeInstances
readList :: ReadS [DescribeInstances]
$creadList :: ReadS [DescribeInstances]
readsPrec :: Int -> ReadS DescribeInstances
$creadsPrec :: Int -> ReadS DescribeInstances
Prelude.Read, Int -> DescribeInstances -> ShowS
[DescribeInstances] -> ShowS
DescribeInstances -> String
(Int -> DescribeInstances -> ShowS)
-> (DescribeInstances -> String)
-> ([DescribeInstances] -> ShowS)
-> Show DescribeInstances
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeInstances] -> ShowS
$cshowList :: [DescribeInstances] -> ShowS
show :: DescribeInstances -> String
$cshow :: DescribeInstances -> String
showsPrec :: Int -> DescribeInstances -> ShowS
$cshowsPrec :: Int -> DescribeInstances -> ShowS
Prelude.Show, (forall x. DescribeInstances -> Rep DescribeInstances x)
-> (forall x. Rep DescribeInstances x -> DescribeInstances)
-> Generic DescribeInstances
forall x. Rep DescribeInstances x -> DescribeInstances
forall x. DescribeInstances -> Rep DescribeInstances x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeInstances x -> DescribeInstances
$cfrom :: forall x. DescribeInstances -> Rep DescribeInstances x
Prelude.Generic)
newDescribeInstances ::
DescribeInstances
newDescribeInstances :: DescribeInstances
newDescribeInstances =
DescribeInstances' :: Maybe [Text] -> Maybe Text -> Maybe Text -> DescribeInstances
DescribeInstances'
{ $sel:instanceIds:DescribeInstances' :: Maybe [Text]
instanceIds = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
$sel:stackId:DescribeInstances' :: Maybe Text
stackId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:layerId:DescribeInstances' :: Maybe Text
layerId = Maybe Text
forall a. Maybe a
Prelude.Nothing
}
describeInstances_instanceIds :: Lens.Lens' DescribeInstances (Prelude.Maybe [Prelude.Text])
describeInstances_instanceIds :: (Maybe [Text] -> f (Maybe [Text]))
-> DescribeInstances -> f DescribeInstances
describeInstances_instanceIds = (DescribeInstances -> Maybe [Text])
-> (DescribeInstances -> Maybe [Text] -> DescribeInstances)
-> Lens
DescribeInstances DescribeInstances (Maybe [Text]) (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeInstances' {Maybe [Text]
instanceIds :: Maybe [Text]
$sel:instanceIds:DescribeInstances' :: DescribeInstances -> Maybe [Text]
instanceIds} -> Maybe [Text]
instanceIds) (\s :: DescribeInstances
s@DescribeInstances' {} Maybe [Text]
a -> DescribeInstances
s {$sel:instanceIds:DescribeInstances' :: Maybe [Text]
instanceIds = Maybe [Text]
a} :: DescribeInstances) ((Maybe [Text] -> f (Maybe [Text]))
-> DescribeInstances -> f DescribeInstances)
-> ((Maybe [Text] -> f (Maybe [Text]))
-> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> DescribeInstances
-> f DescribeInstances
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
describeInstances_stackId :: Lens.Lens' DescribeInstances (Prelude.Maybe Prelude.Text)
describeInstances_stackId :: (Maybe Text -> f (Maybe Text))
-> DescribeInstances -> f DescribeInstances
describeInstances_stackId = (DescribeInstances -> Maybe Text)
-> (DescribeInstances -> Maybe Text -> DescribeInstances)
-> Lens
DescribeInstances DescribeInstances (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeInstances' {Maybe Text
stackId :: Maybe Text
$sel:stackId:DescribeInstances' :: DescribeInstances -> Maybe Text
stackId} -> Maybe Text
stackId) (\s :: DescribeInstances
s@DescribeInstances' {} Maybe Text
a -> DescribeInstances
s {$sel:stackId:DescribeInstances' :: Maybe Text
stackId = Maybe Text
a} :: DescribeInstances)
describeInstances_layerId :: Lens.Lens' DescribeInstances (Prelude.Maybe Prelude.Text)
describeInstances_layerId :: (Maybe Text -> f (Maybe Text))
-> DescribeInstances -> f DescribeInstances
describeInstances_layerId = (DescribeInstances -> Maybe Text)
-> (DescribeInstances -> Maybe Text -> DescribeInstances)
-> Lens
DescribeInstances DescribeInstances (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeInstances' {Maybe Text
layerId :: Maybe Text
$sel:layerId:DescribeInstances' :: DescribeInstances -> Maybe Text
layerId} -> Maybe Text
layerId) (\s :: DescribeInstances
s@DescribeInstances' {} Maybe Text
a -> DescribeInstances
s {$sel:layerId:DescribeInstances' :: Maybe Text
layerId = Maybe Text
a} :: DescribeInstances)
instance Core.AWSRequest DescribeInstances where
type
AWSResponse DescribeInstances =
DescribeInstancesResponse
request :: DescribeInstances -> Request DescribeInstances
request = Service -> DescribeInstances -> Request DescribeInstances
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy DescribeInstances
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse DescribeInstances)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse DescribeInstances))
-> Logger
-> Service
-> Proxy DescribeInstances
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse DescribeInstances)))
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 [Instance] -> Int -> DescribeInstancesResponse
DescribeInstancesResponse'
(Maybe [Instance] -> Int -> DescribeInstancesResponse)
-> Either String (Maybe [Instance])
-> Either String (Int -> DescribeInstancesResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe (Maybe [Instance]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Instances" Either String (Maybe (Maybe [Instance]))
-> Maybe [Instance] -> Either String (Maybe [Instance])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [Instance]
forall a. Monoid a => a
Prelude.mempty)
Either String (Int -> DescribeInstancesResponse)
-> Either String Int -> Either String DescribeInstancesResponse
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 DescribeInstances
instance Prelude.NFData DescribeInstances
instance Core.ToHeaders DescribeInstances where
toHeaders :: DescribeInstances -> ResponseHeaders
toHeaders =
ResponseHeaders -> DescribeInstances -> 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.DescribeInstances" ::
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 DescribeInstances where
toJSON :: DescribeInstances -> Value
toJSON DescribeInstances' {Maybe [Text]
Maybe Text
layerId :: Maybe Text
stackId :: Maybe Text
instanceIds :: Maybe [Text]
$sel:layerId:DescribeInstances' :: DescribeInstances -> Maybe Text
$sel:stackId:DescribeInstances' :: DescribeInstances -> Maybe Text
$sel:instanceIds:DescribeInstances' :: DescribeInstances -> Maybe [Text]
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"InstanceIds" 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]
instanceIds,
(Text
"StackId" 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
stackId,
(Text
"LayerId" 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
layerId
]
)
instance Core.ToPath DescribeInstances where
toPath :: DescribeInstances -> ByteString
toPath = ByteString -> DescribeInstances -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery DescribeInstances where
toQuery :: DescribeInstances -> QueryString
toQuery = QueryString -> DescribeInstances -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data DescribeInstancesResponse = DescribeInstancesResponse'
{
DescribeInstancesResponse -> Maybe [Instance]
instances :: Prelude.Maybe [Instance],
DescribeInstancesResponse -> Int
httpStatus :: Prelude.Int
}
deriving (DescribeInstancesResponse -> DescribeInstancesResponse -> Bool
(DescribeInstancesResponse -> DescribeInstancesResponse -> Bool)
-> (DescribeInstancesResponse -> DescribeInstancesResponse -> Bool)
-> Eq DescribeInstancesResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeInstancesResponse -> DescribeInstancesResponse -> Bool
$c/= :: DescribeInstancesResponse -> DescribeInstancesResponse -> Bool
== :: DescribeInstancesResponse -> DescribeInstancesResponse -> Bool
$c== :: DescribeInstancesResponse -> DescribeInstancesResponse -> Bool
Prelude.Eq, ReadPrec [DescribeInstancesResponse]
ReadPrec DescribeInstancesResponse
Int -> ReadS DescribeInstancesResponse
ReadS [DescribeInstancesResponse]
(Int -> ReadS DescribeInstancesResponse)
-> ReadS [DescribeInstancesResponse]
-> ReadPrec DescribeInstancesResponse
-> ReadPrec [DescribeInstancesResponse]
-> Read DescribeInstancesResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeInstancesResponse]
$creadListPrec :: ReadPrec [DescribeInstancesResponse]
readPrec :: ReadPrec DescribeInstancesResponse
$creadPrec :: ReadPrec DescribeInstancesResponse
readList :: ReadS [DescribeInstancesResponse]
$creadList :: ReadS [DescribeInstancesResponse]
readsPrec :: Int -> ReadS DescribeInstancesResponse
$creadsPrec :: Int -> ReadS DescribeInstancesResponse
Prelude.Read, Int -> DescribeInstancesResponse -> ShowS
[DescribeInstancesResponse] -> ShowS
DescribeInstancesResponse -> String
(Int -> DescribeInstancesResponse -> ShowS)
-> (DescribeInstancesResponse -> String)
-> ([DescribeInstancesResponse] -> ShowS)
-> Show DescribeInstancesResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeInstancesResponse] -> ShowS
$cshowList :: [DescribeInstancesResponse] -> ShowS
show :: DescribeInstancesResponse -> String
$cshow :: DescribeInstancesResponse -> String
showsPrec :: Int -> DescribeInstancesResponse -> ShowS
$cshowsPrec :: Int -> DescribeInstancesResponse -> ShowS
Prelude.Show, (forall x.
DescribeInstancesResponse -> Rep DescribeInstancesResponse x)
-> (forall x.
Rep DescribeInstancesResponse x -> DescribeInstancesResponse)
-> Generic DescribeInstancesResponse
forall x.
Rep DescribeInstancesResponse x -> DescribeInstancesResponse
forall x.
DescribeInstancesResponse -> Rep DescribeInstancesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeInstancesResponse x -> DescribeInstancesResponse
$cfrom :: forall x.
DescribeInstancesResponse -> Rep DescribeInstancesResponse x
Prelude.Generic)
newDescribeInstancesResponse ::
Prelude.Int ->
DescribeInstancesResponse
newDescribeInstancesResponse :: Int -> DescribeInstancesResponse
newDescribeInstancesResponse Int
pHttpStatus_ =
DescribeInstancesResponse' :: Maybe [Instance] -> Int -> DescribeInstancesResponse
DescribeInstancesResponse'
{ $sel:instances:DescribeInstancesResponse' :: Maybe [Instance]
instances =
Maybe [Instance]
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:DescribeInstancesResponse' :: Int
httpStatus = Int
pHttpStatus_
}
describeInstancesResponse_instances :: Lens.Lens' DescribeInstancesResponse (Prelude.Maybe [Instance])
describeInstancesResponse_instances :: (Maybe [Instance] -> f (Maybe [Instance]))
-> DescribeInstancesResponse -> f DescribeInstancesResponse
describeInstancesResponse_instances = (DescribeInstancesResponse -> Maybe [Instance])
-> (DescribeInstancesResponse
-> Maybe [Instance] -> DescribeInstancesResponse)
-> Lens
DescribeInstancesResponse
DescribeInstancesResponse
(Maybe [Instance])
(Maybe [Instance])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeInstancesResponse' {Maybe [Instance]
instances :: Maybe [Instance]
$sel:instances:DescribeInstancesResponse' :: DescribeInstancesResponse -> Maybe [Instance]
instances} -> Maybe [Instance]
instances) (\s :: DescribeInstancesResponse
s@DescribeInstancesResponse' {} Maybe [Instance]
a -> DescribeInstancesResponse
s {$sel:instances:DescribeInstancesResponse' :: Maybe [Instance]
instances = Maybe [Instance]
a} :: DescribeInstancesResponse) ((Maybe [Instance] -> f (Maybe [Instance]))
-> DescribeInstancesResponse -> f DescribeInstancesResponse)
-> ((Maybe [Instance] -> f (Maybe [Instance]))
-> Maybe [Instance] -> f (Maybe [Instance]))
-> (Maybe [Instance] -> f (Maybe [Instance]))
-> DescribeInstancesResponse
-> f DescribeInstancesResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Instance] [Instance] [Instance] [Instance]
-> Iso
(Maybe [Instance])
(Maybe [Instance])
(Maybe [Instance])
(Maybe [Instance])
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 [Instance] [Instance] [Instance] [Instance]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
describeInstancesResponse_httpStatus :: Lens.Lens' DescribeInstancesResponse Prelude.Int
describeInstancesResponse_httpStatus :: (Int -> f Int)
-> DescribeInstancesResponse -> f DescribeInstancesResponse
describeInstancesResponse_httpStatus = (DescribeInstancesResponse -> Int)
-> (DescribeInstancesResponse -> Int -> DescribeInstancesResponse)
-> Lens DescribeInstancesResponse DescribeInstancesResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeInstancesResponse' {Int
httpStatus :: Int
$sel:httpStatus:DescribeInstancesResponse' :: DescribeInstancesResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DescribeInstancesResponse
s@DescribeInstancesResponse' {} Int
a -> DescribeInstancesResponse
s {$sel:httpStatus:DescribeInstancesResponse' :: Int
httpStatus = Int
a} :: DescribeInstancesResponse)
instance Prelude.NFData DescribeInstancesResponse