{-# 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.GetBackendAPI
-- 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)
--
-- Gets the details for a backend API.
module Amazonka.AmplifyBackend.GetBackendAPI
  ( -- * Creating a Request
    GetBackendAPI (..),
    newGetBackendAPI,

    -- * Request Lenses
    getBackendAPI_resourceConfig,
    getBackendAPI_appId,
    getBackendAPI_backendEnvironmentName,
    getBackendAPI_resourceName,

    -- * Destructuring the Response
    GetBackendAPIResponse (..),
    newGetBackendAPIResponse,

    -- * Response Lenses
    getBackendAPIResponse_resourceName,
    getBackendAPIResponse_error,
    getBackendAPIResponse_appId,
    getBackendAPIResponse_resourceConfig,
    getBackendAPIResponse_backendEnvironmentName,
    getBackendAPIResponse_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 GetBackendAPI.
--
-- /See:/ 'newGetBackendAPI' smart constructor.
data GetBackendAPI = GetBackendAPI'
  { -- | Defines the resource configuration for the data model in your Amplify
    -- project.
    GetBackendAPI -> Maybe BackendAPIResourceConfig
resourceConfig :: Prelude.Maybe BackendAPIResourceConfig,
    -- | The app ID.
    GetBackendAPI -> Text
appId :: Prelude.Text,
    -- | The name of the backend environment.
    GetBackendAPI -> Text
backendEnvironmentName :: Prelude.Text,
    -- | The name of this resource.
    GetBackendAPI -> Text
resourceName :: Prelude.Text
  }
  deriving (GetBackendAPI -> GetBackendAPI -> Bool
(GetBackendAPI -> GetBackendAPI -> Bool)
-> (GetBackendAPI -> GetBackendAPI -> Bool) -> Eq GetBackendAPI
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetBackendAPI -> GetBackendAPI -> Bool
$c/= :: GetBackendAPI -> GetBackendAPI -> Bool
== :: GetBackendAPI -> GetBackendAPI -> Bool
$c== :: GetBackendAPI -> GetBackendAPI -> Bool
Prelude.Eq, ReadPrec [GetBackendAPI]
ReadPrec GetBackendAPI
Int -> ReadS GetBackendAPI
ReadS [GetBackendAPI]
(Int -> ReadS GetBackendAPI)
-> ReadS [GetBackendAPI]
-> ReadPrec GetBackendAPI
-> ReadPrec [GetBackendAPI]
-> Read GetBackendAPI
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetBackendAPI]
$creadListPrec :: ReadPrec [GetBackendAPI]
readPrec :: ReadPrec GetBackendAPI
$creadPrec :: ReadPrec GetBackendAPI
readList :: ReadS [GetBackendAPI]
$creadList :: ReadS [GetBackendAPI]
readsPrec :: Int -> ReadS GetBackendAPI
$creadsPrec :: Int -> ReadS GetBackendAPI
Prelude.Read, Int -> GetBackendAPI -> ShowS
[GetBackendAPI] -> ShowS
GetBackendAPI -> String
(Int -> GetBackendAPI -> ShowS)
-> (GetBackendAPI -> String)
-> ([GetBackendAPI] -> ShowS)
-> Show GetBackendAPI
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetBackendAPI] -> ShowS
$cshowList :: [GetBackendAPI] -> ShowS
show :: GetBackendAPI -> String
$cshow :: GetBackendAPI -> String
showsPrec :: Int -> GetBackendAPI -> ShowS
$cshowsPrec :: Int -> GetBackendAPI -> ShowS
Prelude.Show, (forall x. GetBackendAPI -> Rep GetBackendAPI x)
-> (forall x. Rep GetBackendAPI x -> GetBackendAPI)
-> Generic GetBackendAPI
forall x. Rep GetBackendAPI x -> GetBackendAPI
forall x. GetBackendAPI -> Rep GetBackendAPI x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetBackendAPI x -> GetBackendAPI
$cfrom :: forall x. GetBackendAPI -> Rep GetBackendAPI x
Prelude.Generic)

-- |
-- Create a value of 'GetBackendAPI' 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:
--
-- 'resourceConfig', 'getBackendAPI_resourceConfig' - Defines the resource configuration for the data model in your Amplify
-- project.
--
-- 'appId', 'getBackendAPI_appId' - The app ID.
--
-- 'backendEnvironmentName', 'getBackendAPI_backendEnvironmentName' - The name of the backend environment.
--
-- 'resourceName', 'getBackendAPI_resourceName' - The name of this resource.
newGetBackendAPI ::
  -- | 'appId'
  Prelude.Text ->
  -- | 'backendEnvironmentName'
  Prelude.Text ->
  -- | 'resourceName'
  Prelude.Text ->
  GetBackendAPI
newGetBackendAPI :: Text -> Text -> Text -> GetBackendAPI
newGetBackendAPI
  Text
pAppId_
  Text
pBackendEnvironmentName_
  Text
pResourceName_ =
    GetBackendAPI' :: Maybe BackendAPIResourceConfig
-> Text -> Text -> Text -> GetBackendAPI
GetBackendAPI'
      { $sel:resourceConfig:GetBackendAPI' :: Maybe BackendAPIResourceConfig
resourceConfig = Maybe BackendAPIResourceConfig
forall a. Maybe a
Prelude.Nothing,
        $sel:appId:GetBackendAPI' :: Text
appId = Text
pAppId_,
        $sel:backendEnvironmentName:GetBackendAPI' :: Text
backendEnvironmentName = Text
pBackendEnvironmentName_,
        $sel:resourceName:GetBackendAPI' :: Text
resourceName = Text
pResourceName_
      }

-- | Defines the resource configuration for the data model in your Amplify
-- project.
getBackendAPI_resourceConfig :: Lens.Lens' GetBackendAPI (Prelude.Maybe BackendAPIResourceConfig)
getBackendAPI_resourceConfig :: (Maybe BackendAPIResourceConfig
 -> f (Maybe BackendAPIResourceConfig))
-> GetBackendAPI -> f GetBackendAPI
getBackendAPI_resourceConfig = (GetBackendAPI -> Maybe BackendAPIResourceConfig)
-> (GetBackendAPI
    -> Maybe BackendAPIResourceConfig -> GetBackendAPI)
-> Lens
     GetBackendAPI
     GetBackendAPI
     (Maybe BackendAPIResourceConfig)
     (Maybe BackendAPIResourceConfig)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetBackendAPI' {Maybe BackendAPIResourceConfig
resourceConfig :: Maybe BackendAPIResourceConfig
$sel:resourceConfig:GetBackendAPI' :: GetBackendAPI -> Maybe BackendAPIResourceConfig
resourceConfig} -> Maybe BackendAPIResourceConfig
resourceConfig) (\s :: GetBackendAPI
s@GetBackendAPI' {} Maybe BackendAPIResourceConfig
a -> GetBackendAPI
s {$sel:resourceConfig:GetBackendAPI' :: Maybe BackendAPIResourceConfig
resourceConfig = Maybe BackendAPIResourceConfig
a} :: GetBackendAPI)

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

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

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

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

instance Prelude.NFData GetBackendAPI

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

instance Core.ToPath GetBackendAPI where
  toPath :: GetBackendAPI -> ByteString
toPath GetBackendAPI' {Maybe BackendAPIResourceConfig
Text
resourceName :: Text
backendEnvironmentName :: Text
appId :: Text
resourceConfig :: Maybe BackendAPIResourceConfig
$sel:resourceName:GetBackendAPI' :: GetBackendAPI -> Text
$sel:backendEnvironmentName:GetBackendAPI' :: GetBackendAPI -> Text
$sel:appId:GetBackendAPI' :: GetBackendAPI -> Text
$sel:resourceConfig:GetBackendAPI' :: GetBackendAPI -> Maybe BackendAPIResourceConfig
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/backend/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
appId,
        ByteString
"/api/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
backendEnvironmentName,
        ByteString
"/details"
      ]

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

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

-- |
-- Create a value of 'GetBackendAPIResponse' 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', 'getBackendAPIResponse_resourceName' - The name of this resource.
--
-- 'error', 'getBackendAPIResponse_error' - If the request fails, this error is returned.
--
-- 'appId', 'getBackendAPIResponse_appId' - The app ID.
--
-- 'resourceConfig', 'getBackendAPIResponse_resourceConfig' - The resource configuration for this response object.
--
-- 'backendEnvironmentName', 'getBackendAPIResponse_backendEnvironmentName' - The name of the backend environment.
--
-- 'httpStatus', 'getBackendAPIResponse_httpStatus' - The response's http status code.
newGetBackendAPIResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  GetBackendAPIResponse
newGetBackendAPIResponse :: Int -> GetBackendAPIResponse
newGetBackendAPIResponse Int
pHttpStatus_ =
  GetBackendAPIResponse' :: Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe BackendAPIResourceConfig
-> Maybe Text
-> Int
-> GetBackendAPIResponse
GetBackendAPIResponse'
    { $sel:resourceName:GetBackendAPIResponse' :: Maybe Text
resourceName =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:error:GetBackendAPIResponse' :: Maybe Text
error = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:appId:GetBackendAPIResponse' :: Maybe Text
appId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:resourceConfig:GetBackendAPIResponse' :: Maybe BackendAPIResourceConfig
resourceConfig = Maybe BackendAPIResourceConfig
forall a. Maybe a
Prelude.Nothing,
      $sel:backendEnvironmentName:GetBackendAPIResponse' :: Maybe Text
backendEnvironmentName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:GetBackendAPIResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

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

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

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

-- | The resource configuration for this response object.
getBackendAPIResponse_resourceConfig :: Lens.Lens' GetBackendAPIResponse (Prelude.Maybe BackendAPIResourceConfig)
getBackendAPIResponse_resourceConfig :: (Maybe BackendAPIResourceConfig
 -> f (Maybe BackendAPIResourceConfig))
-> GetBackendAPIResponse -> f GetBackendAPIResponse
getBackendAPIResponse_resourceConfig = (GetBackendAPIResponse -> Maybe BackendAPIResourceConfig)
-> (GetBackendAPIResponse
    -> Maybe BackendAPIResourceConfig -> GetBackendAPIResponse)
-> Lens
     GetBackendAPIResponse
     GetBackendAPIResponse
     (Maybe BackendAPIResourceConfig)
     (Maybe BackendAPIResourceConfig)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetBackendAPIResponse' {Maybe BackendAPIResourceConfig
resourceConfig :: Maybe BackendAPIResourceConfig
$sel:resourceConfig:GetBackendAPIResponse' :: GetBackendAPIResponse -> Maybe BackendAPIResourceConfig
resourceConfig} -> Maybe BackendAPIResourceConfig
resourceConfig) (\s :: GetBackendAPIResponse
s@GetBackendAPIResponse' {} Maybe BackendAPIResourceConfig
a -> GetBackendAPIResponse
s {$sel:resourceConfig:GetBackendAPIResponse' :: Maybe BackendAPIResourceConfig
resourceConfig = Maybe BackendAPIResourceConfig
a} :: GetBackendAPIResponse)

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

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

instance Prelude.NFData GetBackendAPIResponse