{-# 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.MachineLearning.DescribeTags
(
DescribeTags (..),
newDescribeTags,
describeTags_resourceId,
describeTags_resourceType,
DescribeTagsResponse (..),
newDescribeTagsResponse,
describeTagsResponse_resourceId,
describeTagsResponse_resourceType,
describeTagsResponse_tags,
describeTagsResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.MachineLearning.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data DescribeTags = DescribeTags'
{
DescribeTags -> Text
resourceId :: Prelude.Text,
DescribeTags -> TaggableResourceType
resourceType :: TaggableResourceType
}
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.Text ->
TaggableResourceType ->
DescribeTags
newDescribeTags :: Text -> TaggableResourceType -> DescribeTags
newDescribeTags Text
pResourceId_ TaggableResourceType
pResourceType_ =
DescribeTags' :: Text -> TaggableResourceType -> DescribeTags
DescribeTags'
{ $sel:resourceId:DescribeTags' :: Text
resourceId = Text
pResourceId_,
$sel:resourceType:DescribeTags' :: TaggableResourceType
resourceType = TaggableResourceType
pResourceType_
}
describeTags_resourceId :: Lens.Lens' DescribeTags Prelude.Text
describeTags_resourceId :: (Text -> f Text) -> DescribeTags -> f DescribeTags
describeTags_resourceId = (DescribeTags -> Text)
-> (DescribeTags -> Text -> DescribeTags)
-> Lens DescribeTags DescribeTags Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeTags' {Text
resourceId :: Text
$sel:resourceId:DescribeTags' :: DescribeTags -> Text
resourceId} -> Text
resourceId) (\s :: DescribeTags
s@DescribeTags' {} Text
a -> DescribeTags
s {$sel:resourceId:DescribeTags' :: Text
resourceId = Text
a} :: DescribeTags)
describeTags_resourceType :: Lens.Lens' DescribeTags TaggableResourceType
describeTags_resourceType :: (TaggableResourceType -> f TaggableResourceType)
-> DescribeTags -> f DescribeTags
describeTags_resourceType = (DescribeTags -> TaggableResourceType)
-> (DescribeTags -> TaggableResourceType -> DescribeTags)
-> Lens
DescribeTags DescribeTags TaggableResourceType TaggableResourceType
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeTags' {TaggableResourceType
resourceType :: TaggableResourceType
$sel:resourceType:DescribeTags' :: DescribeTags -> TaggableResourceType
resourceType} -> TaggableResourceType
resourceType) (\s :: DescribeTags
s@DescribeTags' {} TaggableResourceType
a -> DescribeTags
s {$sel:resourceType:DescribeTags' :: TaggableResourceType
resourceType = TaggableResourceType
a} :: DescribeTags)
instance Core.AWSRequest DescribeTags where
type AWSResponse DescribeTags = DescribeTagsResponse
request :: DescribeTags -> Request DescribeTags
request = Service -> DescribeTags -> Request DescribeTags
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy DescribeTags
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DescribeTags)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse DescribeTags))
-> Logger
-> Service
-> Proxy DescribeTags
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DescribeTags)))
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 Text
-> Maybe TaggableResourceType
-> Maybe [Tag]
-> Int
-> DescribeTagsResponse
DescribeTagsResponse'
(Maybe Text
-> Maybe TaggableResourceType
-> Maybe [Tag]
-> Int
-> DescribeTagsResponse)
-> Either String (Maybe Text)
-> Either
String
(Maybe TaggableResourceType
-> Maybe [Tag] -> Int -> DescribeTagsResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"ResourceId")
Either
String
(Maybe TaggableResourceType
-> Maybe [Tag] -> Int -> DescribeTagsResponse)
-> Either String (Maybe TaggableResourceType)
-> Either String (Maybe [Tag] -> Int -> DescribeTagsResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe TaggableResourceType)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"ResourceType")
Either String (Maybe [Tag] -> Int -> DescribeTagsResponse)
-> Either String (Maybe [Tag])
-> Either String (Int -> DescribeTagsResponse)
forall (f :: * -> *) a b. Applicative f => 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
"Tags" 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 -> 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] -> 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
"AmazonML_20141212.DescribeTags" ::
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 DescribeTags where
toJSON :: DescribeTags -> Value
toJSON DescribeTags' {Text
TaggableResourceType
resourceType :: TaggableResourceType
resourceId :: Text
$sel:resourceType:DescribeTags' :: DescribeTags -> TaggableResourceType
$sel:resourceId:DescribeTags' :: DescribeTags -> Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"ResourceId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
resourceId),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"ResourceType" Text -> TaggableResourceType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= TaggableResourceType
resourceType)
]
)
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 = QueryString -> DescribeTags -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data DescribeTagsResponse = DescribeTagsResponse'
{
DescribeTagsResponse -> Maybe Text
resourceId :: Prelude.Maybe Prelude.Text,
DescribeTagsResponse -> Maybe TaggableResourceType
resourceType :: Prelude.Maybe TaggableResourceType,
DescribeTagsResponse -> Maybe [Tag]
tags :: Prelude.Maybe [Tag],
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 Text
-> Maybe TaggableResourceType
-> Maybe [Tag]
-> Int
-> DescribeTagsResponse
DescribeTagsResponse'
{ $sel:resourceId:DescribeTagsResponse' :: Maybe Text
resourceId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:resourceType:DescribeTagsResponse' :: Maybe TaggableResourceType
resourceType = Maybe TaggableResourceType
forall a. Maybe a
Prelude.Nothing,
$sel:tags:DescribeTagsResponse' :: Maybe [Tag]
tags = Maybe [Tag]
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:DescribeTagsResponse' :: Int
httpStatus = Int
pHttpStatus_
}
describeTagsResponse_resourceId :: Lens.Lens' DescribeTagsResponse (Prelude.Maybe Prelude.Text)
describeTagsResponse_resourceId :: (Maybe Text -> f (Maybe Text))
-> DescribeTagsResponse -> f DescribeTagsResponse
describeTagsResponse_resourceId = (DescribeTagsResponse -> Maybe Text)
-> (DescribeTagsResponse -> Maybe Text -> DescribeTagsResponse)
-> Lens
DescribeTagsResponse DescribeTagsResponse (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeTagsResponse' {Maybe Text
resourceId :: Maybe Text
$sel:resourceId:DescribeTagsResponse' :: DescribeTagsResponse -> Maybe Text
resourceId} -> Maybe Text
resourceId) (\s :: DescribeTagsResponse
s@DescribeTagsResponse' {} Maybe Text
a -> DescribeTagsResponse
s {$sel:resourceId:DescribeTagsResponse' :: Maybe Text
resourceId = Maybe Text
a} :: DescribeTagsResponse)
describeTagsResponse_resourceType :: Lens.Lens' DescribeTagsResponse (Prelude.Maybe TaggableResourceType)
describeTagsResponse_resourceType :: (Maybe TaggableResourceType -> f (Maybe TaggableResourceType))
-> DescribeTagsResponse -> f DescribeTagsResponse
describeTagsResponse_resourceType = (DescribeTagsResponse -> Maybe TaggableResourceType)
-> (DescribeTagsResponse
-> Maybe TaggableResourceType -> DescribeTagsResponse)
-> Lens
DescribeTagsResponse
DescribeTagsResponse
(Maybe TaggableResourceType)
(Maybe TaggableResourceType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeTagsResponse' {Maybe TaggableResourceType
resourceType :: Maybe TaggableResourceType
$sel:resourceType:DescribeTagsResponse' :: DescribeTagsResponse -> Maybe TaggableResourceType
resourceType} -> Maybe TaggableResourceType
resourceType) (\s :: DescribeTagsResponse
s@DescribeTagsResponse' {} Maybe TaggableResourceType
a -> DescribeTagsResponse
s {$sel:resourceType:DescribeTagsResponse' :: Maybe TaggableResourceType
resourceType = Maybe TaggableResourceType
a} :: DescribeTagsResponse)
describeTagsResponse_tags :: Lens.Lens' DescribeTagsResponse (Prelude.Maybe [Tag])
describeTagsResponse_tags :: (Maybe [Tag] -> f (Maybe [Tag]))
-> DescribeTagsResponse -> f DescribeTagsResponse
describeTagsResponse_tags = (DescribeTagsResponse -> Maybe [Tag])
-> (DescribeTagsResponse -> Maybe [Tag] -> DescribeTagsResponse)
-> Lens
DescribeTagsResponse
DescribeTagsResponse
(Maybe [Tag])
(Maybe [Tag])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeTagsResponse' {Maybe [Tag]
tags :: Maybe [Tag]
$sel:tags:DescribeTagsResponse' :: DescribeTagsResponse -> Maybe [Tag]
tags} -> Maybe [Tag]
tags) (\s :: DescribeTagsResponse
s@DescribeTagsResponse' {} Maybe [Tag]
a -> DescribeTagsResponse
s {$sel:tags:DescribeTagsResponse' :: Maybe [Tag]
tags = Maybe [Tag]
a} :: DescribeTagsResponse) ((Maybe [Tag] -> f (Maybe [Tag]))
-> DescribeTagsResponse -> f DescribeTagsResponse)
-> ((Maybe [Tag] -> f (Maybe [Tag]))
-> Maybe [Tag] -> f (Maybe [Tag]))
-> (Maybe [Tag] -> f (Maybe [Tag]))
-> DescribeTagsResponse
-> f DescribeTagsResponse
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
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