{-# 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.RDS.DescribeSourceRegions
-- 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 a list of the source Amazon Web Services Regions where the
-- current Amazon Web Services Region can create a read replica, copy a DB
-- snapshot from, or replicate automated backups from. This API action
-- supports pagination.
--
-- This operation returns paginated results.
module Amazonka.RDS.DescribeSourceRegions
  ( -- * Creating a Request
    DescribeSourceRegions (..),
    newDescribeSourceRegions,

    -- * Request Lenses
    describeSourceRegions_regionName,
    describeSourceRegions_filters,
    describeSourceRegions_marker,
    describeSourceRegions_maxRecords,

    -- * Destructuring the Response
    DescribeSourceRegionsResponse (..),
    newDescribeSourceRegionsResponse,

    -- * Response Lenses
    describeSourceRegionsResponse_marker,
    describeSourceRegionsResponse_sourceRegions,
    describeSourceRegionsResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.RDS.Types
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- |
--
-- /See:/ 'newDescribeSourceRegions' smart constructor.
data DescribeSourceRegions = DescribeSourceRegions'
  { -- | The source Amazon Web Services Region name. For example, @us-east-1@.
    --
    -- Constraints:
    --
    -- -   Must specify a valid Amazon Web Services Region name.
    DescribeSourceRegions -> Maybe Text
regionName :: Prelude.Maybe Prelude.Text,
    -- | This parameter isn\'t currently supported.
    DescribeSourceRegions -> Maybe [Filter]
filters :: Prelude.Maybe [Filter],
    -- | An optional pagination token provided by a previous
    -- @DescribeSourceRegions@ request. If this parameter is specified, the
    -- response includes only records beyond the marker, up to the value
    -- specified by @MaxRecords@.
    DescribeSourceRegions -> Maybe Text
marker :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of records to include in the response. If more
    -- records exist than the specified @MaxRecords@ value, a pagination token
    -- called a marker is included in the response so you can retrieve the
    -- remaining results.
    --
    -- Default: 100
    --
    -- Constraints: Minimum 20, maximum 100.
    DescribeSourceRegions -> Maybe Int
maxRecords :: Prelude.Maybe Prelude.Int
  }
  deriving (DescribeSourceRegions -> DescribeSourceRegions -> Bool
(DescribeSourceRegions -> DescribeSourceRegions -> Bool)
-> (DescribeSourceRegions -> DescribeSourceRegions -> Bool)
-> Eq DescribeSourceRegions
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeSourceRegions -> DescribeSourceRegions -> Bool
$c/= :: DescribeSourceRegions -> DescribeSourceRegions -> Bool
== :: DescribeSourceRegions -> DescribeSourceRegions -> Bool
$c== :: DescribeSourceRegions -> DescribeSourceRegions -> Bool
Prelude.Eq, ReadPrec [DescribeSourceRegions]
ReadPrec DescribeSourceRegions
Int -> ReadS DescribeSourceRegions
ReadS [DescribeSourceRegions]
(Int -> ReadS DescribeSourceRegions)
-> ReadS [DescribeSourceRegions]
-> ReadPrec DescribeSourceRegions
-> ReadPrec [DescribeSourceRegions]
-> Read DescribeSourceRegions
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeSourceRegions]
$creadListPrec :: ReadPrec [DescribeSourceRegions]
readPrec :: ReadPrec DescribeSourceRegions
$creadPrec :: ReadPrec DescribeSourceRegions
readList :: ReadS [DescribeSourceRegions]
$creadList :: ReadS [DescribeSourceRegions]
readsPrec :: Int -> ReadS DescribeSourceRegions
$creadsPrec :: Int -> ReadS DescribeSourceRegions
Prelude.Read, Int -> DescribeSourceRegions -> ShowS
[DescribeSourceRegions] -> ShowS
DescribeSourceRegions -> String
(Int -> DescribeSourceRegions -> ShowS)
-> (DescribeSourceRegions -> String)
-> ([DescribeSourceRegions] -> ShowS)
-> Show DescribeSourceRegions
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeSourceRegions] -> ShowS
$cshowList :: [DescribeSourceRegions] -> ShowS
show :: DescribeSourceRegions -> String
$cshow :: DescribeSourceRegions -> String
showsPrec :: Int -> DescribeSourceRegions -> ShowS
$cshowsPrec :: Int -> DescribeSourceRegions -> ShowS
Prelude.Show, (forall x. DescribeSourceRegions -> Rep DescribeSourceRegions x)
-> (forall x. Rep DescribeSourceRegions x -> DescribeSourceRegions)
-> Generic DescribeSourceRegions
forall x. Rep DescribeSourceRegions x -> DescribeSourceRegions
forall x. DescribeSourceRegions -> Rep DescribeSourceRegions x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeSourceRegions x -> DescribeSourceRegions
$cfrom :: forall x. DescribeSourceRegions -> Rep DescribeSourceRegions x
Prelude.Generic)

-- |
-- Create a value of 'DescribeSourceRegions' 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:
--
-- 'regionName', 'describeSourceRegions_regionName' - The source Amazon Web Services Region name. For example, @us-east-1@.
--
-- Constraints:
--
-- -   Must specify a valid Amazon Web Services Region name.
--
-- 'filters', 'describeSourceRegions_filters' - This parameter isn\'t currently supported.
--
-- 'marker', 'describeSourceRegions_marker' - An optional pagination token provided by a previous
-- @DescribeSourceRegions@ request. If this parameter is specified, the
-- response includes only records beyond the marker, up to the value
-- specified by @MaxRecords@.
--
-- 'maxRecords', 'describeSourceRegions_maxRecords' - The maximum number of records to include in the response. If more
-- records exist than the specified @MaxRecords@ value, a pagination token
-- called a marker is included in the response so you can retrieve the
-- remaining results.
--
-- Default: 100
--
-- Constraints: Minimum 20, maximum 100.
newDescribeSourceRegions ::
  DescribeSourceRegions
newDescribeSourceRegions :: DescribeSourceRegions
newDescribeSourceRegions =
  DescribeSourceRegions' :: Maybe Text
-> Maybe [Filter]
-> Maybe Text
-> Maybe Int
-> DescribeSourceRegions
DescribeSourceRegions'
    { $sel:regionName:DescribeSourceRegions' :: Maybe Text
regionName =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:filters:DescribeSourceRegions' :: Maybe [Filter]
filters = Maybe [Filter]
forall a. Maybe a
Prelude.Nothing,
      $sel:marker:DescribeSourceRegions' :: Maybe Text
marker = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxRecords:DescribeSourceRegions' :: Maybe Int
maxRecords = Maybe Int
forall a. Maybe a
Prelude.Nothing
    }

-- | The source Amazon Web Services Region name. For example, @us-east-1@.
--
-- Constraints:
--
-- -   Must specify a valid Amazon Web Services Region name.
describeSourceRegions_regionName :: Lens.Lens' DescribeSourceRegions (Prelude.Maybe Prelude.Text)
describeSourceRegions_regionName :: (Maybe Text -> f (Maybe Text))
-> DescribeSourceRegions -> f DescribeSourceRegions
describeSourceRegions_regionName = (DescribeSourceRegions -> Maybe Text)
-> (DescribeSourceRegions -> Maybe Text -> DescribeSourceRegions)
-> Lens
     DescribeSourceRegions
     DescribeSourceRegions
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeSourceRegions' {Maybe Text
regionName :: Maybe Text
$sel:regionName:DescribeSourceRegions' :: DescribeSourceRegions -> Maybe Text
regionName} -> Maybe Text
regionName) (\s :: DescribeSourceRegions
s@DescribeSourceRegions' {} Maybe Text
a -> DescribeSourceRegions
s {$sel:regionName:DescribeSourceRegions' :: Maybe Text
regionName = Maybe Text
a} :: DescribeSourceRegions)

-- | This parameter isn\'t currently supported.
describeSourceRegions_filters :: Lens.Lens' DescribeSourceRegions (Prelude.Maybe [Filter])
describeSourceRegions_filters :: (Maybe [Filter] -> f (Maybe [Filter]))
-> DescribeSourceRegions -> f DescribeSourceRegions
describeSourceRegions_filters = (DescribeSourceRegions -> Maybe [Filter])
-> (DescribeSourceRegions
    -> Maybe [Filter] -> DescribeSourceRegions)
-> Lens
     DescribeSourceRegions
     DescribeSourceRegions
     (Maybe [Filter])
     (Maybe [Filter])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeSourceRegions' {Maybe [Filter]
filters :: Maybe [Filter]
$sel:filters:DescribeSourceRegions' :: DescribeSourceRegions -> Maybe [Filter]
filters} -> Maybe [Filter]
filters) (\s :: DescribeSourceRegions
s@DescribeSourceRegions' {} Maybe [Filter]
a -> DescribeSourceRegions
s {$sel:filters:DescribeSourceRegions' :: Maybe [Filter]
filters = Maybe [Filter]
a} :: DescribeSourceRegions) ((Maybe [Filter] -> f (Maybe [Filter]))
 -> DescribeSourceRegions -> f DescribeSourceRegions)
-> ((Maybe [Filter] -> f (Maybe [Filter]))
    -> Maybe [Filter] -> f (Maybe [Filter]))
-> (Maybe [Filter] -> f (Maybe [Filter]))
-> DescribeSourceRegions
-> f DescribeSourceRegions
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Filter] [Filter] [Filter] [Filter]
-> Iso
     (Maybe [Filter]) (Maybe [Filter]) (Maybe [Filter]) (Maybe [Filter])
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 [Filter] [Filter] [Filter] [Filter]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | An optional pagination token provided by a previous
-- @DescribeSourceRegions@ request. If this parameter is specified, the
-- response includes only records beyond the marker, up to the value
-- specified by @MaxRecords@.
describeSourceRegions_marker :: Lens.Lens' DescribeSourceRegions (Prelude.Maybe Prelude.Text)
describeSourceRegions_marker :: (Maybe Text -> f (Maybe Text))
-> DescribeSourceRegions -> f DescribeSourceRegions
describeSourceRegions_marker = (DescribeSourceRegions -> Maybe Text)
-> (DescribeSourceRegions -> Maybe Text -> DescribeSourceRegions)
-> Lens
     DescribeSourceRegions
     DescribeSourceRegions
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeSourceRegions' {Maybe Text
marker :: Maybe Text
$sel:marker:DescribeSourceRegions' :: DescribeSourceRegions -> Maybe Text
marker} -> Maybe Text
marker) (\s :: DescribeSourceRegions
s@DescribeSourceRegions' {} Maybe Text
a -> DescribeSourceRegions
s {$sel:marker:DescribeSourceRegions' :: Maybe Text
marker = Maybe Text
a} :: DescribeSourceRegions)

-- | The maximum number of records to include in the response. If more
-- records exist than the specified @MaxRecords@ value, a pagination token
-- called a marker is included in the response so you can retrieve the
-- remaining results.
--
-- Default: 100
--
-- Constraints: Minimum 20, maximum 100.
describeSourceRegions_maxRecords :: Lens.Lens' DescribeSourceRegions (Prelude.Maybe Prelude.Int)
describeSourceRegions_maxRecords :: (Maybe Int -> f (Maybe Int))
-> DescribeSourceRegions -> f DescribeSourceRegions
describeSourceRegions_maxRecords = (DescribeSourceRegions -> Maybe Int)
-> (DescribeSourceRegions -> Maybe Int -> DescribeSourceRegions)
-> Lens
     DescribeSourceRegions DescribeSourceRegions (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeSourceRegions' {Maybe Int
maxRecords :: Maybe Int
$sel:maxRecords:DescribeSourceRegions' :: DescribeSourceRegions -> Maybe Int
maxRecords} -> Maybe Int
maxRecords) (\s :: DescribeSourceRegions
s@DescribeSourceRegions' {} Maybe Int
a -> DescribeSourceRegions
s {$sel:maxRecords:DescribeSourceRegions' :: Maybe Int
maxRecords = Maybe Int
a} :: DescribeSourceRegions)

instance Core.AWSPager DescribeSourceRegions where
  page :: DescribeSourceRegions
-> AWSResponse DescribeSourceRegions -> Maybe DescribeSourceRegions
page DescribeSourceRegions
rq AWSResponse DescribeSourceRegions
rs
    | Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse DescribeSourceRegions
DescribeSourceRegionsResponse
rs
            DescribeSourceRegionsResponse
-> Getting (First Text) DescribeSourceRegionsResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> DescribeSourceRegionsResponse
-> Const (First Text) DescribeSourceRegionsResponse
Lens' DescribeSourceRegionsResponse (Maybe Text)
describeSourceRegionsResponse_marker
              ((Maybe Text -> Const (First Text) (Maybe Text))
 -> DescribeSourceRegionsResponse
 -> Const (First Text) DescribeSourceRegionsResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) DescribeSourceRegionsResponse Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
      Maybe DescribeSourceRegions
forall a. Maybe a
Prelude.Nothing
    | Maybe [SourceRegion] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse DescribeSourceRegions
DescribeSourceRegionsResponse
rs
            DescribeSourceRegionsResponse
-> Getting
     (First [SourceRegion]) DescribeSourceRegionsResponse [SourceRegion]
-> Maybe [SourceRegion]
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe [SourceRegion]
 -> Const (First [SourceRegion]) (Maybe [SourceRegion]))
-> DescribeSourceRegionsResponse
-> Const (First [SourceRegion]) DescribeSourceRegionsResponse
Lens' DescribeSourceRegionsResponse (Maybe [SourceRegion])
describeSourceRegionsResponse_sourceRegions
              ((Maybe [SourceRegion]
  -> Const (First [SourceRegion]) (Maybe [SourceRegion]))
 -> DescribeSourceRegionsResponse
 -> Const (First [SourceRegion]) DescribeSourceRegionsResponse)
-> (([SourceRegion] -> Const (First [SourceRegion]) [SourceRegion])
    -> Maybe [SourceRegion]
    -> Const (First [SourceRegion]) (Maybe [SourceRegion]))
-> Getting
     (First [SourceRegion]) DescribeSourceRegionsResponse [SourceRegion]
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([SourceRegion] -> Const (First [SourceRegion]) [SourceRegion])
-> Maybe [SourceRegion]
-> Const (First [SourceRegion]) (Maybe [SourceRegion])
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
      Maybe DescribeSourceRegions
forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
      DescribeSourceRegions -> Maybe DescribeSourceRegions
forall a. a -> Maybe a
Prelude.Just (DescribeSourceRegions -> Maybe DescribeSourceRegions)
-> DescribeSourceRegions -> Maybe DescribeSourceRegions
forall a b. (a -> b) -> a -> b
Prelude.$
        DescribeSourceRegions
rq
          DescribeSourceRegions
-> (DescribeSourceRegions -> DescribeSourceRegions)
-> DescribeSourceRegions
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> DescribeSourceRegions -> Identity DescribeSourceRegions
Lens
  DescribeSourceRegions
  DescribeSourceRegions
  (Maybe Text)
  (Maybe Text)
describeSourceRegions_marker
          ((Maybe Text -> Identity (Maybe Text))
 -> DescribeSourceRegions -> Identity DescribeSourceRegions)
-> Maybe Text -> DescribeSourceRegions -> DescribeSourceRegions
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse DescribeSourceRegions
DescribeSourceRegionsResponse
rs
          DescribeSourceRegionsResponse
-> Getting (First Text) DescribeSourceRegionsResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> DescribeSourceRegionsResponse
-> Const (First Text) DescribeSourceRegionsResponse
Lens' DescribeSourceRegionsResponse (Maybe Text)
describeSourceRegionsResponse_marker
            ((Maybe Text -> Const (First Text) (Maybe Text))
 -> DescribeSourceRegionsResponse
 -> Const (First Text) DescribeSourceRegionsResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) DescribeSourceRegionsResponse Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just

instance Core.AWSRequest DescribeSourceRegions where
  type
    AWSResponse DescribeSourceRegions =
      DescribeSourceRegionsResponse
  request :: DescribeSourceRegions -> Request DescribeSourceRegions
request = Service -> DescribeSourceRegions -> Request DescribeSourceRegions
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery Service
defaultService
  response :: Logger
-> Service
-> Proxy DescribeSourceRegions
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeSourceRegions)))
response =
    Text
-> (Int
    -> ResponseHeaders
    -> [Node]
    -> Either String (AWSResponse DescribeSourceRegions))
-> Logger
-> Service
-> Proxy DescribeSourceRegions
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeSourceRegions)))
forall (m :: * -> *) a.
MonadResource m =>
Text
-> (Int
    -> ResponseHeaders -> [Node] -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveXMLWrapper
      Text
"DescribeSourceRegionsResult"
      ( \Int
s ResponseHeaders
h [Node]
x ->
          Maybe Text
-> Maybe [SourceRegion] -> Int -> DescribeSourceRegionsResponse
DescribeSourceRegionsResponse'
            (Maybe Text
 -> Maybe [SourceRegion] -> Int -> DescribeSourceRegionsResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe [SourceRegion] -> Int -> DescribeSourceRegionsResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"Marker")
            Either
  String
  (Maybe [SourceRegion] -> Int -> DescribeSourceRegionsResponse)
-> Either String (Maybe [SourceRegion])
-> Either String (Int -> DescribeSourceRegionsResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( [Node]
x [Node] -> Text -> Either String (Maybe [Node])
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"SourceRegions" Either String (Maybe [Node]) -> [Node] -> Either String [Node]
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ [Node]
forall a. Monoid a => a
Prelude.mempty
                            Either String [Node]
-> ([Node] -> Either String (Maybe [SourceRegion]))
-> Either String (Maybe [SourceRegion])
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= ([Node] -> Either String [SourceRegion])
-> [Node] -> Either String (Maybe [SourceRegion])
forall (f :: * -> *) a b.
Applicative f =>
([a] -> f b) -> [a] -> f (Maybe b)
Core.may (Text -> [Node] -> Either String [SourceRegion]
forall a. FromXML a => Text -> [Node] -> Either String [a]
Core.parseXMLList Text
"SourceRegion")
                        )
            Either String (Int -> DescribeSourceRegionsResponse)
-> Either String Int -> Either String DescribeSourceRegionsResponse
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 DescribeSourceRegions

instance Prelude.NFData DescribeSourceRegions

instance Core.ToHeaders DescribeSourceRegions where
  toHeaders :: DescribeSourceRegions -> ResponseHeaders
toHeaders = ResponseHeaders -> DescribeSourceRegions -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty

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

instance Core.ToQuery DescribeSourceRegions where
  toQuery :: DescribeSourceRegions -> QueryString
toQuery DescribeSourceRegions' {Maybe Int
Maybe [Filter]
Maybe Text
maxRecords :: Maybe Int
marker :: Maybe Text
filters :: Maybe [Filter]
regionName :: Maybe Text
$sel:maxRecords:DescribeSourceRegions' :: DescribeSourceRegions -> Maybe Int
$sel:marker:DescribeSourceRegions' :: DescribeSourceRegions -> Maybe Text
$sel:filters:DescribeSourceRegions' :: DescribeSourceRegions -> Maybe [Filter]
$sel:regionName:DescribeSourceRegions' :: DescribeSourceRegions -> Maybe Text
..} =
    [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"Action"
          ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"DescribeSourceRegions" :: Prelude.ByteString),
        ByteString
"Version"
          ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"2014-10-31" :: Prelude.ByteString),
        ByteString
"RegionName" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
regionName,
        ByteString
"Filters"
          ByteString -> QueryString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe QueryString -> QueryString
forall a. ToQuery a => a -> QueryString
Core.toQuery
            (ByteString -> [Filter] -> QueryString
forall a.
(IsList a, ToQuery (Item a)) =>
ByteString -> a -> QueryString
Core.toQueryList ByteString
"Filter" ([Filter] -> QueryString) -> Maybe [Filter] -> Maybe QueryString
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Filter]
filters),
        ByteString
"Marker" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
marker,
        ByteString
"MaxRecords" ByteString -> Maybe Int -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Int
maxRecords
      ]

-- | Contains the result of a successful invocation of the
-- @DescribeSourceRegions@ action.
--
-- /See:/ 'newDescribeSourceRegionsResponse' smart constructor.
data DescribeSourceRegionsResponse = DescribeSourceRegionsResponse'
  { -- | An optional pagination token provided by a previous request. If this
    -- parameter is specified, the response includes only records beyond the
    -- marker, up to the value specified by @MaxRecords@.
    DescribeSourceRegionsResponse -> Maybe Text
marker :: Prelude.Maybe Prelude.Text,
    -- | A list of SourceRegion instances that contains each source Amazon Web
    -- Services Region that the current Amazon Web Services Region can get a
    -- read replica or a DB snapshot from.
    DescribeSourceRegionsResponse -> Maybe [SourceRegion]
sourceRegions :: Prelude.Maybe [SourceRegion],
    -- | The response's http status code.
    DescribeSourceRegionsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DescribeSourceRegionsResponse
-> DescribeSourceRegionsResponse -> Bool
(DescribeSourceRegionsResponse
 -> DescribeSourceRegionsResponse -> Bool)
-> (DescribeSourceRegionsResponse
    -> DescribeSourceRegionsResponse -> Bool)
-> Eq DescribeSourceRegionsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeSourceRegionsResponse
-> DescribeSourceRegionsResponse -> Bool
$c/= :: DescribeSourceRegionsResponse
-> DescribeSourceRegionsResponse -> Bool
== :: DescribeSourceRegionsResponse
-> DescribeSourceRegionsResponse -> Bool
$c== :: DescribeSourceRegionsResponse
-> DescribeSourceRegionsResponse -> Bool
Prelude.Eq, ReadPrec [DescribeSourceRegionsResponse]
ReadPrec DescribeSourceRegionsResponse
Int -> ReadS DescribeSourceRegionsResponse
ReadS [DescribeSourceRegionsResponse]
(Int -> ReadS DescribeSourceRegionsResponse)
-> ReadS [DescribeSourceRegionsResponse]
-> ReadPrec DescribeSourceRegionsResponse
-> ReadPrec [DescribeSourceRegionsResponse]
-> Read DescribeSourceRegionsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeSourceRegionsResponse]
$creadListPrec :: ReadPrec [DescribeSourceRegionsResponse]
readPrec :: ReadPrec DescribeSourceRegionsResponse
$creadPrec :: ReadPrec DescribeSourceRegionsResponse
readList :: ReadS [DescribeSourceRegionsResponse]
$creadList :: ReadS [DescribeSourceRegionsResponse]
readsPrec :: Int -> ReadS DescribeSourceRegionsResponse
$creadsPrec :: Int -> ReadS DescribeSourceRegionsResponse
Prelude.Read, Int -> DescribeSourceRegionsResponse -> ShowS
[DescribeSourceRegionsResponse] -> ShowS
DescribeSourceRegionsResponse -> String
(Int -> DescribeSourceRegionsResponse -> ShowS)
-> (DescribeSourceRegionsResponse -> String)
-> ([DescribeSourceRegionsResponse] -> ShowS)
-> Show DescribeSourceRegionsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeSourceRegionsResponse] -> ShowS
$cshowList :: [DescribeSourceRegionsResponse] -> ShowS
show :: DescribeSourceRegionsResponse -> String
$cshow :: DescribeSourceRegionsResponse -> String
showsPrec :: Int -> DescribeSourceRegionsResponse -> ShowS
$cshowsPrec :: Int -> DescribeSourceRegionsResponse -> ShowS
Prelude.Show, (forall x.
 DescribeSourceRegionsResponse
 -> Rep DescribeSourceRegionsResponse x)
-> (forall x.
    Rep DescribeSourceRegionsResponse x
    -> DescribeSourceRegionsResponse)
-> Generic DescribeSourceRegionsResponse
forall x.
Rep DescribeSourceRegionsResponse x
-> DescribeSourceRegionsResponse
forall x.
DescribeSourceRegionsResponse
-> Rep DescribeSourceRegionsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeSourceRegionsResponse x
-> DescribeSourceRegionsResponse
$cfrom :: forall x.
DescribeSourceRegionsResponse
-> Rep DescribeSourceRegionsResponse x
Prelude.Generic)

-- |
-- Create a value of 'DescribeSourceRegionsResponse' 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:
--
-- 'marker', 'describeSourceRegionsResponse_marker' - An optional pagination token provided by a previous request. If this
-- parameter is specified, the response includes only records beyond the
-- marker, up to the value specified by @MaxRecords@.
--
-- 'sourceRegions', 'describeSourceRegionsResponse_sourceRegions' - A list of SourceRegion instances that contains each source Amazon Web
-- Services Region that the current Amazon Web Services Region can get a
-- read replica or a DB snapshot from.
--
-- 'httpStatus', 'describeSourceRegionsResponse_httpStatus' - The response's http status code.
newDescribeSourceRegionsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DescribeSourceRegionsResponse
newDescribeSourceRegionsResponse :: Int -> DescribeSourceRegionsResponse
newDescribeSourceRegionsResponse Int
pHttpStatus_ =
  DescribeSourceRegionsResponse' :: Maybe Text
-> Maybe [SourceRegion] -> Int -> DescribeSourceRegionsResponse
DescribeSourceRegionsResponse'
    { $sel:marker:DescribeSourceRegionsResponse' :: Maybe Text
marker =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:sourceRegions:DescribeSourceRegionsResponse' :: Maybe [SourceRegion]
sourceRegions = Maybe [SourceRegion]
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DescribeSourceRegionsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | An optional pagination token provided by a previous request. If this
-- parameter is specified, the response includes only records beyond the
-- marker, up to the value specified by @MaxRecords@.
describeSourceRegionsResponse_marker :: Lens.Lens' DescribeSourceRegionsResponse (Prelude.Maybe Prelude.Text)
describeSourceRegionsResponse_marker :: (Maybe Text -> f (Maybe Text))
-> DescribeSourceRegionsResponse -> f DescribeSourceRegionsResponse
describeSourceRegionsResponse_marker = (DescribeSourceRegionsResponse -> Maybe Text)
-> (DescribeSourceRegionsResponse
    -> Maybe Text -> DescribeSourceRegionsResponse)
-> Lens' DescribeSourceRegionsResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeSourceRegionsResponse' {Maybe Text
marker :: Maybe Text
$sel:marker:DescribeSourceRegionsResponse' :: DescribeSourceRegionsResponse -> Maybe Text
marker} -> Maybe Text
marker) (\s :: DescribeSourceRegionsResponse
s@DescribeSourceRegionsResponse' {} Maybe Text
a -> DescribeSourceRegionsResponse
s {$sel:marker:DescribeSourceRegionsResponse' :: Maybe Text
marker = Maybe Text
a} :: DescribeSourceRegionsResponse)

-- | A list of SourceRegion instances that contains each source Amazon Web
-- Services Region that the current Amazon Web Services Region can get a
-- read replica or a DB snapshot from.
describeSourceRegionsResponse_sourceRegions :: Lens.Lens' DescribeSourceRegionsResponse (Prelude.Maybe [SourceRegion])
describeSourceRegionsResponse_sourceRegions :: (Maybe [SourceRegion] -> f (Maybe [SourceRegion]))
-> DescribeSourceRegionsResponse -> f DescribeSourceRegionsResponse
describeSourceRegionsResponse_sourceRegions = (DescribeSourceRegionsResponse -> Maybe [SourceRegion])
-> (DescribeSourceRegionsResponse
    -> Maybe [SourceRegion] -> DescribeSourceRegionsResponse)
-> Lens' DescribeSourceRegionsResponse (Maybe [SourceRegion])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeSourceRegionsResponse' {Maybe [SourceRegion]
sourceRegions :: Maybe [SourceRegion]
$sel:sourceRegions:DescribeSourceRegionsResponse' :: DescribeSourceRegionsResponse -> Maybe [SourceRegion]
sourceRegions} -> Maybe [SourceRegion]
sourceRegions) (\s :: DescribeSourceRegionsResponse
s@DescribeSourceRegionsResponse' {} Maybe [SourceRegion]
a -> DescribeSourceRegionsResponse
s {$sel:sourceRegions:DescribeSourceRegionsResponse' :: Maybe [SourceRegion]
sourceRegions = Maybe [SourceRegion]
a} :: DescribeSourceRegionsResponse) ((Maybe [SourceRegion] -> f (Maybe [SourceRegion]))
 -> DescribeSourceRegionsResponse
 -> f DescribeSourceRegionsResponse)
-> ((Maybe [SourceRegion] -> f (Maybe [SourceRegion]))
    -> Maybe [SourceRegion] -> f (Maybe [SourceRegion]))
-> (Maybe [SourceRegion] -> f (Maybe [SourceRegion]))
-> DescribeSourceRegionsResponse
-> f DescribeSourceRegionsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [SourceRegion] [SourceRegion] [SourceRegion] [SourceRegion]
-> Iso
     (Maybe [SourceRegion])
     (Maybe [SourceRegion])
     (Maybe [SourceRegion])
     (Maybe [SourceRegion])
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 [SourceRegion] [SourceRegion] [SourceRegion] [SourceRegion]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance Prelude.NFData DescribeSourceRegionsResponse