{-# 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.Redshift.DescribeClusterVersions
-- 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 descriptions of the available Amazon Redshift cluster versions.
-- You can call this operation even before creating any clusters to learn
-- more about the Amazon Redshift versions. For more information about
-- managing clusters, go to
-- <https://docs.aws.amazon.com/redshift/latest/mgmt/working-with-clusters.html Amazon Redshift Clusters>
-- in the /Amazon Redshift Cluster Management Guide/.
--
-- This operation returns paginated results.
module Amazonka.Redshift.DescribeClusterVersions
  ( -- * Creating a Request
    DescribeClusterVersions (..),
    newDescribeClusterVersions,

    -- * Request Lenses
    describeClusterVersions_clusterParameterGroupFamily,
    describeClusterVersions_marker,
    describeClusterVersions_maxRecords,
    describeClusterVersions_clusterVersion,

    -- * Destructuring the Response
    DescribeClusterVersionsResponse (..),
    newDescribeClusterVersionsResponse,

    -- * Response Lenses
    describeClusterVersionsResponse_clusterVersions,
    describeClusterVersionsResponse_marker,
    describeClusterVersionsResponse_httpStatus,
  )
where

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

-- |
--
-- /See:/ 'newDescribeClusterVersions' smart constructor.
data DescribeClusterVersions = DescribeClusterVersions'
  { -- | The name of a specific cluster parameter group family to return details
    -- for.
    --
    -- Constraints:
    --
    -- -   Must be 1 to 255 alphanumeric characters
    --
    -- -   First character must be a letter
    --
    -- -   Cannot end with a hyphen or contain two consecutive hyphens
    DescribeClusterVersions -> Maybe Text
clusterParameterGroupFamily :: Prelude.Maybe Prelude.Text,
    -- | An optional parameter that specifies the starting point to return a set
    -- of response records. When the results of a DescribeClusterVersions
    -- request exceed the value specified in @MaxRecords@, Amazon Web Services
    -- returns a value in the @Marker@ field of the response. You can retrieve
    -- the next set of response records by providing the returned marker value
    -- in the @Marker@ parameter and retrying the request.
    DescribeClusterVersions -> Maybe Text
marker :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of response records to return in each call. If the
    -- number of remaining response records exceeds the specified @MaxRecords@
    -- value, a value is returned in a @marker@ field of the response. You can
    -- retrieve the next set of records by retrying the command with the
    -- returned marker value.
    --
    -- Default: @100@
    --
    -- Constraints: minimum 20, maximum 100.
    DescribeClusterVersions -> Maybe Int
maxRecords :: Prelude.Maybe Prelude.Int,
    -- | The specific cluster version to return.
    --
    -- Example: @1.0@
    DescribeClusterVersions -> Maybe Text
clusterVersion :: Prelude.Maybe Prelude.Text
  }
  deriving (DescribeClusterVersions -> DescribeClusterVersions -> Bool
(DescribeClusterVersions -> DescribeClusterVersions -> Bool)
-> (DescribeClusterVersions -> DescribeClusterVersions -> Bool)
-> Eq DescribeClusterVersions
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeClusterVersions -> DescribeClusterVersions -> Bool
$c/= :: DescribeClusterVersions -> DescribeClusterVersions -> Bool
== :: DescribeClusterVersions -> DescribeClusterVersions -> Bool
$c== :: DescribeClusterVersions -> DescribeClusterVersions -> Bool
Prelude.Eq, ReadPrec [DescribeClusterVersions]
ReadPrec DescribeClusterVersions
Int -> ReadS DescribeClusterVersions
ReadS [DescribeClusterVersions]
(Int -> ReadS DescribeClusterVersions)
-> ReadS [DescribeClusterVersions]
-> ReadPrec DescribeClusterVersions
-> ReadPrec [DescribeClusterVersions]
-> Read DescribeClusterVersions
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeClusterVersions]
$creadListPrec :: ReadPrec [DescribeClusterVersions]
readPrec :: ReadPrec DescribeClusterVersions
$creadPrec :: ReadPrec DescribeClusterVersions
readList :: ReadS [DescribeClusterVersions]
$creadList :: ReadS [DescribeClusterVersions]
readsPrec :: Int -> ReadS DescribeClusterVersions
$creadsPrec :: Int -> ReadS DescribeClusterVersions
Prelude.Read, Int -> DescribeClusterVersions -> ShowS
[DescribeClusterVersions] -> ShowS
DescribeClusterVersions -> String
(Int -> DescribeClusterVersions -> ShowS)
-> (DescribeClusterVersions -> String)
-> ([DescribeClusterVersions] -> ShowS)
-> Show DescribeClusterVersions
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeClusterVersions] -> ShowS
$cshowList :: [DescribeClusterVersions] -> ShowS
show :: DescribeClusterVersions -> String
$cshow :: DescribeClusterVersions -> String
showsPrec :: Int -> DescribeClusterVersions -> ShowS
$cshowsPrec :: Int -> DescribeClusterVersions -> ShowS
Prelude.Show, (forall x.
 DescribeClusterVersions -> Rep DescribeClusterVersions x)
-> (forall x.
    Rep DescribeClusterVersions x -> DescribeClusterVersions)
-> Generic DescribeClusterVersions
forall x. Rep DescribeClusterVersions x -> DescribeClusterVersions
forall x. DescribeClusterVersions -> Rep DescribeClusterVersions x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeClusterVersions x -> DescribeClusterVersions
$cfrom :: forall x. DescribeClusterVersions -> Rep DescribeClusterVersions x
Prelude.Generic)

-- |
-- Create a value of 'DescribeClusterVersions' 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:
--
-- 'clusterParameterGroupFamily', 'describeClusterVersions_clusterParameterGroupFamily' - The name of a specific cluster parameter group family to return details
-- for.
--
-- Constraints:
--
-- -   Must be 1 to 255 alphanumeric characters
--
-- -   First character must be a letter
--
-- -   Cannot end with a hyphen or contain two consecutive hyphens
--
-- 'marker', 'describeClusterVersions_marker' - An optional parameter that specifies the starting point to return a set
-- of response records. When the results of a DescribeClusterVersions
-- request exceed the value specified in @MaxRecords@, Amazon Web Services
-- returns a value in the @Marker@ field of the response. You can retrieve
-- the next set of response records by providing the returned marker value
-- in the @Marker@ parameter and retrying the request.
--
-- 'maxRecords', 'describeClusterVersions_maxRecords' - The maximum number of response records to return in each call. If the
-- number of remaining response records exceeds the specified @MaxRecords@
-- value, a value is returned in a @marker@ field of the response. You can
-- retrieve the next set of records by retrying the command with the
-- returned marker value.
--
-- Default: @100@
--
-- Constraints: minimum 20, maximum 100.
--
-- 'clusterVersion', 'describeClusterVersions_clusterVersion' - The specific cluster version to return.
--
-- Example: @1.0@
newDescribeClusterVersions ::
  DescribeClusterVersions
newDescribeClusterVersions :: DescribeClusterVersions
newDescribeClusterVersions =
  DescribeClusterVersions' :: Maybe Text
-> Maybe Text -> Maybe Int -> Maybe Text -> DescribeClusterVersions
DescribeClusterVersions'
    { $sel:clusterParameterGroupFamily:DescribeClusterVersions' :: Maybe Text
clusterParameterGroupFamily =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:marker:DescribeClusterVersions' :: Maybe Text
marker = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxRecords:DescribeClusterVersions' :: Maybe Int
maxRecords = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:clusterVersion:DescribeClusterVersions' :: Maybe Text
clusterVersion = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The name of a specific cluster parameter group family to return details
-- for.
--
-- Constraints:
--
-- -   Must be 1 to 255 alphanumeric characters
--
-- -   First character must be a letter
--
-- -   Cannot end with a hyphen or contain two consecutive hyphens
describeClusterVersions_clusterParameterGroupFamily :: Lens.Lens' DescribeClusterVersions (Prelude.Maybe Prelude.Text)
describeClusterVersions_clusterParameterGroupFamily :: (Maybe Text -> f (Maybe Text))
-> DescribeClusterVersions -> f DescribeClusterVersions
describeClusterVersions_clusterParameterGroupFamily = (DescribeClusterVersions -> Maybe Text)
-> (DescribeClusterVersions
    -> Maybe Text -> DescribeClusterVersions)
-> Lens
     DescribeClusterVersions
     DescribeClusterVersions
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeClusterVersions' {Maybe Text
clusterParameterGroupFamily :: Maybe Text
$sel:clusterParameterGroupFamily:DescribeClusterVersions' :: DescribeClusterVersions -> Maybe Text
clusterParameterGroupFamily} -> Maybe Text
clusterParameterGroupFamily) (\s :: DescribeClusterVersions
s@DescribeClusterVersions' {} Maybe Text
a -> DescribeClusterVersions
s {$sel:clusterParameterGroupFamily:DescribeClusterVersions' :: Maybe Text
clusterParameterGroupFamily = Maybe Text
a} :: DescribeClusterVersions)

-- | An optional parameter that specifies the starting point to return a set
-- of response records. When the results of a DescribeClusterVersions
-- request exceed the value specified in @MaxRecords@, Amazon Web Services
-- returns a value in the @Marker@ field of the response. You can retrieve
-- the next set of response records by providing the returned marker value
-- in the @Marker@ parameter and retrying the request.
describeClusterVersions_marker :: Lens.Lens' DescribeClusterVersions (Prelude.Maybe Prelude.Text)
describeClusterVersions_marker :: (Maybe Text -> f (Maybe Text))
-> DescribeClusterVersions -> f DescribeClusterVersions
describeClusterVersions_marker = (DescribeClusterVersions -> Maybe Text)
-> (DescribeClusterVersions
    -> Maybe Text -> DescribeClusterVersions)
-> Lens
     DescribeClusterVersions
     DescribeClusterVersions
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeClusterVersions' {Maybe Text
marker :: Maybe Text
$sel:marker:DescribeClusterVersions' :: DescribeClusterVersions -> Maybe Text
marker} -> Maybe Text
marker) (\s :: DescribeClusterVersions
s@DescribeClusterVersions' {} Maybe Text
a -> DescribeClusterVersions
s {$sel:marker:DescribeClusterVersions' :: Maybe Text
marker = Maybe Text
a} :: DescribeClusterVersions)

-- | The maximum number of response records to return in each call. If the
-- number of remaining response records exceeds the specified @MaxRecords@
-- value, a value is returned in a @marker@ field of the response. You can
-- retrieve the next set of records by retrying the command with the
-- returned marker value.
--
-- Default: @100@
--
-- Constraints: minimum 20, maximum 100.
describeClusterVersions_maxRecords :: Lens.Lens' DescribeClusterVersions (Prelude.Maybe Prelude.Int)
describeClusterVersions_maxRecords :: (Maybe Int -> f (Maybe Int))
-> DescribeClusterVersions -> f DescribeClusterVersions
describeClusterVersions_maxRecords = (DescribeClusterVersions -> Maybe Int)
-> (DescribeClusterVersions
    -> Maybe Int -> DescribeClusterVersions)
-> Lens
     DescribeClusterVersions
     DescribeClusterVersions
     (Maybe Int)
     (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeClusterVersions' {Maybe Int
maxRecords :: Maybe Int
$sel:maxRecords:DescribeClusterVersions' :: DescribeClusterVersions -> Maybe Int
maxRecords} -> Maybe Int
maxRecords) (\s :: DescribeClusterVersions
s@DescribeClusterVersions' {} Maybe Int
a -> DescribeClusterVersions
s {$sel:maxRecords:DescribeClusterVersions' :: Maybe Int
maxRecords = Maybe Int
a} :: DescribeClusterVersions)

-- | The specific cluster version to return.
--
-- Example: @1.0@
describeClusterVersions_clusterVersion :: Lens.Lens' DescribeClusterVersions (Prelude.Maybe Prelude.Text)
describeClusterVersions_clusterVersion :: (Maybe Text -> f (Maybe Text))
-> DescribeClusterVersions -> f DescribeClusterVersions
describeClusterVersions_clusterVersion = (DescribeClusterVersions -> Maybe Text)
-> (DescribeClusterVersions
    -> Maybe Text -> DescribeClusterVersions)
-> Lens
     DescribeClusterVersions
     DescribeClusterVersions
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeClusterVersions' {Maybe Text
clusterVersion :: Maybe Text
$sel:clusterVersion:DescribeClusterVersions' :: DescribeClusterVersions -> Maybe Text
clusterVersion} -> Maybe Text
clusterVersion) (\s :: DescribeClusterVersions
s@DescribeClusterVersions' {} Maybe Text
a -> DescribeClusterVersions
s {$sel:clusterVersion:DescribeClusterVersions' :: Maybe Text
clusterVersion = Maybe Text
a} :: DescribeClusterVersions)

instance Core.AWSPager DescribeClusterVersions where
  page :: DescribeClusterVersions
-> AWSResponse DescribeClusterVersions
-> Maybe DescribeClusterVersions
page DescribeClusterVersions
rq AWSResponse DescribeClusterVersions
rs
    | Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse DescribeClusterVersions
DescribeClusterVersionsResponse
rs
            DescribeClusterVersionsResponse
-> Getting (First Text) DescribeClusterVersionsResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> DescribeClusterVersionsResponse
-> Const (First Text) DescribeClusterVersionsResponse
Lens' DescribeClusterVersionsResponse (Maybe Text)
describeClusterVersionsResponse_marker
              ((Maybe Text -> Const (First Text) (Maybe Text))
 -> DescribeClusterVersionsResponse
 -> Const (First Text) DescribeClusterVersionsResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) DescribeClusterVersionsResponse 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 DescribeClusterVersions
forall a. Maybe a
Prelude.Nothing
    | Maybe [ClusterVersion] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse DescribeClusterVersions
DescribeClusterVersionsResponse
rs
            DescribeClusterVersionsResponse
-> Getting
     (First [ClusterVersion])
     DescribeClusterVersionsResponse
     [ClusterVersion]
-> Maybe [ClusterVersion]
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe [ClusterVersion]
 -> Const (First [ClusterVersion]) (Maybe [ClusterVersion]))
-> DescribeClusterVersionsResponse
-> Const (First [ClusterVersion]) DescribeClusterVersionsResponse
Lens' DescribeClusterVersionsResponse (Maybe [ClusterVersion])
describeClusterVersionsResponse_clusterVersions
              ((Maybe [ClusterVersion]
  -> Const (First [ClusterVersion]) (Maybe [ClusterVersion]))
 -> DescribeClusterVersionsResponse
 -> Const (First [ClusterVersion]) DescribeClusterVersionsResponse)
-> (([ClusterVersion]
     -> Const (First [ClusterVersion]) [ClusterVersion])
    -> Maybe [ClusterVersion]
    -> Const (First [ClusterVersion]) (Maybe [ClusterVersion]))
-> Getting
     (First [ClusterVersion])
     DescribeClusterVersionsResponse
     [ClusterVersion]
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([ClusterVersion]
 -> Const (First [ClusterVersion]) [ClusterVersion])
-> Maybe [ClusterVersion]
-> Const (First [ClusterVersion]) (Maybe [ClusterVersion])
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
      Maybe DescribeClusterVersions
forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
      DescribeClusterVersions -> Maybe DescribeClusterVersions
forall a. a -> Maybe a
Prelude.Just (DescribeClusterVersions -> Maybe DescribeClusterVersions)
-> DescribeClusterVersions -> Maybe DescribeClusterVersions
forall a b. (a -> b) -> a -> b
Prelude.$
        DescribeClusterVersions
rq
          DescribeClusterVersions
-> (DescribeClusterVersions -> DescribeClusterVersions)
-> DescribeClusterVersions
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> DescribeClusterVersions -> Identity DescribeClusterVersions
Lens
  DescribeClusterVersions
  DescribeClusterVersions
  (Maybe Text)
  (Maybe Text)
describeClusterVersions_marker
          ((Maybe Text -> Identity (Maybe Text))
 -> DescribeClusterVersions -> Identity DescribeClusterVersions)
-> Maybe Text -> DescribeClusterVersions -> DescribeClusterVersions
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse DescribeClusterVersions
DescribeClusterVersionsResponse
rs
          DescribeClusterVersionsResponse
-> Getting (First Text) DescribeClusterVersionsResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> DescribeClusterVersionsResponse
-> Const (First Text) DescribeClusterVersionsResponse
Lens' DescribeClusterVersionsResponse (Maybe Text)
describeClusterVersionsResponse_marker
            ((Maybe Text -> Const (First Text) (Maybe Text))
 -> DescribeClusterVersionsResponse
 -> Const (First Text) DescribeClusterVersionsResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) DescribeClusterVersionsResponse 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 DescribeClusterVersions where
  type
    AWSResponse DescribeClusterVersions =
      DescribeClusterVersionsResponse
  request :: DescribeClusterVersions -> Request DescribeClusterVersions
request = Service
-> DescribeClusterVersions -> Request DescribeClusterVersions
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery Service
defaultService
  response :: Logger
-> Service
-> Proxy DescribeClusterVersions
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeClusterVersions)))
response =
    Text
-> (Int
    -> ResponseHeaders
    -> [Node]
    -> Either String (AWSResponse DescribeClusterVersions))
-> Logger
-> Service
-> Proxy DescribeClusterVersions
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeClusterVersions)))
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
"DescribeClusterVersionsResult"
      ( \Int
s ResponseHeaders
h [Node]
x ->
          Maybe [ClusterVersion]
-> Maybe Text -> Int -> DescribeClusterVersionsResponse
DescribeClusterVersionsResponse'
            (Maybe [ClusterVersion]
 -> Maybe Text -> Int -> DescribeClusterVersionsResponse)
-> Either String (Maybe [ClusterVersion])
-> Either
     String (Maybe Text -> Int -> DescribeClusterVersionsResponse)
forall (f :: * -> *) a b. Functor 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
"ClusterVersions" 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 [ClusterVersion]))
-> Either String (Maybe [ClusterVersion])
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= ([Node] -> Either String [ClusterVersion])
-> [Node] -> Either String (Maybe [ClusterVersion])
forall (f :: * -> *) a b.
Applicative f =>
([a] -> f b) -> [a] -> f (Maybe b)
Core.may (Text -> [Node] -> Either String [ClusterVersion]
forall a. FromXML a => Text -> [Node] -> Either String [a]
Core.parseXMLList Text
"ClusterVersion")
                        )
            Either
  String (Maybe Text -> Int -> DescribeClusterVersionsResponse)
-> Either String (Maybe Text)
-> Either String (Int -> DescribeClusterVersionsResponse)
forall (f :: * -> *) a b. Applicative f => 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 (Int -> DescribeClusterVersionsResponse)
-> Either String Int
-> Either String DescribeClusterVersionsResponse
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 DescribeClusterVersions

instance Prelude.NFData DescribeClusterVersions

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

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

instance Core.ToQuery DescribeClusterVersions where
  toQuery :: DescribeClusterVersions -> QueryString
toQuery DescribeClusterVersions' {Maybe Int
Maybe Text
clusterVersion :: Maybe Text
maxRecords :: Maybe Int
marker :: Maybe Text
clusterParameterGroupFamily :: Maybe Text
$sel:clusterVersion:DescribeClusterVersions' :: DescribeClusterVersions -> Maybe Text
$sel:maxRecords:DescribeClusterVersions' :: DescribeClusterVersions -> Maybe Int
$sel:marker:DescribeClusterVersions' :: DescribeClusterVersions -> Maybe Text
$sel:clusterParameterGroupFamily:DescribeClusterVersions' :: DescribeClusterVersions -> 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
"DescribeClusterVersions" :: Prelude.ByteString),
        ByteString
"Version"
          ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"2012-12-01" :: Prelude.ByteString),
        ByteString
"ClusterParameterGroupFamily"
          ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
clusterParameterGroupFamily,
        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,
        ByteString
"ClusterVersion" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
clusterVersion
      ]

-- | Contains the output from the DescribeClusterVersions action.
--
-- /See:/ 'newDescribeClusterVersionsResponse' smart constructor.
data DescribeClusterVersionsResponse = DescribeClusterVersionsResponse'
  { -- | A list of @Version@ elements.
    DescribeClusterVersionsResponse -> Maybe [ClusterVersion]
clusterVersions :: Prelude.Maybe [ClusterVersion],
    -- | A value that indicates the starting point for the next set of response
    -- records in a subsequent request. If a value is returned in a response,
    -- you can retrieve the next set of records by providing this returned
    -- marker value in the @Marker@ parameter and retrying the command. If the
    -- @Marker@ field is empty, all response records have been retrieved for
    -- the request.
    DescribeClusterVersionsResponse -> Maybe Text
marker :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    DescribeClusterVersionsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DescribeClusterVersionsResponse
-> DescribeClusterVersionsResponse -> Bool
(DescribeClusterVersionsResponse
 -> DescribeClusterVersionsResponse -> Bool)
-> (DescribeClusterVersionsResponse
    -> DescribeClusterVersionsResponse -> Bool)
-> Eq DescribeClusterVersionsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeClusterVersionsResponse
-> DescribeClusterVersionsResponse -> Bool
$c/= :: DescribeClusterVersionsResponse
-> DescribeClusterVersionsResponse -> Bool
== :: DescribeClusterVersionsResponse
-> DescribeClusterVersionsResponse -> Bool
$c== :: DescribeClusterVersionsResponse
-> DescribeClusterVersionsResponse -> Bool
Prelude.Eq, ReadPrec [DescribeClusterVersionsResponse]
ReadPrec DescribeClusterVersionsResponse
Int -> ReadS DescribeClusterVersionsResponse
ReadS [DescribeClusterVersionsResponse]
(Int -> ReadS DescribeClusterVersionsResponse)
-> ReadS [DescribeClusterVersionsResponse]
-> ReadPrec DescribeClusterVersionsResponse
-> ReadPrec [DescribeClusterVersionsResponse]
-> Read DescribeClusterVersionsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeClusterVersionsResponse]
$creadListPrec :: ReadPrec [DescribeClusterVersionsResponse]
readPrec :: ReadPrec DescribeClusterVersionsResponse
$creadPrec :: ReadPrec DescribeClusterVersionsResponse
readList :: ReadS [DescribeClusterVersionsResponse]
$creadList :: ReadS [DescribeClusterVersionsResponse]
readsPrec :: Int -> ReadS DescribeClusterVersionsResponse
$creadsPrec :: Int -> ReadS DescribeClusterVersionsResponse
Prelude.Read, Int -> DescribeClusterVersionsResponse -> ShowS
[DescribeClusterVersionsResponse] -> ShowS
DescribeClusterVersionsResponse -> String
(Int -> DescribeClusterVersionsResponse -> ShowS)
-> (DescribeClusterVersionsResponse -> String)
-> ([DescribeClusterVersionsResponse] -> ShowS)
-> Show DescribeClusterVersionsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeClusterVersionsResponse] -> ShowS
$cshowList :: [DescribeClusterVersionsResponse] -> ShowS
show :: DescribeClusterVersionsResponse -> String
$cshow :: DescribeClusterVersionsResponse -> String
showsPrec :: Int -> DescribeClusterVersionsResponse -> ShowS
$cshowsPrec :: Int -> DescribeClusterVersionsResponse -> ShowS
Prelude.Show, (forall x.
 DescribeClusterVersionsResponse
 -> Rep DescribeClusterVersionsResponse x)
-> (forall x.
    Rep DescribeClusterVersionsResponse x
    -> DescribeClusterVersionsResponse)
-> Generic DescribeClusterVersionsResponse
forall x.
Rep DescribeClusterVersionsResponse x
-> DescribeClusterVersionsResponse
forall x.
DescribeClusterVersionsResponse
-> Rep DescribeClusterVersionsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeClusterVersionsResponse x
-> DescribeClusterVersionsResponse
$cfrom :: forall x.
DescribeClusterVersionsResponse
-> Rep DescribeClusterVersionsResponse x
Prelude.Generic)

-- |
-- Create a value of 'DescribeClusterVersionsResponse' 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:
--
-- 'clusterVersions', 'describeClusterVersionsResponse_clusterVersions' - A list of @Version@ elements.
--
-- 'marker', 'describeClusterVersionsResponse_marker' - A value that indicates the starting point for the next set of response
-- records in a subsequent request. If a value is returned in a response,
-- you can retrieve the next set of records by providing this returned
-- marker value in the @Marker@ parameter and retrying the command. If the
-- @Marker@ field is empty, all response records have been retrieved for
-- the request.
--
-- 'httpStatus', 'describeClusterVersionsResponse_httpStatus' - The response's http status code.
newDescribeClusterVersionsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DescribeClusterVersionsResponse
newDescribeClusterVersionsResponse :: Int -> DescribeClusterVersionsResponse
newDescribeClusterVersionsResponse Int
pHttpStatus_ =
  DescribeClusterVersionsResponse' :: Maybe [ClusterVersion]
-> Maybe Text -> Int -> DescribeClusterVersionsResponse
DescribeClusterVersionsResponse'
    { $sel:clusterVersions:DescribeClusterVersionsResponse' :: Maybe [ClusterVersion]
clusterVersions =
        Maybe [ClusterVersion]
forall a. Maybe a
Prelude.Nothing,
      $sel:marker:DescribeClusterVersionsResponse' :: Maybe Text
marker = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DescribeClusterVersionsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | A list of @Version@ elements.
describeClusterVersionsResponse_clusterVersions :: Lens.Lens' DescribeClusterVersionsResponse (Prelude.Maybe [ClusterVersion])
describeClusterVersionsResponse_clusterVersions :: (Maybe [ClusterVersion] -> f (Maybe [ClusterVersion]))
-> DescribeClusterVersionsResponse
-> f DescribeClusterVersionsResponse
describeClusterVersionsResponse_clusterVersions = (DescribeClusterVersionsResponse -> Maybe [ClusterVersion])
-> (DescribeClusterVersionsResponse
    -> Maybe [ClusterVersion] -> DescribeClusterVersionsResponse)
-> Lens' DescribeClusterVersionsResponse (Maybe [ClusterVersion])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeClusterVersionsResponse' {Maybe [ClusterVersion]
clusterVersions :: Maybe [ClusterVersion]
$sel:clusterVersions:DescribeClusterVersionsResponse' :: DescribeClusterVersionsResponse -> Maybe [ClusterVersion]
clusterVersions} -> Maybe [ClusterVersion]
clusterVersions) (\s :: DescribeClusterVersionsResponse
s@DescribeClusterVersionsResponse' {} Maybe [ClusterVersion]
a -> DescribeClusterVersionsResponse
s {$sel:clusterVersions:DescribeClusterVersionsResponse' :: Maybe [ClusterVersion]
clusterVersions = Maybe [ClusterVersion]
a} :: DescribeClusterVersionsResponse) ((Maybe [ClusterVersion] -> f (Maybe [ClusterVersion]))
 -> DescribeClusterVersionsResponse
 -> f DescribeClusterVersionsResponse)
-> ((Maybe [ClusterVersion] -> f (Maybe [ClusterVersion]))
    -> Maybe [ClusterVersion] -> f (Maybe [ClusterVersion]))
-> (Maybe [ClusterVersion] -> f (Maybe [ClusterVersion]))
-> DescribeClusterVersionsResponse
-> f DescribeClusterVersionsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [ClusterVersion] [ClusterVersion] [ClusterVersion] [ClusterVersion]
-> Iso
     (Maybe [ClusterVersion])
     (Maybe [ClusterVersion])
     (Maybe [ClusterVersion])
     (Maybe [ClusterVersion])
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
  [ClusterVersion] [ClusterVersion] [ClusterVersion] [ClusterVersion]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | A value that indicates the starting point for the next set of response
-- records in a subsequent request. If a value is returned in a response,
-- you can retrieve the next set of records by providing this returned
-- marker value in the @Marker@ parameter and retrying the command. If the
-- @Marker@ field is empty, all response records have been retrieved for
-- the request.
describeClusterVersionsResponse_marker :: Lens.Lens' DescribeClusterVersionsResponse (Prelude.Maybe Prelude.Text)
describeClusterVersionsResponse_marker :: (Maybe Text -> f (Maybe Text))
-> DescribeClusterVersionsResponse
-> f DescribeClusterVersionsResponse
describeClusterVersionsResponse_marker = (DescribeClusterVersionsResponse -> Maybe Text)
-> (DescribeClusterVersionsResponse
    -> Maybe Text -> DescribeClusterVersionsResponse)
-> Lens' DescribeClusterVersionsResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeClusterVersionsResponse' {Maybe Text
marker :: Maybe Text
$sel:marker:DescribeClusterVersionsResponse' :: DescribeClusterVersionsResponse -> Maybe Text
marker} -> Maybe Text
marker) (\s :: DescribeClusterVersionsResponse
s@DescribeClusterVersionsResponse' {} Maybe Text
a -> DescribeClusterVersionsResponse
s {$sel:marker:DescribeClusterVersionsResponse' :: Maybe Text
marker = Maybe Text
a} :: DescribeClusterVersionsResponse)

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

instance
  Prelude.NFData
    DescribeClusterVersionsResponse