{-# 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.Redshift.Types.AccountWithRestoreAccess
-- 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.Redshift.Types.AccountWithRestoreAccess where

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

-- | Describes an Amazon Web Services account authorized to restore a
-- snapshot.
--
-- /See:/ 'newAccountWithRestoreAccess' smart constructor.
data AccountWithRestoreAccess = AccountWithRestoreAccess'
  { -- | The identifier of an Amazon Web Services support account authorized to
    -- restore a snapshot. For Amazon Web Services Support, the identifier is
    -- @amazon-redshift-support@.
    AccountWithRestoreAccess -> Maybe Text
accountAlias :: Prelude.Maybe Prelude.Text,
    -- | The identifier of an Amazon Web Services account authorized to restore a
    -- snapshot.
    AccountWithRestoreAccess -> Maybe Text
accountId :: Prelude.Maybe Prelude.Text
  }
  deriving (AccountWithRestoreAccess -> AccountWithRestoreAccess -> Bool
(AccountWithRestoreAccess -> AccountWithRestoreAccess -> Bool)
-> (AccountWithRestoreAccess -> AccountWithRestoreAccess -> Bool)
-> Eq AccountWithRestoreAccess
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AccountWithRestoreAccess -> AccountWithRestoreAccess -> Bool
$c/= :: AccountWithRestoreAccess -> AccountWithRestoreAccess -> Bool
== :: AccountWithRestoreAccess -> AccountWithRestoreAccess -> Bool
$c== :: AccountWithRestoreAccess -> AccountWithRestoreAccess -> Bool
Prelude.Eq, ReadPrec [AccountWithRestoreAccess]
ReadPrec AccountWithRestoreAccess
Int -> ReadS AccountWithRestoreAccess
ReadS [AccountWithRestoreAccess]
(Int -> ReadS AccountWithRestoreAccess)
-> ReadS [AccountWithRestoreAccess]
-> ReadPrec AccountWithRestoreAccess
-> ReadPrec [AccountWithRestoreAccess]
-> Read AccountWithRestoreAccess
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AccountWithRestoreAccess]
$creadListPrec :: ReadPrec [AccountWithRestoreAccess]
readPrec :: ReadPrec AccountWithRestoreAccess
$creadPrec :: ReadPrec AccountWithRestoreAccess
readList :: ReadS [AccountWithRestoreAccess]
$creadList :: ReadS [AccountWithRestoreAccess]
readsPrec :: Int -> ReadS AccountWithRestoreAccess
$creadsPrec :: Int -> ReadS AccountWithRestoreAccess
Prelude.Read, Int -> AccountWithRestoreAccess -> ShowS
[AccountWithRestoreAccess] -> ShowS
AccountWithRestoreAccess -> String
(Int -> AccountWithRestoreAccess -> ShowS)
-> (AccountWithRestoreAccess -> String)
-> ([AccountWithRestoreAccess] -> ShowS)
-> Show AccountWithRestoreAccess
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AccountWithRestoreAccess] -> ShowS
$cshowList :: [AccountWithRestoreAccess] -> ShowS
show :: AccountWithRestoreAccess -> String
$cshow :: AccountWithRestoreAccess -> String
showsPrec :: Int -> AccountWithRestoreAccess -> ShowS
$cshowsPrec :: Int -> AccountWithRestoreAccess -> ShowS
Prelude.Show, (forall x.
 AccountWithRestoreAccess -> Rep AccountWithRestoreAccess x)
-> (forall x.
    Rep AccountWithRestoreAccess x -> AccountWithRestoreAccess)
-> Generic AccountWithRestoreAccess
forall x.
Rep AccountWithRestoreAccess x -> AccountWithRestoreAccess
forall x.
AccountWithRestoreAccess -> Rep AccountWithRestoreAccess x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AccountWithRestoreAccess x -> AccountWithRestoreAccess
$cfrom :: forall x.
AccountWithRestoreAccess -> Rep AccountWithRestoreAccess x
Prelude.Generic)

-- |
-- Create a value of 'AccountWithRestoreAccess' 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:
--
-- 'accountAlias', 'accountWithRestoreAccess_accountAlias' - The identifier of an Amazon Web Services support account authorized to
-- restore a snapshot. For Amazon Web Services Support, the identifier is
-- @amazon-redshift-support@.
--
-- 'accountId', 'accountWithRestoreAccess_accountId' - The identifier of an Amazon Web Services account authorized to restore a
-- snapshot.
newAccountWithRestoreAccess ::
  AccountWithRestoreAccess
newAccountWithRestoreAccess :: AccountWithRestoreAccess
newAccountWithRestoreAccess =
  AccountWithRestoreAccess' :: Maybe Text -> Maybe Text -> AccountWithRestoreAccess
AccountWithRestoreAccess'
    { $sel:accountAlias:AccountWithRestoreAccess' :: Maybe Text
accountAlias =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:accountId:AccountWithRestoreAccess' :: Maybe Text
accountId = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The identifier of an Amazon Web Services support account authorized to
-- restore a snapshot. For Amazon Web Services Support, the identifier is
-- @amazon-redshift-support@.
accountWithRestoreAccess_accountAlias :: Lens.Lens' AccountWithRestoreAccess (Prelude.Maybe Prelude.Text)
accountWithRestoreAccess_accountAlias :: (Maybe Text -> f (Maybe Text))
-> AccountWithRestoreAccess -> f AccountWithRestoreAccess
accountWithRestoreAccess_accountAlias = (AccountWithRestoreAccess -> Maybe Text)
-> (AccountWithRestoreAccess
    -> Maybe Text -> AccountWithRestoreAccess)
-> Lens
     AccountWithRestoreAccess
     AccountWithRestoreAccess
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AccountWithRestoreAccess' {Maybe Text
accountAlias :: Maybe Text
$sel:accountAlias:AccountWithRestoreAccess' :: AccountWithRestoreAccess -> Maybe Text
accountAlias} -> Maybe Text
accountAlias) (\s :: AccountWithRestoreAccess
s@AccountWithRestoreAccess' {} Maybe Text
a -> AccountWithRestoreAccess
s {$sel:accountAlias:AccountWithRestoreAccess' :: Maybe Text
accountAlias = Maybe Text
a} :: AccountWithRestoreAccess)

-- | The identifier of an Amazon Web Services account authorized to restore a
-- snapshot.
accountWithRestoreAccess_accountId :: Lens.Lens' AccountWithRestoreAccess (Prelude.Maybe Prelude.Text)
accountWithRestoreAccess_accountId :: (Maybe Text -> f (Maybe Text))
-> AccountWithRestoreAccess -> f AccountWithRestoreAccess
accountWithRestoreAccess_accountId = (AccountWithRestoreAccess -> Maybe Text)
-> (AccountWithRestoreAccess
    -> Maybe Text -> AccountWithRestoreAccess)
-> Lens
     AccountWithRestoreAccess
     AccountWithRestoreAccess
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AccountWithRestoreAccess' {Maybe Text
accountId :: Maybe Text
$sel:accountId:AccountWithRestoreAccess' :: AccountWithRestoreAccess -> Maybe Text
accountId} -> Maybe Text
accountId) (\s :: AccountWithRestoreAccess
s@AccountWithRestoreAccess' {} Maybe Text
a -> AccountWithRestoreAccess
s {$sel:accountId:AccountWithRestoreAccess' :: Maybe Text
accountId = Maybe Text
a} :: AccountWithRestoreAccess)

instance Core.FromXML AccountWithRestoreAccess where
  parseXML :: [Node] -> Either String AccountWithRestoreAccess
parseXML [Node]
x =
    Maybe Text -> Maybe Text -> AccountWithRestoreAccess
AccountWithRestoreAccess'
      (Maybe Text -> Maybe Text -> AccountWithRestoreAccess)
-> Either String (Maybe Text)
-> Either String (Maybe Text -> AccountWithRestoreAccess)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"AccountAlias")
      Either String (Maybe Text -> AccountWithRestoreAccess)
-> Either String (Maybe Text)
-> Either String AccountWithRestoreAccess
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"AccountId")

instance Prelude.Hashable AccountWithRestoreAccess

instance Prelude.NFData AccountWithRestoreAccess