{-# 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.ServiceCatalog.CreateTagOption
(
CreateTagOption (..),
newCreateTagOption,
createTagOption_key,
createTagOption_value,
CreateTagOptionResponse (..),
newCreateTagOptionResponse,
createTagOptionResponse_tagOptionDetail,
createTagOptionResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
import Amazonka.ServiceCatalog.Types
data CreateTagOption = CreateTagOption'
{
CreateTagOption -> Text
key :: Prelude.Text,
CreateTagOption -> Text
value :: Prelude.Text
}
deriving (CreateTagOption -> CreateTagOption -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateTagOption -> CreateTagOption -> Bool
$c/= :: CreateTagOption -> CreateTagOption -> Bool
== :: CreateTagOption -> CreateTagOption -> Bool
$c== :: CreateTagOption -> CreateTagOption -> Bool
Prelude.Eq, ReadPrec [CreateTagOption]
ReadPrec CreateTagOption
Int -> ReadS CreateTagOption
ReadS [CreateTagOption]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateTagOption]
$creadListPrec :: ReadPrec [CreateTagOption]
readPrec :: ReadPrec CreateTagOption
$creadPrec :: ReadPrec CreateTagOption
readList :: ReadS [CreateTagOption]
$creadList :: ReadS [CreateTagOption]
readsPrec :: Int -> ReadS CreateTagOption
$creadsPrec :: Int -> ReadS CreateTagOption
Prelude.Read, Int -> CreateTagOption -> ShowS
[CreateTagOption] -> ShowS
CreateTagOption -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateTagOption] -> ShowS
$cshowList :: [CreateTagOption] -> ShowS
show :: CreateTagOption -> String
$cshow :: CreateTagOption -> String
showsPrec :: Int -> CreateTagOption -> ShowS
$cshowsPrec :: Int -> CreateTagOption -> ShowS
Prelude.Show, forall x. Rep CreateTagOption x -> CreateTagOption
forall x. CreateTagOption -> Rep CreateTagOption x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateTagOption x -> CreateTagOption
$cfrom :: forall x. CreateTagOption -> Rep CreateTagOption x
Prelude.Generic)
newCreateTagOption ::
Prelude.Text ->
Prelude.Text ->
CreateTagOption
newCreateTagOption :: Text -> Text -> CreateTagOption
newCreateTagOption Text
pKey_ Text
pValue_ =
CreateTagOption' {$sel:key:CreateTagOption' :: Text
key = Text
pKey_, $sel:value:CreateTagOption' :: Text
value = Text
pValue_}
createTagOption_key :: Lens.Lens' CreateTagOption Prelude.Text
createTagOption_key :: Lens' CreateTagOption Text
createTagOption_key = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateTagOption' {Text
key :: Text
$sel:key:CreateTagOption' :: CreateTagOption -> Text
key} -> Text
key) (\s :: CreateTagOption
s@CreateTagOption' {} Text
a -> CreateTagOption
s {$sel:key:CreateTagOption' :: Text
key = Text
a} :: CreateTagOption)
createTagOption_value :: Lens.Lens' CreateTagOption Prelude.Text
createTagOption_value :: Lens' CreateTagOption Text
createTagOption_value = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateTagOption' {Text
value :: Text
$sel:value:CreateTagOption' :: CreateTagOption -> Text
value} -> Text
value) (\s :: CreateTagOption
s@CreateTagOption' {} Text
a -> CreateTagOption
s {$sel:value:CreateTagOption' :: Text
value = Text
a} :: CreateTagOption)
instance Core.AWSRequest CreateTagOption where
type
AWSResponse CreateTagOption =
CreateTagOptionResponse
request :: (Service -> Service) -> CreateTagOption -> Request CreateTagOption
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 CreateTagOption
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateTagOption)))
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 TagOptionDetail -> Int -> CreateTagOptionResponse
CreateTagOptionResponse'
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
"TagOptionDetail")
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 CreateTagOption where
hashWithSalt :: Int -> CreateTagOption -> Int
hashWithSalt Int
_salt CreateTagOption' {Text
value :: Text
key :: Text
$sel:value:CreateTagOption' :: CreateTagOption -> Text
$sel:key:CreateTagOption' :: CreateTagOption -> Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
key
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
value
instance Prelude.NFData CreateTagOption where
rnf :: CreateTagOption -> ()
rnf CreateTagOption' {Text
value :: Text
key :: Text
$sel:value:CreateTagOption' :: CreateTagOption -> Text
$sel:key:CreateTagOption' :: CreateTagOption -> Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Text
key seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
value
instance Data.ToHeaders CreateTagOption where
toHeaders :: CreateTagOption -> 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
"AWS242ServiceCatalogService.CreateTagOption" ::
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 CreateTagOption where
toJSON :: CreateTagOption -> Value
toJSON CreateTagOption' {Text
value :: Text
key :: Text
$sel:value:CreateTagOption' :: CreateTagOption -> Text
$sel:key:CreateTagOption' :: CreateTagOption -> Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ forall a. a -> Maybe a
Prelude.Just (Key
"Key" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
key),
forall a. a -> Maybe a
Prelude.Just (Key
"Value" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
value)
]
)
instance Data.ToPath CreateTagOption where
toPath :: CreateTagOption -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery CreateTagOption where
toQuery :: CreateTagOption -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data CreateTagOptionResponse = CreateTagOptionResponse'
{
CreateTagOptionResponse -> Maybe TagOptionDetail
tagOptionDetail :: Prelude.Maybe TagOptionDetail,
CreateTagOptionResponse -> Int
httpStatus :: Prelude.Int
}
deriving (CreateTagOptionResponse -> CreateTagOptionResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateTagOptionResponse -> CreateTagOptionResponse -> Bool
$c/= :: CreateTagOptionResponse -> CreateTagOptionResponse -> Bool
== :: CreateTagOptionResponse -> CreateTagOptionResponse -> Bool
$c== :: CreateTagOptionResponse -> CreateTagOptionResponse -> Bool
Prelude.Eq, ReadPrec [CreateTagOptionResponse]
ReadPrec CreateTagOptionResponse
Int -> ReadS CreateTagOptionResponse
ReadS [CreateTagOptionResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateTagOptionResponse]
$creadListPrec :: ReadPrec [CreateTagOptionResponse]
readPrec :: ReadPrec CreateTagOptionResponse
$creadPrec :: ReadPrec CreateTagOptionResponse
readList :: ReadS [CreateTagOptionResponse]
$creadList :: ReadS [CreateTagOptionResponse]
readsPrec :: Int -> ReadS CreateTagOptionResponse
$creadsPrec :: Int -> ReadS CreateTagOptionResponse
Prelude.Read, Int -> CreateTagOptionResponse -> ShowS
[CreateTagOptionResponse] -> ShowS
CreateTagOptionResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateTagOptionResponse] -> ShowS
$cshowList :: [CreateTagOptionResponse] -> ShowS
show :: CreateTagOptionResponse -> String
$cshow :: CreateTagOptionResponse -> String
showsPrec :: Int -> CreateTagOptionResponse -> ShowS
$cshowsPrec :: Int -> CreateTagOptionResponse -> ShowS
Prelude.Show, forall x. Rep CreateTagOptionResponse x -> CreateTagOptionResponse
forall x. CreateTagOptionResponse -> Rep CreateTagOptionResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateTagOptionResponse x -> CreateTagOptionResponse
$cfrom :: forall x. CreateTagOptionResponse -> Rep CreateTagOptionResponse x
Prelude.Generic)
newCreateTagOptionResponse ::
Prelude.Int ->
CreateTagOptionResponse
newCreateTagOptionResponse :: Int -> CreateTagOptionResponse
newCreateTagOptionResponse Int
pHttpStatus_ =
CreateTagOptionResponse'
{ $sel:tagOptionDetail:CreateTagOptionResponse' :: Maybe TagOptionDetail
tagOptionDetail =
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:CreateTagOptionResponse' :: Int
httpStatus = Int
pHttpStatus_
}
createTagOptionResponse_tagOptionDetail :: Lens.Lens' CreateTagOptionResponse (Prelude.Maybe TagOptionDetail)
createTagOptionResponse_tagOptionDetail :: Lens' CreateTagOptionResponse (Maybe TagOptionDetail)
createTagOptionResponse_tagOptionDetail = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateTagOptionResponse' {Maybe TagOptionDetail
tagOptionDetail :: Maybe TagOptionDetail
$sel:tagOptionDetail:CreateTagOptionResponse' :: CreateTagOptionResponse -> Maybe TagOptionDetail
tagOptionDetail} -> Maybe TagOptionDetail
tagOptionDetail) (\s :: CreateTagOptionResponse
s@CreateTagOptionResponse' {} Maybe TagOptionDetail
a -> CreateTagOptionResponse
s {$sel:tagOptionDetail:CreateTagOptionResponse' :: Maybe TagOptionDetail
tagOptionDetail = Maybe TagOptionDetail
a} :: CreateTagOptionResponse)
createTagOptionResponse_httpStatus :: Lens.Lens' CreateTagOptionResponse Prelude.Int
createTagOptionResponse_httpStatus :: Lens' CreateTagOptionResponse Int
createTagOptionResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateTagOptionResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateTagOptionResponse' :: CreateTagOptionResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateTagOptionResponse
s@CreateTagOptionResponse' {} Int
a -> CreateTagOptionResponse
s {$sel:httpStatus:CreateTagOptionResponse' :: Int
httpStatus = Int
a} :: CreateTagOptionResponse)
instance Prelude.NFData CreateTagOptionResponse where
rnf :: CreateTagOptionResponse -> ()
rnf CreateTagOptionResponse' {Int
Maybe TagOptionDetail
httpStatus :: Int
tagOptionDetail :: Maybe TagOptionDetail
$sel:httpStatus:CreateTagOptionResponse' :: CreateTagOptionResponse -> Int
$sel:tagOptionDetail:CreateTagOptionResponse' :: CreateTagOptionResponse -> Maybe TagOptionDetail
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe TagOptionDetail
tagOptionDetail
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus