{-# 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.AcceptGrant
(
AcceptGrant (..),
newAcceptGrant,
acceptGrant_grantArn,
AcceptGrantResponse (..),
newAcceptGrantResponse,
acceptGrantResponse_status,
acceptGrantResponse_version,
acceptGrantResponse_grantArn,
acceptGrantResponse_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 AcceptGrant = AcceptGrant'
{
AcceptGrant -> Text
grantArn :: Prelude.Text
}
deriving (AcceptGrant -> AcceptGrant -> Bool
(AcceptGrant -> AcceptGrant -> Bool)
-> (AcceptGrant -> AcceptGrant -> Bool) -> Eq AcceptGrant
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AcceptGrant -> AcceptGrant -> Bool
$c/= :: AcceptGrant -> AcceptGrant -> Bool
== :: AcceptGrant -> AcceptGrant -> Bool
$c== :: AcceptGrant -> AcceptGrant -> Bool
Prelude.Eq, ReadPrec [AcceptGrant]
ReadPrec AcceptGrant
Int -> ReadS AcceptGrant
ReadS [AcceptGrant]
(Int -> ReadS AcceptGrant)
-> ReadS [AcceptGrant]
-> ReadPrec AcceptGrant
-> ReadPrec [AcceptGrant]
-> Read AcceptGrant
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AcceptGrant]
$creadListPrec :: ReadPrec [AcceptGrant]
readPrec :: ReadPrec AcceptGrant
$creadPrec :: ReadPrec AcceptGrant
readList :: ReadS [AcceptGrant]
$creadList :: ReadS [AcceptGrant]
readsPrec :: Int -> ReadS AcceptGrant
$creadsPrec :: Int -> ReadS AcceptGrant
Prelude.Read, Int -> AcceptGrant -> ShowS
[AcceptGrant] -> ShowS
AcceptGrant -> String
(Int -> AcceptGrant -> ShowS)
-> (AcceptGrant -> String)
-> ([AcceptGrant] -> ShowS)
-> Show AcceptGrant
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AcceptGrant] -> ShowS
$cshowList :: [AcceptGrant] -> ShowS
show :: AcceptGrant -> String
$cshow :: AcceptGrant -> String
showsPrec :: Int -> AcceptGrant -> ShowS
$cshowsPrec :: Int -> AcceptGrant -> ShowS
Prelude.Show, (forall x. AcceptGrant -> Rep AcceptGrant x)
-> (forall x. Rep AcceptGrant x -> AcceptGrant)
-> Generic AcceptGrant
forall x. Rep AcceptGrant x -> AcceptGrant
forall x. AcceptGrant -> Rep AcceptGrant x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AcceptGrant x -> AcceptGrant
$cfrom :: forall x. AcceptGrant -> Rep AcceptGrant x
Prelude.Generic)
newAcceptGrant ::
Prelude.Text ->
AcceptGrant
newAcceptGrant :: Text -> AcceptGrant
newAcceptGrant Text
pGrantArn_ =
AcceptGrant' :: Text -> AcceptGrant
AcceptGrant' {$sel:grantArn:AcceptGrant' :: Text
grantArn = Text
pGrantArn_}
acceptGrant_grantArn :: Lens.Lens' AcceptGrant Prelude.Text
acceptGrant_grantArn :: (Text -> f Text) -> AcceptGrant -> f AcceptGrant
acceptGrant_grantArn = (AcceptGrant -> Text)
-> (AcceptGrant -> Text -> AcceptGrant)
-> Lens AcceptGrant AcceptGrant Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AcceptGrant' {Text
grantArn :: Text
$sel:grantArn:AcceptGrant' :: AcceptGrant -> Text
grantArn} -> Text
grantArn) (\s :: AcceptGrant
s@AcceptGrant' {} Text
a -> AcceptGrant
s {$sel:grantArn:AcceptGrant' :: Text
grantArn = Text
a} :: AcceptGrant)
instance Core.AWSRequest AcceptGrant where
type AWSResponse AcceptGrant = AcceptGrantResponse
request :: AcceptGrant -> Request AcceptGrant
request = Service -> AcceptGrant -> Request AcceptGrant
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy AcceptGrant
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse AcceptGrant)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse AcceptGrant))
-> Logger
-> Service
-> Proxy AcceptGrant
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse AcceptGrant)))
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 -> AcceptGrantResponse
AcceptGrantResponse'
(Maybe GrantStatus
-> Maybe Text -> Maybe Text -> Int -> AcceptGrantResponse)
-> Either String (Maybe GrantStatus)
-> Either
String (Maybe Text -> Maybe Text -> Int -> AcceptGrantResponse)
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 -> AcceptGrantResponse)
-> Either String (Maybe Text)
-> Either String (Maybe Text -> Int -> AcceptGrantResponse)
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 -> AcceptGrantResponse)
-> Either String (Maybe Text)
-> Either String (Int -> AcceptGrantResponse)
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 -> AcceptGrantResponse)
-> Either String Int -> Either String AcceptGrantResponse
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 AcceptGrant
instance Prelude.NFData AcceptGrant
instance Core.ToHeaders AcceptGrant where
toHeaders :: AcceptGrant -> ResponseHeaders
toHeaders =
ResponseHeaders -> AcceptGrant -> 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.AcceptGrant" ::
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 AcceptGrant where
toJSON :: AcceptGrant -> Value
toJSON AcceptGrant' {Text
grantArn :: Text
$sel:grantArn:AcceptGrant' :: AcceptGrant -> 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 AcceptGrant where
toPath :: AcceptGrant -> ByteString
toPath = ByteString -> AcceptGrant -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery AcceptGrant where
toQuery :: AcceptGrant -> QueryString
toQuery = QueryString -> AcceptGrant -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data AcceptGrantResponse = AcceptGrantResponse'
{
AcceptGrantResponse -> Maybe GrantStatus
status :: Prelude.Maybe GrantStatus,
AcceptGrantResponse -> Maybe Text
version :: Prelude.Maybe Prelude.Text,
AcceptGrantResponse -> Maybe Text
grantArn :: Prelude.Maybe Prelude.Text,
AcceptGrantResponse -> Int
httpStatus :: Prelude.Int
}
deriving (AcceptGrantResponse -> AcceptGrantResponse -> Bool
(AcceptGrantResponse -> AcceptGrantResponse -> Bool)
-> (AcceptGrantResponse -> AcceptGrantResponse -> Bool)
-> Eq AcceptGrantResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AcceptGrantResponse -> AcceptGrantResponse -> Bool
$c/= :: AcceptGrantResponse -> AcceptGrantResponse -> Bool
== :: AcceptGrantResponse -> AcceptGrantResponse -> Bool
$c== :: AcceptGrantResponse -> AcceptGrantResponse -> Bool
Prelude.Eq, ReadPrec [AcceptGrantResponse]
ReadPrec AcceptGrantResponse
Int -> ReadS AcceptGrantResponse
ReadS [AcceptGrantResponse]
(Int -> ReadS AcceptGrantResponse)
-> ReadS [AcceptGrantResponse]
-> ReadPrec AcceptGrantResponse
-> ReadPrec [AcceptGrantResponse]
-> Read AcceptGrantResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AcceptGrantResponse]
$creadListPrec :: ReadPrec [AcceptGrantResponse]
readPrec :: ReadPrec AcceptGrantResponse
$creadPrec :: ReadPrec AcceptGrantResponse
readList :: ReadS [AcceptGrantResponse]
$creadList :: ReadS [AcceptGrantResponse]
readsPrec :: Int -> ReadS AcceptGrantResponse
$creadsPrec :: Int -> ReadS AcceptGrantResponse
Prelude.Read, Int -> AcceptGrantResponse -> ShowS
[AcceptGrantResponse] -> ShowS
AcceptGrantResponse -> String
(Int -> AcceptGrantResponse -> ShowS)
-> (AcceptGrantResponse -> String)
-> ([AcceptGrantResponse] -> ShowS)
-> Show AcceptGrantResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AcceptGrantResponse] -> ShowS
$cshowList :: [AcceptGrantResponse] -> ShowS
show :: AcceptGrantResponse -> String
$cshow :: AcceptGrantResponse -> String
showsPrec :: Int -> AcceptGrantResponse -> ShowS
$cshowsPrec :: Int -> AcceptGrantResponse -> ShowS
Prelude.Show, (forall x. AcceptGrantResponse -> Rep AcceptGrantResponse x)
-> (forall x. Rep AcceptGrantResponse x -> AcceptGrantResponse)
-> Generic AcceptGrantResponse
forall x. Rep AcceptGrantResponse x -> AcceptGrantResponse
forall x. AcceptGrantResponse -> Rep AcceptGrantResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AcceptGrantResponse x -> AcceptGrantResponse
$cfrom :: forall x. AcceptGrantResponse -> Rep AcceptGrantResponse x
Prelude.Generic)
newAcceptGrantResponse ::
Prelude.Int ->
AcceptGrantResponse
newAcceptGrantResponse :: Int -> AcceptGrantResponse
newAcceptGrantResponse Int
pHttpStatus_ =
AcceptGrantResponse' :: Maybe GrantStatus
-> Maybe Text -> Maybe Text -> Int -> AcceptGrantResponse
AcceptGrantResponse'
{ $sel:status:AcceptGrantResponse' :: Maybe GrantStatus
status = Maybe GrantStatus
forall a. Maybe a
Prelude.Nothing,
$sel:version:AcceptGrantResponse' :: Maybe Text
version = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:grantArn:AcceptGrantResponse' :: Maybe Text
grantArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:AcceptGrantResponse' :: Int
httpStatus = Int
pHttpStatus_
}
acceptGrantResponse_status :: Lens.Lens' AcceptGrantResponse (Prelude.Maybe GrantStatus)
acceptGrantResponse_status :: (Maybe GrantStatus -> f (Maybe GrantStatus))
-> AcceptGrantResponse -> f AcceptGrantResponse
acceptGrantResponse_status = (AcceptGrantResponse -> Maybe GrantStatus)
-> (AcceptGrantResponse
-> Maybe GrantStatus -> AcceptGrantResponse)
-> Lens
AcceptGrantResponse
AcceptGrantResponse
(Maybe GrantStatus)
(Maybe GrantStatus)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AcceptGrantResponse' {Maybe GrantStatus
status :: Maybe GrantStatus
$sel:status:AcceptGrantResponse' :: AcceptGrantResponse -> Maybe GrantStatus
status} -> Maybe GrantStatus
status) (\s :: AcceptGrantResponse
s@AcceptGrantResponse' {} Maybe GrantStatus
a -> AcceptGrantResponse
s {$sel:status:AcceptGrantResponse' :: Maybe GrantStatus
status = Maybe GrantStatus
a} :: AcceptGrantResponse)
acceptGrantResponse_version :: Lens.Lens' AcceptGrantResponse (Prelude.Maybe Prelude.Text)
acceptGrantResponse_version :: (Maybe Text -> f (Maybe Text))
-> AcceptGrantResponse -> f AcceptGrantResponse
acceptGrantResponse_version = (AcceptGrantResponse -> Maybe Text)
-> (AcceptGrantResponse -> Maybe Text -> AcceptGrantResponse)
-> Lens
AcceptGrantResponse AcceptGrantResponse (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AcceptGrantResponse' {Maybe Text
version :: Maybe Text
$sel:version:AcceptGrantResponse' :: AcceptGrantResponse -> Maybe Text
version} -> Maybe Text
version) (\s :: AcceptGrantResponse
s@AcceptGrantResponse' {} Maybe Text
a -> AcceptGrantResponse
s {$sel:version:AcceptGrantResponse' :: Maybe Text
version = Maybe Text
a} :: AcceptGrantResponse)
acceptGrantResponse_grantArn :: Lens.Lens' AcceptGrantResponse (Prelude.Maybe Prelude.Text)
acceptGrantResponse_grantArn :: (Maybe Text -> f (Maybe Text))
-> AcceptGrantResponse -> f AcceptGrantResponse
acceptGrantResponse_grantArn = (AcceptGrantResponse -> Maybe Text)
-> (AcceptGrantResponse -> Maybe Text -> AcceptGrantResponse)
-> Lens
AcceptGrantResponse AcceptGrantResponse (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AcceptGrantResponse' {Maybe Text
grantArn :: Maybe Text
$sel:grantArn:AcceptGrantResponse' :: AcceptGrantResponse -> Maybe Text
grantArn} -> Maybe Text
grantArn) (\s :: AcceptGrantResponse
s@AcceptGrantResponse' {} Maybe Text
a -> AcceptGrantResponse
s {$sel:grantArn:AcceptGrantResponse' :: Maybe Text
grantArn = Maybe Text
a} :: AcceptGrantResponse)
acceptGrantResponse_httpStatus :: Lens.Lens' AcceptGrantResponse Prelude.Int
acceptGrantResponse_httpStatus :: (Int -> f Int) -> AcceptGrantResponse -> f AcceptGrantResponse
acceptGrantResponse_httpStatus = (AcceptGrantResponse -> Int)
-> (AcceptGrantResponse -> Int -> AcceptGrantResponse)
-> Lens AcceptGrantResponse AcceptGrantResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AcceptGrantResponse' {Int
httpStatus :: Int
$sel:httpStatus:AcceptGrantResponse' :: AcceptGrantResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: AcceptGrantResponse
s@AcceptGrantResponse' {} Int
a -> AcceptGrantResponse
s {$sel:httpStatus:AcceptGrantResponse' :: Int
httpStatus = Int
a} :: AcceptGrantResponse)
instance Prelude.NFData AcceptGrantResponse