{-# 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.StorageGateway.Types.AutomaticTapeCreationPolicyInfo
-- 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.StorageGateway.Types.AutomaticTapeCreationPolicyInfo where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.StorageGateway.Types.AutomaticTapeCreationRule

-- | Information about the gateway\'s automatic tape creation policies,
-- including the automatic tape creation rules and the gateway that is
-- using the policies.
--
-- /See:/ 'newAutomaticTapeCreationPolicyInfo' smart constructor.
data AutomaticTapeCreationPolicyInfo = AutomaticTapeCreationPolicyInfo'
  { AutomaticTapeCreationPolicyInfo -> Maybe Text
gatewayARN :: Prelude.Maybe Prelude.Text,
    -- | An automatic tape creation policy consists of a list of automatic tape
    -- creation rules. This returns the rules that determine when and how to
    -- automatically create new tapes.
    AutomaticTapeCreationPolicyInfo
-> Maybe (NonEmpty AutomaticTapeCreationRule)
automaticTapeCreationRules :: Prelude.Maybe (Prelude.NonEmpty AutomaticTapeCreationRule)
  }
  deriving (AutomaticTapeCreationPolicyInfo
-> AutomaticTapeCreationPolicyInfo -> Bool
(AutomaticTapeCreationPolicyInfo
 -> AutomaticTapeCreationPolicyInfo -> Bool)
-> (AutomaticTapeCreationPolicyInfo
    -> AutomaticTapeCreationPolicyInfo -> Bool)
-> Eq AutomaticTapeCreationPolicyInfo
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AutomaticTapeCreationPolicyInfo
-> AutomaticTapeCreationPolicyInfo -> Bool
$c/= :: AutomaticTapeCreationPolicyInfo
-> AutomaticTapeCreationPolicyInfo -> Bool
== :: AutomaticTapeCreationPolicyInfo
-> AutomaticTapeCreationPolicyInfo -> Bool
$c== :: AutomaticTapeCreationPolicyInfo
-> AutomaticTapeCreationPolicyInfo -> Bool
Prelude.Eq, ReadPrec [AutomaticTapeCreationPolicyInfo]
ReadPrec AutomaticTapeCreationPolicyInfo
Int -> ReadS AutomaticTapeCreationPolicyInfo
ReadS [AutomaticTapeCreationPolicyInfo]
(Int -> ReadS AutomaticTapeCreationPolicyInfo)
-> ReadS [AutomaticTapeCreationPolicyInfo]
-> ReadPrec AutomaticTapeCreationPolicyInfo
-> ReadPrec [AutomaticTapeCreationPolicyInfo]
-> Read AutomaticTapeCreationPolicyInfo
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AutomaticTapeCreationPolicyInfo]
$creadListPrec :: ReadPrec [AutomaticTapeCreationPolicyInfo]
readPrec :: ReadPrec AutomaticTapeCreationPolicyInfo
$creadPrec :: ReadPrec AutomaticTapeCreationPolicyInfo
readList :: ReadS [AutomaticTapeCreationPolicyInfo]
$creadList :: ReadS [AutomaticTapeCreationPolicyInfo]
readsPrec :: Int -> ReadS AutomaticTapeCreationPolicyInfo
$creadsPrec :: Int -> ReadS AutomaticTapeCreationPolicyInfo
Prelude.Read, Int -> AutomaticTapeCreationPolicyInfo -> ShowS
[AutomaticTapeCreationPolicyInfo] -> ShowS
AutomaticTapeCreationPolicyInfo -> String
(Int -> AutomaticTapeCreationPolicyInfo -> ShowS)
-> (AutomaticTapeCreationPolicyInfo -> String)
-> ([AutomaticTapeCreationPolicyInfo] -> ShowS)
-> Show AutomaticTapeCreationPolicyInfo
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AutomaticTapeCreationPolicyInfo] -> ShowS
$cshowList :: [AutomaticTapeCreationPolicyInfo] -> ShowS
show :: AutomaticTapeCreationPolicyInfo -> String
$cshow :: AutomaticTapeCreationPolicyInfo -> String
showsPrec :: Int -> AutomaticTapeCreationPolicyInfo -> ShowS
$cshowsPrec :: Int -> AutomaticTapeCreationPolicyInfo -> ShowS
Prelude.Show, (forall x.
 AutomaticTapeCreationPolicyInfo
 -> Rep AutomaticTapeCreationPolicyInfo x)
-> (forall x.
    Rep AutomaticTapeCreationPolicyInfo x
    -> AutomaticTapeCreationPolicyInfo)
-> Generic AutomaticTapeCreationPolicyInfo
forall x.
Rep AutomaticTapeCreationPolicyInfo x
-> AutomaticTapeCreationPolicyInfo
forall x.
AutomaticTapeCreationPolicyInfo
-> Rep AutomaticTapeCreationPolicyInfo x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AutomaticTapeCreationPolicyInfo x
-> AutomaticTapeCreationPolicyInfo
$cfrom :: forall x.
AutomaticTapeCreationPolicyInfo
-> Rep AutomaticTapeCreationPolicyInfo x
Prelude.Generic)

-- |
-- Create a value of 'AutomaticTapeCreationPolicyInfo' 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:
--
-- 'gatewayARN', 'automaticTapeCreationPolicyInfo_gatewayARN' - Undocumented member.
--
-- 'automaticTapeCreationRules', 'automaticTapeCreationPolicyInfo_automaticTapeCreationRules' - An automatic tape creation policy consists of a list of automatic tape
-- creation rules. This returns the rules that determine when and how to
-- automatically create new tapes.
newAutomaticTapeCreationPolicyInfo ::
  AutomaticTapeCreationPolicyInfo
newAutomaticTapeCreationPolicyInfo :: AutomaticTapeCreationPolicyInfo
newAutomaticTapeCreationPolicyInfo =
  AutomaticTapeCreationPolicyInfo' :: Maybe Text
-> Maybe (NonEmpty AutomaticTapeCreationRule)
-> AutomaticTapeCreationPolicyInfo
AutomaticTapeCreationPolicyInfo'
    { $sel:gatewayARN:AutomaticTapeCreationPolicyInfo' :: Maybe Text
gatewayARN =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:automaticTapeCreationRules:AutomaticTapeCreationPolicyInfo' :: Maybe (NonEmpty AutomaticTapeCreationRule)
automaticTapeCreationRules =
        Maybe (NonEmpty AutomaticTapeCreationRule)
forall a. Maybe a
Prelude.Nothing
    }

-- | Undocumented member.
automaticTapeCreationPolicyInfo_gatewayARN :: Lens.Lens' AutomaticTapeCreationPolicyInfo (Prelude.Maybe Prelude.Text)
automaticTapeCreationPolicyInfo_gatewayARN :: (Maybe Text -> f (Maybe Text))
-> AutomaticTapeCreationPolicyInfo
-> f AutomaticTapeCreationPolicyInfo
automaticTapeCreationPolicyInfo_gatewayARN = (AutomaticTapeCreationPolicyInfo -> Maybe Text)
-> (AutomaticTapeCreationPolicyInfo
    -> Maybe Text -> AutomaticTapeCreationPolicyInfo)
-> Lens
     AutomaticTapeCreationPolicyInfo
     AutomaticTapeCreationPolicyInfo
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AutomaticTapeCreationPolicyInfo' {Maybe Text
gatewayARN :: Maybe Text
$sel:gatewayARN:AutomaticTapeCreationPolicyInfo' :: AutomaticTapeCreationPolicyInfo -> Maybe Text
gatewayARN} -> Maybe Text
gatewayARN) (\s :: AutomaticTapeCreationPolicyInfo
s@AutomaticTapeCreationPolicyInfo' {} Maybe Text
a -> AutomaticTapeCreationPolicyInfo
s {$sel:gatewayARN:AutomaticTapeCreationPolicyInfo' :: Maybe Text
gatewayARN = Maybe Text
a} :: AutomaticTapeCreationPolicyInfo)

-- | An automatic tape creation policy consists of a list of automatic tape
-- creation rules. This returns the rules that determine when and how to
-- automatically create new tapes.
automaticTapeCreationPolicyInfo_automaticTapeCreationRules :: Lens.Lens' AutomaticTapeCreationPolicyInfo (Prelude.Maybe (Prelude.NonEmpty AutomaticTapeCreationRule))
automaticTapeCreationPolicyInfo_automaticTapeCreationRules :: (Maybe (NonEmpty AutomaticTapeCreationRule)
 -> f (Maybe (NonEmpty AutomaticTapeCreationRule)))
-> AutomaticTapeCreationPolicyInfo
-> f AutomaticTapeCreationPolicyInfo
automaticTapeCreationPolicyInfo_automaticTapeCreationRules = (AutomaticTapeCreationPolicyInfo
 -> Maybe (NonEmpty AutomaticTapeCreationRule))
-> (AutomaticTapeCreationPolicyInfo
    -> Maybe (NonEmpty AutomaticTapeCreationRule)
    -> AutomaticTapeCreationPolicyInfo)
-> Lens
     AutomaticTapeCreationPolicyInfo
     AutomaticTapeCreationPolicyInfo
     (Maybe (NonEmpty AutomaticTapeCreationRule))
     (Maybe (NonEmpty AutomaticTapeCreationRule))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AutomaticTapeCreationPolicyInfo' {Maybe (NonEmpty AutomaticTapeCreationRule)
automaticTapeCreationRules :: Maybe (NonEmpty AutomaticTapeCreationRule)
$sel:automaticTapeCreationRules:AutomaticTapeCreationPolicyInfo' :: AutomaticTapeCreationPolicyInfo
-> Maybe (NonEmpty AutomaticTapeCreationRule)
automaticTapeCreationRules} -> Maybe (NonEmpty AutomaticTapeCreationRule)
automaticTapeCreationRules) (\s :: AutomaticTapeCreationPolicyInfo
s@AutomaticTapeCreationPolicyInfo' {} Maybe (NonEmpty AutomaticTapeCreationRule)
a -> AutomaticTapeCreationPolicyInfo
s {$sel:automaticTapeCreationRules:AutomaticTapeCreationPolicyInfo' :: Maybe (NonEmpty AutomaticTapeCreationRule)
automaticTapeCreationRules = Maybe (NonEmpty AutomaticTapeCreationRule)
a} :: AutomaticTapeCreationPolicyInfo) ((Maybe (NonEmpty AutomaticTapeCreationRule)
  -> f (Maybe (NonEmpty AutomaticTapeCreationRule)))
 -> AutomaticTapeCreationPolicyInfo
 -> f AutomaticTapeCreationPolicyInfo)
-> ((Maybe (NonEmpty AutomaticTapeCreationRule)
     -> f (Maybe (NonEmpty AutomaticTapeCreationRule)))
    -> Maybe (NonEmpty AutomaticTapeCreationRule)
    -> f (Maybe (NonEmpty AutomaticTapeCreationRule)))
-> (Maybe (NonEmpty AutomaticTapeCreationRule)
    -> f (Maybe (NonEmpty AutomaticTapeCreationRule)))
-> AutomaticTapeCreationPolicyInfo
-> f AutomaticTapeCreationPolicyInfo
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (NonEmpty AutomaticTapeCreationRule)
  (NonEmpty AutomaticTapeCreationRule)
  (NonEmpty AutomaticTapeCreationRule)
  (NonEmpty AutomaticTapeCreationRule)
-> Iso
     (Maybe (NonEmpty AutomaticTapeCreationRule))
     (Maybe (NonEmpty AutomaticTapeCreationRule))
     (Maybe (NonEmpty AutomaticTapeCreationRule))
     (Maybe (NonEmpty AutomaticTapeCreationRule))
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
  (NonEmpty AutomaticTapeCreationRule)
  (NonEmpty AutomaticTapeCreationRule)
  (NonEmpty AutomaticTapeCreationRule)
  (NonEmpty AutomaticTapeCreationRule)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance
  Core.FromJSON
    AutomaticTapeCreationPolicyInfo
  where
  parseJSON :: Value -> Parser AutomaticTapeCreationPolicyInfo
parseJSON =
    String
-> (Object -> Parser AutomaticTapeCreationPolicyInfo)
-> Value
-> Parser AutomaticTapeCreationPolicyInfo
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"AutomaticTapeCreationPolicyInfo"
      ( \Object
x ->
          Maybe Text
-> Maybe (NonEmpty AutomaticTapeCreationRule)
-> AutomaticTapeCreationPolicyInfo
AutomaticTapeCreationPolicyInfo'
            (Maybe Text
 -> Maybe (NonEmpty AutomaticTapeCreationRule)
 -> AutomaticTapeCreationPolicyInfo)
-> Parser (Maybe Text)
-> Parser
     (Maybe (NonEmpty AutomaticTapeCreationRule)
      -> AutomaticTapeCreationPolicyInfo)
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
"GatewayARN")
            Parser
  (Maybe (NonEmpty AutomaticTapeCreationRule)
   -> AutomaticTapeCreationPolicyInfo)
-> Parser (Maybe (NonEmpty AutomaticTapeCreationRule))
-> Parser AutomaticTapeCreationPolicyInfo
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object
-> Text -> Parser (Maybe (NonEmpty AutomaticTapeCreationRule))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"AutomaticTapeCreationRules")
      )

instance
  Prelude.Hashable
    AutomaticTapeCreationPolicyInfo

instance
  Prelude.NFData
    AutomaticTapeCreationPolicyInfo