{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.WorkSpaces.Types.AccountModification where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
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 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 status of BYOL (whether BYOL is being enabled or disabled).
    AccountModification -> Maybe DedicatedTenancySupportResultEnum
dedicatedTenancySupport :: Prelude.Maybe DedicatedTenancySupportResultEnum,
    -- | 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,
    -- | The state of the modification to the configuration of BYOL.
    AccountModification -> Maybe DedicatedTenancyModificationStateEnum
modificationState :: Prelude.Maybe DedicatedTenancyModificationStateEnum,
    -- | The timestamp when the modification of the BYOL configuration was
    -- started.
    AccountModification -> Maybe POSIX
startTime :: Prelude.Maybe Data.POSIX
  }
  deriving (AccountModification -> AccountModification -> Bool
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]
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
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. 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:
--
-- 'dedicatedTenancyManagementCidrRange', 'accountModification_dedicatedTenancyManagementCidrRange' - The IP address range, specified as an IPv4 CIDR block, for the
-- management network interface used for the account.
--
-- 'dedicatedTenancySupport', 'accountModification_dedicatedTenancySupport' - The status of BYOL (whether BYOL is being enabled or disabled).
--
-- '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.
--
-- 'modificationState', 'accountModification_modificationState' - The state of the modification to the configuration of BYOL.
--
-- 'startTime', 'accountModification_startTime' - The timestamp when the modification of the BYOL configuration was
-- started.
newAccountModification ::
  AccountModification
newAccountModification :: AccountModification
newAccountModification =
  AccountModification'
    { $sel:dedicatedTenancyManagementCidrRange:AccountModification' :: Maybe Text
dedicatedTenancyManagementCidrRange =
        forall a. Maybe a
Prelude.Nothing,
      $sel:dedicatedTenancySupport:AccountModification' :: Maybe DedicatedTenancySupportResultEnum
dedicatedTenancySupport = forall a. Maybe a
Prelude.Nothing,
      $sel:errorCode:AccountModification' :: Maybe Text
errorCode = forall a. Maybe a
Prelude.Nothing,
      $sel:errorMessage:AccountModification' :: Maybe Text
errorMessage = forall a. Maybe a
Prelude.Nothing,
      $sel:modificationState:AccountModification' :: Maybe DedicatedTenancyModificationStateEnum
modificationState = forall a. Maybe a
Prelude.Nothing,
      $sel:startTime:AccountModification' :: Maybe POSIX
startTime = forall a. Maybe a
Prelude.Nothing
    }

-- | 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 :: Lens' AccountModification (Maybe Text)
accountModification_dedicatedTenancyManagementCidrRange = 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 status of BYOL (whether BYOL is being enabled or disabled).
accountModification_dedicatedTenancySupport :: Lens.Lens' AccountModification (Prelude.Maybe DedicatedTenancySupportResultEnum)
accountModification_dedicatedTenancySupport :: Lens' AccountModification (Maybe DedicatedTenancySupportResultEnum)
accountModification_dedicatedTenancySupport = 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 error code that is returned if the configuration of BYOL cannot be
-- modified.
accountModification_errorCode :: Lens.Lens' AccountModification (Prelude.Maybe Prelude.Text)
accountModification_errorCode :: Lens' AccountModification (Maybe Text)
accountModification_errorCode = 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 :: Lens' AccountModification (Maybe Text)
accountModification_errorMessage = 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)

-- | The state of the modification to the configuration of BYOL.
accountModification_modificationState :: Lens.Lens' AccountModification (Prelude.Maybe DedicatedTenancyModificationStateEnum)
accountModification_modificationState :: Lens'
  AccountModification (Maybe DedicatedTenancyModificationStateEnum)
accountModification_modificationState = 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 timestamp when the modification of the BYOL configuration was
-- started.
accountModification_startTime :: Lens.Lens' AccountModification (Prelude.Maybe Prelude.UTCTime)
accountModification_startTime :: Lens' AccountModification (Maybe UTCTime)
accountModification_startTime = 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) 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 (a :: Format). Iso' (Time a) UTCTime
Data._Time

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

instance Prelude.Hashable AccountModification where
  hashWithSalt :: Int -> AccountModification -> Int
hashWithSalt Int
_salt AccountModification' {Maybe Text
Maybe POSIX
Maybe DedicatedTenancyModificationStateEnum
Maybe DedicatedTenancySupportResultEnum
startTime :: Maybe POSIX
modificationState :: Maybe DedicatedTenancyModificationStateEnum
errorMessage :: Maybe Text
errorCode :: Maybe Text
dedicatedTenancySupport :: Maybe DedicatedTenancySupportResultEnum
dedicatedTenancyManagementCidrRange :: Maybe Text
$sel:startTime:AccountModification' :: AccountModification -> Maybe POSIX
$sel:modificationState:AccountModification' :: AccountModification -> Maybe DedicatedTenancyModificationStateEnum
$sel:errorMessage:AccountModification' :: AccountModification -> Maybe Text
$sel:errorCode:AccountModification' :: AccountModification -> Maybe Text
$sel:dedicatedTenancySupport:AccountModification' :: AccountModification -> Maybe DedicatedTenancySupportResultEnum
$sel:dedicatedTenancyManagementCidrRange:AccountModification' :: AccountModification -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
dedicatedTenancyManagementCidrRange
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe DedicatedTenancySupportResultEnum
dedicatedTenancySupport
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
errorCode
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
errorMessage
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe DedicatedTenancyModificationStateEnum
modificationState
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
startTime

instance Prelude.NFData AccountModification where
  rnf :: AccountModification -> ()
rnf AccountModification' {Maybe Text
Maybe POSIX
Maybe DedicatedTenancyModificationStateEnum
Maybe DedicatedTenancySupportResultEnum
startTime :: Maybe POSIX
modificationState :: Maybe DedicatedTenancyModificationStateEnum
errorMessage :: Maybe Text
errorCode :: Maybe Text
dedicatedTenancySupport :: Maybe DedicatedTenancySupportResultEnum
dedicatedTenancyManagementCidrRange :: Maybe Text
$sel:startTime:AccountModification' :: AccountModification -> Maybe POSIX
$sel:modificationState:AccountModification' :: AccountModification -> Maybe DedicatedTenancyModificationStateEnum
$sel:errorMessage:AccountModification' :: AccountModification -> Maybe Text
$sel:errorCode:AccountModification' :: AccountModification -> Maybe Text
$sel:dedicatedTenancySupport:AccountModification' :: AccountModification -> Maybe DedicatedTenancySupportResultEnum
$sel:dedicatedTenancyManagementCidrRange:AccountModification' :: AccountModification -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
dedicatedTenancyManagementCidrRange
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe DedicatedTenancySupportResultEnum
dedicatedTenancySupport
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
errorCode
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
errorMessage
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe DedicatedTenancyModificationStateEnum
modificationState
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
startTime