{-# 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.LicenseManager.RejectGrant
(
RejectGrant (..),
newRejectGrant,
rejectGrant_grantArn,
RejectGrantResponse (..),
newRejectGrantResponse,
rejectGrantResponse_status,
rejectGrantResponse_version,
rejectGrantResponse_grantArn,
rejectGrantResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.LicenseManager.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data RejectGrant = RejectGrant'
{
RejectGrant -> Text
grantArn :: Prelude.Text
}
deriving (RejectGrant -> RejectGrant -> Bool
(RejectGrant -> RejectGrant -> Bool)
-> (RejectGrant -> RejectGrant -> Bool) -> Eq RejectGrant
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RejectGrant -> RejectGrant -> Bool
$c/= :: RejectGrant -> RejectGrant -> Bool
== :: RejectGrant -> RejectGrant -> Bool
$c== :: RejectGrant -> RejectGrant -> Bool
Prelude.Eq, ReadPrec [RejectGrant]
ReadPrec RejectGrant
Int -> ReadS RejectGrant
ReadS [RejectGrant]
(Int -> ReadS RejectGrant)
-> ReadS [RejectGrant]
-> ReadPrec RejectGrant
-> ReadPrec [RejectGrant]
-> Read RejectGrant
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RejectGrant]
$creadListPrec :: ReadPrec [RejectGrant]
readPrec :: ReadPrec RejectGrant
$creadPrec :: ReadPrec RejectGrant
readList :: ReadS [RejectGrant]
$creadList :: ReadS [RejectGrant]
readsPrec :: Int -> ReadS RejectGrant
$creadsPrec :: Int -> ReadS RejectGrant
Prelude.Read, Int -> RejectGrant -> ShowS
[RejectGrant] -> ShowS
RejectGrant -> String
(Int -> RejectGrant -> ShowS)
-> (RejectGrant -> String)
-> ([RejectGrant] -> ShowS)
-> Show RejectGrant
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RejectGrant] -> ShowS
$cshowList :: [RejectGrant] -> ShowS
show :: RejectGrant -> String
$cshow :: RejectGrant -> String
showsPrec :: Int -> RejectGrant -> ShowS
$cshowsPrec :: Int -> RejectGrant -> ShowS
Prelude.Show, (forall x. RejectGrant -> Rep RejectGrant x)
-> (forall x. Rep RejectGrant x -> RejectGrant)
-> Generic RejectGrant
forall x. Rep RejectGrant x -> RejectGrant
forall x. RejectGrant -> Rep RejectGrant x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RejectGrant x -> RejectGrant
$cfrom :: forall x. RejectGrant -> Rep RejectGrant x
Prelude.Generic)
newRejectGrant ::
Prelude.Text ->
RejectGrant
newRejectGrant :: Text -> RejectGrant
newRejectGrant Text
pGrantArn_ =
RejectGrant' :: Text -> RejectGrant
RejectGrant' {$sel:grantArn:RejectGrant' :: Text
grantArn = Text
pGrantArn_}
rejectGrant_grantArn :: Lens.Lens' RejectGrant Prelude.Text
rejectGrant_grantArn :: (Text -> f Text) -> RejectGrant -> f RejectGrant
rejectGrant_grantArn = (RejectGrant -> Text)
-> (RejectGrant -> Text -> RejectGrant)
-> Lens RejectGrant RejectGrant Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RejectGrant' {Text
grantArn :: Text
$sel:grantArn:RejectGrant' :: RejectGrant -> Text
grantArn} -> Text
grantArn) (\s :: RejectGrant
s@RejectGrant' {} Text
a -> RejectGrant
s {$sel:grantArn:RejectGrant' :: Text
grantArn = Text
a} :: RejectGrant)
instance Core.AWSRequest RejectGrant where
type AWSResponse RejectGrant = RejectGrantResponse
request :: RejectGrant -> Request RejectGrant
request = Service -> RejectGrant -> Request RejectGrant
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy RejectGrant
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse RejectGrant)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse RejectGrant))
-> Logger
-> Service
-> Proxy RejectGrant
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse RejectGrant)))
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 GrantStatus
-> Maybe Text -> Maybe Text -> Int -> RejectGrantResponse
RejectGrantResponse'
(Maybe GrantStatus
-> Maybe Text -> Maybe Text -> Int -> RejectGrantResponse)
-> Either String (Maybe GrantStatus)
-> Either
String (Maybe Text -> Maybe Text -> Int -> RejectGrantResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe GrantStatus)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Status")
Either
String (Maybe Text -> Maybe Text -> Int -> RejectGrantResponse)
-> Either String (Maybe Text)
-> Either String (Maybe Text -> Int -> RejectGrantResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Version")
Either String (Maybe Text -> Int -> RejectGrantResponse)
-> Either String (Maybe Text)
-> Either String (Int -> RejectGrantResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"GrantArn")
Either String (Int -> RejectGrantResponse)
-> Either String Int -> Either String RejectGrantResponse
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 RejectGrant
instance Prelude.NFData RejectGrant
instance Core.ToHeaders RejectGrant where
toHeaders :: RejectGrant -> ResponseHeaders
toHeaders =
ResponseHeaders -> RejectGrant -> 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
"AWSLicenseManager.RejectGrant" ::
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 RejectGrant where
toJSON :: RejectGrant -> Value
toJSON RejectGrant' {Text
grantArn :: Text
$sel:grantArn:RejectGrant' :: RejectGrant -> 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
"GrantArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
grantArn)]
)
instance Core.ToPath RejectGrant where
toPath :: RejectGrant -> ByteString
toPath = ByteString -> RejectGrant -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery RejectGrant where
toQuery :: RejectGrant -> QueryString
toQuery = QueryString -> RejectGrant -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data RejectGrantResponse = RejectGrantResponse'
{
RejectGrantResponse -> Maybe GrantStatus
status :: Prelude.Maybe GrantStatus,
RejectGrantResponse -> Maybe Text
version :: Prelude.Maybe Prelude.Text,
RejectGrantResponse -> Maybe Text
grantArn :: Prelude.Maybe Prelude.Text,
RejectGrantResponse -> Int
httpStatus :: Prelude.Int
}
deriving (RejectGrantResponse -> RejectGrantResponse -> Bool
(RejectGrantResponse -> RejectGrantResponse -> Bool)
-> (RejectGrantResponse -> RejectGrantResponse -> Bool)
-> Eq RejectGrantResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RejectGrantResponse -> RejectGrantResponse -> Bool
$c/= :: RejectGrantResponse -> RejectGrantResponse -> Bool
== :: RejectGrantResponse -> RejectGrantResponse -> Bool
$c== :: RejectGrantResponse -> RejectGrantResponse -> Bool
Prelude.Eq, ReadPrec [RejectGrantResponse]
ReadPrec RejectGrantResponse
Int -> ReadS RejectGrantResponse
ReadS [RejectGrantResponse]
(Int -> ReadS RejectGrantResponse)
-> ReadS [RejectGrantResponse]
-> ReadPrec RejectGrantResponse
-> ReadPrec [RejectGrantResponse]
-> Read RejectGrantResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RejectGrantResponse]
$creadListPrec :: ReadPrec [RejectGrantResponse]
readPrec :: ReadPrec RejectGrantResponse
$creadPrec :: ReadPrec RejectGrantResponse
readList :: ReadS [RejectGrantResponse]
$creadList :: ReadS [RejectGrantResponse]
readsPrec :: Int -> ReadS RejectGrantResponse
$creadsPrec :: Int -> ReadS RejectGrantResponse
Prelude.Read, Int -> RejectGrantResponse -> ShowS
[RejectGrantResponse] -> ShowS
RejectGrantResponse -> String
(Int -> RejectGrantResponse -> ShowS)
-> (RejectGrantResponse -> String)
-> ([RejectGrantResponse] -> ShowS)
-> Show RejectGrantResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RejectGrantResponse] -> ShowS
$cshowList :: [RejectGrantResponse] -> ShowS
show :: RejectGrantResponse -> String
$cshow :: RejectGrantResponse -> String
showsPrec :: Int -> RejectGrantResponse -> ShowS
$cshowsPrec :: Int -> RejectGrantResponse -> ShowS
Prelude.Show, (forall x. RejectGrantResponse -> Rep RejectGrantResponse x)
-> (forall x. Rep RejectGrantResponse x -> RejectGrantResponse)
-> Generic RejectGrantResponse
forall x. Rep RejectGrantResponse x -> RejectGrantResponse
forall x. RejectGrantResponse -> Rep RejectGrantResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RejectGrantResponse x -> RejectGrantResponse
$cfrom :: forall x. RejectGrantResponse -> Rep RejectGrantResponse x
Prelude.Generic)
newRejectGrantResponse ::
Prelude.Int ->
RejectGrantResponse
newRejectGrantResponse :: Int -> RejectGrantResponse
newRejectGrantResponse Int
pHttpStatus_ =
RejectGrantResponse' :: Maybe GrantStatus
-> Maybe Text -> Maybe Text -> Int -> RejectGrantResponse
RejectGrantResponse'
{ $sel:status:RejectGrantResponse' :: Maybe GrantStatus
status = Maybe GrantStatus
forall a. Maybe a
Prelude.Nothing,
$sel:version:RejectGrantResponse' :: Maybe Text
version = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:grantArn:RejectGrantResponse' :: Maybe Text
grantArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:RejectGrantResponse' :: Int
httpStatus = Int
pHttpStatus_
}
rejectGrantResponse_status :: Lens.Lens' RejectGrantResponse (Prelude.Maybe GrantStatus)
rejectGrantResponse_status :: (Maybe GrantStatus -> f (Maybe GrantStatus))
-> RejectGrantResponse -> f RejectGrantResponse
rejectGrantResponse_status = (RejectGrantResponse -> Maybe GrantStatus)
-> (RejectGrantResponse
-> Maybe GrantStatus -> RejectGrantResponse)
-> Lens
RejectGrantResponse
RejectGrantResponse
(Maybe GrantStatus)
(Maybe GrantStatus)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RejectGrantResponse' {Maybe GrantStatus
status :: Maybe GrantStatus
$sel:status:RejectGrantResponse' :: RejectGrantResponse -> Maybe GrantStatus
status} -> Maybe GrantStatus
status) (\s :: RejectGrantResponse
s@RejectGrantResponse' {} Maybe GrantStatus
a -> RejectGrantResponse
s {$sel:status:RejectGrantResponse' :: Maybe GrantStatus
status = Maybe GrantStatus
a} :: RejectGrantResponse)
rejectGrantResponse_version :: Lens.Lens' RejectGrantResponse (Prelude.Maybe Prelude.Text)
rejectGrantResponse_version :: (Maybe Text -> f (Maybe Text))
-> RejectGrantResponse -> f RejectGrantResponse
rejectGrantResponse_version = (RejectGrantResponse -> Maybe Text)
-> (RejectGrantResponse -> Maybe Text -> RejectGrantResponse)
-> Lens
RejectGrantResponse RejectGrantResponse (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RejectGrantResponse' {Maybe Text
version :: Maybe Text
$sel:version:RejectGrantResponse' :: RejectGrantResponse -> Maybe Text
version} -> Maybe Text
version) (\s :: RejectGrantResponse
s@RejectGrantResponse' {} Maybe Text
a -> RejectGrantResponse
s {$sel:version:RejectGrantResponse' :: Maybe Text
version = Maybe Text
a} :: RejectGrantResponse)
rejectGrantResponse_grantArn :: Lens.Lens' RejectGrantResponse (Prelude.Maybe Prelude.Text)
rejectGrantResponse_grantArn :: (Maybe Text -> f (Maybe Text))
-> RejectGrantResponse -> f RejectGrantResponse
rejectGrantResponse_grantArn = (RejectGrantResponse -> Maybe Text)
-> (RejectGrantResponse -> Maybe Text -> RejectGrantResponse)
-> Lens
RejectGrantResponse RejectGrantResponse (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RejectGrantResponse' {Maybe Text
grantArn :: Maybe Text
$sel:grantArn:RejectGrantResponse' :: RejectGrantResponse -> Maybe Text
grantArn} -> Maybe Text
grantArn) (\s :: RejectGrantResponse
s@RejectGrantResponse' {} Maybe Text
a -> RejectGrantResponse
s {$sel:grantArn:RejectGrantResponse' :: Maybe Text
grantArn = Maybe Text
a} :: RejectGrantResponse)
rejectGrantResponse_httpStatus :: Lens.Lens' RejectGrantResponse Prelude.Int
rejectGrantResponse_httpStatus :: (Int -> f Int) -> RejectGrantResponse -> f RejectGrantResponse
rejectGrantResponse_httpStatus = (RejectGrantResponse -> Int)
-> (RejectGrantResponse -> Int -> RejectGrantResponse)
-> Lens RejectGrantResponse RejectGrantResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RejectGrantResponse' {Int
httpStatus :: Int
$sel:httpStatus:RejectGrantResponse' :: RejectGrantResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: RejectGrantResponse
s@RejectGrantResponse' {} Int
a -> RejectGrantResponse
s {$sel:httpStatus:RejectGrantResponse' :: Int
httpStatus = Int
a} :: RejectGrantResponse)
instance Prelude.NFData RejectGrantResponse