{-# 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.DescribeElasticIps
(
DescribeElasticIps (..),
newDescribeElasticIps,
describeElasticIps_instanceId,
describeElasticIps_ips,
describeElasticIps_stackId,
DescribeElasticIpsResponse (..),
newDescribeElasticIpsResponse,
describeElasticIpsResponse_elasticIps,
describeElasticIpsResponse_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 DescribeElasticIps = DescribeElasticIps'
{
DescribeElasticIps -> Maybe Text
instanceId :: Prelude.Maybe Prelude.Text,
DescribeElasticIps -> Maybe [Text]
ips :: Prelude.Maybe [Prelude.Text],
DescribeElasticIps -> Maybe Text
stackId :: Prelude.Maybe Prelude.Text
}
deriving (DescribeElasticIps -> DescribeElasticIps -> Bool
(DescribeElasticIps -> DescribeElasticIps -> Bool)
-> (DescribeElasticIps -> DescribeElasticIps -> Bool)
-> Eq DescribeElasticIps
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeElasticIps -> DescribeElasticIps -> Bool
$c/= :: DescribeElasticIps -> DescribeElasticIps -> Bool
== :: DescribeElasticIps -> DescribeElasticIps -> Bool
$c== :: DescribeElasticIps -> DescribeElasticIps -> Bool
Prelude.Eq, ReadPrec [DescribeElasticIps]
ReadPrec DescribeElasticIps
Int -> ReadS DescribeElasticIps
ReadS [DescribeElasticIps]
(Int -> ReadS DescribeElasticIps)
-> ReadS [DescribeElasticIps]
-> ReadPrec DescribeElasticIps
-> ReadPrec [DescribeElasticIps]
-> Read DescribeElasticIps
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeElasticIps]
$creadListPrec :: ReadPrec [DescribeElasticIps]
readPrec :: ReadPrec DescribeElasticIps
$creadPrec :: ReadPrec DescribeElasticIps
readList :: ReadS [DescribeElasticIps]
$creadList :: ReadS [DescribeElasticIps]
readsPrec :: Int -> ReadS DescribeElasticIps
$creadsPrec :: Int -> ReadS DescribeElasticIps
Prelude.Read, Int -> DescribeElasticIps -> ShowS
[DescribeElasticIps] -> ShowS
DescribeElasticIps -> String
(Int -> DescribeElasticIps -> ShowS)
-> (DescribeElasticIps -> String)
-> ([DescribeElasticIps] -> ShowS)
-> Show DescribeElasticIps
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeElasticIps] -> ShowS
$cshowList :: [DescribeElasticIps] -> ShowS
show :: DescribeElasticIps -> String
$cshow :: DescribeElasticIps -> String
showsPrec :: Int -> DescribeElasticIps -> ShowS
$cshowsPrec :: Int -> DescribeElasticIps -> ShowS
Prelude.Show, (forall x. DescribeElasticIps -> Rep DescribeElasticIps x)
-> (forall x. Rep DescribeElasticIps x -> DescribeElasticIps)
-> Generic DescribeElasticIps
forall x. Rep DescribeElasticIps x -> DescribeElasticIps
forall x. DescribeElasticIps -> Rep DescribeElasticIps x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeElasticIps x -> DescribeElasticIps
$cfrom :: forall x. DescribeElasticIps -> Rep DescribeElasticIps x
Prelude.Generic)
newDescribeElasticIps ::
DescribeElasticIps
newDescribeElasticIps :: DescribeElasticIps
newDescribeElasticIps =
DescribeElasticIps' :: Maybe Text -> Maybe [Text] -> Maybe Text -> DescribeElasticIps
DescribeElasticIps'
{ $sel:instanceId:DescribeElasticIps' :: Maybe Text
instanceId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:ips:DescribeElasticIps' :: Maybe [Text]
ips = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
$sel:stackId:DescribeElasticIps' :: Maybe Text
stackId = Maybe Text
forall a. Maybe a
Prelude.Nothing
}
describeElasticIps_instanceId :: Lens.Lens' DescribeElasticIps (Prelude.Maybe Prelude.Text)
describeElasticIps_instanceId :: (Maybe Text -> f (Maybe Text))
-> DescribeElasticIps -> f DescribeElasticIps
describeElasticIps_instanceId = (DescribeElasticIps -> Maybe Text)
-> (DescribeElasticIps -> Maybe Text -> DescribeElasticIps)
-> Lens
DescribeElasticIps DescribeElasticIps (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeElasticIps' {Maybe Text
instanceId :: Maybe Text
$sel:instanceId:DescribeElasticIps' :: DescribeElasticIps -> Maybe Text
instanceId} -> Maybe Text
instanceId) (\s :: DescribeElasticIps
s@DescribeElasticIps' {} Maybe Text
a -> DescribeElasticIps
s {$sel:instanceId:DescribeElasticIps' :: Maybe Text
instanceId = Maybe Text
a} :: DescribeElasticIps)
describeElasticIps_ips :: Lens.Lens' DescribeElasticIps (Prelude.Maybe [Prelude.Text])
describeElasticIps_ips :: (Maybe [Text] -> f (Maybe [Text]))
-> DescribeElasticIps -> f DescribeElasticIps
describeElasticIps_ips = (DescribeElasticIps -> Maybe [Text])
-> (DescribeElasticIps -> Maybe [Text] -> DescribeElasticIps)
-> Lens
DescribeElasticIps DescribeElasticIps (Maybe [Text]) (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeElasticIps' {Maybe [Text]
ips :: Maybe [Text]
$sel:ips:DescribeElasticIps' :: DescribeElasticIps -> Maybe [Text]
ips} -> Maybe [Text]
ips) (\s :: DescribeElasticIps
s@DescribeElasticIps' {} Maybe [Text]
a -> DescribeElasticIps
s {$sel:ips:DescribeElasticIps' :: Maybe [Text]
ips = Maybe [Text]
a} :: DescribeElasticIps) ((Maybe [Text] -> f (Maybe [Text]))
-> DescribeElasticIps -> f DescribeElasticIps)
-> ((Maybe [Text] -> f (Maybe [Text]))
-> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> DescribeElasticIps
-> f DescribeElasticIps
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
describeElasticIps_stackId :: Lens.Lens' DescribeElasticIps (Prelude.Maybe Prelude.Text)
describeElasticIps_stackId :: (Maybe Text -> f (Maybe Text))
-> DescribeElasticIps -> f DescribeElasticIps
describeElasticIps_stackId = (DescribeElasticIps -> Maybe Text)
-> (DescribeElasticIps -> Maybe Text -> DescribeElasticIps)
-> Lens
DescribeElasticIps DescribeElasticIps (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeElasticIps' {Maybe Text
stackId :: Maybe Text
$sel:stackId:DescribeElasticIps' :: DescribeElasticIps -> Maybe Text
stackId} -> Maybe Text
stackId) (\s :: DescribeElasticIps
s@DescribeElasticIps' {} Maybe Text
a -> DescribeElasticIps
s {$sel:stackId:DescribeElasticIps' :: Maybe Text
stackId = Maybe Text
a} :: DescribeElasticIps)
instance Core.AWSRequest DescribeElasticIps where
type
AWSResponse DescribeElasticIps =
DescribeElasticIpsResponse
request :: DescribeElasticIps -> Request DescribeElasticIps
request = Service -> DescribeElasticIps -> Request DescribeElasticIps
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy DescribeElasticIps
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse DescribeElasticIps)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse DescribeElasticIps))
-> Logger
-> Service
-> Proxy DescribeElasticIps
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse DescribeElasticIps)))
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 [ElasticIp] -> Int -> DescribeElasticIpsResponse
DescribeElasticIpsResponse'
(Maybe [ElasticIp] -> Int -> DescribeElasticIpsResponse)
-> Either String (Maybe [ElasticIp])
-> Either String (Int -> DescribeElasticIpsResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe (Maybe [ElasticIp]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"ElasticIps" Either String (Maybe (Maybe [ElasticIp]))
-> Maybe [ElasticIp] -> Either String (Maybe [ElasticIp])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [ElasticIp]
forall a. Monoid a => a
Prelude.mempty)
Either String (Int -> DescribeElasticIpsResponse)
-> Either String Int -> Either String DescribeElasticIpsResponse
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 DescribeElasticIps
instance Prelude.NFData DescribeElasticIps
instance Core.ToHeaders DescribeElasticIps where
toHeaders :: DescribeElasticIps -> ResponseHeaders
toHeaders =
ResponseHeaders -> DescribeElasticIps -> 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.DescribeElasticIps" ::
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 DescribeElasticIps where
toJSON :: DescribeElasticIps -> Value
toJSON DescribeElasticIps' {Maybe [Text]
Maybe Text
stackId :: Maybe Text
ips :: Maybe [Text]
instanceId :: Maybe Text
$sel:stackId:DescribeElasticIps' :: DescribeElasticIps -> Maybe Text
$sel:ips:DescribeElasticIps' :: DescribeElasticIps -> Maybe [Text]
$sel:instanceId:DescribeElasticIps' :: DescribeElasticIps -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (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
"Ips" 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]
ips,
(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
]
)
instance Core.ToPath DescribeElasticIps where
toPath :: DescribeElasticIps -> ByteString
toPath = ByteString -> DescribeElasticIps -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery DescribeElasticIps where
toQuery :: DescribeElasticIps -> QueryString
toQuery = QueryString -> DescribeElasticIps -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data DescribeElasticIpsResponse = DescribeElasticIpsResponse'
{
DescribeElasticIpsResponse -> Maybe [ElasticIp]
elasticIps :: Prelude.Maybe [ElasticIp],
DescribeElasticIpsResponse -> Int
httpStatus :: Prelude.Int
}
deriving (DescribeElasticIpsResponse -> DescribeElasticIpsResponse -> Bool
(DescribeElasticIpsResponse -> DescribeElasticIpsResponse -> Bool)
-> (DescribeElasticIpsResponse
-> DescribeElasticIpsResponse -> Bool)
-> Eq DescribeElasticIpsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeElasticIpsResponse -> DescribeElasticIpsResponse -> Bool
$c/= :: DescribeElasticIpsResponse -> DescribeElasticIpsResponse -> Bool
== :: DescribeElasticIpsResponse -> DescribeElasticIpsResponse -> Bool
$c== :: DescribeElasticIpsResponse -> DescribeElasticIpsResponse -> Bool
Prelude.Eq, ReadPrec [DescribeElasticIpsResponse]
ReadPrec DescribeElasticIpsResponse
Int -> ReadS DescribeElasticIpsResponse
ReadS [DescribeElasticIpsResponse]
(Int -> ReadS DescribeElasticIpsResponse)
-> ReadS [DescribeElasticIpsResponse]
-> ReadPrec DescribeElasticIpsResponse
-> ReadPrec [DescribeElasticIpsResponse]
-> Read DescribeElasticIpsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeElasticIpsResponse]
$creadListPrec :: ReadPrec [DescribeElasticIpsResponse]
readPrec :: ReadPrec DescribeElasticIpsResponse
$creadPrec :: ReadPrec DescribeElasticIpsResponse
readList :: ReadS [DescribeElasticIpsResponse]
$creadList :: ReadS [DescribeElasticIpsResponse]
readsPrec :: Int -> ReadS DescribeElasticIpsResponse
$creadsPrec :: Int -> ReadS DescribeElasticIpsResponse
Prelude.Read, Int -> DescribeElasticIpsResponse -> ShowS
[DescribeElasticIpsResponse] -> ShowS
DescribeElasticIpsResponse -> String
(Int -> DescribeElasticIpsResponse -> ShowS)
-> (DescribeElasticIpsResponse -> String)
-> ([DescribeElasticIpsResponse] -> ShowS)
-> Show DescribeElasticIpsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeElasticIpsResponse] -> ShowS
$cshowList :: [DescribeElasticIpsResponse] -> ShowS
show :: DescribeElasticIpsResponse -> String
$cshow :: DescribeElasticIpsResponse -> String
showsPrec :: Int -> DescribeElasticIpsResponse -> ShowS
$cshowsPrec :: Int -> DescribeElasticIpsResponse -> ShowS
Prelude.Show, (forall x.
DescribeElasticIpsResponse -> Rep DescribeElasticIpsResponse x)
-> (forall x.
Rep DescribeElasticIpsResponse x -> DescribeElasticIpsResponse)
-> Generic DescribeElasticIpsResponse
forall x.
Rep DescribeElasticIpsResponse x -> DescribeElasticIpsResponse
forall x.
DescribeElasticIpsResponse -> Rep DescribeElasticIpsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeElasticIpsResponse x -> DescribeElasticIpsResponse
$cfrom :: forall x.
DescribeElasticIpsResponse -> Rep DescribeElasticIpsResponse x
Prelude.Generic)
newDescribeElasticIpsResponse ::
Prelude.Int ->
DescribeElasticIpsResponse
newDescribeElasticIpsResponse :: Int -> DescribeElasticIpsResponse
newDescribeElasticIpsResponse Int
pHttpStatus_ =
DescribeElasticIpsResponse' :: Maybe [ElasticIp] -> Int -> DescribeElasticIpsResponse
DescribeElasticIpsResponse'
{ $sel:elasticIps:DescribeElasticIpsResponse' :: Maybe [ElasticIp]
elasticIps =
Maybe [ElasticIp]
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:DescribeElasticIpsResponse' :: Int
httpStatus = Int
pHttpStatus_
}
describeElasticIpsResponse_elasticIps :: Lens.Lens' DescribeElasticIpsResponse (Prelude.Maybe [ElasticIp])
describeElasticIpsResponse_elasticIps :: (Maybe [ElasticIp] -> f (Maybe [ElasticIp]))
-> DescribeElasticIpsResponse -> f DescribeElasticIpsResponse
describeElasticIpsResponse_elasticIps = (DescribeElasticIpsResponse -> Maybe [ElasticIp])
-> (DescribeElasticIpsResponse
-> Maybe [ElasticIp] -> DescribeElasticIpsResponse)
-> Lens
DescribeElasticIpsResponse
DescribeElasticIpsResponse
(Maybe [ElasticIp])
(Maybe [ElasticIp])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeElasticIpsResponse' {Maybe [ElasticIp]
elasticIps :: Maybe [ElasticIp]
$sel:elasticIps:DescribeElasticIpsResponse' :: DescribeElasticIpsResponse -> Maybe [ElasticIp]
elasticIps} -> Maybe [ElasticIp]
elasticIps) (\s :: DescribeElasticIpsResponse
s@DescribeElasticIpsResponse' {} Maybe [ElasticIp]
a -> DescribeElasticIpsResponse
s {$sel:elasticIps:DescribeElasticIpsResponse' :: Maybe [ElasticIp]
elasticIps = Maybe [ElasticIp]
a} :: DescribeElasticIpsResponse) ((Maybe [ElasticIp] -> f (Maybe [ElasticIp]))
-> DescribeElasticIpsResponse -> f DescribeElasticIpsResponse)
-> ((Maybe [ElasticIp] -> f (Maybe [ElasticIp]))
-> Maybe [ElasticIp] -> f (Maybe [ElasticIp]))
-> (Maybe [ElasticIp] -> f (Maybe [ElasticIp]))
-> DescribeElasticIpsResponse
-> f DescribeElasticIpsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [ElasticIp] [ElasticIp] [ElasticIp] [ElasticIp]
-> Iso
(Maybe [ElasticIp])
(Maybe [ElasticIp])
(Maybe [ElasticIp])
(Maybe [ElasticIp])
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 [ElasticIp] [ElasticIp] [ElasticIp] [ElasticIp]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
describeElasticIpsResponse_httpStatus :: Lens.Lens' DescribeElasticIpsResponse Prelude.Int
describeElasticIpsResponse_httpStatus :: (Int -> f Int)
-> DescribeElasticIpsResponse -> f DescribeElasticIpsResponse
describeElasticIpsResponse_httpStatus = (DescribeElasticIpsResponse -> Int)
-> (DescribeElasticIpsResponse
-> Int -> DescribeElasticIpsResponse)
-> Lens
DescribeElasticIpsResponse DescribeElasticIpsResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeElasticIpsResponse' {Int
httpStatus :: Int
$sel:httpStatus:DescribeElasticIpsResponse' :: DescribeElasticIpsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DescribeElasticIpsResponse
s@DescribeElasticIpsResponse' {} Int
a -> DescribeElasticIpsResponse
s {$sel:httpStatus:DescribeElasticIpsResponse' :: Int
httpStatus = Int
a} :: DescribeElasticIpsResponse)
instance Prelude.NFData DescribeElasticIpsResponse