{-# 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.CloudTrail.RemoveTags
(
RemoveTags (..),
newRemoveTags,
removeTags_tagsList,
removeTags_resourceId,
RemoveTagsResponse (..),
newRemoveTagsResponse,
removeTagsResponse_httpStatus,
)
where
import Amazonka.CloudTrail.Types
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data RemoveTags = RemoveTags'
{
RemoveTags -> Maybe [Tag]
tagsList :: Prelude.Maybe [Tag],
RemoveTags -> Text
resourceId :: Prelude.Text
}
deriving (RemoveTags -> RemoveTags -> Bool
(RemoveTags -> RemoveTags -> Bool)
-> (RemoveTags -> RemoveTags -> Bool) -> Eq RemoveTags
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RemoveTags -> RemoveTags -> Bool
$c/= :: RemoveTags -> RemoveTags -> Bool
== :: RemoveTags -> RemoveTags -> Bool
$c== :: RemoveTags -> RemoveTags -> Bool
Prelude.Eq, ReadPrec [RemoveTags]
ReadPrec RemoveTags
Int -> ReadS RemoveTags
ReadS [RemoveTags]
(Int -> ReadS RemoveTags)
-> ReadS [RemoveTags]
-> ReadPrec RemoveTags
-> ReadPrec [RemoveTags]
-> Read RemoveTags
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RemoveTags]
$creadListPrec :: ReadPrec [RemoveTags]
readPrec :: ReadPrec RemoveTags
$creadPrec :: ReadPrec RemoveTags
readList :: ReadS [RemoveTags]
$creadList :: ReadS [RemoveTags]
readsPrec :: Int -> ReadS RemoveTags
$creadsPrec :: Int -> ReadS RemoveTags
Prelude.Read, Int -> RemoveTags -> ShowS
[RemoveTags] -> ShowS
RemoveTags -> String
(Int -> RemoveTags -> ShowS)
-> (RemoveTags -> String)
-> ([RemoveTags] -> ShowS)
-> Show RemoveTags
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RemoveTags] -> ShowS
$cshowList :: [RemoveTags] -> ShowS
show :: RemoveTags -> String
$cshow :: RemoveTags -> String
showsPrec :: Int -> RemoveTags -> ShowS
$cshowsPrec :: Int -> RemoveTags -> ShowS
Prelude.Show, (forall x. RemoveTags -> Rep RemoveTags x)
-> (forall x. Rep RemoveTags x -> RemoveTags) -> Generic RemoveTags
forall x. Rep RemoveTags x -> RemoveTags
forall x. RemoveTags -> Rep RemoveTags x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RemoveTags x -> RemoveTags
$cfrom :: forall x. RemoveTags -> Rep RemoveTags x
Prelude.Generic)
newRemoveTags ::
Prelude.Text ->
RemoveTags
newRemoveTags :: Text -> RemoveTags
newRemoveTags Text
pResourceId_ =
RemoveTags' :: Maybe [Tag] -> Text -> RemoveTags
RemoveTags'
{ $sel:tagsList:RemoveTags' :: Maybe [Tag]
tagsList = Maybe [Tag]
forall a. Maybe a
Prelude.Nothing,
$sel:resourceId:RemoveTags' :: Text
resourceId = Text
pResourceId_
}
removeTags_tagsList :: Lens.Lens' RemoveTags (Prelude.Maybe [Tag])
removeTags_tagsList :: (Maybe [Tag] -> f (Maybe [Tag])) -> RemoveTags -> f RemoveTags
removeTags_tagsList = (RemoveTags -> Maybe [Tag])
-> (RemoveTags -> Maybe [Tag] -> RemoveTags)
-> Lens RemoveTags RemoveTags (Maybe [Tag]) (Maybe [Tag])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RemoveTags' {Maybe [Tag]
tagsList :: Maybe [Tag]
$sel:tagsList:RemoveTags' :: RemoveTags -> Maybe [Tag]
tagsList} -> Maybe [Tag]
tagsList) (\s :: RemoveTags
s@RemoveTags' {} Maybe [Tag]
a -> RemoveTags
s {$sel:tagsList:RemoveTags' :: Maybe [Tag]
tagsList = Maybe [Tag]
a} :: RemoveTags) ((Maybe [Tag] -> f (Maybe [Tag])) -> RemoveTags -> f RemoveTags)
-> ((Maybe [Tag] -> f (Maybe [Tag]))
-> Maybe [Tag] -> f (Maybe [Tag]))
-> (Maybe [Tag] -> f (Maybe [Tag]))
-> RemoveTags
-> f RemoveTags
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
removeTags_resourceId :: Lens.Lens' RemoveTags Prelude.Text
removeTags_resourceId :: (Text -> f Text) -> RemoveTags -> f RemoveTags
removeTags_resourceId = (RemoveTags -> Text)
-> (RemoveTags -> Text -> RemoveTags)
-> Lens RemoveTags RemoveTags Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RemoveTags' {Text
resourceId :: Text
$sel:resourceId:RemoveTags' :: RemoveTags -> Text
resourceId} -> Text
resourceId) (\s :: RemoveTags
s@RemoveTags' {} Text
a -> RemoveTags
s {$sel:resourceId:RemoveTags' :: Text
resourceId = Text
a} :: RemoveTags)
instance Core.AWSRequest RemoveTags where
type AWSResponse RemoveTags = RemoveTagsResponse
request :: RemoveTags -> Request RemoveTags
request = Service -> RemoveTags -> Request RemoveTags
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy RemoveTags
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse RemoveTags)))
response =
(Int
-> ResponseHeaders -> () -> Either String (AWSResponse RemoveTags))
-> Logger
-> Service
-> Proxy RemoveTags
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse RemoveTags)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
( \Int
s ResponseHeaders
h ()
x ->
Int -> RemoveTagsResponse
RemoveTagsResponse'
(Int -> RemoveTagsResponse)
-> Either String Int -> Either String RemoveTagsResponse
forall (f :: * -> *) a b. Functor 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 RemoveTags
instance Prelude.NFData RemoveTags
instance Core.ToHeaders RemoveTags where
toHeaders :: RemoveTags -> ResponseHeaders
toHeaders =
ResponseHeaders -> RemoveTags -> 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
"com.amazonaws.cloudtrail.v20131101.CloudTrail_20131101.RemoveTags" ::
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 RemoveTags where
toJSON :: RemoveTags -> Value
toJSON RemoveTags' {Maybe [Tag]
Text
resourceId :: Text
tagsList :: Maybe [Tag]
$sel:resourceId:RemoveTags' :: RemoveTags -> Text
$sel:tagsList:RemoveTags' :: RemoveTags -> Maybe [Tag]
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"TagsList" Text -> [Tag] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([Tag] -> Pair) -> Maybe [Tag] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Tag]
tagsList,
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)
]
)
instance Core.ToPath RemoveTags where
toPath :: RemoveTags -> ByteString
toPath = ByteString -> RemoveTags -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery RemoveTags where
toQuery :: RemoveTags -> QueryString
toQuery = QueryString -> RemoveTags -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data RemoveTagsResponse = RemoveTagsResponse'
{
RemoveTagsResponse -> Int
httpStatus :: Prelude.Int
}
deriving (RemoveTagsResponse -> RemoveTagsResponse -> Bool
(RemoveTagsResponse -> RemoveTagsResponse -> Bool)
-> (RemoveTagsResponse -> RemoveTagsResponse -> Bool)
-> Eq RemoveTagsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RemoveTagsResponse -> RemoveTagsResponse -> Bool
$c/= :: RemoveTagsResponse -> RemoveTagsResponse -> Bool
== :: RemoveTagsResponse -> RemoveTagsResponse -> Bool
$c== :: RemoveTagsResponse -> RemoveTagsResponse -> Bool
Prelude.Eq, ReadPrec [RemoveTagsResponse]
ReadPrec RemoveTagsResponse
Int -> ReadS RemoveTagsResponse
ReadS [RemoveTagsResponse]
(Int -> ReadS RemoveTagsResponse)
-> ReadS [RemoveTagsResponse]
-> ReadPrec RemoveTagsResponse
-> ReadPrec [RemoveTagsResponse]
-> Read RemoveTagsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RemoveTagsResponse]
$creadListPrec :: ReadPrec [RemoveTagsResponse]
readPrec :: ReadPrec RemoveTagsResponse
$creadPrec :: ReadPrec RemoveTagsResponse
readList :: ReadS [RemoveTagsResponse]
$creadList :: ReadS [RemoveTagsResponse]
readsPrec :: Int -> ReadS RemoveTagsResponse
$creadsPrec :: Int -> ReadS RemoveTagsResponse
Prelude.Read, Int -> RemoveTagsResponse -> ShowS
[RemoveTagsResponse] -> ShowS
RemoveTagsResponse -> String
(Int -> RemoveTagsResponse -> ShowS)
-> (RemoveTagsResponse -> String)
-> ([RemoveTagsResponse] -> ShowS)
-> Show RemoveTagsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RemoveTagsResponse] -> ShowS
$cshowList :: [RemoveTagsResponse] -> ShowS
show :: RemoveTagsResponse -> String
$cshow :: RemoveTagsResponse -> String
showsPrec :: Int -> RemoveTagsResponse -> ShowS
$cshowsPrec :: Int -> RemoveTagsResponse -> ShowS
Prelude.Show, (forall x. RemoveTagsResponse -> Rep RemoveTagsResponse x)
-> (forall x. Rep RemoveTagsResponse x -> RemoveTagsResponse)
-> Generic RemoveTagsResponse
forall x. Rep RemoveTagsResponse x -> RemoveTagsResponse
forall x. RemoveTagsResponse -> Rep RemoveTagsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RemoveTagsResponse x -> RemoveTagsResponse
$cfrom :: forall x. RemoveTagsResponse -> Rep RemoveTagsResponse x
Prelude.Generic)
newRemoveTagsResponse ::
Prelude.Int ->
RemoveTagsResponse
newRemoveTagsResponse :: Int -> RemoveTagsResponse
newRemoveTagsResponse Int
pHttpStatus_ =
RemoveTagsResponse' :: Int -> RemoveTagsResponse
RemoveTagsResponse' {$sel:httpStatus:RemoveTagsResponse' :: Int
httpStatus = Int
pHttpStatus_}
removeTagsResponse_httpStatus :: Lens.Lens' RemoveTagsResponse Prelude.Int
removeTagsResponse_httpStatus :: (Int -> f Int) -> RemoveTagsResponse -> f RemoveTagsResponse
removeTagsResponse_httpStatus = (RemoveTagsResponse -> Int)
-> (RemoveTagsResponse -> Int -> RemoveTagsResponse)
-> Lens RemoveTagsResponse RemoveTagsResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RemoveTagsResponse' {Int
httpStatus :: Int
$sel:httpStatus:RemoveTagsResponse' :: RemoveTagsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: RemoveTagsResponse
s@RemoveTagsResponse' {} Int
a -> RemoveTagsResponse
s {$sel:httpStatus:RemoveTagsResponse' :: Int
httpStatus = Int
a} :: RemoveTagsResponse)
instance Prelude.NFData RemoveTagsResponse