{-# 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.AmplifyBackend.CreateBackend
-- 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)
--
-- This operation creates a backend for an Amplify app. Backends are
-- automatically created at the time of app creation.
module Amazonka.AmplifyBackend.CreateBackend
  ( -- * Creating a Request
    CreateBackend (..),
    newCreateBackend,

    -- * Request Lenses
    createBackend_resourceName,
    createBackend_resourceConfig,
    createBackend_appId,
    createBackend_backendEnvironmentName,
    createBackend_appName,

    -- * Destructuring the Response
    CreateBackendResponse (..),
    newCreateBackendResponse,

    -- * Response Lenses
    createBackendResponse_status,
    createBackendResponse_jobId,
    createBackendResponse_operation,
    createBackendResponse_error,
    createBackendResponse_appId,
    createBackendResponse_backendEnvironmentName,
    createBackendResponse_httpStatus,
  )
where

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

-- | The request body for CreateBackend.
--
-- /See:/ 'newCreateBackend' smart constructor.
data CreateBackend = CreateBackend'
  { -- | The name of the resource.
    CreateBackend -> Maybe Text
resourceName :: Prelude.Maybe Prelude.Text,
    -- | The resource configuration for the create backend request.
    CreateBackend -> Maybe ResourceConfig
resourceConfig :: Prelude.Maybe ResourceConfig,
    -- | The app ID.
    CreateBackend -> Text
appId :: Prelude.Text,
    -- | The name of the backend environment.
    CreateBackend -> Text
backendEnvironmentName :: Prelude.Text,
    -- | The name of the app.
    CreateBackend -> Text
appName :: Prelude.Text
  }
  deriving (CreateBackend -> CreateBackend -> Bool
(CreateBackend -> CreateBackend -> Bool)
-> (CreateBackend -> CreateBackend -> Bool) -> Eq CreateBackend
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateBackend -> CreateBackend -> Bool
$c/= :: CreateBackend -> CreateBackend -> Bool
== :: CreateBackend -> CreateBackend -> Bool
$c== :: CreateBackend -> CreateBackend -> Bool
Prelude.Eq, ReadPrec [CreateBackend]
ReadPrec CreateBackend
Int -> ReadS CreateBackend
ReadS [CreateBackend]
(Int -> ReadS CreateBackend)
-> ReadS [CreateBackend]
-> ReadPrec CreateBackend
-> ReadPrec [CreateBackend]
-> Read CreateBackend
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateBackend]
$creadListPrec :: ReadPrec [CreateBackend]
readPrec :: ReadPrec CreateBackend
$creadPrec :: ReadPrec CreateBackend
readList :: ReadS [CreateBackend]
$creadList :: ReadS [CreateBackend]
readsPrec :: Int -> ReadS CreateBackend
$creadsPrec :: Int -> ReadS CreateBackend
Prelude.Read, Int -> CreateBackend -> ShowS
[CreateBackend] -> ShowS
CreateBackend -> String
(Int -> CreateBackend -> ShowS)
-> (CreateBackend -> String)
-> ([CreateBackend] -> ShowS)
-> Show CreateBackend
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateBackend] -> ShowS
$cshowList :: [CreateBackend] -> ShowS
show :: CreateBackend -> String
$cshow :: CreateBackend -> String
showsPrec :: Int -> CreateBackend -> ShowS
$cshowsPrec :: Int -> CreateBackend -> ShowS
Prelude.Show, (forall x. CreateBackend -> Rep CreateBackend x)
-> (forall x. Rep CreateBackend x -> CreateBackend)
-> Generic CreateBackend
forall x. Rep CreateBackend x -> CreateBackend
forall x. CreateBackend -> Rep CreateBackend x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateBackend x -> CreateBackend
$cfrom :: forall x. CreateBackend -> Rep CreateBackend x
Prelude.Generic)

-- |
-- Create a value of 'CreateBackend' 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:
--
-- 'resourceName', 'createBackend_resourceName' - The name of the resource.
--
-- 'resourceConfig', 'createBackend_resourceConfig' - The resource configuration for the create backend request.
--
-- 'appId', 'createBackend_appId' - The app ID.
--
-- 'backendEnvironmentName', 'createBackend_backendEnvironmentName' - The name of the backend environment.
--
-- 'appName', 'createBackend_appName' - The name of the app.
newCreateBackend ::
  -- | 'appId'
  Prelude.Text ->
  -- | 'backendEnvironmentName'
  Prelude.Text ->
  -- | 'appName'
  Prelude.Text ->
  CreateBackend
newCreateBackend :: Text -> Text -> Text -> CreateBackend
newCreateBackend
  Text
pAppId_
  Text
pBackendEnvironmentName_
  Text
pAppName_ =
    CreateBackend' :: Maybe Text
-> Maybe ResourceConfig -> Text -> Text -> Text -> CreateBackend
CreateBackend'
      { $sel:resourceName:CreateBackend' :: Maybe Text
resourceName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:resourceConfig:CreateBackend' :: Maybe ResourceConfig
resourceConfig = Maybe ResourceConfig
forall a. Maybe a
Prelude.Nothing,
        $sel:appId:CreateBackend' :: Text
appId = Text
pAppId_,
        $sel:backendEnvironmentName:CreateBackend' :: Text
backendEnvironmentName = Text
pBackendEnvironmentName_,
        $sel:appName:CreateBackend' :: Text
appName = Text
pAppName_
      }

-- | The name of the resource.
createBackend_resourceName :: Lens.Lens' CreateBackend (Prelude.Maybe Prelude.Text)
createBackend_resourceName :: (Maybe Text -> f (Maybe Text)) -> CreateBackend -> f CreateBackend
createBackend_resourceName = (CreateBackend -> Maybe Text)
-> (CreateBackend -> Maybe Text -> CreateBackend)
-> Lens CreateBackend CreateBackend (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateBackend' {Maybe Text
resourceName :: Maybe Text
$sel:resourceName:CreateBackend' :: CreateBackend -> Maybe Text
resourceName} -> Maybe Text
resourceName) (\s :: CreateBackend
s@CreateBackend' {} Maybe Text
a -> CreateBackend
s {$sel:resourceName:CreateBackend' :: Maybe Text
resourceName = Maybe Text
a} :: CreateBackend)

-- | The resource configuration for the create backend request.
createBackend_resourceConfig :: Lens.Lens' CreateBackend (Prelude.Maybe ResourceConfig)
createBackend_resourceConfig :: (Maybe ResourceConfig -> f (Maybe ResourceConfig))
-> CreateBackend -> f CreateBackend
createBackend_resourceConfig = (CreateBackend -> Maybe ResourceConfig)
-> (CreateBackend -> Maybe ResourceConfig -> CreateBackend)
-> Lens
     CreateBackend
     CreateBackend
     (Maybe ResourceConfig)
     (Maybe ResourceConfig)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateBackend' {Maybe ResourceConfig
resourceConfig :: Maybe ResourceConfig
$sel:resourceConfig:CreateBackend' :: CreateBackend -> Maybe ResourceConfig
resourceConfig} -> Maybe ResourceConfig
resourceConfig) (\s :: CreateBackend
s@CreateBackend' {} Maybe ResourceConfig
a -> CreateBackend
s {$sel:resourceConfig:CreateBackend' :: Maybe ResourceConfig
resourceConfig = Maybe ResourceConfig
a} :: CreateBackend)

-- | The app ID.
createBackend_appId :: Lens.Lens' CreateBackend Prelude.Text
createBackend_appId :: (Text -> f Text) -> CreateBackend -> f CreateBackend
createBackend_appId = (CreateBackend -> Text)
-> (CreateBackend -> Text -> CreateBackend)
-> Lens CreateBackend CreateBackend Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateBackend' {Text
appId :: Text
$sel:appId:CreateBackend' :: CreateBackend -> Text
appId} -> Text
appId) (\s :: CreateBackend
s@CreateBackend' {} Text
a -> CreateBackend
s {$sel:appId:CreateBackend' :: Text
appId = Text
a} :: CreateBackend)

-- | The name of the backend environment.
createBackend_backendEnvironmentName :: Lens.Lens' CreateBackend Prelude.Text
createBackend_backendEnvironmentName :: (Text -> f Text) -> CreateBackend -> f CreateBackend
createBackend_backendEnvironmentName = (CreateBackend -> Text)
-> (CreateBackend -> Text -> CreateBackend)
-> Lens CreateBackend CreateBackend Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateBackend' {Text
backendEnvironmentName :: Text
$sel:backendEnvironmentName:CreateBackend' :: CreateBackend -> Text
backendEnvironmentName} -> Text
backendEnvironmentName) (\s :: CreateBackend
s@CreateBackend' {} Text
a -> CreateBackend
s {$sel:backendEnvironmentName:CreateBackend' :: Text
backendEnvironmentName = Text
a} :: CreateBackend)

-- | The name of the app.
createBackend_appName :: Lens.Lens' CreateBackend Prelude.Text
createBackend_appName :: (Text -> f Text) -> CreateBackend -> f CreateBackend
createBackend_appName = (CreateBackend -> Text)
-> (CreateBackend -> Text -> CreateBackend)
-> Lens CreateBackend CreateBackend Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateBackend' {Text
appName :: Text
$sel:appName:CreateBackend' :: CreateBackend -> Text
appName} -> Text
appName) (\s :: CreateBackend
s@CreateBackend' {} Text
a -> CreateBackend
s {$sel:appName:CreateBackend' :: Text
appName = Text
a} :: CreateBackend)

instance Core.AWSRequest CreateBackend where
  type
    AWSResponse CreateBackend =
      CreateBackendResponse
  request :: CreateBackend -> Request CreateBackend
request = Service -> CreateBackend -> Request CreateBackend
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy CreateBackend
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateBackend)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse CreateBackend))
-> Logger
-> Service
-> Proxy CreateBackend
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateBackend)))
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 Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Int
-> CreateBackendResponse
CreateBackendResponse'
            (Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Int
 -> CreateBackendResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Int
      -> CreateBackendResponse)
forall (f :: * -> *) a b. Functor 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
"status")
            Either
  String
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Int
   -> CreateBackendResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Int
      -> CreateBackendResponse)
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
"jobId")
            Either
  String
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Int
   -> CreateBackendResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe Text
      -> Maybe Text -> Maybe Text -> Int -> CreateBackendResponse)
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
"operation")
            Either
  String
  (Maybe Text
   -> Maybe Text -> Maybe Text -> Int -> CreateBackendResponse)
-> Either String (Maybe Text)
-> Either
     String (Maybe Text -> Maybe Text -> Int -> CreateBackendResponse)
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
"error")
            Either
  String (Maybe Text -> Maybe Text -> Int -> CreateBackendResponse)
-> Either String (Maybe Text)
-> Either String (Maybe Text -> Int -> CreateBackendResponse)
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
"appId")
            Either String (Maybe Text -> Int -> CreateBackendResponse)
-> Either String (Maybe Text)
-> Either String (Int -> CreateBackendResponse)
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
"backendEnvironmentName")
            Either String (Int -> CreateBackendResponse)
-> Either String Int -> Either String CreateBackendResponse
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 CreateBackend

instance Prelude.NFData CreateBackend

instance Core.ToHeaders CreateBackend where
  toHeaders :: CreateBackend -> ResponseHeaders
toHeaders =
    ResponseHeaders -> CreateBackend -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ 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 CreateBackend where
  toJSON :: CreateBackend -> Value
toJSON CreateBackend' {Maybe Text
Maybe ResourceConfig
Text
appName :: Text
backendEnvironmentName :: Text
appId :: Text
resourceConfig :: Maybe ResourceConfig
resourceName :: Maybe Text
$sel:appName:CreateBackend' :: CreateBackend -> Text
$sel:backendEnvironmentName:CreateBackend' :: CreateBackend -> Text
$sel:appId:CreateBackend' :: CreateBackend -> Text
$sel:resourceConfig:CreateBackend' :: CreateBackend -> Maybe ResourceConfig
$sel:resourceName:CreateBackend' :: CreateBackend -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"resourceName" 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
resourceName,
            (Text
"resourceConfig" Text -> ResourceConfig -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (ResourceConfig -> Pair) -> Maybe ResourceConfig -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ResourceConfig
resourceConfig,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"appId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
appId),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              ( Text
"backendEnvironmentName"
                  Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
backendEnvironmentName
              ),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"appName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
appName)
          ]
      )

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

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

-- | /See:/ 'newCreateBackendResponse' smart constructor.
data CreateBackendResponse = CreateBackendResponse'
  { -- | The current status of the request.
    CreateBackendResponse -> Maybe Text
status :: Prelude.Maybe Prelude.Text,
    -- | The ID for the job.
    CreateBackendResponse -> Maybe Text
jobId :: Prelude.Maybe Prelude.Text,
    -- | The name of the operation.
    CreateBackendResponse -> Maybe Text
operation :: Prelude.Maybe Prelude.Text,
    -- | If the request fails, this error is returned.
    CreateBackendResponse -> Maybe Text
error :: Prelude.Maybe Prelude.Text,
    -- | The app ID.
    CreateBackendResponse -> Maybe Text
appId :: Prelude.Maybe Prelude.Text,
    -- | The name of the backend environment.
    CreateBackendResponse -> Maybe Text
backendEnvironmentName :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    CreateBackendResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (CreateBackendResponse -> CreateBackendResponse -> Bool
(CreateBackendResponse -> CreateBackendResponse -> Bool)
-> (CreateBackendResponse -> CreateBackendResponse -> Bool)
-> Eq CreateBackendResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateBackendResponse -> CreateBackendResponse -> Bool
$c/= :: CreateBackendResponse -> CreateBackendResponse -> Bool
== :: CreateBackendResponse -> CreateBackendResponse -> Bool
$c== :: CreateBackendResponse -> CreateBackendResponse -> Bool
Prelude.Eq, ReadPrec [CreateBackendResponse]
ReadPrec CreateBackendResponse
Int -> ReadS CreateBackendResponse
ReadS [CreateBackendResponse]
(Int -> ReadS CreateBackendResponse)
-> ReadS [CreateBackendResponse]
-> ReadPrec CreateBackendResponse
-> ReadPrec [CreateBackendResponse]
-> Read CreateBackendResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateBackendResponse]
$creadListPrec :: ReadPrec [CreateBackendResponse]
readPrec :: ReadPrec CreateBackendResponse
$creadPrec :: ReadPrec CreateBackendResponse
readList :: ReadS [CreateBackendResponse]
$creadList :: ReadS [CreateBackendResponse]
readsPrec :: Int -> ReadS CreateBackendResponse
$creadsPrec :: Int -> ReadS CreateBackendResponse
Prelude.Read, Int -> CreateBackendResponse -> ShowS
[CreateBackendResponse] -> ShowS
CreateBackendResponse -> String
(Int -> CreateBackendResponse -> ShowS)
-> (CreateBackendResponse -> String)
-> ([CreateBackendResponse] -> ShowS)
-> Show CreateBackendResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateBackendResponse] -> ShowS
$cshowList :: [CreateBackendResponse] -> ShowS
show :: CreateBackendResponse -> String
$cshow :: CreateBackendResponse -> String
showsPrec :: Int -> CreateBackendResponse -> ShowS
$cshowsPrec :: Int -> CreateBackendResponse -> ShowS
Prelude.Show, (forall x. CreateBackendResponse -> Rep CreateBackendResponse x)
-> (forall x. Rep CreateBackendResponse x -> CreateBackendResponse)
-> Generic CreateBackendResponse
forall x. Rep CreateBackendResponse x -> CreateBackendResponse
forall x. CreateBackendResponse -> Rep CreateBackendResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateBackendResponse x -> CreateBackendResponse
$cfrom :: forall x. CreateBackendResponse -> Rep CreateBackendResponse x
Prelude.Generic)

-- |
-- Create a value of 'CreateBackendResponse' 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', 'createBackendResponse_status' - The current status of the request.
--
-- 'jobId', 'createBackendResponse_jobId' - The ID for the job.
--
-- 'operation', 'createBackendResponse_operation' - The name of the operation.
--
-- 'error', 'createBackendResponse_error' - If the request fails, this error is returned.
--
-- 'appId', 'createBackendResponse_appId' - The app ID.
--
-- 'backendEnvironmentName', 'createBackendResponse_backendEnvironmentName' - The name of the backend environment.
--
-- 'httpStatus', 'createBackendResponse_httpStatus' - The response's http status code.
newCreateBackendResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  CreateBackendResponse
newCreateBackendResponse :: Int -> CreateBackendResponse
newCreateBackendResponse Int
pHttpStatus_ =
  CreateBackendResponse' :: Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Int
-> CreateBackendResponse
CreateBackendResponse'
    { $sel:status:CreateBackendResponse' :: Maybe Text
status = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:jobId:CreateBackendResponse' :: Maybe Text
jobId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:operation:CreateBackendResponse' :: Maybe Text
operation = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:error:CreateBackendResponse' :: Maybe Text
error = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:appId:CreateBackendResponse' :: Maybe Text
appId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:backendEnvironmentName:CreateBackendResponse' :: Maybe Text
backendEnvironmentName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:CreateBackendResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The current status of the request.
createBackendResponse_status :: Lens.Lens' CreateBackendResponse (Prelude.Maybe Prelude.Text)
createBackendResponse_status :: (Maybe Text -> f (Maybe Text))
-> CreateBackendResponse -> f CreateBackendResponse
createBackendResponse_status = (CreateBackendResponse -> Maybe Text)
-> (CreateBackendResponse -> Maybe Text -> CreateBackendResponse)
-> Lens
     CreateBackendResponse
     CreateBackendResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateBackendResponse' {Maybe Text
status :: Maybe Text
$sel:status:CreateBackendResponse' :: CreateBackendResponse -> Maybe Text
status} -> Maybe Text
status) (\s :: CreateBackendResponse
s@CreateBackendResponse' {} Maybe Text
a -> CreateBackendResponse
s {$sel:status:CreateBackendResponse' :: Maybe Text
status = Maybe Text
a} :: CreateBackendResponse)

-- | The ID for the job.
createBackendResponse_jobId :: Lens.Lens' CreateBackendResponse (Prelude.Maybe Prelude.Text)
createBackendResponse_jobId :: (Maybe Text -> f (Maybe Text))
-> CreateBackendResponse -> f CreateBackendResponse
createBackendResponse_jobId = (CreateBackendResponse -> Maybe Text)
-> (CreateBackendResponse -> Maybe Text -> CreateBackendResponse)
-> Lens
     CreateBackendResponse
     CreateBackendResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateBackendResponse' {Maybe Text
jobId :: Maybe Text
$sel:jobId:CreateBackendResponse' :: CreateBackendResponse -> Maybe Text
jobId} -> Maybe Text
jobId) (\s :: CreateBackendResponse
s@CreateBackendResponse' {} Maybe Text
a -> CreateBackendResponse
s {$sel:jobId:CreateBackendResponse' :: Maybe Text
jobId = Maybe Text
a} :: CreateBackendResponse)

-- | The name of the operation.
createBackendResponse_operation :: Lens.Lens' CreateBackendResponse (Prelude.Maybe Prelude.Text)
createBackendResponse_operation :: (Maybe Text -> f (Maybe Text))
-> CreateBackendResponse -> f CreateBackendResponse
createBackendResponse_operation = (CreateBackendResponse -> Maybe Text)
-> (CreateBackendResponse -> Maybe Text -> CreateBackendResponse)
-> Lens
     CreateBackendResponse
     CreateBackendResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateBackendResponse' {Maybe Text
operation :: Maybe Text
$sel:operation:CreateBackendResponse' :: CreateBackendResponse -> Maybe Text
operation} -> Maybe Text
operation) (\s :: CreateBackendResponse
s@CreateBackendResponse' {} Maybe Text
a -> CreateBackendResponse
s {$sel:operation:CreateBackendResponse' :: Maybe Text
operation = Maybe Text
a} :: CreateBackendResponse)

-- | If the request fails, this error is returned.
createBackendResponse_error :: Lens.Lens' CreateBackendResponse (Prelude.Maybe Prelude.Text)
createBackendResponse_error :: (Maybe Text -> f (Maybe Text))
-> CreateBackendResponse -> f CreateBackendResponse
createBackendResponse_error = (CreateBackendResponse -> Maybe Text)
-> (CreateBackendResponse -> Maybe Text -> CreateBackendResponse)
-> Lens
     CreateBackendResponse
     CreateBackendResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateBackendResponse' {Maybe Text
error :: Maybe Text
$sel:error:CreateBackendResponse' :: CreateBackendResponse -> Maybe Text
error} -> Maybe Text
error) (\s :: CreateBackendResponse
s@CreateBackendResponse' {} Maybe Text
a -> CreateBackendResponse
s {$sel:error:CreateBackendResponse' :: Maybe Text
error = Maybe Text
a} :: CreateBackendResponse)

-- | The app ID.
createBackendResponse_appId :: Lens.Lens' CreateBackendResponse (Prelude.Maybe Prelude.Text)
createBackendResponse_appId :: (Maybe Text -> f (Maybe Text))
-> CreateBackendResponse -> f CreateBackendResponse
createBackendResponse_appId = (CreateBackendResponse -> Maybe Text)
-> (CreateBackendResponse -> Maybe Text -> CreateBackendResponse)
-> Lens
     CreateBackendResponse
     CreateBackendResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateBackendResponse' {Maybe Text
appId :: Maybe Text
$sel:appId:CreateBackendResponse' :: CreateBackendResponse -> Maybe Text
appId} -> Maybe Text
appId) (\s :: CreateBackendResponse
s@CreateBackendResponse' {} Maybe Text
a -> CreateBackendResponse
s {$sel:appId:CreateBackendResponse' :: Maybe Text
appId = Maybe Text
a} :: CreateBackendResponse)

-- | The name of the backend environment.
createBackendResponse_backendEnvironmentName :: Lens.Lens' CreateBackendResponse (Prelude.Maybe Prelude.Text)
createBackendResponse_backendEnvironmentName :: (Maybe Text -> f (Maybe Text))
-> CreateBackendResponse -> f CreateBackendResponse
createBackendResponse_backendEnvironmentName = (CreateBackendResponse -> Maybe Text)
-> (CreateBackendResponse -> Maybe Text -> CreateBackendResponse)
-> Lens
     CreateBackendResponse
     CreateBackendResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateBackendResponse' {Maybe Text
backendEnvironmentName :: Maybe Text
$sel:backendEnvironmentName:CreateBackendResponse' :: CreateBackendResponse -> Maybe Text
backendEnvironmentName} -> Maybe Text
backendEnvironmentName) (\s :: CreateBackendResponse
s@CreateBackendResponse' {} Maybe Text
a -> CreateBackendResponse
s {$sel:backendEnvironmentName:CreateBackendResponse' :: Maybe Text
backendEnvironmentName = Maybe Text
a} :: CreateBackendResponse)

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

instance Prelude.NFData CreateBackendResponse