{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.CloudWatchEvents.CreateArchive
-- 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)
--
-- Creates an archive of events with the specified settings. When you
-- create an archive, incoming events might not immediately start being
-- sent to the archive. Allow a short period of time for changes to take
-- effect. If you do not specify a pattern to filter events sent to the
-- archive, all events are sent to the archive except replayed events.
-- Replayed events are not sent to an archive.
module Amazonka.CloudWatchEvents.CreateArchive
  ( -- * Creating a Request
    CreateArchive (..),
    newCreateArchive,

    -- * Request Lenses
    createArchive_eventPattern,
    createArchive_retentionDays,
    createArchive_description,
    createArchive_archiveName,
    createArchive_eventSourceArn,

    -- * Destructuring the Response
    CreateArchiveResponse (..),
    newCreateArchiveResponse,

    -- * Response Lenses
    createArchiveResponse_creationTime,
    createArchiveResponse_state,
    createArchiveResponse_archiveArn,
    createArchiveResponse_stateReason,
    createArchiveResponse_httpStatus,
  )
where

import Amazonka.CloudWatchEvents.Types
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newCreateArchive' smart constructor.
data CreateArchive = CreateArchive'
  { -- | An event pattern to use to filter events sent to the archive.
    CreateArchive -> Maybe Text
eventPattern :: Prelude.Maybe Prelude.Text,
    -- | The number of days to retain events for. Default value is 0. If set to
    -- 0, events are retained indefinitely
    CreateArchive -> Maybe Natural
retentionDays :: Prelude.Maybe Prelude.Natural,
    -- | A description for the archive.
    CreateArchive -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | The name for the archive to create.
    CreateArchive -> Text
archiveName :: Prelude.Text,
    -- | The ARN of the event bus that sends events to the archive.
    CreateArchive -> Text
eventSourceArn :: Prelude.Text
  }
  deriving (CreateArchive -> CreateArchive -> Bool
(CreateArchive -> CreateArchive -> Bool)
-> (CreateArchive -> CreateArchive -> Bool) -> Eq CreateArchive
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateArchive -> CreateArchive -> Bool
$c/= :: CreateArchive -> CreateArchive -> Bool
== :: CreateArchive -> CreateArchive -> Bool
$c== :: CreateArchive -> CreateArchive -> Bool
Prelude.Eq, ReadPrec [CreateArchive]
ReadPrec CreateArchive
Int -> ReadS CreateArchive
ReadS [CreateArchive]
(Int -> ReadS CreateArchive)
-> ReadS [CreateArchive]
-> ReadPrec CreateArchive
-> ReadPrec [CreateArchive]
-> Read CreateArchive
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateArchive]
$creadListPrec :: ReadPrec [CreateArchive]
readPrec :: ReadPrec CreateArchive
$creadPrec :: ReadPrec CreateArchive
readList :: ReadS [CreateArchive]
$creadList :: ReadS [CreateArchive]
readsPrec :: Int -> ReadS CreateArchive
$creadsPrec :: Int -> ReadS CreateArchive
Prelude.Read, Int -> CreateArchive -> ShowS
[CreateArchive] -> ShowS
CreateArchive -> String
(Int -> CreateArchive -> ShowS)
-> (CreateArchive -> String)
-> ([CreateArchive] -> ShowS)
-> Show CreateArchive
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateArchive] -> ShowS
$cshowList :: [CreateArchive] -> ShowS
show :: CreateArchive -> String
$cshow :: CreateArchive -> String
showsPrec :: Int -> CreateArchive -> ShowS
$cshowsPrec :: Int -> CreateArchive -> ShowS
Prelude.Show, (forall x. CreateArchive -> Rep CreateArchive x)
-> (forall x. Rep CreateArchive x -> CreateArchive)
-> Generic CreateArchive
forall x. Rep CreateArchive x -> CreateArchive
forall x. CreateArchive -> Rep CreateArchive x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateArchive x -> CreateArchive
$cfrom :: forall x. CreateArchive -> Rep CreateArchive x
Prelude.Generic)

-- |
-- Create a value of 'CreateArchive' 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:
--
-- 'eventPattern', 'createArchive_eventPattern' - An event pattern to use to filter events sent to the archive.
--
-- 'retentionDays', 'createArchive_retentionDays' - The number of days to retain events for. Default value is 0. If set to
-- 0, events are retained indefinitely
--
-- 'description', 'createArchive_description' - A description for the archive.
--
-- 'archiveName', 'createArchive_archiveName' - The name for the archive to create.
--
-- 'eventSourceArn', 'createArchive_eventSourceArn' - The ARN of the event bus that sends events to the archive.
newCreateArchive ::
  -- | 'archiveName'
  Prelude.Text ->
  -- | 'eventSourceArn'
  Prelude.Text ->
  CreateArchive
newCreateArchive :: Text -> Text -> CreateArchive
newCreateArchive Text
pArchiveName_ Text
pEventSourceArn_ =
  CreateArchive' :: Maybe Text
-> Maybe Natural -> Maybe Text -> Text -> Text -> CreateArchive
CreateArchive'
    { $sel:eventPattern:CreateArchive' :: Maybe Text
eventPattern = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:retentionDays:CreateArchive' :: Maybe Natural
retentionDays = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:description:CreateArchive' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:archiveName:CreateArchive' :: Text
archiveName = Text
pArchiveName_,
      $sel:eventSourceArn:CreateArchive' :: Text
eventSourceArn = Text
pEventSourceArn_
    }

-- | An event pattern to use to filter events sent to the archive.
createArchive_eventPattern :: Lens.Lens' CreateArchive (Prelude.Maybe Prelude.Text)
createArchive_eventPattern :: (Maybe Text -> f (Maybe Text)) -> CreateArchive -> f CreateArchive
createArchive_eventPattern = (CreateArchive -> Maybe Text)
-> (CreateArchive -> Maybe Text -> CreateArchive)
-> Lens CreateArchive CreateArchive (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateArchive' {Maybe Text
eventPattern :: Maybe Text
$sel:eventPattern:CreateArchive' :: CreateArchive -> Maybe Text
eventPattern} -> Maybe Text
eventPattern) (\s :: CreateArchive
s@CreateArchive' {} Maybe Text
a -> CreateArchive
s {$sel:eventPattern:CreateArchive' :: Maybe Text
eventPattern = Maybe Text
a} :: CreateArchive)

-- | The number of days to retain events for. Default value is 0. If set to
-- 0, events are retained indefinitely
createArchive_retentionDays :: Lens.Lens' CreateArchive (Prelude.Maybe Prelude.Natural)
createArchive_retentionDays :: (Maybe Natural -> f (Maybe Natural))
-> CreateArchive -> f CreateArchive
createArchive_retentionDays = (CreateArchive -> Maybe Natural)
-> (CreateArchive -> Maybe Natural -> CreateArchive)
-> Lens CreateArchive CreateArchive (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateArchive' {Maybe Natural
retentionDays :: Maybe Natural
$sel:retentionDays:CreateArchive' :: CreateArchive -> Maybe Natural
retentionDays} -> Maybe Natural
retentionDays) (\s :: CreateArchive
s@CreateArchive' {} Maybe Natural
a -> CreateArchive
s {$sel:retentionDays:CreateArchive' :: Maybe Natural
retentionDays = Maybe Natural
a} :: CreateArchive)

-- | A description for the archive.
createArchive_description :: Lens.Lens' CreateArchive (Prelude.Maybe Prelude.Text)
createArchive_description :: (Maybe Text -> f (Maybe Text)) -> CreateArchive -> f CreateArchive
createArchive_description = (CreateArchive -> Maybe Text)
-> (CreateArchive -> Maybe Text -> CreateArchive)
-> Lens CreateArchive CreateArchive (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateArchive' {Maybe Text
description :: Maybe Text
$sel:description:CreateArchive' :: CreateArchive -> Maybe Text
description} -> Maybe Text
description) (\s :: CreateArchive
s@CreateArchive' {} Maybe Text
a -> CreateArchive
s {$sel:description:CreateArchive' :: Maybe Text
description = Maybe Text
a} :: CreateArchive)

-- | The name for the archive to create.
createArchive_archiveName :: Lens.Lens' CreateArchive Prelude.Text
createArchive_archiveName :: (Text -> f Text) -> CreateArchive -> f CreateArchive
createArchive_archiveName = (CreateArchive -> Text)
-> (CreateArchive -> Text -> CreateArchive)
-> Lens CreateArchive CreateArchive Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateArchive' {Text
archiveName :: Text
$sel:archiveName:CreateArchive' :: CreateArchive -> Text
archiveName} -> Text
archiveName) (\s :: CreateArchive
s@CreateArchive' {} Text
a -> CreateArchive
s {$sel:archiveName:CreateArchive' :: Text
archiveName = Text
a} :: CreateArchive)

-- | The ARN of the event bus that sends events to the archive.
createArchive_eventSourceArn :: Lens.Lens' CreateArchive Prelude.Text
createArchive_eventSourceArn :: (Text -> f Text) -> CreateArchive -> f CreateArchive
createArchive_eventSourceArn = (CreateArchive -> Text)
-> (CreateArchive -> Text -> CreateArchive)
-> Lens CreateArchive CreateArchive Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateArchive' {Text
eventSourceArn :: Text
$sel:eventSourceArn:CreateArchive' :: CreateArchive -> Text
eventSourceArn} -> Text
eventSourceArn) (\s :: CreateArchive
s@CreateArchive' {} Text
a -> CreateArchive
s {$sel:eventSourceArn:CreateArchive' :: Text
eventSourceArn = Text
a} :: CreateArchive)

instance Core.AWSRequest CreateArchive where
  type
    AWSResponse CreateArchive =
      CreateArchiveResponse
  request :: CreateArchive -> Request CreateArchive
request = Service -> CreateArchive -> Request CreateArchive
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy CreateArchive
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateArchive)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse CreateArchive))
-> Logger
-> Service
-> Proxy CreateArchive
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateArchive)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe POSIX
-> Maybe ArchiveState
-> Maybe Text
-> Maybe Text
-> Int
-> CreateArchiveResponse
CreateArchiveResponse'
            (Maybe POSIX
 -> Maybe ArchiveState
 -> Maybe Text
 -> Maybe Text
 -> Int
 -> CreateArchiveResponse)
-> Either String (Maybe POSIX)
-> Either
     String
     (Maybe ArchiveState
      -> Maybe Text -> Maybe Text -> Int -> CreateArchiveResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"CreationTime")
            Either
  String
  (Maybe ArchiveState
   -> Maybe Text -> Maybe Text -> Int -> CreateArchiveResponse)
-> Either String (Maybe ArchiveState)
-> Either
     String (Maybe Text -> Maybe Text -> Int -> CreateArchiveResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe ArchiveState)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"State")
            Either
  String (Maybe Text -> Maybe Text -> Int -> CreateArchiveResponse)
-> Either String (Maybe Text)
-> Either String (Maybe Text -> Int -> CreateArchiveResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"ArchiveArn")
            Either String (Maybe Text -> Int -> CreateArchiveResponse)
-> Either String (Maybe Text)
-> Either String (Int -> CreateArchiveResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"StateReason")
            Either String (Int -> CreateArchiveResponse)
-> Either String Int -> Either String CreateArchiveResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable CreateArchive

instance Prelude.NFData CreateArchive

instance Core.ToHeaders CreateArchive where
  toHeaders :: CreateArchive -> ResponseHeaders
toHeaders =
    ResponseHeaders -> CreateArchive -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# (ByteString
"AWSEvents.CreateArchive" :: Prelude.ByteString),
            HeaderName
"Content-Type"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Core.ToJSON CreateArchive where
  toJSON :: CreateArchive -> Value
toJSON CreateArchive' {Maybe Natural
Maybe Text
Text
eventSourceArn :: Text
archiveName :: Text
description :: Maybe Text
retentionDays :: Maybe Natural
eventPattern :: Maybe Text
$sel:eventSourceArn:CreateArchive' :: CreateArchive -> Text
$sel:archiveName:CreateArchive' :: CreateArchive -> Text
$sel:description:CreateArchive' :: CreateArchive -> Maybe Text
$sel:retentionDays:CreateArchive' :: CreateArchive -> Maybe Natural
$sel:eventPattern:CreateArchive' :: CreateArchive -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"EventPattern" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
eventPattern,
            (Text
"RetentionDays" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
retentionDays,
            (Text
"Description" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
description,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"ArchiveName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
archiveName),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"EventSourceArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
eventSourceArn)
          ]
      )

instance Core.ToPath CreateArchive where
  toPath :: CreateArchive -> ByteString
toPath = ByteString -> CreateArchive -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

instance Core.ToQuery CreateArchive where
  toQuery :: CreateArchive -> QueryString
toQuery = QueryString -> CreateArchive -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty

-- | /See:/ 'newCreateArchiveResponse' smart constructor.
data CreateArchiveResponse = CreateArchiveResponse'
  { -- | The time at which the archive was created.
    CreateArchiveResponse -> Maybe POSIX
creationTime :: Prelude.Maybe Core.POSIX,
    -- | The state of the archive that was created.
    CreateArchiveResponse -> Maybe ArchiveState
state :: Prelude.Maybe ArchiveState,
    -- | The ARN of the archive that was created.
    CreateArchiveResponse -> Maybe Text
archiveArn :: Prelude.Maybe Prelude.Text,
    -- | The reason that the archive is in the state.
    CreateArchiveResponse -> Maybe Text
stateReason :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    CreateArchiveResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (CreateArchiveResponse -> CreateArchiveResponse -> Bool
(CreateArchiveResponse -> CreateArchiveResponse -> Bool)
-> (CreateArchiveResponse -> CreateArchiveResponse -> Bool)
-> Eq CreateArchiveResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateArchiveResponse -> CreateArchiveResponse -> Bool
$c/= :: CreateArchiveResponse -> CreateArchiveResponse -> Bool
== :: CreateArchiveResponse -> CreateArchiveResponse -> Bool
$c== :: CreateArchiveResponse -> CreateArchiveResponse -> Bool
Prelude.Eq, ReadPrec [CreateArchiveResponse]
ReadPrec CreateArchiveResponse
Int -> ReadS CreateArchiveResponse
ReadS [CreateArchiveResponse]
(Int -> ReadS CreateArchiveResponse)
-> ReadS [CreateArchiveResponse]
-> ReadPrec CreateArchiveResponse
-> ReadPrec [CreateArchiveResponse]
-> Read CreateArchiveResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateArchiveResponse]
$creadListPrec :: ReadPrec [CreateArchiveResponse]
readPrec :: ReadPrec CreateArchiveResponse
$creadPrec :: ReadPrec CreateArchiveResponse
readList :: ReadS [CreateArchiveResponse]
$creadList :: ReadS [CreateArchiveResponse]
readsPrec :: Int -> ReadS CreateArchiveResponse
$creadsPrec :: Int -> ReadS CreateArchiveResponse
Prelude.Read, Int -> CreateArchiveResponse -> ShowS
[CreateArchiveResponse] -> ShowS
CreateArchiveResponse -> String
(Int -> CreateArchiveResponse -> ShowS)
-> (CreateArchiveResponse -> String)
-> ([CreateArchiveResponse] -> ShowS)
-> Show CreateArchiveResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateArchiveResponse] -> ShowS
$cshowList :: [CreateArchiveResponse] -> ShowS
show :: CreateArchiveResponse -> String
$cshow :: CreateArchiveResponse -> String
showsPrec :: Int -> CreateArchiveResponse -> ShowS
$cshowsPrec :: Int -> CreateArchiveResponse -> ShowS
Prelude.Show, (forall x. CreateArchiveResponse -> Rep CreateArchiveResponse x)
-> (forall x. Rep CreateArchiveResponse x -> CreateArchiveResponse)
-> Generic CreateArchiveResponse
forall x. Rep CreateArchiveResponse x -> CreateArchiveResponse
forall x. CreateArchiveResponse -> Rep CreateArchiveResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateArchiveResponse x -> CreateArchiveResponse
$cfrom :: forall x. CreateArchiveResponse -> Rep CreateArchiveResponse x
Prelude.Generic)

-- |
-- Create a value of 'CreateArchiveResponse' 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:
--
-- 'creationTime', 'createArchiveResponse_creationTime' - The time at which the archive was created.
--
-- 'state', 'createArchiveResponse_state' - The state of the archive that was created.
--
-- 'archiveArn', 'createArchiveResponse_archiveArn' - The ARN of the archive that was created.
--
-- 'stateReason', 'createArchiveResponse_stateReason' - The reason that the archive is in the state.
--
-- 'httpStatus', 'createArchiveResponse_httpStatus' - The response's http status code.
newCreateArchiveResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  CreateArchiveResponse
newCreateArchiveResponse :: Int -> CreateArchiveResponse
newCreateArchiveResponse Int
pHttpStatus_ =
  CreateArchiveResponse' :: Maybe POSIX
-> Maybe ArchiveState
-> Maybe Text
-> Maybe Text
-> Int
-> CreateArchiveResponse
CreateArchiveResponse'
    { $sel:creationTime:CreateArchiveResponse' :: Maybe POSIX
creationTime =
        Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:state:CreateArchiveResponse' :: Maybe ArchiveState
state = Maybe ArchiveState
forall a. Maybe a
Prelude.Nothing,
      $sel:archiveArn:CreateArchiveResponse' :: Maybe Text
archiveArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:stateReason:CreateArchiveResponse' :: Maybe Text
stateReason = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:CreateArchiveResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The time at which the archive was created.
createArchiveResponse_creationTime :: Lens.Lens' CreateArchiveResponse (Prelude.Maybe Prelude.UTCTime)
createArchiveResponse_creationTime :: (Maybe UTCTime -> f (Maybe UTCTime))
-> CreateArchiveResponse -> f CreateArchiveResponse
createArchiveResponse_creationTime = (CreateArchiveResponse -> Maybe POSIX)
-> (CreateArchiveResponse -> Maybe POSIX -> CreateArchiveResponse)
-> Lens
     CreateArchiveResponse
     CreateArchiveResponse
     (Maybe POSIX)
     (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateArchiveResponse' {Maybe POSIX
creationTime :: Maybe POSIX
$sel:creationTime:CreateArchiveResponse' :: CreateArchiveResponse -> Maybe POSIX
creationTime} -> Maybe POSIX
creationTime) (\s :: CreateArchiveResponse
s@CreateArchiveResponse' {} Maybe POSIX
a -> CreateArchiveResponse
s {$sel:creationTime:CreateArchiveResponse' :: Maybe POSIX
creationTime = Maybe POSIX
a} :: CreateArchiveResponse) ((Maybe POSIX -> f (Maybe POSIX))
 -> CreateArchiveResponse -> f CreateArchiveResponse)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> CreateArchiveResponse
-> f CreateArchiveResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
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 POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | The state of the archive that was created.
createArchiveResponse_state :: Lens.Lens' CreateArchiveResponse (Prelude.Maybe ArchiveState)
createArchiveResponse_state :: (Maybe ArchiveState -> f (Maybe ArchiveState))
-> CreateArchiveResponse -> f CreateArchiveResponse
createArchiveResponse_state = (CreateArchiveResponse -> Maybe ArchiveState)
-> (CreateArchiveResponse
    -> Maybe ArchiveState -> CreateArchiveResponse)
-> Lens
     CreateArchiveResponse
     CreateArchiveResponse
     (Maybe ArchiveState)
     (Maybe ArchiveState)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateArchiveResponse' {Maybe ArchiveState
state :: Maybe ArchiveState
$sel:state:CreateArchiveResponse' :: CreateArchiveResponse -> Maybe ArchiveState
state} -> Maybe ArchiveState
state) (\s :: CreateArchiveResponse
s@CreateArchiveResponse' {} Maybe ArchiveState
a -> CreateArchiveResponse
s {$sel:state:CreateArchiveResponse' :: Maybe ArchiveState
state = Maybe ArchiveState
a} :: CreateArchiveResponse)

-- | The ARN of the archive that was created.
createArchiveResponse_archiveArn :: Lens.Lens' CreateArchiveResponse (Prelude.Maybe Prelude.Text)
createArchiveResponse_archiveArn :: (Maybe Text -> f (Maybe Text))
-> CreateArchiveResponse -> f CreateArchiveResponse
createArchiveResponse_archiveArn = (CreateArchiveResponse -> Maybe Text)
-> (CreateArchiveResponse -> Maybe Text -> CreateArchiveResponse)
-> Lens
     CreateArchiveResponse
     CreateArchiveResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateArchiveResponse' {Maybe Text
archiveArn :: Maybe Text
$sel:archiveArn:CreateArchiveResponse' :: CreateArchiveResponse -> Maybe Text
archiveArn} -> Maybe Text
archiveArn) (\s :: CreateArchiveResponse
s@CreateArchiveResponse' {} Maybe Text
a -> CreateArchiveResponse
s {$sel:archiveArn:CreateArchiveResponse' :: Maybe Text
archiveArn = Maybe Text
a} :: CreateArchiveResponse)

-- | The reason that the archive is in the state.
createArchiveResponse_stateReason :: Lens.Lens' CreateArchiveResponse (Prelude.Maybe Prelude.Text)
createArchiveResponse_stateReason :: (Maybe Text -> f (Maybe Text))
-> CreateArchiveResponse -> f CreateArchiveResponse
createArchiveResponse_stateReason = (CreateArchiveResponse -> Maybe Text)
-> (CreateArchiveResponse -> Maybe Text -> CreateArchiveResponse)
-> Lens
     CreateArchiveResponse
     CreateArchiveResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateArchiveResponse' {Maybe Text
stateReason :: Maybe Text
$sel:stateReason:CreateArchiveResponse' :: CreateArchiveResponse -> Maybe Text
stateReason} -> Maybe Text
stateReason) (\s :: CreateArchiveResponse
s@CreateArchiveResponse' {} Maybe Text
a -> CreateArchiveResponse
s {$sel:stateReason:CreateArchiveResponse' :: Maybe Text
stateReason = Maybe Text
a} :: CreateArchiveResponse)

-- | The response's http status code.
createArchiveResponse_httpStatus :: Lens.Lens' CreateArchiveResponse Prelude.Int
createArchiveResponse_httpStatus :: (Int -> f Int) -> CreateArchiveResponse -> f CreateArchiveResponse
createArchiveResponse_httpStatus = (CreateArchiveResponse -> Int)
-> (CreateArchiveResponse -> Int -> CreateArchiveResponse)
-> Lens CreateArchiveResponse CreateArchiveResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateArchiveResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateArchiveResponse' :: CreateArchiveResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateArchiveResponse
s@CreateArchiveResponse' {} Int
a -> CreateArchiveResponse
s {$sel:httpStatus:CreateArchiveResponse' :: Int
httpStatus = Int
a} :: CreateArchiveResponse)

instance Prelude.NFData CreateArchiveResponse