{-# 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.S3.Types.RestoreRequest
-- 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.S3.Types.RestoreRequest where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.S3.Internal
import Amazonka.S3.Types.GlacierJobParameters
import Amazonka.S3.Types.OutputLocation
import Amazonka.S3.Types.RestoreRequestType
import Amazonka.S3.Types.SelectParameters
import Amazonka.S3.Types.Tier

-- | Container for restore job parameters.
--
-- /See:/ 'newRestoreRequest' smart constructor.
data RestoreRequest = RestoreRequest'
  { -- | Lifetime of the active copy in days. Do not use with restores that
    -- specify @OutputLocation@.
    --
    -- The Days element is required for regular restores, and must not be
    -- provided for select requests.
    RestoreRequest -> Maybe Int
days :: Prelude.Maybe Prelude.Int,
    -- | Describes the parameters for Select job types.
    RestoreRequest -> Maybe SelectParameters
selectParameters :: Prelude.Maybe SelectParameters,
    -- | Describes the location where the restore job\'s output is stored.
    RestoreRequest -> Maybe OutputLocation
outputLocation :: Prelude.Maybe OutputLocation,
    -- | Retrieval tier at which the restore will be processed.
    RestoreRequest -> Maybe Tier
tier :: Prelude.Maybe Tier,
    -- | S3 Glacier related parameters pertaining to this job. Do not use with
    -- restores that specify @OutputLocation@.
    RestoreRequest -> Maybe GlacierJobParameters
glacierJobParameters :: Prelude.Maybe GlacierJobParameters,
    -- | Type of restore request.
    RestoreRequest -> Maybe RestoreRequestType
type' :: Prelude.Maybe RestoreRequestType,
    -- | The optional description for the job.
    RestoreRequest -> Maybe Text
description :: Prelude.Maybe Prelude.Text
  }
  deriving (RestoreRequest -> RestoreRequest -> Bool
(RestoreRequest -> RestoreRequest -> Bool)
-> (RestoreRequest -> RestoreRequest -> Bool) -> Eq RestoreRequest
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RestoreRequest -> RestoreRequest -> Bool
$c/= :: RestoreRequest -> RestoreRequest -> Bool
== :: RestoreRequest -> RestoreRequest -> Bool
$c== :: RestoreRequest -> RestoreRequest -> Bool
Prelude.Eq, Int -> RestoreRequest -> ShowS
[RestoreRequest] -> ShowS
RestoreRequest -> String
(Int -> RestoreRequest -> ShowS)
-> (RestoreRequest -> String)
-> ([RestoreRequest] -> ShowS)
-> Show RestoreRequest
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RestoreRequest] -> ShowS
$cshowList :: [RestoreRequest] -> ShowS
show :: RestoreRequest -> String
$cshow :: RestoreRequest -> String
showsPrec :: Int -> RestoreRequest -> ShowS
$cshowsPrec :: Int -> RestoreRequest -> ShowS
Prelude.Show, (forall x. RestoreRequest -> Rep RestoreRequest x)
-> (forall x. Rep RestoreRequest x -> RestoreRequest)
-> Generic RestoreRequest
forall x. Rep RestoreRequest x -> RestoreRequest
forall x. RestoreRequest -> Rep RestoreRequest x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RestoreRequest x -> RestoreRequest
$cfrom :: forall x. RestoreRequest -> Rep RestoreRequest x
Prelude.Generic)

-- |
-- Create a value of 'RestoreRequest' 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:
--
-- 'days', 'restoreRequest_days' - Lifetime of the active copy in days. Do not use with restores that
-- specify @OutputLocation@.
--
-- The Days element is required for regular restores, and must not be
-- provided for select requests.
--
-- 'selectParameters', 'restoreRequest_selectParameters' - Describes the parameters for Select job types.
--
-- 'outputLocation', 'restoreRequest_outputLocation' - Describes the location where the restore job\'s output is stored.
--
-- 'tier', 'restoreRequest_tier' - Retrieval tier at which the restore will be processed.
--
-- 'glacierJobParameters', 'restoreRequest_glacierJobParameters' - S3 Glacier related parameters pertaining to this job. Do not use with
-- restores that specify @OutputLocation@.
--
-- 'type'', 'restoreRequest_type' - Type of restore request.
--
-- 'description', 'restoreRequest_description' - The optional description for the job.
newRestoreRequest ::
  RestoreRequest
newRestoreRequest :: RestoreRequest
newRestoreRequest =
  RestoreRequest' :: Maybe Int
-> Maybe SelectParameters
-> Maybe OutputLocation
-> Maybe Tier
-> Maybe GlacierJobParameters
-> Maybe RestoreRequestType
-> Maybe Text
-> RestoreRequest
RestoreRequest'
    { $sel:days:RestoreRequest' :: Maybe Int
days = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:selectParameters:RestoreRequest' :: Maybe SelectParameters
selectParameters = Maybe SelectParameters
forall a. Maybe a
Prelude.Nothing,
      $sel:outputLocation:RestoreRequest' :: Maybe OutputLocation
outputLocation = Maybe OutputLocation
forall a. Maybe a
Prelude.Nothing,
      $sel:tier:RestoreRequest' :: Maybe Tier
tier = Maybe Tier
forall a. Maybe a
Prelude.Nothing,
      $sel:glacierJobParameters:RestoreRequest' :: Maybe GlacierJobParameters
glacierJobParameters = Maybe GlacierJobParameters
forall a. Maybe a
Prelude.Nothing,
      $sel:type':RestoreRequest' :: Maybe RestoreRequestType
type' = Maybe RestoreRequestType
forall a. Maybe a
Prelude.Nothing,
      $sel:description:RestoreRequest' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | Lifetime of the active copy in days. Do not use with restores that
-- specify @OutputLocation@.
--
-- The Days element is required for regular restores, and must not be
-- provided for select requests.
restoreRequest_days :: Lens.Lens' RestoreRequest (Prelude.Maybe Prelude.Int)
restoreRequest_days :: (Maybe Int -> f (Maybe Int)) -> RestoreRequest -> f RestoreRequest
restoreRequest_days = (RestoreRequest -> Maybe Int)
-> (RestoreRequest -> Maybe Int -> RestoreRequest)
-> Lens RestoreRequest RestoreRequest (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RestoreRequest' {Maybe Int
days :: Maybe Int
$sel:days:RestoreRequest' :: RestoreRequest -> Maybe Int
days} -> Maybe Int
days) (\s :: RestoreRequest
s@RestoreRequest' {} Maybe Int
a -> RestoreRequest
s {$sel:days:RestoreRequest' :: Maybe Int
days = Maybe Int
a} :: RestoreRequest)

-- | Describes the parameters for Select job types.
restoreRequest_selectParameters :: Lens.Lens' RestoreRequest (Prelude.Maybe SelectParameters)
restoreRequest_selectParameters :: (Maybe SelectParameters -> f (Maybe SelectParameters))
-> RestoreRequest -> f RestoreRequest
restoreRequest_selectParameters = (RestoreRequest -> Maybe SelectParameters)
-> (RestoreRequest -> Maybe SelectParameters -> RestoreRequest)
-> Lens
     RestoreRequest
     RestoreRequest
     (Maybe SelectParameters)
     (Maybe SelectParameters)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RestoreRequest' {Maybe SelectParameters
selectParameters :: Maybe SelectParameters
$sel:selectParameters:RestoreRequest' :: RestoreRequest -> Maybe SelectParameters
selectParameters} -> Maybe SelectParameters
selectParameters) (\s :: RestoreRequest
s@RestoreRequest' {} Maybe SelectParameters
a -> RestoreRequest
s {$sel:selectParameters:RestoreRequest' :: Maybe SelectParameters
selectParameters = Maybe SelectParameters
a} :: RestoreRequest)

-- | Describes the location where the restore job\'s output is stored.
restoreRequest_outputLocation :: Lens.Lens' RestoreRequest (Prelude.Maybe OutputLocation)
restoreRequest_outputLocation :: (Maybe OutputLocation -> f (Maybe OutputLocation))
-> RestoreRequest -> f RestoreRequest
restoreRequest_outputLocation = (RestoreRequest -> Maybe OutputLocation)
-> (RestoreRequest -> Maybe OutputLocation -> RestoreRequest)
-> Lens
     RestoreRequest
     RestoreRequest
     (Maybe OutputLocation)
     (Maybe OutputLocation)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RestoreRequest' {Maybe OutputLocation
outputLocation :: Maybe OutputLocation
$sel:outputLocation:RestoreRequest' :: RestoreRequest -> Maybe OutputLocation
outputLocation} -> Maybe OutputLocation
outputLocation) (\s :: RestoreRequest
s@RestoreRequest' {} Maybe OutputLocation
a -> RestoreRequest
s {$sel:outputLocation:RestoreRequest' :: Maybe OutputLocation
outputLocation = Maybe OutputLocation
a} :: RestoreRequest)

-- | Retrieval tier at which the restore will be processed.
restoreRequest_tier :: Lens.Lens' RestoreRequest (Prelude.Maybe Tier)
restoreRequest_tier :: (Maybe Tier -> f (Maybe Tier))
-> RestoreRequest -> f RestoreRequest
restoreRequest_tier = (RestoreRequest -> Maybe Tier)
-> (RestoreRequest -> Maybe Tier -> RestoreRequest)
-> Lens RestoreRequest RestoreRequest (Maybe Tier) (Maybe Tier)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RestoreRequest' {Maybe Tier
tier :: Maybe Tier
$sel:tier:RestoreRequest' :: RestoreRequest -> Maybe Tier
tier} -> Maybe Tier
tier) (\s :: RestoreRequest
s@RestoreRequest' {} Maybe Tier
a -> RestoreRequest
s {$sel:tier:RestoreRequest' :: Maybe Tier
tier = Maybe Tier
a} :: RestoreRequest)

-- | S3 Glacier related parameters pertaining to this job. Do not use with
-- restores that specify @OutputLocation@.
restoreRequest_glacierJobParameters :: Lens.Lens' RestoreRequest (Prelude.Maybe GlacierJobParameters)
restoreRequest_glacierJobParameters :: (Maybe GlacierJobParameters -> f (Maybe GlacierJobParameters))
-> RestoreRequest -> f RestoreRequest
restoreRequest_glacierJobParameters = (RestoreRequest -> Maybe GlacierJobParameters)
-> (RestoreRequest -> Maybe GlacierJobParameters -> RestoreRequest)
-> Lens
     RestoreRequest
     RestoreRequest
     (Maybe GlacierJobParameters)
     (Maybe GlacierJobParameters)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RestoreRequest' {Maybe GlacierJobParameters
glacierJobParameters :: Maybe GlacierJobParameters
$sel:glacierJobParameters:RestoreRequest' :: RestoreRequest -> Maybe GlacierJobParameters
glacierJobParameters} -> Maybe GlacierJobParameters
glacierJobParameters) (\s :: RestoreRequest
s@RestoreRequest' {} Maybe GlacierJobParameters
a -> RestoreRequest
s {$sel:glacierJobParameters:RestoreRequest' :: Maybe GlacierJobParameters
glacierJobParameters = Maybe GlacierJobParameters
a} :: RestoreRequest)

-- | Type of restore request.
restoreRequest_type :: Lens.Lens' RestoreRequest (Prelude.Maybe RestoreRequestType)
restoreRequest_type :: (Maybe RestoreRequestType -> f (Maybe RestoreRequestType))
-> RestoreRequest -> f RestoreRequest
restoreRequest_type = (RestoreRequest -> Maybe RestoreRequestType)
-> (RestoreRequest -> Maybe RestoreRequestType -> RestoreRequest)
-> Lens
     RestoreRequest
     RestoreRequest
     (Maybe RestoreRequestType)
     (Maybe RestoreRequestType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RestoreRequest' {Maybe RestoreRequestType
type' :: Maybe RestoreRequestType
$sel:type':RestoreRequest' :: RestoreRequest -> Maybe RestoreRequestType
type'} -> Maybe RestoreRequestType
type') (\s :: RestoreRequest
s@RestoreRequest' {} Maybe RestoreRequestType
a -> RestoreRequest
s {$sel:type':RestoreRequest' :: Maybe RestoreRequestType
type' = Maybe RestoreRequestType
a} :: RestoreRequest)

-- | The optional description for the job.
restoreRequest_description :: Lens.Lens' RestoreRequest (Prelude.Maybe Prelude.Text)
restoreRequest_description :: (Maybe Text -> f (Maybe Text))
-> RestoreRequest -> f RestoreRequest
restoreRequest_description = (RestoreRequest -> Maybe Text)
-> (RestoreRequest -> Maybe Text -> RestoreRequest)
-> Lens RestoreRequest RestoreRequest (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RestoreRequest' {Maybe Text
description :: Maybe Text
$sel:description:RestoreRequest' :: RestoreRequest -> Maybe Text
description} -> Maybe Text
description) (\s :: RestoreRequest
s@RestoreRequest' {} Maybe Text
a -> RestoreRequest
s {$sel:description:RestoreRequest' :: Maybe Text
description = Maybe Text
a} :: RestoreRequest)

instance Prelude.Hashable RestoreRequest

instance Prelude.NFData RestoreRequest

instance Core.ToXML RestoreRequest where
  toXML :: RestoreRequest -> XML
toXML RestoreRequest' {Maybe Int
Maybe Text
Maybe RestoreRequestType
Maybe SelectParameters
Maybe Tier
Maybe GlacierJobParameters
Maybe OutputLocation
description :: Maybe Text
type' :: Maybe RestoreRequestType
glacierJobParameters :: Maybe GlacierJobParameters
tier :: Maybe Tier
outputLocation :: Maybe OutputLocation
selectParameters :: Maybe SelectParameters
days :: Maybe Int
$sel:description:RestoreRequest' :: RestoreRequest -> Maybe Text
$sel:type':RestoreRequest' :: RestoreRequest -> Maybe RestoreRequestType
$sel:glacierJobParameters:RestoreRequest' :: RestoreRequest -> Maybe GlacierJobParameters
$sel:tier:RestoreRequest' :: RestoreRequest -> Maybe Tier
$sel:outputLocation:RestoreRequest' :: RestoreRequest -> Maybe OutputLocation
$sel:selectParameters:RestoreRequest' :: RestoreRequest -> Maybe SelectParameters
$sel:days:RestoreRequest' :: RestoreRequest -> Maybe Int
..} =
    [XML] -> XML
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ Name
"Days" Name -> Maybe Int -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= Maybe Int
days,
        Name
"SelectParameters" Name -> Maybe SelectParameters -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= Maybe SelectParameters
selectParameters,
        Name
"OutputLocation" Name -> Maybe OutputLocation -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= Maybe OutputLocation
outputLocation,
        Name
"Tier" Name -> Maybe Tier -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= Maybe Tier
tier,
        Name
"GlacierJobParameters" Name -> Maybe GlacierJobParameters -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= Maybe GlacierJobParameters
glacierJobParameters,
        Name
"Type" Name -> Maybe RestoreRequestType -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= Maybe RestoreRequestType
type',
        Name
"Description" Name -> Maybe Text -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= Maybe Text
description
      ]