{-# 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.EC2.Types.PrincipalIdFormat
-- 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.EC2.Types.PrincipalIdFormat where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.EC2.Internal
import Amazonka.EC2.Types.IdFormat
import qualified Amazonka.Prelude as Prelude

-- | PrincipalIdFormat description
--
-- /See:/ 'newPrincipalIdFormat' smart constructor.
data PrincipalIdFormat = PrincipalIdFormat'
  { -- | PrincipalIdFormatARN description
    PrincipalIdFormat -> Maybe Text
arn :: Prelude.Maybe Prelude.Text,
    -- | PrincipalIdFormatStatuses description
    PrincipalIdFormat -> Maybe [IdFormat]
statuses :: Prelude.Maybe [IdFormat]
  }
  deriving (PrincipalIdFormat -> PrincipalIdFormat -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PrincipalIdFormat -> PrincipalIdFormat -> Bool
$c/= :: PrincipalIdFormat -> PrincipalIdFormat -> Bool
== :: PrincipalIdFormat -> PrincipalIdFormat -> Bool
$c== :: PrincipalIdFormat -> PrincipalIdFormat -> Bool
Prelude.Eq, ReadPrec [PrincipalIdFormat]
ReadPrec PrincipalIdFormat
Int -> ReadS PrincipalIdFormat
ReadS [PrincipalIdFormat]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PrincipalIdFormat]
$creadListPrec :: ReadPrec [PrincipalIdFormat]
readPrec :: ReadPrec PrincipalIdFormat
$creadPrec :: ReadPrec PrincipalIdFormat
readList :: ReadS [PrincipalIdFormat]
$creadList :: ReadS [PrincipalIdFormat]
readsPrec :: Int -> ReadS PrincipalIdFormat
$creadsPrec :: Int -> ReadS PrincipalIdFormat
Prelude.Read, Int -> PrincipalIdFormat -> ShowS
[PrincipalIdFormat] -> ShowS
PrincipalIdFormat -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PrincipalIdFormat] -> ShowS
$cshowList :: [PrincipalIdFormat] -> ShowS
show :: PrincipalIdFormat -> String
$cshow :: PrincipalIdFormat -> String
showsPrec :: Int -> PrincipalIdFormat -> ShowS
$cshowsPrec :: Int -> PrincipalIdFormat -> ShowS
Prelude.Show, forall x. Rep PrincipalIdFormat x -> PrincipalIdFormat
forall x. PrincipalIdFormat -> Rep PrincipalIdFormat x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PrincipalIdFormat x -> PrincipalIdFormat
$cfrom :: forall x. PrincipalIdFormat -> Rep PrincipalIdFormat x
Prelude.Generic)

-- |
-- Create a value of 'PrincipalIdFormat' 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:
--
-- 'arn', 'principalIdFormat_arn' - PrincipalIdFormatARN description
--
-- 'statuses', 'principalIdFormat_statuses' - PrincipalIdFormatStatuses description
newPrincipalIdFormat ::
  PrincipalIdFormat
newPrincipalIdFormat :: PrincipalIdFormat
newPrincipalIdFormat =
  PrincipalIdFormat'
    { $sel:arn:PrincipalIdFormat' :: Maybe Text
arn = forall a. Maybe a
Prelude.Nothing,
      $sel:statuses:PrincipalIdFormat' :: Maybe [IdFormat]
statuses = forall a. Maybe a
Prelude.Nothing
    }

-- | PrincipalIdFormatARN description
principalIdFormat_arn :: Lens.Lens' PrincipalIdFormat (Prelude.Maybe Prelude.Text)
principalIdFormat_arn :: Lens' PrincipalIdFormat (Maybe Text)
principalIdFormat_arn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PrincipalIdFormat' {Maybe Text
arn :: Maybe Text
$sel:arn:PrincipalIdFormat' :: PrincipalIdFormat -> Maybe Text
arn} -> Maybe Text
arn) (\s :: PrincipalIdFormat
s@PrincipalIdFormat' {} Maybe Text
a -> PrincipalIdFormat
s {$sel:arn:PrincipalIdFormat' :: Maybe Text
arn = Maybe Text
a} :: PrincipalIdFormat)

-- | PrincipalIdFormatStatuses description
principalIdFormat_statuses :: Lens.Lens' PrincipalIdFormat (Prelude.Maybe [IdFormat])
principalIdFormat_statuses :: Lens' PrincipalIdFormat (Maybe [IdFormat])
principalIdFormat_statuses = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PrincipalIdFormat' {Maybe [IdFormat]
statuses :: Maybe [IdFormat]
$sel:statuses:PrincipalIdFormat' :: PrincipalIdFormat -> Maybe [IdFormat]
statuses} -> Maybe [IdFormat]
statuses) (\s :: PrincipalIdFormat
s@PrincipalIdFormat' {} Maybe [IdFormat]
a -> PrincipalIdFormat
s {$sel:statuses:PrincipalIdFormat' :: Maybe [IdFormat]
statuses = Maybe [IdFormat]
a} :: PrincipalIdFormat) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Data.FromXML PrincipalIdFormat where
  parseXML :: [Node] -> Either String PrincipalIdFormat
parseXML [Node]
x =
    Maybe Text -> Maybe [IdFormat] -> PrincipalIdFormat
PrincipalIdFormat'
      forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"arn")
      forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( [Node]
x
                      forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"statusSet"
                      forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty
                      forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= forall (f :: * -> *) a b.
Applicative f =>
([a] -> f b) -> [a] -> f (Maybe b)
Core.may (forall a. FromXML a => Text -> [Node] -> Either String [a]
Data.parseXMLList Text
"item")
                  )

instance Prelude.Hashable PrincipalIdFormat where
  hashWithSalt :: Int -> PrincipalIdFormat -> Int
hashWithSalt Int
_salt PrincipalIdFormat' {Maybe [IdFormat]
Maybe Text
statuses :: Maybe [IdFormat]
arn :: Maybe Text
$sel:statuses:PrincipalIdFormat' :: PrincipalIdFormat -> Maybe [IdFormat]
$sel:arn:PrincipalIdFormat' :: PrincipalIdFormat -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
arn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [IdFormat]
statuses

instance Prelude.NFData PrincipalIdFormat where
  rnf :: PrincipalIdFormat -> ()
rnf PrincipalIdFormat' {Maybe [IdFormat]
Maybe Text
statuses :: Maybe [IdFormat]
arn :: Maybe Text
$sel:statuses:PrincipalIdFormat' :: PrincipalIdFormat -> Maybe [IdFormat]
$sel:arn:PrincipalIdFormat' :: PrincipalIdFormat -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
arn seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [IdFormat]
statuses