{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.KMS.Types.XksProxyAuthenticationCredentialType
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.KMS.Types.XksProxyAuthenticationCredentialType where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude

-- | KMS uses the authentication credential to sign requests that it sends to
-- the external key store proxy (XKS proxy) on your behalf. You establish
-- these credentials on your external key store proxy and report them to
-- KMS.
--
-- The @XksProxyAuthenticationCredential@ includes two required elements.
--
-- /See:/ 'newXksProxyAuthenticationCredentialType' smart constructor.
data XksProxyAuthenticationCredentialType = XksProxyAuthenticationCredentialType'
  { -- | A unique identifier for the raw secret access key.
    XksProxyAuthenticationCredentialType -> Sensitive Text
accessKeyId :: Data.Sensitive Prelude.Text,
    -- | A secret string of 43-64 characters. Valid characters are a-z, A-Z, 0-9,
    -- \/, +, and =.
    XksProxyAuthenticationCredentialType -> Sensitive Text
rawSecretAccessKey :: Data.Sensitive Prelude.Text
  }
  deriving (XksProxyAuthenticationCredentialType
-> XksProxyAuthenticationCredentialType -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: XksProxyAuthenticationCredentialType
-> XksProxyAuthenticationCredentialType -> Bool
$c/= :: XksProxyAuthenticationCredentialType
-> XksProxyAuthenticationCredentialType -> Bool
== :: XksProxyAuthenticationCredentialType
-> XksProxyAuthenticationCredentialType -> Bool
$c== :: XksProxyAuthenticationCredentialType
-> XksProxyAuthenticationCredentialType -> Bool
Prelude.Eq, Int -> XksProxyAuthenticationCredentialType -> ShowS
[XksProxyAuthenticationCredentialType] -> ShowS
XksProxyAuthenticationCredentialType -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [XksProxyAuthenticationCredentialType] -> ShowS
$cshowList :: [XksProxyAuthenticationCredentialType] -> ShowS
show :: XksProxyAuthenticationCredentialType -> String
$cshow :: XksProxyAuthenticationCredentialType -> String
showsPrec :: Int -> XksProxyAuthenticationCredentialType -> ShowS
$cshowsPrec :: Int -> XksProxyAuthenticationCredentialType -> ShowS
Prelude.Show, forall x.
Rep XksProxyAuthenticationCredentialType x
-> XksProxyAuthenticationCredentialType
forall x.
XksProxyAuthenticationCredentialType
-> Rep XksProxyAuthenticationCredentialType x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep XksProxyAuthenticationCredentialType x
-> XksProxyAuthenticationCredentialType
$cfrom :: forall x.
XksProxyAuthenticationCredentialType
-> Rep XksProxyAuthenticationCredentialType x
Prelude.Generic)

-- |
-- Create a value of 'XksProxyAuthenticationCredentialType' 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:
--
-- 'accessKeyId', 'xksProxyAuthenticationCredentialType_accessKeyId' - A unique identifier for the raw secret access key.
--
-- 'rawSecretAccessKey', 'xksProxyAuthenticationCredentialType_rawSecretAccessKey' - A secret string of 43-64 characters. Valid characters are a-z, A-Z, 0-9,
-- \/, +, and =.
newXksProxyAuthenticationCredentialType ::
  -- | 'accessKeyId'
  Prelude.Text ->
  -- | 'rawSecretAccessKey'
  Prelude.Text ->
  XksProxyAuthenticationCredentialType
newXksProxyAuthenticationCredentialType :: Text -> Text -> XksProxyAuthenticationCredentialType
newXksProxyAuthenticationCredentialType
  Text
pAccessKeyId_
  Text
pRawSecretAccessKey_ =
    XksProxyAuthenticationCredentialType'
      { $sel:accessKeyId:XksProxyAuthenticationCredentialType' :: Sensitive Text
accessKeyId =
          forall a. Iso' (Sensitive a) a
Data._Sensitive
            forall t b. AReview t b -> b -> t
Lens.# Text
pAccessKeyId_,
        $sel:rawSecretAccessKey:XksProxyAuthenticationCredentialType' :: Sensitive Text
rawSecretAccessKey =
          forall a. Iso' (Sensitive a) a
Data._Sensitive
            forall t b. AReview t b -> b -> t
Lens.# Text
pRawSecretAccessKey_
      }

-- | A unique identifier for the raw secret access key.
xksProxyAuthenticationCredentialType_accessKeyId :: Lens.Lens' XksProxyAuthenticationCredentialType Prelude.Text
xksProxyAuthenticationCredentialType_accessKeyId :: Lens' XksProxyAuthenticationCredentialType Text
xksProxyAuthenticationCredentialType_accessKeyId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\XksProxyAuthenticationCredentialType' {Sensitive Text
accessKeyId :: Sensitive Text
$sel:accessKeyId:XksProxyAuthenticationCredentialType' :: XksProxyAuthenticationCredentialType -> Sensitive Text
accessKeyId} -> Sensitive Text
accessKeyId) (\s :: XksProxyAuthenticationCredentialType
s@XksProxyAuthenticationCredentialType' {} Sensitive Text
a -> XksProxyAuthenticationCredentialType
s {$sel:accessKeyId:XksProxyAuthenticationCredentialType' :: Sensitive Text
accessKeyId = Sensitive Text
a} :: XksProxyAuthenticationCredentialType) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a. Iso' (Sensitive a) a
Data._Sensitive

-- | A secret string of 43-64 characters. Valid characters are a-z, A-Z, 0-9,
-- \/, +, and =.
xksProxyAuthenticationCredentialType_rawSecretAccessKey :: Lens.Lens' XksProxyAuthenticationCredentialType Prelude.Text
xksProxyAuthenticationCredentialType_rawSecretAccessKey :: Lens' XksProxyAuthenticationCredentialType Text
xksProxyAuthenticationCredentialType_rawSecretAccessKey = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\XksProxyAuthenticationCredentialType' {Sensitive Text
rawSecretAccessKey :: Sensitive Text
$sel:rawSecretAccessKey:XksProxyAuthenticationCredentialType' :: XksProxyAuthenticationCredentialType -> Sensitive Text
rawSecretAccessKey} -> Sensitive Text
rawSecretAccessKey) (\s :: XksProxyAuthenticationCredentialType
s@XksProxyAuthenticationCredentialType' {} Sensitive Text
a -> XksProxyAuthenticationCredentialType
s {$sel:rawSecretAccessKey:XksProxyAuthenticationCredentialType' :: Sensitive Text
rawSecretAccessKey = Sensitive Text
a} :: XksProxyAuthenticationCredentialType) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a. Iso' (Sensitive a) a
Data._Sensitive

instance
  Prelude.Hashable
    XksProxyAuthenticationCredentialType
  where
  hashWithSalt :: Int -> XksProxyAuthenticationCredentialType -> Int
hashWithSalt
    Int
_salt
    XksProxyAuthenticationCredentialType' {Sensitive Text
rawSecretAccessKey :: Sensitive Text
accessKeyId :: Sensitive Text
$sel:rawSecretAccessKey:XksProxyAuthenticationCredentialType' :: XksProxyAuthenticationCredentialType -> Sensitive Text
$sel:accessKeyId:XksProxyAuthenticationCredentialType' :: XksProxyAuthenticationCredentialType -> Sensitive Text
..} =
      Int
_salt
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Sensitive Text
accessKeyId
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Sensitive Text
rawSecretAccessKey

instance
  Prelude.NFData
    XksProxyAuthenticationCredentialType
  where
  rnf :: XksProxyAuthenticationCredentialType -> ()
rnf XksProxyAuthenticationCredentialType' {Sensitive Text
rawSecretAccessKey :: Sensitive Text
accessKeyId :: Sensitive Text
$sel:rawSecretAccessKey:XksProxyAuthenticationCredentialType' :: XksProxyAuthenticationCredentialType -> Sensitive Text
$sel:accessKeyId:XksProxyAuthenticationCredentialType' :: XksProxyAuthenticationCredentialType -> Sensitive Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Sensitive Text
accessKeyId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Sensitive Text
rawSecretAccessKey

instance
  Data.ToJSON
    XksProxyAuthenticationCredentialType
  where
  toJSON :: XksProxyAuthenticationCredentialType -> Value
toJSON XksProxyAuthenticationCredentialType' {Sensitive Text
rawSecretAccessKey :: Sensitive Text
accessKeyId :: Sensitive Text
$sel:rawSecretAccessKey:XksProxyAuthenticationCredentialType' :: XksProxyAuthenticationCredentialType -> Sensitive Text
$sel:accessKeyId:XksProxyAuthenticationCredentialType' :: XksProxyAuthenticationCredentialType -> Sensitive Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ forall a. a -> Maybe a
Prelude.Just (Key
"AccessKeyId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Sensitive Text
accessKeyId),
            forall a. a -> Maybe a
Prelude.Just
              (Key
"RawSecretAccessKey" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Sensitive Text
rawSecretAccessKey)
          ]
      )