{-# 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.DescribeEndpointAuthorization
-- 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 an endpoint authorization.
--
-- This operation returns paginated results.
module Amazonka.Redshift.DescribeEndpointAuthorization
  ( -- * Creating a Request
    DescribeEndpointAuthorization (..),
    newDescribeEndpointAuthorization,

    -- * Request Lenses
    describeEndpointAuthorization_clusterIdentifier,
    describeEndpointAuthorization_account,
    describeEndpointAuthorization_marker,
    describeEndpointAuthorization_maxRecords,
    describeEndpointAuthorization_grantee,

    -- * Destructuring the Response
    DescribeEndpointAuthorizationResponse (..),
    newDescribeEndpointAuthorizationResponse,

    -- * Response Lenses
    describeEndpointAuthorizationResponse_endpointAuthorizationList,
    describeEndpointAuthorizationResponse_marker,
    describeEndpointAuthorizationResponse_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:/ 'newDescribeEndpointAuthorization' smart constructor.
data DescribeEndpointAuthorization = DescribeEndpointAuthorization'
  { -- | The cluster identifier of the cluster to access.
    DescribeEndpointAuthorization -> Maybe Text
clusterIdentifier :: Prelude.Maybe Prelude.Text,
    -- | The AAmazon Web Services account ID of either the cluster owner
    -- (grantor) or grantee. If @Grantee@ parameter is true, then the @Account@
    -- value is of the grantor.
    DescribeEndpointAuthorization -> Maybe Text
account :: Prelude.Maybe Prelude.Text,
    -- | An optional pagination token provided by a previous
    -- @DescribeEndpointAuthorization@ request. If this parameter is specified,
    -- the response includes only records beyond the marker, up to the value
    -- specified by the @MaxRecords@ parameter.
    DescribeEndpointAuthorization -> 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.
    DescribeEndpointAuthorization -> Maybe Int
maxRecords :: Prelude.Maybe Prelude.Int,
    -- | Indicates whether to check authorization from a grantor or grantee point
    -- of view. If true, Amazon Redshift returns endpoint authorizations that
    -- you\'ve been granted. If false (default), checks authorization from a
    -- grantor point of view.
    DescribeEndpointAuthorization -> Maybe Bool
grantee :: Prelude.Maybe Prelude.Bool
  }
  deriving (DescribeEndpointAuthorization
-> DescribeEndpointAuthorization -> Bool
(DescribeEndpointAuthorization
 -> DescribeEndpointAuthorization -> Bool)
-> (DescribeEndpointAuthorization
    -> DescribeEndpointAuthorization -> Bool)
-> Eq DescribeEndpointAuthorization
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeEndpointAuthorization
-> DescribeEndpointAuthorization -> Bool
$c/= :: DescribeEndpointAuthorization
-> DescribeEndpointAuthorization -> Bool
== :: DescribeEndpointAuthorization
-> DescribeEndpointAuthorization -> Bool
$c== :: DescribeEndpointAuthorization
-> DescribeEndpointAuthorization -> Bool
Prelude.Eq, ReadPrec [DescribeEndpointAuthorization]
ReadPrec DescribeEndpointAuthorization
Int -> ReadS DescribeEndpointAuthorization
ReadS [DescribeEndpointAuthorization]
(Int -> ReadS DescribeEndpointAuthorization)
-> ReadS [DescribeEndpointAuthorization]
-> ReadPrec DescribeEndpointAuthorization
-> ReadPrec [DescribeEndpointAuthorization]
-> Read DescribeEndpointAuthorization
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeEndpointAuthorization]
$creadListPrec :: ReadPrec [DescribeEndpointAuthorization]
readPrec :: ReadPrec DescribeEndpointAuthorization
$creadPrec :: ReadPrec DescribeEndpointAuthorization
readList :: ReadS [DescribeEndpointAuthorization]
$creadList :: ReadS [DescribeEndpointAuthorization]
readsPrec :: Int -> ReadS DescribeEndpointAuthorization
$creadsPrec :: Int -> ReadS DescribeEndpointAuthorization
Prelude.Read, Int -> DescribeEndpointAuthorization -> ShowS
[DescribeEndpointAuthorization] -> ShowS
DescribeEndpointAuthorization -> String
(Int -> DescribeEndpointAuthorization -> ShowS)
-> (DescribeEndpointAuthorization -> String)
-> ([DescribeEndpointAuthorization] -> ShowS)
-> Show DescribeEndpointAuthorization
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeEndpointAuthorization] -> ShowS
$cshowList :: [DescribeEndpointAuthorization] -> ShowS
show :: DescribeEndpointAuthorization -> String
$cshow :: DescribeEndpointAuthorization -> String
showsPrec :: Int -> DescribeEndpointAuthorization -> ShowS
$cshowsPrec :: Int -> DescribeEndpointAuthorization -> ShowS
Prelude.Show, (forall x.
 DescribeEndpointAuthorization
 -> Rep DescribeEndpointAuthorization x)
-> (forall x.
    Rep DescribeEndpointAuthorization x
    -> DescribeEndpointAuthorization)
-> Generic DescribeEndpointAuthorization
forall x.
Rep DescribeEndpointAuthorization x
-> DescribeEndpointAuthorization
forall x.
DescribeEndpointAuthorization
-> Rep DescribeEndpointAuthorization x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeEndpointAuthorization x
-> DescribeEndpointAuthorization
$cfrom :: forall x.
DescribeEndpointAuthorization
-> Rep DescribeEndpointAuthorization x
Prelude.Generic)

-- |
-- Create a value of 'DescribeEndpointAuthorization' 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:
--
-- 'clusterIdentifier', 'describeEndpointAuthorization_clusterIdentifier' - The cluster identifier of the cluster to access.
--
-- 'account', 'describeEndpointAuthorization_account' - The AAmazon Web Services account ID of either the cluster owner
-- (grantor) or grantee. If @Grantee@ parameter is true, then the @Account@
-- value is of the grantor.
--
-- 'marker', 'describeEndpointAuthorization_marker' - An optional pagination token provided by a previous
-- @DescribeEndpointAuthorization@ request. If this parameter is specified,
-- the response includes only records beyond the marker, up to the value
-- specified by the @MaxRecords@ parameter.
--
-- 'maxRecords', 'describeEndpointAuthorization_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.
--
-- 'grantee', 'describeEndpointAuthorization_grantee' - Indicates whether to check authorization from a grantor or grantee point
-- of view. If true, Amazon Redshift returns endpoint authorizations that
-- you\'ve been granted. If false (default), checks authorization from a
-- grantor point of view.
newDescribeEndpointAuthorization ::
  DescribeEndpointAuthorization
newDescribeEndpointAuthorization :: DescribeEndpointAuthorization
newDescribeEndpointAuthorization =
  DescribeEndpointAuthorization' :: Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Int
-> Maybe Bool
-> DescribeEndpointAuthorization
DescribeEndpointAuthorization'
    { $sel:clusterIdentifier:DescribeEndpointAuthorization' :: Maybe Text
clusterIdentifier =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:account:DescribeEndpointAuthorization' :: Maybe Text
account = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:marker:DescribeEndpointAuthorization' :: Maybe Text
marker = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxRecords:DescribeEndpointAuthorization' :: Maybe Int
maxRecords = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:grantee:DescribeEndpointAuthorization' :: Maybe Bool
grantee = Maybe Bool
forall a. Maybe a
Prelude.Nothing
    }

-- | The cluster identifier of the cluster to access.
describeEndpointAuthorization_clusterIdentifier :: Lens.Lens' DescribeEndpointAuthorization (Prelude.Maybe Prelude.Text)
describeEndpointAuthorization_clusterIdentifier :: (Maybe Text -> f (Maybe Text))
-> DescribeEndpointAuthorization -> f DescribeEndpointAuthorization
describeEndpointAuthorization_clusterIdentifier = (DescribeEndpointAuthorization -> Maybe Text)
-> (DescribeEndpointAuthorization
    -> Maybe Text -> DescribeEndpointAuthorization)
-> Lens
     DescribeEndpointAuthorization
     DescribeEndpointAuthorization
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeEndpointAuthorization' {Maybe Text
clusterIdentifier :: Maybe Text
$sel:clusterIdentifier:DescribeEndpointAuthorization' :: DescribeEndpointAuthorization -> Maybe Text
clusterIdentifier} -> Maybe Text
clusterIdentifier) (\s :: DescribeEndpointAuthorization
s@DescribeEndpointAuthorization' {} Maybe Text
a -> DescribeEndpointAuthorization
s {$sel:clusterIdentifier:DescribeEndpointAuthorization' :: Maybe Text
clusterIdentifier = Maybe Text
a} :: DescribeEndpointAuthorization)

-- | The AAmazon Web Services account ID of either the cluster owner
-- (grantor) or grantee. If @Grantee@ parameter is true, then the @Account@
-- value is of the grantor.
describeEndpointAuthorization_account :: Lens.Lens' DescribeEndpointAuthorization (Prelude.Maybe Prelude.Text)
describeEndpointAuthorization_account :: (Maybe Text -> f (Maybe Text))
-> DescribeEndpointAuthorization -> f DescribeEndpointAuthorization
describeEndpointAuthorization_account = (DescribeEndpointAuthorization -> Maybe Text)
-> (DescribeEndpointAuthorization
    -> Maybe Text -> DescribeEndpointAuthorization)
-> Lens
     DescribeEndpointAuthorization
     DescribeEndpointAuthorization
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeEndpointAuthorization' {Maybe Text
account :: Maybe Text
$sel:account:DescribeEndpointAuthorization' :: DescribeEndpointAuthorization -> Maybe Text
account} -> Maybe Text
account) (\s :: DescribeEndpointAuthorization
s@DescribeEndpointAuthorization' {} Maybe Text
a -> DescribeEndpointAuthorization
s {$sel:account:DescribeEndpointAuthorization' :: Maybe Text
account = Maybe Text
a} :: DescribeEndpointAuthorization)

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

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

-- | Indicates whether to check authorization from a grantor or grantee point
-- of view. If true, Amazon Redshift returns endpoint authorizations that
-- you\'ve been granted. If false (default), checks authorization from a
-- grantor point of view.
describeEndpointAuthorization_grantee :: Lens.Lens' DescribeEndpointAuthorization (Prelude.Maybe Prelude.Bool)
describeEndpointAuthorization_grantee :: (Maybe Bool -> f (Maybe Bool))
-> DescribeEndpointAuthorization -> f DescribeEndpointAuthorization
describeEndpointAuthorization_grantee = (DescribeEndpointAuthorization -> Maybe Bool)
-> (DescribeEndpointAuthorization
    -> Maybe Bool -> DescribeEndpointAuthorization)
-> Lens
     DescribeEndpointAuthorization
     DescribeEndpointAuthorization
     (Maybe Bool)
     (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeEndpointAuthorization' {Maybe Bool
grantee :: Maybe Bool
$sel:grantee:DescribeEndpointAuthorization' :: DescribeEndpointAuthorization -> Maybe Bool
grantee} -> Maybe Bool
grantee) (\s :: DescribeEndpointAuthorization
s@DescribeEndpointAuthorization' {} Maybe Bool
a -> DescribeEndpointAuthorization
s {$sel:grantee:DescribeEndpointAuthorization' :: Maybe Bool
grantee = Maybe Bool
a} :: DescribeEndpointAuthorization)

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

instance Prelude.NFData DescribeEndpointAuthorization

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

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

instance Core.ToQuery DescribeEndpointAuthorization where
  toQuery :: DescribeEndpointAuthorization -> QueryString
toQuery DescribeEndpointAuthorization' {Maybe Bool
Maybe Int
Maybe Text
grantee :: Maybe Bool
maxRecords :: Maybe Int
marker :: Maybe Text
account :: Maybe Text
clusterIdentifier :: Maybe Text
$sel:grantee:DescribeEndpointAuthorization' :: DescribeEndpointAuthorization -> Maybe Bool
$sel:maxRecords:DescribeEndpointAuthorization' :: DescribeEndpointAuthorization -> Maybe Int
$sel:marker:DescribeEndpointAuthorization' :: DescribeEndpointAuthorization -> Maybe Text
$sel:account:DescribeEndpointAuthorization' :: DescribeEndpointAuthorization -> Maybe Text
$sel:clusterIdentifier:DescribeEndpointAuthorization' :: DescribeEndpointAuthorization -> 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
"DescribeEndpointAuthorization" ::
                      Prelude.ByteString
                  ),
        ByteString
"Version"
          ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"2012-12-01" :: Prelude.ByteString),
        ByteString
"ClusterIdentifier" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
clusterIdentifier,
        ByteString
"Account" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
account,
        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
"Grantee" ByteString -> Maybe Bool -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Bool
grantee
      ]

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

-- |
-- Create a value of 'DescribeEndpointAuthorizationResponse' 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:
--
-- 'endpointAuthorizationList', 'describeEndpointAuthorizationResponse_endpointAuthorizationList' - The authorizations to an endpoint.
--
-- 'marker', 'describeEndpointAuthorizationResponse_marker' - An optional pagination token provided by a previous
-- @DescribeEndpointAuthorization@ request. If this parameter is specified,
-- the response includes only records beyond the marker, up to the value
-- specified by the @MaxRecords@ parameter.
--
-- 'httpStatus', 'describeEndpointAuthorizationResponse_httpStatus' - The response's http status code.
newDescribeEndpointAuthorizationResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DescribeEndpointAuthorizationResponse
newDescribeEndpointAuthorizationResponse :: Int -> DescribeEndpointAuthorizationResponse
newDescribeEndpointAuthorizationResponse Int
pHttpStatus_ =
  DescribeEndpointAuthorizationResponse' :: Maybe [EndpointAuthorization]
-> Maybe Text -> Int -> DescribeEndpointAuthorizationResponse
DescribeEndpointAuthorizationResponse'
    { $sel:endpointAuthorizationList:DescribeEndpointAuthorizationResponse' :: Maybe [EndpointAuthorization]
endpointAuthorizationList =
        Maybe [EndpointAuthorization]
forall a. Maybe a
Prelude.Nothing,
      $sel:marker:DescribeEndpointAuthorizationResponse' :: Maybe Text
marker = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DescribeEndpointAuthorizationResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The authorizations to an endpoint.
describeEndpointAuthorizationResponse_endpointAuthorizationList :: Lens.Lens' DescribeEndpointAuthorizationResponse (Prelude.Maybe [EndpointAuthorization])
describeEndpointAuthorizationResponse_endpointAuthorizationList :: (Maybe [EndpointAuthorization]
 -> f (Maybe [EndpointAuthorization]))
-> DescribeEndpointAuthorizationResponse
-> f DescribeEndpointAuthorizationResponse
describeEndpointAuthorizationResponse_endpointAuthorizationList = (DescribeEndpointAuthorizationResponse
 -> Maybe [EndpointAuthorization])
-> (DescribeEndpointAuthorizationResponse
    -> Maybe [EndpointAuthorization]
    -> DescribeEndpointAuthorizationResponse)
-> Lens'
     DescribeEndpointAuthorizationResponse
     (Maybe [EndpointAuthorization])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeEndpointAuthorizationResponse' {Maybe [EndpointAuthorization]
endpointAuthorizationList :: Maybe [EndpointAuthorization]
$sel:endpointAuthorizationList:DescribeEndpointAuthorizationResponse' :: DescribeEndpointAuthorizationResponse
-> Maybe [EndpointAuthorization]
endpointAuthorizationList} -> Maybe [EndpointAuthorization]
endpointAuthorizationList) (\s :: DescribeEndpointAuthorizationResponse
s@DescribeEndpointAuthorizationResponse' {} Maybe [EndpointAuthorization]
a -> DescribeEndpointAuthorizationResponse
s {$sel:endpointAuthorizationList:DescribeEndpointAuthorizationResponse' :: Maybe [EndpointAuthorization]
endpointAuthorizationList = Maybe [EndpointAuthorization]
a} :: DescribeEndpointAuthorizationResponse) ((Maybe [EndpointAuthorization]
  -> f (Maybe [EndpointAuthorization]))
 -> DescribeEndpointAuthorizationResponse
 -> f DescribeEndpointAuthorizationResponse)
-> ((Maybe [EndpointAuthorization]
     -> f (Maybe [EndpointAuthorization]))
    -> Maybe [EndpointAuthorization]
    -> f (Maybe [EndpointAuthorization]))
-> (Maybe [EndpointAuthorization]
    -> f (Maybe [EndpointAuthorization]))
-> DescribeEndpointAuthorizationResponse
-> f DescribeEndpointAuthorizationResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [EndpointAuthorization]
  [EndpointAuthorization]
  [EndpointAuthorization]
  [EndpointAuthorization]
-> Iso
     (Maybe [EndpointAuthorization])
     (Maybe [EndpointAuthorization])
     (Maybe [EndpointAuthorization])
     (Maybe [EndpointAuthorization])
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
  [EndpointAuthorization]
  [EndpointAuthorization]
  [EndpointAuthorization]
  [EndpointAuthorization]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

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

instance
  Prelude.NFData
    DescribeEndpointAuthorizationResponse