{-# 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.AddClientIDToOpenIDConnectProvider
-- 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)
--
-- Adds a new client ID (also known as audience) to the list of client IDs
-- already registered for the specified IAM OpenID Connect (OIDC) provider
-- resource.
--
-- This operation is idempotent; it does not fail or return an error if you
-- add an existing client ID to the provider.
module Amazonka.IAM.AddClientIDToOpenIDConnectProvider
  ( -- * Creating a Request
    AddClientIDToOpenIDConnectProvider (..),
    newAddClientIDToOpenIDConnectProvider,

    -- * Request Lenses
    addClientIDToOpenIDConnectProvider_openIDConnectProviderArn,
    addClientIDToOpenIDConnectProvider_clientID,

    -- * Destructuring the Response
    AddClientIDToOpenIDConnectProviderResponse (..),
    newAddClientIDToOpenIDConnectProviderResponse,
  )
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:/ 'newAddClientIDToOpenIDConnectProvider' smart constructor.
data AddClientIDToOpenIDConnectProvider = AddClientIDToOpenIDConnectProvider'
  { -- | The Amazon Resource Name (ARN) of the IAM OpenID Connect (OIDC) provider
    -- resource to add the client ID to. You can get a list of OIDC provider
    -- ARNs by using the ListOpenIDConnectProviders operation.
    AddClientIDToOpenIDConnectProvider -> Text
openIDConnectProviderArn :: Prelude.Text,
    -- | The client ID (also known as audience) to add to the IAM OpenID Connect
    -- provider resource.
    AddClientIDToOpenIDConnectProvider -> Text
clientID :: Prelude.Text
  }
  deriving (AddClientIDToOpenIDConnectProvider
-> AddClientIDToOpenIDConnectProvider -> Bool
(AddClientIDToOpenIDConnectProvider
 -> AddClientIDToOpenIDConnectProvider -> Bool)
-> (AddClientIDToOpenIDConnectProvider
    -> AddClientIDToOpenIDConnectProvider -> Bool)
-> Eq AddClientIDToOpenIDConnectProvider
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AddClientIDToOpenIDConnectProvider
-> AddClientIDToOpenIDConnectProvider -> Bool
$c/= :: AddClientIDToOpenIDConnectProvider
-> AddClientIDToOpenIDConnectProvider -> Bool
== :: AddClientIDToOpenIDConnectProvider
-> AddClientIDToOpenIDConnectProvider -> Bool
$c== :: AddClientIDToOpenIDConnectProvider
-> AddClientIDToOpenIDConnectProvider -> Bool
Prelude.Eq, ReadPrec [AddClientIDToOpenIDConnectProvider]
ReadPrec AddClientIDToOpenIDConnectProvider
Int -> ReadS AddClientIDToOpenIDConnectProvider
ReadS [AddClientIDToOpenIDConnectProvider]
(Int -> ReadS AddClientIDToOpenIDConnectProvider)
-> ReadS [AddClientIDToOpenIDConnectProvider]
-> ReadPrec AddClientIDToOpenIDConnectProvider
-> ReadPrec [AddClientIDToOpenIDConnectProvider]
-> Read AddClientIDToOpenIDConnectProvider
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AddClientIDToOpenIDConnectProvider]
$creadListPrec :: ReadPrec [AddClientIDToOpenIDConnectProvider]
readPrec :: ReadPrec AddClientIDToOpenIDConnectProvider
$creadPrec :: ReadPrec AddClientIDToOpenIDConnectProvider
readList :: ReadS [AddClientIDToOpenIDConnectProvider]
$creadList :: ReadS [AddClientIDToOpenIDConnectProvider]
readsPrec :: Int -> ReadS AddClientIDToOpenIDConnectProvider
$creadsPrec :: Int -> ReadS AddClientIDToOpenIDConnectProvider
Prelude.Read, Int -> AddClientIDToOpenIDConnectProvider -> ShowS
[AddClientIDToOpenIDConnectProvider] -> ShowS
AddClientIDToOpenIDConnectProvider -> String
(Int -> AddClientIDToOpenIDConnectProvider -> ShowS)
-> (AddClientIDToOpenIDConnectProvider -> String)
-> ([AddClientIDToOpenIDConnectProvider] -> ShowS)
-> Show AddClientIDToOpenIDConnectProvider
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AddClientIDToOpenIDConnectProvider] -> ShowS
$cshowList :: [AddClientIDToOpenIDConnectProvider] -> ShowS
show :: AddClientIDToOpenIDConnectProvider -> String
$cshow :: AddClientIDToOpenIDConnectProvider -> String
showsPrec :: Int -> AddClientIDToOpenIDConnectProvider -> ShowS
$cshowsPrec :: Int -> AddClientIDToOpenIDConnectProvider -> ShowS
Prelude.Show, (forall x.
 AddClientIDToOpenIDConnectProvider
 -> Rep AddClientIDToOpenIDConnectProvider x)
-> (forall x.
    Rep AddClientIDToOpenIDConnectProvider x
    -> AddClientIDToOpenIDConnectProvider)
-> Generic AddClientIDToOpenIDConnectProvider
forall x.
Rep AddClientIDToOpenIDConnectProvider x
-> AddClientIDToOpenIDConnectProvider
forall x.
AddClientIDToOpenIDConnectProvider
-> Rep AddClientIDToOpenIDConnectProvider x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AddClientIDToOpenIDConnectProvider x
-> AddClientIDToOpenIDConnectProvider
$cfrom :: forall x.
AddClientIDToOpenIDConnectProvider
-> Rep AddClientIDToOpenIDConnectProvider x
Prelude.Generic)

-- |
-- Create a value of 'AddClientIDToOpenIDConnectProvider' 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:
--
-- 'openIDConnectProviderArn', 'addClientIDToOpenIDConnectProvider_openIDConnectProviderArn' - The Amazon Resource Name (ARN) of the IAM OpenID Connect (OIDC) provider
-- resource to add the client ID to. You can get a list of OIDC provider
-- ARNs by using the ListOpenIDConnectProviders operation.
--
-- 'clientID', 'addClientIDToOpenIDConnectProvider_clientID' - The client ID (also known as audience) to add to the IAM OpenID Connect
-- provider resource.
newAddClientIDToOpenIDConnectProvider ::
  -- | 'openIDConnectProviderArn'
  Prelude.Text ->
  -- | 'clientID'
  Prelude.Text ->
  AddClientIDToOpenIDConnectProvider
newAddClientIDToOpenIDConnectProvider :: Text -> Text -> AddClientIDToOpenIDConnectProvider
newAddClientIDToOpenIDConnectProvider
  Text
pOpenIDConnectProviderArn_
  Text
pClientID_ =
    AddClientIDToOpenIDConnectProvider' :: Text -> Text -> AddClientIDToOpenIDConnectProvider
AddClientIDToOpenIDConnectProvider'
      { $sel:openIDConnectProviderArn:AddClientIDToOpenIDConnectProvider' :: Text
openIDConnectProviderArn =
          Text
pOpenIDConnectProviderArn_,
        $sel:clientID:AddClientIDToOpenIDConnectProvider' :: Text
clientID = Text
pClientID_
      }

-- | The Amazon Resource Name (ARN) of the IAM OpenID Connect (OIDC) provider
-- resource to add the client ID to. You can get a list of OIDC provider
-- ARNs by using the ListOpenIDConnectProviders operation.
addClientIDToOpenIDConnectProvider_openIDConnectProviderArn :: Lens.Lens' AddClientIDToOpenIDConnectProvider Prelude.Text
addClientIDToOpenIDConnectProvider_openIDConnectProviderArn :: (Text -> f Text)
-> AddClientIDToOpenIDConnectProvider
-> f AddClientIDToOpenIDConnectProvider
addClientIDToOpenIDConnectProvider_openIDConnectProviderArn = (AddClientIDToOpenIDConnectProvider -> Text)
-> (AddClientIDToOpenIDConnectProvider
    -> Text -> AddClientIDToOpenIDConnectProvider)
-> Lens
     AddClientIDToOpenIDConnectProvider
     AddClientIDToOpenIDConnectProvider
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AddClientIDToOpenIDConnectProvider' {Text
openIDConnectProviderArn :: Text
$sel:openIDConnectProviderArn:AddClientIDToOpenIDConnectProvider' :: AddClientIDToOpenIDConnectProvider -> Text
openIDConnectProviderArn} -> Text
openIDConnectProviderArn) (\s :: AddClientIDToOpenIDConnectProvider
s@AddClientIDToOpenIDConnectProvider' {} Text
a -> AddClientIDToOpenIDConnectProvider
s {$sel:openIDConnectProviderArn:AddClientIDToOpenIDConnectProvider' :: Text
openIDConnectProviderArn = Text
a} :: AddClientIDToOpenIDConnectProvider)

-- | The client ID (also known as audience) to add to the IAM OpenID Connect
-- provider resource.
addClientIDToOpenIDConnectProvider_clientID :: Lens.Lens' AddClientIDToOpenIDConnectProvider Prelude.Text
addClientIDToOpenIDConnectProvider_clientID :: (Text -> f Text)
-> AddClientIDToOpenIDConnectProvider
-> f AddClientIDToOpenIDConnectProvider
addClientIDToOpenIDConnectProvider_clientID = (AddClientIDToOpenIDConnectProvider -> Text)
-> (AddClientIDToOpenIDConnectProvider
    -> Text -> AddClientIDToOpenIDConnectProvider)
-> Lens
     AddClientIDToOpenIDConnectProvider
     AddClientIDToOpenIDConnectProvider
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AddClientIDToOpenIDConnectProvider' {Text
clientID :: Text
$sel:clientID:AddClientIDToOpenIDConnectProvider' :: AddClientIDToOpenIDConnectProvider -> Text
clientID} -> Text
clientID) (\s :: AddClientIDToOpenIDConnectProvider
s@AddClientIDToOpenIDConnectProvider' {} Text
a -> AddClientIDToOpenIDConnectProvider
s {$sel:clientID:AddClientIDToOpenIDConnectProvider' :: Text
clientID = Text
a} :: AddClientIDToOpenIDConnectProvider)

instance
  Core.AWSRequest
    AddClientIDToOpenIDConnectProvider
  where
  type
    AWSResponse AddClientIDToOpenIDConnectProvider =
      AddClientIDToOpenIDConnectProviderResponse
  request :: AddClientIDToOpenIDConnectProvider
-> Request AddClientIDToOpenIDConnectProvider
request = Service
-> AddClientIDToOpenIDConnectProvider
-> Request AddClientIDToOpenIDConnectProvider
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery Service
defaultService
  response :: Logger
-> Service
-> Proxy AddClientIDToOpenIDConnectProvider
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse (AWSResponse AddClientIDToOpenIDConnectProvider)))
response =
    AWSResponse AddClientIDToOpenIDConnectProvider
-> Logger
-> Service
-> Proxy AddClientIDToOpenIDConnectProvider
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse (AWSResponse AddClientIDToOpenIDConnectProvider)))
forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull
      AWSResponse AddClientIDToOpenIDConnectProvider
AddClientIDToOpenIDConnectProviderResponse
AddClientIDToOpenIDConnectProviderResponse'

instance
  Prelude.Hashable
    AddClientIDToOpenIDConnectProvider

instance
  Prelude.NFData
    AddClientIDToOpenIDConnectProvider

instance
  Core.ToHeaders
    AddClientIDToOpenIDConnectProvider
  where
  toHeaders :: AddClientIDToOpenIDConnectProvider -> [Header]
toHeaders = [Header] -> AddClientIDToOpenIDConnectProvider -> [Header]
forall a b. a -> b -> a
Prelude.const [Header]
forall a. Monoid a => a
Prelude.mempty

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

instance
  Core.ToQuery
    AddClientIDToOpenIDConnectProvider
  where
  toQuery :: AddClientIDToOpenIDConnectProvider -> QueryString
toQuery AddClientIDToOpenIDConnectProvider' {Text
clientID :: Text
openIDConnectProviderArn :: Text
$sel:clientID:AddClientIDToOpenIDConnectProvider' :: AddClientIDToOpenIDConnectProvider -> Text
$sel:openIDConnectProviderArn:AddClientIDToOpenIDConnectProvider' :: AddClientIDToOpenIDConnectProvider -> 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
"AddClientIDToOpenIDConnectProvider" ::
                      Prelude.ByteString
                  ),
        ByteString
"Version"
          ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"2010-05-08" :: Prelude.ByteString),
        ByteString
"OpenIDConnectProviderArn"
          ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
openIDConnectProviderArn,
        ByteString
"ClientID" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
clientID
      ]

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

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

instance
  Prelude.NFData
    AddClientIDToOpenIDConnectProviderResponse