{-# 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.ResourceGroupsTagging.UntagResources
(
UntagResources (..),
newUntagResources,
untagResources_resourceARNList,
untagResources_tagKeys,
UntagResourcesResponse (..),
newUntagResourcesResponse,
untagResourcesResponse_failedResourcesMap,
untagResourcesResponse_httpStatus,
)
where
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 Amazonka.ResourceGroupsTagging.Types
import qualified Amazonka.Response as Response
data UntagResources = UntagResources'
{
UntagResources -> NonEmpty Text
resourceARNList :: Prelude.NonEmpty Prelude.Text,
UntagResources -> NonEmpty Text
tagKeys :: Prelude.NonEmpty Prelude.Text
}
deriving (UntagResources -> UntagResources -> Bool
(UntagResources -> UntagResources -> Bool)
-> (UntagResources -> UntagResources -> Bool) -> Eq UntagResources
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UntagResources -> UntagResources -> Bool
$c/= :: UntagResources -> UntagResources -> Bool
== :: UntagResources -> UntagResources -> Bool
$c== :: UntagResources -> UntagResources -> Bool
Prelude.Eq, ReadPrec [UntagResources]
ReadPrec UntagResources
Int -> ReadS UntagResources
ReadS [UntagResources]
(Int -> ReadS UntagResources)
-> ReadS [UntagResources]
-> ReadPrec UntagResources
-> ReadPrec [UntagResources]
-> Read UntagResources
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UntagResources]
$creadListPrec :: ReadPrec [UntagResources]
readPrec :: ReadPrec UntagResources
$creadPrec :: ReadPrec UntagResources
readList :: ReadS [UntagResources]
$creadList :: ReadS [UntagResources]
readsPrec :: Int -> ReadS UntagResources
$creadsPrec :: Int -> ReadS UntagResources
Prelude.Read, Int -> UntagResources -> ShowS
[UntagResources] -> ShowS
UntagResources -> String
(Int -> UntagResources -> ShowS)
-> (UntagResources -> String)
-> ([UntagResources] -> ShowS)
-> Show UntagResources
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UntagResources] -> ShowS
$cshowList :: [UntagResources] -> ShowS
show :: UntagResources -> String
$cshow :: UntagResources -> String
showsPrec :: Int -> UntagResources -> ShowS
$cshowsPrec :: Int -> UntagResources -> ShowS
Prelude.Show, (forall x. UntagResources -> Rep UntagResources x)
-> (forall x. Rep UntagResources x -> UntagResources)
-> Generic UntagResources
forall x. Rep UntagResources x -> UntagResources
forall x. UntagResources -> Rep UntagResources x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UntagResources x -> UntagResources
$cfrom :: forall x. UntagResources -> Rep UntagResources x
Prelude.Generic)
newUntagResources ::
Prelude.NonEmpty Prelude.Text ->
Prelude.NonEmpty Prelude.Text ->
UntagResources
newUntagResources :: NonEmpty Text -> NonEmpty Text -> UntagResources
newUntagResources NonEmpty Text
pResourceARNList_ NonEmpty Text
pTagKeys_ =
UntagResources' :: NonEmpty Text -> NonEmpty Text -> UntagResources
UntagResources'
{ $sel:resourceARNList:UntagResources' :: NonEmpty Text
resourceARNList =
Tagged (NonEmpty Text) (Identity (NonEmpty Text))
-> Tagged (NonEmpty Text) (Identity (NonEmpty Text))
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced (Tagged (NonEmpty Text) (Identity (NonEmpty Text))
-> Tagged (NonEmpty Text) (Identity (NonEmpty Text)))
-> NonEmpty Text -> NonEmpty Text
forall t b. AReview t b -> b -> t
Lens.# NonEmpty Text
pResourceARNList_,
$sel:tagKeys:UntagResources' :: NonEmpty Text
tagKeys = Tagged (NonEmpty Text) (Identity (NonEmpty Text))
-> Tagged (NonEmpty Text) (Identity (NonEmpty Text))
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced (Tagged (NonEmpty Text) (Identity (NonEmpty Text))
-> Tagged (NonEmpty Text) (Identity (NonEmpty Text)))
-> NonEmpty Text -> NonEmpty Text
forall t b. AReview t b -> b -> t
Lens.# NonEmpty Text
pTagKeys_
}
untagResources_resourceARNList :: Lens.Lens' UntagResources (Prelude.NonEmpty Prelude.Text)
untagResources_resourceARNList :: (NonEmpty Text -> f (NonEmpty Text))
-> UntagResources -> f UntagResources
untagResources_resourceARNList = (UntagResources -> NonEmpty Text)
-> (UntagResources -> NonEmpty Text -> UntagResources)
-> Lens
UntagResources UntagResources (NonEmpty Text) (NonEmpty Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UntagResources' {NonEmpty Text
resourceARNList :: NonEmpty Text
$sel:resourceARNList:UntagResources' :: UntagResources -> NonEmpty Text
resourceARNList} -> NonEmpty Text
resourceARNList) (\s :: UntagResources
s@UntagResources' {} NonEmpty Text
a -> UntagResources
s {$sel:resourceARNList:UntagResources' :: NonEmpty Text
resourceARNList = NonEmpty Text
a} :: UntagResources) ((NonEmpty Text -> f (NonEmpty Text))
-> UntagResources -> f UntagResources)
-> ((NonEmpty Text -> f (NonEmpty Text))
-> NonEmpty Text -> f (NonEmpty Text))
-> (NonEmpty Text -> f (NonEmpty Text))
-> UntagResources
-> f UntagResources
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (NonEmpty Text -> f (NonEmpty Text))
-> NonEmpty Text -> f (NonEmpty Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
untagResources_tagKeys :: Lens.Lens' UntagResources (Prelude.NonEmpty Prelude.Text)
untagResources_tagKeys :: (NonEmpty Text -> f (NonEmpty Text))
-> UntagResources -> f UntagResources
untagResources_tagKeys = (UntagResources -> NonEmpty Text)
-> (UntagResources -> NonEmpty Text -> UntagResources)
-> Lens
UntagResources UntagResources (NonEmpty Text) (NonEmpty Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UntagResources' {NonEmpty Text
tagKeys :: NonEmpty Text
$sel:tagKeys:UntagResources' :: UntagResources -> NonEmpty Text
tagKeys} -> NonEmpty Text
tagKeys) (\s :: UntagResources
s@UntagResources' {} NonEmpty Text
a -> UntagResources
s {$sel:tagKeys:UntagResources' :: NonEmpty Text
tagKeys = NonEmpty Text
a} :: UntagResources) ((NonEmpty Text -> f (NonEmpty Text))
-> UntagResources -> f UntagResources)
-> ((NonEmpty Text -> f (NonEmpty Text))
-> NonEmpty Text -> f (NonEmpty Text))
-> (NonEmpty Text -> f (NonEmpty Text))
-> UntagResources
-> f UntagResources
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (NonEmpty Text -> f (NonEmpty Text))
-> NonEmpty Text -> f (NonEmpty Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.AWSRequest UntagResources where
type
AWSResponse UntagResources =
UntagResourcesResponse
request :: UntagResources -> Request UntagResources
request = Service -> UntagResources -> Request UntagResources
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy UntagResources
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UntagResources)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse UntagResources))
-> Logger
-> Service
-> Proxy UntagResources
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UntagResources)))
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 (HashMap Text FailureInfo) -> Int -> UntagResourcesResponse
UntagResourcesResponse'
(Maybe (HashMap Text FailureInfo) -> Int -> UntagResourcesResponse)
-> Either String (Maybe (HashMap Text FailureInfo))
-> Either String (Int -> UntagResourcesResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( Object
x Object
-> Text -> Either String (Maybe (Maybe (HashMap Text FailureInfo)))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"FailedResourcesMap"
Either String (Maybe (Maybe (HashMap Text FailureInfo)))
-> Maybe (HashMap Text FailureInfo)
-> Either String (Maybe (HashMap Text FailureInfo))
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe (HashMap Text FailureInfo)
forall a. Monoid a => a
Prelude.mempty
)
Either String (Int -> UntagResourcesResponse)
-> Either String Int -> Either String UntagResourcesResponse
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 UntagResources
instance Prelude.NFData UntagResources
instance Core.ToHeaders UntagResources where
toHeaders :: UntagResources -> ResponseHeaders
toHeaders =
ResponseHeaders -> UntagResources -> 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
"ResourceGroupsTaggingAPI_20170126.UntagResources" ::
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 UntagResources where
toJSON :: UntagResources -> Value
toJSON UntagResources' {NonEmpty Text
tagKeys :: NonEmpty Text
resourceARNList :: NonEmpty Text
$sel:tagKeys:UntagResources' :: UntagResources -> NonEmpty Text
$sel:resourceARNList:UntagResources' :: UntagResources -> NonEmpty 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
"ResourceARNList" Text -> NonEmpty Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= NonEmpty Text
resourceARNList),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"TagKeys" Text -> NonEmpty Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= NonEmpty Text
tagKeys)
]
)
instance Core.ToPath UntagResources where
toPath :: UntagResources -> ByteString
toPath = ByteString -> UntagResources -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery UntagResources where
toQuery :: UntagResources -> QueryString
toQuery = QueryString -> UntagResources -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data UntagResourcesResponse = UntagResourcesResponse'
{
UntagResourcesResponse -> Maybe (HashMap Text FailureInfo)
failedResourcesMap :: Prelude.Maybe (Prelude.HashMap Prelude.Text FailureInfo),
UntagResourcesResponse -> Int
httpStatus :: Prelude.Int
}
deriving (UntagResourcesResponse -> UntagResourcesResponse -> Bool
(UntagResourcesResponse -> UntagResourcesResponse -> Bool)
-> (UntagResourcesResponse -> UntagResourcesResponse -> Bool)
-> Eq UntagResourcesResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UntagResourcesResponse -> UntagResourcesResponse -> Bool
$c/= :: UntagResourcesResponse -> UntagResourcesResponse -> Bool
== :: UntagResourcesResponse -> UntagResourcesResponse -> Bool
$c== :: UntagResourcesResponse -> UntagResourcesResponse -> Bool
Prelude.Eq, ReadPrec [UntagResourcesResponse]
ReadPrec UntagResourcesResponse
Int -> ReadS UntagResourcesResponse
ReadS [UntagResourcesResponse]
(Int -> ReadS UntagResourcesResponse)
-> ReadS [UntagResourcesResponse]
-> ReadPrec UntagResourcesResponse
-> ReadPrec [UntagResourcesResponse]
-> Read UntagResourcesResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UntagResourcesResponse]
$creadListPrec :: ReadPrec [UntagResourcesResponse]
readPrec :: ReadPrec UntagResourcesResponse
$creadPrec :: ReadPrec UntagResourcesResponse
readList :: ReadS [UntagResourcesResponse]
$creadList :: ReadS [UntagResourcesResponse]
readsPrec :: Int -> ReadS UntagResourcesResponse
$creadsPrec :: Int -> ReadS UntagResourcesResponse
Prelude.Read, Int -> UntagResourcesResponse -> ShowS
[UntagResourcesResponse] -> ShowS
UntagResourcesResponse -> String
(Int -> UntagResourcesResponse -> ShowS)
-> (UntagResourcesResponse -> String)
-> ([UntagResourcesResponse] -> ShowS)
-> Show UntagResourcesResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UntagResourcesResponse] -> ShowS
$cshowList :: [UntagResourcesResponse] -> ShowS
show :: UntagResourcesResponse -> String
$cshow :: UntagResourcesResponse -> String
showsPrec :: Int -> UntagResourcesResponse -> ShowS
$cshowsPrec :: Int -> UntagResourcesResponse -> ShowS
Prelude.Show, (forall x. UntagResourcesResponse -> Rep UntagResourcesResponse x)
-> (forall x.
Rep UntagResourcesResponse x -> UntagResourcesResponse)
-> Generic UntagResourcesResponse
forall x. Rep UntagResourcesResponse x -> UntagResourcesResponse
forall x. UntagResourcesResponse -> Rep UntagResourcesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UntagResourcesResponse x -> UntagResourcesResponse
$cfrom :: forall x. UntagResourcesResponse -> Rep UntagResourcesResponse x
Prelude.Generic)
newUntagResourcesResponse ::
Prelude.Int ->
UntagResourcesResponse
newUntagResourcesResponse :: Int -> UntagResourcesResponse
newUntagResourcesResponse Int
pHttpStatus_ =
UntagResourcesResponse' :: Maybe (HashMap Text FailureInfo) -> Int -> UntagResourcesResponse
UntagResourcesResponse'
{ $sel:failedResourcesMap:UntagResourcesResponse' :: Maybe (HashMap Text FailureInfo)
failedResourcesMap =
Maybe (HashMap Text FailureInfo)
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:UntagResourcesResponse' :: Int
httpStatus = Int
pHttpStatus_
}
untagResourcesResponse_failedResourcesMap :: Lens.Lens' UntagResourcesResponse (Prelude.Maybe (Prelude.HashMap Prelude.Text FailureInfo))
untagResourcesResponse_failedResourcesMap :: (Maybe (HashMap Text FailureInfo)
-> f (Maybe (HashMap Text FailureInfo)))
-> UntagResourcesResponse -> f UntagResourcesResponse
untagResourcesResponse_failedResourcesMap = (UntagResourcesResponse -> Maybe (HashMap Text FailureInfo))
-> (UntagResourcesResponse
-> Maybe (HashMap Text FailureInfo) -> UntagResourcesResponse)
-> Lens
UntagResourcesResponse
UntagResourcesResponse
(Maybe (HashMap Text FailureInfo))
(Maybe (HashMap Text FailureInfo))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UntagResourcesResponse' {Maybe (HashMap Text FailureInfo)
failedResourcesMap :: Maybe (HashMap Text FailureInfo)
$sel:failedResourcesMap:UntagResourcesResponse' :: UntagResourcesResponse -> Maybe (HashMap Text FailureInfo)
failedResourcesMap} -> Maybe (HashMap Text FailureInfo)
failedResourcesMap) (\s :: UntagResourcesResponse
s@UntagResourcesResponse' {} Maybe (HashMap Text FailureInfo)
a -> UntagResourcesResponse
s {$sel:failedResourcesMap:UntagResourcesResponse' :: Maybe (HashMap Text FailureInfo)
failedResourcesMap = Maybe (HashMap Text FailureInfo)
a} :: UntagResourcesResponse) ((Maybe (HashMap Text FailureInfo)
-> f (Maybe (HashMap Text FailureInfo)))
-> UntagResourcesResponse -> f UntagResourcesResponse)
-> ((Maybe (HashMap Text FailureInfo)
-> f (Maybe (HashMap Text FailureInfo)))
-> Maybe (HashMap Text FailureInfo)
-> f (Maybe (HashMap Text FailureInfo)))
-> (Maybe (HashMap Text FailureInfo)
-> f (Maybe (HashMap Text FailureInfo)))
-> UntagResourcesResponse
-> f UntagResourcesResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
(HashMap Text FailureInfo)
(HashMap Text FailureInfo)
(HashMap Text FailureInfo)
(HashMap Text FailureInfo)
-> Iso
(Maybe (HashMap Text FailureInfo))
(Maybe (HashMap Text FailureInfo))
(Maybe (HashMap Text FailureInfo))
(Maybe (HashMap Text FailureInfo))
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
(HashMap Text FailureInfo)
(HashMap Text FailureInfo)
(HashMap Text FailureInfo)
(HashMap Text FailureInfo)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
untagResourcesResponse_httpStatus :: Lens.Lens' UntagResourcesResponse Prelude.Int
untagResourcesResponse_httpStatus :: (Int -> f Int)
-> UntagResourcesResponse -> f UntagResourcesResponse
untagResourcesResponse_httpStatus = (UntagResourcesResponse -> Int)
-> (UntagResourcesResponse -> Int -> UntagResourcesResponse)
-> Lens UntagResourcesResponse UntagResourcesResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UntagResourcesResponse' {Int
httpStatus :: Int
$sel:httpStatus:UntagResourcesResponse' :: UntagResourcesResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: UntagResourcesResponse
s@UntagResourcesResponse' {} Int
a -> UntagResourcesResponse
s {$sel:httpStatus:UntagResourcesResponse' :: Int
httpStatus = Int
a} :: UntagResourcesResponse)
instance Prelude.NFData UntagResourcesResponse