{-# 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.CloudFront.GetFieldLevelEncryptionProfileConfig
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Get the field-level encryption profile configuration information.
module Amazonka.CloudFront.GetFieldLevelEncryptionProfileConfig
  ( -- * Creating a Request
    GetFieldLevelEncryptionProfileConfig (..),
    newGetFieldLevelEncryptionProfileConfig,

    -- * Request Lenses
    getFieldLevelEncryptionProfileConfig_id,

    -- * Destructuring the Response
    GetFieldLevelEncryptionProfileConfigResponse (..),
    newGetFieldLevelEncryptionProfileConfigResponse,

    -- * Response Lenses
    getFieldLevelEncryptionProfileConfigResponse_eTag,
    getFieldLevelEncryptionProfileConfigResponse_fieldLevelEncryptionProfileConfig,
    getFieldLevelEncryptionProfileConfigResponse_httpStatus,
  )
where

import Amazonka.CloudFront.Types
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
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newGetFieldLevelEncryptionProfileConfig' smart constructor.
data GetFieldLevelEncryptionProfileConfig = GetFieldLevelEncryptionProfileConfig'
  { -- | Get the ID for the field-level encryption profile configuration
    -- information.
    GetFieldLevelEncryptionProfileConfig -> Text
id :: Prelude.Text
  }
  deriving (GetFieldLevelEncryptionProfileConfig
-> GetFieldLevelEncryptionProfileConfig -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetFieldLevelEncryptionProfileConfig
-> GetFieldLevelEncryptionProfileConfig -> Bool
$c/= :: GetFieldLevelEncryptionProfileConfig
-> GetFieldLevelEncryptionProfileConfig -> Bool
== :: GetFieldLevelEncryptionProfileConfig
-> GetFieldLevelEncryptionProfileConfig -> Bool
$c== :: GetFieldLevelEncryptionProfileConfig
-> GetFieldLevelEncryptionProfileConfig -> Bool
Prelude.Eq, ReadPrec [GetFieldLevelEncryptionProfileConfig]
ReadPrec GetFieldLevelEncryptionProfileConfig
Int -> ReadS GetFieldLevelEncryptionProfileConfig
ReadS [GetFieldLevelEncryptionProfileConfig]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetFieldLevelEncryptionProfileConfig]
$creadListPrec :: ReadPrec [GetFieldLevelEncryptionProfileConfig]
readPrec :: ReadPrec GetFieldLevelEncryptionProfileConfig
$creadPrec :: ReadPrec GetFieldLevelEncryptionProfileConfig
readList :: ReadS [GetFieldLevelEncryptionProfileConfig]
$creadList :: ReadS [GetFieldLevelEncryptionProfileConfig]
readsPrec :: Int -> ReadS GetFieldLevelEncryptionProfileConfig
$creadsPrec :: Int -> ReadS GetFieldLevelEncryptionProfileConfig
Prelude.Read, Int -> GetFieldLevelEncryptionProfileConfig -> ShowS
[GetFieldLevelEncryptionProfileConfig] -> ShowS
GetFieldLevelEncryptionProfileConfig -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetFieldLevelEncryptionProfileConfig] -> ShowS
$cshowList :: [GetFieldLevelEncryptionProfileConfig] -> ShowS
show :: GetFieldLevelEncryptionProfileConfig -> String
$cshow :: GetFieldLevelEncryptionProfileConfig -> String
showsPrec :: Int -> GetFieldLevelEncryptionProfileConfig -> ShowS
$cshowsPrec :: Int -> GetFieldLevelEncryptionProfileConfig -> ShowS
Prelude.Show, forall x.
Rep GetFieldLevelEncryptionProfileConfig x
-> GetFieldLevelEncryptionProfileConfig
forall x.
GetFieldLevelEncryptionProfileConfig
-> Rep GetFieldLevelEncryptionProfileConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetFieldLevelEncryptionProfileConfig x
-> GetFieldLevelEncryptionProfileConfig
$cfrom :: forall x.
GetFieldLevelEncryptionProfileConfig
-> Rep GetFieldLevelEncryptionProfileConfig x
Prelude.Generic)

-- |
-- Create a value of 'GetFieldLevelEncryptionProfileConfig' 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:
--
-- 'id', 'getFieldLevelEncryptionProfileConfig_id' - Get the ID for the field-level encryption profile configuration
-- information.
newGetFieldLevelEncryptionProfileConfig ::
  -- | 'id'
  Prelude.Text ->
  GetFieldLevelEncryptionProfileConfig
newGetFieldLevelEncryptionProfileConfig :: Text -> GetFieldLevelEncryptionProfileConfig
newGetFieldLevelEncryptionProfileConfig Text
pId_ =
  GetFieldLevelEncryptionProfileConfig' {$sel:id:GetFieldLevelEncryptionProfileConfig' :: Text
id = Text
pId_}

-- | Get the ID for the field-level encryption profile configuration
-- information.
getFieldLevelEncryptionProfileConfig_id :: Lens.Lens' GetFieldLevelEncryptionProfileConfig Prelude.Text
getFieldLevelEncryptionProfileConfig_id :: Lens' GetFieldLevelEncryptionProfileConfig Text
getFieldLevelEncryptionProfileConfig_id = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetFieldLevelEncryptionProfileConfig' {Text
id :: Text
$sel:id:GetFieldLevelEncryptionProfileConfig' :: GetFieldLevelEncryptionProfileConfig -> Text
id} -> Text
id) (\s :: GetFieldLevelEncryptionProfileConfig
s@GetFieldLevelEncryptionProfileConfig' {} Text
a -> GetFieldLevelEncryptionProfileConfig
s {$sel:id:GetFieldLevelEncryptionProfileConfig' :: Text
id = Text
a} :: GetFieldLevelEncryptionProfileConfig)

instance
  Core.AWSRequest
    GetFieldLevelEncryptionProfileConfig
  where
  type
    AWSResponse GetFieldLevelEncryptionProfileConfig =
      GetFieldLevelEncryptionProfileConfigResponse
  request :: (Service -> Service)
-> GetFieldLevelEncryptionProfileConfig
-> Request GetFieldLevelEncryptionProfileConfig
request Service -> Service
overrides =
    forall a. ToRequest a => Service -> a -> Request a
Request.get (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy GetFieldLevelEncryptionProfileConfig
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse
           (AWSResponse GetFieldLevelEncryptionProfileConfig)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> [Node] -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveXML
      ( \Int
s ResponseHeaders
h [Node]
x ->
          Maybe Text
-> Maybe FieldLevelEncryptionProfileConfig
-> Int
-> GetFieldLevelEncryptionProfileConfigResponse
GetFieldLevelEncryptionProfileConfigResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (ResponseHeaders
h forall a.
FromText a =>
ResponseHeaders -> HeaderName -> Either String (Maybe a)
Data..#? HeaderName
"ETag")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall a. FromXML a => [Node] -> Either String a
Data.parseXML [Node]
x)
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance
  Prelude.Hashable
    GetFieldLevelEncryptionProfileConfig
  where
  hashWithSalt :: Int -> GetFieldLevelEncryptionProfileConfig -> Int
hashWithSalt
    Int
_salt
    GetFieldLevelEncryptionProfileConfig' {Text
id :: Text
$sel:id:GetFieldLevelEncryptionProfileConfig' :: GetFieldLevelEncryptionProfileConfig -> Text
..} =
      Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
id

instance
  Prelude.NFData
    GetFieldLevelEncryptionProfileConfig
  where
  rnf :: GetFieldLevelEncryptionProfileConfig -> ()
rnf GetFieldLevelEncryptionProfileConfig' {Text
id :: Text
$sel:id:GetFieldLevelEncryptionProfileConfig' :: GetFieldLevelEncryptionProfileConfig -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
id

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

instance
  Data.ToPath
    GetFieldLevelEncryptionProfileConfig
  where
  toPath :: GetFieldLevelEncryptionProfileConfig -> ByteString
toPath GetFieldLevelEncryptionProfileConfig' {Text
id :: Text
$sel:id:GetFieldLevelEncryptionProfileConfig' :: GetFieldLevelEncryptionProfileConfig -> Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/2020-05-31/field-level-encryption-profile/",
        forall a. ToByteString a => a -> ByteString
Data.toBS Text
id,
        ByteString
"/config"
      ]

instance
  Data.ToQuery
    GetFieldLevelEncryptionProfileConfig
  where
  toQuery :: GetFieldLevelEncryptionProfileConfig -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty

-- | /See:/ 'newGetFieldLevelEncryptionProfileConfigResponse' smart constructor.
data GetFieldLevelEncryptionProfileConfigResponse = GetFieldLevelEncryptionProfileConfigResponse'
  { -- | The current version of the field-level encryption profile configuration
    -- result. For example: @E2QWRUHAPOMQZL@.
    GetFieldLevelEncryptionProfileConfigResponse -> Maybe Text
eTag :: Prelude.Maybe Prelude.Text,
    -- | Return the field-level encryption profile configuration information.
    GetFieldLevelEncryptionProfileConfigResponse
-> Maybe FieldLevelEncryptionProfileConfig
fieldLevelEncryptionProfileConfig :: Prelude.Maybe FieldLevelEncryptionProfileConfig,
    -- | The response's http status code.
    GetFieldLevelEncryptionProfileConfigResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (GetFieldLevelEncryptionProfileConfigResponse
-> GetFieldLevelEncryptionProfileConfigResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetFieldLevelEncryptionProfileConfigResponse
-> GetFieldLevelEncryptionProfileConfigResponse -> Bool
$c/= :: GetFieldLevelEncryptionProfileConfigResponse
-> GetFieldLevelEncryptionProfileConfigResponse -> Bool
== :: GetFieldLevelEncryptionProfileConfigResponse
-> GetFieldLevelEncryptionProfileConfigResponse -> Bool
$c== :: GetFieldLevelEncryptionProfileConfigResponse
-> GetFieldLevelEncryptionProfileConfigResponse -> Bool
Prelude.Eq, ReadPrec [GetFieldLevelEncryptionProfileConfigResponse]
ReadPrec GetFieldLevelEncryptionProfileConfigResponse
Int -> ReadS GetFieldLevelEncryptionProfileConfigResponse
ReadS [GetFieldLevelEncryptionProfileConfigResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetFieldLevelEncryptionProfileConfigResponse]
$creadListPrec :: ReadPrec [GetFieldLevelEncryptionProfileConfigResponse]
readPrec :: ReadPrec GetFieldLevelEncryptionProfileConfigResponse
$creadPrec :: ReadPrec GetFieldLevelEncryptionProfileConfigResponse
readList :: ReadS [GetFieldLevelEncryptionProfileConfigResponse]
$creadList :: ReadS [GetFieldLevelEncryptionProfileConfigResponse]
readsPrec :: Int -> ReadS GetFieldLevelEncryptionProfileConfigResponse
$creadsPrec :: Int -> ReadS GetFieldLevelEncryptionProfileConfigResponse
Prelude.Read, Int -> GetFieldLevelEncryptionProfileConfigResponse -> ShowS
[GetFieldLevelEncryptionProfileConfigResponse] -> ShowS
GetFieldLevelEncryptionProfileConfigResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetFieldLevelEncryptionProfileConfigResponse] -> ShowS
$cshowList :: [GetFieldLevelEncryptionProfileConfigResponse] -> ShowS
show :: GetFieldLevelEncryptionProfileConfigResponse -> String
$cshow :: GetFieldLevelEncryptionProfileConfigResponse -> String
showsPrec :: Int -> GetFieldLevelEncryptionProfileConfigResponse -> ShowS
$cshowsPrec :: Int -> GetFieldLevelEncryptionProfileConfigResponse -> ShowS
Prelude.Show, forall x.
Rep GetFieldLevelEncryptionProfileConfigResponse x
-> GetFieldLevelEncryptionProfileConfigResponse
forall x.
GetFieldLevelEncryptionProfileConfigResponse
-> Rep GetFieldLevelEncryptionProfileConfigResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetFieldLevelEncryptionProfileConfigResponse x
-> GetFieldLevelEncryptionProfileConfigResponse
$cfrom :: forall x.
GetFieldLevelEncryptionProfileConfigResponse
-> Rep GetFieldLevelEncryptionProfileConfigResponse x
Prelude.Generic)

-- |
-- Create a value of 'GetFieldLevelEncryptionProfileConfigResponse' 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:
--
-- 'eTag', 'getFieldLevelEncryptionProfileConfigResponse_eTag' - The current version of the field-level encryption profile configuration
-- result. For example: @E2QWRUHAPOMQZL@.
--
-- 'fieldLevelEncryptionProfileConfig', 'getFieldLevelEncryptionProfileConfigResponse_fieldLevelEncryptionProfileConfig' - Return the field-level encryption profile configuration information.
--
-- 'httpStatus', 'getFieldLevelEncryptionProfileConfigResponse_httpStatus' - The response's http status code.
newGetFieldLevelEncryptionProfileConfigResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  GetFieldLevelEncryptionProfileConfigResponse
newGetFieldLevelEncryptionProfileConfigResponse :: Int -> GetFieldLevelEncryptionProfileConfigResponse
newGetFieldLevelEncryptionProfileConfigResponse
  Int
pHttpStatus_ =
    GetFieldLevelEncryptionProfileConfigResponse'
      { $sel:eTag:GetFieldLevelEncryptionProfileConfigResponse' :: Maybe Text
eTag =
          forall a. Maybe a
Prelude.Nothing,
        $sel:fieldLevelEncryptionProfileConfig:GetFieldLevelEncryptionProfileConfigResponse' :: Maybe FieldLevelEncryptionProfileConfig
fieldLevelEncryptionProfileConfig =
          forall a. Maybe a
Prelude.Nothing,
        $sel:httpStatus:GetFieldLevelEncryptionProfileConfigResponse' :: Int
httpStatus = Int
pHttpStatus_
      }

-- | The current version of the field-level encryption profile configuration
-- result. For example: @E2QWRUHAPOMQZL@.
getFieldLevelEncryptionProfileConfigResponse_eTag :: Lens.Lens' GetFieldLevelEncryptionProfileConfigResponse (Prelude.Maybe Prelude.Text)
getFieldLevelEncryptionProfileConfigResponse_eTag :: Lens' GetFieldLevelEncryptionProfileConfigResponse (Maybe Text)
getFieldLevelEncryptionProfileConfigResponse_eTag = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetFieldLevelEncryptionProfileConfigResponse' {Maybe Text
eTag :: Maybe Text
$sel:eTag:GetFieldLevelEncryptionProfileConfigResponse' :: GetFieldLevelEncryptionProfileConfigResponse -> Maybe Text
eTag} -> Maybe Text
eTag) (\s :: GetFieldLevelEncryptionProfileConfigResponse
s@GetFieldLevelEncryptionProfileConfigResponse' {} Maybe Text
a -> GetFieldLevelEncryptionProfileConfigResponse
s {$sel:eTag:GetFieldLevelEncryptionProfileConfigResponse' :: Maybe Text
eTag = Maybe Text
a} :: GetFieldLevelEncryptionProfileConfigResponse)

-- | Return the field-level encryption profile configuration information.
getFieldLevelEncryptionProfileConfigResponse_fieldLevelEncryptionProfileConfig :: Lens.Lens' GetFieldLevelEncryptionProfileConfigResponse (Prelude.Maybe FieldLevelEncryptionProfileConfig)
getFieldLevelEncryptionProfileConfigResponse_fieldLevelEncryptionProfileConfig :: Lens'
  GetFieldLevelEncryptionProfileConfigResponse
  (Maybe FieldLevelEncryptionProfileConfig)
getFieldLevelEncryptionProfileConfigResponse_fieldLevelEncryptionProfileConfig = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetFieldLevelEncryptionProfileConfigResponse' {Maybe FieldLevelEncryptionProfileConfig
fieldLevelEncryptionProfileConfig :: Maybe FieldLevelEncryptionProfileConfig
$sel:fieldLevelEncryptionProfileConfig:GetFieldLevelEncryptionProfileConfigResponse' :: GetFieldLevelEncryptionProfileConfigResponse
-> Maybe FieldLevelEncryptionProfileConfig
fieldLevelEncryptionProfileConfig} -> Maybe FieldLevelEncryptionProfileConfig
fieldLevelEncryptionProfileConfig) (\s :: GetFieldLevelEncryptionProfileConfigResponse
s@GetFieldLevelEncryptionProfileConfigResponse' {} Maybe FieldLevelEncryptionProfileConfig
a -> GetFieldLevelEncryptionProfileConfigResponse
s {$sel:fieldLevelEncryptionProfileConfig:GetFieldLevelEncryptionProfileConfigResponse' :: Maybe FieldLevelEncryptionProfileConfig
fieldLevelEncryptionProfileConfig = Maybe FieldLevelEncryptionProfileConfig
a} :: GetFieldLevelEncryptionProfileConfigResponse)

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

instance
  Prelude.NFData
    GetFieldLevelEncryptionProfileConfigResponse
  where
  rnf :: GetFieldLevelEncryptionProfileConfigResponse -> ()
rnf GetFieldLevelEncryptionProfileConfigResponse' {Int
Maybe Text
Maybe FieldLevelEncryptionProfileConfig
httpStatus :: Int
fieldLevelEncryptionProfileConfig :: Maybe FieldLevelEncryptionProfileConfig
eTag :: Maybe Text
$sel:httpStatus:GetFieldLevelEncryptionProfileConfigResponse' :: GetFieldLevelEncryptionProfileConfigResponse -> Int
$sel:fieldLevelEncryptionProfileConfig:GetFieldLevelEncryptionProfileConfigResponse' :: GetFieldLevelEncryptionProfileConfigResponse
-> Maybe FieldLevelEncryptionProfileConfig
$sel:eTag:GetFieldLevelEncryptionProfileConfigResponse' :: GetFieldLevelEncryptionProfileConfigResponse -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
eTag
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe FieldLevelEncryptionProfileConfig
fieldLevelEncryptionProfileConfig
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus