{-# 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.DescribeEndpointAccess
-- 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)
--
-- Describes a Redshift-managed VPC endpoint.
--
-- This operation returns paginated results.
module Amazonka.Redshift.DescribeEndpointAccess
  ( -- * Creating a Request
    DescribeEndpointAccess (..),
    newDescribeEndpointAccess,

    -- * Request Lenses
    describeEndpointAccess_endpointName,
    describeEndpointAccess_vpcId,
    describeEndpointAccess_clusterIdentifier,
    describeEndpointAccess_marker,
    describeEndpointAccess_maxRecords,
    describeEndpointAccess_resourceOwner,

    -- * Destructuring the Response
    DescribeEndpointAccessResponse (..),
    newDescribeEndpointAccessResponse,

    -- * Response Lenses
    describeEndpointAccessResponse_marker,
    describeEndpointAccessResponse_endpointAccessList,
    describeEndpointAccessResponse_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:/ 'newDescribeEndpointAccess' smart constructor.
data DescribeEndpointAccess = DescribeEndpointAccess'
  { -- | The name of the endpoint to be described.
    DescribeEndpointAccess -> Maybe Text
endpointName :: Prelude.Maybe Prelude.Text,
    -- | The virtual private cloud (VPC) identifier with access to the cluster.
    DescribeEndpointAccess -> Maybe Text
vpcId :: Prelude.Maybe Prelude.Text,
    -- | The cluster identifier associated with the described endpoint.
    DescribeEndpointAccess -> Maybe Text
clusterIdentifier :: Prelude.Maybe Prelude.Text,
    -- | An optional pagination token provided by a previous
    -- @DescribeEndpointAccess@ request. If this parameter is specified, the
    -- response includes only records beyond the marker, up to the value
    -- specified by the @MaxRecords@ parameter.
    DescribeEndpointAccess -> 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 that the remaining
    -- results can be retrieved.
    DescribeEndpointAccess -> Maybe Int
maxRecords :: Prelude.Maybe Prelude.Int,
    -- | The Amazon Web Services account ID of the owner of the cluster.
    DescribeEndpointAccess -> Maybe Text
resourceOwner :: Prelude.Maybe Prelude.Text
  }
  deriving (DescribeEndpointAccess -> DescribeEndpointAccess -> Bool
(DescribeEndpointAccess -> DescribeEndpointAccess -> Bool)
-> (DescribeEndpointAccess -> DescribeEndpointAccess -> Bool)
-> Eq DescribeEndpointAccess
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeEndpointAccess -> DescribeEndpointAccess -> Bool
$c/= :: DescribeEndpointAccess -> DescribeEndpointAccess -> Bool
== :: DescribeEndpointAccess -> DescribeEndpointAccess -> Bool
$c== :: DescribeEndpointAccess -> DescribeEndpointAccess -> Bool
Prelude.Eq, ReadPrec [DescribeEndpointAccess]
ReadPrec DescribeEndpointAccess
Int -> ReadS DescribeEndpointAccess
ReadS [DescribeEndpointAccess]
(Int -> ReadS DescribeEndpointAccess)
-> ReadS [DescribeEndpointAccess]
-> ReadPrec DescribeEndpointAccess
-> ReadPrec [DescribeEndpointAccess]
-> Read DescribeEndpointAccess
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeEndpointAccess]
$creadListPrec :: ReadPrec [DescribeEndpointAccess]
readPrec :: ReadPrec DescribeEndpointAccess
$creadPrec :: ReadPrec DescribeEndpointAccess
readList :: ReadS [DescribeEndpointAccess]
$creadList :: ReadS [DescribeEndpointAccess]
readsPrec :: Int -> ReadS DescribeEndpointAccess
$creadsPrec :: Int -> ReadS DescribeEndpointAccess
Prelude.Read, Int -> DescribeEndpointAccess -> ShowS
[DescribeEndpointAccess] -> ShowS
DescribeEndpointAccess -> String
(Int -> DescribeEndpointAccess -> ShowS)
-> (DescribeEndpointAccess -> String)
-> ([DescribeEndpointAccess] -> ShowS)
-> Show DescribeEndpointAccess
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeEndpointAccess] -> ShowS
$cshowList :: [DescribeEndpointAccess] -> ShowS
show :: DescribeEndpointAccess -> String
$cshow :: DescribeEndpointAccess -> String
showsPrec :: Int -> DescribeEndpointAccess -> ShowS
$cshowsPrec :: Int -> DescribeEndpointAccess -> ShowS
Prelude.Show, (forall x. DescribeEndpointAccess -> Rep DescribeEndpointAccess x)
-> (forall x.
    Rep DescribeEndpointAccess x -> DescribeEndpointAccess)
-> Generic DescribeEndpointAccess
forall x. Rep DescribeEndpointAccess x -> DescribeEndpointAccess
forall x. DescribeEndpointAccess -> Rep DescribeEndpointAccess x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeEndpointAccess x -> DescribeEndpointAccess
$cfrom :: forall x. DescribeEndpointAccess -> Rep DescribeEndpointAccess x
Prelude.Generic)

-- |
-- Create a value of 'DescribeEndpointAccess' 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:
--
-- 'endpointName', 'describeEndpointAccess_endpointName' - The name of the endpoint to be described.
--
-- 'vpcId', 'describeEndpointAccess_vpcId' - The virtual private cloud (VPC) identifier with access to the cluster.
--
-- 'clusterIdentifier', 'describeEndpointAccess_clusterIdentifier' - The cluster identifier associated with the described endpoint.
--
-- 'marker', 'describeEndpointAccess_marker' - An optional pagination token provided by a previous
-- @DescribeEndpointAccess@ request. If this parameter is specified, the
-- response includes only records beyond the marker, up to the value
-- specified by the @MaxRecords@ parameter.
--
-- 'maxRecords', 'describeEndpointAccess_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 that the remaining
-- results can be retrieved.
--
-- 'resourceOwner', 'describeEndpointAccess_resourceOwner' - The Amazon Web Services account ID of the owner of the cluster.
newDescribeEndpointAccess ::
  DescribeEndpointAccess
newDescribeEndpointAccess :: DescribeEndpointAccess
newDescribeEndpointAccess =
  DescribeEndpointAccess' :: Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Int
-> Maybe Text
-> DescribeEndpointAccess
DescribeEndpointAccess'
    { $sel:endpointName:DescribeEndpointAccess' :: Maybe Text
endpointName =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:vpcId:DescribeEndpointAccess' :: Maybe Text
vpcId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:clusterIdentifier:DescribeEndpointAccess' :: Maybe Text
clusterIdentifier = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:marker:DescribeEndpointAccess' :: Maybe Text
marker = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxRecords:DescribeEndpointAccess' :: Maybe Int
maxRecords = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:resourceOwner:DescribeEndpointAccess' :: Maybe Text
resourceOwner = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The name of the endpoint to be described.
describeEndpointAccess_endpointName :: Lens.Lens' DescribeEndpointAccess (Prelude.Maybe Prelude.Text)
describeEndpointAccess_endpointName :: (Maybe Text -> f (Maybe Text))
-> DescribeEndpointAccess -> f DescribeEndpointAccess
describeEndpointAccess_endpointName = (DescribeEndpointAccess -> Maybe Text)
-> (DescribeEndpointAccess -> Maybe Text -> DescribeEndpointAccess)
-> Lens
     DescribeEndpointAccess
     DescribeEndpointAccess
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeEndpointAccess' {Maybe Text
endpointName :: Maybe Text
$sel:endpointName:DescribeEndpointAccess' :: DescribeEndpointAccess -> Maybe Text
endpointName} -> Maybe Text
endpointName) (\s :: DescribeEndpointAccess
s@DescribeEndpointAccess' {} Maybe Text
a -> DescribeEndpointAccess
s {$sel:endpointName:DescribeEndpointAccess' :: Maybe Text
endpointName = Maybe Text
a} :: DescribeEndpointAccess)

-- | The virtual private cloud (VPC) identifier with access to the cluster.
describeEndpointAccess_vpcId :: Lens.Lens' DescribeEndpointAccess (Prelude.Maybe Prelude.Text)
describeEndpointAccess_vpcId :: (Maybe Text -> f (Maybe Text))
-> DescribeEndpointAccess -> f DescribeEndpointAccess
describeEndpointAccess_vpcId = (DescribeEndpointAccess -> Maybe Text)
-> (DescribeEndpointAccess -> Maybe Text -> DescribeEndpointAccess)
-> Lens
     DescribeEndpointAccess
     DescribeEndpointAccess
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeEndpointAccess' {Maybe Text
vpcId :: Maybe Text
$sel:vpcId:DescribeEndpointAccess' :: DescribeEndpointAccess -> Maybe Text
vpcId} -> Maybe Text
vpcId) (\s :: DescribeEndpointAccess
s@DescribeEndpointAccess' {} Maybe Text
a -> DescribeEndpointAccess
s {$sel:vpcId:DescribeEndpointAccess' :: Maybe Text
vpcId = Maybe Text
a} :: DescribeEndpointAccess)

-- | The cluster identifier associated with the described endpoint.
describeEndpointAccess_clusterIdentifier :: Lens.Lens' DescribeEndpointAccess (Prelude.Maybe Prelude.Text)
describeEndpointAccess_clusterIdentifier :: (Maybe Text -> f (Maybe Text))
-> DescribeEndpointAccess -> f DescribeEndpointAccess
describeEndpointAccess_clusterIdentifier = (DescribeEndpointAccess -> Maybe Text)
-> (DescribeEndpointAccess -> Maybe Text -> DescribeEndpointAccess)
-> Lens
     DescribeEndpointAccess
     DescribeEndpointAccess
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeEndpointAccess' {Maybe Text
clusterIdentifier :: Maybe Text
$sel:clusterIdentifier:DescribeEndpointAccess' :: DescribeEndpointAccess -> Maybe Text
clusterIdentifier} -> Maybe Text
clusterIdentifier) (\s :: DescribeEndpointAccess
s@DescribeEndpointAccess' {} Maybe Text
a -> DescribeEndpointAccess
s {$sel:clusterIdentifier:DescribeEndpointAccess' :: Maybe Text
clusterIdentifier = Maybe Text
a} :: DescribeEndpointAccess)

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

-- | 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 that the remaining
-- results can be retrieved.
describeEndpointAccess_maxRecords :: Lens.Lens' DescribeEndpointAccess (Prelude.Maybe Prelude.Int)
describeEndpointAccess_maxRecords :: (Maybe Int -> f (Maybe Int))
-> DescribeEndpointAccess -> f DescribeEndpointAccess
describeEndpointAccess_maxRecords = (DescribeEndpointAccess -> Maybe Int)
-> (DescribeEndpointAccess -> Maybe Int -> DescribeEndpointAccess)
-> Lens
     DescribeEndpointAccess
     DescribeEndpointAccess
     (Maybe Int)
     (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeEndpointAccess' {Maybe Int
maxRecords :: Maybe Int
$sel:maxRecords:DescribeEndpointAccess' :: DescribeEndpointAccess -> Maybe Int
maxRecords} -> Maybe Int
maxRecords) (\s :: DescribeEndpointAccess
s@DescribeEndpointAccess' {} Maybe Int
a -> DescribeEndpointAccess
s {$sel:maxRecords:DescribeEndpointAccess' :: Maybe Int
maxRecords = Maybe Int
a} :: DescribeEndpointAccess)

-- | The Amazon Web Services account ID of the owner of the cluster.
describeEndpointAccess_resourceOwner :: Lens.Lens' DescribeEndpointAccess (Prelude.Maybe Prelude.Text)
describeEndpointAccess_resourceOwner :: (Maybe Text -> f (Maybe Text))
-> DescribeEndpointAccess -> f DescribeEndpointAccess
describeEndpointAccess_resourceOwner = (DescribeEndpointAccess -> Maybe Text)
-> (DescribeEndpointAccess -> Maybe Text -> DescribeEndpointAccess)
-> Lens
     DescribeEndpointAccess
     DescribeEndpointAccess
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeEndpointAccess' {Maybe Text
resourceOwner :: Maybe Text
$sel:resourceOwner:DescribeEndpointAccess' :: DescribeEndpointAccess -> Maybe Text
resourceOwner} -> Maybe Text
resourceOwner) (\s :: DescribeEndpointAccess
s@DescribeEndpointAccess' {} Maybe Text
a -> DescribeEndpointAccess
s {$sel:resourceOwner:DescribeEndpointAccess' :: Maybe Text
resourceOwner = Maybe Text
a} :: DescribeEndpointAccess)

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

instance Prelude.NFData DescribeEndpointAccess

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

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

instance Core.ToQuery DescribeEndpointAccess where
  toQuery :: DescribeEndpointAccess -> QueryString
toQuery DescribeEndpointAccess' {Maybe Int
Maybe Text
resourceOwner :: Maybe Text
maxRecords :: Maybe Int
marker :: Maybe Text
clusterIdentifier :: Maybe Text
vpcId :: Maybe Text
endpointName :: Maybe Text
$sel:resourceOwner:DescribeEndpointAccess' :: DescribeEndpointAccess -> Maybe Text
$sel:maxRecords:DescribeEndpointAccess' :: DescribeEndpointAccess -> Maybe Int
$sel:marker:DescribeEndpointAccess' :: DescribeEndpointAccess -> Maybe Text
$sel:clusterIdentifier:DescribeEndpointAccess' :: DescribeEndpointAccess -> Maybe Text
$sel:vpcId:DescribeEndpointAccess' :: DescribeEndpointAccess -> Maybe Text
$sel:endpointName:DescribeEndpointAccess' :: DescribeEndpointAccess -> 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
"DescribeEndpointAccess" :: Prelude.ByteString),
        ByteString
"Version"
          ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"2012-12-01" :: Prelude.ByteString),
        ByteString
"EndpointName" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
endpointName,
        ByteString
"VpcId" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
vpcId,
        ByteString
"ClusterIdentifier" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
clusterIdentifier,
        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
"ResourceOwner" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
resourceOwner
      ]

-- | /See:/ 'newDescribeEndpointAccessResponse' smart constructor.
data DescribeEndpointAccessResponse = DescribeEndpointAccessResponse'
  { -- | An optional pagination token provided by a previous
    -- @DescribeEndpointAccess@ request. If this parameter is specified, the
    -- response includes only records beyond the marker, up to the value
    -- specified by the @MaxRecords@ parameter.
    DescribeEndpointAccessResponse -> Maybe Text
marker :: Prelude.Maybe Prelude.Text,
    -- | The list of endpoints with access to the cluster.
    DescribeEndpointAccessResponse -> Maybe [EndpointAccess]
endpointAccessList :: Prelude.Maybe [EndpointAccess],
    -- | The response's http status code.
    DescribeEndpointAccessResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DescribeEndpointAccessResponse
-> DescribeEndpointAccessResponse -> Bool
(DescribeEndpointAccessResponse
 -> DescribeEndpointAccessResponse -> Bool)
-> (DescribeEndpointAccessResponse
    -> DescribeEndpointAccessResponse -> Bool)
-> Eq DescribeEndpointAccessResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeEndpointAccessResponse
-> DescribeEndpointAccessResponse -> Bool
$c/= :: DescribeEndpointAccessResponse
-> DescribeEndpointAccessResponse -> Bool
== :: DescribeEndpointAccessResponse
-> DescribeEndpointAccessResponse -> Bool
$c== :: DescribeEndpointAccessResponse
-> DescribeEndpointAccessResponse -> Bool
Prelude.Eq, ReadPrec [DescribeEndpointAccessResponse]
ReadPrec DescribeEndpointAccessResponse
Int -> ReadS DescribeEndpointAccessResponse
ReadS [DescribeEndpointAccessResponse]
(Int -> ReadS DescribeEndpointAccessResponse)
-> ReadS [DescribeEndpointAccessResponse]
-> ReadPrec DescribeEndpointAccessResponse
-> ReadPrec [DescribeEndpointAccessResponse]
-> Read DescribeEndpointAccessResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeEndpointAccessResponse]
$creadListPrec :: ReadPrec [DescribeEndpointAccessResponse]
readPrec :: ReadPrec DescribeEndpointAccessResponse
$creadPrec :: ReadPrec DescribeEndpointAccessResponse
readList :: ReadS [DescribeEndpointAccessResponse]
$creadList :: ReadS [DescribeEndpointAccessResponse]
readsPrec :: Int -> ReadS DescribeEndpointAccessResponse
$creadsPrec :: Int -> ReadS DescribeEndpointAccessResponse
Prelude.Read, Int -> DescribeEndpointAccessResponse -> ShowS
[DescribeEndpointAccessResponse] -> ShowS
DescribeEndpointAccessResponse -> String
(Int -> DescribeEndpointAccessResponse -> ShowS)
-> (DescribeEndpointAccessResponse -> String)
-> ([DescribeEndpointAccessResponse] -> ShowS)
-> Show DescribeEndpointAccessResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeEndpointAccessResponse] -> ShowS
$cshowList :: [DescribeEndpointAccessResponse] -> ShowS
show :: DescribeEndpointAccessResponse -> String
$cshow :: DescribeEndpointAccessResponse -> String
showsPrec :: Int -> DescribeEndpointAccessResponse -> ShowS
$cshowsPrec :: Int -> DescribeEndpointAccessResponse -> ShowS
Prelude.Show, (forall x.
 DescribeEndpointAccessResponse
 -> Rep DescribeEndpointAccessResponse x)
-> (forall x.
    Rep DescribeEndpointAccessResponse x
    -> DescribeEndpointAccessResponse)
-> Generic DescribeEndpointAccessResponse
forall x.
Rep DescribeEndpointAccessResponse x
-> DescribeEndpointAccessResponse
forall x.
DescribeEndpointAccessResponse
-> Rep DescribeEndpointAccessResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeEndpointAccessResponse x
-> DescribeEndpointAccessResponse
$cfrom :: forall x.
DescribeEndpointAccessResponse
-> Rep DescribeEndpointAccessResponse x
Prelude.Generic)

-- |
-- Create a value of 'DescribeEndpointAccessResponse' 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', 'describeEndpointAccessResponse_marker' - An optional pagination token provided by a previous
-- @DescribeEndpointAccess@ request. If this parameter is specified, the
-- response includes only records beyond the marker, up to the value
-- specified by the @MaxRecords@ parameter.
--
-- 'endpointAccessList', 'describeEndpointAccessResponse_endpointAccessList' - The list of endpoints with access to the cluster.
--
-- 'httpStatus', 'describeEndpointAccessResponse_httpStatus' - The response's http status code.
newDescribeEndpointAccessResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DescribeEndpointAccessResponse
newDescribeEndpointAccessResponse :: Int -> DescribeEndpointAccessResponse
newDescribeEndpointAccessResponse Int
pHttpStatus_ =
  DescribeEndpointAccessResponse' :: Maybe Text
-> Maybe [EndpointAccess] -> Int -> DescribeEndpointAccessResponse
DescribeEndpointAccessResponse'
    { $sel:marker:DescribeEndpointAccessResponse' :: Maybe Text
marker =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:endpointAccessList:DescribeEndpointAccessResponse' :: Maybe [EndpointAccess]
endpointAccessList = Maybe [EndpointAccess]
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DescribeEndpointAccessResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

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

-- | The list of endpoints with access to the cluster.
describeEndpointAccessResponse_endpointAccessList :: Lens.Lens' DescribeEndpointAccessResponse (Prelude.Maybe [EndpointAccess])
describeEndpointAccessResponse_endpointAccessList :: (Maybe [EndpointAccess] -> f (Maybe [EndpointAccess]))
-> DescribeEndpointAccessResponse
-> f DescribeEndpointAccessResponse
describeEndpointAccessResponse_endpointAccessList = (DescribeEndpointAccessResponse -> Maybe [EndpointAccess])
-> (DescribeEndpointAccessResponse
    -> Maybe [EndpointAccess] -> DescribeEndpointAccessResponse)
-> Lens' DescribeEndpointAccessResponse (Maybe [EndpointAccess])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeEndpointAccessResponse' {Maybe [EndpointAccess]
endpointAccessList :: Maybe [EndpointAccess]
$sel:endpointAccessList:DescribeEndpointAccessResponse' :: DescribeEndpointAccessResponse -> Maybe [EndpointAccess]
endpointAccessList} -> Maybe [EndpointAccess]
endpointAccessList) (\s :: DescribeEndpointAccessResponse
s@DescribeEndpointAccessResponse' {} Maybe [EndpointAccess]
a -> DescribeEndpointAccessResponse
s {$sel:endpointAccessList:DescribeEndpointAccessResponse' :: Maybe [EndpointAccess]
endpointAccessList = Maybe [EndpointAccess]
a} :: DescribeEndpointAccessResponse) ((Maybe [EndpointAccess] -> f (Maybe [EndpointAccess]))
 -> DescribeEndpointAccessResponse
 -> f DescribeEndpointAccessResponse)
-> ((Maybe [EndpointAccess] -> f (Maybe [EndpointAccess]))
    -> Maybe [EndpointAccess] -> f (Maybe [EndpointAccess]))
-> (Maybe [EndpointAccess] -> f (Maybe [EndpointAccess]))
-> DescribeEndpointAccessResponse
-> f DescribeEndpointAccessResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [EndpointAccess] [EndpointAccess] [EndpointAccess] [EndpointAccess]
-> Iso
     (Maybe [EndpointAccess])
     (Maybe [EndpointAccess])
     (Maybe [EndpointAccess])
     (Maybe [EndpointAccess])
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
  [EndpointAccess] [EndpointAccess] [EndpointAccess] [EndpointAccess]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance
  Prelude.NFData
    DescribeEndpointAccessResponse