{-# 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-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 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_typeVersionId,
    createResource_roleArn,
    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.Lens as Lens
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,
    -- | 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 Amazon Resource Name (ARN) of the Identity and Access Management
    -- (IAM) 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 @ 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,
    -- | 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.
    --
    -- Specify the desired state as one of the following:
    --
    -- -   A JSON blob
    --
    -- -   A local path containing the desired state in JSON data format
    --
    -- For more information, see
    -- <https://docs.aws.amazon.com/cloudcontrolapi/latest/userguide/resource-operations-create.html#resource-operations-create-desiredstate Composing the desired state of the resource>
    -- in the /Amazon Web Services Cloud Control API User Guide/.
    --
    -- For more information about the properties of a specific resource, refer
    -- to the related topic for the resource in the
    -- <https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-template-resource-type-ref.html Resource and property types reference>
    -- in the /Amazon Web Services CloudFormation Users Guide/.
    CreateResource -> Sensitive Text
desiredState :: Core.Sensitive Prelude.Text
  }
  deriving (CreateResource -> CreateResource -> Bool
(CreateResource -> CreateResource -> Bool)
-> (CreateResource -> CreateResource -> Bool) -> Eq CreateResource
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
(Int -> CreateResource -> ShowS)
-> (CreateResource -> String)
-> ([CreateResource] -> ShowS)
-> Show CreateResource
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. CreateResource -> Rep CreateResource x)
-> (forall x. Rep CreateResource x -> CreateResource)
-> Generic CreateResource
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/.
--
-- '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.
--
-- 'roleArn', 'createResource_roleArn' - The Amazon Resource Name (ARN) of the Identity and Access Management
-- (IAM) 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 @ 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/.
--
-- '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.
--
-- Specify the desired state as one of the following:
--
-- -   A JSON blob
--
-- -   A local path containing the desired state in JSON data format
--
-- For more information, see
-- <https://docs.aws.amazon.com/cloudcontrolapi/latest/userguide/resource-operations-create.html#resource-operations-create-desiredstate Composing the desired state of the resource>
-- in the /Amazon Web Services Cloud Control API User Guide/.
--
-- For more information about the properties of a specific resource, refer
-- to the related topic for the resource in the
-- <https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-template-resource-type-ref.html Resource and property types reference>
-- in the /Amazon Web Services CloudFormation Users Guide/.
newCreateResource ::
  -- | 'typeName'
  Prelude.Text ->
  -- | 'desiredState'
  Prelude.Text ->
  CreateResource
newCreateResource :: Text -> Text -> CreateResource
newCreateResource Text
pTypeName_ Text
pDesiredState_ =
  CreateResource' :: Maybe Text
-> Maybe Text
-> Maybe Text
-> Text
-> Sensitive Text
-> CreateResource
CreateResource'
    { $sel:clientToken:CreateResource' :: Maybe Text
clientToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:typeVersionId:CreateResource' :: Maybe Text
typeVersionId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:roleArn:CreateResource' :: Maybe Text
roleArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:typeName:CreateResource' :: Text
typeName = Text
pTypeName_,
      $sel:desiredState:CreateResource' :: Sensitive Text
desiredState = Tagged Text (Identity Text)
-> Tagged (Sensitive Text) (Identity (Sensitive Text))
forall a. Iso' (Sensitive a) a
Core._Sensitive (Tagged Text (Identity Text)
 -> Tagged (Sensitive Text) (Identity (Sensitive Text)))
-> Text -> Sensitive Text
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 :: (Maybe Text -> f (Maybe Text))
-> CreateResource -> f CreateResource
createResource_clientToken = (CreateResource -> Maybe Text)
-> (CreateResource -> Maybe Text -> CreateResource)
-> Lens CreateResource CreateResource (Maybe Text) (Maybe Text)
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)

-- | 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 :: (Maybe Text -> f (Maybe Text))
-> CreateResource -> f CreateResource
createResource_typeVersionId = (CreateResource -> Maybe Text)
-> (CreateResource -> Maybe Text -> CreateResource)
-> Lens CreateResource CreateResource (Maybe Text) (Maybe Text)
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 Amazon Resource Name (ARN) of the Identity and Access Management
-- (IAM) 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 @ 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 :: (Maybe Text -> f (Maybe Text))
-> CreateResource -> f CreateResource
createResource_roleArn = (CreateResource -> Maybe Text)
-> (CreateResource -> Maybe Text -> CreateResource)
-> Lens CreateResource CreateResource (Maybe Text) (Maybe Text)
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)

-- | The name of the resource type.
createResource_typeName :: Lens.Lens' CreateResource Prelude.Text
createResource_typeName :: (Text -> f Text) -> CreateResource -> f CreateResource
createResource_typeName = (CreateResource -> Text)
-> (CreateResource -> Text -> CreateResource)
-> Lens CreateResource CreateResource Text Text
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.
--
-- Specify the desired state as one of the following:
--
-- -   A JSON blob
--
-- -   A local path containing the desired state in JSON data format
--
-- For more information, see
-- <https://docs.aws.amazon.com/cloudcontrolapi/latest/userguide/resource-operations-create.html#resource-operations-create-desiredstate Composing the desired state of the resource>
-- in the /Amazon Web Services Cloud Control API User Guide/.
--
-- For more information about the properties of a specific resource, refer
-- to the related topic for the resource in the
-- <https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-template-resource-type-ref.html Resource and property types reference>
-- in the /Amazon Web Services CloudFormation Users Guide/.
createResource_desiredState :: Lens.Lens' CreateResource Prelude.Text
createResource_desiredState :: (Text -> f Text) -> CreateResource -> f CreateResource
createResource_desiredState = (CreateResource -> Sensitive Text)
-> (CreateResource -> Sensitive Text -> CreateResource)
-> Lens
     CreateResource CreateResource (Sensitive Text) (Sensitive Text)
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) ((Sensitive Text -> f (Sensitive Text))
 -> CreateResource -> f CreateResource)
-> ((Text -> f Text) -> Sensitive Text -> f (Sensitive Text))
-> (Text -> f Text)
-> CreateResource
-> f CreateResource
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> f Text) -> Sensitive Text -> f (Sensitive Text)
forall a. Iso' (Sensitive a) a
Core._Sensitive

instance Core.AWSRequest CreateResource where
  type
    AWSResponse CreateResource =
      CreateResourceResponse
  request :: CreateResource -> Request CreateResource
request = Service -> CreateResource -> Request CreateResource
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy CreateResource
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateResource)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse CreateResource))
-> Logger
-> Service
-> Proxy CreateResource
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateResource)))
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 ProgressEvent -> Int -> CreateResourceResponse
CreateResourceResponse'
            (Maybe ProgressEvent -> Int -> CreateResourceResponse)
-> Either String (Maybe ProgressEvent)
-> Either String (Int -> CreateResourceResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe ProgressEvent)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"ProgressEvent")
            Either String (Int -> CreateResourceResponse)
-> Either String Int -> Either String CreateResourceResponse
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 CreateResource

instance Prelude.NFData CreateResource

instance Core.ToHeaders CreateResource where
  toHeaders :: CreateResource -> ResponseHeaders
toHeaders =
    ResponseHeaders -> CreateResource -> 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
"CloudApiService.CreateResource" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.0" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Core.ToJSON CreateResource where
  toJSON :: CreateResource -> Value
toJSON CreateResource' {Maybe Text
Text
Sensitive Text
desiredState :: Sensitive Text
typeName :: Text
roleArn :: Maybe Text
typeVersionId :: Maybe Text
clientToken :: Maybe Text
$sel:desiredState:CreateResource' :: CreateResource -> Sensitive Text
$sel:typeName:CreateResource' :: CreateResource -> Text
$sel:roleArn:CreateResource' :: CreateResource -> Maybe Text
$sel:typeVersionId:CreateResource' :: CreateResource -> Maybe Text
$sel:clientToken:CreateResource' :: CreateResource -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"ClientToken" 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
clientToken,
            (Text
"TypeVersionId" 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
typeVersionId,
            (Text
"RoleArn" 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
roleArn,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"TypeName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
typeName),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"DesiredState" Text -> Sensitive Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Sensitive Text
desiredState)
          ]
      )

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

instance Core.ToQuery CreateResource where
  toQuery :: CreateResource -> QueryString
toQuery = QueryString -> CreateResource -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
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
(CreateResourceResponse -> CreateResourceResponse -> Bool)
-> (CreateResourceResponse -> CreateResourceResponse -> Bool)
-> Eq CreateResourceResponse
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
(Int -> CreateResourceResponse -> ShowS)
-> (CreateResourceResponse -> String)
-> ([CreateResourceResponse] -> ShowS)
-> Show CreateResourceResponse
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. CreateResourceResponse -> Rep CreateResourceResponse x)
-> (forall x.
    Rep CreateResourceResponse x -> CreateResourceResponse)
-> Generic CreateResourceResponse
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' :: Maybe ProgressEvent -> Int -> CreateResourceResponse
CreateResourceResponse'
    { $sel:progressEvent:CreateResourceResponse' :: Maybe ProgressEvent
progressEvent =
        Maybe 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 :: (Maybe ProgressEvent -> f (Maybe ProgressEvent))
-> CreateResourceResponse -> f CreateResourceResponse
createResourceResponse_progressEvent = (CreateResourceResponse -> Maybe ProgressEvent)
-> (CreateResourceResponse
    -> Maybe ProgressEvent -> CreateResourceResponse)
-> Lens
     CreateResourceResponse
     CreateResourceResponse
     (Maybe ProgressEvent)
     (Maybe 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 :: (Int -> f Int)
-> CreateResourceResponse -> f CreateResourceResponse
createResourceResponse_httpStatus = (CreateResourceResponse -> Int)
-> (CreateResourceResponse -> Int -> CreateResourceResponse)
-> Lens CreateResourceResponse CreateResourceResponse Int Int
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