{-# 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.Backup.GetSupportedResourceTypes
-- 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)
--
-- Returns the Amazon Web Services resource types supported by Backup.
module Amazonka.Backup.GetSupportedResourceTypes
  ( -- * Creating a Request
    GetSupportedResourceTypes (..),
    newGetSupportedResourceTypes,

    -- * Destructuring the Response
    GetSupportedResourceTypesResponse (..),
    newGetSupportedResourceTypesResponse,

    -- * Response Lenses
    getSupportedResourceTypesResponse_resourceTypes,
    getSupportedResourceTypesResponse_httpStatus,
  )
where

import Amazonka.Backup.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:/ 'newGetSupportedResourceTypes' smart constructor.
data GetSupportedResourceTypes = GetSupportedResourceTypes'
  {
  }
  deriving (GetSupportedResourceTypes -> GetSupportedResourceTypes -> Bool
(GetSupportedResourceTypes -> GetSupportedResourceTypes -> Bool)
-> (GetSupportedResourceTypes -> GetSupportedResourceTypes -> Bool)
-> Eq GetSupportedResourceTypes
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetSupportedResourceTypes -> GetSupportedResourceTypes -> Bool
$c/= :: GetSupportedResourceTypes -> GetSupportedResourceTypes -> Bool
== :: GetSupportedResourceTypes -> GetSupportedResourceTypes -> Bool
$c== :: GetSupportedResourceTypes -> GetSupportedResourceTypes -> Bool
Prelude.Eq, ReadPrec [GetSupportedResourceTypes]
ReadPrec GetSupportedResourceTypes
Int -> ReadS GetSupportedResourceTypes
ReadS [GetSupportedResourceTypes]
(Int -> ReadS GetSupportedResourceTypes)
-> ReadS [GetSupportedResourceTypes]
-> ReadPrec GetSupportedResourceTypes
-> ReadPrec [GetSupportedResourceTypes]
-> Read GetSupportedResourceTypes
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetSupportedResourceTypes]
$creadListPrec :: ReadPrec [GetSupportedResourceTypes]
readPrec :: ReadPrec GetSupportedResourceTypes
$creadPrec :: ReadPrec GetSupportedResourceTypes
readList :: ReadS [GetSupportedResourceTypes]
$creadList :: ReadS [GetSupportedResourceTypes]
readsPrec :: Int -> ReadS GetSupportedResourceTypes
$creadsPrec :: Int -> ReadS GetSupportedResourceTypes
Prelude.Read, Int -> GetSupportedResourceTypes -> ShowS
[GetSupportedResourceTypes] -> ShowS
GetSupportedResourceTypes -> String
(Int -> GetSupportedResourceTypes -> ShowS)
-> (GetSupportedResourceTypes -> String)
-> ([GetSupportedResourceTypes] -> ShowS)
-> Show GetSupportedResourceTypes
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetSupportedResourceTypes] -> ShowS
$cshowList :: [GetSupportedResourceTypes] -> ShowS
show :: GetSupportedResourceTypes -> String
$cshow :: GetSupportedResourceTypes -> String
showsPrec :: Int -> GetSupportedResourceTypes -> ShowS
$cshowsPrec :: Int -> GetSupportedResourceTypes -> ShowS
Prelude.Show, (forall x.
 GetSupportedResourceTypes -> Rep GetSupportedResourceTypes x)
-> (forall x.
    Rep GetSupportedResourceTypes x -> GetSupportedResourceTypes)
-> Generic GetSupportedResourceTypes
forall x.
Rep GetSupportedResourceTypes x -> GetSupportedResourceTypes
forall x.
GetSupportedResourceTypes -> Rep GetSupportedResourceTypes x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetSupportedResourceTypes x -> GetSupportedResourceTypes
$cfrom :: forall x.
GetSupportedResourceTypes -> Rep GetSupportedResourceTypes x
Prelude.Generic)

-- |
-- Create a value of 'GetSupportedResourceTypes' 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.
newGetSupportedResourceTypes ::
  GetSupportedResourceTypes
newGetSupportedResourceTypes :: GetSupportedResourceTypes
newGetSupportedResourceTypes =
  GetSupportedResourceTypes
GetSupportedResourceTypes'

instance Core.AWSRequest GetSupportedResourceTypes where
  type
    AWSResponse GetSupportedResourceTypes =
      GetSupportedResourceTypesResponse
  request :: GetSupportedResourceTypes -> Request GetSupportedResourceTypes
request = Service
-> GetSupportedResourceTypes -> Request GetSupportedResourceTypes
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
  response :: Logger
-> Service
-> Proxy GetSupportedResourceTypes
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse GetSupportedResourceTypes)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse GetSupportedResourceTypes))
-> Logger
-> Service
-> Proxy GetSupportedResourceTypes
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse GetSupportedResourceTypes)))
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] -> Int -> GetSupportedResourceTypesResponse
GetSupportedResourceTypesResponse'
            (Maybe [Text] -> Int -> GetSupportedResourceTypesResponse)
-> Either String (Maybe [Text])
-> Either String (Int -> GetSupportedResourceTypesResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe (Maybe [Text]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"ResourceTypes" Either String (Maybe (Maybe [Text]))
-> Maybe [Text] -> Either String (Maybe [Text])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [Text]
forall a. Monoid a => a
Prelude.mempty)
            Either String (Int -> GetSupportedResourceTypesResponse)
-> Either String Int
-> Either String GetSupportedResourceTypesResponse
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 GetSupportedResourceTypes

instance Prelude.NFData GetSupportedResourceTypes

instance Core.ToHeaders GetSupportedResourceTypes where
  toHeaders :: GetSupportedResourceTypes -> ResponseHeaders
toHeaders =
    ResponseHeaders -> GetSupportedResourceTypes -> 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.ToPath GetSupportedResourceTypes where
  toPath :: GetSupportedResourceTypes -> ByteString
toPath = ByteString -> GetSupportedResourceTypes -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/supported-resource-types"

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

-- | /See:/ 'newGetSupportedResourceTypesResponse' smart constructor.
data GetSupportedResourceTypesResponse = GetSupportedResourceTypesResponse'
  { -- | Contains a string with the supported Amazon Web Services resource types:
    --
    -- -   @Aurora@ for Amazon Aurora
    --
    -- -   @DynamoDB@ for Amazon DynamoDB
    --
    -- -   @EBS@ for Amazon Elastic Block Store
    --
    -- -   @EC2@ for Amazon Elastic Compute Cloud
    --
    -- -   @EFS@ for Amazon Elastic File System
    --
    -- -   @FSX@ for Amazon FSx
    --
    -- -   @RDS@ for Amazon Relational Database Service
    --
    -- -   @Storage Gateway@ for Storage Gateway
    GetSupportedResourceTypesResponse -> Maybe [Text]
resourceTypes :: Prelude.Maybe [Prelude.Text],
    -- | The response's http status code.
    GetSupportedResourceTypesResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (GetSupportedResourceTypesResponse
-> GetSupportedResourceTypesResponse -> Bool
(GetSupportedResourceTypesResponse
 -> GetSupportedResourceTypesResponse -> Bool)
-> (GetSupportedResourceTypesResponse
    -> GetSupportedResourceTypesResponse -> Bool)
-> Eq GetSupportedResourceTypesResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetSupportedResourceTypesResponse
-> GetSupportedResourceTypesResponse -> Bool
$c/= :: GetSupportedResourceTypesResponse
-> GetSupportedResourceTypesResponse -> Bool
== :: GetSupportedResourceTypesResponse
-> GetSupportedResourceTypesResponse -> Bool
$c== :: GetSupportedResourceTypesResponse
-> GetSupportedResourceTypesResponse -> Bool
Prelude.Eq, ReadPrec [GetSupportedResourceTypesResponse]
ReadPrec GetSupportedResourceTypesResponse
Int -> ReadS GetSupportedResourceTypesResponse
ReadS [GetSupportedResourceTypesResponse]
(Int -> ReadS GetSupportedResourceTypesResponse)
-> ReadS [GetSupportedResourceTypesResponse]
-> ReadPrec GetSupportedResourceTypesResponse
-> ReadPrec [GetSupportedResourceTypesResponse]
-> Read GetSupportedResourceTypesResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetSupportedResourceTypesResponse]
$creadListPrec :: ReadPrec [GetSupportedResourceTypesResponse]
readPrec :: ReadPrec GetSupportedResourceTypesResponse
$creadPrec :: ReadPrec GetSupportedResourceTypesResponse
readList :: ReadS [GetSupportedResourceTypesResponse]
$creadList :: ReadS [GetSupportedResourceTypesResponse]
readsPrec :: Int -> ReadS GetSupportedResourceTypesResponse
$creadsPrec :: Int -> ReadS GetSupportedResourceTypesResponse
Prelude.Read, Int -> GetSupportedResourceTypesResponse -> ShowS
[GetSupportedResourceTypesResponse] -> ShowS
GetSupportedResourceTypesResponse -> String
(Int -> GetSupportedResourceTypesResponse -> ShowS)
-> (GetSupportedResourceTypesResponse -> String)
-> ([GetSupportedResourceTypesResponse] -> ShowS)
-> Show GetSupportedResourceTypesResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetSupportedResourceTypesResponse] -> ShowS
$cshowList :: [GetSupportedResourceTypesResponse] -> ShowS
show :: GetSupportedResourceTypesResponse -> String
$cshow :: GetSupportedResourceTypesResponse -> String
showsPrec :: Int -> GetSupportedResourceTypesResponse -> ShowS
$cshowsPrec :: Int -> GetSupportedResourceTypesResponse -> ShowS
Prelude.Show, (forall x.
 GetSupportedResourceTypesResponse
 -> Rep GetSupportedResourceTypesResponse x)
-> (forall x.
    Rep GetSupportedResourceTypesResponse x
    -> GetSupportedResourceTypesResponse)
-> Generic GetSupportedResourceTypesResponse
forall x.
Rep GetSupportedResourceTypesResponse x
-> GetSupportedResourceTypesResponse
forall x.
GetSupportedResourceTypesResponse
-> Rep GetSupportedResourceTypesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetSupportedResourceTypesResponse x
-> GetSupportedResourceTypesResponse
$cfrom :: forall x.
GetSupportedResourceTypesResponse
-> Rep GetSupportedResourceTypesResponse x
Prelude.Generic)

-- |
-- Create a value of 'GetSupportedResourceTypesResponse' 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:
--
-- 'resourceTypes', 'getSupportedResourceTypesResponse_resourceTypes' - Contains a string with the supported Amazon Web Services resource types:
--
-- -   @Aurora@ for Amazon Aurora
--
-- -   @DynamoDB@ for Amazon DynamoDB
--
-- -   @EBS@ for Amazon Elastic Block Store
--
-- -   @EC2@ for Amazon Elastic Compute Cloud
--
-- -   @EFS@ for Amazon Elastic File System
--
-- -   @FSX@ for Amazon FSx
--
-- -   @RDS@ for Amazon Relational Database Service
--
-- -   @Storage Gateway@ for Storage Gateway
--
-- 'httpStatus', 'getSupportedResourceTypesResponse_httpStatus' - The response's http status code.
newGetSupportedResourceTypesResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  GetSupportedResourceTypesResponse
newGetSupportedResourceTypesResponse :: Int -> GetSupportedResourceTypesResponse
newGetSupportedResourceTypesResponse Int
pHttpStatus_ =
  GetSupportedResourceTypesResponse' :: Maybe [Text] -> Int -> GetSupportedResourceTypesResponse
GetSupportedResourceTypesResponse'
    { $sel:resourceTypes:GetSupportedResourceTypesResponse' :: Maybe [Text]
resourceTypes =
        Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:GetSupportedResourceTypesResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | Contains a string with the supported Amazon Web Services resource types:
--
-- -   @Aurora@ for Amazon Aurora
--
-- -   @DynamoDB@ for Amazon DynamoDB
--
-- -   @EBS@ for Amazon Elastic Block Store
--
-- -   @EC2@ for Amazon Elastic Compute Cloud
--
-- -   @EFS@ for Amazon Elastic File System
--
-- -   @FSX@ for Amazon FSx
--
-- -   @RDS@ for Amazon Relational Database Service
--
-- -   @Storage Gateway@ for Storage Gateway
getSupportedResourceTypesResponse_resourceTypes :: Lens.Lens' GetSupportedResourceTypesResponse (Prelude.Maybe [Prelude.Text])
getSupportedResourceTypesResponse_resourceTypes :: (Maybe [Text] -> f (Maybe [Text]))
-> GetSupportedResourceTypesResponse
-> f GetSupportedResourceTypesResponse
getSupportedResourceTypesResponse_resourceTypes = (GetSupportedResourceTypesResponse -> Maybe [Text])
-> (GetSupportedResourceTypesResponse
    -> Maybe [Text] -> GetSupportedResourceTypesResponse)
-> Lens
     GetSupportedResourceTypesResponse
     GetSupportedResourceTypesResponse
     (Maybe [Text])
     (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetSupportedResourceTypesResponse' {Maybe [Text]
resourceTypes :: Maybe [Text]
$sel:resourceTypes:GetSupportedResourceTypesResponse' :: GetSupportedResourceTypesResponse -> Maybe [Text]
resourceTypes} -> Maybe [Text]
resourceTypes) (\s :: GetSupportedResourceTypesResponse
s@GetSupportedResourceTypesResponse' {} Maybe [Text]
a -> GetSupportedResourceTypesResponse
s {$sel:resourceTypes:GetSupportedResourceTypesResponse' :: Maybe [Text]
resourceTypes = Maybe [Text]
a} :: GetSupportedResourceTypesResponse) ((Maybe [Text] -> f (Maybe [Text]))
 -> GetSupportedResourceTypesResponse
 -> f GetSupportedResourceTypesResponse)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> GetSupportedResourceTypesResponse
-> f GetSupportedResourceTypesResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance
  Prelude.NFData
    GetSupportedResourceTypesResponse