{-# 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.IAM.ListOpenIDConnectProviders
-- 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)
--
-- Lists information about the IAM OpenID Connect (OIDC) provider resource
-- objects defined in the Amazon Web Services account.
--
-- IAM resource-listing operations return a subset of the available
-- attributes for the resource. For example, this operation does not return
-- tags, even though they are an attribute of the returned object. To view
-- all of the information for an OIDC provider, see
-- GetOpenIDConnectProvider.
module Amazonka.IAM.ListOpenIDConnectProviders
  ( -- * Creating a Request
    ListOpenIDConnectProviders (..),
    newListOpenIDConnectProviders,

    -- * Destructuring the Response
    ListOpenIDConnectProvidersResponse (..),
    newListOpenIDConnectProvidersResponse,

    -- * Response Lenses
    listOpenIDConnectProvidersResponse_openIDConnectProviderList,
    listOpenIDConnectProvidersResponse_httpStatus,
  )
where

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

-- | /See:/ 'newListOpenIDConnectProviders' smart constructor.
data ListOpenIDConnectProviders = ListOpenIDConnectProviders'
  {
  }
  deriving (ListOpenIDConnectProviders -> ListOpenIDConnectProviders -> Bool
(ListOpenIDConnectProviders -> ListOpenIDConnectProviders -> Bool)
-> (ListOpenIDConnectProviders
    -> ListOpenIDConnectProviders -> Bool)
-> Eq ListOpenIDConnectProviders
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListOpenIDConnectProviders -> ListOpenIDConnectProviders -> Bool
$c/= :: ListOpenIDConnectProviders -> ListOpenIDConnectProviders -> Bool
== :: ListOpenIDConnectProviders -> ListOpenIDConnectProviders -> Bool
$c== :: ListOpenIDConnectProviders -> ListOpenIDConnectProviders -> Bool
Prelude.Eq, ReadPrec [ListOpenIDConnectProviders]
ReadPrec ListOpenIDConnectProviders
Int -> ReadS ListOpenIDConnectProviders
ReadS [ListOpenIDConnectProviders]
(Int -> ReadS ListOpenIDConnectProviders)
-> ReadS [ListOpenIDConnectProviders]
-> ReadPrec ListOpenIDConnectProviders
-> ReadPrec [ListOpenIDConnectProviders]
-> Read ListOpenIDConnectProviders
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListOpenIDConnectProviders]
$creadListPrec :: ReadPrec [ListOpenIDConnectProviders]
readPrec :: ReadPrec ListOpenIDConnectProviders
$creadPrec :: ReadPrec ListOpenIDConnectProviders
readList :: ReadS [ListOpenIDConnectProviders]
$creadList :: ReadS [ListOpenIDConnectProviders]
readsPrec :: Int -> ReadS ListOpenIDConnectProviders
$creadsPrec :: Int -> ReadS ListOpenIDConnectProviders
Prelude.Read, Int -> ListOpenIDConnectProviders -> ShowS
[ListOpenIDConnectProviders] -> ShowS
ListOpenIDConnectProviders -> String
(Int -> ListOpenIDConnectProviders -> ShowS)
-> (ListOpenIDConnectProviders -> String)
-> ([ListOpenIDConnectProviders] -> ShowS)
-> Show ListOpenIDConnectProviders
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListOpenIDConnectProviders] -> ShowS
$cshowList :: [ListOpenIDConnectProviders] -> ShowS
show :: ListOpenIDConnectProviders -> String
$cshow :: ListOpenIDConnectProviders -> String
showsPrec :: Int -> ListOpenIDConnectProviders -> ShowS
$cshowsPrec :: Int -> ListOpenIDConnectProviders -> ShowS
Prelude.Show, (forall x.
 ListOpenIDConnectProviders -> Rep ListOpenIDConnectProviders x)
-> (forall x.
    Rep ListOpenIDConnectProviders x -> ListOpenIDConnectProviders)
-> Generic ListOpenIDConnectProviders
forall x.
Rep ListOpenIDConnectProviders x -> ListOpenIDConnectProviders
forall x.
ListOpenIDConnectProviders -> Rep ListOpenIDConnectProviders x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListOpenIDConnectProviders x -> ListOpenIDConnectProviders
$cfrom :: forall x.
ListOpenIDConnectProviders -> Rep ListOpenIDConnectProviders x
Prelude.Generic)

-- |
-- Create a value of 'ListOpenIDConnectProviders' 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.
newListOpenIDConnectProviders ::
  ListOpenIDConnectProviders
newListOpenIDConnectProviders :: ListOpenIDConnectProviders
newListOpenIDConnectProviders =
  ListOpenIDConnectProviders
ListOpenIDConnectProviders'

instance Core.AWSRequest ListOpenIDConnectProviders where
  type
    AWSResponse ListOpenIDConnectProviders =
      ListOpenIDConnectProvidersResponse
  request :: ListOpenIDConnectProviders -> Request ListOpenIDConnectProviders
request = Service
-> ListOpenIDConnectProviders -> Request ListOpenIDConnectProviders
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery Service
defaultService
  response :: Logger
-> Service
-> Proxy ListOpenIDConnectProviders
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ListOpenIDConnectProviders)))
response =
    Text
-> (Int
    -> ResponseHeaders
    -> [Node]
    -> Either String (AWSResponse ListOpenIDConnectProviders))
-> Logger
-> Service
-> Proxy ListOpenIDConnectProviders
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ListOpenIDConnectProviders)))
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
"ListOpenIDConnectProvidersResult"
      ( \Int
s ResponseHeaders
h [Node]
x ->
          Maybe [OpenIDConnectProviderListEntry]
-> Int -> ListOpenIDConnectProvidersResponse
ListOpenIDConnectProvidersResponse'
            (Maybe [OpenIDConnectProviderListEntry]
 -> Int -> ListOpenIDConnectProvidersResponse)
-> Either String (Maybe [OpenIDConnectProviderListEntry])
-> Either String (Int -> ListOpenIDConnectProvidersResponse)
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
"OpenIDConnectProviderList"
                            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 [OpenIDConnectProviderListEntry]))
-> Either String (Maybe [OpenIDConnectProviderListEntry])
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= ([Node] -> Either String [OpenIDConnectProviderListEntry])
-> [Node] -> Either String (Maybe [OpenIDConnectProviderListEntry])
forall (f :: * -> *) a b.
Applicative f =>
([a] -> f b) -> [a] -> f (Maybe b)
Core.may (Text -> [Node] -> Either String [OpenIDConnectProviderListEntry]
forall a. FromXML a => Text -> [Node] -> Either String [a]
Core.parseXMLList Text
"member")
                        )
            Either String (Int -> ListOpenIDConnectProvidersResponse)
-> Either String Int
-> Either String ListOpenIDConnectProvidersResponse
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 ListOpenIDConnectProviders

instance Prelude.NFData ListOpenIDConnectProviders

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

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

instance Core.ToQuery ListOpenIDConnectProviders where
  toQuery :: ListOpenIDConnectProviders -> QueryString
toQuery =
    QueryString -> ListOpenIDConnectProviders -> QueryString
forall a b. a -> b -> a
Prelude.const
      ( [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ ByteString
"Action"
              ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"ListOpenIDConnectProviders" :: Prelude.ByteString),
            ByteString
"Version"
              ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"2010-05-08" :: Prelude.ByteString)
          ]
      )

-- | Contains the response to a successful ListOpenIDConnectProviders
-- request.
--
-- /See:/ 'newListOpenIDConnectProvidersResponse' smart constructor.
data ListOpenIDConnectProvidersResponse = ListOpenIDConnectProvidersResponse'
  { -- | The list of IAM OIDC provider resource objects defined in the Amazon Web
    -- Services account.
    ListOpenIDConnectProvidersResponse
-> Maybe [OpenIDConnectProviderListEntry]
openIDConnectProviderList :: Prelude.Maybe [OpenIDConnectProviderListEntry],
    -- | The response's http status code.
    ListOpenIDConnectProvidersResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ListOpenIDConnectProvidersResponse
-> ListOpenIDConnectProvidersResponse -> Bool
(ListOpenIDConnectProvidersResponse
 -> ListOpenIDConnectProvidersResponse -> Bool)
-> (ListOpenIDConnectProvidersResponse
    -> ListOpenIDConnectProvidersResponse -> Bool)
-> Eq ListOpenIDConnectProvidersResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListOpenIDConnectProvidersResponse
-> ListOpenIDConnectProvidersResponse -> Bool
$c/= :: ListOpenIDConnectProvidersResponse
-> ListOpenIDConnectProvidersResponse -> Bool
== :: ListOpenIDConnectProvidersResponse
-> ListOpenIDConnectProvidersResponse -> Bool
$c== :: ListOpenIDConnectProvidersResponse
-> ListOpenIDConnectProvidersResponse -> Bool
Prelude.Eq, ReadPrec [ListOpenIDConnectProvidersResponse]
ReadPrec ListOpenIDConnectProvidersResponse
Int -> ReadS ListOpenIDConnectProvidersResponse
ReadS [ListOpenIDConnectProvidersResponse]
(Int -> ReadS ListOpenIDConnectProvidersResponse)
-> ReadS [ListOpenIDConnectProvidersResponse]
-> ReadPrec ListOpenIDConnectProvidersResponse
-> ReadPrec [ListOpenIDConnectProvidersResponse]
-> Read ListOpenIDConnectProvidersResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListOpenIDConnectProvidersResponse]
$creadListPrec :: ReadPrec [ListOpenIDConnectProvidersResponse]
readPrec :: ReadPrec ListOpenIDConnectProvidersResponse
$creadPrec :: ReadPrec ListOpenIDConnectProvidersResponse
readList :: ReadS [ListOpenIDConnectProvidersResponse]
$creadList :: ReadS [ListOpenIDConnectProvidersResponse]
readsPrec :: Int -> ReadS ListOpenIDConnectProvidersResponse
$creadsPrec :: Int -> ReadS ListOpenIDConnectProvidersResponse
Prelude.Read, Int -> ListOpenIDConnectProvidersResponse -> ShowS
[ListOpenIDConnectProvidersResponse] -> ShowS
ListOpenIDConnectProvidersResponse -> String
(Int -> ListOpenIDConnectProvidersResponse -> ShowS)
-> (ListOpenIDConnectProvidersResponse -> String)
-> ([ListOpenIDConnectProvidersResponse] -> ShowS)
-> Show ListOpenIDConnectProvidersResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListOpenIDConnectProvidersResponse] -> ShowS
$cshowList :: [ListOpenIDConnectProvidersResponse] -> ShowS
show :: ListOpenIDConnectProvidersResponse -> String
$cshow :: ListOpenIDConnectProvidersResponse -> String
showsPrec :: Int -> ListOpenIDConnectProvidersResponse -> ShowS
$cshowsPrec :: Int -> ListOpenIDConnectProvidersResponse -> ShowS
Prelude.Show, (forall x.
 ListOpenIDConnectProvidersResponse
 -> Rep ListOpenIDConnectProvidersResponse x)
-> (forall x.
    Rep ListOpenIDConnectProvidersResponse x
    -> ListOpenIDConnectProvidersResponse)
-> Generic ListOpenIDConnectProvidersResponse
forall x.
Rep ListOpenIDConnectProvidersResponse x
-> ListOpenIDConnectProvidersResponse
forall x.
ListOpenIDConnectProvidersResponse
-> Rep ListOpenIDConnectProvidersResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListOpenIDConnectProvidersResponse x
-> ListOpenIDConnectProvidersResponse
$cfrom :: forall x.
ListOpenIDConnectProvidersResponse
-> Rep ListOpenIDConnectProvidersResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListOpenIDConnectProvidersResponse' 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:
--
-- 'openIDConnectProviderList', 'listOpenIDConnectProvidersResponse_openIDConnectProviderList' - The list of IAM OIDC provider resource objects defined in the Amazon Web
-- Services account.
--
-- 'httpStatus', 'listOpenIDConnectProvidersResponse_httpStatus' - The response's http status code.
newListOpenIDConnectProvidersResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListOpenIDConnectProvidersResponse
newListOpenIDConnectProvidersResponse :: Int -> ListOpenIDConnectProvidersResponse
newListOpenIDConnectProvidersResponse Int
pHttpStatus_ =
  ListOpenIDConnectProvidersResponse' :: Maybe [OpenIDConnectProviderListEntry]
-> Int -> ListOpenIDConnectProvidersResponse
ListOpenIDConnectProvidersResponse'
    { $sel:openIDConnectProviderList:ListOpenIDConnectProvidersResponse' :: Maybe [OpenIDConnectProviderListEntry]
openIDConnectProviderList =
        Maybe [OpenIDConnectProviderListEntry]
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListOpenIDConnectProvidersResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The list of IAM OIDC provider resource objects defined in the Amazon Web
-- Services account.
listOpenIDConnectProvidersResponse_openIDConnectProviderList :: Lens.Lens' ListOpenIDConnectProvidersResponse (Prelude.Maybe [OpenIDConnectProviderListEntry])
listOpenIDConnectProvidersResponse_openIDConnectProviderList :: (Maybe [OpenIDConnectProviderListEntry]
 -> f (Maybe [OpenIDConnectProviderListEntry]))
-> ListOpenIDConnectProvidersResponse
-> f ListOpenIDConnectProvidersResponse
listOpenIDConnectProvidersResponse_openIDConnectProviderList = (ListOpenIDConnectProvidersResponse
 -> Maybe [OpenIDConnectProviderListEntry])
-> (ListOpenIDConnectProvidersResponse
    -> Maybe [OpenIDConnectProviderListEntry]
    -> ListOpenIDConnectProvidersResponse)
-> Lens
     ListOpenIDConnectProvidersResponse
     ListOpenIDConnectProvidersResponse
     (Maybe [OpenIDConnectProviderListEntry])
     (Maybe [OpenIDConnectProviderListEntry])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListOpenIDConnectProvidersResponse' {Maybe [OpenIDConnectProviderListEntry]
openIDConnectProviderList :: Maybe [OpenIDConnectProviderListEntry]
$sel:openIDConnectProviderList:ListOpenIDConnectProvidersResponse' :: ListOpenIDConnectProvidersResponse
-> Maybe [OpenIDConnectProviderListEntry]
openIDConnectProviderList} -> Maybe [OpenIDConnectProviderListEntry]
openIDConnectProviderList) (\s :: ListOpenIDConnectProvidersResponse
s@ListOpenIDConnectProvidersResponse' {} Maybe [OpenIDConnectProviderListEntry]
a -> ListOpenIDConnectProvidersResponse
s {$sel:openIDConnectProviderList:ListOpenIDConnectProvidersResponse' :: Maybe [OpenIDConnectProviderListEntry]
openIDConnectProviderList = Maybe [OpenIDConnectProviderListEntry]
a} :: ListOpenIDConnectProvidersResponse) ((Maybe [OpenIDConnectProviderListEntry]
  -> f (Maybe [OpenIDConnectProviderListEntry]))
 -> ListOpenIDConnectProvidersResponse
 -> f ListOpenIDConnectProvidersResponse)
-> ((Maybe [OpenIDConnectProviderListEntry]
     -> f (Maybe [OpenIDConnectProviderListEntry]))
    -> Maybe [OpenIDConnectProviderListEntry]
    -> f (Maybe [OpenIDConnectProviderListEntry]))
-> (Maybe [OpenIDConnectProviderListEntry]
    -> f (Maybe [OpenIDConnectProviderListEntry]))
-> ListOpenIDConnectProvidersResponse
-> f ListOpenIDConnectProvidersResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [OpenIDConnectProviderListEntry]
  [OpenIDConnectProviderListEntry]
  [OpenIDConnectProviderListEntry]
  [OpenIDConnectProviderListEntry]
-> Iso
     (Maybe [OpenIDConnectProviderListEntry])
     (Maybe [OpenIDConnectProviderListEntry])
     (Maybe [OpenIDConnectProviderListEntry])
     (Maybe [OpenIDConnectProviderListEntry])
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
  [OpenIDConnectProviderListEntry]
  [OpenIDConnectProviderListEntry]
  [OpenIDConnectProviderListEntry]
  [OpenIDConnectProviderListEntry]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance
  Prelude.NFData
    ListOpenIDConnectProvidersResponse