{-# 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.OpsWorksCM.Types.AccountAttribute
-- 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.OpsWorksCM.Types.AccountAttribute where

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

-- | Stores account attributes.
--
-- /See:/ 'newAccountAttribute' smart constructor.
data AccountAttribute = AccountAttribute'
  { -- | The current usage, such as the current number of servers that are
    -- associated with the account.
    AccountAttribute -> Maybe Int
used :: Prelude.Maybe Prelude.Int,
    -- | The maximum allowed value.
    AccountAttribute -> Maybe Int
maximum :: Prelude.Maybe Prelude.Int,
    -- | The attribute name. The following are supported attribute names.
    --
    -- -   /ServerLimit:/ The number of current servers\/maximum number of
    --     servers allowed. By default, you can have a maximum of 10 servers.
    --
    -- -   /ManualBackupLimit:/ The number of current manual backups\/maximum
    --     number of backups allowed. By default, you can have a maximum of 50
    --     manual backups saved.
    AccountAttribute -> Maybe Text
name :: Prelude.Maybe Prelude.Text
  }
  deriving (AccountAttribute -> AccountAttribute -> Bool
(AccountAttribute -> AccountAttribute -> Bool)
-> (AccountAttribute -> AccountAttribute -> Bool)
-> Eq AccountAttribute
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AccountAttribute -> AccountAttribute -> Bool
$c/= :: AccountAttribute -> AccountAttribute -> Bool
== :: AccountAttribute -> AccountAttribute -> Bool
$c== :: AccountAttribute -> AccountAttribute -> Bool
Prelude.Eq, ReadPrec [AccountAttribute]
ReadPrec AccountAttribute
Int -> ReadS AccountAttribute
ReadS [AccountAttribute]
(Int -> ReadS AccountAttribute)
-> ReadS [AccountAttribute]
-> ReadPrec AccountAttribute
-> ReadPrec [AccountAttribute]
-> Read AccountAttribute
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AccountAttribute]
$creadListPrec :: ReadPrec [AccountAttribute]
readPrec :: ReadPrec AccountAttribute
$creadPrec :: ReadPrec AccountAttribute
readList :: ReadS [AccountAttribute]
$creadList :: ReadS [AccountAttribute]
readsPrec :: Int -> ReadS AccountAttribute
$creadsPrec :: Int -> ReadS AccountAttribute
Prelude.Read, Int -> AccountAttribute -> ShowS
[AccountAttribute] -> ShowS
AccountAttribute -> String
(Int -> AccountAttribute -> ShowS)
-> (AccountAttribute -> String)
-> ([AccountAttribute] -> ShowS)
-> Show AccountAttribute
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AccountAttribute] -> ShowS
$cshowList :: [AccountAttribute] -> ShowS
show :: AccountAttribute -> String
$cshow :: AccountAttribute -> String
showsPrec :: Int -> AccountAttribute -> ShowS
$cshowsPrec :: Int -> AccountAttribute -> ShowS
Prelude.Show, (forall x. AccountAttribute -> Rep AccountAttribute x)
-> (forall x. Rep AccountAttribute x -> AccountAttribute)
-> Generic AccountAttribute
forall x. Rep AccountAttribute x -> AccountAttribute
forall x. AccountAttribute -> Rep AccountAttribute x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AccountAttribute x -> AccountAttribute
$cfrom :: forall x. AccountAttribute -> Rep AccountAttribute x
Prelude.Generic)

-- |
-- Create a value of 'AccountAttribute' 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:
--
-- 'used', 'accountAttribute_used' - The current usage, such as the current number of servers that are
-- associated with the account.
--
-- 'maximum', 'accountAttribute_maximum' - The maximum allowed value.
--
-- 'name', 'accountAttribute_name' - The attribute name. The following are supported attribute names.
--
-- -   /ServerLimit:/ The number of current servers\/maximum number of
--     servers allowed. By default, you can have a maximum of 10 servers.
--
-- -   /ManualBackupLimit:/ The number of current manual backups\/maximum
--     number of backups allowed. By default, you can have a maximum of 50
--     manual backups saved.
newAccountAttribute ::
  AccountAttribute
newAccountAttribute :: AccountAttribute
newAccountAttribute =
  AccountAttribute' :: Maybe Int -> Maybe Int -> Maybe Text -> AccountAttribute
AccountAttribute'
    { $sel:used:AccountAttribute' :: Maybe Int
used = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:maximum:AccountAttribute' :: Maybe Int
maximum = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:name:AccountAttribute' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The current usage, such as the current number of servers that are
-- associated with the account.
accountAttribute_used :: Lens.Lens' AccountAttribute (Prelude.Maybe Prelude.Int)
accountAttribute_used :: (Maybe Int -> f (Maybe Int))
-> AccountAttribute -> f AccountAttribute
accountAttribute_used = (AccountAttribute -> Maybe Int)
-> (AccountAttribute -> Maybe Int -> AccountAttribute)
-> Lens AccountAttribute AccountAttribute (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AccountAttribute' {Maybe Int
used :: Maybe Int
$sel:used:AccountAttribute' :: AccountAttribute -> Maybe Int
used} -> Maybe Int
used) (\s :: AccountAttribute
s@AccountAttribute' {} Maybe Int
a -> AccountAttribute
s {$sel:used:AccountAttribute' :: Maybe Int
used = Maybe Int
a} :: AccountAttribute)

-- | The maximum allowed value.
accountAttribute_maximum :: Lens.Lens' AccountAttribute (Prelude.Maybe Prelude.Int)
accountAttribute_maximum :: (Maybe Int -> f (Maybe Int))
-> AccountAttribute -> f AccountAttribute
accountAttribute_maximum = (AccountAttribute -> Maybe Int)
-> (AccountAttribute -> Maybe Int -> AccountAttribute)
-> Lens AccountAttribute AccountAttribute (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AccountAttribute' {Maybe Int
maximum :: Maybe Int
$sel:maximum:AccountAttribute' :: AccountAttribute -> Maybe Int
maximum} -> Maybe Int
maximum) (\s :: AccountAttribute
s@AccountAttribute' {} Maybe Int
a -> AccountAttribute
s {$sel:maximum:AccountAttribute' :: Maybe Int
maximum = Maybe Int
a} :: AccountAttribute)

-- | The attribute name. The following are supported attribute names.
--
-- -   /ServerLimit:/ The number of current servers\/maximum number of
--     servers allowed. By default, you can have a maximum of 10 servers.
--
-- -   /ManualBackupLimit:/ The number of current manual backups\/maximum
--     number of backups allowed. By default, you can have a maximum of 50
--     manual backups saved.
accountAttribute_name :: Lens.Lens' AccountAttribute (Prelude.Maybe Prelude.Text)
accountAttribute_name :: (Maybe Text -> f (Maybe Text))
-> AccountAttribute -> f AccountAttribute
accountAttribute_name = (AccountAttribute -> Maybe Text)
-> (AccountAttribute -> Maybe Text -> AccountAttribute)
-> Lens AccountAttribute AccountAttribute (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AccountAttribute' {Maybe Text
name :: Maybe Text
$sel:name:AccountAttribute' :: AccountAttribute -> Maybe Text
name} -> Maybe Text
name) (\s :: AccountAttribute
s@AccountAttribute' {} Maybe Text
a -> AccountAttribute
s {$sel:name:AccountAttribute' :: Maybe Text
name = Maybe Text
a} :: AccountAttribute)

instance Core.FromJSON AccountAttribute where
  parseJSON :: Value -> Parser AccountAttribute
parseJSON =
    String
-> (Object -> Parser AccountAttribute)
-> Value
-> Parser AccountAttribute
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"AccountAttribute"
      ( \Object
x ->
          Maybe Int -> Maybe Int -> Maybe Text -> AccountAttribute
AccountAttribute'
            (Maybe Int -> Maybe Int -> Maybe Text -> AccountAttribute)
-> Parser (Maybe Int)
-> Parser (Maybe Int -> Maybe Text -> AccountAttribute)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Used")
            Parser (Maybe Int -> Maybe Text -> AccountAttribute)
-> Parser (Maybe Int) -> Parser (Maybe Text -> AccountAttribute)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Maximum")
            Parser (Maybe Text -> AccountAttribute)
-> Parser (Maybe Text) -> Parser AccountAttribute
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
"Name")
      )

instance Prelude.Hashable AccountAttribute

instance Prelude.NFData AccountAttribute