{-# 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-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)
module Amazonka.CloudFront.Types.QueryArgProfile where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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
(QueryArgProfile -> QueryArgProfile -> Bool)
-> (QueryArgProfile -> QueryArgProfile -> Bool)
-> Eq QueryArgProfile
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]
(Int -> ReadS QueryArgProfile)
-> ReadS [QueryArgProfile]
-> ReadPrec QueryArgProfile
-> ReadPrec [QueryArgProfile]
-> Read 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
(Int -> QueryArgProfile -> ShowS)
-> (QueryArgProfile -> String)
-> ([QueryArgProfile] -> ShowS)
-> Show QueryArgProfile
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. QueryArgProfile -> Rep QueryArgProfile x)
-> (forall x. Rep QueryArgProfile x -> QueryArgProfile)
-> Generic QueryArgProfile
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' :: Text -> Text -> QueryArgProfile
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 :: (Text -> f Text) -> QueryArgProfile -> f QueryArgProfile
queryArgProfile_queryArg = (QueryArgProfile -> Text)
-> (QueryArgProfile -> Text -> QueryArgProfile)
-> Lens QueryArgProfile QueryArgProfile Text Text
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 :: (Text -> f Text) -> QueryArgProfile -> f QueryArgProfile
queryArgProfile_profileId = (QueryArgProfile -> Text)
-> (QueryArgProfile -> Text -> QueryArgProfile)
-> Lens QueryArgProfile QueryArgProfile Text Text
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 Core.FromXML QueryArgProfile where
  parseXML :: [Node] -> Either String QueryArgProfile
parseXML [Node]
x =
    Text -> Text -> QueryArgProfile
QueryArgProfile'
      (Text -> Text -> QueryArgProfile)
-> Either String Text -> Either String (Text -> QueryArgProfile)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String Text
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"QueryArg")
      Either String (Text -> QueryArgProfile)
-> Either String Text -> Either String QueryArgProfile
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String Text
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"ProfileId")

instance Prelude.Hashable QueryArgProfile

instance Prelude.NFData QueryArgProfile

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