{-# 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.OriginGroupMember
-- 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.OriginGroupMember where

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

-- | An origin in an origin group.
--
-- /See:/ 'newOriginGroupMember' smart constructor.
data OriginGroupMember = OriginGroupMember'
  { -- | The ID for an origin in an origin group.
    OriginGroupMember -> Text
originId :: Prelude.Text
  }
  deriving (OriginGroupMember -> OriginGroupMember -> Bool
(OriginGroupMember -> OriginGroupMember -> Bool)
-> (OriginGroupMember -> OriginGroupMember -> Bool)
-> Eq OriginGroupMember
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: OriginGroupMember -> OriginGroupMember -> Bool
$c/= :: OriginGroupMember -> OriginGroupMember -> Bool
== :: OriginGroupMember -> OriginGroupMember -> Bool
$c== :: OriginGroupMember -> OriginGroupMember -> Bool
Prelude.Eq, ReadPrec [OriginGroupMember]
ReadPrec OriginGroupMember
Int -> ReadS OriginGroupMember
ReadS [OriginGroupMember]
(Int -> ReadS OriginGroupMember)
-> ReadS [OriginGroupMember]
-> ReadPrec OriginGroupMember
-> ReadPrec [OriginGroupMember]
-> Read OriginGroupMember
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [OriginGroupMember]
$creadListPrec :: ReadPrec [OriginGroupMember]
readPrec :: ReadPrec OriginGroupMember
$creadPrec :: ReadPrec OriginGroupMember
readList :: ReadS [OriginGroupMember]
$creadList :: ReadS [OriginGroupMember]
readsPrec :: Int -> ReadS OriginGroupMember
$creadsPrec :: Int -> ReadS OriginGroupMember
Prelude.Read, Int -> OriginGroupMember -> ShowS
[OriginGroupMember] -> ShowS
OriginGroupMember -> String
(Int -> OriginGroupMember -> ShowS)
-> (OriginGroupMember -> String)
-> ([OriginGroupMember] -> ShowS)
-> Show OriginGroupMember
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [OriginGroupMember] -> ShowS
$cshowList :: [OriginGroupMember] -> ShowS
show :: OriginGroupMember -> String
$cshow :: OriginGroupMember -> String
showsPrec :: Int -> OriginGroupMember -> ShowS
$cshowsPrec :: Int -> OriginGroupMember -> ShowS
Prelude.Show, (forall x. OriginGroupMember -> Rep OriginGroupMember x)
-> (forall x. Rep OriginGroupMember x -> OriginGroupMember)
-> Generic OriginGroupMember
forall x. Rep OriginGroupMember x -> OriginGroupMember
forall x. OriginGroupMember -> Rep OriginGroupMember x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep OriginGroupMember x -> OriginGroupMember
$cfrom :: forall x. OriginGroupMember -> Rep OriginGroupMember x
Prelude.Generic)

-- |
-- Create a value of 'OriginGroupMember' 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:
--
-- 'originId', 'originGroupMember_originId' - The ID for an origin in an origin group.
newOriginGroupMember ::
  -- | 'originId'
  Prelude.Text ->
  OriginGroupMember
newOriginGroupMember :: Text -> OriginGroupMember
newOriginGroupMember Text
pOriginId_ =
  OriginGroupMember' :: Text -> OriginGroupMember
OriginGroupMember' {$sel:originId:OriginGroupMember' :: Text
originId = Text
pOriginId_}

-- | The ID for an origin in an origin group.
originGroupMember_originId :: Lens.Lens' OriginGroupMember Prelude.Text
originGroupMember_originId :: (Text -> f Text) -> OriginGroupMember -> f OriginGroupMember
originGroupMember_originId = (OriginGroupMember -> Text)
-> (OriginGroupMember -> Text -> OriginGroupMember)
-> Lens OriginGroupMember OriginGroupMember Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OriginGroupMember' {Text
originId :: Text
$sel:originId:OriginGroupMember' :: OriginGroupMember -> Text
originId} -> Text
originId) (\s :: OriginGroupMember
s@OriginGroupMember' {} Text
a -> OriginGroupMember
s {$sel:originId:OriginGroupMember' :: Text
originId = Text
a} :: OriginGroupMember)

instance Core.FromXML OriginGroupMember where
  parseXML :: [Node] -> Either String OriginGroupMember
parseXML [Node]
x =
    Text -> OriginGroupMember
OriginGroupMember'
      (Text -> OriginGroupMember)
-> Either String Text -> Either String OriginGroupMember
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
"OriginId")

instance Prelude.Hashable OriginGroupMember

instance Prelude.NFData OriginGroupMember

instance Core.ToXML OriginGroupMember where
  toXML :: OriginGroupMember -> XML
toXML OriginGroupMember' {Text
originId :: Text
$sel:originId:OriginGroupMember' :: OriginGroupMember -> Text
..} =
    [XML] -> XML
forall a. Monoid a => [a] -> a
Prelude.mconcat [Name
"OriginId" Name -> Text -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= Text
originId]