{-# 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.CloudFormation.RegisterType
-- 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)
--
-- Registers an extension with the CloudFormation service. Registering an
-- extension makes it available for use in CloudFormation templates in your
-- Amazon Web Services account, and includes:
--
-- -   Validating the extension schema
--
-- -   Determining which handlers, if any, have been specified for the
--     extension
--
-- -   Making the extension available for use in your account
--
-- For more information on how to develop extensions and ready them for
-- registeration, see
-- <https://docs.aws.amazon.com/cloudformation-cli/latest/userguide/resource-types.html Creating Resource Providers>
-- in the /CloudFormation CLI User Guide/.
--
-- You can have a maximum of 50 resource extension versions registered at a
-- time. This maximum is per account and per region. Use
-- <AWSCloudFormation/latest/APIReference/API_DeregisterType.html DeregisterType>
-- to deregister specific extension versions if necessary.
--
-- Once you have initiated a registration request using @ RegisterType @,
-- you can use @ DescribeTypeRegistration @ to monitor the progress of the
-- registration request.
--
-- Once you have registered a private extension in your account and region,
-- use
-- <AWSCloudFormation/latest/APIReference/API_SetTypeConfiguration.html SetTypeConfiguration>
-- to specify configuration properties for the extension. For more
-- information, see
-- <https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/registry-register.html#registry-set-configuration Configuring extensions at the account level>
-- in the /CloudFormation User Guide/.
module Amazonka.CloudFormation.RegisterType
  ( -- * Creating a Request
    RegisterType (..),
    newRegisterType,

    -- * Request Lenses
    registerType_executionRoleArn,
    registerType_type,
    registerType_clientRequestToken,
    registerType_loggingConfig,
    registerType_typeName,
    registerType_schemaHandlerPackage,

    -- * Destructuring the Response
    RegisterTypeResponse (..),
    newRegisterTypeResponse,

    -- * Response Lenses
    registerTypeResponse_registrationToken,
    registerTypeResponse_httpStatus,
  )
where

import Amazonka.CloudFormation.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

-- | /See:/ 'newRegisterType' smart constructor.
data RegisterType = RegisterType'
  { -- | The Amazon Resource Name (ARN) of the IAM role for CloudFormation to
    -- assume when invoking the extension.
    --
    -- For CloudFormation to assume the specified execution role, the role must
    -- contain a trust relationship with the CloudFormation service principle
    -- (@resources.cloudformation.amazonaws.com@). For more information on
    -- adding trust relationships, see
    -- <IAM/latest/UserGuide/roles-managingrole-editing-console.html#roles-managingrole_edit-trust-policy Modifying a role trust policy>
    -- in the /Identity and Access Management User Guide/.
    --
    -- If your extension calls Amazon Web Services APIs in any of its handlers,
    -- you must create an
    -- /<https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles.html IAM execution role>/
    -- that includes the necessary permissions to call those Amazon Web
    -- Services APIs, and provision that execution role in your account. When
    -- CloudFormation needs to invoke the resource type handler, CloudFormation
    -- assumes this execution role to create a temporary session token, which
    -- it then passes to the resource type handler, thereby supplying your
    -- resource type with the appropriate credentials.
    RegisterType -> Maybe Text
executionRoleArn :: Prelude.Maybe Prelude.Text,
    -- | The kind of extension.
    RegisterType -> Maybe RegistryType
type' :: Prelude.Maybe RegistryType,
    -- | A unique identifier that acts as an idempotency key for this
    -- registration request. Specifying a client request token prevents
    -- CloudFormation from generating more than one version of an extension
    -- from the same registeration request, even if the request is submitted
    -- multiple times.
    RegisterType -> Maybe Text
clientRequestToken :: Prelude.Maybe Prelude.Text,
    -- | Specifies logging configuration information for an extension.
    RegisterType -> Maybe LoggingConfig
loggingConfig :: Prelude.Maybe LoggingConfig,
    -- | The name of the extension being registered.
    --
    -- We recommend that extension names adhere to the following patterns:
    --
    -- -   For resource types, /company_or_organization/::/service/::/type/.
    --
    -- -   For modules, /company_or_organization/::/service/::/type/::MODULE.
    --
    -- The following organization namespaces are reserved and cannot be used in
    -- your extension names:
    --
    -- -   @Alexa@
    --
    -- -   @AMZN@
    --
    -- -   @Amazon@
    --
    -- -   @AWS@
    --
    -- -   @Custom@
    --
    -- -   @Dev@
    RegisterType -> Text
typeName :: Prelude.Text,
    -- | A url to the S3 bucket containing the extension project package that
    -- contains the neccessary files for the extension you want to register.
    --
    -- For information on generating a schema handler package for the extension
    -- you want to register, see
    -- <https://docs.aws.amazon.com/cloudformation-cli/latest/userguide/resource-type-cli-submit.html submit>
    -- in the /CloudFormation CLI User Guide/.
    --
    -- The user registering the extension must be able to access the package in
    -- the S3 bucket. That is, the user needs to have
    -- <https://docs.aws.amazon.com/AmazonS3/latest/API/API_GetObject.html GetObject>
    -- permissions for the schema handler package. For more information, see
    -- <https://docs.aws.amazon.com/IAM/latest/UserGuide/list_amazons3.html Actions, Resources, and Condition Keys for Amazon S3>
    -- in the /Identity and Access Management User Guide/.
    RegisterType -> Text
schemaHandlerPackage :: Prelude.Text
  }
  deriving (RegisterType -> RegisterType -> Bool
(RegisterType -> RegisterType -> Bool)
-> (RegisterType -> RegisterType -> Bool) -> Eq RegisterType
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RegisterType -> RegisterType -> Bool
$c/= :: RegisterType -> RegisterType -> Bool
== :: RegisterType -> RegisterType -> Bool
$c== :: RegisterType -> RegisterType -> Bool
Prelude.Eq, ReadPrec [RegisterType]
ReadPrec RegisterType
Int -> ReadS RegisterType
ReadS [RegisterType]
(Int -> ReadS RegisterType)
-> ReadS [RegisterType]
-> ReadPrec RegisterType
-> ReadPrec [RegisterType]
-> Read RegisterType
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RegisterType]
$creadListPrec :: ReadPrec [RegisterType]
readPrec :: ReadPrec RegisterType
$creadPrec :: ReadPrec RegisterType
readList :: ReadS [RegisterType]
$creadList :: ReadS [RegisterType]
readsPrec :: Int -> ReadS RegisterType
$creadsPrec :: Int -> ReadS RegisterType
Prelude.Read, Int -> RegisterType -> ShowS
[RegisterType] -> ShowS
RegisterType -> String
(Int -> RegisterType -> ShowS)
-> (RegisterType -> String)
-> ([RegisterType] -> ShowS)
-> Show RegisterType
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RegisterType] -> ShowS
$cshowList :: [RegisterType] -> ShowS
show :: RegisterType -> String
$cshow :: RegisterType -> String
showsPrec :: Int -> RegisterType -> ShowS
$cshowsPrec :: Int -> RegisterType -> ShowS
Prelude.Show, (forall x. RegisterType -> Rep RegisterType x)
-> (forall x. Rep RegisterType x -> RegisterType)
-> Generic RegisterType
forall x. Rep RegisterType x -> RegisterType
forall x. RegisterType -> Rep RegisterType x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RegisterType x -> RegisterType
$cfrom :: forall x. RegisterType -> Rep RegisterType x
Prelude.Generic)

-- |
-- Create a value of 'RegisterType' 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:
--
-- 'executionRoleArn', 'registerType_executionRoleArn' - The Amazon Resource Name (ARN) of the IAM role for CloudFormation to
-- assume when invoking the extension.
--
-- For CloudFormation to assume the specified execution role, the role must
-- contain a trust relationship with the CloudFormation service principle
-- (@resources.cloudformation.amazonaws.com@). For more information on
-- adding trust relationships, see
-- <IAM/latest/UserGuide/roles-managingrole-editing-console.html#roles-managingrole_edit-trust-policy Modifying a role trust policy>
-- in the /Identity and Access Management User Guide/.
--
-- If your extension calls Amazon Web Services APIs in any of its handlers,
-- you must create an
-- /<https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles.html IAM execution role>/
-- that includes the necessary permissions to call those Amazon Web
-- Services APIs, and provision that execution role in your account. When
-- CloudFormation needs to invoke the resource type handler, CloudFormation
-- assumes this execution role to create a temporary session token, which
-- it then passes to the resource type handler, thereby supplying your
-- resource type with the appropriate credentials.
--
-- 'type'', 'registerType_type' - The kind of extension.
--
-- 'clientRequestToken', 'registerType_clientRequestToken' - A unique identifier that acts as an idempotency key for this
-- registration request. Specifying a client request token prevents
-- CloudFormation from generating more than one version of an extension
-- from the same registeration request, even if the request is submitted
-- multiple times.
--
-- 'loggingConfig', 'registerType_loggingConfig' - Specifies logging configuration information for an extension.
--
-- 'typeName', 'registerType_typeName' - The name of the extension being registered.
--
-- We recommend that extension names adhere to the following patterns:
--
-- -   For resource types, /company_or_organization/::/service/::/type/.
--
-- -   For modules, /company_or_organization/::/service/::/type/::MODULE.
--
-- The following organization namespaces are reserved and cannot be used in
-- your extension names:
--
-- -   @Alexa@
--
-- -   @AMZN@
--
-- -   @Amazon@
--
-- -   @AWS@
--
-- -   @Custom@
--
-- -   @Dev@
--
-- 'schemaHandlerPackage', 'registerType_schemaHandlerPackage' - A url to the S3 bucket containing the extension project package that
-- contains the neccessary files for the extension you want to register.
--
-- For information on generating a schema handler package for the extension
-- you want to register, see
-- <https://docs.aws.amazon.com/cloudformation-cli/latest/userguide/resource-type-cli-submit.html submit>
-- in the /CloudFormation CLI User Guide/.
--
-- The user registering the extension must be able to access the package in
-- the S3 bucket. That is, the user needs to have
-- <https://docs.aws.amazon.com/AmazonS3/latest/API/API_GetObject.html GetObject>
-- permissions for the schema handler package. For more information, see
-- <https://docs.aws.amazon.com/IAM/latest/UserGuide/list_amazons3.html Actions, Resources, and Condition Keys for Amazon S3>
-- in the /Identity and Access Management User Guide/.
newRegisterType ::
  -- | 'typeName'
  Prelude.Text ->
  -- | 'schemaHandlerPackage'
  Prelude.Text ->
  RegisterType
newRegisterType :: Text -> Text -> RegisterType
newRegisterType Text
pTypeName_ Text
pSchemaHandlerPackage_ =
  RegisterType' :: Maybe Text
-> Maybe RegistryType
-> Maybe Text
-> Maybe LoggingConfig
-> Text
-> Text
-> RegisterType
RegisterType'
    { $sel:executionRoleArn:RegisterType' :: Maybe Text
executionRoleArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:type':RegisterType' :: Maybe RegistryType
type' = Maybe RegistryType
forall a. Maybe a
Prelude.Nothing,
      $sel:clientRequestToken:RegisterType' :: Maybe Text
clientRequestToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:loggingConfig:RegisterType' :: Maybe LoggingConfig
loggingConfig = Maybe LoggingConfig
forall a. Maybe a
Prelude.Nothing,
      $sel:typeName:RegisterType' :: Text
typeName = Text
pTypeName_,
      $sel:schemaHandlerPackage:RegisterType' :: Text
schemaHandlerPackage = Text
pSchemaHandlerPackage_
    }

-- | The Amazon Resource Name (ARN) of the IAM role for CloudFormation to
-- assume when invoking the extension.
--
-- For CloudFormation to assume the specified execution role, the role must
-- contain a trust relationship with the CloudFormation service principle
-- (@resources.cloudformation.amazonaws.com@). For more information on
-- adding trust relationships, see
-- <IAM/latest/UserGuide/roles-managingrole-editing-console.html#roles-managingrole_edit-trust-policy Modifying a role trust policy>
-- in the /Identity and Access Management User Guide/.
--
-- If your extension calls Amazon Web Services APIs in any of its handlers,
-- you must create an
-- /<https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles.html IAM execution role>/
-- that includes the necessary permissions to call those Amazon Web
-- Services APIs, and provision that execution role in your account. When
-- CloudFormation needs to invoke the resource type handler, CloudFormation
-- assumes this execution role to create a temporary session token, which
-- it then passes to the resource type handler, thereby supplying your
-- resource type with the appropriate credentials.
registerType_executionRoleArn :: Lens.Lens' RegisterType (Prelude.Maybe Prelude.Text)
registerType_executionRoleArn :: (Maybe Text -> f (Maybe Text)) -> RegisterType -> f RegisterType
registerType_executionRoleArn = (RegisterType -> Maybe Text)
-> (RegisterType -> Maybe Text -> RegisterType)
-> Lens RegisterType RegisterType (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RegisterType' {Maybe Text
executionRoleArn :: Maybe Text
$sel:executionRoleArn:RegisterType' :: RegisterType -> Maybe Text
executionRoleArn} -> Maybe Text
executionRoleArn) (\s :: RegisterType
s@RegisterType' {} Maybe Text
a -> RegisterType
s {$sel:executionRoleArn:RegisterType' :: Maybe Text
executionRoleArn = Maybe Text
a} :: RegisterType)

-- | The kind of extension.
registerType_type :: Lens.Lens' RegisterType (Prelude.Maybe RegistryType)
registerType_type :: (Maybe RegistryType -> f (Maybe RegistryType))
-> RegisterType -> f RegisterType
registerType_type = (RegisterType -> Maybe RegistryType)
-> (RegisterType -> Maybe RegistryType -> RegisterType)
-> Lens
     RegisterType RegisterType (Maybe RegistryType) (Maybe RegistryType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RegisterType' {Maybe RegistryType
type' :: Maybe RegistryType
$sel:type':RegisterType' :: RegisterType -> Maybe RegistryType
type'} -> Maybe RegistryType
type') (\s :: RegisterType
s@RegisterType' {} Maybe RegistryType
a -> RegisterType
s {$sel:type':RegisterType' :: Maybe RegistryType
type' = Maybe RegistryType
a} :: RegisterType)

-- | A unique identifier that acts as an idempotency key for this
-- registration request. Specifying a client request token prevents
-- CloudFormation from generating more than one version of an extension
-- from the same registeration request, even if the request is submitted
-- multiple times.
registerType_clientRequestToken :: Lens.Lens' RegisterType (Prelude.Maybe Prelude.Text)
registerType_clientRequestToken :: (Maybe Text -> f (Maybe Text)) -> RegisterType -> f RegisterType
registerType_clientRequestToken = (RegisterType -> Maybe Text)
-> (RegisterType -> Maybe Text -> RegisterType)
-> Lens RegisterType RegisterType (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RegisterType' {Maybe Text
clientRequestToken :: Maybe Text
$sel:clientRequestToken:RegisterType' :: RegisterType -> Maybe Text
clientRequestToken} -> Maybe Text
clientRequestToken) (\s :: RegisterType
s@RegisterType' {} Maybe Text
a -> RegisterType
s {$sel:clientRequestToken:RegisterType' :: Maybe Text
clientRequestToken = Maybe Text
a} :: RegisterType)

-- | Specifies logging configuration information for an extension.
registerType_loggingConfig :: Lens.Lens' RegisterType (Prelude.Maybe LoggingConfig)
registerType_loggingConfig :: (Maybe LoggingConfig -> f (Maybe LoggingConfig))
-> RegisterType -> f RegisterType
registerType_loggingConfig = (RegisterType -> Maybe LoggingConfig)
-> (RegisterType -> Maybe LoggingConfig -> RegisterType)
-> Lens
     RegisterType
     RegisterType
     (Maybe LoggingConfig)
     (Maybe LoggingConfig)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RegisterType' {Maybe LoggingConfig
loggingConfig :: Maybe LoggingConfig
$sel:loggingConfig:RegisterType' :: RegisterType -> Maybe LoggingConfig
loggingConfig} -> Maybe LoggingConfig
loggingConfig) (\s :: RegisterType
s@RegisterType' {} Maybe LoggingConfig
a -> RegisterType
s {$sel:loggingConfig:RegisterType' :: Maybe LoggingConfig
loggingConfig = Maybe LoggingConfig
a} :: RegisterType)

-- | The name of the extension being registered.
--
-- We recommend that extension names adhere to the following patterns:
--
-- -   For resource types, /company_or_organization/::/service/::/type/.
--
-- -   For modules, /company_or_organization/::/service/::/type/::MODULE.
--
-- The following organization namespaces are reserved and cannot be used in
-- your extension names:
--
-- -   @Alexa@
--
-- -   @AMZN@
--
-- -   @Amazon@
--
-- -   @AWS@
--
-- -   @Custom@
--
-- -   @Dev@
registerType_typeName :: Lens.Lens' RegisterType Prelude.Text
registerType_typeName :: (Text -> f Text) -> RegisterType -> f RegisterType
registerType_typeName = (RegisterType -> Text)
-> (RegisterType -> Text -> RegisterType)
-> Lens RegisterType RegisterType Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RegisterType' {Text
typeName :: Text
$sel:typeName:RegisterType' :: RegisterType -> Text
typeName} -> Text
typeName) (\s :: RegisterType
s@RegisterType' {} Text
a -> RegisterType
s {$sel:typeName:RegisterType' :: Text
typeName = Text
a} :: RegisterType)

-- | A url to the S3 bucket containing the extension project package that
-- contains the neccessary files for the extension you want to register.
--
-- For information on generating a schema handler package for the extension
-- you want to register, see
-- <https://docs.aws.amazon.com/cloudformation-cli/latest/userguide/resource-type-cli-submit.html submit>
-- in the /CloudFormation CLI User Guide/.
--
-- The user registering the extension must be able to access the package in
-- the S3 bucket. That is, the user needs to have
-- <https://docs.aws.amazon.com/AmazonS3/latest/API/API_GetObject.html GetObject>
-- permissions for the schema handler package. For more information, see
-- <https://docs.aws.amazon.com/IAM/latest/UserGuide/list_amazons3.html Actions, Resources, and Condition Keys for Amazon S3>
-- in the /Identity and Access Management User Guide/.
registerType_schemaHandlerPackage :: Lens.Lens' RegisterType Prelude.Text
registerType_schemaHandlerPackage :: (Text -> f Text) -> RegisterType -> f RegisterType
registerType_schemaHandlerPackage = (RegisterType -> Text)
-> (RegisterType -> Text -> RegisterType)
-> Lens RegisterType RegisterType Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RegisterType' {Text
schemaHandlerPackage :: Text
$sel:schemaHandlerPackage:RegisterType' :: RegisterType -> Text
schemaHandlerPackage} -> Text
schemaHandlerPackage) (\s :: RegisterType
s@RegisterType' {} Text
a -> RegisterType
s {$sel:schemaHandlerPackage:RegisterType' :: Text
schemaHandlerPackage = Text
a} :: RegisterType)

instance Core.AWSRequest RegisterType where
  type AWSResponse RegisterType = RegisterTypeResponse
  request :: RegisterType -> Request RegisterType
request = Service -> RegisterType -> Request RegisterType
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery Service
defaultService
  response :: Logger
-> Service
-> Proxy RegisterType
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse RegisterType)))
response =
    Text
-> (Int
    -> ResponseHeaders
    -> [Node]
    -> Either String (AWSResponse RegisterType))
-> Logger
-> Service
-> Proxy RegisterType
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse RegisterType)))
forall (m :: * -> *) a.
MonadResource m =>
Text
-> (Int
    -> ResponseHeaders -> [Node] -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveXMLWrapper
      Text
"RegisterTypeResult"
      ( \Int
s ResponseHeaders
h [Node]
x ->
          Maybe Text -> Int -> RegisterTypeResponse
RegisterTypeResponse'
            (Maybe Text -> Int -> RegisterTypeResponse)
-> Either String (Maybe Text)
-> Either String (Int -> RegisterTypeResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"RegistrationToken")
            Either String (Int -> RegisterTypeResponse)
-> Either String Int -> Either String RegisterTypeResponse
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 RegisterType

instance Prelude.NFData RegisterType

instance Core.ToHeaders RegisterType where
  toHeaders :: RegisterType -> ResponseHeaders
toHeaders = ResponseHeaders -> RegisterType -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty

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

instance Core.ToQuery RegisterType where
  toQuery :: RegisterType -> QueryString
toQuery RegisterType' {Maybe Text
Maybe LoggingConfig
Maybe RegistryType
Text
schemaHandlerPackage :: Text
typeName :: Text
loggingConfig :: Maybe LoggingConfig
clientRequestToken :: Maybe Text
type' :: Maybe RegistryType
executionRoleArn :: Maybe Text
$sel:schemaHandlerPackage:RegisterType' :: RegisterType -> Text
$sel:typeName:RegisterType' :: RegisterType -> Text
$sel:loggingConfig:RegisterType' :: RegisterType -> Maybe LoggingConfig
$sel:clientRequestToken:RegisterType' :: RegisterType -> Maybe Text
$sel:type':RegisterType' :: RegisterType -> Maybe RegistryType
$sel:executionRoleArn:RegisterType' :: RegisterType -> Maybe Text
..} =
    [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"Action"
          ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"RegisterType" :: Prelude.ByteString),
        ByteString
"Version"
          ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"2010-05-15" :: Prelude.ByteString),
        ByteString
"ExecutionRoleArn" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
executionRoleArn,
        ByteString
"Type" ByteString -> Maybe RegistryType -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe RegistryType
type',
        ByteString
"ClientRequestToken" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
clientRequestToken,
        ByteString
"LoggingConfig" ByteString -> Maybe LoggingConfig -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe LoggingConfig
loggingConfig,
        ByteString
"TypeName" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
typeName,
        ByteString
"SchemaHandlerPackage" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
schemaHandlerPackage
      ]

-- | /See:/ 'newRegisterTypeResponse' smart constructor.
data RegisterTypeResponse = RegisterTypeResponse'
  { -- | The identifier for this registration request.
    --
    -- Use this registration token when calling @ DescribeTypeRegistration @,
    -- which returns information about the status and IDs of the extension
    -- registration.
    RegisterTypeResponse -> Maybe Text
registrationToken :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    RegisterTypeResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (RegisterTypeResponse -> RegisterTypeResponse -> Bool
(RegisterTypeResponse -> RegisterTypeResponse -> Bool)
-> (RegisterTypeResponse -> RegisterTypeResponse -> Bool)
-> Eq RegisterTypeResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RegisterTypeResponse -> RegisterTypeResponse -> Bool
$c/= :: RegisterTypeResponse -> RegisterTypeResponse -> Bool
== :: RegisterTypeResponse -> RegisterTypeResponse -> Bool
$c== :: RegisterTypeResponse -> RegisterTypeResponse -> Bool
Prelude.Eq, ReadPrec [RegisterTypeResponse]
ReadPrec RegisterTypeResponse
Int -> ReadS RegisterTypeResponse
ReadS [RegisterTypeResponse]
(Int -> ReadS RegisterTypeResponse)
-> ReadS [RegisterTypeResponse]
-> ReadPrec RegisterTypeResponse
-> ReadPrec [RegisterTypeResponse]
-> Read RegisterTypeResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RegisterTypeResponse]
$creadListPrec :: ReadPrec [RegisterTypeResponse]
readPrec :: ReadPrec RegisterTypeResponse
$creadPrec :: ReadPrec RegisterTypeResponse
readList :: ReadS [RegisterTypeResponse]
$creadList :: ReadS [RegisterTypeResponse]
readsPrec :: Int -> ReadS RegisterTypeResponse
$creadsPrec :: Int -> ReadS RegisterTypeResponse
Prelude.Read, Int -> RegisterTypeResponse -> ShowS
[RegisterTypeResponse] -> ShowS
RegisterTypeResponse -> String
(Int -> RegisterTypeResponse -> ShowS)
-> (RegisterTypeResponse -> String)
-> ([RegisterTypeResponse] -> ShowS)
-> Show RegisterTypeResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RegisterTypeResponse] -> ShowS
$cshowList :: [RegisterTypeResponse] -> ShowS
show :: RegisterTypeResponse -> String
$cshow :: RegisterTypeResponse -> String
showsPrec :: Int -> RegisterTypeResponse -> ShowS
$cshowsPrec :: Int -> RegisterTypeResponse -> ShowS
Prelude.Show, (forall x. RegisterTypeResponse -> Rep RegisterTypeResponse x)
-> (forall x. Rep RegisterTypeResponse x -> RegisterTypeResponse)
-> Generic RegisterTypeResponse
forall x. Rep RegisterTypeResponse x -> RegisterTypeResponse
forall x. RegisterTypeResponse -> Rep RegisterTypeResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RegisterTypeResponse x -> RegisterTypeResponse
$cfrom :: forall x. RegisterTypeResponse -> Rep RegisterTypeResponse x
Prelude.Generic)

-- |
-- Create a value of 'RegisterTypeResponse' 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:
--
-- 'registrationToken', 'registerTypeResponse_registrationToken' - The identifier for this registration request.
--
-- Use this registration token when calling @ DescribeTypeRegistration @,
-- which returns information about the status and IDs of the extension
-- registration.
--
-- 'httpStatus', 'registerTypeResponse_httpStatus' - The response's http status code.
newRegisterTypeResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  RegisterTypeResponse
newRegisterTypeResponse :: Int -> RegisterTypeResponse
newRegisterTypeResponse Int
pHttpStatus_ =
  RegisterTypeResponse' :: Maybe Text -> Int -> RegisterTypeResponse
RegisterTypeResponse'
    { $sel:registrationToken:RegisterTypeResponse' :: Maybe Text
registrationToken =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:RegisterTypeResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The identifier for this registration request.
--
-- Use this registration token when calling @ DescribeTypeRegistration @,
-- which returns information about the status and IDs of the extension
-- registration.
registerTypeResponse_registrationToken :: Lens.Lens' RegisterTypeResponse (Prelude.Maybe Prelude.Text)
registerTypeResponse_registrationToken :: (Maybe Text -> f (Maybe Text))
-> RegisterTypeResponse -> f RegisterTypeResponse
registerTypeResponse_registrationToken = (RegisterTypeResponse -> Maybe Text)
-> (RegisterTypeResponse -> Maybe Text -> RegisterTypeResponse)
-> Lens
     RegisterTypeResponse RegisterTypeResponse (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RegisterTypeResponse' {Maybe Text
registrationToken :: Maybe Text
$sel:registrationToken:RegisterTypeResponse' :: RegisterTypeResponse -> Maybe Text
registrationToken} -> Maybe Text
registrationToken) (\s :: RegisterTypeResponse
s@RegisterTypeResponse' {} Maybe Text
a -> RegisterTypeResponse
s {$sel:registrationToken:RegisterTypeResponse' :: Maybe Text
registrationToken = Maybe Text
a} :: RegisterTypeResponse)

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

instance Prelude.NFData RegisterTypeResponse