{-# 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.OpenSearch.ListTags
(
ListTags (..),
newListTags,
listTags_arn,
ListTagsResponse (..),
newListTagsResponse,
listTagsResponse_tagList,
listTagsResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.OpenSearch.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data ListTags = ListTags'
{
ListTags -> Text
arn :: Prelude.Text
}
deriving (ListTags -> ListTags -> Bool
(ListTags -> ListTags -> Bool)
-> (ListTags -> ListTags -> Bool) -> Eq ListTags
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListTags -> ListTags -> Bool
$c/= :: ListTags -> ListTags -> Bool
== :: ListTags -> ListTags -> Bool
$c== :: ListTags -> ListTags -> Bool
Prelude.Eq, ReadPrec [ListTags]
ReadPrec ListTags
Int -> ReadS ListTags
ReadS [ListTags]
(Int -> ReadS ListTags)
-> ReadS [ListTags]
-> ReadPrec ListTags
-> ReadPrec [ListTags]
-> Read ListTags
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListTags]
$creadListPrec :: ReadPrec [ListTags]
readPrec :: ReadPrec ListTags
$creadPrec :: ReadPrec ListTags
readList :: ReadS [ListTags]
$creadList :: ReadS [ListTags]
readsPrec :: Int -> ReadS ListTags
$creadsPrec :: Int -> ReadS ListTags
Prelude.Read, Int -> ListTags -> ShowS
[ListTags] -> ShowS
ListTags -> String
(Int -> ListTags -> ShowS)
-> (ListTags -> String) -> ([ListTags] -> ShowS) -> Show ListTags
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListTags] -> ShowS
$cshowList :: [ListTags] -> ShowS
show :: ListTags -> String
$cshow :: ListTags -> String
showsPrec :: Int -> ListTags -> ShowS
$cshowsPrec :: Int -> ListTags -> ShowS
Prelude.Show, (forall x. ListTags -> Rep ListTags x)
-> (forall x. Rep ListTags x -> ListTags) -> Generic ListTags
forall x. Rep ListTags x -> ListTags
forall x. ListTags -> Rep ListTags x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListTags x -> ListTags
$cfrom :: forall x. ListTags -> Rep ListTags x
Prelude.Generic)
newListTags ::
Prelude.Text ->
ListTags
newListTags :: Text -> ListTags
newListTags Text
pARN_ = ListTags' :: Text -> ListTags
ListTags' {$sel:arn:ListTags' :: Text
arn = Text
pARN_}
listTags_arn :: Lens.Lens' ListTags Prelude.Text
listTags_arn :: (Text -> f Text) -> ListTags -> f ListTags
listTags_arn = (ListTags -> Text)
-> (ListTags -> Text -> ListTags)
-> Lens ListTags ListTags Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListTags' {Text
arn :: Text
$sel:arn:ListTags' :: ListTags -> Text
arn} -> Text
arn) (\s :: ListTags
s@ListTags' {} Text
a -> ListTags
s {$sel:arn:ListTags' :: Text
arn = Text
a} :: ListTags)
instance Core.AWSRequest ListTags where
type AWSResponse ListTags = ListTagsResponse
request :: ListTags -> Request ListTags
request = Service -> ListTags -> Request ListTags
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
response :: Logger
-> Service
-> Proxy ListTags
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListTags)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse ListTags))
-> Logger
-> Service
-> Proxy ListTags
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListTags)))
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 [Tag] -> Int -> ListTagsResponse
ListTagsResponse'
(Maybe [Tag] -> Int -> ListTagsResponse)
-> Either String (Maybe [Tag])
-> Either String (Int -> ListTagsResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe (Maybe [Tag]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"TagList" Either String (Maybe (Maybe [Tag]))
-> Maybe [Tag] -> Either String (Maybe [Tag])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [Tag]
forall a. Monoid a => a
Prelude.mempty)
Either String (Int -> ListTagsResponse)
-> Either String Int -> Either String ListTagsResponse
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 ListTags
instance Prelude.NFData ListTags
instance Core.ToHeaders ListTags where
toHeaders :: ListTags -> ResponseHeaders
toHeaders = ResponseHeaders -> ListTags -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty
instance Core.ToPath ListTags where
toPath :: ListTags -> ByteString
toPath = ByteString -> ListTags -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/2021-01-01/tags/"
instance Core.ToQuery ListTags where
toQuery :: ListTags -> QueryString
toQuery ListTags' {Text
arn :: Text
$sel:arn:ListTags' :: ListTags -> Text
..} =
[QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat [ByteString
"arn" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
arn]
data ListTagsResponse = ListTagsResponse'
{
ListTagsResponse -> Maybe [Tag]
tagList :: Prelude.Maybe [Tag],
ListTagsResponse -> Int
httpStatus :: Prelude.Int
}
deriving (ListTagsResponse -> ListTagsResponse -> Bool
(ListTagsResponse -> ListTagsResponse -> Bool)
-> (ListTagsResponse -> ListTagsResponse -> Bool)
-> Eq ListTagsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListTagsResponse -> ListTagsResponse -> Bool
$c/= :: ListTagsResponse -> ListTagsResponse -> Bool
== :: ListTagsResponse -> ListTagsResponse -> Bool
$c== :: ListTagsResponse -> ListTagsResponse -> Bool
Prelude.Eq, ReadPrec [ListTagsResponse]
ReadPrec ListTagsResponse
Int -> ReadS ListTagsResponse
ReadS [ListTagsResponse]
(Int -> ReadS ListTagsResponse)
-> ReadS [ListTagsResponse]
-> ReadPrec ListTagsResponse
-> ReadPrec [ListTagsResponse]
-> Read ListTagsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListTagsResponse]
$creadListPrec :: ReadPrec [ListTagsResponse]
readPrec :: ReadPrec ListTagsResponse
$creadPrec :: ReadPrec ListTagsResponse
readList :: ReadS [ListTagsResponse]
$creadList :: ReadS [ListTagsResponse]
readsPrec :: Int -> ReadS ListTagsResponse
$creadsPrec :: Int -> ReadS ListTagsResponse
Prelude.Read, Int -> ListTagsResponse -> ShowS
[ListTagsResponse] -> ShowS
ListTagsResponse -> String
(Int -> ListTagsResponse -> ShowS)
-> (ListTagsResponse -> String)
-> ([ListTagsResponse] -> ShowS)
-> Show ListTagsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListTagsResponse] -> ShowS
$cshowList :: [ListTagsResponse] -> ShowS
show :: ListTagsResponse -> String
$cshow :: ListTagsResponse -> String
showsPrec :: Int -> ListTagsResponse -> ShowS
$cshowsPrec :: Int -> ListTagsResponse -> ShowS
Prelude.Show, (forall x. ListTagsResponse -> Rep ListTagsResponse x)
-> (forall x. Rep ListTagsResponse x -> ListTagsResponse)
-> Generic ListTagsResponse
forall x. Rep ListTagsResponse x -> ListTagsResponse
forall x. ListTagsResponse -> Rep ListTagsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListTagsResponse x -> ListTagsResponse
$cfrom :: forall x. ListTagsResponse -> Rep ListTagsResponse x
Prelude.Generic)
newListTagsResponse ::
Prelude.Int ->
ListTagsResponse
newListTagsResponse :: Int -> ListTagsResponse
newListTagsResponse Int
pHttpStatus_ =
ListTagsResponse' :: Maybe [Tag] -> Int -> ListTagsResponse
ListTagsResponse'
{ $sel:tagList:ListTagsResponse' :: Maybe [Tag]
tagList = Maybe [Tag]
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ListTagsResponse' :: Int
httpStatus = Int
pHttpStatus_
}
listTagsResponse_tagList :: Lens.Lens' ListTagsResponse (Prelude.Maybe [Tag])
listTagsResponse_tagList :: (Maybe [Tag] -> f (Maybe [Tag]))
-> ListTagsResponse -> f ListTagsResponse
listTagsResponse_tagList = (ListTagsResponse -> Maybe [Tag])
-> (ListTagsResponse -> Maybe [Tag] -> ListTagsResponse)
-> Lens
ListTagsResponse ListTagsResponse (Maybe [Tag]) (Maybe [Tag])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListTagsResponse' {Maybe [Tag]
tagList :: Maybe [Tag]
$sel:tagList:ListTagsResponse' :: ListTagsResponse -> Maybe [Tag]
tagList} -> Maybe [Tag]
tagList) (\s :: ListTagsResponse
s@ListTagsResponse' {} Maybe [Tag]
a -> ListTagsResponse
s {$sel:tagList:ListTagsResponse' :: Maybe [Tag]
tagList = Maybe [Tag]
a} :: ListTagsResponse) ((Maybe [Tag] -> f (Maybe [Tag]))
-> ListTagsResponse -> f ListTagsResponse)
-> ((Maybe [Tag] -> f (Maybe [Tag]))
-> Maybe [Tag] -> f (Maybe [Tag]))
-> (Maybe [Tag] -> f (Maybe [Tag]))
-> ListTagsResponse
-> f ListTagsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Tag] [Tag] [Tag] [Tag]
-> Iso (Maybe [Tag]) (Maybe [Tag]) (Maybe [Tag]) (Maybe [Tag])
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 [Tag] [Tag] [Tag] [Tag]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
listTagsResponse_httpStatus :: Lens.Lens' ListTagsResponse Prelude.Int
listTagsResponse_httpStatus :: (Int -> f Int) -> ListTagsResponse -> f ListTagsResponse
listTagsResponse_httpStatus = (ListTagsResponse -> Int)
-> (ListTagsResponse -> Int -> ListTagsResponse)
-> Lens ListTagsResponse ListTagsResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListTagsResponse' {Int
httpStatus :: Int
$sel:httpStatus:ListTagsResponse' :: ListTagsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ListTagsResponse
s@ListTagsResponse' {} Int
a -> ListTagsResponse
s {$sel:httpStatus:ListTagsResponse' :: Int
httpStatus = Int
a} :: ListTagsResponse)
instance Prelude.NFData ListTagsResponse