{-# 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 #-}
module Amazonka.AmplifyBackend.GetBackendStorage
  ( 
    GetBackendStorage (..),
    newGetBackendStorage,
    
    getBackendStorage_appId,
    getBackendStorage_backendEnvironmentName,
    getBackendStorage_resourceName,
    
    GetBackendStorageResponse (..),
    newGetBackendStorageResponse,
    
    getBackendStorageResponse_appId,
    getBackendStorageResponse_backendEnvironmentName,
    getBackendStorageResponse_resourceConfig,
    getBackendStorageResponse_resourceName,
    getBackendStorageResponse_httpStatus,
  )
where
import Amazonka.AmplifyBackend.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
data GetBackendStorage = GetBackendStorage'
  { 
    GetBackendStorage -> Text
appId :: Prelude.Text,
    
    GetBackendStorage -> Text
backendEnvironmentName :: Prelude.Text,
    
    GetBackendStorage -> Text
resourceName :: Prelude.Text
  }
  deriving (GetBackendStorage -> GetBackendStorage -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetBackendStorage -> GetBackendStorage -> Bool
$c/= :: GetBackendStorage -> GetBackendStorage -> Bool
== :: GetBackendStorage -> GetBackendStorage -> Bool
$c== :: GetBackendStorage -> GetBackendStorage -> Bool
Prelude.Eq, ReadPrec [GetBackendStorage]
ReadPrec GetBackendStorage
Int -> ReadS GetBackendStorage
ReadS [GetBackendStorage]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetBackendStorage]
$creadListPrec :: ReadPrec [GetBackendStorage]
readPrec :: ReadPrec GetBackendStorage
$creadPrec :: ReadPrec GetBackendStorage
readList :: ReadS [GetBackendStorage]
$creadList :: ReadS [GetBackendStorage]
readsPrec :: Int -> ReadS GetBackendStorage
$creadsPrec :: Int -> ReadS GetBackendStorage
Prelude.Read, Int -> GetBackendStorage -> ShowS
[GetBackendStorage] -> ShowS
GetBackendStorage -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetBackendStorage] -> ShowS
$cshowList :: [GetBackendStorage] -> ShowS
show :: GetBackendStorage -> String
$cshow :: GetBackendStorage -> String
showsPrec :: Int -> GetBackendStorage -> ShowS
$cshowsPrec :: Int -> GetBackendStorage -> ShowS
Prelude.Show, forall x. Rep GetBackendStorage x -> GetBackendStorage
forall x. GetBackendStorage -> Rep GetBackendStorage x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetBackendStorage x -> GetBackendStorage
$cfrom :: forall x. GetBackendStorage -> Rep GetBackendStorage x
Prelude.Generic)
newGetBackendStorage ::
  
  Prelude.Text ->
  
  Prelude.Text ->
  
  Prelude.Text ->
  GetBackendStorage
newGetBackendStorage :: Text -> Text -> Text -> GetBackendStorage
newGetBackendStorage
  Text
pAppId_
  Text
pBackendEnvironmentName_
  Text
pResourceName_ =
    GetBackendStorage'
      { $sel:appId:GetBackendStorage' :: Text
appId = Text
pAppId_,
        $sel:backendEnvironmentName:GetBackendStorage' :: Text
backendEnvironmentName = Text
pBackendEnvironmentName_,
        $sel:resourceName:GetBackendStorage' :: Text
resourceName = Text
pResourceName_
      }
getBackendStorage_appId :: Lens.Lens' GetBackendStorage Prelude.Text
getBackendStorage_appId :: Lens' GetBackendStorage Text
getBackendStorage_appId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetBackendStorage' {Text
appId :: Text
$sel:appId:GetBackendStorage' :: GetBackendStorage -> Text
appId} -> Text
appId) (\s :: GetBackendStorage
s@GetBackendStorage' {} Text
a -> GetBackendStorage
s {$sel:appId:GetBackendStorage' :: Text
appId = Text
a} :: GetBackendStorage)
getBackendStorage_backendEnvironmentName :: Lens.Lens' GetBackendStorage Prelude.Text
getBackendStorage_backendEnvironmentName :: Lens' GetBackendStorage Text
getBackendStorage_backendEnvironmentName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetBackendStorage' {Text
backendEnvironmentName :: Text
$sel:backendEnvironmentName:GetBackendStorage' :: GetBackendStorage -> Text
backendEnvironmentName} -> Text
backendEnvironmentName) (\s :: GetBackendStorage
s@GetBackendStorage' {} Text
a -> GetBackendStorage
s {$sel:backendEnvironmentName:GetBackendStorage' :: Text
backendEnvironmentName = Text
a} :: GetBackendStorage)
getBackendStorage_resourceName :: Lens.Lens' GetBackendStorage Prelude.Text
getBackendStorage_resourceName :: Lens' GetBackendStorage Text
getBackendStorage_resourceName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetBackendStorage' {Text
resourceName :: Text
$sel:resourceName:GetBackendStorage' :: GetBackendStorage -> Text
resourceName} -> Text
resourceName) (\s :: GetBackendStorage
s@GetBackendStorage' {} Text
a -> GetBackendStorage
s {$sel:resourceName:GetBackendStorage' :: Text
resourceName = Text
a} :: GetBackendStorage)
instance Core.AWSRequest GetBackendStorage where
  type
    AWSResponse GetBackendStorage =
      GetBackendStorageResponse
  request :: (Service -> Service)
-> GetBackendStorage -> Request GetBackendStorage
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 GetBackendStorage
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse GetBackendStorage)))
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 Text
-> Maybe Text
-> Maybe GetBackendStorageResourceConfig
-> Maybe Text
-> Int
-> GetBackendStorageResponse
GetBackendStorageResponse'
            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
"appId")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"backendEnvironmentName")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"resourceConfig")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"resourceName")
            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 GetBackendStorage where
  hashWithSalt :: Int -> GetBackendStorage -> Int
hashWithSalt Int
_salt GetBackendStorage' {Text
resourceName :: Text
backendEnvironmentName :: Text
appId :: Text
$sel:resourceName:GetBackendStorage' :: GetBackendStorage -> Text
$sel:backendEnvironmentName:GetBackendStorage' :: GetBackendStorage -> Text
$sel:appId:GetBackendStorage' :: GetBackendStorage -> Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
appId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
backendEnvironmentName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
resourceName
instance Prelude.NFData GetBackendStorage where
  rnf :: GetBackendStorage -> ()
rnf GetBackendStorage' {Text
resourceName :: Text
backendEnvironmentName :: Text
appId :: Text
$sel:resourceName:GetBackendStorage' :: GetBackendStorage -> Text
$sel:backendEnvironmentName:GetBackendStorage' :: GetBackendStorage -> Text
$sel:appId:GetBackendStorage' :: GetBackendStorage -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
appId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
backendEnvironmentName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
resourceName
instance Data.ToHeaders GetBackendStorage where
  toHeaders :: GetBackendStorage -> ResponseHeaders
toHeaders =
    forall a b. a -> b -> a
Prelude.const
      ( forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"Content-Type"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )
instance Data.ToJSON GetBackendStorage where
  toJSON :: GetBackendStorage -> Value
toJSON GetBackendStorage' {Text
resourceName :: Text
backendEnvironmentName :: Text
appId :: Text
$sel:resourceName:GetBackendStorage' :: GetBackendStorage -> Text
$sel:backendEnvironmentName:GetBackendStorage' :: GetBackendStorage -> Text
$sel:appId:GetBackendStorage' :: GetBackendStorage -> Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [forall a. a -> Maybe a
Prelude.Just (Key
"resourceName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
resourceName)]
      )
instance Data.ToPath GetBackendStorage where
  toPath :: GetBackendStorage -> ByteString
toPath GetBackendStorage' {Text
resourceName :: Text
backendEnvironmentName :: Text
appId :: Text
$sel:resourceName:GetBackendStorage' :: GetBackendStorage -> Text
$sel:backendEnvironmentName:GetBackendStorage' :: GetBackendStorage -> Text
$sel:appId:GetBackendStorage' :: GetBackendStorage -> Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/backend/",
        forall a. ToByteString a => a -> ByteString
Data.toBS Text
appId,
        ByteString
"/storage/",
        forall a. ToByteString a => a -> ByteString
Data.toBS Text
backendEnvironmentName,
        ByteString
"/details"
      ]
instance Data.ToQuery GetBackendStorage where
  toQuery :: GetBackendStorage -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data GetBackendStorageResponse = GetBackendStorageResponse'
  { 
    GetBackendStorageResponse -> Maybe Text
appId :: Prelude.Maybe Prelude.Text,
    
    GetBackendStorageResponse -> Maybe Text
backendEnvironmentName :: Prelude.Maybe Prelude.Text,
    
    GetBackendStorageResponse -> Maybe GetBackendStorageResourceConfig
resourceConfig :: Prelude.Maybe GetBackendStorageResourceConfig,
    
    GetBackendStorageResponse -> Maybe Text
resourceName :: Prelude.Maybe Prelude.Text,
    
    GetBackendStorageResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (GetBackendStorageResponse -> GetBackendStorageResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetBackendStorageResponse -> GetBackendStorageResponse -> Bool
$c/= :: GetBackendStorageResponse -> GetBackendStorageResponse -> Bool
== :: GetBackendStorageResponse -> GetBackendStorageResponse -> Bool
$c== :: GetBackendStorageResponse -> GetBackendStorageResponse -> Bool
Prelude.Eq, ReadPrec [GetBackendStorageResponse]
ReadPrec GetBackendStorageResponse
Int -> ReadS GetBackendStorageResponse
ReadS [GetBackendStorageResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetBackendStorageResponse]
$creadListPrec :: ReadPrec [GetBackendStorageResponse]
readPrec :: ReadPrec GetBackendStorageResponse
$creadPrec :: ReadPrec GetBackendStorageResponse
readList :: ReadS [GetBackendStorageResponse]
$creadList :: ReadS [GetBackendStorageResponse]
readsPrec :: Int -> ReadS GetBackendStorageResponse
$creadsPrec :: Int -> ReadS GetBackendStorageResponse
Prelude.Read, Int -> GetBackendStorageResponse -> ShowS
[GetBackendStorageResponse] -> ShowS
GetBackendStorageResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetBackendStorageResponse] -> ShowS
$cshowList :: [GetBackendStorageResponse] -> ShowS
show :: GetBackendStorageResponse -> String
$cshow :: GetBackendStorageResponse -> String
showsPrec :: Int -> GetBackendStorageResponse -> ShowS
$cshowsPrec :: Int -> GetBackendStorageResponse -> ShowS
Prelude.Show, forall x.
Rep GetBackendStorageResponse x -> GetBackendStorageResponse
forall x.
GetBackendStorageResponse -> Rep GetBackendStorageResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetBackendStorageResponse x -> GetBackendStorageResponse
$cfrom :: forall x.
GetBackendStorageResponse -> Rep GetBackendStorageResponse x
Prelude.Generic)
newGetBackendStorageResponse ::
  
  Prelude.Int ->
  GetBackendStorageResponse
newGetBackendStorageResponse :: Int -> GetBackendStorageResponse
newGetBackendStorageResponse Int
pHttpStatus_ =
  GetBackendStorageResponse'
    { $sel:appId:GetBackendStorageResponse' :: Maybe Text
appId = forall a. Maybe a
Prelude.Nothing,
      $sel:backendEnvironmentName:GetBackendStorageResponse' :: Maybe Text
backendEnvironmentName = forall a. Maybe a
Prelude.Nothing,
      $sel:resourceConfig:GetBackendStorageResponse' :: Maybe GetBackendStorageResourceConfig
resourceConfig = forall a. Maybe a
Prelude.Nothing,
      $sel:resourceName:GetBackendStorageResponse' :: Maybe Text
resourceName = forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:GetBackendStorageResponse' :: Int
httpStatus = Int
pHttpStatus_
    }
getBackendStorageResponse_appId :: Lens.Lens' GetBackendStorageResponse (Prelude.Maybe Prelude.Text)
getBackendStorageResponse_appId :: Lens' GetBackendStorageResponse (Maybe Text)
getBackendStorageResponse_appId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetBackendStorageResponse' {Maybe Text
appId :: Maybe Text
$sel:appId:GetBackendStorageResponse' :: GetBackendStorageResponse -> Maybe Text
appId} -> Maybe Text
appId) (\s :: GetBackendStorageResponse
s@GetBackendStorageResponse' {} Maybe Text
a -> GetBackendStorageResponse
s {$sel:appId:GetBackendStorageResponse' :: Maybe Text
appId = Maybe Text
a} :: GetBackendStorageResponse)
getBackendStorageResponse_backendEnvironmentName :: Lens.Lens' GetBackendStorageResponse (Prelude.Maybe Prelude.Text)
getBackendStorageResponse_backendEnvironmentName :: Lens' GetBackendStorageResponse (Maybe Text)
getBackendStorageResponse_backendEnvironmentName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetBackendStorageResponse' {Maybe Text
backendEnvironmentName :: Maybe Text
$sel:backendEnvironmentName:GetBackendStorageResponse' :: GetBackendStorageResponse -> Maybe Text
backendEnvironmentName} -> Maybe Text
backendEnvironmentName) (\s :: GetBackendStorageResponse
s@GetBackendStorageResponse' {} Maybe Text
a -> GetBackendStorageResponse
s {$sel:backendEnvironmentName:GetBackendStorageResponse' :: Maybe Text
backendEnvironmentName = Maybe Text
a} :: GetBackendStorageResponse)
getBackendStorageResponse_resourceConfig :: Lens.Lens' GetBackendStorageResponse (Prelude.Maybe GetBackendStorageResourceConfig)
getBackendStorageResponse_resourceConfig :: Lens'
  GetBackendStorageResponse (Maybe GetBackendStorageResourceConfig)
getBackendStorageResponse_resourceConfig = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetBackendStorageResponse' {Maybe GetBackendStorageResourceConfig
resourceConfig :: Maybe GetBackendStorageResourceConfig
$sel:resourceConfig:GetBackendStorageResponse' :: GetBackendStorageResponse -> Maybe GetBackendStorageResourceConfig
resourceConfig} -> Maybe GetBackendStorageResourceConfig
resourceConfig) (\s :: GetBackendStorageResponse
s@GetBackendStorageResponse' {} Maybe GetBackendStorageResourceConfig
a -> GetBackendStorageResponse
s {$sel:resourceConfig:GetBackendStorageResponse' :: Maybe GetBackendStorageResourceConfig
resourceConfig = Maybe GetBackendStorageResourceConfig
a} :: GetBackendStorageResponse)
getBackendStorageResponse_resourceName :: Lens.Lens' GetBackendStorageResponse (Prelude.Maybe Prelude.Text)
getBackendStorageResponse_resourceName :: Lens' GetBackendStorageResponse (Maybe Text)
getBackendStorageResponse_resourceName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetBackendStorageResponse' {Maybe Text
resourceName :: Maybe Text
$sel:resourceName:GetBackendStorageResponse' :: GetBackendStorageResponse -> Maybe Text
resourceName} -> Maybe Text
resourceName) (\s :: GetBackendStorageResponse
s@GetBackendStorageResponse' {} Maybe Text
a -> GetBackendStorageResponse
s {$sel:resourceName:GetBackendStorageResponse' :: Maybe Text
resourceName = Maybe Text
a} :: GetBackendStorageResponse)
getBackendStorageResponse_httpStatus :: Lens.Lens' GetBackendStorageResponse Prelude.Int
getBackendStorageResponse_httpStatus :: Lens' GetBackendStorageResponse Int
getBackendStorageResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetBackendStorageResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetBackendStorageResponse' :: GetBackendStorageResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetBackendStorageResponse
s@GetBackendStorageResponse' {} Int
a -> GetBackendStorageResponse
s {$sel:httpStatus:GetBackendStorageResponse' :: Int
httpStatus = Int
a} :: GetBackendStorageResponse)
instance Prelude.NFData GetBackendStorageResponse where
  rnf :: GetBackendStorageResponse -> ()
rnf GetBackendStorageResponse' {Int
Maybe Text
Maybe GetBackendStorageResourceConfig
httpStatus :: Int
resourceName :: Maybe Text
resourceConfig :: Maybe GetBackendStorageResourceConfig
backendEnvironmentName :: Maybe Text
appId :: Maybe Text
$sel:httpStatus:GetBackendStorageResponse' :: GetBackendStorageResponse -> Int
$sel:resourceName:GetBackendStorageResponse' :: GetBackendStorageResponse -> Maybe Text
$sel:resourceConfig:GetBackendStorageResponse' :: GetBackendStorageResponse -> Maybe GetBackendStorageResourceConfig
$sel:backendEnvironmentName:GetBackendStorageResponse' :: GetBackendStorageResponse -> Maybe Text
$sel:appId:GetBackendStorageResponse' :: GetBackendStorageResponse -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
appId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
backendEnvironmentName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe GetBackendStorageResourceConfig
resourceConfig
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
resourceName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus