{-# 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.DescribeHsmConfigurations
-- 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 information about the specified Amazon Redshift HSM
-- configuration. If no configuration ID is specified, returns information
-- about all the HSM configurations owned by your Amazon Web Services
-- account.
--
-- If you specify both tag keys and tag values in the same request, Amazon
-- Redshift returns all HSM connections that match any combination of the
-- specified keys and values. For example, if you have @owner@ and
-- @environment@ for tag keys, and @admin@ and @test@ for tag values, all
-- HSM connections that have any combination of those values are returned.
--
-- If both tag keys and values are omitted from the request, HSM
-- connections are returned regardless of whether they have tag keys or
-- values associated with them.
--
-- This operation returns paginated results.
module Amazonka.Redshift.DescribeHsmConfigurations
  ( -- * Creating a Request
    DescribeHsmConfigurations (..),
    newDescribeHsmConfigurations,

    -- * Request Lenses
    describeHsmConfigurations_tagValues,
    describeHsmConfigurations_hsmConfigurationIdentifier,
    describeHsmConfigurations_tagKeys,
    describeHsmConfigurations_marker,
    describeHsmConfigurations_maxRecords,

    -- * Destructuring the Response
    DescribeHsmConfigurationsResponse (..),
    newDescribeHsmConfigurationsResponse,

    -- * Response Lenses
    describeHsmConfigurationsResponse_marker,
    describeHsmConfigurationsResponse_hsmConfigurations,
    describeHsmConfigurationsResponse_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:/ 'newDescribeHsmConfigurations' smart constructor.
data DescribeHsmConfigurations = DescribeHsmConfigurations'
  { -- | A tag value or values for which you want to return all matching HSM
    -- configurations that are associated with the specified tag value or
    -- values. For example, suppose that you have HSM configurations that are
    -- tagged with values called @admin@ and @test@. If you specify both of
    -- these tag values in the request, Amazon Redshift returns a response with
    -- the HSM configurations that have either or both of these tag values
    -- associated with them.
    DescribeHsmConfigurations -> Maybe [Text]
tagValues :: Prelude.Maybe [Prelude.Text],
    -- | The identifier of a specific Amazon Redshift HSM configuration to be
    -- described. If no identifier is specified, information is returned for
    -- all HSM configurations owned by your Amazon Web Services account.
    DescribeHsmConfigurations -> Maybe Text
hsmConfigurationIdentifier :: Prelude.Maybe Prelude.Text,
    -- | A tag key or keys for which you want to return all matching HSM
    -- configurations that are associated with the specified key or keys. For
    -- example, suppose that you have HSM configurations that are tagged with
    -- keys called @owner@ and @environment@. If you specify both of these tag
    -- keys in the request, Amazon Redshift returns a response with the HSM
    -- configurations that have either or both of these tag keys associated
    -- with them.
    DescribeHsmConfigurations -> Maybe [Text]
tagKeys :: Prelude.Maybe [Prelude.Text],
    -- | An optional parameter that specifies the starting point to return a set
    -- of response records. When the results of a DescribeHsmConfigurations
    -- 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.
    DescribeHsmConfigurations -> 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.
    DescribeHsmConfigurations -> Maybe Int
maxRecords :: Prelude.Maybe Prelude.Int
  }
  deriving (DescribeHsmConfigurations -> DescribeHsmConfigurations -> Bool
(DescribeHsmConfigurations -> DescribeHsmConfigurations -> Bool)
-> (DescribeHsmConfigurations -> DescribeHsmConfigurations -> Bool)
-> Eq DescribeHsmConfigurations
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeHsmConfigurations -> DescribeHsmConfigurations -> Bool
$c/= :: DescribeHsmConfigurations -> DescribeHsmConfigurations -> Bool
== :: DescribeHsmConfigurations -> DescribeHsmConfigurations -> Bool
$c== :: DescribeHsmConfigurations -> DescribeHsmConfigurations -> Bool
Prelude.Eq, ReadPrec [DescribeHsmConfigurations]
ReadPrec DescribeHsmConfigurations
Int -> ReadS DescribeHsmConfigurations
ReadS [DescribeHsmConfigurations]
(Int -> ReadS DescribeHsmConfigurations)
-> ReadS [DescribeHsmConfigurations]
-> ReadPrec DescribeHsmConfigurations
-> ReadPrec [DescribeHsmConfigurations]
-> Read DescribeHsmConfigurations
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeHsmConfigurations]
$creadListPrec :: ReadPrec [DescribeHsmConfigurations]
readPrec :: ReadPrec DescribeHsmConfigurations
$creadPrec :: ReadPrec DescribeHsmConfigurations
readList :: ReadS [DescribeHsmConfigurations]
$creadList :: ReadS [DescribeHsmConfigurations]
readsPrec :: Int -> ReadS DescribeHsmConfigurations
$creadsPrec :: Int -> ReadS DescribeHsmConfigurations
Prelude.Read, Int -> DescribeHsmConfigurations -> ShowS
[DescribeHsmConfigurations] -> ShowS
DescribeHsmConfigurations -> String
(Int -> DescribeHsmConfigurations -> ShowS)
-> (DescribeHsmConfigurations -> String)
-> ([DescribeHsmConfigurations] -> ShowS)
-> Show DescribeHsmConfigurations
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeHsmConfigurations] -> ShowS
$cshowList :: [DescribeHsmConfigurations] -> ShowS
show :: DescribeHsmConfigurations -> String
$cshow :: DescribeHsmConfigurations -> String
showsPrec :: Int -> DescribeHsmConfigurations -> ShowS
$cshowsPrec :: Int -> DescribeHsmConfigurations -> ShowS
Prelude.Show, (forall x.
 DescribeHsmConfigurations -> Rep DescribeHsmConfigurations x)
-> (forall x.
    Rep DescribeHsmConfigurations x -> DescribeHsmConfigurations)
-> Generic DescribeHsmConfigurations
forall x.
Rep DescribeHsmConfigurations x -> DescribeHsmConfigurations
forall x.
DescribeHsmConfigurations -> Rep DescribeHsmConfigurations x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeHsmConfigurations x -> DescribeHsmConfigurations
$cfrom :: forall x.
DescribeHsmConfigurations -> Rep DescribeHsmConfigurations x
Prelude.Generic)

-- |
-- Create a value of 'DescribeHsmConfigurations' 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:
--
-- 'tagValues', 'describeHsmConfigurations_tagValues' - A tag value or values for which you want to return all matching HSM
-- configurations that are associated with the specified tag value or
-- values. For example, suppose that you have HSM configurations that are
-- tagged with values called @admin@ and @test@. If you specify both of
-- these tag values in the request, Amazon Redshift returns a response with
-- the HSM configurations that have either or both of these tag values
-- associated with them.
--
-- 'hsmConfigurationIdentifier', 'describeHsmConfigurations_hsmConfigurationIdentifier' - The identifier of a specific Amazon Redshift HSM configuration to be
-- described. If no identifier is specified, information is returned for
-- all HSM configurations owned by your Amazon Web Services account.
--
-- 'tagKeys', 'describeHsmConfigurations_tagKeys' - A tag key or keys for which you want to return all matching HSM
-- configurations that are associated with the specified key or keys. For
-- example, suppose that you have HSM configurations that are tagged with
-- keys called @owner@ and @environment@. If you specify both of these tag
-- keys in the request, Amazon Redshift returns a response with the HSM
-- configurations that have either or both of these tag keys associated
-- with them.
--
-- 'marker', 'describeHsmConfigurations_marker' - An optional parameter that specifies the starting point to return a set
-- of response records. When the results of a DescribeHsmConfigurations
-- 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', 'describeHsmConfigurations_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.
newDescribeHsmConfigurations ::
  DescribeHsmConfigurations
newDescribeHsmConfigurations :: DescribeHsmConfigurations
newDescribeHsmConfigurations =
  DescribeHsmConfigurations' :: Maybe [Text]
-> Maybe Text
-> Maybe [Text]
-> Maybe Text
-> Maybe Int
-> DescribeHsmConfigurations
DescribeHsmConfigurations'
    { $sel:tagValues:DescribeHsmConfigurations' :: Maybe [Text]
tagValues =
        Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
      $sel:hsmConfigurationIdentifier:DescribeHsmConfigurations' :: Maybe Text
hsmConfigurationIdentifier = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:tagKeys:DescribeHsmConfigurations' :: Maybe [Text]
tagKeys = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
      $sel:marker:DescribeHsmConfigurations' :: Maybe Text
marker = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxRecords:DescribeHsmConfigurations' :: Maybe Int
maxRecords = Maybe Int
forall a. Maybe a
Prelude.Nothing
    }

-- | A tag value or values for which you want to return all matching HSM
-- configurations that are associated with the specified tag value or
-- values. For example, suppose that you have HSM configurations that are
-- tagged with values called @admin@ and @test@. If you specify both of
-- these tag values in the request, Amazon Redshift returns a response with
-- the HSM configurations that have either or both of these tag values
-- associated with them.
describeHsmConfigurations_tagValues :: Lens.Lens' DescribeHsmConfigurations (Prelude.Maybe [Prelude.Text])
describeHsmConfigurations_tagValues :: (Maybe [Text] -> f (Maybe [Text]))
-> DescribeHsmConfigurations -> f DescribeHsmConfigurations
describeHsmConfigurations_tagValues = (DescribeHsmConfigurations -> Maybe [Text])
-> (DescribeHsmConfigurations
    -> Maybe [Text] -> DescribeHsmConfigurations)
-> Lens
     DescribeHsmConfigurations
     DescribeHsmConfigurations
     (Maybe [Text])
     (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeHsmConfigurations' {Maybe [Text]
tagValues :: Maybe [Text]
$sel:tagValues:DescribeHsmConfigurations' :: DescribeHsmConfigurations -> Maybe [Text]
tagValues} -> Maybe [Text]
tagValues) (\s :: DescribeHsmConfigurations
s@DescribeHsmConfigurations' {} Maybe [Text]
a -> DescribeHsmConfigurations
s {$sel:tagValues:DescribeHsmConfigurations' :: Maybe [Text]
tagValues = Maybe [Text]
a} :: DescribeHsmConfigurations) ((Maybe [Text] -> f (Maybe [Text]))
 -> DescribeHsmConfigurations -> f DescribeHsmConfigurations)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> DescribeHsmConfigurations
-> f DescribeHsmConfigurations
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 identifier of a specific Amazon Redshift HSM configuration to be
-- described. If no identifier is specified, information is returned for
-- all HSM configurations owned by your Amazon Web Services account.
describeHsmConfigurations_hsmConfigurationIdentifier :: Lens.Lens' DescribeHsmConfigurations (Prelude.Maybe Prelude.Text)
describeHsmConfigurations_hsmConfigurationIdentifier :: (Maybe Text -> f (Maybe Text))
-> DescribeHsmConfigurations -> f DescribeHsmConfigurations
describeHsmConfigurations_hsmConfigurationIdentifier = (DescribeHsmConfigurations -> Maybe Text)
-> (DescribeHsmConfigurations
    -> Maybe Text -> DescribeHsmConfigurations)
-> Lens
     DescribeHsmConfigurations
     DescribeHsmConfigurations
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeHsmConfigurations' {Maybe Text
hsmConfigurationIdentifier :: Maybe Text
$sel:hsmConfigurationIdentifier:DescribeHsmConfigurations' :: DescribeHsmConfigurations -> Maybe Text
hsmConfigurationIdentifier} -> Maybe Text
hsmConfigurationIdentifier) (\s :: DescribeHsmConfigurations
s@DescribeHsmConfigurations' {} Maybe Text
a -> DescribeHsmConfigurations
s {$sel:hsmConfigurationIdentifier:DescribeHsmConfigurations' :: Maybe Text
hsmConfigurationIdentifier = Maybe Text
a} :: DescribeHsmConfigurations)

-- | A tag key or keys for which you want to return all matching HSM
-- configurations that are associated with the specified key or keys. For
-- example, suppose that you have HSM configurations that are tagged with
-- keys called @owner@ and @environment@. If you specify both of these tag
-- keys in the request, Amazon Redshift returns a response with the HSM
-- configurations that have either or both of these tag keys associated
-- with them.
describeHsmConfigurations_tagKeys :: Lens.Lens' DescribeHsmConfigurations (Prelude.Maybe [Prelude.Text])
describeHsmConfigurations_tagKeys :: (Maybe [Text] -> f (Maybe [Text]))
-> DescribeHsmConfigurations -> f DescribeHsmConfigurations
describeHsmConfigurations_tagKeys = (DescribeHsmConfigurations -> Maybe [Text])
-> (DescribeHsmConfigurations
    -> Maybe [Text] -> DescribeHsmConfigurations)
-> Lens
     DescribeHsmConfigurations
     DescribeHsmConfigurations
     (Maybe [Text])
     (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeHsmConfigurations' {Maybe [Text]
tagKeys :: Maybe [Text]
$sel:tagKeys:DescribeHsmConfigurations' :: DescribeHsmConfigurations -> Maybe [Text]
tagKeys} -> Maybe [Text]
tagKeys) (\s :: DescribeHsmConfigurations
s@DescribeHsmConfigurations' {} Maybe [Text]
a -> DescribeHsmConfigurations
s {$sel:tagKeys:DescribeHsmConfigurations' :: Maybe [Text]
tagKeys = Maybe [Text]
a} :: DescribeHsmConfigurations) ((Maybe [Text] -> f (Maybe [Text]))
 -> DescribeHsmConfigurations -> f DescribeHsmConfigurations)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> DescribeHsmConfigurations
-> f DescribeHsmConfigurations
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

-- | An optional parameter that specifies the starting point to return a set
-- of response records. When the results of a DescribeHsmConfigurations
-- 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.
describeHsmConfigurations_marker :: Lens.Lens' DescribeHsmConfigurations (Prelude.Maybe Prelude.Text)
describeHsmConfigurations_marker :: (Maybe Text -> f (Maybe Text))
-> DescribeHsmConfigurations -> f DescribeHsmConfigurations
describeHsmConfigurations_marker = (DescribeHsmConfigurations -> Maybe Text)
-> (DescribeHsmConfigurations
    -> Maybe Text -> DescribeHsmConfigurations)
-> Lens
     DescribeHsmConfigurations
     DescribeHsmConfigurations
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeHsmConfigurations' {Maybe Text
marker :: Maybe Text
$sel:marker:DescribeHsmConfigurations' :: DescribeHsmConfigurations -> Maybe Text
marker} -> Maybe Text
marker) (\s :: DescribeHsmConfigurations
s@DescribeHsmConfigurations' {} Maybe Text
a -> DescribeHsmConfigurations
s {$sel:marker:DescribeHsmConfigurations' :: Maybe Text
marker = Maybe Text
a} :: DescribeHsmConfigurations)

-- | 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.
describeHsmConfigurations_maxRecords :: Lens.Lens' DescribeHsmConfigurations (Prelude.Maybe Prelude.Int)
describeHsmConfigurations_maxRecords :: (Maybe Int -> f (Maybe Int))
-> DescribeHsmConfigurations -> f DescribeHsmConfigurations
describeHsmConfigurations_maxRecords = (DescribeHsmConfigurations -> Maybe Int)
-> (DescribeHsmConfigurations
    -> Maybe Int -> DescribeHsmConfigurations)
-> Lens
     DescribeHsmConfigurations
     DescribeHsmConfigurations
     (Maybe Int)
     (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeHsmConfigurations' {Maybe Int
maxRecords :: Maybe Int
$sel:maxRecords:DescribeHsmConfigurations' :: DescribeHsmConfigurations -> Maybe Int
maxRecords} -> Maybe Int
maxRecords) (\s :: DescribeHsmConfigurations
s@DescribeHsmConfigurations' {} Maybe Int
a -> DescribeHsmConfigurations
s {$sel:maxRecords:DescribeHsmConfigurations' :: Maybe Int
maxRecords = Maybe Int
a} :: DescribeHsmConfigurations)

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

instance Prelude.NFData DescribeHsmConfigurations

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

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

instance Core.ToQuery DescribeHsmConfigurations where
  toQuery :: DescribeHsmConfigurations -> QueryString
toQuery DescribeHsmConfigurations' {Maybe Int
Maybe [Text]
Maybe Text
maxRecords :: Maybe Int
marker :: Maybe Text
tagKeys :: Maybe [Text]
hsmConfigurationIdentifier :: Maybe Text
tagValues :: Maybe [Text]
$sel:maxRecords:DescribeHsmConfigurations' :: DescribeHsmConfigurations -> Maybe Int
$sel:marker:DescribeHsmConfigurations' :: DescribeHsmConfigurations -> Maybe Text
$sel:tagKeys:DescribeHsmConfigurations' :: DescribeHsmConfigurations -> Maybe [Text]
$sel:hsmConfigurationIdentifier:DescribeHsmConfigurations' :: DescribeHsmConfigurations -> Maybe Text
$sel:tagValues:DescribeHsmConfigurations' :: DescribeHsmConfigurations -> 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
"DescribeHsmConfigurations" :: Prelude.ByteString),
        ByteString
"Version"
          ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"2012-12-01" :: Prelude.ByteString),
        ByteString
"TagValues"
          ByteString -> QueryString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe QueryString -> QueryString
forall a. ToQuery a => a -> QueryString
Core.toQuery
            (ByteString -> [Text] -> QueryString
forall a.
(IsList a, ToQuery (Item a)) =>
ByteString -> a -> QueryString
Core.toQueryList ByteString
"TagValue" ([Text] -> QueryString) -> Maybe [Text] -> Maybe QueryString
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Text]
tagValues),
        ByteString
"HsmConfigurationIdentifier"
          ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
hsmConfigurationIdentifier,
        ByteString
"TagKeys"
          ByteString -> QueryString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe QueryString -> QueryString
forall a. ToQuery a => a -> QueryString
Core.toQuery
            (ByteString -> [Text] -> QueryString
forall a.
(IsList a, ToQuery (Item a)) =>
ByteString -> a -> QueryString
Core.toQueryList ByteString
"TagKey" ([Text] -> QueryString) -> Maybe [Text] -> Maybe QueryString
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Text]
tagKeys),
        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
      ]

-- |
--
-- /See:/ 'newDescribeHsmConfigurationsResponse' smart constructor.
data DescribeHsmConfigurationsResponse = DescribeHsmConfigurationsResponse'
  { -- | 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.
    DescribeHsmConfigurationsResponse -> Maybe Text
marker :: Prelude.Maybe Prelude.Text,
    -- | A list of @HsmConfiguration@ objects.
    DescribeHsmConfigurationsResponse -> Maybe [HsmConfiguration]
hsmConfigurations :: Prelude.Maybe [HsmConfiguration],
    -- | The response's http status code.
    DescribeHsmConfigurationsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DescribeHsmConfigurationsResponse
-> DescribeHsmConfigurationsResponse -> Bool
(DescribeHsmConfigurationsResponse
 -> DescribeHsmConfigurationsResponse -> Bool)
-> (DescribeHsmConfigurationsResponse
    -> DescribeHsmConfigurationsResponse -> Bool)
-> Eq DescribeHsmConfigurationsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeHsmConfigurationsResponse
-> DescribeHsmConfigurationsResponse -> Bool
$c/= :: DescribeHsmConfigurationsResponse
-> DescribeHsmConfigurationsResponse -> Bool
== :: DescribeHsmConfigurationsResponse
-> DescribeHsmConfigurationsResponse -> Bool
$c== :: DescribeHsmConfigurationsResponse
-> DescribeHsmConfigurationsResponse -> Bool
Prelude.Eq, ReadPrec [DescribeHsmConfigurationsResponse]
ReadPrec DescribeHsmConfigurationsResponse
Int -> ReadS DescribeHsmConfigurationsResponse
ReadS [DescribeHsmConfigurationsResponse]
(Int -> ReadS DescribeHsmConfigurationsResponse)
-> ReadS [DescribeHsmConfigurationsResponse]
-> ReadPrec DescribeHsmConfigurationsResponse
-> ReadPrec [DescribeHsmConfigurationsResponse]
-> Read DescribeHsmConfigurationsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeHsmConfigurationsResponse]
$creadListPrec :: ReadPrec [DescribeHsmConfigurationsResponse]
readPrec :: ReadPrec DescribeHsmConfigurationsResponse
$creadPrec :: ReadPrec DescribeHsmConfigurationsResponse
readList :: ReadS [DescribeHsmConfigurationsResponse]
$creadList :: ReadS [DescribeHsmConfigurationsResponse]
readsPrec :: Int -> ReadS DescribeHsmConfigurationsResponse
$creadsPrec :: Int -> ReadS DescribeHsmConfigurationsResponse
Prelude.Read, Int -> DescribeHsmConfigurationsResponse -> ShowS
[DescribeHsmConfigurationsResponse] -> ShowS
DescribeHsmConfigurationsResponse -> String
(Int -> DescribeHsmConfigurationsResponse -> ShowS)
-> (DescribeHsmConfigurationsResponse -> String)
-> ([DescribeHsmConfigurationsResponse] -> ShowS)
-> Show DescribeHsmConfigurationsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeHsmConfigurationsResponse] -> ShowS
$cshowList :: [DescribeHsmConfigurationsResponse] -> ShowS
show :: DescribeHsmConfigurationsResponse -> String
$cshow :: DescribeHsmConfigurationsResponse -> String
showsPrec :: Int -> DescribeHsmConfigurationsResponse -> ShowS
$cshowsPrec :: Int -> DescribeHsmConfigurationsResponse -> ShowS
Prelude.Show, (forall x.
 DescribeHsmConfigurationsResponse
 -> Rep DescribeHsmConfigurationsResponse x)
-> (forall x.
    Rep DescribeHsmConfigurationsResponse x
    -> DescribeHsmConfigurationsResponse)
-> Generic DescribeHsmConfigurationsResponse
forall x.
Rep DescribeHsmConfigurationsResponse x
-> DescribeHsmConfigurationsResponse
forall x.
DescribeHsmConfigurationsResponse
-> Rep DescribeHsmConfigurationsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeHsmConfigurationsResponse x
-> DescribeHsmConfigurationsResponse
$cfrom :: forall x.
DescribeHsmConfigurationsResponse
-> Rep DescribeHsmConfigurationsResponse x
Prelude.Generic)

-- |
-- Create a value of 'DescribeHsmConfigurationsResponse' 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', 'describeHsmConfigurationsResponse_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.
--
-- 'hsmConfigurations', 'describeHsmConfigurationsResponse_hsmConfigurations' - A list of @HsmConfiguration@ objects.
--
-- 'httpStatus', 'describeHsmConfigurationsResponse_httpStatus' - The response's http status code.
newDescribeHsmConfigurationsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DescribeHsmConfigurationsResponse
newDescribeHsmConfigurationsResponse :: Int -> DescribeHsmConfigurationsResponse
newDescribeHsmConfigurationsResponse Int
pHttpStatus_ =
  DescribeHsmConfigurationsResponse' :: Maybe Text
-> Maybe [HsmConfiguration]
-> Int
-> DescribeHsmConfigurationsResponse
DescribeHsmConfigurationsResponse'
    { $sel:marker:DescribeHsmConfigurationsResponse' :: Maybe Text
marker =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:hsmConfigurations:DescribeHsmConfigurationsResponse' :: Maybe [HsmConfiguration]
hsmConfigurations = Maybe [HsmConfiguration]
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DescribeHsmConfigurationsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | 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.
describeHsmConfigurationsResponse_marker :: Lens.Lens' DescribeHsmConfigurationsResponse (Prelude.Maybe Prelude.Text)
describeHsmConfigurationsResponse_marker :: (Maybe Text -> f (Maybe Text))
-> DescribeHsmConfigurationsResponse
-> f DescribeHsmConfigurationsResponse
describeHsmConfigurationsResponse_marker = (DescribeHsmConfigurationsResponse -> Maybe Text)
-> (DescribeHsmConfigurationsResponse
    -> Maybe Text -> DescribeHsmConfigurationsResponse)
-> Lens' DescribeHsmConfigurationsResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeHsmConfigurationsResponse' {Maybe Text
marker :: Maybe Text
$sel:marker:DescribeHsmConfigurationsResponse' :: DescribeHsmConfigurationsResponse -> Maybe Text
marker} -> Maybe Text
marker) (\s :: DescribeHsmConfigurationsResponse
s@DescribeHsmConfigurationsResponse' {} Maybe Text
a -> DescribeHsmConfigurationsResponse
s {$sel:marker:DescribeHsmConfigurationsResponse' :: Maybe Text
marker = Maybe Text
a} :: DescribeHsmConfigurationsResponse)

-- | A list of @HsmConfiguration@ objects.
describeHsmConfigurationsResponse_hsmConfigurations :: Lens.Lens' DescribeHsmConfigurationsResponse (Prelude.Maybe [HsmConfiguration])
describeHsmConfigurationsResponse_hsmConfigurations :: (Maybe [HsmConfiguration] -> f (Maybe [HsmConfiguration]))
-> DescribeHsmConfigurationsResponse
-> f DescribeHsmConfigurationsResponse
describeHsmConfigurationsResponse_hsmConfigurations = (DescribeHsmConfigurationsResponse -> Maybe [HsmConfiguration])
-> (DescribeHsmConfigurationsResponse
    -> Maybe [HsmConfiguration] -> DescribeHsmConfigurationsResponse)
-> Lens'
     DescribeHsmConfigurationsResponse (Maybe [HsmConfiguration])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeHsmConfigurationsResponse' {Maybe [HsmConfiguration]
hsmConfigurations :: Maybe [HsmConfiguration]
$sel:hsmConfigurations:DescribeHsmConfigurationsResponse' :: DescribeHsmConfigurationsResponse -> Maybe [HsmConfiguration]
hsmConfigurations} -> Maybe [HsmConfiguration]
hsmConfigurations) (\s :: DescribeHsmConfigurationsResponse
s@DescribeHsmConfigurationsResponse' {} Maybe [HsmConfiguration]
a -> DescribeHsmConfigurationsResponse
s {$sel:hsmConfigurations:DescribeHsmConfigurationsResponse' :: Maybe [HsmConfiguration]
hsmConfigurations = Maybe [HsmConfiguration]
a} :: DescribeHsmConfigurationsResponse) ((Maybe [HsmConfiguration] -> f (Maybe [HsmConfiguration]))
 -> DescribeHsmConfigurationsResponse
 -> f DescribeHsmConfigurationsResponse)
-> ((Maybe [HsmConfiguration] -> f (Maybe [HsmConfiguration]))
    -> Maybe [HsmConfiguration] -> f (Maybe [HsmConfiguration]))
-> (Maybe [HsmConfiguration] -> f (Maybe [HsmConfiguration]))
-> DescribeHsmConfigurationsResponse
-> f DescribeHsmConfigurationsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [HsmConfiguration]
  [HsmConfiguration]
  [HsmConfiguration]
  [HsmConfiguration]
-> Iso
     (Maybe [HsmConfiguration])
     (Maybe [HsmConfiguration])
     (Maybe [HsmConfiguration])
     (Maybe [HsmConfiguration])
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
  [HsmConfiguration]
  [HsmConfiguration]
  [HsmConfiguration]
  [HsmConfiguration]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance
  Prelude.NFData
    DescribeHsmConfigurationsResponse