{-# 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.Inspector.SetTagsForResource
(
SetTagsForResource (..),
newSetTagsForResource,
setTagsForResource_tags,
setTagsForResource_resourceArn,
SetTagsForResourceResponse (..),
newSetTagsForResourceResponse,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.Inspector.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data SetTagsForResource = SetTagsForResource'
{
SetTagsForResource -> Maybe [Tag]
tags :: Prelude.Maybe [Tag],
SetTagsForResource -> Text
resourceArn :: Prelude.Text
}
deriving (SetTagsForResource -> SetTagsForResource -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SetTagsForResource -> SetTagsForResource -> Bool
$c/= :: SetTagsForResource -> SetTagsForResource -> Bool
== :: SetTagsForResource -> SetTagsForResource -> Bool
$c== :: SetTagsForResource -> SetTagsForResource -> Bool
Prelude.Eq, ReadPrec [SetTagsForResource]
ReadPrec SetTagsForResource
Int -> ReadS SetTagsForResource
ReadS [SetTagsForResource]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SetTagsForResource]
$creadListPrec :: ReadPrec [SetTagsForResource]
readPrec :: ReadPrec SetTagsForResource
$creadPrec :: ReadPrec SetTagsForResource
readList :: ReadS [SetTagsForResource]
$creadList :: ReadS [SetTagsForResource]
readsPrec :: Int -> ReadS SetTagsForResource
$creadsPrec :: Int -> ReadS SetTagsForResource
Prelude.Read, Int -> SetTagsForResource -> ShowS
[SetTagsForResource] -> ShowS
SetTagsForResource -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SetTagsForResource] -> ShowS
$cshowList :: [SetTagsForResource] -> ShowS
show :: SetTagsForResource -> String
$cshow :: SetTagsForResource -> String
showsPrec :: Int -> SetTagsForResource -> ShowS
$cshowsPrec :: Int -> SetTagsForResource -> ShowS
Prelude.Show, forall x. Rep SetTagsForResource x -> SetTagsForResource
forall x. SetTagsForResource -> Rep SetTagsForResource x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SetTagsForResource x -> SetTagsForResource
$cfrom :: forall x. SetTagsForResource -> Rep SetTagsForResource x
Prelude.Generic)
newSetTagsForResource ::
Prelude.Text ->
SetTagsForResource
newSetTagsForResource :: Text -> SetTagsForResource
newSetTagsForResource Text
pResourceArn_ =
SetTagsForResource'
{ $sel:tags:SetTagsForResource' :: Maybe [Tag]
tags = forall a. Maybe a
Prelude.Nothing,
$sel:resourceArn:SetTagsForResource' :: Text
resourceArn = Text
pResourceArn_
}
setTagsForResource_tags :: Lens.Lens' SetTagsForResource (Prelude.Maybe [Tag])
setTagsForResource_tags :: Lens' SetTagsForResource (Maybe [Tag])
setTagsForResource_tags = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SetTagsForResource' {Maybe [Tag]
tags :: Maybe [Tag]
$sel:tags:SetTagsForResource' :: SetTagsForResource -> Maybe [Tag]
tags} -> Maybe [Tag]
tags) (\s :: SetTagsForResource
s@SetTagsForResource' {} Maybe [Tag]
a -> SetTagsForResource
s {$sel:tags:SetTagsForResource' :: Maybe [Tag]
tags = Maybe [Tag]
a} :: SetTagsForResource) 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
setTagsForResource_resourceArn :: Lens.Lens' SetTagsForResource Prelude.Text
setTagsForResource_resourceArn :: Lens' SetTagsForResource Text
setTagsForResource_resourceArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SetTagsForResource' {Text
resourceArn :: Text
$sel:resourceArn:SetTagsForResource' :: SetTagsForResource -> Text
resourceArn} -> Text
resourceArn) (\s :: SetTagsForResource
s@SetTagsForResource' {} Text
a -> SetTagsForResource
s {$sel:resourceArn:SetTagsForResource' :: Text
resourceArn = Text
a} :: SetTagsForResource)
instance Core.AWSRequest SetTagsForResource where
type
AWSResponse SetTagsForResource =
SetTagsForResourceResponse
request :: (Service -> Service)
-> SetTagsForResource -> Request SetTagsForResource
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 SetTagsForResource
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse SetTagsForResource)))
response =
forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull SetTagsForResourceResponse
SetTagsForResourceResponse'
instance Prelude.Hashable SetTagsForResource where
hashWithSalt :: Int -> SetTagsForResource -> Int
hashWithSalt Int
_salt SetTagsForResource' {Maybe [Tag]
Text
resourceArn :: Text
tags :: Maybe [Tag]
$sel:resourceArn:SetTagsForResource' :: SetTagsForResource -> Text
$sel:tags:SetTagsForResource' :: SetTagsForResource -> Maybe [Tag]
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Tag]
tags
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
resourceArn
instance Prelude.NFData SetTagsForResource where
rnf :: SetTagsForResource -> ()
rnf SetTagsForResource' {Maybe [Tag]
Text
resourceArn :: Text
tags :: Maybe [Tag]
$sel:resourceArn:SetTagsForResource' :: SetTagsForResource -> Text
$sel:tags:SetTagsForResource' :: SetTagsForResource -> Maybe [Tag]
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe [Tag]
tags
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
resourceArn
instance Data.ToHeaders SetTagsForResource where
toHeaders :: SetTagsForResource -> [Header]
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 -> [Header]
Data.=# ( ByteString
"InspectorService.SetTagsForResource" ::
Prelude.ByteString
),
HeaderName
"Content-Type"
forall a. ToHeader a => HeaderName -> a -> [Header]
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Data.ToJSON SetTagsForResource where
toJSON :: SetTagsForResource -> Value
toJSON SetTagsForResource' {Maybe [Tag]
Text
resourceArn :: Text
tags :: Maybe [Tag]
$sel:resourceArn:SetTagsForResource' :: SetTagsForResource -> Text
$sel:tags:SetTagsForResource' :: SetTagsForResource -> Maybe [Tag]
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"tags" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Tag]
tags,
forall a. a -> Maybe a
Prelude.Just (Key
"resourceArn" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
resourceArn)
]
)
instance Data.ToPath SetTagsForResource where
toPath :: SetTagsForResource -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery SetTagsForResource where
toQuery :: SetTagsForResource -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data SetTagsForResourceResponse = SetTagsForResourceResponse'
{
}
deriving (SetTagsForResourceResponse -> SetTagsForResourceResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SetTagsForResourceResponse -> SetTagsForResourceResponse -> Bool
$c/= :: SetTagsForResourceResponse -> SetTagsForResourceResponse -> Bool
== :: SetTagsForResourceResponse -> SetTagsForResourceResponse -> Bool
$c== :: SetTagsForResourceResponse -> SetTagsForResourceResponse -> Bool
Prelude.Eq, ReadPrec [SetTagsForResourceResponse]
ReadPrec SetTagsForResourceResponse
Int -> ReadS SetTagsForResourceResponse
ReadS [SetTagsForResourceResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SetTagsForResourceResponse]
$creadListPrec :: ReadPrec [SetTagsForResourceResponse]
readPrec :: ReadPrec SetTagsForResourceResponse
$creadPrec :: ReadPrec SetTagsForResourceResponse
readList :: ReadS [SetTagsForResourceResponse]
$creadList :: ReadS [SetTagsForResourceResponse]
readsPrec :: Int -> ReadS SetTagsForResourceResponse
$creadsPrec :: Int -> ReadS SetTagsForResourceResponse
Prelude.Read, Int -> SetTagsForResourceResponse -> ShowS
[SetTagsForResourceResponse] -> ShowS
SetTagsForResourceResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SetTagsForResourceResponse] -> ShowS
$cshowList :: [SetTagsForResourceResponse] -> ShowS
show :: SetTagsForResourceResponse -> String
$cshow :: SetTagsForResourceResponse -> String
showsPrec :: Int -> SetTagsForResourceResponse -> ShowS
$cshowsPrec :: Int -> SetTagsForResourceResponse -> ShowS
Prelude.Show, forall x.
Rep SetTagsForResourceResponse x -> SetTagsForResourceResponse
forall x.
SetTagsForResourceResponse -> Rep SetTagsForResourceResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep SetTagsForResourceResponse x -> SetTagsForResourceResponse
$cfrom :: forall x.
SetTagsForResourceResponse -> Rep SetTagsForResourceResponse x
Prelude.Generic)
newSetTagsForResourceResponse ::
SetTagsForResourceResponse
newSetTagsForResourceResponse :: SetTagsForResourceResponse
newSetTagsForResourceResponse =
SetTagsForResourceResponse
SetTagsForResourceResponse'
instance Prelude.NFData SetTagsForResourceResponse where
rnf :: SetTagsForResourceResponse -> ()
rnf SetTagsForResourceResponse
_ = ()