{-# 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.WorkSpaces.Types.AccountModification
-- 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.WorkSpaces.Types.AccountModification where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.WorkSpaces.Types.DedicatedTenancyModificationStateEnum
import Amazonka.WorkSpaces.Types.DedicatedTenancySupportResultEnum

-- | Describes a modification to the configuration of Bring Your Own License
-- (BYOL) for the specified account.
--
-- /See:/ 'newAccountModification' smart constructor.
data AccountModification = AccountModification'
  { -- | The timestamp when the modification of the BYOL configuration was
    -- started.
    AccountModification -> Maybe POSIX
startTime :: Prelude.Maybe Core.POSIX,
    -- | The status of BYOL (whether BYOL is being enabled or disabled).
    AccountModification -> Maybe DedicatedTenancySupportResultEnum
dedicatedTenancySupport :: Prelude.Maybe DedicatedTenancySupportResultEnum,
    -- | The state of the modification to the configuration of BYOL.
    AccountModification -> Maybe DedicatedTenancyModificationStateEnum
modificationState :: Prelude.Maybe DedicatedTenancyModificationStateEnum,
    -- | The IP address range, specified as an IPv4 CIDR block, for the
    -- management network interface used for the account.
    AccountModification -> Maybe Text
dedicatedTenancyManagementCidrRange :: Prelude.Maybe Prelude.Text,
    -- | The error code that is returned if the configuration of BYOL cannot be
    -- modified.
    AccountModification -> Maybe Text
errorCode :: Prelude.Maybe Prelude.Text,
    -- | The text of the error message that is returned if the configuration of
    -- BYOL cannot be modified.
    AccountModification -> Maybe Text
errorMessage :: Prelude.Maybe Prelude.Text
  }
  deriving (AccountModification -> AccountModification -> Bool
(AccountModification -> AccountModification -> Bool)
-> (AccountModification -> AccountModification -> Bool)
-> Eq AccountModification
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AccountModification -> AccountModification -> Bool
$c/= :: AccountModification -> AccountModification -> Bool
== :: AccountModification -> AccountModification -> Bool
$c== :: AccountModification -> AccountModification -> Bool
Prelude.Eq, ReadPrec [AccountModification]
ReadPrec AccountModification
Int -> ReadS AccountModification
ReadS [AccountModification]
(Int -> ReadS AccountModification)
-> ReadS [AccountModification]
-> ReadPrec AccountModification
-> ReadPrec [AccountModification]
-> Read AccountModification
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AccountModification]
$creadListPrec :: ReadPrec [AccountModification]
readPrec :: ReadPrec AccountModification
$creadPrec :: ReadPrec AccountModification
readList :: ReadS [AccountModification]
$creadList :: ReadS [AccountModification]
readsPrec :: Int -> ReadS AccountModification
$creadsPrec :: Int -> ReadS AccountModification
Prelude.Read, Int -> AccountModification -> ShowS
[AccountModification] -> ShowS
AccountModification -> String
(Int -> AccountModification -> ShowS)
-> (AccountModification -> String)
-> ([AccountModification] -> ShowS)
-> Show AccountModification
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AccountModification] -> ShowS
$cshowList :: [AccountModification] -> ShowS
show :: AccountModification -> String
$cshow :: AccountModification -> String
showsPrec :: Int -> AccountModification -> ShowS
$cshowsPrec :: Int -> AccountModification -> ShowS
Prelude.Show, (forall x. AccountModification -> Rep AccountModification x)
-> (forall x. Rep AccountModification x -> AccountModification)
-> Generic AccountModification
forall x. Rep AccountModification x -> AccountModification
forall x. AccountModification -> Rep AccountModification x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AccountModification x -> AccountModification
$cfrom :: forall x. AccountModification -> Rep AccountModification x
Prelude.Generic)

-- |
-- Create a value of 'AccountModification' 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:
--
-- 'startTime', 'accountModification_startTime' - The timestamp when the modification of the BYOL configuration was
-- started.
--
-- 'dedicatedTenancySupport', 'accountModification_dedicatedTenancySupport' - The status of BYOL (whether BYOL is being enabled or disabled).
--
-- 'modificationState', 'accountModification_modificationState' - The state of the modification to the configuration of BYOL.
--
-- 'dedicatedTenancyManagementCidrRange', 'accountModification_dedicatedTenancyManagementCidrRange' - The IP address range, specified as an IPv4 CIDR block, for the
-- management network interface used for the account.
--
-- 'errorCode', 'accountModification_errorCode' - The error code that is returned if the configuration of BYOL cannot be
-- modified.
--
-- 'errorMessage', 'accountModification_errorMessage' - The text of the error message that is returned if the configuration of
-- BYOL cannot be modified.
newAccountModification ::
  AccountModification
newAccountModification :: AccountModification
newAccountModification =
  AccountModification' :: Maybe POSIX
-> Maybe DedicatedTenancySupportResultEnum
-> Maybe DedicatedTenancyModificationStateEnum
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> AccountModification
AccountModification'
    { $sel:startTime:AccountModification' :: Maybe POSIX
startTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:dedicatedTenancySupport:AccountModification' :: Maybe DedicatedTenancySupportResultEnum
dedicatedTenancySupport = Maybe DedicatedTenancySupportResultEnum
forall a. Maybe a
Prelude.Nothing,
      $sel:modificationState:AccountModification' :: Maybe DedicatedTenancyModificationStateEnum
modificationState = Maybe DedicatedTenancyModificationStateEnum
forall a. Maybe a
Prelude.Nothing,
      $sel:dedicatedTenancyManagementCidrRange:AccountModification' :: Maybe Text
dedicatedTenancyManagementCidrRange =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:errorCode:AccountModification' :: Maybe Text
errorCode = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:errorMessage:AccountModification' :: Maybe Text
errorMessage = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The timestamp when the modification of the BYOL configuration was
-- started.
accountModification_startTime :: Lens.Lens' AccountModification (Prelude.Maybe Prelude.UTCTime)
accountModification_startTime :: (Maybe UTCTime -> f (Maybe UTCTime))
-> AccountModification -> f AccountModification
accountModification_startTime = (AccountModification -> Maybe POSIX)
-> (AccountModification -> Maybe POSIX -> AccountModification)
-> Lens
     AccountModification AccountModification (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AccountModification' {Maybe POSIX
startTime :: Maybe POSIX
$sel:startTime:AccountModification' :: AccountModification -> Maybe POSIX
startTime} -> Maybe POSIX
startTime) (\s :: AccountModification
s@AccountModification' {} Maybe POSIX
a -> AccountModification
s {$sel:startTime:AccountModification' :: Maybe POSIX
startTime = Maybe POSIX
a} :: AccountModification) ((Maybe POSIX -> f (Maybe POSIX))
 -> AccountModification -> f AccountModification)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> AccountModification
-> f AccountModification
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
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 AnIso POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | The status of BYOL (whether BYOL is being enabled or disabled).
accountModification_dedicatedTenancySupport :: Lens.Lens' AccountModification (Prelude.Maybe DedicatedTenancySupportResultEnum)
accountModification_dedicatedTenancySupport :: (Maybe DedicatedTenancySupportResultEnum
 -> f (Maybe DedicatedTenancySupportResultEnum))
-> AccountModification -> f AccountModification
accountModification_dedicatedTenancySupport = (AccountModification -> Maybe DedicatedTenancySupportResultEnum)
-> (AccountModification
    -> Maybe DedicatedTenancySupportResultEnum -> AccountModification)
-> Lens
     AccountModification
     AccountModification
     (Maybe DedicatedTenancySupportResultEnum)
     (Maybe DedicatedTenancySupportResultEnum)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AccountModification' {Maybe DedicatedTenancySupportResultEnum
dedicatedTenancySupport :: Maybe DedicatedTenancySupportResultEnum
$sel:dedicatedTenancySupport:AccountModification' :: AccountModification -> Maybe DedicatedTenancySupportResultEnum
dedicatedTenancySupport} -> Maybe DedicatedTenancySupportResultEnum
dedicatedTenancySupport) (\s :: AccountModification
s@AccountModification' {} Maybe DedicatedTenancySupportResultEnum
a -> AccountModification
s {$sel:dedicatedTenancySupport:AccountModification' :: Maybe DedicatedTenancySupportResultEnum
dedicatedTenancySupport = Maybe DedicatedTenancySupportResultEnum
a} :: AccountModification)

-- | The state of the modification to the configuration of BYOL.
accountModification_modificationState :: Lens.Lens' AccountModification (Prelude.Maybe DedicatedTenancyModificationStateEnum)
accountModification_modificationState :: (Maybe DedicatedTenancyModificationStateEnum
 -> f (Maybe DedicatedTenancyModificationStateEnum))
-> AccountModification -> f AccountModification
accountModification_modificationState = (AccountModification
 -> Maybe DedicatedTenancyModificationStateEnum)
-> (AccountModification
    -> Maybe DedicatedTenancyModificationStateEnum
    -> AccountModification)
-> Lens
     AccountModification
     AccountModification
     (Maybe DedicatedTenancyModificationStateEnum)
     (Maybe DedicatedTenancyModificationStateEnum)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AccountModification' {Maybe DedicatedTenancyModificationStateEnum
modificationState :: Maybe DedicatedTenancyModificationStateEnum
$sel:modificationState:AccountModification' :: AccountModification -> Maybe DedicatedTenancyModificationStateEnum
modificationState} -> Maybe DedicatedTenancyModificationStateEnum
modificationState) (\s :: AccountModification
s@AccountModification' {} Maybe DedicatedTenancyModificationStateEnum
a -> AccountModification
s {$sel:modificationState:AccountModification' :: Maybe DedicatedTenancyModificationStateEnum
modificationState = Maybe DedicatedTenancyModificationStateEnum
a} :: AccountModification)

-- | The IP address range, specified as an IPv4 CIDR block, for the
-- management network interface used for the account.
accountModification_dedicatedTenancyManagementCidrRange :: Lens.Lens' AccountModification (Prelude.Maybe Prelude.Text)
accountModification_dedicatedTenancyManagementCidrRange :: (Maybe Text -> f (Maybe Text))
-> AccountModification -> f AccountModification
accountModification_dedicatedTenancyManagementCidrRange = (AccountModification -> Maybe Text)
-> (AccountModification -> Maybe Text -> AccountModification)
-> Lens
     AccountModification AccountModification (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AccountModification' {Maybe Text
dedicatedTenancyManagementCidrRange :: Maybe Text
$sel:dedicatedTenancyManagementCidrRange:AccountModification' :: AccountModification -> Maybe Text
dedicatedTenancyManagementCidrRange} -> Maybe Text
dedicatedTenancyManagementCidrRange) (\s :: AccountModification
s@AccountModification' {} Maybe Text
a -> AccountModification
s {$sel:dedicatedTenancyManagementCidrRange:AccountModification' :: Maybe Text
dedicatedTenancyManagementCidrRange = Maybe Text
a} :: AccountModification)

-- | The error code that is returned if the configuration of BYOL cannot be
-- modified.
accountModification_errorCode :: Lens.Lens' AccountModification (Prelude.Maybe Prelude.Text)
accountModification_errorCode :: (Maybe Text -> f (Maybe Text))
-> AccountModification -> f AccountModification
accountModification_errorCode = (AccountModification -> Maybe Text)
-> (AccountModification -> Maybe Text -> AccountModification)
-> Lens
     AccountModification AccountModification (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AccountModification' {Maybe Text
errorCode :: Maybe Text
$sel:errorCode:AccountModification' :: AccountModification -> Maybe Text
errorCode} -> Maybe Text
errorCode) (\s :: AccountModification
s@AccountModification' {} Maybe Text
a -> AccountModification
s {$sel:errorCode:AccountModification' :: Maybe Text
errorCode = Maybe Text
a} :: AccountModification)

-- | The text of the error message that is returned if the configuration of
-- BYOL cannot be modified.
accountModification_errorMessage :: Lens.Lens' AccountModification (Prelude.Maybe Prelude.Text)
accountModification_errorMessage :: (Maybe Text -> f (Maybe Text))
-> AccountModification -> f AccountModification
accountModification_errorMessage = (AccountModification -> Maybe Text)
-> (AccountModification -> Maybe Text -> AccountModification)
-> Lens
     AccountModification AccountModification (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AccountModification' {Maybe Text
errorMessage :: Maybe Text
$sel:errorMessage:AccountModification' :: AccountModification -> Maybe Text
errorMessage} -> Maybe Text
errorMessage) (\s :: AccountModification
s@AccountModification' {} Maybe Text
a -> AccountModification
s {$sel:errorMessage:AccountModification' :: Maybe Text
errorMessage = Maybe Text
a} :: AccountModification)

instance Core.FromJSON AccountModification where
  parseJSON :: Value -> Parser AccountModification
parseJSON =
    String
-> (Object -> Parser AccountModification)
-> Value
-> Parser AccountModification
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"AccountModification"
      ( \Object
x ->
          Maybe POSIX
-> Maybe DedicatedTenancySupportResultEnum
-> Maybe DedicatedTenancyModificationStateEnum
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> AccountModification
AccountModification'
            (Maybe POSIX
 -> Maybe DedicatedTenancySupportResultEnum
 -> Maybe DedicatedTenancyModificationStateEnum
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> AccountModification)
-> Parser (Maybe POSIX)
-> Parser
     (Maybe DedicatedTenancySupportResultEnum
      -> Maybe DedicatedTenancyModificationStateEnum
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> AccountModification)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"StartTime")
            Parser
  (Maybe DedicatedTenancySupportResultEnum
   -> Maybe DedicatedTenancyModificationStateEnum
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> AccountModification)
-> Parser (Maybe DedicatedTenancySupportResultEnum)
-> Parser
     (Maybe DedicatedTenancyModificationStateEnum
      -> Maybe Text -> Maybe Text -> Maybe Text -> AccountModification)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe DedicatedTenancySupportResultEnum)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"DedicatedTenancySupport")
            Parser
  (Maybe DedicatedTenancyModificationStateEnum
   -> Maybe Text -> Maybe Text -> Maybe Text -> AccountModification)
-> Parser (Maybe DedicatedTenancyModificationStateEnum)
-> Parser
     (Maybe Text -> Maybe Text -> Maybe Text -> AccountModification)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object
-> Text -> Parser (Maybe DedicatedTenancyModificationStateEnum)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ModificationState")
            Parser
  (Maybe Text -> Maybe Text -> Maybe Text -> AccountModification)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe Text -> AccountModification)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"DedicatedTenancyManagementCidrRange")
            Parser (Maybe Text -> Maybe Text -> AccountModification)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> AccountModification)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ErrorCode")
            Parser (Maybe Text -> AccountModification)
-> Parser (Maybe Text) -> Parser AccountModification
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ErrorMessage")
      )

instance Prelude.Hashable AccountModification

instance Prelude.NFData AccountModification