{-# 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.CreateGrantVersion
-- 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 new version of the specified grant.
module Amazonka.LicenseManager.CreateGrantVersion
  ( -- * Creating a Request
    CreateGrantVersion (..),
    newCreateGrantVersion,

    -- * Request Lenses
    createGrantVersion_status,
    createGrantVersion_allowedOperations,
    createGrantVersion_grantName,
    createGrantVersion_sourceVersion,
    createGrantVersion_statusReason,
    createGrantVersion_clientToken,
    createGrantVersion_grantArn,

    -- * Destructuring the Response
    CreateGrantVersionResponse (..),
    newCreateGrantVersionResponse,

    -- * Response Lenses
    createGrantVersionResponse_status,
    createGrantVersionResponse_version,
    createGrantVersionResponse_grantArn,
    createGrantVersionResponse_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:/ 'newCreateGrantVersion' smart constructor.
data CreateGrantVersion = CreateGrantVersion'
  { -- | Grant status.
    CreateGrantVersion -> Maybe GrantStatus
status :: Prelude.Maybe GrantStatus,
    -- | Allowed operations for the grant.
    CreateGrantVersion -> Maybe (NonEmpty AllowedOperation)
allowedOperations :: Prelude.Maybe (Prelude.NonEmpty AllowedOperation),
    -- | Grant name.
    CreateGrantVersion -> Maybe Text
grantName :: Prelude.Maybe Prelude.Text,
    -- | Current version of the grant.
    CreateGrantVersion -> Maybe Text
sourceVersion :: Prelude.Maybe Prelude.Text,
    -- | Grant status reason.
    CreateGrantVersion -> Maybe Text
statusReason :: Prelude.Maybe Prelude.Text,
    -- | Unique, case-sensitive identifier that you provide to ensure the
    -- idempotency of the request.
    CreateGrantVersion -> Text
clientToken :: Prelude.Text,
    -- | Amazon Resource Name (ARN) of the grant.
    CreateGrantVersion -> Text
grantArn :: Prelude.Text
  }
  deriving (CreateGrantVersion -> CreateGrantVersion -> Bool
(CreateGrantVersion -> CreateGrantVersion -> Bool)
-> (CreateGrantVersion -> CreateGrantVersion -> Bool)
-> Eq CreateGrantVersion
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateGrantVersion -> CreateGrantVersion -> Bool
$c/= :: CreateGrantVersion -> CreateGrantVersion -> Bool
== :: CreateGrantVersion -> CreateGrantVersion -> Bool
$c== :: CreateGrantVersion -> CreateGrantVersion -> Bool
Prelude.Eq, ReadPrec [CreateGrantVersion]
ReadPrec CreateGrantVersion
Int -> ReadS CreateGrantVersion
ReadS [CreateGrantVersion]
(Int -> ReadS CreateGrantVersion)
-> ReadS [CreateGrantVersion]
-> ReadPrec CreateGrantVersion
-> ReadPrec [CreateGrantVersion]
-> Read CreateGrantVersion
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateGrantVersion]
$creadListPrec :: ReadPrec [CreateGrantVersion]
readPrec :: ReadPrec CreateGrantVersion
$creadPrec :: ReadPrec CreateGrantVersion
readList :: ReadS [CreateGrantVersion]
$creadList :: ReadS [CreateGrantVersion]
readsPrec :: Int -> ReadS CreateGrantVersion
$creadsPrec :: Int -> ReadS CreateGrantVersion
Prelude.Read, Int -> CreateGrantVersion -> ShowS
[CreateGrantVersion] -> ShowS
CreateGrantVersion -> String
(Int -> CreateGrantVersion -> ShowS)
-> (CreateGrantVersion -> String)
-> ([CreateGrantVersion] -> ShowS)
-> Show CreateGrantVersion
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateGrantVersion] -> ShowS
$cshowList :: [CreateGrantVersion] -> ShowS
show :: CreateGrantVersion -> String
$cshow :: CreateGrantVersion -> String
showsPrec :: Int -> CreateGrantVersion -> ShowS
$cshowsPrec :: Int -> CreateGrantVersion -> ShowS
Prelude.Show, (forall x. CreateGrantVersion -> Rep CreateGrantVersion x)
-> (forall x. Rep CreateGrantVersion x -> CreateGrantVersion)
-> Generic CreateGrantVersion
forall x. Rep CreateGrantVersion x -> CreateGrantVersion
forall x. CreateGrantVersion -> Rep CreateGrantVersion x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateGrantVersion x -> CreateGrantVersion
$cfrom :: forall x. CreateGrantVersion -> Rep CreateGrantVersion x
Prelude.Generic)

-- |
-- Create a value of 'CreateGrantVersion' 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', 'createGrantVersion_status' - Grant status.
--
-- 'allowedOperations', 'createGrantVersion_allowedOperations' - Allowed operations for the grant.
--
-- 'grantName', 'createGrantVersion_grantName' - Grant name.
--
-- 'sourceVersion', 'createGrantVersion_sourceVersion' - Current version of the grant.
--
-- 'statusReason', 'createGrantVersion_statusReason' - Grant status reason.
--
-- 'clientToken', 'createGrantVersion_clientToken' - Unique, case-sensitive identifier that you provide to ensure the
-- idempotency of the request.
--
-- 'grantArn', 'createGrantVersion_grantArn' - Amazon Resource Name (ARN) of the grant.
newCreateGrantVersion ::
  -- | 'clientToken'
  Prelude.Text ->
  -- | 'grantArn'
  Prelude.Text ->
  CreateGrantVersion
newCreateGrantVersion :: Text -> Text -> CreateGrantVersion
newCreateGrantVersion Text
pClientToken_ Text
pGrantArn_ =
  CreateGrantVersion' :: Maybe GrantStatus
-> Maybe (NonEmpty AllowedOperation)
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Text
-> Text
-> CreateGrantVersion
CreateGrantVersion'
    { $sel:status:CreateGrantVersion' :: Maybe GrantStatus
status = Maybe GrantStatus
forall a. Maybe a
Prelude.Nothing,
      $sel:allowedOperations:CreateGrantVersion' :: Maybe (NonEmpty AllowedOperation)
allowedOperations = Maybe (NonEmpty AllowedOperation)
forall a. Maybe a
Prelude.Nothing,
      $sel:grantName:CreateGrantVersion' :: Maybe Text
grantName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:sourceVersion:CreateGrantVersion' :: Maybe Text
sourceVersion = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:statusReason:CreateGrantVersion' :: Maybe Text
statusReason = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:clientToken:CreateGrantVersion' :: Text
clientToken = Text
pClientToken_,
      $sel:grantArn:CreateGrantVersion' :: Text
grantArn = Text
pGrantArn_
    }

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

-- | Allowed operations for the grant.
createGrantVersion_allowedOperations :: Lens.Lens' CreateGrantVersion (Prelude.Maybe (Prelude.NonEmpty AllowedOperation))
createGrantVersion_allowedOperations :: (Maybe (NonEmpty AllowedOperation)
 -> f (Maybe (NonEmpty AllowedOperation)))
-> CreateGrantVersion -> f CreateGrantVersion
createGrantVersion_allowedOperations = (CreateGrantVersion -> Maybe (NonEmpty AllowedOperation))
-> (CreateGrantVersion
    -> Maybe (NonEmpty AllowedOperation) -> CreateGrantVersion)
-> Lens
     CreateGrantVersion
     CreateGrantVersion
     (Maybe (NonEmpty AllowedOperation))
     (Maybe (NonEmpty AllowedOperation))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateGrantVersion' {Maybe (NonEmpty AllowedOperation)
allowedOperations :: Maybe (NonEmpty AllowedOperation)
$sel:allowedOperations:CreateGrantVersion' :: CreateGrantVersion -> Maybe (NonEmpty AllowedOperation)
allowedOperations} -> Maybe (NonEmpty AllowedOperation)
allowedOperations) (\s :: CreateGrantVersion
s@CreateGrantVersion' {} Maybe (NonEmpty AllowedOperation)
a -> CreateGrantVersion
s {$sel:allowedOperations:CreateGrantVersion' :: Maybe (NonEmpty AllowedOperation)
allowedOperations = Maybe (NonEmpty AllowedOperation)
a} :: CreateGrantVersion) ((Maybe (NonEmpty AllowedOperation)
  -> f (Maybe (NonEmpty AllowedOperation)))
 -> CreateGrantVersion -> f CreateGrantVersion)
-> ((Maybe (NonEmpty AllowedOperation)
     -> f (Maybe (NonEmpty AllowedOperation)))
    -> Maybe (NonEmpty AllowedOperation)
    -> f (Maybe (NonEmpty AllowedOperation)))
-> (Maybe (NonEmpty AllowedOperation)
    -> f (Maybe (NonEmpty AllowedOperation)))
-> CreateGrantVersion
-> f CreateGrantVersion
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (NonEmpty AllowedOperation)
  (NonEmpty AllowedOperation)
  (NonEmpty AllowedOperation)
  (NonEmpty AllowedOperation)
-> Iso
     (Maybe (NonEmpty AllowedOperation))
     (Maybe (NonEmpty AllowedOperation))
     (Maybe (NonEmpty AllowedOperation))
     (Maybe (NonEmpty AllowedOperation))
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
  (NonEmpty AllowedOperation)
  (NonEmpty AllowedOperation)
  (NonEmpty AllowedOperation)
  (NonEmpty AllowedOperation)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

-- | Current version of the grant.
createGrantVersion_sourceVersion :: Lens.Lens' CreateGrantVersion (Prelude.Maybe Prelude.Text)
createGrantVersion_sourceVersion :: (Maybe Text -> f (Maybe Text))
-> CreateGrantVersion -> f CreateGrantVersion
createGrantVersion_sourceVersion = (CreateGrantVersion -> Maybe Text)
-> (CreateGrantVersion -> Maybe Text -> CreateGrantVersion)
-> Lens
     CreateGrantVersion CreateGrantVersion (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateGrantVersion' {Maybe Text
sourceVersion :: Maybe Text
$sel:sourceVersion:CreateGrantVersion' :: CreateGrantVersion -> Maybe Text
sourceVersion} -> Maybe Text
sourceVersion) (\s :: CreateGrantVersion
s@CreateGrantVersion' {} Maybe Text
a -> CreateGrantVersion
s {$sel:sourceVersion:CreateGrantVersion' :: Maybe Text
sourceVersion = Maybe Text
a} :: CreateGrantVersion)

-- | Grant status reason.
createGrantVersion_statusReason :: Lens.Lens' CreateGrantVersion (Prelude.Maybe Prelude.Text)
createGrantVersion_statusReason :: (Maybe Text -> f (Maybe Text))
-> CreateGrantVersion -> f CreateGrantVersion
createGrantVersion_statusReason = (CreateGrantVersion -> Maybe Text)
-> (CreateGrantVersion -> Maybe Text -> CreateGrantVersion)
-> Lens
     CreateGrantVersion CreateGrantVersion (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateGrantVersion' {Maybe Text
statusReason :: Maybe Text
$sel:statusReason:CreateGrantVersion' :: CreateGrantVersion -> Maybe Text
statusReason} -> Maybe Text
statusReason) (\s :: CreateGrantVersion
s@CreateGrantVersion' {} Maybe Text
a -> CreateGrantVersion
s {$sel:statusReason:CreateGrantVersion' :: Maybe Text
statusReason = Maybe Text
a} :: CreateGrantVersion)

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

-- | Amazon Resource Name (ARN) of the grant.
createGrantVersion_grantArn :: Lens.Lens' CreateGrantVersion Prelude.Text
createGrantVersion_grantArn :: (Text -> f Text) -> CreateGrantVersion -> f CreateGrantVersion
createGrantVersion_grantArn = (CreateGrantVersion -> Text)
-> (CreateGrantVersion -> Text -> CreateGrantVersion)
-> Lens CreateGrantVersion CreateGrantVersion Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateGrantVersion' {Text
grantArn :: Text
$sel:grantArn:CreateGrantVersion' :: CreateGrantVersion -> Text
grantArn} -> Text
grantArn) (\s :: CreateGrantVersion
s@CreateGrantVersion' {} Text
a -> CreateGrantVersion
s {$sel:grantArn:CreateGrantVersion' :: Text
grantArn = Text
a} :: CreateGrantVersion)

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

instance Prelude.NFData CreateGrantVersion

instance Core.ToHeaders CreateGrantVersion where
  toHeaders :: CreateGrantVersion -> ResponseHeaders
toHeaders =
    ResponseHeaders -> CreateGrantVersion -> 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.CreateGrantVersion" ::
                          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 CreateGrantVersion where
  toJSON :: CreateGrantVersion -> Value
toJSON CreateGrantVersion' {Maybe (NonEmpty AllowedOperation)
Maybe Text
Maybe GrantStatus
Text
grantArn :: Text
clientToken :: Text
statusReason :: Maybe Text
sourceVersion :: Maybe Text
grantName :: Maybe Text
allowedOperations :: Maybe (NonEmpty AllowedOperation)
status :: Maybe GrantStatus
$sel:grantArn:CreateGrantVersion' :: CreateGrantVersion -> Text
$sel:clientToken:CreateGrantVersion' :: CreateGrantVersion -> Text
$sel:statusReason:CreateGrantVersion' :: CreateGrantVersion -> Maybe Text
$sel:sourceVersion:CreateGrantVersion' :: CreateGrantVersion -> Maybe Text
$sel:grantName:CreateGrantVersion' :: CreateGrantVersion -> Maybe Text
$sel:allowedOperations:CreateGrantVersion' :: CreateGrantVersion -> Maybe (NonEmpty AllowedOperation)
$sel:status:CreateGrantVersion' :: CreateGrantVersion -> Maybe GrantStatus
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"Status" Text -> GrantStatus -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (GrantStatus -> Pair) -> Maybe GrantStatus -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe GrantStatus
status,
            (Text
"AllowedOperations" Text -> NonEmpty AllowedOperation -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (NonEmpty AllowedOperation -> Pair)
-> Maybe (NonEmpty AllowedOperation) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (NonEmpty AllowedOperation)
allowedOperations,
            (Text
"GrantName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
grantName,
            (Text
"SourceVersion" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
sourceVersion,
            (Text
"StatusReason" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
statusReason,
            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
"GrantArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
grantArn)
          ]
      )

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

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

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

-- |
-- Create a value of 'CreateGrantVersionResponse' 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', 'createGrantVersionResponse_status' - Grant status.
--
-- 'version', 'createGrantVersionResponse_version' - New version of the grant.
--
-- 'grantArn', 'createGrantVersionResponse_grantArn' - Grant ARN.
--
-- 'httpStatus', 'createGrantVersionResponse_httpStatus' - The response's http status code.
newCreateGrantVersionResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  CreateGrantVersionResponse
newCreateGrantVersionResponse :: Int -> CreateGrantVersionResponse
newCreateGrantVersionResponse Int
pHttpStatus_ =
  CreateGrantVersionResponse' :: Maybe GrantStatus
-> Maybe Text -> Maybe Text -> Int -> CreateGrantVersionResponse
CreateGrantVersionResponse'
    { $sel:status:CreateGrantVersionResponse' :: Maybe GrantStatus
status =
        Maybe GrantStatus
forall a. Maybe a
Prelude.Nothing,
      $sel:version:CreateGrantVersionResponse' :: Maybe Text
version = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:grantArn:CreateGrantVersionResponse' :: Maybe Text
grantArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:CreateGrantVersionResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

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

-- | New version of the grant.
createGrantVersionResponse_version :: Lens.Lens' CreateGrantVersionResponse (Prelude.Maybe Prelude.Text)
createGrantVersionResponse_version :: (Maybe Text -> f (Maybe Text))
-> CreateGrantVersionResponse -> f CreateGrantVersionResponse
createGrantVersionResponse_version = (CreateGrantVersionResponse -> Maybe Text)
-> (CreateGrantVersionResponse
    -> Maybe Text -> CreateGrantVersionResponse)
-> Lens
     CreateGrantVersionResponse
     CreateGrantVersionResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateGrantVersionResponse' {Maybe Text
version :: Maybe Text
$sel:version:CreateGrantVersionResponse' :: CreateGrantVersionResponse -> Maybe Text
version} -> Maybe Text
version) (\s :: CreateGrantVersionResponse
s@CreateGrantVersionResponse' {} Maybe Text
a -> CreateGrantVersionResponse
s {$sel:version:CreateGrantVersionResponse' :: Maybe Text
version = Maybe Text
a} :: CreateGrantVersionResponse)

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

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

instance Prelude.NFData CreateGrantVersionResponse