{-# 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.CloudFront.Types.QueryArgProfile
-- 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.CloudFront.Types.QueryArgProfile 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

-- | Query argument-profile mapping for field-level encryption.
--
-- /See:/ 'newQueryArgProfile' smart constructor.
data QueryArgProfile = QueryArgProfile'
  { -- | Query argument for field-level encryption query argument-profile
    -- mapping.
    QueryArgProfile -> Text
queryArg :: Prelude.Text,
    -- | ID of profile to use for field-level encryption query argument-profile
    -- mapping
    QueryArgProfile -> Text
profileId :: Prelude.Text
  }
  deriving (QueryArgProfile -> QueryArgProfile -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: QueryArgProfile -> QueryArgProfile -> Bool
$c/= :: QueryArgProfile -> QueryArgProfile -> Bool
== :: QueryArgProfile -> QueryArgProfile -> Bool
$c== :: QueryArgProfile -> QueryArgProfile -> Bool
Prelude.Eq, ReadPrec [QueryArgProfile]
ReadPrec QueryArgProfile
Int -> ReadS QueryArgProfile
ReadS [QueryArgProfile]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [QueryArgProfile]
$creadListPrec :: ReadPrec [QueryArgProfile]
readPrec :: ReadPrec QueryArgProfile
$creadPrec :: ReadPrec QueryArgProfile
readList :: ReadS [QueryArgProfile]
$creadList :: ReadS [QueryArgProfile]
readsPrec :: Int -> ReadS QueryArgProfile
$creadsPrec :: Int -> ReadS QueryArgProfile
Prelude.Read, Int -> QueryArgProfile -> ShowS
[QueryArgProfile] -> ShowS
QueryArgProfile -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [QueryArgProfile] -> ShowS
$cshowList :: [QueryArgProfile] -> ShowS
show :: QueryArgProfile -> String
$cshow :: QueryArgProfile -> String
showsPrec :: Int -> QueryArgProfile -> ShowS
$cshowsPrec :: Int -> QueryArgProfile -> ShowS
Prelude.Show, forall x. Rep QueryArgProfile x -> QueryArgProfile
forall x. QueryArgProfile -> Rep QueryArgProfile x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep QueryArgProfile x -> QueryArgProfile
$cfrom :: forall x. QueryArgProfile -> Rep QueryArgProfile x
Prelude.Generic)

-- |
-- Create a value of 'QueryArgProfile' 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:
--
-- 'queryArg', 'queryArgProfile_queryArg' - Query argument for field-level encryption query argument-profile
-- mapping.
--
-- 'profileId', 'queryArgProfile_profileId' - ID of profile to use for field-level encryption query argument-profile
-- mapping
newQueryArgProfile ::
  -- | 'queryArg'
  Prelude.Text ->
  -- | 'profileId'
  Prelude.Text ->
  QueryArgProfile
newQueryArgProfile :: Text -> Text -> QueryArgProfile
newQueryArgProfile Text
pQueryArg_ Text
pProfileId_ =
  QueryArgProfile'
    { $sel:queryArg:QueryArgProfile' :: Text
queryArg = Text
pQueryArg_,
      $sel:profileId:QueryArgProfile' :: Text
profileId = Text
pProfileId_
    }

-- | Query argument for field-level encryption query argument-profile
-- mapping.
queryArgProfile_queryArg :: Lens.Lens' QueryArgProfile Prelude.Text
queryArgProfile_queryArg :: Lens' QueryArgProfile Text
queryArgProfile_queryArg = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\QueryArgProfile' {Text
queryArg :: Text
$sel:queryArg:QueryArgProfile' :: QueryArgProfile -> Text
queryArg} -> Text
queryArg) (\s :: QueryArgProfile
s@QueryArgProfile' {} Text
a -> QueryArgProfile
s {$sel:queryArg:QueryArgProfile' :: Text
queryArg = Text
a} :: QueryArgProfile)

-- | ID of profile to use for field-level encryption query argument-profile
-- mapping
queryArgProfile_profileId :: Lens.Lens' QueryArgProfile Prelude.Text
queryArgProfile_profileId :: Lens' QueryArgProfile Text
queryArgProfile_profileId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\QueryArgProfile' {Text
profileId :: Text
$sel:profileId:QueryArgProfile' :: QueryArgProfile -> Text
profileId} -> Text
profileId) (\s :: QueryArgProfile
s@QueryArgProfile' {} Text
a -> QueryArgProfile
s {$sel:profileId:QueryArgProfile' :: Text
profileId = Text
a} :: QueryArgProfile)

instance Data.FromXML QueryArgProfile where
  parseXML :: [Node] -> Either String QueryArgProfile
parseXML [Node]
x =
    Text -> Text -> QueryArgProfile
QueryArgProfile'
      forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String a
Data..@ Text
"QueryArg")
      forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String a
Data..@ Text
"ProfileId")

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

instance Prelude.NFData QueryArgProfile where
  rnf :: QueryArgProfile -> ()
rnf QueryArgProfile' {Text
profileId :: Text
queryArg :: Text
$sel:profileId:QueryArgProfile' :: QueryArgProfile -> Text
$sel:queryArg:QueryArgProfile' :: QueryArgProfile -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
queryArg
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
profileId

instance Data.ToXML QueryArgProfile where
  toXML :: QueryArgProfile -> XML
toXML QueryArgProfile' {Text
profileId :: Text
queryArg :: Text
$sel:profileId:QueryArgProfile' :: QueryArgProfile -> Text
$sel:queryArg:QueryArgProfile' :: QueryArgProfile -> Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ Name
"QueryArg" forall a. ToXML a => Name -> a -> XML
Data.@= Text
queryArg,
        Name
"ProfileId" forall a. ToXML a => Name -> a -> XML
Data.@= Text
profileId
      ]