{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- 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.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

-- | /See:/ 'newGetSupportedResourceTypes' smart constructor.
data GetSupportedResourceTypes = GetSupportedResourceTypes'
  {
  }
  deriving (GetSupportedResourceTypes -> GetSupportedResourceTypes -> Bool
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]
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
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.
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 :: (Service -> Service)
-> GetSupportedResourceTypes -> Request GetSupportedResourceTypes
request Service -> Service
overrides =
    forall a. ToRequest a => Service -> a -> Request a
Request.get (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy GetSupportedResourceTypes
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse GetSupportedResourceTypes)))
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] -> Int -> GetSupportedResourceTypesResponse
GetSupportedResourceTypesResponse'
            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
"ResourceTypes" forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty)
            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 GetSupportedResourceTypes where
  hashWithSalt :: Int -> GetSupportedResourceTypes -> Int
hashWithSalt Int
_salt GetSupportedResourceTypes
_ =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` ()

instance Prelude.NFData GetSupportedResourceTypes where
  rnf :: GetSupportedResourceTypes -> ()
rnf GetSupportedResourceTypes
_ = ()

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

instance Data.ToQuery GetSupportedResourceTypes where
  toQuery :: GetSupportedResourceTypes -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const 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
    --
    -- -   @DocDB@ for Amazon DocumentDB (with MongoDB compatibility)
    --
    -- -   @Neptune@ for Amazon Neptune
    GetSupportedResourceTypesResponse -> Maybe [Text]
resourceTypes :: Prelude.Maybe [Prelude.Text],
    -- | The response's http status code.
    GetSupportedResourceTypesResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (GetSupportedResourceTypesResponse
-> GetSupportedResourceTypesResponse -> Bool
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]
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
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.
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
--
-- -   @DocDB@ for Amazon DocumentDB (with MongoDB compatibility)
--
-- -   @Neptune@ for Amazon Neptune
--
-- 'httpStatus', 'getSupportedResourceTypesResponse_httpStatus' - The response's http status code.
newGetSupportedResourceTypesResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  GetSupportedResourceTypesResponse
newGetSupportedResourceTypesResponse :: Int -> GetSupportedResourceTypesResponse
newGetSupportedResourceTypesResponse Int
pHttpStatus_ =
  GetSupportedResourceTypesResponse'
    { $sel:resourceTypes:GetSupportedResourceTypesResponse' :: Maybe [Text]
resourceTypes =
        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
--
-- -   @DocDB@ for Amazon DocumentDB (with MongoDB compatibility)
--
-- -   @Neptune@ for Amazon Neptune
getSupportedResourceTypesResponse_resourceTypes :: Lens.Lens' GetSupportedResourceTypesResponse (Prelude.Maybe [Prelude.Text])
getSupportedResourceTypesResponse_resourceTypes :: Lens' GetSupportedResourceTypesResponse (Maybe [Text])
getSupportedResourceTypesResponse_resourceTypes = 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) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 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 :: Lens' GetSupportedResourceTypesResponse Int
getSupportedResourceTypesResponse_httpStatus = 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
  where
  rnf :: GetSupportedResourceTypesResponse -> ()
rnf GetSupportedResourceTypesResponse' {Int
Maybe [Text]
httpStatus :: Int
resourceTypes :: Maybe [Text]
$sel:httpStatus:GetSupportedResourceTypesResponse' :: GetSupportedResourceTypesResponse -> Int
$sel:resourceTypes:GetSupportedResourceTypesResponse' :: GetSupportedResourceTypesResponse -> Maybe [Text]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [Text]
resourceTypes
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus