{-# 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.Config.PutAggregationAuthorization
(
PutAggregationAuthorization (..),
newPutAggregationAuthorization,
putAggregationAuthorization_tags,
putAggregationAuthorization_authorizedAccountId,
putAggregationAuthorization_authorizedAwsRegion,
PutAggregationAuthorizationResponse (..),
newPutAggregationAuthorizationResponse,
putAggregationAuthorizationResponse_aggregationAuthorization,
putAggregationAuthorizationResponse_httpStatus,
)
where
import Amazonka.Config.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 PutAggregationAuthorization = PutAggregationAuthorization'
{
PutAggregationAuthorization -> Maybe [Tag]
tags :: Prelude.Maybe [Tag],
PutAggregationAuthorization -> Text
authorizedAccountId :: Prelude.Text,
PutAggregationAuthorization -> Text
authorizedAwsRegion :: Prelude.Text
}
deriving (PutAggregationAuthorization -> PutAggregationAuthorization -> Bool
(PutAggregationAuthorization
-> PutAggregationAuthorization -> Bool)
-> (PutAggregationAuthorization
-> PutAggregationAuthorization -> Bool)
-> Eq PutAggregationAuthorization
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PutAggregationAuthorization -> PutAggregationAuthorization -> Bool
$c/= :: PutAggregationAuthorization -> PutAggregationAuthorization -> Bool
== :: PutAggregationAuthorization -> PutAggregationAuthorization -> Bool
$c== :: PutAggregationAuthorization -> PutAggregationAuthorization -> Bool
Prelude.Eq, ReadPrec [PutAggregationAuthorization]
ReadPrec PutAggregationAuthorization
Int -> ReadS PutAggregationAuthorization
ReadS [PutAggregationAuthorization]
(Int -> ReadS PutAggregationAuthorization)
-> ReadS [PutAggregationAuthorization]
-> ReadPrec PutAggregationAuthorization
-> ReadPrec [PutAggregationAuthorization]
-> Read PutAggregationAuthorization
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PutAggregationAuthorization]
$creadListPrec :: ReadPrec [PutAggregationAuthorization]
readPrec :: ReadPrec PutAggregationAuthorization
$creadPrec :: ReadPrec PutAggregationAuthorization
readList :: ReadS [PutAggregationAuthorization]
$creadList :: ReadS [PutAggregationAuthorization]
readsPrec :: Int -> ReadS PutAggregationAuthorization
$creadsPrec :: Int -> ReadS PutAggregationAuthorization
Prelude.Read, Int -> PutAggregationAuthorization -> ShowS
[PutAggregationAuthorization] -> ShowS
PutAggregationAuthorization -> String
(Int -> PutAggregationAuthorization -> ShowS)
-> (PutAggregationAuthorization -> String)
-> ([PutAggregationAuthorization] -> ShowS)
-> Show PutAggregationAuthorization
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PutAggregationAuthorization] -> ShowS
$cshowList :: [PutAggregationAuthorization] -> ShowS
show :: PutAggregationAuthorization -> String
$cshow :: PutAggregationAuthorization -> String
showsPrec :: Int -> PutAggregationAuthorization -> ShowS
$cshowsPrec :: Int -> PutAggregationAuthorization -> ShowS
Prelude.Show, (forall x.
PutAggregationAuthorization -> Rep PutAggregationAuthorization x)
-> (forall x.
Rep PutAggregationAuthorization x -> PutAggregationAuthorization)
-> Generic PutAggregationAuthorization
forall x.
Rep PutAggregationAuthorization x -> PutAggregationAuthorization
forall x.
PutAggregationAuthorization -> Rep PutAggregationAuthorization x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep PutAggregationAuthorization x -> PutAggregationAuthorization
$cfrom :: forall x.
PutAggregationAuthorization -> Rep PutAggregationAuthorization x
Prelude.Generic)
newPutAggregationAuthorization ::
Prelude.Text ->
Prelude.Text ->
PutAggregationAuthorization
newPutAggregationAuthorization :: Text -> Text -> PutAggregationAuthorization
newPutAggregationAuthorization
Text
pAuthorizedAccountId_
Text
pAuthorizedAwsRegion_ =
PutAggregationAuthorization' :: Maybe [Tag] -> Text -> Text -> PutAggregationAuthorization
PutAggregationAuthorization'
{ $sel:tags:PutAggregationAuthorization' :: Maybe [Tag]
tags =
Maybe [Tag]
forall a. Maybe a
Prelude.Nothing,
$sel:authorizedAccountId:PutAggregationAuthorization' :: Text
authorizedAccountId = Text
pAuthorizedAccountId_,
$sel:authorizedAwsRegion:PutAggregationAuthorization' :: Text
authorizedAwsRegion = Text
pAuthorizedAwsRegion_
}
putAggregationAuthorization_tags :: Lens.Lens' PutAggregationAuthorization (Prelude.Maybe [Tag])
putAggregationAuthorization_tags :: (Maybe [Tag] -> f (Maybe [Tag]))
-> PutAggregationAuthorization -> f PutAggregationAuthorization
putAggregationAuthorization_tags = (PutAggregationAuthorization -> Maybe [Tag])
-> (PutAggregationAuthorization
-> Maybe [Tag] -> PutAggregationAuthorization)
-> Lens
PutAggregationAuthorization
PutAggregationAuthorization
(Maybe [Tag])
(Maybe [Tag])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutAggregationAuthorization' {Maybe [Tag]
tags :: Maybe [Tag]
$sel:tags:PutAggregationAuthorization' :: PutAggregationAuthorization -> Maybe [Tag]
tags} -> Maybe [Tag]
tags) (\s :: PutAggregationAuthorization
s@PutAggregationAuthorization' {} Maybe [Tag]
a -> PutAggregationAuthorization
s {$sel:tags:PutAggregationAuthorization' :: Maybe [Tag]
tags = Maybe [Tag]
a} :: PutAggregationAuthorization) ((Maybe [Tag] -> f (Maybe [Tag]))
-> PutAggregationAuthorization -> f PutAggregationAuthorization)
-> ((Maybe [Tag] -> f (Maybe [Tag]))
-> Maybe [Tag] -> f (Maybe [Tag]))
-> (Maybe [Tag] -> f (Maybe [Tag]))
-> PutAggregationAuthorization
-> f PutAggregationAuthorization
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
putAggregationAuthorization_authorizedAccountId :: Lens.Lens' PutAggregationAuthorization Prelude.Text
putAggregationAuthorization_authorizedAccountId :: (Text -> f Text)
-> PutAggregationAuthorization -> f PutAggregationAuthorization
putAggregationAuthorization_authorizedAccountId = (PutAggregationAuthorization -> Text)
-> (PutAggregationAuthorization
-> Text -> PutAggregationAuthorization)
-> Lens
PutAggregationAuthorization PutAggregationAuthorization Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutAggregationAuthorization' {Text
authorizedAccountId :: Text
$sel:authorizedAccountId:PutAggregationAuthorization' :: PutAggregationAuthorization -> Text
authorizedAccountId} -> Text
authorizedAccountId) (\s :: PutAggregationAuthorization
s@PutAggregationAuthorization' {} Text
a -> PutAggregationAuthorization
s {$sel:authorizedAccountId:PutAggregationAuthorization' :: Text
authorizedAccountId = Text
a} :: PutAggregationAuthorization)
putAggregationAuthorization_authorizedAwsRegion :: Lens.Lens' PutAggregationAuthorization Prelude.Text
putAggregationAuthorization_authorizedAwsRegion :: (Text -> f Text)
-> PutAggregationAuthorization -> f PutAggregationAuthorization
putAggregationAuthorization_authorizedAwsRegion = (PutAggregationAuthorization -> Text)
-> (PutAggregationAuthorization
-> Text -> PutAggregationAuthorization)
-> Lens
PutAggregationAuthorization PutAggregationAuthorization Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutAggregationAuthorization' {Text
authorizedAwsRegion :: Text
$sel:authorizedAwsRegion:PutAggregationAuthorization' :: PutAggregationAuthorization -> Text
authorizedAwsRegion} -> Text
authorizedAwsRegion) (\s :: PutAggregationAuthorization
s@PutAggregationAuthorization' {} Text
a -> PutAggregationAuthorization
s {$sel:authorizedAwsRegion:PutAggregationAuthorization' :: Text
authorizedAwsRegion = Text
a} :: PutAggregationAuthorization)
instance Core.AWSRequest PutAggregationAuthorization where
type
AWSResponse PutAggregationAuthorization =
PutAggregationAuthorizationResponse
request :: PutAggregationAuthorization -> Request PutAggregationAuthorization
request = Service
-> PutAggregationAuthorization
-> Request PutAggregationAuthorization
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy PutAggregationAuthorization
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse PutAggregationAuthorization)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse PutAggregationAuthorization))
-> Logger
-> Service
-> Proxy PutAggregationAuthorization
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse PutAggregationAuthorization)))
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 AggregationAuthorization
-> Int -> PutAggregationAuthorizationResponse
PutAggregationAuthorizationResponse'
(Maybe AggregationAuthorization
-> Int -> PutAggregationAuthorizationResponse)
-> Either String (Maybe AggregationAuthorization)
-> Either String (Int -> PutAggregationAuthorizationResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe AggregationAuthorization)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"AggregationAuthorization")
Either String (Int -> PutAggregationAuthorizationResponse)
-> Either String Int
-> Either String PutAggregationAuthorizationResponse
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 PutAggregationAuthorization
instance Prelude.NFData PutAggregationAuthorization
instance Core.ToHeaders PutAggregationAuthorization where
toHeaders :: PutAggregationAuthorization -> ResponseHeaders
toHeaders =
ResponseHeaders -> PutAggregationAuthorization -> 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
"StarlingDoveService.PutAggregationAuthorization" ::
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 PutAggregationAuthorization where
toJSON :: PutAggregationAuthorization -> Value
toJSON PutAggregationAuthorization' {Maybe [Tag]
Text
authorizedAwsRegion :: Text
authorizedAccountId :: Text
tags :: Maybe [Tag]
$sel:authorizedAwsRegion:PutAggregationAuthorization' :: PutAggregationAuthorization -> Text
$sel:authorizedAccountId:PutAggregationAuthorization' :: PutAggregationAuthorization -> Text
$sel:tags:PutAggregationAuthorization' :: PutAggregationAuthorization -> Maybe [Tag]
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"Tags" 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]
tags,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"AuthorizedAccountId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
authorizedAccountId),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"AuthorizedAwsRegion" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
authorizedAwsRegion)
]
)
instance Core.ToPath PutAggregationAuthorization where
toPath :: PutAggregationAuthorization -> ByteString
toPath = ByteString -> PutAggregationAuthorization -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery PutAggregationAuthorization where
toQuery :: PutAggregationAuthorization -> QueryString
toQuery = QueryString -> PutAggregationAuthorization -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data PutAggregationAuthorizationResponse = PutAggregationAuthorizationResponse'
{
PutAggregationAuthorizationResponse
-> Maybe AggregationAuthorization
aggregationAuthorization :: Prelude.Maybe AggregationAuthorization,
PutAggregationAuthorizationResponse -> Int
httpStatus :: Prelude.Int
}
deriving (PutAggregationAuthorizationResponse
-> PutAggregationAuthorizationResponse -> Bool
(PutAggregationAuthorizationResponse
-> PutAggregationAuthorizationResponse -> Bool)
-> (PutAggregationAuthorizationResponse
-> PutAggregationAuthorizationResponse -> Bool)
-> Eq PutAggregationAuthorizationResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PutAggregationAuthorizationResponse
-> PutAggregationAuthorizationResponse -> Bool
$c/= :: PutAggregationAuthorizationResponse
-> PutAggregationAuthorizationResponse -> Bool
== :: PutAggregationAuthorizationResponse
-> PutAggregationAuthorizationResponse -> Bool
$c== :: PutAggregationAuthorizationResponse
-> PutAggregationAuthorizationResponse -> Bool
Prelude.Eq, ReadPrec [PutAggregationAuthorizationResponse]
ReadPrec PutAggregationAuthorizationResponse
Int -> ReadS PutAggregationAuthorizationResponse
ReadS [PutAggregationAuthorizationResponse]
(Int -> ReadS PutAggregationAuthorizationResponse)
-> ReadS [PutAggregationAuthorizationResponse]
-> ReadPrec PutAggregationAuthorizationResponse
-> ReadPrec [PutAggregationAuthorizationResponse]
-> Read PutAggregationAuthorizationResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PutAggregationAuthorizationResponse]
$creadListPrec :: ReadPrec [PutAggregationAuthorizationResponse]
readPrec :: ReadPrec PutAggregationAuthorizationResponse
$creadPrec :: ReadPrec PutAggregationAuthorizationResponse
readList :: ReadS [PutAggregationAuthorizationResponse]
$creadList :: ReadS [PutAggregationAuthorizationResponse]
readsPrec :: Int -> ReadS PutAggregationAuthorizationResponse
$creadsPrec :: Int -> ReadS PutAggregationAuthorizationResponse
Prelude.Read, Int -> PutAggregationAuthorizationResponse -> ShowS
[PutAggregationAuthorizationResponse] -> ShowS
PutAggregationAuthorizationResponse -> String
(Int -> PutAggregationAuthorizationResponse -> ShowS)
-> (PutAggregationAuthorizationResponse -> String)
-> ([PutAggregationAuthorizationResponse] -> ShowS)
-> Show PutAggregationAuthorizationResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PutAggregationAuthorizationResponse] -> ShowS
$cshowList :: [PutAggregationAuthorizationResponse] -> ShowS
show :: PutAggregationAuthorizationResponse -> String
$cshow :: PutAggregationAuthorizationResponse -> String
showsPrec :: Int -> PutAggregationAuthorizationResponse -> ShowS
$cshowsPrec :: Int -> PutAggregationAuthorizationResponse -> ShowS
Prelude.Show, (forall x.
PutAggregationAuthorizationResponse
-> Rep PutAggregationAuthorizationResponse x)
-> (forall x.
Rep PutAggregationAuthorizationResponse x
-> PutAggregationAuthorizationResponse)
-> Generic PutAggregationAuthorizationResponse
forall x.
Rep PutAggregationAuthorizationResponse x
-> PutAggregationAuthorizationResponse
forall x.
PutAggregationAuthorizationResponse
-> Rep PutAggregationAuthorizationResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep PutAggregationAuthorizationResponse x
-> PutAggregationAuthorizationResponse
$cfrom :: forall x.
PutAggregationAuthorizationResponse
-> Rep PutAggregationAuthorizationResponse x
Prelude.Generic)
newPutAggregationAuthorizationResponse ::
Prelude.Int ->
PutAggregationAuthorizationResponse
newPutAggregationAuthorizationResponse :: Int -> PutAggregationAuthorizationResponse
newPutAggregationAuthorizationResponse Int
pHttpStatus_ =
PutAggregationAuthorizationResponse' :: Maybe AggregationAuthorization
-> Int -> PutAggregationAuthorizationResponse
PutAggregationAuthorizationResponse'
{ $sel:aggregationAuthorization:PutAggregationAuthorizationResponse' :: Maybe AggregationAuthorization
aggregationAuthorization =
Maybe AggregationAuthorization
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:PutAggregationAuthorizationResponse' :: Int
httpStatus = Int
pHttpStatus_
}
putAggregationAuthorizationResponse_aggregationAuthorization :: Lens.Lens' PutAggregationAuthorizationResponse (Prelude.Maybe AggregationAuthorization)
putAggregationAuthorizationResponse_aggregationAuthorization :: (Maybe AggregationAuthorization
-> f (Maybe AggregationAuthorization))
-> PutAggregationAuthorizationResponse
-> f PutAggregationAuthorizationResponse
putAggregationAuthorizationResponse_aggregationAuthorization = (PutAggregationAuthorizationResponse
-> Maybe AggregationAuthorization)
-> (PutAggregationAuthorizationResponse
-> Maybe AggregationAuthorization
-> PutAggregationAuthorizationResponse)
-> Lens
PutAggregationAuthorizationResponse
PutAggregationAuthorizationResponse
(Maybe AggregationAuthorization)
(Maybe AggregationAuthorization)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutAggregationAuthorizationResponse' {Maybe AggregationAuthorization
aggregationAuthorization :: Maybe AggregationAuthorization
$sel:aggregationAuthorization:PutAggregationAuthorizationResponse' :: PutAggregationAuthorizationResponse
-> Maybe AggregationAuthorization
aggregationAuthorization} -> Maybe AggregationAuthorization
aggregationAuthorization) (\s :: PutAggregationAuthorizationResponse
s@PutAggregationAuthorizationResponse' {} Maybe AggregationAuthorization
a -> PutAggregationAuthorizationResponse
s {$sel:aggregationAuthorization:PutAggregationAuthorizationResponse' :: Maybe AggregationAuthorization
aggregationAuthorization = Maybe AggregationAuthorization
a} :: PutAggregationAuthorizationResponse)
putAggregationAuthorizationResponse_httpStatus :: Lens.Lens' PutAggregationAuthorizationResponse Prelude.Int
putAggregationAuthorizationResponse_httpStatus :: (Int -> f Int)
-> PutAggregationAuthorizationResponse
-> f PutAggregationAuthorizationResponse
putAggregationAuthorizationResponse_httpStatus = (PutAggregationAuthorizationResponse -> Int)
-> (PutAggregationAuthorizationResponse
-> Int -> PutAggregationAuthorizationResponse)
-> Lens
PutAggregationAuthorizationResponse
PutAggregationAuthorizationResponse
Int
Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutAggregationAuthorizationResponse' {Int
httpStatus :: Int
$sel:httpStatus:PutAggregationAuthorizationResponse' :: PutAggregationAuthorizationResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: PutAggregationAuthorizationResponse
s@PutAggregationAuthorizationResponse' {} Int
a -> PutAggregationAuthorizationResponse
s {$sel:httpStatus:PutAggregationAuthorizationResponse' :: Int
httpStatus = Int
a} :: PutAggregationAuthorizationResponse)
instance
Prelude.NFData
PutAggregationAuthorizationResponse