{-# 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.AddTags
(
AddTags (..),
newAddTags,
addTags_tags,
addTags_resourceId,
addTags_resourceType,
AddTagsResponse (..),
newAddTagsResponse,
addTagsResponse_resourceId,
addTagsResponse_resourceType,
addTagsResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.MachineLearning.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data AddTags = AddTags'
{
AddTags -> [Tag]
tags :: [Tag],
AddTags -> Text
resourceId :: Prelude.Text,
AddTags -> TaggableResourceType
resourceType :: TaggableResourceType
}
deriving (AddTags -> AddTags -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AddTags -> AddTags -> Bool
$c/= :: AddTags -> AddTags -> Bool
== :: AddTags -> AddTags -> Bool
$c== :: AddTags -> AddTags -> Bool
Prelude.Eq, ReadPrec [AddTags]
ReadPrec AddTags
Int -> ReadS AddTags
ReadS [AddTags]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AddTags]
$creadListPrec :: ReadPrec [AddTags]
readPrec :: ReadPrec AddTags
$creadPrec :: ReadPrec AddTags
readList :: ReadS [AddTags]
$creadList :: ReadS [AddTags]
readsPrec :: Int -> ReadS AddTags
$creadsPrec :: Int -> ReadS AddTags
Prelude.Read, Int -> AddTags -> ShowS
[AddTags] -> ShowS
AddTags -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AddTags] -> ShowS
$cshowList :: [AddTags] -> ShowS
show :: AddTags -> String
$cshow :: AddTags -> String
showsPrec :: Int -> AddTags -> ShowS
$cshowsPrec :: Int -> AddTags -> ShowS
Prelude.Show, forall x. Rep AddTags x -> AddTags
forall x. AddTags -> Rep AddTags x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AddTags x -> AddTags
$cfrom :: forall x. AddTags -> Rep AddTags x
Prelude.Generic)
newAddTags ::
Prelude.Text ->
TaggableResourceType ->
AddTags
newAddTags :: Text -> TaggableResourceType -> AddTags
newAddTags Text
pResourceId_ TaggableResourceType
pResourceType_ =
AddTags'
{ $sel:tags:AddTags' :: [Tag]
tags = forall a. Monoid a => a
Prelude.mempty,
$sel:resourceId:AddTags' :: Text
resourceId = Text
pResourceId_,
$sel:resourceType:AddTags' :: TaggableResourceType
resourceType = TaggableResourceType
pResourceType_
}
addTags_tags :: Lens.Lens' AddTags [Tag]
addTags_tags :: Lens' AddTags [Tag]
addTags_tags = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AddTags' {[Tag]
tags :: [Tag]
$sel:tags:AddTags' :: AddTags -> [Tag]
tags} -> [Tag]
tags) (\s :: AddTags
s@AddTags' {} [Tag]
a -> AddTags
s {$sel:tags:AddTags' :: [Tag]
tags = [Tag]
a} :: AddTags) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
addTags_resourceId :: Lens.Lens' AddTags Prelude.Text
addTags_resourceId :: Lens' AddTags Text
addTags_resourceId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AddTags' {Text
resourceId :: Text
$sel:resourceId:AddTags' :: AddTags -> Text
resourceId} -> Text
resourceId) (\s :: AddTags
s@AddTags' {} Text
a -> AddTags
s {$sel:resourceId:AddTags' :: Text
resourceId = Text
a} :: AddTags)
addTags_resourceType :: Lens.Lens' AddTags TaggableResourceType
addTags_resourceType :: Lens' AddTags TaggableResourceType
addTags_resourceType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AddTags' {TaggableResourceType
resourceType :: TaggableResourceType
$sel:resourceType:AddTags' :: AddTags -> TaggableResourceType
resourceType} -> TaggableResourceType
resourceType) (\s :: AddTags
s@AddTags' {} TaggableResourceType
a -> AddTags
s {$sel:resourceType:AddTags' :: TaggableResourceType
resourceType = TaggableResourceType
a} :: AddTags)
instance Core.AWSRequest AddTags where
type AWSResponse AddTags = AddTagsResponse
request :: (Service -> Service) -> AddTags -> Request AddTags
request Service -> Service
overrides =
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy AddTags
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse AddTags)))
response =
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Maybe Text -> Maybe TaggableResourceType -> Int -> AddTagsResponse
AddTagsResponse'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"ResourceId")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"ResourceType")
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 AddTags where
hashWithSalt :: Int -> AddTags -> Int
hashWithSalt Int
_salt AddTags' {[Tag]
Text
TaggableResourceType
resourceType :: TaggableResourceType
resourceId :: Text
tags :: [Tag]
$sel:resourceType:AddTags' :: AddTags -> TaggableResourceType
$sel:resourceId:AddTags' :: AddTags -> Text
$sel:tags:AddTags' :: AddTags -> [Tag]
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` [Tag]
tags
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
resourceId
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` TaggableResourceType
resourceType
instance Prelude.NFData AddTags where
rnf :: AddTags -> ()
rnf AddTags' {[Tag]
Text
TaggableResourceType
resourceType :: TaggableResourceType
resourceId :: Text
tags :: [Tag]
$sel:resourceType:AddTags' :: AddTags -> TaggableResourceType
$sel:resourceId:AddTags' :: AddTags -> Text
$sel:tags:AddTags' :: AddTags -> [Tag]
..} =
forall a. NFData a => a -> ()
Prelude.rnf [Tag]
tags
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
resourceId
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf TaggableResourceType
resourceType
instance Data.ToHeaders AddTags where
toHeaders :: AddTags -> ResponseHeaders
toHeaders =
forall a b. a -> b -> a
Prelude.const
( forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# (ByteString
"AmazonML_20141212.AddTags" :: Prelude.ByteString),
HeaderName
"Content-Type"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Data.ToJSON AddTags where
toJSON :: AddTags -> Value
toJSON AddTags' {[Tag]
Text
TaggableResourceType
resourceType :: TaggableResourceType
resourceId :: Text
tags :: [Tag]
$sel:resourceType:AddTags' :: AddTags -> TaggableResourceType
$sel:resourceId:AddTags' :: AddTags -> Text
$sel:tags:AddTags' :: AddTags -> [Tag]
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ forall a. a -> Maybe a
Prelude.Just (Key
"Tags" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= [Tag]
tags),
forall a. a -> Maybe a
Prelude.Just (Key
"ResourceId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
resourceId),
forall a. a -> Maybe a
Prelude.Just (Key
"ResourceType" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= TaggableResourceType
resourceType)
]
)
instance Data.ToPath AddTags where
toPath :: AddTags -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery AddTags where
toQuery :: AddTags -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data AddTagsResponse = AddTagsResponse'
{
AddTagsResponse -> Maybe Text
resourceId :: Prelude.Maybe Prelude.Text,
AddTagsResponse -> Maybe TaggableResourceType
resourceType :: Prelude.Maybe TaggableResourceType,
AddTagsResponse -> Int
httpStatus :: Prelude.Int
}
deriving (AddTagsResponse -> AddTagsResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AddTagsResponse -> AddTagsResponse -> Bool
$c/= :: AddTagsResponse -> AddTagsResponse -> Bool
== :: AddTagsResponse -> AddTagsResponse -> Bool
$c== :: AddTagsResponse -> AddTagsResponse -> Bool
Prelude.Eq, ReadPrec [AddTagsResponse]
ReadPrec AddTagsResponse
Int -> ReadS AddTagsResponse
ReadS [AddTagsResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AddTagsResponse]
$creadListPrec :: ReadPrec [AddTagsResponse]
readPrec :: ReadPrec AddTagsResponse
$creadPrec :: ReadPrec AddTagsResponse
readList :: ReadS [AddTagsResponse]
$creadList :: ReadS [AddTagsResponse]
readsPrec :: Int -> ReadS AddTagsResponse
$creadsPrec :: Int -> ReadS AddTagsResponse
Prelude.Read, Int -> AddTagsResponse -> ShowS
[AddTagsResponse] -> ShowS
AddTagsResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AddTagsResponse] -> ShowS
$cshowList :: [AddTagsResponse] -> ShowS
show :: AddTagsResponse -> String
$cshow :: AddTagsResponse -> String
showsPrec :: Int -> AddTagsResponse -> ShowS
$cshowsPrec :: Int -> AddTagsResponse -> ShowS
Prelude.Show, forall x. Rep AddTagsResponse x -> AddTagsResponse
forall x. AddTagsResponse -> Rep AddTagsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AddTagsResponse x -> AddTagsResponse
$cfrom :: forall x. AddTagsResponse -> Rep AddTagsResponse x
Prelude.Generic)
newAddTagsResponse ::
Prelude.Int ->
AddTagsResponse
newAddTagsResponse :: Int -> AddTagsResponse
newAddTagsResponse Int
pHttpStatus_ =
AddTagsResponse'
{ $sel:resourceId:AddTagsResponse' :: Maybe Text
resourceId = forall a. Maybe a
Prelude.Nothing,
$sel:resourceType:AddTagsResponse' :: Maybe TaggableResourceType
resourceType = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:AddTagsResponse' :: Int
httpStatus = Int
pHttpStatus_
}
addTagsResponse_resourceId :: Lens.Lens' AddTagsResponse (Prelude.Maybe Prelude.Text)
addTagsResponse_resourceId :: Lens' AddTagsResponse (Maybe Text)
addTagsResponse_resourceId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AddTagsResponse' {Maybe Text
resourceId :: Maybe Text
$sel:resourceId:AddTagsResponse' :: AddTagsResponse -> Maybe Text
resourceId} -> Maybe Text
resourceId) (\s :: AddTagsResponse
s@AddTagsResponse' {} Maybe Text
a -> AddTagsResponse
s {$sel:resourceId:AddTagsResponse' :: Maybe Text
resourceId = Maybe Text
a} :: AddTagsResponse)
addTagsResponse_resourceType :: Lens.Lens' AddTagsResponse (Prelude.Maybe TaggableResourceType)
addTagsResponse_resourceType :: Lens' AddTagsResponse (Maybe TaggableResourceType)
addTagsResponse_resourceType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AddTagsResponse' {Maybe TaggableResourceType
resourceType :: Maybe TaggableResourceType
$sel:resourceType:AddTagsResponse' :: AddTagsResponse -> Maybe TaggableResourceType
resourceType} -> Maybe TaggableResourceType
resourceType) (\s :: AddTagsResponse
s@AddTagsResponse' {} Maybe TaggableResourceType
a -> AddTagsResponse
s {$sel:resourceType:AddTagsResponse' :: Maybe TaggableResourceType
resourceType = Maybe TaggableResourceType
a} :: AddTagsResponse)
addTagsResponse_httpStatus :: Lens.Lens' AddTagsResponse Prelude.Int
addTagsResponse_httpStatus :: Lens' AddTagsResponse Int
addTagsResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AddTagsResponse' {Int
httpStatus :: Int
$sel:httpStatus:AddTagsResponse' :: AddTagsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: AddTagsResponse
s@AddTagsResponse' {} Int
a -> AddTagsResponse
s {$sel:httpStatus:AddTagsResponse' :: Int
httpStatus = Int
a} :: AddTagsResponse)
instance Prelude.NFData AddTagsResponse where
rnf :: AddTagsResponse -> ()
rnf AddTagsResponse' {Int
Maybe Text
Maybe TaggableResourceType
httpStatus :: Int
resourceType :: Maybe TaggableResourceType
resourceId :: Maybe Text
$sel:httpStatus:AddTagsResponse' :: AddTagsResponse -> Int
$sel:resourceType:AddTagsResponse' :: AddTagsResponse -> Maybe TaggableResourceType
$sel:resourceId:AddTagsResponse' :: AddTagsResponse -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
resourceId
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe TaggableResourceType
resourceType
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus