{-# 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.EC2.CreateSnapshots
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Creates crash-consistent snapshots of multiple EBS volumes and stores
-- the data in S3. Volumes are chosen by specifying an instance. Any
-- attached volumes will produce one snapshot each that is crash-consistent
-- across the instance.
--
-- You can include all of the volumes currently attached to the instance,
-- or you can exclude the root volume or specific data (non-root) volumes
-- from the multi-volume snapshot set.
--
-- You can create multi-volume snapshots of instances in a Region and
-- instances on an Outpost. If you create snapshots from an instance in a
-- Region, the snapshots must be stored in the same Region as the instance.
-- If you create snapshots from an instance on an Outpost, the snapshots
-- can be stored on the same Outpost as the instance, or in the Region for
-- that Outpost.
module Amazonka.EC2.CreateSnapshots
  ( -- * Creating a Request
    CreateSnapshots (..),
    newCreateSnapshots,

    -- * Request Lenses
    createSnapshots_copyTagsFromSource,
    createSnapshots_description,
    createSnapshots_dryRun,
    createSnapshots_outpostArn,
    createSnapshots_tagSpecifications,
    createSnapshots_instanceSpecification,

    -- * Destructuring the Response
    CreateSnapshotsResponse (..),
    newCreateSnapshotsResponse,

    -- * Response Lenses
    createSnapshotsResponse_snapshots,
    createSnapshotsResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.EC2.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newCreateSnapshots' smart constructor.
data CreateSnapshots = CreateSnapshots'
  { -- | Copies the tags from the specified volume to corresponding snapshot.
    CreateSnapshots -> Maybe CopyTagsFromSource
copyTagsFromSource :: Prelude.Maybe CopyTagsFromSource,
    -- | A description propagated to every snapshot specified by the instance.
    CreateSnapshots -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | Checks whether you have the required permissions for the action, without
    -- actually making the request, and provides an error response. If you have
    -- the required permissions, the error response is @DryRunOperation@.
    -- Otherwise, it is @UnauthorizedOperation@.
    CreateSnapshots -> Maybe Bool
dryRun :: Prelude.Maybe Prelude.Bool,
    -- | The Amazon Resource Name (ARN) of the Outpost on which to create the
    -- local snapshots.
    --
    -- -   To create snapshots from an instance in a Region, omit this
    --     parameter. The snapshots are created in the same Region as the
    --     instance.
    --
    -- -   To create snapshots from an instance on an Outpost and store the
    --     snapshots in the Region, omit this parameter. The snapshots are
    --     created in the Region for the Outpost.
    --
    -- -   To create snapshots from an instance on an Outpost and store the
    --     snapshots on an Outpost, specify the ARN of the destination Outpost.
    --     The snapshots must be created on the same Outpost as the instance.
    --
    -- For more information, see
    -- <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/snapshots-outposts.html#create-multivol-snapshot Create multi-volume local snapshots from instances on an Outpost>
    -- in the /Amazon Elastic Compute Cloud User Guide/.
    CreateSnapshots -> Maybe Text
outpostArn :: Prelude.Maybe Prelude.Text,
    -- | Tags to apply to every snapshot specified by the instance.
    CreateSnapshots -> Maybe [TagSpecification]
tagSpecifications :: Prelude.Maybe [TagSpecification],
    -- | The instance to specify which volumes should be included in the
    -- snapshots.
    CreateSnapshots -> InstanceSpecification
instanceSpecification :: InstanceSpecification
  }
  deriving (CreateSnapshots -> CreateSnapshots -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateSnapshots -> CreateSnapshots -> Bool
$c/= :: CreateSnapshots -> CreateSnapshots -> Bool
== :: CreateSnapshots -> CreateSnapshots -> Bool
$c== :: CreateSnapshots -> CreateSnapshots -> Bool
Prelude.Eq, ReadPrec [CreateSnapshots]
ReadPrec CreateSnapshots
Int -> ReadS CreateSnapshots
ReadS [CreateSnapshots]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateSnapshots]
$creadListPrec :: ReadPrec [CreateSnapshots]
readPrec :: ReadPrec CreateSnapshots
$creadPrec :: ReadPrec CreateSnapshots
readList :: ReadS [CreateSnapshots]
$creadList :: ReadS [CreateSnapshots]
readsPrec :: Int -> ReadS CreateSnapshots
$creadsPrec :: Int -> ReadS CreateSnapshots
Prelude.Read, Int -> CreateSnapshots -> ShowS
[CreateSnapshots] -> ShowS
CreateSnapshots -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateSnapshots] -> ShowS
$cshowList :: [CreateSnapshots] -> ShowS
show :: CreateSnapshots -> String
$cshow :: CreateSnapshots -> String
showsPrec :: Int -> CreateSnapshots -> ShowS
$cshowsPrec :: Int -> CreateSnapshots -> ShowS
Prelude.Show, forall x. Rep CreateSnapshots x -> CreateSnapshots
forall x. CreateSnapshots -> Rep CreateSnapshots x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateSnapshots x -> CreateSnapshots
$cfrom :: forall x. CreateSnapshots -> Rep CreateSnapshots x
Prelude.Generic)

-- |
-- Create a value of 'CreateSnapshots' 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:
--
-- 'copyTagsFromSource', 'createSnapshots_copyTagsFromSource' - Copies the tags from the specified volume to corresponding snapshot.
--
-- 'description', 'createSnapshots_description' - A description propagated to every snapshot specified by the instance.
--
-- 'dryRun', 'createSnapshots_dryRun' - Checks whether you have the required permissions for the action, without
-- actually making the request, and provides an error response. If you have
-- the required permissions, the error response is @DryRunOperation@.
-- Otherwise, it is @UnauthorizedOperation@.
--
-- 'outpostArn', 'createSnapshots_outpostArn' - The Amazon Resource Name (ARN) of the Outpost on which to create the
-- local snapshots.
--
-- -   To create snapshots from an instance in a Region, omit this
--     parameter. The snapshots are created in the same Region as the
--     instance.
--
-- -   To create snapshots from an instance on an Outpost and store the
--     snapshots in the Region, omit this parameter. The snapshots are
--     created in the Region for the Outpost.
--
-- -   To create snapshots from an instance on an Outpost and store the
--     snapshots on an Outpost, specify the ARN of the destination Outpost.
--     The snapshots must be created on the same Outpost as the instance.
--
-- For more information, see
-- <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/snapshots-outposts.html#create-multivol-snapshot Create multi-volume local snapshots from instances on an Outpost>
-- in the /Amazon Elastic Compute Cloud User Guide/.
--
-- 'tagSpecifications', 'createSnapshots_tagSpecifications' - Tags to apply to every snapshot specified by the instance.
--
-- 'instanceSpecification', 'createSnapshots_instanceSpecification' - The instance to specify which volumes should be included in the
-- snapshots.
newCreateSnapshots ::
  -- | 'instanceSpecification'
  InstanceSpecification ->
  CreateSnapshots
newCreateSnapshots :: InstanceSpecification -> CreateSnapshots
newCreateSnapshots InstanceSpecification
pInstanceSpecification_ =
  CreateSnapshots'
    { $sel:copyTagsFromSource:CreateSnapshots' :: Maybe CopyTagsFromSource
copyTagsFromSource =
        forall a. Maybe a
Prelude.Nothing,
      $sel:description:CreateSnapshots' :: Maybe Text
description = forall a. Maybe a
Prelude.Nothing,
      $sel:dryRun:CreateSnapshots' :: Maybe Bool
dryRun = forall a. Maybe a
Prelude.Nothing,
      $sel:outpostArn:CreateSnapshots' :: Maybe Text
outpostArn = forall a. Maybe a
Prelude.Nothing,
      $sel:tagSpecifications:CreateSnapshots' :: Maybe [TagSpecification]
tagSpecifications = forall a. Maybe a
Prelude.Nothing,
      $sel:instanceSpecification:CreateSnapshots' :: InstanceSpecification
instanceSpecification = InstanceSpecification
pInstanceSpecification_
    }

-- | Copies the tags from the specified volume to corresponding snapshot.
createSnapshots_copyTagsFromSource :: Lens.Lens' CreateSnapshots (Prelude.Maybe CopyTagsFromSource)
createSnapshots_copyTagsFromSource :: Lens' CreateSnapshots (Maybe CopyTagsFromSource)
createSnapshots_copyTagsFromSource = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateSnapshots' {Maybe CopyTagsFromSource
copyTagsFromSource :: Maybe CopyTagsFromSource
$sel:copyTagsFromSource:CreateSnapshots' :: CreateSnapshots -> Maybe CopyTagsFromSource
copyTagsFromSource} -> Maybe CopyTagsFromSource
copyTagsFromSource) (\s :: CreateSnapshots
s@CreateSnapshots' {} Maybe CopyTagsFromSource
a -> CreateSnapshots
s {$sel:copyTagsFromSource:CreateSnapshots' :: Maybe CopyTagsFromSource
copyTagsFromSource = Maybe CopyTagsFromSource
a} :: CreateSnapshots)

-- | A description propagated to every snapshot specified by the instance.
createSnapshots_description :: Lens.Lens' CreateSnapshots (Prelude.Maybe Prelude.Text)
createSnapshots_description :: Lens' CreateSnapshots (Maybe Text)
createSnapshots_description = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateSnapshots' {Maybe Text
description :: Maybe Text
$sel:description:CreateSnapshots' :: CreateSnapshots -> Maybe Text
description} -> Maybe Text
description) (\s :: CreateSnapshots
s@CreateSnapshots' {} Maybe Text
a -> CreateSnapshots
s {$sel:description:CreateSnapshots' :: Maybe Text
description = Maybe Text
a} :: CreateSnapshots)

-- | Checks whether you have the required permissions for the action, without
-- actually making the request, and provides an error response. If you have
-- the required permissions, the error response is @DryRunOperation@.
-- Otherwise, it is @UnauthorizedOperation@.
createSnapshots_dryRun :: Lens.Lens' CreateSnapshots (Prelude.Maybe Prelude.Bool)
createSnapshots_dryRun :: Lens' CreateSnapshots (Maybe Bool)
createSnapshots_dryRun = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateSnapshots' {Maybe Bool
dryRun :: Maybe Bool
$sel:dryRun:CreateSnapshots' :: CreateSnapshots -> Maybe Bool
dryRun} -> Maybe Bool
dryRun) (\s :: CreateSnapshots
s@CreateSnapshots' {} Maybe Bool
a -> CreateSnapshots
s {$sel:dryRun:CreateSnapshots' :: Maybe Bool
dryRun = Maybe Bool
a} :: CreateSnapshots)

-- | The Amazon Resource Name (ARN) of the Outpost on which to create the
-- local snapshots.
--
-- -   To create snapshots from an instance in a Region, omit this
--     parameter. The snapshots are created in the same Region as the
--     instance.
--
-- -   To create snapshots from an instance on an Outpost and store the
--     snapshots in the Region, omit this parameter. The snapshots are
--     created in the Region for the Outpost.
--
-- -   To create snapshots from an instance on an Outpost and store the
--     snapshots on an Outpost, specify the ARN of the destination Outpost.
--     The snapshots must be created on the same Outpost as the instance.
--
-- For more information, see
-- <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/snapshots-outposts.html#create-multivol-snapshot Create multi-volume local snapshots from instances on an Outpost>
-- in the /Amazon Elastic Compute Cloud User Guide/.
createSnapshots_outpostArn :: Lens.Lens' CreateSnapshots (Prelude.Maybe Prelude.Text)
createSnapshots_outpostArn :: Lens' CreateSnapshots (Maybe Text)
createSnapshots_outpostArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateSnapshots' {Maybe Text
outpostArn :: Maybe Text
$sel:outpostArn:CreateSnapshots' :: CreateSnapshots -> Maybe Text
outpostArn} -> Maybe Text
outpostArn) (\s :: CreateSnapshots
s@CreateSnapshots' {} Maybe Text
a -> CreateSnapshots
s {$sel:outpostArn:CreateSnapshots' :: Maybe Text
outpostArn = Maybe Text
a} :: CreateSnapshots)

-- | Tags to apply to every snapshot specified by the instance.
createSnapshots_tagSpecifications :: Lens.Lens' CreateSnapshots (Prelude.Maybe [TagSpecification])
createSnapshots_tagSpecifications :: Lens' CreateSnapshots (Maybe [TagSpecification])
createSnapshots_tagSpecifications = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateSnapshots' {Maybe [TagSpecification]
tagSpecifications :: Maybe [TagSpecification]
$sel:tagSpecifications:CreateSnapshots' :: CreateSnapshots -> Maybe [TagSpecification]
tagSpecifications} -> Maybe [TagSpecification]
tagSpecifications) (\s :: CreateSnapshots
s@CreateSnapshots' {} Maybe [TagSpecification]
a -> CreateSnapshots
s {$sel:tagSpecifications:CreateSnapshots' :: Maybe [TagSpecification]
tagSpecifications = Maybe [TagSpecification]
a} :: CreateSnapshots) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The instance to specify which volumes should be included in the
-- snapshots.
createSnapshots_instanceSpecification :: Lens.Lens' CreateSnapshots InstanceSpecification
createSnapshots_instanceSpecification :: Lens' CreateSnapshots InstanceSpecification
createSnapshots_instanceSpecification = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateSnapshots' {InstanceSpecification
instanceSpecification :: InstanceSpecification
$sel:instanceSpecification:CreateSnapshots' :: CreateSnapshots -> InstanceSpecification
instanceSpecification} -> InstanceSpecification
instanceSpecification) (\s :: CreateSnapshots
s@CreateSnapshots' {} InstanceSpecification
a -> CreateSnapshots
s {$sel:instanceSpecification:CreateSnapshots' :: InstanceSpecification
instanceSpecification = InstanceSpecification
a} :: CreateSnapshots)

instance Core.AWSRequest CreateSnapshots where
  type
    AWSResponse CreateSnapshots =
      CreateSnapshotsResponse
  request :: (Service -> Service) -> CreateSnapshots -> Request CreateSnapshots
request Service -> Service
overrides =
    forall a. ToRequest a => Service -> a -> Request a
Request.postQuery (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy CreateSnapshots
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateSnapshots)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> [Node] -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveXML
      ( \Int
s ResponseHeaders
h [Node]
x ->
          Maybe [SnapshotInfo] -> Int -> CreateSnapshotsResponse
CreateSnapshotsResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( [Node]
x
                            forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"snapshotSet"
                            forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty
                            forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= forall (f :: * -> *) a b.
Applicative f =>
([a] -> f b) -> [a] -> f (Maybe b)
Core.may (forall a. FromXML a => Text -> [Node] -> Either String [a]
Data.parseXMLList Text
"item")
                        )
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable CreateSnapshots where
  hashWithSalt :: Int -> CreateSnapshots -> Int
hashWithSalt Int
_salt CreateSnapshots' {Maybe Bool
Maybe [TagSpecification]
Maybe Text
Maybe CopyTagsFromSource
InstanceSpecification
instanceSpecification :: InstanceSpecification
tagSpecifications :: Maybe [TagSpecification]
outpostArn :: Maybe Text
dryRun :: Maybe Bool
description :: Maybe Text
copyTagsFromSource :: Maybe CopyTagsFromSource
$sel:instanceSpecification:CreateSnapshots' :: CreateSnapshots -> InstanceSpecification
$sel:tagSpecifications:CreateSnapshots' :: CreateSnapshots -> Maybe [TagSpecification]
$sel:outpostArn:CreateSnapshots' :: CreateSnapshots -> Maybe Text
$sel:dryRun:CreateSnapshots' :: CreateSnapshots -> Maybe Bool
$sel:description:CreateSnapshots' :: CreateSnapshots -> Maybe Text
$sel:copyTagsFromSource:CreateSnapshots' :: CreateSnapshots -> Maybe CopyTagsFromSource
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe CopyTagsFromSource
copyTagsFromSource
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
description
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
dryRun
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
outpostArn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [TagSpecification]
tagSpecifications
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` InstanceSpecification
instanceSpecification

instance Prelude.NFData CreateSnapshots where
  rnf :: CreateSnapshots -> ()
rnf CreateSnapshots' {Maybe Bool
Maybe [TagSpecification]
Maybe Text
Maybe CopyTagsFromSource
InstanceSpecification
instanceSpecification :: InstanceSpecification
tagSpecifications :: Maybe [TagSpecification]
outpostArn :: Maybe Text
dryRun :: Maybe Bool
description :: Maybe Text
copyTagsFromSource :: Maybe CopyTagsFromSource
$sel:instanceSpecification:CreateSnapshots' :: CreateSnapshots -> InstanceSpecification
$sel:tagSpecifications:CreateSnapshots' :: CreateSnapshots -> Maybe [TagSpecification]
$sel:outpostArn:CreateSnapshots' :: CreateSnapshots -> Maybe Text
$sel:dryRun:CreateSnapshots' :: CreateSnapshots -> Maybe Bool
$sel:description:CreateSnapshots' :: CreateSnapshots -> Maybe Text
$sel:copyTagsFromSource:CreateSnapshots' :: CreateSnapshots -> Maybe CopyTagsFromSource
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe CopyTagsFromSource
copyTagsFromSource
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
description
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
dryRun
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
outpostArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [TagSpecification]
tagSpecifications
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf InstanceSpecification
instanceSpecification

instance Data.ToHeaders CreateSnapshots where
  toHeaders :: CreateSnapshots -> ResponseHeaders
toHeaders = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty

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

instance Data.ToQuery CreateSnapshots where
  toQuery :: CreateSnapshots -> QueryString
toQuery CreateSnapshots' {Maybe Bool
Maybe [TagSpecification]
Maybe Text
Maybe CopyTagsFromSource
InstanceSpecification
instanceSpecification :: InstanceSpecification
tagSpecifications :: Maybe [TagSpecification]
outpostArn :: Maybe Text
dryRun :: Maybe Bool
description :: Maybe Text
copyTagsFromSource :: Maybe CopyTagsFromSource
$sel:instanceSpecification:CreateSnapshots' :: CreateSnapshots -> InstanceSpecification
$sel:tagSpecifications:CreateSnapshots' :: CreateSnapshots -> Maybe [TagSpecification]
$sel:outpostArn:CreateSnapshots' :: CreateSnapshots -> Maybe Text
$sel:dryRun:CreateSnapshots' :: CreateSnapshots -> Maybe Bool
$sel:description:CreateSnapshots' :: CreateSnapshots -> Maybe Text
$sel:copyTagsFromSource:CreateSnapshots' :: CreateSnapshots -> Maybe CopyTagsFromSource
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"Action"
          forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: (ByteString
"CreateSnapshots" :: Prelude.ByteString),
        ByteString
"Version"
          forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: (ByteString
"2016-11-15" :: Prelude.ByteString),
        ByteString
"CopyTagsFromSource" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe CopyTagsFromSource
copyTagsFromSource,
        ByteString
"Description" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
description,
        ByteString
"DryRun" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Bool
dryRun,
        ByteString
"OutpostArn" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
outpostArn,
        forall a. ToQuery a => a -> QueryString
Data.toQuery
          ( forall a.
(IsList a, ToQuery (Item a)) =>
ByteString -> a -> QueryString
Data.toQueryList ByteString
"TagSpecification"
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [TagSpecification]
tagSpecifications
          ),
        ByteString
"InstanceSpecification"
          forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: InstanceSpecification
instanceSpecification
      ]

-- | /See:/ 'newCreateSnapshotsResponse' smart constructor.
data CreateSnapshotsResponse = CreateSnapshotsResponse'
  { -- | List of snapshots.
    CreateSnapshotsResponse -> Maybe [SnapshotInfo]
snapshots :: Prelude.Maybe [SnapshotInfo],
    -- | The response's http status code.
    CreateSnapshotsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (CreateSnapshotsResponse -> CreateSnapshotsResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateSnapshotsResponse -> CreateSnapshotsResponse -> Bool
$c/= :: CreateSnapshotsResponse -> CreateSnapshotsResponse -> Bool
== :: CreateSnapshotsResponse -> CreateSnapshotsResponse -> Bool
$c== :: CreateSnapshotsResponse -> CreateSnapshotsResponse -> Bool
Prelude.Eq, ReadPrec [CreateSnapshotsResponse]
ReadPrec CreateSnapshotsResponse
Int -> ReadS CreateSnapshotsResponse
ReadS [CreateSnapshotsResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateSnapshotsResponse]
$creadListPrec :: ReadPrec [CreateSnapshotsResponse]
readPrec :: ReadPrec CreateSnapshotsResponse
$creadPrec :: ReadPrec CreateSnapshotsResponse
readList :: ReadS [CreateSnapshotsResponse]
$creadList :: ReadS [CreateSnapshotsResponse]
readsPrec :: Int -> ReadS CreateSnapshotsResponse
$creadsPrec :: Int -> ReadS CreateSnapshotsResponse
Prelude.Read, Int -> CreateSnapshotsResponse -> ShowS
[CreateSnapshotsResponse] -> ShowS
CreateSnapshotsResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateSnapshotsResponse] -> ShowS
$cshowList :: [CreateSnapshotsResponse] -> ShowS
show :: CreateSnapshotsResponse -> String
$cshow :: CreateSnapshotsResponse -> String
showsPrec :: Int -> CreateSnapshotsResponse -> ShowS
$cshowsPrec :: Int -> CreateSnapshotsResponse -> ShowS
Prelude.Show, forall x. Rep CreateSnapshotsResponse x -> CreateSnapshotsResponse
forall x. CreateSnapshotsResponse -> Rep CreateSnapshotsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateSnapshotsResponse x -> CreateSnapshotsResponse
$cfrom :: forall x. CreateSnapshotsResponse -> Rep CreateSnapshotsResponse x
Prelude.Generic)

-- |
-- Create a value of 'CreateSnapshotsResponse' 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:
--
-- 'snapshots', 'createSnapshotsResponse_snapshots' - List of snapshots.
--
-- 'httpStatus', 'createSnapshotsResponse_httpStatus' - The response's http status code.
newCreateSnapshotsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  CreateSnapshotsResponse
newCreateSnapshotsResponse :: Int -> CreateSnapshotsResponse
newCreateSnapshotsResponse Int
pHttpStatus_ =
  CreateSnapshotsResponse'
    { $sel:snapshots:CreateSnapshotsResponse' :: Maybe [SnapshotInfo]
snapshots =
        forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:CreateSnapshotsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | List of snapshots.
createSnapshotsResponse_snapshots :: Lens.Lens' CreateSnapshotsResponse (Prelude.Maybe [SnapshotInfo])
createSnapshotsResponse_snapshots :: Lens' CreateSnapshotsResponse (Maybe [SnapshotInfo])
createSnapshotsResponse_snapshots = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateSnapshotsResponse' {Maybe [SnapshotInfo]
snapshots :: Maybe [SnapshotInfo]
$sel:snapshots:CreateSnapshotsResponse' :: CreateSnapshotsResponse -> Maybe [SnapshotInfo]
snapshots} -> Maybe [SnapshotInfo]
snapshots) (\s :: CreateSnapshotsResponse
s@CreateSnapshotsResponse' {} Maybe [SnapshotInfo]
a -> CreateSnapshotsResponse
s {$sel:snapshots:CreateSnapshotsResponse' :: Maybe [SnapshotInfo]
snapshots = Maybe [SnapshotInfo]
a} :: CreateSnapshotsResponse) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance Prelude.NFData CreateSnapshotsResponse where
  rnf :: CreateSnapshotsResponse -> ()
rnf CreateSnapshotsResponse' {Int
Maybe [SnapshotInfo]
httpStatus :: Int
snapshots :: Maybe [SnapshotInfo]
$sel:httpStatus:CreateSnapshotsResponse' :: CreateSnapshotsResponse -> Int
$sel:snapshots:CreateSnapshotsResponse' :: CreateSnapshotsResponse -> Maybe [SnapshotInfo]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [SnapshotInfo]
snapshots
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus