{-# 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.Glacier.Types.ProvisionedCapacityDescription
-- 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.Glacier.Types.ProvisionedCapacityDescription where

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

-- | The definition for a provisioned capacity unit.
--
-- /See:/ 'newProvisionedCapacityDescription' smart constructor.
data ProvisionedCapacityDescription = ProvisionedCapacityDescription'
  { -- | The ID that identifies the provisioned capacity unit.
    ProvisionedCapacityDescription -> Maybe Text
capacityId :: Prelude.Maybe Prelude.Text,
    -- | The date that the provisioned capacity unit was purchased, in Universal
    -- Coordinated Time (UTC).
    ProvisionedCapacityDescription -> Maybe Text
startDate :: Prelude.Maybe Prelude.Text,
    -- | The date that the provisioned capacity unit expires, in Universal
    -- Coordinated Time (UTC).
    ProvisionedCapacityDescription -> Maybe Text
expirationDate :: Prelude.Maybe Prelude.Text
  }
  deriving (ProvisionedCapacityDescription
-> ProvisionedCapacityDescription -> Bool
(ProvisionedCapacityDescription
 -> ProvisionedCapacityDescription -> Bool)
-> (ProvisionedCapacityDescription
    -> ProvisionedCapacityDescription -> Bool)
-> Eq ProvisionedCapacityDescription
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ProvisionedCapacityDescription
-> ProvisionedCapacityDescription -> Bool
$c/= :: ProvisionedCapacityDescription
-> ProvisionedCapacityDescription -> Bool
== :: ProvisionedCapacityDescription
-> ProvisionedCapacityDescription -> Bool
$c== :: ProvisionedCapacityDescription
-> ProvisionedCapacityDescription -> Bool
Prelude.Eq, ReadPrec [ProvisionedCapacityDescription]
ReadPrec ProvisionedCapacityDescription
Int -> ReadS ProvisionedCapacityDescription
ReadS [ProvisionedCapacityDescription]
(Int -> ReadS ProvisionedCapacityDescription)
-> ReadS [ProvisionedCapacityDescription]
-> ReadPrec ProvisionedCapacityDescription
-> ReadPrec [ProvisionedCapacityDescription]
-> Read ProvisionedCapacityDescription
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ProvisionedCapacityDescription]
$creadListPrec :: ReadPrec [ProvisionedCapacityDescription]
readPrec :: ReadPrec ProvisionedCapacityDescription
$creadPrec :: ReadPrec ProvisionedCapacityDescription
readList :: ReadS [ProvisionedCapacityDescription]
$creadList :: ReadS [ProvisionedCapacityDescription]
readsPrec :: Int -> ReadS ProvisionedCapacityDescription
$creadsPrec :: Int -> ReadS ProvisionedCapacityDescription
Prelude.Read, Int -> ProvisionedCapacityDescription -> ShowS
[ProvisionedCapacityDescription] -> ShowS
ProvisionedCapacityDescription -> String
(Int -> ProvisionedCapacityDescription -> ShowS)
-> (ProvisionedCapacityDescription -> String)
-> ([ProvisionedCapacityDescription] -> ShowS)
-> Show ProvisionedCapacityDescription
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ProvisionedCapacityDescription] -> ShowS
$cshowList :: [ProvisionedCapacityDescription] -> ShowS
show :: ProvisionedCapacityDescription -> String
$cshow :: ProvisionedCapacityDescription -> String
showsPrec :: Int -> ProvisionedCapacityDescription -> ShowS
$cshowsPrec :: Int -> ProvisionedCapacityDescription -> ShowS
Prelude.Show, (forall x.
 ProvisionedCapacityDescription
 -> Rep ProvisionedCapacityDescription x)
-> (forall x.
    Rep ProvisionedCapacityDescription x
    -> ProvisionedCapacityDescription)
-> Generic ProvisionedCapacityDescription
forall x.
Rep ProvisionedCapacityDescription x
-> ProvisionedCapacityDescription
forall x.
ProvisionedCapacityDescription
-> Rep ProvisionedCapacityDescription x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ProvisionedCapacityDescription x
-> ProvisionedCapacityDescription
$cfrom :: forall x.
ProvisionedCapacityDescription
-> Rep ProvisionedCapacityDescription x
Prelude.Generic)

-- |
-- Create a value of 'ProvisionedCapacityDescription' 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:
--
-- 'capacityId', 'provisionedCapacityDescription_capacityId' - The ID that identifies the provisioned capacity unit.
--
-- 'startDate', 'provisionedCapacityDescription_startDate' - The date that the provisioned capacity unit was purchased, in Universal
-- Coordinated Time (UTC).
--
-- 'expirationDate', 'provisionedCapacityDescription_expirationDate' - The date that the provisioned capacity unit expires, in Universal
-- Coordinated Time (UTC).
newProvisionedCapacityDescription ::
  ProvisionedCapacityDescription
newProvisionedCapacityDescription :: ProvisionedCapacityDescription
newProvisionedCapacityDescription =
  ProvisionedCapacityDescription' :: Maybe Text
-> Maybe Text -> Maybe Text -> ProvisionedCapacityDescription
ProvisionedCapacityDescription'
    { $sel:capacityId:ProvisionedCapacityDescription' :: Maybe Text
capacityId =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:startDate:ProvisionedCapacityDescription' :: Maybe Text
startDate = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:expirationDate:ProvisionedCapacityDescription' :: Maybe Text
expirationDate = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The ID that identifies the provisioned capacity unit.
provisionedCapacityDescription_capacityId :: Lens.Lens' ProvisionedCapacityDescription (Prelude.Maybe Prelude.Text)
provisionedCapacityDescription_capacityId :: (Maybe Text -> f (Maybe Text))
-> ProvisionedCapacityDescription
-> f ProvisionedCapacityDescription
provisionedCapacityDescription_capacityId = (ProvisionedCapacityDescription -> Maybe Text)
-> (ProvisionedCapacityDescription
    -> Maybe Text -> ProvisionedCapacityDescription)
-> Lens
     ProvisionedCapacityDescription
     ProvisionedCapacityDescription
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProvisionedCapacityDescription' {Maybe Text
capacityId :: Maybe Text
$sel:capacityId:ProvisionedCapacityDescription' :: ProvisionedCapacityDescription -> Maybe Text
capacityId} -> Maybe Text
capacityId) (\s :: ProvisionedCapacityDescription
s@ProvisionedCapacityDescription' {} Maybe Text
a -> ProvisionedCapacityDescription
s {$sel:capacityId:ProvisionedCapacityDescription' :: Maybe Text
capacityId = Maybe Text
a} :: ProvisionedCapacityDescription)

-- | The date that the provisioned capacity unit was purchased, in Universal
-- Coordinated Time (UTC).
provisionedCapacityDescription_startDate :: Lens.Lens' ProvisionedCapacityDescription (Prelude.Maybe Prelude.Text)
provisionedCapacityDescription_startDate :: (Maybe Text -> f (Maybe Text))
-> ProvisionedCapacityDescription
-> f ProvisionedCapacityDescription
provisionedCapacityDescription_startDate = (ProvisionedCapacityDescription -> Maybe Text)
-> (ProvisionedCapacityDescription
    -> Maybe Text -> ProvisionedCapacityDescription)
-> Lens
     ProvisionedCapacityDescription
     ProvisionedCapacityDescription
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProvisionedCapacityDescription' {Maybe Text
startDate :: Maybe Text
$sel:startDate:ProvisionedCapacityDescription' :: ProvisionedCapacityDescription -> Maybe Text
startDate} -> Maybe Text
startDate) (\s :: ProvisionedCapacityDescription
s@ProvisionedCapacityDescription' {} Maybe Text
a -> ProvisionedCapacityDescription
s {$sel:startDate:ProvisionedCapacityDescription' :: Maybe Text
startDate = Maybe Text
a} :: ProvisionedCapacityDescription)

-- | The date that the provisioned capacity unit expires, in Universal
-- Coordinated Time (UTC).
provisionedCapacityDescription_expirationDate :: Lens.Lens' ProvisionedCapacityDescription (Prelude.Maybe Prelude.Text)
provisionedCapacityDescription_expirationDate :: (Maybe Text -> f (Maybe Text))
-> ProvisionedCapacityDescription
-> f ProvisionedCapacityDescription
provisionedCapacityDescription_expirationDate = (ProvisionedCapacityDescription -> Maybe Text)
-> (ProvisionedCapacityDescription
    -> Maybe Text -> ProvisionedCapacityDescription)
-> Lens
     ProvisionedCapacityDescription
     ProvisionedCapacityDescription
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProvisionedCapacityDescription' {Maybe Text
expirationDate :: Maybe Text
$sel:expirationDate:ProvisionedCapacityDescription' :: ProvisionedCapacityDescription -> Maybe Text
expirationDate} -> Maybe Text
expirationDate) (\s :: ProvisionedCapacityDescription
s@ProvisionedCapacityDescription' {} Maybe Text
a -> ProvisionedCapacityDescription
s {$sel:expirationDate:ProvisionedCapacityDescription' :: Maybe Text
expirationDate = Maybe Text
a} :: ProvisionedCapacityDescription)

instance Core.FromJSON ProvisionedCapacityDescription where
  parseJSON :: Value -> Parser ProvisionedCapacityDescription
parseJSON =
    String
-> (Object -> Parser ProvisionedCapacityDescription)
-> Value
-> Parser ProvisionedCapacityDescription
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ProvisionedCapacityDescription"
      ( \Object
x ->
          Maybe Text
-> Maybe Text -> Maybe Text -> ProvisionedCapacityDescription
ProvisionedCapacityDescription'
            (Maybe Text
 -> Maybe Text -> Maybe Text -> ProvisionedCapacityDescription)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text -> Maybe Text -> ProvisionedCapacityDescription)
forall (f :: * -> *) a b. Functor 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
"CapacityId")
            Parser (Maybe Text -> Maybe Text -> ProvisionedCapacityDescription)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> ProvisionedCapacityDescription)
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
"StartDate")
            Parser (Maybe Text -> ProvisionedCapacityDescription)
-> Parser (Maybe Text) -> Parser ProvisionedCapacityDescription
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
"ExpirationDate")
      )

instance
  Prelude.Hashable
    ProvisionedCapacityDescription

instance
  Prelude.NFData
    ProvisionedCapacityDescription