{-# 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.EC2.DescribeTags
(
DescribeTags (..),
newDescribeTags,
describeTags_dryRun,
describeTags_filters,
describeTags_maxResults,
describeTags_nextToken,
DescribeTagsResponse (..),
newDescribeTagsResponse,
describeTagsResponse_nextToken,
describeTagsResponse_tags,
describeTagsResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.EC2.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data DescribeTags = DescribeTags'
{
DescribeTags -> Maybe Bool
dryRun :: Prelude.Maybe Prelude.Bool,
DescribeTags -> Maybe [Filter]
filters :: Prelude.Maybe [Filter],
DescribeTags -> Maybe Int
maxResults :: Prelude.Maybe Prelude.Int,
DescribeTags -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text
}
deriving (DescribeTags -> DescribeTags -> Bool
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]
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
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. 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 ::
DescribeTags
newDescribeTags :: DescribeTags
newDescribeTags =
DescribeTags'
{ $sel:dryRun:DescribeTags' :: Maybe Bool
dryRun = forall a. Maybe a
Prelude.Nothing,
$sel:filters:DescribeTags' :: Maybe [Filter]
filters = forall a. Maybe a
Prelude.Nothing,
$sel:maxResults:DescribeTags' :: Maybe Int
maxResults = forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:DescribeTags' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing
}
describeTags_dryRun :: Lens.Lens' DescribeTags (Prelude.Maybe Prelude.Bool)
describeTags_dryRun :: Lens' DescribeTags (Maybe Bool)
describeTags_dryRun = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeTags' {Maybe Bool
dryRun :: Maybe Bool
$sel:dryRun:DescribeTags' :: DescribeTags -> Maybe Bool
dryRun} -> Maybe Bool
dryRun) (\s :: DescribeTags
s@DescribeTags' {} Maybe Bool
a -> DescribeTags
s {$sel:dryRun:DescribeTags' :: Maybe Bool
dryRun = Maybe Bool
a} :: DescribeTags)
describeTags_filters :: Lens.Lens' DescribeTags (Prelude.Maybe [Filter])
describeTags_filters :: Lens' DescribeTags (Maybe [Filter])
describeTags_filters = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeTags' {Maybe [Filter]
filters :: Maybe [Filter]
$sel:filters:DescribeTags' :: DescribeTags -> Maybe [Filter]
filters} -> Maybe [Filter]
filters) (\s :: DescribeTags
s@DescribeTags' {} Maybe [Filter]
a -> DescribeTags
s {$sel:filters:DescribeTags' :: Maybe [Filter]
filters = Maybe [Filter]
a} :: DescribeTags) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
describeTags_maxResults :: Lens.Lens' DescribeTags (Prelude.Maybe Prelude.Int)
describeTags_maxResults :: Lens' DescribeTags (Maybe Int)
describeTags_maxResults = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeTags' {Maybe Int
maxResults :: Maybe Int
$sel:maxResults:DescribeTags' :: DescribeTags -> Maybe Int
maxResults} -> Maybe Int
maxResults) (\s :: DescribeTags
s@DescribeTags' {} Maybe Int
a -> DescribeTags
s {$sel:maxResults:DescribeTags' :: Maybe Int
maxResults = Maybe Int
a} :: DescribeTags)
describeTags_nextToken :: Lens.Lens' DescribeTags (Prelude.Maybe Prelude.Text)
describeTags_nextToken :: Lens' DescribeTags (Maybe Text)
describeTags_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeTags' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:DescribeTags' :: DescribeTags -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: DescribeTags
s@DescribeTags' {} Maybe Text
a -> DescribeTags
s {$sel:nextToken:DescribeTags' :: Maybe Text
nextToken = Maybe Text
a} :: DescribeTags)
instance Core.AWSPager DescribeTags where
page :: DescribeTags -> AWSResponse DescribeTags -> Maybe DescribeTags
page DescribeTags
rq AWSResponse DescribeTags
rs
| forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse DescribeTags
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' DescribeTagsResponse (Maybe Text)
describeTagsResponse_nextToken
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
) =
forall a. Maybe a
Prelude.Nothing
| forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse DescribeTags
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' DescribeTagsResponse (Maybe [TagDescription])
describeTagsResponse_tags
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
) =
forall a. Maybe a
Prelude.Nothing
| Bool
Prelude.otherwise =
forall a. a -> Maybe a
Prelude.Just
forall a b. (a -> b) -> a -> b
Prelude.$ DescribeTags
rq
forall a b. a -> (a -> b) -> b
Prelude.& Lens' DescribeTags (Maybe Text)
describeTags_nextToken
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse DescribeTags
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' DescribeTagsResponse (Maybe Text)
describeTagsResponse_nextToken
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
instance Core.AWSRequest DescribeTags where
type AWSResponse DescribeTags = DescribeTagsResponse
request :: (Service -> Service) -> DescribeTags -> Request DescribeTags
request Service -> Service
overrides =
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy DescribeTags
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DescribeTags)))
response =
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> [Node] -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveXML
( \Int
s ResponseHeaders
h [Node]
x ->
Maybe Text -> Maybe [TagDescription] -> Int -> DescribeTagsResponse
DescribeTagsResponse'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"nextToken")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( [Node]
x
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"tagSet"
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= forall (f :: * -> *) a b.
Applicative f =>
([a] -> f b) -> [a] -> f (Maybe b)
Core.may (forall a. FromXML a => Text -> [Node] -> Either String [a]
Data.parseXMLList Text
"item")
)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance Prelude.Hashable DescribeTags where
hashWithSalt :: Int -> DescribeTags -> Int
hashWithSalt Int
_salt DescribeTags' {Maybe Bool
Maybe Int
Maybe [Filter]
Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Int
filters :: Maybe [Filter]
dryRun :: Maybe Bool
$sel:nextToken:DescribeTags' :: DescribeTags -> Maybe Text
$sel:maxResults:DescribeTags' :: DescribeTags -> Maybe Int
$sel:filters:DescribeTags' :: DescribeTags -> Maybe [Filter]
$sel:dryRun:DescribeTags' :: DescribeTags -> Maybe Bool
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
dryRun
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Filter]
filters
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
maxResults
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
nextToken
instance Prelude.NFData DescribeTags where
rnf :: DescribeTags -> ()
rnf DescribeTags' {Maybe Bool
Maybe Int
Maybe [Filter]
Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Int
filters :: Maybe [Filter]
dryRun :: Maybe Bool
$sel:nextToken:DescribeTags' :: DescribeTags -> Maybe Text
$sel:maxResults:DescribeTags' :: DescribeTags -> Maybe Int
$sel:filters:DescribeTags' :: DescribeTags -> Maybe [Filter]
$sel:dryRun:DescribeTags' :: DescribeTags -> Maybe Bool
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
dryRun
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Filter]
filters
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
maxResults
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nextToken
instance Data.ToHeaders DescribeTags where
toHeaders :: DescribeTags -> ResponseHeaders
toHeaders = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
instance Data.ToPath DescribeTags where
toPath :: DescribeTags -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery DescribeTags where
toQuery :: DescribeTags -> QueryString
toQuery DescribeTags' {Maybe Bool
Maybe Int
Maybe [Filter]
Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Int
filters :: Maybe [Filter]
dryRun :: Maybe Bool
$sel:nextToken:DescribeTags' :: DescribeTags -> Maybe Text
$sel:maxResults:DescribeTags' :: DescribeTags -> Maybe Int
$sel:filters:DescribeTags' :: DescribeTags -> Maybe [Filter]
$sel:dryRun:DescribeTags' :: DescribeTags -> Maybe Bool
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"Action"
forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: (ByteString
"DescribeTags" :: Prelude.ByteString),
ByteString
"Version"
forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: (ByteString
"2016-11-15" :: Prelude.ByteString),
ByteString
"DryRun" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Bool
dryRun,
forall a. ToQuery a => a -> QueryString
Data.toQuery
(forall a.
(IsList a, ToQuery (Item a)) =>
ByteString -> a -> QueryString
Data.toQueryList ByteString
"Filter" forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Filter]
filters),
ByteString
"MaxResults" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Int
maxResults,
ByteString
"NextToken" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
nextToken
]
data DescribeTagsResponse = DescribeTagsResponse'
{
DescribeTagsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
DescribeTagsResponse -> Maybe [TagDescription]
tags :: Prelude.Maybe [TagDescription],
DescribeTagsResponse -> Int
httpStatus :: Prelude.Int
}
deriving (DescribeTagsResponse -> DescribeTagsResponse -> Bool
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]
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
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. 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'
{ $sel:nextToken:DescribeTagsResponse' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
$sel:tags:DescribeTagsResponse' :: Maybe [TagDescription]
tags = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:DescribeTagsResponse' :: Int
httpStatus = Int
pHttpStatus_
}
describeTagsResponse_nextToken :: Lens.Lens' DescribeTagsResponse (Prelude.Maybe Prelude.Text)
describeTagsResponse_nextToken :: Lens' DescribeTagsResponse (Maybe Text)
describeTagsResponse_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeTagsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:DescribeTagsResponse' :: DescribeTagsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: DescribeTagsResponse
s@DescribeTagsResponse' {} Maybe Text
a -> DescribeTagsResponse
s {$sel:nextToken:DescribeTagsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: DescribeTagsResponse)
describeTagsResponse_tags :: Lens.Lens' DescribeTagsResponse (Prelude.Maybe [TagDescription])
describeTagsResponse_tags :: Lens' DescribeTagsResponse (Maybe [TagDescription])
describeTagsResponse_tags = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeTagsResponse' {Maybe [TagDescription]
tags :: Maybe [TagDescription]
$sel:tags:DescribeTagsResponse' :: DescribeTagsResponse -> Maybe [TagDescription]
tags} -> Maybe [TagDescription]
tags) (\s :: DescribeTagsResponse
s@DescribeTagsResponse' {} Maybe [TagDescription]
a -> DescribeTagsResponse
s {$sel:tags:DescribeTagsResponse' :: Maybe [TagDescription]
tags = Maybe [TagDescription]
a} :: DescribeTagsResponse) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 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 :: Lens' DescribeTagsResponse Int
describeTagsResponse_httpStatus = 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 where
rnf :: DescribeTagsResponse -> ()
rnf DescribeTagsResponse' {Int
Maybe [TagDescription]
Maybe Text
httpStatus :: Int
tags :: Maybe [TagDescription]
nextToken :: Maybe Text
$sel:httpStatus:DescribeTagsResponse' :: DescribeTagsResponse -> Int
$sel:tags:DescribeTagsResponse' :: DescribeTagsResponse -> Maybe [TagDescription]
$sel:nextToken:DescribeTagsResponse' :: DescribeTagsResponse -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nextToken
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [TagDescription]
tags
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus