{-# 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.ELB.DescribeTags
(
DescribeTags (..),
newDescribeTags,
describeTags_loadBalancerNames,
DescribeTagsResponse (..),
newDescribeTagsResponse,
describeTagsResponse_tagDescriptions,
describeTagsResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import Amazonka.ELB.Types
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data DescribeTags = DescribeTags'
{
DescribeTags -> NonEmpty Text
loadBalancerNames :: Prelude.NonEmpty Prelude.Text
}
deriving (DescribeTags -> DescribeTags -> Bool
(DescribeTags -> DescribeTags -> Bool)
-> (DescribeTags -> DescribeTags -> Bool) -> Eq DescribeTags
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeTags -> DescribeTags -> Bool
$c/= :: DescribeTags -> DescribeTags -> Bool
== :: DescribeTags -> DescribeTags -> Bool
$c== :: DescribeTags -> DescribeTags -> Bool
Prelude.Eq, ReadPrec [DescribeTags]
ReadPrec DescribeTags
Int -> ReadS DescribeTags
ReadS [DescribeTags]
(Int -> ReadS DescribeTags)
-> ReadS [DescribeTags]
-> ReadPrec DescribeTags
-> ReadPrec [DescribeTags]
-> Read DescribeTags
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeTags]
$creadListPrec :: ReadPrec [DescribeTags]
readPrec :: ReadPrec DescribeTags
$creadPrec :: ReadPrec DescribeTags
readList :: ReadS [DescribeTags]
$creadList :: ReadS [DescribeTags]
readsPrec :: Int -> ReadS DescribeTags
$creadsPrec :: Int -> ReadS DescribeTags
Prelude.Read, Int -> DescribeTags -> ShowS
[DescribeTags] -> ShowS
DescribeTags -> String
(Int -> DescribeTags -> ShowS)
-> (DescribeTags -> String)
-> ([DescribeTags] -> ShowS)
-> Show DescribeTags
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeTags] -> ShowS
$cshowList :: [DescribeTags] -> ShowS
show :: DescribeTags -> String
$cshow :: DescribeTags -> String
showsPrec :: Int -> DescribeTags -> ShowS
$cshowsPrec :: Int -> DescribeTags -> ShowS
Prelude.Show, (forall x. DescribeTags -> Rep DescribeTags x)
-> (forall x. Rep DescribeTags x -> DescribeTags)
-> Generic DescribeTags
forall x. Rep DescribeTags x -> DescribeTags
forall x. DescribeTags -> Rep DescribeTags x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeTags x -> DescribeTags
$cfrom :: forall x. DescribeTags -> Rep DescribeTags x
Prelude.Generic)
newDescribeTags ::
Prelude.NonEmpty Prelude.Text ->
DescribeTags
newDescribeTags :: NonEmpty Text -> DescribeTags
newDescribeTags NonEmpty Text
pLoadBalancerNames_ =
DescribeTags' :: NonEmpty Text -> DescribeTags
DescribeTags'
{ $sel:loadBalancerNames:DescribeTags' :: NonEmpty Text
loadBalancerNames =
Tagged (NonEmpty Text) (Identity (NonEmpty Text))
-> Tagged (NonEmpty Text) (Identity (NonEmpty Text))
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced (Tagged (NonEmpty Text) (Identity (NonEmpty Text))
-> Tagged (NonEmpty Text) (Identity (NonEmpty Text)))
-> NonEmpty Text -> NonEmpty Text
forall t b. AReview t b -> b -> t
Lens.# NonEmpty Text
pLoadBalancerNames_
}
describeTags_loadBalancerNames :: Lens.Lens' DescribeTags (Prelude.NonEmpty Prelude.Text)
describeTags_loadBalancerNames :: (NonEmpty Text -> f (NonEmpty Text))
-> DescribeTags -> f DescribeTags
describeTags_loadBalancerNames = (DescribeTags -> NonEmpty Text)
-> (DescribeTags -> NonEmpty Text -> DescribeTags)
-> Lens DescribeTags DescribeTags (NonEmpty Text) (NonEmpty Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeTags' {NonEmpty Text
loadBalancerNames :: NonEmpty Text
$sel:loadBalancerNames:DescribeTags' :: DescribeTags -> NonEmpty Text
loadBalancerNames} -> NonEmpty Text
loadBalancerNames) (\s :: DescribeTags
s@DescribeTags' {} NonEmpty Text
a -> DescribeTags
s {$sel:loadBalancerNames:DescribeTags' :: NonEmpty Text
loadBalancerNames = NonEmpty Text
a} :: DescribeTags) ((NonEmpty Text -> f (NonEmpty Text))
-> DescribeTags -> f DescribeTags)
-> ((NonEmpty Text -> f (NonEmpty Text))
-> NonEmpty Text -> f (NonEmpty Text))
-> (NonEmpty Text -> f (NonEmpty Text))
-> DescribeTags
-> f DescribeTags
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (NonEmpty Text -> f (NonEmpty Text))
-> NonEmpty Text -> f (NonEmpty Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.AWSRequest DescribeTags where
type AWSResponse DescribeTags = DescribeTagsResponse
request :: DescribeTags -> Request DescribeTags
request = Service -> DescribeTags -> Request DescribeTags
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery Service
defaultService
response :: Logger
-> Service
-> Proxy DescribeTags
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DescribeTags)))
response =
Text
-> (Int
-> ResponseHeaders
-> [Node]
-> Either String (AWSResponse DescribeTags))
-> Logger
-> Service
-> Proxy DescribeTags
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DescribeTags)))
forall (m :: * -> *) a.
MonadResource m =>
Text
-> (Int
-> ResponseHeaders -> [Node] -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveXMLWrapper
Text
"DescribeTagsResult"
( \Int
s ResponseHeaders
h [Node]
x ->
Maybe [TagDescription] -> Int -> DescribeTagsResponse
DescribeTagsResponse'
(Maybe [TagDescription] -> Int -> DescribeTagsResponse)
-> Either String (Maybe [TagDescription])
-> Either String (Int -> DescribeTagsResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( [Node]
x [Node] -> Text -> Either String (Maybe [Node])
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"TagDescriptions" Either String (Maybe [Node]) -> [Node] -> Either String [Node]
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ [Node]
forall a. Monoid a => a
Prelude.mempty
Either String [Node]
-> ([Node] -> Either String (Maybe [TagDescription]))
-> Either String (Maybe [TagDescription])
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= ([Node] -> Either String [TagDescription])
-> [Node] -> Either String (Maybe [TagDescription])
forall (f :: * -> *) a b.
Applicative f =>
([a] -> f b) -> [a] -> f (Maybe b)
Core.may (Text -> [Node] -> Either String [TagDescription]
forall a. FromXML a => Text -> [Node] -> Either String [a]
Core.parseXMLList Text
"member")
)
Either String (Int -> DescribeTagsResponse)
-> Either String Int -> Either String DescribeTagsResponse
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 DescribeTags
instance Prelude.NFData DescribeTags
instance Core.ToHeaders DescribeTags where
toHeaders :: DescribeTags -> ResponseHeaders
toHeaders = ResponseHeaders -> DescribeTags -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty
instance Core.ToPath DescribeTags where
toPath :: DescribeTags -> ByteString
toPath = ByteString -> DescribeTags -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery DescribeTags where
toQuery :: DescribeTags -> QueryString
toQuery DescribeTags' {NonEmpty Text
loadBalancerNames :: NonEmpty Text
$sel:loadBalancerNames:DescribeTags' :: DescribeTags -> NonEmpty Text
..} =
[QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"Action"
ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"DescribeTags" :: Prelude.ByteString),
ByteString
"Version"
ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"2012-06-01" :: Prelude.ByteString),
ByteString
"LoadBalancerNames"
ByteString -> QueryString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: ByteString -> NonEmpty Text -> QueryString
forall a.
(IsList a, ToQuery (Item a)) =>
ByteString -> a -> QueryString
Core.toQueryList ByteString
"member" NonEmpty Text
loadBalancerNames
]
data DescribeTagsResponse = DescribeTagsResponse'
{
DescribeTagsResponse -> Maybe [TagDescription]
tagDescriptions :: Prelude.Maybe [TagDescription],
DescribeTagsResponse -> Int
httpStatus :: Prelude.Int
}
deriving (DescribeTagsResponse -> DescribeTagsResponse -> Bool
(DescribeTagsResponse -> DescribeTagsResponse -> Bool)
-> (DescribeTagsResponse -> DescribeTagsResponse -> Bool)
-> Eq DescribeTagsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeTagsResponse -> DescribeTagsResponse -> Bool
$c/= :: DescribeTagsResponse -> DescribeTagsResponse -> Bool
== :: DescribeTagsResponse -> DescribeTagsResponse -> Bool
$c== :: DescribeTagsResponse -> DescribeTagsResponse -> Bool
Prelude.Eq, ReadPrec [DescribeTagsResponse]
ReadPrec DescribeTagsResponse
Int -> ReadS DescribeTagsResponse
ReadS [DescribeTagsResponse]
(Int -> ReadS DescribeTagsResponse)
-> ReadS [DescribeTagsResponse]
-> ReadPrec DescribeTagsResponse
-> ReadPrec [DescribeTagsResponse]
-> Read DescribeTagsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeTagsResponse]
$creadListPrec :: ReadPrec [DescribeTagsResponse]
readPrec :: ReadPrec DescribeTagsResponse
$creadPrec :: ReadPrec DescribeTagsResponse
readList :: ReadS [DescribeTagsResponse]
$creadList :: ReadS [DescribeTagsResponse]
readsPrec :: Int -> ReadS DescribeTagsResponse
$creadsPrec :: Int -> ReadS DescribeTagsResponse
Prelude.Read, Int -> DescribeTagsResponse -> ShowS
[DescribeTagsResponse] -> ShowS
DescribeTagsResponse -> String
(Int -> DescribeTagsResponse -> ShowS)
-> (DescribeTagsResponse -> String)
-> ([DescribeTagsResponse] -> ShowS)
-> Show DescribeTagsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeTagsResponse] -> ShowS
$cshowList :: [DescribeTagsResponse] -> ShowS
show :: DescribeTagsResponse -> String
$cshow :: DescribeTagsResponse -> String
showsPrec :: Int -> DescribeTagsResponse -> ShowS
$cshowsPrec :: Int -> DescribeTagsResponse -> ShowS
Prelude.Show, (forall x. DescribeTagsResponse -> Rep DescribeTagsResponse x)
-> (forall x. Rep DescribeTagsResponse x -> DescribeTagsResponse)
-> Generic DescribeTagsResponse
forall x. Rep DescribeTagsResponse x -> DescribeTagsResponse
forall x. DescribeTagsResponse -> Rep DescribeTagsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeTagsResponse x -> DescribeTagsResponse
$cfrom :: forall x. DescribeTagsResponse -> Rep DescribeTagsResponse x
Prelude.Generic)
newDescribeTagsResponse ::
Prelude.Int ->
DescribeTagsResponse
newDescribeTagsResponse :: Int -> DescribeTagsResponse
newDescribeTagsResponse Int
pHttpStatus_ =
DescribeTagsResponse' :: Maybe [TagDescription] -> Int -> DescribeTagsResponse
DescribeTagsResponse'
{ $sel:tagDescriptions:DescribeTagsResponse' :: Maybe [TagDescription]
tagDescriptions =
Maybe [TagDescription]
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:DescribeTagsResponse' :: Int
httpStatus = Int
pHttpStatus_
}
describeTagsResponse_tagDescriptions :: Lens.Lens' DescribeTagsResponse (Prelude.Maybe [TagDescription])
describeTagsResponse_tagDescriptions :: (Maybe [TagDescription] -> f (Maybe [TagDescription]))
-> DescribeTagsResponse -> f DescribeTagsResponse
describeTagsResponse_tagDescriptions = (DescribeTagsResponse -> Maybe [TagDescription])
-> (DescribeTagsResponse
-> Maybe [TagDescription] -> DescribeTagsResponse)
-> Lens
DescribeTagsResponse
DescribeTagsResponse
(Maybe [TagDescription])
(Maybe [TagDescription])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeTagsResponse' {Maybe [TagDescription]
tagDescriptions :: Maybe [TagDescription]
$sel:tagDescriptions:DescribeTagsResponse' :: DescribeTagsResponse -> Maybe [TagDescription]
tagDescriptions} -> Maybe [TagDescription]
tagDescriptions) (\s :: DescribeTagsResponse
s@DescribeTagsResponse' {} Maybe [TagDescription]
a -> DescribeTagsResponse
s {$sel:tagDescriptions:DescribeTagsResponse' :: Maybe [TagDescription]
tagDescriptions = Maybe [TagDescription]
a} :: DescribeTagsResponse) ((Maybe [TagDescription] -> f (Maybe [TagDescription]))
-> DescribeTagsResponse -> f DescribeTagsResponse)
-> ((Maybe [TagDescription] -> f (Maybe [TagDescription]))
-> Maybe [TagDescription] -> f (Maybe [TagDescription]))
-> (Maybe [TagDescription] -> f (Maybe [TagDescription]))
-> DescribeTagsResponse
-> f DescribeTagsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
[TagDescription] [TagDescription] [TagDescription] [TagDescription]
-> Iso
(Maybe [TagDescription])
(Maybe [TagDescription])
(Maybe [TagDescription])
(Maybe [TagDescription])
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
[TagDescription] [TagDescription] [TagDescription] [TagDescription]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
describeTagsResponse_httpStatus :: Lens.Lens' DescribeTagsResponse Prelude.Int
describeTagsResponse_httpStatus :: (Int -> f Int) -> DescribeTagsResponse -> f DescribeTagsResponse
describeTagsResponse_httpStatus = (DescribeTagsResponse -> Int)
-> (DescribeTagsResponse -> Int -> DescribeTagsResponse)
-> Lens DescribeTagsResponse DescribeTagsResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeTagsResponse' {Int
httpStatus :: Int
$sel:httpStatus:DescribeTagsResponse' :: DescribeTagsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DescribeTagsResponse
s@DescribeTagsResponse' {} Int
a -> DescribeTagsResponse
s {$sel:httpStatus:DescribeTagsResponse' :: Int
httpStatus = Int
a} :: DescribeTagsResponse)
instance Prelude.NFData DescribeTagsResponse