{-# 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.ArchiveCreationOutput
-- 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.ArchiveCreationOutput where

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

-- | Contains the Amazon S3 Glacier response to your request.
--
-- For information about the underlying REST API, see
-- <https://docs.aws.amazon.com/amazonglacier/latest/dev/api-archive-post.html Upload Archive>.
-- For conceptual information, see
-- <https://docs.aws.amazon.com/amazonglacier/latest/dev/working-with-archives.html Working with Archives in Amazon S3 Glacier>.
--
-- /See:/ 'newArchiveCreationOutput' smart constructor.
data ArchiveCreationOutput = ArchiveCreationOutput'
  { -- | The ID of the archive. This value is also included as part of the
    -- location.
    ArchiveCreationOutput -> Maybe Text
archiveId :: Prelude.Maybe Prelude.Text,
    -- | The checksum of the archive computed by Amazon S3 Glacier.
    ArchiveCreationOutput -> Maybe Text
checksum :: Prelude.Maybe Prelude.Text,
    -- | The relative URI path of the newly added archive resource.
    ArchiveCreationOutput -> Maybe Text
location :: Prelude.Maybe Prelude.Text
  }
  deriving (ArchiveCreationOutput -> ArchiveCreationOutput -> Bool
(ArchiveCreationOutput -> ArchiveCreationOutput -> Bool)
-> (ArchiveCreationOutput -> ArchiveCreationOutput -> Bool)
-> Eq ArchiveCreationOutput
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ArchiveCreationOutput -> ArchiveCreationOutput -> Bool
$c/= :: ArchiveCreationOutput -> ArchiveCreationOutput -> Bool
== :: ArchiveCreationOutput -> ArchiveCreationOutput -> Bool
$c== :: ArchiveCreationOutput -> ArchiveCreationOutput -> Bool
Prelude.Eq, ReadPrec [ArchiveCreationOutput]
ReadPrec ArchiveCreationOutput
Int -> ReadS ArchiveCreationOutput
ReadS [ArchiveCreationOutput]
(Int -> ReadS ArchiveCreationOutput)
-> ReadS [ArchiveCreationOutput]
-> ReadPrec ArchiveCreationOutput
-> ReadPrec [ArchiveCreationOutput]
-> Read ArchiveCreationOutput
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ArchiveCreationOutput]
$creadListPrec :: ReadPrec [ArchiveCreationOutput]
readPrec :: ReadPrec ArchiveCreationOutput
$creadPrec :: ReadPrec ArchiveCreationOutput
readList :: ReadS [ArchiveCreationOutput]
$creadList :: ReadS [ArchiveCreationOutput]
readsPrec :: Int -> ReadS ArchiveCreationOutput
$creadsPrec :: Int -> ReadS ArchiveCreationOutput
Prelude.Read, Int -> ArchiveCreationOutput -> ShowS
[ArchiveCreationOutput] -> ShowS
ArchiveCreationOutput -> String
(Int -> ArchiveCreationOutput -> ShowS)
-> (ArchiveCreationOutput -> String)
-> ([ArchiveCreationOutput] -> ShowS)
-> Show ArchiveCreationOutput
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ArchiveCreationOutput] -> ShowS
$cshowList :: [ArchiveCreationOutput] -> ShowS
show :: ArchiveCreationOutput -> String
$cshow :: ArchiveCreationOutput -> String
showsPrec :: Int -> ArchiveCreationOutput -> ShowS
$cshowsPrec :: Int -> ArchiveCreationOutput -> ShowS
Prelude.Show, (forall x. ArchiveCreationOutput -> Rep ArchiveCreationOutput x)
-> (forall x. Rep ArchiveCreationOutput x -> ArchiveCreationOutput)
-> Generic ArchiveCreationOutput
forall x. Rep ArchiveCreationOutput x -> ArchiveCreationOutput
forall x. ArchiveCreationOutput -> Rep ArchiveCreationOutput x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ArchiveCreationOutput x -> ArchiveCreationOutput
$cfrom :: forall x. ArchiveCreationOutput -> Rep ArchiveCreationOutput x
Prelude.Generic)

-- |
-- Create a value of 'ArchiveCreationOutput' 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:
--
-- 'archiveId', 'archiveCreationOutput_archiveId' - The ID of the archive. This value is also included as part of the
-- location.
--
-- 'checksum', 'archiveCreationOutput_checksum' - The checksum of the archive computed by Amazon S3 Glacier.
--
-- 'location', 'archiveCreationOutput_location' - The relative URI path of the newly added archive resource.
newArchiveCreationOutput ::
  ArchiveCreationOutput
newArchiveCreationOutput :: ArchiveCreationOutput
newArchiveCreationOutput =
  ArchiveCreationOutput' :: Maybe Text -> Maybe Text -> Maybe Text -> ArchiveCreationOutput
ArchiveCreationOutput'
    { $sel:archiveId:ArchiveCreationOutput' :: Maybe Text
archiveId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:checksum:ArchiveCreationOutput' :: Maybe Text
checksum = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:location:ArchiveCreationOutput' :: Maybe Text
location = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The ID of the archive. This value is also included as part of the
-- location.
archiveCreationOutput_archiveId :: Lens.Lens' ArchiveCreationOutput (Prelude.Maybe Prelude.Text)
archiveCreationOutput_archiveId :: (Maybe Text -> f (Maybe Text))
-> ArchiveCreationOutput -> f ArchiveCreationOutput
archiveCreationOutput_archiveId = (ArchiveCreationOutput -> Maybe Text)
-> (ArchiveCreationOutput -> Maybe Text -> ArchiveCreationOutput)
-> Lens
     ArchiveCreationOutput
     ArchiveCreationOutput
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ArchiveCreationOutput' {Maybe Text
archiveId :: Maybe Text
$sel:archiveId:ArchiveCreationOutput' :: ArchiveCreationOutput -> Maybe Text
archiveId} -> Maybe Text
archiveId) (\s :: ArchiveCreationOutput
s@ArchiveCreationOutput' {} Maybe Text
a -> ArchiveCreationOutput
s {$sel:archiveId:ArchiveCreationOutput' :: Maybe Text
archiveId = Maybe Text
a} :: ArchiveCreationOutput)

-- | The checksum of the archive computed by Amazon S3 Glacier.
archiveCreationOutput_checksum :: Lens.Lens' ArchiveCreationOutput (Prelude.Maybe Prelude.Text)
archiveCreationOutput_checksum :: (Maybe Text -> f (Maybe Text))
-> ArchiveCreationOutput -> f ArchiveCreationOutput
archiveCreationOutput_checksum = (ArchiveCreationOutput -> Maybe Text)
-> (ArchiveCreationOutput -> Maybe Text -> ArchiveCreationOutput)
-> Lens
     ArchiveCreationOutput
     ArchiveCreationOutput
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ArchiveCreationOutput' {Maybe Text
checksum :: Maybe Text
$sel:checksum:ArchiveCreationOutput' :: ArchiveCreationOutput -> Maybe Text
checksum} -> Maybe Text
checksum) (\s :: ArchiveCreationOutput
s@ArchiveCreationOutput' {} Maybe Text
a -> ArchiveCreationOutput
s {$sel:checksum:ArchiveCreationOutput' :: Maybe Text
checksum = Maybe Text
a} :: ArchiveCreationOutput)

-- | The relative URI path of the newly added archive resource.
archiveCreationOutput_location :: Lens.Lens' ArchiveCreationOutput (Prelude.Maybe Prelude.Text)
archiveCreationOutput_location :: (Maybe Text -> f (Maybe Text))
-> ArchiveCreationOutput -> f ArchiveCreationOutput
archiveCreationOutput_location = (ArchiveCreationOutput -> Maybe Text)
-> (ArchiveCreationOutput -> Maybe Text -> ArchiveCreationOutput)
-> Lens
     ArchiveCreationOutput
     ArchiveCreationOutput
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ArchiveCreationOutput' {Maybe Text
location :: Maybe Text
$sel:location:ArchiveCreationOutput' :: ArchiveCreationOutput -> Maybe Text
location} -> Maybe Text
location) (\s :: ArchiveCreationOutput
s@ArchiveCreationOutput' {} Maybe Text
a -> ArchiveCreationOutput
s {$sel:location:ArchiveCreationOutput' :: Maybe Text
location = Maybe Text
a} :: ArchiveCreationOutput)

instance Core.FromJSON ArchiveCreationOutput where
  parseJSON :: Value -> Parser ArchiveCreationOutput
parseJSON =
    String
-> (Object -> Parser ArchiveCreationOutput)
-> Value
-> Parser ArchiveCreationOutput
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ArchiveCreationOutput"
      ( \Object
x ->
          Maybe Text -> Maybe Text -> Maybe Text -> ArchiveCreationOutput
ArchiveCreationOutput'
            (Maybe Text -> Maybe Text -> Maybe Text -> ArchiveCreationOutput)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe Text -> ArchiveCreationOutput)
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
"x-amz-archive-id")
            Parser (Maybe Text -> Maybe Text -> ArchiveCreationOutput)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> ArchiveCreationOutput)
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
"x-amz-sha256-tree-hash")
            Parser (Maybe Text -> ArchiveCreationOutput)
-> Parser (Maybe Text) -> Parser ArchiveCreationOutput
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
"Location")
      )

instance Prelude.Hashable ArchiveCreationOutput

instance Prelude.NFData ArchiveCreationOutput