{-# 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.CloudControl.CreateResource
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Creates the specified resource. For more information, see
-- <https://docs.aws.amazon.com/cloudcontrolapi/latest/userguide/resource-operations-create.html Creating a resource>
-- in the /Amazon Web Services Cloud Control API User Guide/.
--
-- After you have initiated a resource creation request, you can monitor
-- the progress of your request by calling
-- <https://docs.aws.amazon.com/cloudcontrolapi/latest/APIReference/API_GetResourceRequestStatus.html GetResourceRequestStatus>
-- using the @RequestToken@ of the @ProgressEvent@ type returned by
-- @CreateResource@.
module Amazonka.CloudControl.CreateResource
  ( -- * Creating a Request
    CreateResource (..),
    newCreateResource,

    -- * Request Lenses
    createResource_clientToken,
    createResource_roleArn,
    createResource_typeVersionId,
    createResource_typeName,
    createResource_desiredState,

    -- * Destructuring the Response
    CreateResourceResponse (..),
    newCreateResourceResponse,

    -- * Response Lenses
    createResourceResponse_progressEvent,
    createResourceResponse_httpStatus,
  )
where

import Amazonka.CloudControl.Types
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newCreateResource' smart constructor.
data CreateResource = CreateResource'
  { -- | A unique identifier to ensure the idempotency of the resource request.
    -- As a best practice, specify this token to ensure idempotency, so that
    -- Amazon Web Services Cloud Control API can accurately distinguish between
    -- request retries and new resource requests. You might retry a resource
    -- request to ensure that it was successfully received.
    --
    -- A client token is valid for 36 hours once used. After that, a resource
    -- request with the same client token is treated as a new request.
    --
    -- If you do not specify a client token, one is generated for inclusion in
    -- the request.
    --
    -- For more information, see
    -- <https://docs.aws.amazon.com/cloudcontrolapi/latest/userguide/resource-operations.html#resource-operations-idempotency Ensuring resource operation requests are unique>
    -- in the /Amazon Web Services Cloud Control API User Guide/.
    CreateResource -> Maybe Text
clientToken :: Prelude.Maybe Prelude.Text,
    -- | The Amazon Resource Name (ARN) of the Identity and Access Management
    -- (IAM) role for Cloud Control API to use when performing this resource
    -- operation. The role specified must have the permissions required for
    -- this operation. The necessary permissions for each event handler are
    -- defined in the
    -- @ @<https://docs.aws.amazon.com/cloudformation-cli/latest/userguide/resource-type-schema.html#schema-properties-handlers handlers>@ @
    -- section of the
    -- <https://docs.aws.amazon.com/cloudformation-cli/latest/userguide/resource-type-schema.html resource type definition schema>.
    --
    -- If you do not specify a role, Cloud Control API uses a temporary session
    -- created using your Amazon Web Services user credentials.
    --
    -- For more information, see
    -- <https://docs.aws.amazon.com/cloudcontrolapi/latest/userguide/resource-operations.html#resource-operations-permissions Specifying credentials>
    -- in the /Amazon Web Services Cloud Control API User Guide/.
    CreateResource -> Maybe Text
roleArn :: Prelude.Maybe Prelude.Text,
    -- | For private resource types, the type version to use in this resource
    -- operation. If you do not specify a resource version, CloudFormation uses
    -- the default version.
    CreateResource -> Maybe Text
typeVersionId :: Prelude.Maybe Prelude.Text,
    -- | The name of the resource type.
    CreateResource -> Text
typeName :: Prelude.Text,
    -- | Structured data format representing the desired state of the resource,
    -- consisting of that resource\'s properties and their desired values.
    --
    -- Cloud Control API currently supports JSON as a structured data format.
    --
    -- >  <p>Specify the desired state as one of the following:</p> <ul> <li> <p>A JSON blob</p> </li> <li> <p>A local path containing the desired state in JSON data format</p> </li> </ul> <p>For more information, see <a href="https://docs.aws.amazon.com/cloudcontrolapi/latest/userguide/resource-operations-create.html#resource-operations-create-desiredstate">Composing the desired state of the resource</a> in the <i>Amazon Web Services Cloud Control API User Guide</i>.</p> <p>For more information about the properties of a specific resource, refer to the related topic for the resource in the <a href="https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-template-resource-type-ref.html">Resource and property types reference</a> in the <i>CloudFormation Users Guide</i>.</p>
    CreateResource -> Sensitive Text
desiredState :: Data.Sensitive Prelude.Text
  }
  deriving (CreateResource -> CreateResource -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateResource -> CreateResource -> Bool
$c/= :: CreateResource -> CreateResource -> Bool
== :: CreateResource -> CreateResource -> Bool
$c== :: CreateResource -> CreateResource -> Bool
Prelude.Eq, Int -> CreateResource -> ShowS
[CreateResource] -> ShowS
CreateResource -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateResource] -> ShowS
$cshowList :: [CreateResource] -> ShowS
show :: CreateResource -> String
$cshow :: CreateResource -> String
showsPrec :: Int -> CreateResource -> ShowS
$cshowsPrec :: Int -> CreateResource -> ShowS
Prelude.Show, forall x. Rep CreateResource x -> CreateResource
forall x. CreateResource -> Rep CreateResource x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateResource x -> CreateResource
$cfrom :: forall x. CreateResource -> Rep CreateResource x
Prelude.Generic)

-- |
-- Create a value of 'CreateResource' 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', 'createResource_clientToken' - A unique identifier to ensure the idempotency of the resource request.
-- As a best practice, specify this token to ensure idempotency, so that
-- Amazon Web Services Cloud Control API can accurately distinguish between
-- request retries and new resource requests. You might retry a resource
-- request to ensure that it was successfully received.
--
-- A client token is valid for 36 hours once used. After that, a resource
-- request with the same client token is treated as a new request.
--
-- If you do not specify a client token, one is generated for inclusion in
-- the request.
--
-- For more information, see
-- <https://docs.aws.amazon.com/cloudcontrolapi/latest/userguide/resource-operations.html#resource-operations-idempotency Ensuring resource operation requests are unique>
-- in the /Amazon Web Services Cloud Control API User Guide/.
--
-- 'roleArn', 'createResource_roleArn' - The Amazon Resource Name (ARN) of the Identity and Access Management
-- (IAM) role for Cloud Control API to use when performing this resource
-- operation. The role specified must have the permissions required for
-- this operation. The necessary permissions for each event handler are
-- defined in the
-- @ @<https://docs.aws.amazon.com/cloudformation-cli/latest/userguide/resource-type-schema.html#schema-properties-handlers handlers>@ @
-- section of the
-- <https://docs.aws.amazon.com/cloudformation-cli/latest/userguide/resource-type-schema.html resource type definition schema>.
--
-- If you do not specify a role, Cloud Control API uses a temporary session
-- created using your Amazon Web Services user credentials.
--
-- For more information, see
-- <https://docs.aws.amazon.com/cloudcontrolapi/latest/userguide/resource-operations.html#resource-operations-permissions Specifying credentials>
-- in the /Amazon Web Services Cloud Control API User Guide/.
--
-- 'typeVersionId', 'createResource_typeVersionId' - For private resource types, the type version to use in this resource
-- operation. If you do not specify a resource version, CloudFormation uses
-- the default version.
--
-- 'typeName', 'createResource_typeName' - The name of the resource type.
--
-- 'desiredState', 'createResource_desiredState' - Structured data format representing the desired state of the resource,
-- consisting of that resource\'s properties and their desired values.
--
-- Cloud Control API currently supports JSON as a structured data format.
--
-- >  <p>Specify the desired state as one of the following:</p> <ul> <li> <p>A JSON blob</p> </li> <li> <p>A local path containing the desired state in JSON data format</p> </li> </ul> <p>For more information, see <a href="https://docs.aws.amazon.com/cloudcontrolapi/latest/userguide/resource-operations-create.html#resource-operations-create-desiredstate">Composing the desired state of the resource</a> in the <i>Amazon Web Services Cloud Control API User Guide</i>.</p> <p>For more information about the properties of a specific resource, refer to the related topic for the resource in the <a href="https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-template-resource-type-ref.html">Resource and property types reference</a> in the <i>CloudFormation Users Guide</i>.</p>
newCreateResource ::
  -- | 'typeName'
  Prelude.Text ->
  -- | 'desiredState'
  Prelude.Text ->
  CreateResource
newCreateResource :: Text -> Text -> CreateResource
newCreateResource Text
pTypeName_ Text
pDesiredState_ =
  CreateResource'
    { $sel:clientToken:CreateResource' :: Maybe Text
clientToken = forall a. Maybe a
Prelude.Nothing,
      $sel:roleArn:CreateResource' :: Maybe Text
roleArn = forall a. Maybe a
Prelude.Nothing,
      $sel:typeVersionId:CreateResource' :: Maybe Text
typeVersionId = forall a. Maybe a
Prelude.Nothing,
      $sel:typeName:CreateResource' :: Text
typeName = Text
pTypeName_,
      $sel:desiredState:CreateResource' :: Sensitive Text
desiredState = forall a. Iso' (Sensitive a) a
Data._Sensitive forall t b. AReview t b -> b -> t
Lens.# Text
pDesiredState_
    }

-- | A unique identifier to ensure the idempotency of the resource request.
-- As a best practice, specify this token to ensure idempotency, so that
-- Amazon Web Services Cloud Control API can accurately distinguish between
-- request retries and new resource requests. You might retry a resource
-- request to ensure that it was successfully received.
--
-- A client token is valid for 36 hours once used. After that, a resource
-- request with the same client token is treated as a new request.
--
-- If you do not specify a client token, one is generated for inclusion in
-- the request.
--
-- For more information, see
-- <https://docs.aws.amazon.com/cloudcontrolapi/latest/userguide/resource-operations.html#resource-operations-idempotency Ensuring resource operation requests are unique>
-- in the /Amazon Web Services Cloud Control API User Guide/.
createResource_clientToken :: Lens.Lens' CreateResource (Prelude.Maybe Prelude.Text)
createResource_clientToken :: Lens' CreateResource (Maybe Text)
createResource_clientToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateResource' {Maybe Text
clientToken :: Maybe Text
$sel:clientToken:CreateResource' :: CreateResource -> Maybe Text
clientToken} -> Maybe Text
clientToken) (\s :: CreateResource
s@CreateResource' {} Maybe Text
a -> CreateResource
s {$sel:clientToken:CreateResource' :: Maybe Text
clientToken = Maybe Text
a} :: CreateResource)

-- | The Amazon Resource Name (ARN) of the Identity and Access Management
-- (IAM) role for Cloud Control API to use when performing this resource
-- operation. The role specified must have the permissions required for
-- this operation. The necessary permissions for each event handler are
-- defined in the
-- @ @<https://docs.aws.amazon.com/cloudformation-cli/latest/userguide/resource-type-schema.html#schema-properties-handlers handlers>@ @
-- section of the
-- <https://docs.aws.amazon.com/cloudformation-cli/latest/userguide/resource-type-schema.html resource type definition schema>.
--
-- If you do not specify a role, Cloud Control API uses a temporary session
-- created using your Amazon Web Services user credentials.
--
-- For more information, see
-- <https://docs.aws.amazon.com/cloudcontrolapi/latest/userguide/resource-operations.html#resource-operations-permissions Specifying credentials>
-- in the /Amazon Web Services Cloud Control API User Guide/.
createResource_roleArn :: Lens.Lens' CreateResource (Prelude.Maybe Prelude.Text)
createResource_roleArn :: Lens' CreateResource (Maybe Text)
createResource_roleArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateResource' {Maybe Text
roleArn :: Maybe Text
$sel:roleArn:CreateResource' :: CreateResource -> Maybe Text
roleArn} -> Maybe Text
roleArn) (\s :: CreateResource
s@CreateResource' {} Maybe Text
a -> CreateResource
s {$sel:roleArn:CreateResource' :: Maybe Text
roleArn = Maybe Text
a} :: CreateResource)

-- | For private resource types, the type version to use in this resource
-- operation. If you do not specify a resource version, CloudFormation uses
-- the default version.
createResource_typeVersionId :: Lens.Lens' CreateResource (Prelude.Maybe Prelude.Text)
createResource_typeVersionId :: Lens' CreateResource (Maybe Text)
createResource_typeVersionId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateResource' {Maybe Text
typeVersionId :: Maybe Text
$sel:typeVersionId:CreateResource' :: CreateResource -> Maybe Text
typeVersionId} -> Maybe Text
typeVersionId) (\s :: CreateResource
s@CreateResource' {} Maybe Text
a -> CreateResource
s {$sel:typeVersionId:CreateResource' :: Maybe Text
typeVersionId = Maybe Text
a} :: CreateResource)

-- | The name of the resource type.
createResource_typeName :: Lens.Lens' CreateResource Prelude.Text
createResource_typeName :: Lens' CreateResource Text
createResource_typeName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateResource' {Text
typeName :: Text
$sel:typeName:CreateResource' :: CreateResource -> Text
typeName} -> Text
typeName) (\s :: CreateResource
s@CreateResource' {} Text
a -> CreateResource
s {$sel:typeName:CreateResource' :: Text
typeName = Text
a} :: CreateResource)

-- | Structured data format representing the desired state of the resource,
-- consisting of that resource\'s properties and their desired values.
--
-- Cloud Control API currently supports JSON as a structured data format.
--
-- >  <p>Specify the desired state as one of the following:</p> <ul> <li> <p>A JSON blob</p> </li> <li> <p>A local path containing the desired state in JSON data format</p> </li> </ul> <p>For more information, see <a href="https://docs.aws.amazon.com/cloudcontrolapi/latest/userguide/resource-operations-create.html#resource-operations-create-desiredstate">Composing the desired state of the resource</a> in the <i>Amazon Web Services Cloud Control API User Guide</i>.</p> <p>For more information about the properties of a specific resource, refer to the related topic for the resource in the <a href="https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-template-resource-type-ref.html">Resource and property types reference</a> in the <i>CloudFormation Users Guide</i>.</p>
createResource_desiredState :: Lens.Lens' CreateResource Prelude.Text
createResource_desiredState :: Lens' CreateResource Text
createResource_desiredState = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateResource' {Sensitive Text
desiredState :: Sensitive Text
$sel:desiredState:CreateResource' :: CreateResource -> Sensitive Text
desiredState} -> Sensitive Text
desiredState) (\s :: CreateResource
s@CreateResource' {} Sensitive Text
a -> CreateResource
s {$sel:desiredState:CreateResource' :: Sensitive Text
desiredState = Sensitive Text
a} :: CreateResource) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a. Iso' (Sensitive a) a
Data._Sensitive

instance Core.AWSRequest CreateResource where
  type
    AWSResponse CreateResource =
      CreateResourceResponse
  request :: (Service -> Service) -> CreateResource -> Request CreateResource
request Service -> Service
overrides =
    forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy CreateResource
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateResource)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe ProgressEvent -> Int -> CreateResourceResponse
CreateResourceResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"ProgressEvent")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable CreateResource where
  hashWithSalt :: Int -> CreateResource -> Int
hashWithSalt Int
_salt CreateResource' {Maybe Text
Text
Sensitive Text
desiredState :: Sensitive Text
typeName :: Text
typeVersionId :: Maybe Text
roleArn :: Maybe Text
clientToken :: Maybe Text
$sel:desiredState:CreateResource' :: CreateResource -> Sensitive Text
$sel:typeName:CreateResource' :: CreateResource -> Text
$sel:typeVersionId:CreateResource' :: CreateResource -> Maybe Text
$sel:roleArn:CreateResource' :: CreateResource -> Maybe Text
$sel:clientToken:CreateResource' :: CreateResource -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
clientToken
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
roleArn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
typeVersionId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
typeName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Sensitive Text
desiredState

instance Prelude.NFData CreateResource where
  rnf :: CreateResource -> ()
rnf CreateResource' {Maybe Text
Text
Sensitive Text
desiredState :: Sensitive Text
typeName :: Text
typeVersionId :: Maybe Text
roleArn :: Maybe Text
clientToken :: Maybe Text
$sel:desiredState:CreateResource' :: CreateResource -> Sensitive Text
$sel:typeName:CreateResource' :: CreateResource -> Text
$sel:typeVersionId:CreateResource' :: CreateResource -> Maybe Text
$sel:roleArn:CreateResource' :: CreateResource -> Maybe Text
$sel:clientToken:CreateResource' :: CreateResource -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
clientToken
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
roleArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
typeVersionId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
typeName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Sensitive Text
desiredState

instance Data.ToHeaders CreateResource where
  toHeaders :: CreateResource -> ResponseHeaders
toHeaders =
    forall a b. a -> b -> a
Prelude.const
      ( forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"CloudApiService.CreateResource" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.0" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Data.ToJSON CreateResource where
  toJSON :: CreateResource -> Value
toJSON CreateResource' {Maybe Text
Text
Sensitive Text
desiredState :: Sensitive Text
typeName :: Text
typeVersionId :: Maybe Text
roleArn :: Maybe Text
clientToken :: Maybe Text
$sel:desiredState:CreateResource' :: CreateResource -> Sensitive Text
$sel:typeName:CreateResource' :: CreateResource -> Text
$sel:typeVersionId:CreateResource' :: CreateResource -> Maybe Text
$sel:roleArn:CreateResource' :: CreateResource -> Maybe Text
$sel:clientToken:CreateResource' :: CreateResource -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"ClientToken" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
clientToken,
            (Key
"RoleArn" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
roleArn,
            (Key
"TypeVersionId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
typeVersionId,
            forall a. a -> Maybe a
Prelude.Just (Key
"TypeName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
typeName),
            forall a. a -> Maybe a
Prelude.Just (Key
"DesiredState" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Sensitive Text
desiredState)
          ]
      )

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

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

-- | /See:/ 'newCreateResourceResponse' smart constructor.
data CreateResourceResponse = CreateResourceResponse'
  { -- | Represents the current status of the resource creation request.
    --
    -- After you have initiated a resource creation request, you can monitor
    -- the progress of your request by calling
    -- <https://docs.aws.amazon.com/cloudcontrolapi/latest/APIReference/API_GetResourceRequestStatus.html GetResourceRequestStatus>
    -- using the @RequestToken@ of the @ProgressEvent@ returned by
    -- @CreateResource@.
    CreateResourceResponse -> Maybe ProgressEvent
progressEvent :: Prelude.Maybe ProgressEvent,
    -- | The response's http status code.
    CreateResourceResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (CreateResourceResponse -> CreateResourceResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateResourceResponse -> CreateResourceResponse -> Bool
$c/= :: CreateResourceResponse -> CreateResourceResponse -> Bool
== :: CreateResourceResponse -> CreateResourceResponse -> Bool
$c== :: CreateResourceResponse -> CreateResourceResponse -> Bool
Prelude.Eq, Int -> CreateResourceResponse -> ShowS
[CreateResourceResponse] -> ShowS
CreateResourceResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateResourceResponse] -> ShowS
$cshowList :: [CreateResourceResponse] -> ShowS
show :: CreateResourceResponse -> String
$cshow :: CreateResourceResponse -> String
showsPrec :: Int -> CreateResourceResponse -> ShowS
$cshowsPrec :: Int -> CreateResourceResponse -> ShowS
Prelude.Show, forall x. Rep CreateResourceResponse x -> CreateResourceResponse
forall x. CreateResourceResponse -> Rep CreateResourceResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateResourceResponse x -> CreateResourceResponse
$cfrom :: forall x. CreateResourceResponse -> Rep CreateResourceResponse x
Prelude.Generic)

-- |
-- Create a value of 'CreateResourceResponse' 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:
--
-- 'progressEvent', 'createResourceResponse_progressEvent' - Represents the current status of the resource creation request.
--
-- After you have initiated a resource creation request, you can monitor
-- the progress of your request by calling
-- <https://docs.aws.amazon.com/cloudcontrolapi/latest/APIReference/API_GetResourceRequestStatus.html GetResourceRequestStatus>
-- using the @RequestToken@ of the @ProgressEvent@ returned by
-- @CreateResource@.
--
-- 'httpStatus', 'createResourceResponse_httpStatus' - The response's http status code.
newCreateResourceResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  CreateResourceResponse
newCreateResourceResponse :: Int -> CreateResourceResponse
newCreateResourceResponse Int
pHttpStatus_ =
  CreateResourceResponse'
    { $sel:progressEvent:CreateResourceResponse' :: Maybe ProgressEvent
progressEvent =
        forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:CreateResourceResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | Represents the current status of the resource creation request.
--
-- After you have initiated a resource creation request, you can monitor
-- the progress of your request by calling
-- <https://docs.aws.amazon.com/cloudcontrolapi/latest/APIReference/API_GetResourceRequestStatus.html GetResourceRequestStatus>
-- using the @RequestToken@ of the @ProgressEvent@ returned by
-- @CreateResource@.
createResourceResponse_progressEvent :: Lens.Lens' CreateResourceResponse (Prelude.Maybe ProgressEvent)
createResourceResponse_progressEvent :: Lens' CreateResourceResponse (Maybe ProgressEvent)
createResourceResponse_progressEvent = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateResourceResponse' {Maybe ProgressEvent
progressEvent :: Maybe ProgressEvent
$sel:progressEvent:CreateResourceResponse' :: CreateResourceResponse -> Maybe ProgressEvent
progressEvent} -> Maybe ProgressEvent
progressEvent) (\s :: CreateResourceResponse
s@CreateResourceResponse' {} Maybe ProgressEvent
a -> CreateResourceResponse
s {$sel:progressEvent:CreateResourceResponse' :: Maybe ProgressEvent
progressEvent = Maybe ProgressEvent
a} :: CreateResourceResponse)

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

instance Prelude.NFData CreateResourceResponse where
  rnf :: CreateResourceResponse -> ()
rnf CreateResourceResponse' {Int
Maybe ProgressEvent
httpStatus :: Int
progressEvent :: Maybe ProgressEvent
$sel:httpStatus:CreateResourceResponse' :: CreateResourceResponse -> Int
$sel:progressEvent:CreateResourceResponse' :: CreateResourceResponse -> Maybe ProgressEvent
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe ProgressEvent
progressEvent
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus