{-# 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.TagOpenIDConnectProvider
-- 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 one or more tags to an OpenID Connect (OIDC)-compatible identity
-- provider. For more information about these providers, see
-- <https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_providers_oidc.html About web identity federation>.
-- If a tag with the same key name already exists, then that tag is
-- overwritten with the new value.
--
-- A tag consists of a key name and an associated value. By assigning tags
-- to your resources, you can do the following:
--
-- -   __Administrative grouping and discovery__ - Attach tags to resources
--     to aid in organization and search. For example, you could search for
--     all resources with the key name /Project/ and the value
--     /MyImportantProject/. Or search for all resources with the key name
--     /Cost Center/ and the value /41200/.
--
-- -   __Access control__ - Include tags in IAM user-based and
--     resource-based policies. You can use tags to restrict access to only
--     an OIDC provider that has a specified tag attached. For examples of
--     policies that show how to use tags to control access, see
--     <https://docs.aws.amazon.com/IAM/latest/UserGuide/access_tags.html Control access using IAM tags>
--     in the /IAM User Guide/.
--
-- -   If any one of the tags is invalid or if you exceed the allowed
--     maximum number of tags, then the entire request fails and the
--     resource is not created. For more information about tagging, see
--     <https://docs.aws.amazon.com/IAM/latest/UserGuide/id_tags.html Tagging IAM resources>
--     in the /IAM User Guide/.
--
-- -   Amazon Web Services always interprets the tag @Value@ as a single
--     string. If you need to store an array, you can store comma-separated
--     values in the string. However, you must interpret the value in your
--     code.
module Amazonka.IAM.TagOpenIDConnectProvider
  ( -- * Creating a Request
    TagOpenIDConnectProvider (..),
    newTagOpenIDConnectProvider,

    -- * Request Lenses
    tagOpenIDConnectProvider_openIDConnectProviderArn,
    tagOpenIDConnectProvider_tags,

    -- * Destructuring the Response
    TagOpenIDConnectProviderResponse (..),
    newTagOpenIDConnectProviderResponse,
  )
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:/ 'newTagOpenIDConnectProvider' smart constructor.
data TagOpenIDConnectProvider = TagOpenIDConnectProvider'
  { -- | The ARN of the OIDC identity provider in IAM to which you want to add
    -- tags.
    --
    -- This parameter allows (through its
    -- <http://wikipedia.org/wiki/regex regex pattern>) a string of characters
    -- consisting of upper and lowercase alphanumeric characters with no
    -- spaces. You can also include any of the following characters: _+=,.\@-
    TagOpenIDConnectProvider -> Text
openIDConnectProviderArn :: Prelude.Text,
    -- | The list of tags that you want to attach to the OIDC identity provider
    -- in IAM. Each tag consists of a key name and an associated value.
    TagOpenIDConnectProvider -> [Tag]
tags :: [Tag]
  }
  deriving (TagOpenIDConnectProvider -> TagOpenIDConnectProvider -> Bool
(TagOpenIDConnectProvider -> TagOpenIDConnectProvider -> Bool)
-> (TagOpenIDConnectProvider -> TagOpenIDConnectProvider -> Bool)
-> Eq TagOpenIDConnectProvider
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TagOpenIDConnectProvider -> TagOpenIDConnectProvider -> Bool
$c/= :: TagOpenIDConnectProvider -> TagOpenIDConnectProvider -> Bool
== :: TagOpenIDConnectProvider -> TagOpenIDConnectProvider -> Bool
$c== :: TagOpenIDConnectProvider -> TagOpenIDConnectProvider -> Bool
Prelude.Eq, ReadPrec [TagOpenIDConnectProvider]
ReadPrec TagOpenIDConnectProvider
Int -> ReadS TagOpenIDConnectProvider
ReadS [TagOpenIDConnectProvider]
(Int -> ReadS TagOpenIDConnectProvider)
-> ReadS [TagOpenIDConnectProvider]
-> ReadPrec TagOpenIDConnectProvider
-> ReadPrec [TagOpenIDConnectProvider]
-> Read TagOpenIDConnectProvider
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TagOpenIDConnectProvider]
$creadListPrec :: ReadPrec [TagOpenIDConnectProvider]
readPrec :: ReadPrec TagOpenIDConnectProvider
$creadPrec :: ReadPrec TagOpenIDConnectProvider
readList :: ReadS [TagOpenIDConnectProvider]
$creadList :: ReadS [TagOpenIDConnectProvider]
readsPrec :: Int -> ReadS TagOpenIDConnectProvider
$creadsPrec :: Int -> ReadS TagOpenIDConnectProvider
Prelude.Read, Int -> TagOpenIDConnectProvider -> ShowS
[TagOpenIDConnectProvider] -> ShowS
TagOpenIDConnectProvider -> String
(Int -> TagOpenIDConnectProvider -> ShowS)
-> (TagOpenIDConnectProvider -> String)
-> ([TagOpenIDConnectProvider] -> ShowS)
-> Show TagOpenIDConnectProvider
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TagOpenIDConnectProvider] -> ShowS
$cshowList :: [TagOpenIDConnectProvider] -> ShowS
show :: TagOpenIDConnectProvider -> String
$cshow :: TagOpenIDConnectProvider -> String
showsPrec :: Int -> TagOpenIDConnectProvider -> ShowS
$cshowsPrec :: Int -> TagOpenIDConnectProvider -> ShowS
Prelude.Show, (forall x.
 TagOpenIDConnectProvider -> Rep TagOpenIDConnectProvider x)
-> (forall x.
    Rep TagOpenIDConnectProvider x -> TagOpenIDConnectProvider)
-> Generic TagOpenIDConnectProvider
forall x.
Rep TagOpenIDConnectProvider x -> TagOpenIDConnectProvider
forall x.
TagOpenIDConnectProvider -> Rep TagOpenIDConnectProvider x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep TagOpenIDConnectProvider x -> TagOpenIDConnectProvider
$cfrom :: forall x.
TagOpenIDConnectProvider -> Rep TagOpenIDConnectProvider x
Prelude.Generic)

-- |
-- Create a value of 'TagOpenIDConnectProvider' 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', 'tagOpenIDConnectProvider_openIDConnectProviderArn' - The ARN of the OIDC identity provider in IAM to which you want to add
-- tags.
--
-- This parameter allows (through its
-- <http://wikipedia.org/wiki/regex regex pattern>) a string of characters
-- consisting of upper and lowercase alphanumeric characters with no
-- spaces. You can also include any of the following characters: _+=,.\@-
--
-- 'tags', 'tagOpenIDConnectProvider_tags' - The list of tags that you want to attach to the OIDC identity provider
-- in IAM. Each tag consists of a key name and an associated value.
newTagOpenIDConnectProvider ::
  -- | 'openIDConnectProviderArn'
  Prelude.Text ->
  TagOpenIDConnectProvider
newTagOpenIDConnectProvider :: Text -> TagOpenIDConnectProvider
newTagOpenIDConnectProvider
  Text
pOpenIDConnectProviderArn_ =
    TagOpenIDConnectProvider' :: Text -> [Tag] -> TagOpenIDConnectProvider
TagOpenIDConnectProvider'
      { $sel:openIDConnectProviderArn:TagOpenIDConnectProvider' :: Text
openIDConnectProviderArn =
          Text
pOpenIDConnectProviderArn_,
        $sel:tags:TagOpenIDConnectProvider' :: [Tag]
tags = [Tag]
forall a. Monoid a => a
Prelude.mempty
      }

-- | The ARN of the OIDC identity provider in IAM to which you want to add
-- tags.
--
-- This parameter allows (through its
-- <http://wikipedia.org/wiki/regex regex pattern>) a string of characters
-- consisting of upper and lowercase alphanumeric characters with no
-- spaces. You can also include any of the following characters: _+=,.\@-
tagOpenIDConnectProvider_openIDConnectProviderArn :: Lens.Lens' TagOpenIDConnectProvider Prelude.Text
tagOpenIDConnectProvider_openIDConnectProviderArn :: (Text -> f Text)
-> TagOpenIDConnectProvider -> f TagOpenIDConnectProvider
tagOpenIDConnectProvider_openIDConnectProviderArn = (TagOpenIDConnectProvider -> Text)
-> (TagOpenIDConnectProvider -> Text -> TagOpenIDConnectProvider)
-> Lens TagOpenIDConnectProvider TagOpenIDConnectProvider Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TagOpenIDConnectProvider' {Text
openIDConnectProviderArn :: Text
$sel:openIDConnectProviderArn:TagOpenIDConnectProvider' :: TagOpenIDConnectProvider -> Text
openIDConnectProviderArn} -> Text
openIDConnectProviderArn) (\s :: TagOpenIDConnectProvider
s@TagOpenIDConnectProvider' {} Text
a -> TagOpenIDConnectProvider
s {$sel:openIDConnectProviderArn:TagOpenIDConnectProvider' :: Text
openIDConnectProviderArn = Text
a} :: TagOpenIDConnectProvider)

-- | The list of tags that you want to attach to the OIDC identity provider
-- in IAM. Each tag consists of a key name and an associated value.
tagOpenIDConnectProvider_tags :: Lens.Lens' TagOpenIDConnectProvider [Tag]
tagOpenIDConnectProvider_tags :: ([Tag] -> f [Tag])
-> TagOpenIDConnectProvider -> f TagOpenIDConnectProvider
tagOpenIDConnectProvider_tags = (TagOpenIDConnectProvider -> [Tag])
-> (TagOpenIDConnectProvider -> [Tag] -> TagOpenIDConnectProvider)
-> Lens
     TagOpenIDConnectProvider TagOpenIDConnectProvider [Tag] [Tag]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TagOpenIDConnectProvider' {[Tag]
tags :: [Tag]
$sel:tags:TagOpenIDConnectProvider' :: TagOpenIDConnectProvider -> [Tag]
tags} -> [Tag]
tags) (\s :: TagOpenIDConnectProvider
s@TagOpenIDConnectProvider' {} [Tag]
a -> TagOpenIDConnectProvider
s {$sel:tags:TagOpenIDConnectProvider' :: [Tag]
tags = [Tag]
a} :: TagOpenIDConnectProvider) (([Tag] -> f [Tag])
 -> TagOpenIDConnectProvider -> f TagOpenIDConnectProvider)
-> (([Tag] -> f [Tag]) -> [Tag] -> f [Tag])
-> ([Tag] -> f [Tag])
-> TagOpenIDConnectProvider
-> f TagOpenIDConnectProvider
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([Tag] -> f [Tag]) -> [Tag] -> f [Tag]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance Prelude.Hashable TagOpenIDConnectProvider

instance Prelude.NFData TagOpenIDConnectProvider

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

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

instance Core.ToQuery TagOpenIDConnectProvider where
  toQuery :: TagOpenIDConnectProvider -> QueryString
toQuery TagOpenIDConnectProvider' {[Tag]
Text
tags :: [Tag]
openIDConnectProviderArn :: Text
$sel:tags:TagOpenIDConnectProvider' :: TagOpenIDConnectProvider -> [Tag]
$sel:openIDConnectProviderArn:TagOpenIDConnectProvider' :: TagOpenIDConnectProvider -> 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
"TagOpenIDConnectProvider" :: 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
"Tags" ByteString -> QueryString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: ByteString -> [Tag] -> QueryString
forall a.
(IsList a, ToQuery (Item a)) =>
ByteString -> a -> QueryString
Core.toQueryList ByteString
"member" [Tag]
tags
      ]

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

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

instance
  Prelude.NFData
    TagOpenIDConnectProviderResponse