{-# 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 #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.LicenseManager.CreateGrant
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Creates a grant for the specified license. A grant shares the use of
-- license entitlements with specific Amazon Web Services accounts.
module Amazonka.LicenseManager.CreateGrant
  ( -- * Creating a Request
    CreateGrant (..),
    newCreateGrant,

    -- * Request Lenses
    createGrant_clientToken,
    createGrant_grantName,
    createGrant_licenseArn,
    createGrant_principals,
    createGrant_homeRegion,
    createGrant_allowedOperations,

    -- * Destructuring the Response
    CreateGrantResponse (..),
    newCreateGrantResponse,

    -- * Response Lenses
    createGrantResponse_status,
    createGrantResponse_version,
    createGrantResponse_grantArn,
    createGrantResponse_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

-- | /See:/ 'newCreateGrant' smart constructor.
data CreateGrant = CreateGrant'
  { -- | Unique, case-sensitive identifier that you provide to ensure the
    -- idempotency of the request.
    CreateGrant -> Text
clientToken :: Prelude.Text,
    -- | Grant name.
    CreateGrant -> Text
grantName :: Prelude.Text,
    -- | Amazon Resource Name (ARN) of the license.
    CreateGrant -> Text
licenseArn :: Prelude.Text,
    -- | The grant principals.
    CreateGrant -> NonEmpty Text
principals :: Prelude.NonEmpty Prelude.Text,
    -- | Home Region of the grant.
    CreateGrant -> Text
homeRegion :: Prelude.Text,
    -- | Allowed operations for the grant.
    CreateGrant -> NonEmpty AllowedOperation
allowedOperations :: Prelude.NonEmpty AllowedOperation
  }
  deriving (CreateGrant -> CreateGrant -> Bool
(CreateGrant -> CreateGrant -> Bool)
-> (CreateGrant -> CreateGrant -> Bool) -> Eq CreateGrant
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateGrant -> CreateGrant -> Bool
$c/= :: CreateGrant -> CreateGrant -> Bool
== :: CreateGrant -> CreateGrant -> Bool
$c== :: CreateGrant -> CreateGrant -> Bool
Prelude.Eq, ReadPrec [CreateGrant]
ReadPrec CreateGrant
Int -> ReadS CreateGrant
ReadS [CreateGrant]
(Int -> ReadS CreateGrant)
-> ReadS [CreateGrant]
-> ReadPrec CreateGrant
-> ReadPrec [CreateGrant]
-> Read CreateGrant
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateGrant]
$creadListPrec :: ReadPrec [CreateGrant]
readPrec :: ReadPrec CreateGrant
$creadPrec :: ReadPrec CreateGrant
readList :: ReadS [CreateGrant]
$creadList :: ReadS [CreateGrant]
readsPrec :: Int -> ReadS CreateGrant
$creadsPrec :: Int -> ReadS CreateGrant
Prelude.Read, Int -> CreateGrant -> ShowS
[CreateGrant] -> ShowS
CreateGrant -> String
(Int -> CreateGrant -> ShowS)
-> (CreateGrant -> String)
-> ([CreateGrant] -> ShowS)
-> Show CreateGrant
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateGrant] -> ShowS
$cshowList :: [CreateGrant] -> ShowS
show :: CreateGrant -> String
$cshow :: CreateGrant -> String
showsPrec :: Int -> CreateGrant -> ShowS
$cshowsPrec :: Int -> CreateGrant -> ShowS
Prelude.Show, (forall x. CreateGrant -> Rep CreateGrant x)
-> (forall x. Rep CreateGrant x -> CreateGrant)
-> Generic CreateGrant
forall x. Rep CreateGrant x -> CreateGrant
forall x. CreateGrant -> Rep CreateGrant x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateGrant x -> CreateGrant
$cfrom :: forall x. CreateGrant -> Rep CreateGrant x
Prelude.Generic)

-- |
-- Create a value of 'CreateGrant' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'clientToken', 'createGrant_clientToken' - Unique, case-sensitive identifier that you provide to ensure the
-- idempotency of the request.
--
-- 'grantName', 'createGrant_grantName' - Grant name.
--
-- 'licenseArn', 'createGrant_licenseArn' - Amazon Resource Name (ARN) of the license.
--
-- 'principals', 'createGrant_principals' - The grant principals.
--
-- 'homeRegion', 'createGrant_homeRegion' - Home Region of the grant.
--
-- 'allowedOperations', 'createGrant_allowedOperations' - Allowed operations for the grant.
newCreateGrant ::
  -- | 'clientToken'
  Prelude.Text ->
  -- | 'grantName'
  Prelude.Text ->
  -- | 'licenseArn'
  Prelude.Text ->
  -- | 'principals'
  Prelude.NonEmpty Prelude.Text ->
  -- | 'homeRegion'
  Prelude.Text ->
  -- | 'allowedOperations'
  Prelude.NonEmpty AllowedOperation ->
  CreateGrant
newCreateGrant :: Text
-> Text
-> Text
-> NonEmpty Text
-> Text
-> NonEmpty AllowedOperation
-> CreateGrant
newCreateGrant
  Text
pClientToken_
  Text
pGrantName_
  Text
pLicenseArn_
  NonEmpty Text
pPrincipals_
  Text
pHomeRegion_
  NonEmpty AllowedOperation
pAllowedOperations_ =
    CreateGrant' :: Text
-> Text
-> Text
-> NonEmpty Text
-> Text
-> NonEmpty AllowedOperation
-> CreateGrant
CreateGrant'
      { $sel:clientToken:CreateGrant' :: Text
clientToken = Text
pClientToken_,
        $sel:grantName:CreateGrant' :: Text
grantName = Text
pGrantName_,
        $sel:licenseArn:CreateGrant' :: Text
licenseArn = Text
pLicenseArn_,
        $sel:principals:CreateGrant' :: NonEmpty Text
principals = 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
pPrincipals_,
        $sel:homeRegion:CreateGrant' :: Text
homeRegion = Text
pHomeRegion_,
        $sel:allowedOperations:CreateGrant' :: NonEmpty AllowedOperation
allowedOperations =
          Tagged
  (NonEmpty AllowedOperation) (Identity (NonEmpty AllowedOperation))
-> Tagged
     (NonEmpty AllowedOperation) (Identity (NonEmpty AllowedOperation))
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced (Tagged
   (NonEmpty AllowedOperation) (Identity (NonEmpty AllowedOperation))
 -> Tagged
      (NonEmpty AllowedOperation) (Identity (NonEmpty AllowedOperation)))
-> NonEmpty AllowedOperation -> NonEmpty AllowedOperation
forall t b. AReview t b -> b -> t
Lens.# NonEmpty AllowedOperation
pAllowedOperations_
      }

-- | Unique, case-sensitive identifier that you provide to ensure the
-- idempotency of the request.
createGrant_clientToken :: Lens.Lens' CreateGrant Prelude.Text
createGrant_clientToken :: (Text -> f Text) -> CreateGrant -> f CreateGrant
createGrant_clientToken = (CreateGrant -> Text)
-> (CreateGrant -> Text -> CreateGrant)
-> Lens CreateGrant CreateGrant Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateGrant' {Text
clientToken :: Text
$sel:clientToken:CreateGrant' :: CreateGrant -> Text
clientToken} -> Text
clientToken) (\s :: CreateGrant
s@CreateGrant' {} Text
a -> CreateGrant
s {$sel:clientToken:CreateGrant' :: Text
clientToken = Text
a} :: CreateGrant)

-- | Grant name.
createGrant_grantName :: Lens.Lens' CreateGrant Prelude.Text
createGrant_grantName :: (Text -> f Text) -> CreateGrant -> f CreateGrant
createGrant_grantName = (CreateGrant -> Text)
-> (CreateGrant -> Text -> CreateGrant)
-> Lens CreateGrant CreateGrant Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateGrant' {Text
grantName :: Text
$sel:grantName:CreateGrant' :: CreateGrant -> Text
grantName} -> Text
grantName) (\s :: CreateGrant
s@CreateGrant' {} Text
a -> CreateGrant
s {$sel:grantName:CreateGrant' :: Text
grantName = Text
a} :: CreateGrant)

-- | Amazon Resource Name (ARN) of the license.
createGrant_licenseArn :: Lens.Lens' CreateGrant Prelude.Text
createGrant_licenseArn :: (Text -> f Text) -> CreateGrant -> f CreateGrant
createGrant_licenseArn = (CreateGrant -> Text)
-> (CreateGrant -> Text -> CreateGrant)
-> Lens CreateGrant CreateGrant Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateGrant' {Text
licenseArn :: Text
$sel:licenseArn:CreateGrant' :: CreateGrant -> Text
licenseArn} -> Text
licenseArn) (\s :: CreateGrant
s@CreateGrant' {} Text
a -> CreateGrant
s {$sel:licenseArn:CreateGrant' :: Text
licenseArn = Text
a} :: CreateGrant)

-- | The grant principals.
createGrant_principals :: Lens.Lens' CreateGrant (Prelude.NonEmpty Prelude.Text)
createGrant_principals :: (NonEmpty Text -> f (NonEmpty Text))
-> CreateGrant -> f CreateGrant
createGrant_principals = (CreateGrant -> NonEmpty Text)
-> (CreateGrant -> NonEmpty Text -> CreateGrant)
-> Lens CreateGrant CreateGrant (NonEmpty Text) (NonEmpty Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateGrant' {NonEmpty Text
principals :: NonEmpty Text
$sel:principals:CreateGrant' :: CreateGrant -> NonEmpty Text
principals} -> NonEmpty Text
principals) (\s :: CreateGrant
s@CreateGrant' {} NonEmpty Text
a -> CreateGrant
s {$sel:principals:CreateGrant' :: NonEmpty Text
principals = NonEmpty Text
a} :: CreateGrant) ((NonEmpty Text -> f (NonEmpty Text))
 -> CreateGrant -> f CreateGrant)
-> ((NonEmpty Text -> f (NonEmpty Text))
    -> NonEmpty Text -> f (NonEmpty Text))
-> (NonEmpty Text -> f (NonEmpty Text))
-> CreateGrant
-> f CreateGrant
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

-- | Home Region of the grant.
createGrant_homeRegion :: Lens.Lens' CreateGrant Prelude.Text
createGrant_homeRegion :: (Text -> f Text) -> CreateGrant -> f CreateGrant
createGrant_homeRegion = (CreateGrant -> Text)
-> (CreateGrant -> Text -> CreateGrant)
-> Lens CreateGrant CreateGrant Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateGrant' {Text
homeRegion :: Text
$sel:homeRegion:CreateGrant' :: CreateGrant -> Text
homeRegion} -> Text
homeRegion) (\s :: CreateGrant
s@CreateGrant' {} Text
a -> CreateGrant
s {$sel:homeRegion:CreateGrant' :: Text
homeRegion = Text
a} :: CreateGrant)

-- | Allowed operations for the grant.
createGrant_allowedOperations :: Lens.Lens' CreateGrant (Prelude.NonEmpty AllowedOperation)
createGrant_allowedOperations :: (NonEmpty AllowedOperation -> f (NonEmpty AllowedOperation))
-> CreateGrant -> f CreateGrant
createGrant_allowedOperations = (CreateGrant -> NonEmpty AllowedOperation)
-> (CreateGrant -> NonEmpty AllowedOperation -> CreateGrant)
-> Lens
     CreateGrant
     CreateGrant
     (NonEmpty AllowedOperation)
     (NonEmpty AllowedOperation)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateGrant' {NonEmpty AllowedOperation
allowedOperations :: NonEmpty AllowedOperation
$sel:allowedOperations:CreateGrant' :: CreateGrant -> NonEmpty AllowedOperation
allowedOperations} -> NonEmpty AllowedOperation
allowedOperations) (\s :: CreateGrant
s@CreateGrant' {} NonEmpty AllowedOperation
a -> CreateGrant
s {$sel:allowedOperations:CreateGrant' :: NonEmpty AllowedOperation
allowedOperations = NonEmpty AllowedOperation
a} :: CreateGrant) ((NonEmpty AllowedOperation -> f (NonEmpty AllowedOperation))
 -> CreateGrant -> f CreateGrant)
-> ((NonEmpty AllowedOperation -> f (NonEmpty AllowedOperation))
    -> NonEmpty AllowedOperation -> f (NonEmpty AllowedOperation))
-> (NonEmpty AllowedOperation -> f (NonEmpty AllowedOperation))
-> CreateGrant
-> f CreateGrant
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (NonEmpty AllowedOperation -> f (NonEmpty AllowedOperation))
-> NonEmpty AllowedOperation -> f (NonEmpty AllowedOperation)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Core.AWSRequest CreateGrant where
  type AWSResponse CreateGrant = CreateGrantResponse
  request :: CreateGrant -> Request CreateGrant
request = Service -> CreateGrant -> Request CreateGrant
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy CreateGrant
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateGrant)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse CreateGrant))
-> Logger
-> Service
-> Proxy CreateGrant
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateGrant)))
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 -> CreateGrantResponse
CreateGrantResponse'
            (Maybe GrantStatus
 -> Maybe Text -> Maybe Text -> Int -> CreateGrantResponse)
-> Either String (Maybe GrantStatus)
-> Either
     String (Maybe Text -> Maybe Text -> Int -> CreateGrantResponse)
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 -> CreateGrantResponse)
-> Either String (Maybe Text)
-> Either String (Maybe Text -> Int -> CreateGrantResponse)
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 -> CreateGrantResponse)
-> Either String (Maybe Text)
-> Either String (Int -> CreateGrantResponse)
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 -> CreateGrantResponse)
-> Either String Int -> Either String CreateGrantResponse
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 CreateGrant

instance Prelude.NFData CreateGrant

instance Core.ToHeaders CreateGrant where
  toHeaders :: CreateGrant -> ResponseHeaders
toHeaders =
    ResponseHeaders -> CreateGrant -> 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.CreateGrant" ::
                          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 CreateGrant where
  toJSON :: CreateGrant -> Value
toJSON CreateGrant' {NonEmpty Text
NonEmpty AllowedOperation
Text
allowedOperations :: NonEmpty AllowedOperation
homeRegion :: Text
principals :: NonEmpty Text
licenseArn :: Text
grantName :: Text
clientToken :: Text
$sel:allowedOperations:CreateGrant' :: CreateGrant -> NonEmpty AllowedOperation
$sel:homeRegion:CreateGrant' :: CreateGrant -> Text
$sel:principals:CreateGrant' :: CreateGrant -> NonEmpty Text
$sel:licenseArn:CreateGrant' :: CreateGrant -> Text
$sel:grantName:CreateGrant' :: CreateGrant -> Text
$sel:clientToken:CreateGrant' :: CreateGrant -> 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
"ClientToken" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
clientToken),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"GrantName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
grantName),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"LicenseArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
licenseArn),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Principals" Text -> NonEmpty Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= NonEmpty Text
principals),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"HomeRegion" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
homeRegion),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"AllowedOperations" Text -> NonEmpty AllowedOperation -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= NonEmpty AllowedOperation
allowedOperations)
          ]
      )

instance Core.ToPath CreateGrant where
  toPath :: CreateGrant -> ByteString
toPath = ByteString -> CreateGrant -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

instance Core.ToQuery CreateGrant where
  toQuery :: CreateGrant -> QueryString
toQuery = QueryString -> CreateGrant -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty

-- | /See:/ 'newCreateGrantResponse' smart constructor.
data CreateGrantResponse = CreateGrantResponse'
  { -- | Grant status.
    CreateGrantResponse -> Maybe GrantStatus
status :: Prelude.Maybe GrantStatus,
    -- | Grant version.
    CreateGrantResponse -> Maybe Text
version :: Prelude.Maybe Prelude.Text,
    -- | Grant ARN.
    CreateGrantResponse -> Maybe Text
grantArn :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    CreateGrantResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (CreateGrantResponse -> CreateGrantResponse -> Bool
(CreateGrantResponse -> CreateGrantResponse -> Bool)
-> (CreateGrantResponse -> CreateGrantResponse -> Bool)
-> Eq CreateGrantResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateGrantResponse -> CreateGrantResponse -> Bool
$c/= :: CreateGrantResponse -> CreateGrantResponse -> Bool
== :: CreateGrantResponse -> CreateGrantResponse -> Bool
$c== :: CreateGrantResponse -> CreateGrantResponse -> Bool
Prelude.Eq, ReadPrec [CreateGrantResponse]
ReadPrec CreateGrantResponse
Int -> ReadS CreateGrantResponse
ReadS [CreateGrantResponse]
(Int -> ReadS CreateGrantResponse)
-> ReadS [CreateGrantResponse]
-> ReadPrec CreateGrantResponse
-> ReadPrec [CreateGrantResponse]
-> Read CreateGrantResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateGrantResponse]
$creadListPrec :: ReadPrec [CreateGrantResponse]
readPrec :: ReadPrec CreateGrantResponse
$creadPrec :: ReadPrec CreateGrantResponse
readList :: ReadS [CreateGrantResponse]
$creadList :: ReadS [CreateGrantResponse]
readsPrec :: Int -> ReadS CreateGrantResponse
$creadsPrec :: Int -> ReadS CreateGrantResponse
Prelude.Read, Int -> CreateGrantResponse -> ShowS
[CreateGrantResponse] -> ShowS
CreateGrantResponse -> String
(Int -> CreateGrantResponse -> ShowS)
-> (CreateGrantResponse -> String)
-> ([CreateGrantResponse] -> ShowS)
-> Show CreateGrantResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateGrantResponse] -> ShowS
$cshowList :: [CreateGrantResponse] -> ShowS
show :: CreateGrantResponse -> String
$cshow :: CreateGrantResponse -> String
showsPrec :: Int -> CreateGrantResponse -> ShowS
$cshowsPrec :: Int -> CreateGrantResponse -> ShowS
Prelude.Show, (forall x. CreateGrantResponse -> Rep CreateGrantResponse x)
-> (forall x. Rep CreateGrantResponse x -> CreateGrantResponse)
-> Generic CreateGrantResponse
forall x. Rep CreateGrantResponse x -> CreateGrantResponse
forall x. CreateGrantResponse -> Rep CreateGrantResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateGrantResponse x -> CreateGrantResponse
$cfrom :: forall x. CreateGrantResponse -> Rep CreateGrantResponse x
Prelude.Generic)

-- |
-- Create a value of 'CreateGrantResponse' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'status', 'createGrantResponse_status' - Grant status.
--
-- 'version', 'createGrantResponse_version' - Grant version.
--
-- 'grantArn', 'createGrantResponse_grantArn' - Grant ARN.
--
-- 'httpStatus', 'createGrantResponse_httpStatus' - The response's http status code.
newCreateGrantResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  CreateGrantResponse
newCreateGrantResponse :: Int -> CreateGrantResponse
newCreateGrantResponse Int
pHttpStatus_ =
  CreateGrantResponse' :: Maybe GrantStatus
-> Maybe Text -> Maybe Text -> Int -> CreateGrantResponse
CreateGrantResponse'
    { $sel:status:CreateGrantResponse' :: Maybe GrantStatus
status = Maybe GrantStatus
forall a. Maybe a
Prelude.Nothing,
      $sel:version:CreateGrantResponse' :: Maybe Text
version = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:grantArn:CreateGrantResponse' :: Maybe Text
grantArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:CreateGrantResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | Grant status.
createGrantResponse_status :: Lens.Lens' CreateGrantResponse (Prelude.Maybe GrantStatus)
createGrantResponse_status :: (Maybe GrantStatus -> f (Maybe GrantStatus))
-> CreateGrantResponse -> f CreateGrantResponse
createGrantResponse_status = (CreateGrantResponse -> Maybe GrantStatus)
-> (CreateGrantResponse
    -> Maybe GrantStatus -> CreateGrantResponse)
-> Lens
     CreateGrantResponse
     CreateGrantResponse
     (Maybe GrantStatus)
     (Maybe GrantStatus)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateGrantResponse' {Maybe GrantStatus
status :: Maybe GrantStatus
$sel:status:CreateGrantResponse' :: CreateGrantResponse -> Maybe GrantStatus
status} -> Maybe GrantStatus
status) (\s :: CreateGrantResponse
s@CreateGrantResponse' {} Maybe GrantStatus
a -> CreateGrantResponse
s {$sel:status:CreateGrantResponse' :: Maybe GrantStatus
status = Maybe GrantStatus
a} :: CreateGrantResponse)

-- | Grant version.
createGrantResponse_version :: Lens.Lens' CreateGrantResponse (Prelude.Maybe Prelude.Text)
createGrantResponse_version :: (Maybe Text -> f (Maybe Text))
-> CreateGrantResponse -> f CreateGrantResponse
createGrantResponse_version = (CreateGrantResponse -> Maybe Text)
-> (CreateGrantResponse -> Maybe Text -> CreateGrantResponse)
-> Lens
     CreateGrantResponse CreateGrantResponse (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateGrantResponse' {Maybe Text
version :: Maybe Text
$sel:version:CreateGrantResponse' :: CreateGrantResponse -> Maybe Text
version} -> Maybe Text
version) (\s :: CreateGrantResponse
s@CreateGrantResponse' {} Maybe Text
a -> CreateGrantResponse
s {$sel:version:CreateGrantResponse' :: Maybe Text
version = Maybe Text
a} :: CreateGrantResponse)

-- | Grant ARN.
createGrantResponse_grantArn :: Lens.Lens' CreateGrantResponse (Prelude.Maybe Prelude.Text)
createGrantResponse_grantArn :: (Maybe Text -> f (Maybe Text))
-> CreateGrantResponse -> f CreateGrantResponse
createGrantResponse_grantArn = (CreateGrantResponse -> Maybe Text)
-> (CreateGrantResponse -> Maybe Text -> CreateGrantResponse)
-> Lens
     CreateGrantResponse CreateGrantResponse (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateGrantResponse' {Maybe Text
grantArn :: Maybe Text
$sel:grantArn:CreateGrantResponse' :: CreateGrantResponse -> Maybe Text
grantArn} -> Maybe Text
grantArn) (\s :: CreateGrantResponse
s@CreateGrantResponse' {} Maybe Text
a -> CreateGrantResponse
s {$sel:grantArn:CreateGrantResponse' :: Maybe Text
grantArn = Maybe Text
a} :: CreateGrantResponse)

-- | The response's http status code.
createGrantResponse_httpStatus :: Lens.Lens' CreateGrantResponse Prelude.Int
createGrantResponse_httpStatus :: (Int -> f Int) -> CreateGrantResponse -> f CreateGrantResponse
createGrantResponse_httpStatus = (CreateGrantResponse -> Int)
-> (CreateGrantResponse -> Int -> CreateGrantResponse)
-> Lens CreateGrantResponse CreateGrantResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateGrantResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateGrantResponse' :: CreateGrantResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateGrantResponse
s@CreateGrantResponse' {} Int
a -> CreateGrantResponse
s {$sel:httpStatus:CreateGrantResponse' :: Int
httpStatus = Int
a} :: CreateGrantResponse)

instance Prelude.NFData CreateGrantResponse