{-# 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.Lightsail.CreateDiskSnapshot
-- 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 a snapshot of a block storage disk. You can use snapshots for
-- backups, to make copies of disks, and to save data before shutting down
-- a Lightsail instance.
--
-- You can take a snapshot of an attached disk that is in use; however,
-- snapshots only capture data that has been written to your disk at the
-- time the snapshot command is issued. This may exclude any data that has
-- been cached by any applications or the operating system. If you can
-- pause any file systems on the disk long enough to take a snapshot, your
-- snapshot should be complete. Nevertheless, if you cannot pause all file
-- writes to the disk, you should unmount the disk from within the
-- Lightsail instance, issue the create disk snapshot command, and then
-- remount the disk to ensure a consistent and complete snapshot. You may
-- remount and use your disk while the snapshot status is pending.
--
-- You can also use this operation to create a snapshot of an instance\'s
-- system volume. You might want to do this, for example, to recover data
-- from the system volume of a botched instance or to create a backup of
-- the system volume like you would for a block storage disk. To create a
-- snapshot of a system volume, just define the @instance name@ parameter
-- when issuing the snapshot command, and a snapshot of the defined
-- instance\'s system volume will be created. After the snapshot is
-- available, you can create a block storage disk from the snapshot and
-- attach it to a running instance to access the data on the disk.
--
-- The @create disk snapshot@ operation supports tag-based access control
-- via request tags. For more information, see the
-- <https://lightsail.aws.amazon.com/ls/docs/en_us/articles/amazon-lightsail-controlling-access-using-tags Amazon Lightsail Developer Guide>.
module Amazonka.Lightsail.CreateDiskSnapshot
  ( -- * Creating a Request
    CreateDiskSnapshot (..),
    newCreateDiskSnapshot,

    -- * Request Lenses
    createDiskSnapshot_diskName,
    createDiskSnapshot_instanceName,
    createDiskSnapshot_tags,
    createDiskSnapshot_diskSnapshotName,

    -- * Destructuring the Response
    CreateDiskSnapshotResponse (..),
    newCreateDiskSnapshotResponse,

    -- * Response Lenses
    createDiskSnapshotResponse_operations,
    createDiskSnapshotResponse_httpStatus,
  )
where

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

-- | /See:/ 'newCreateDiskSnapshot' smart constructor.
data CreateDiskSnapshot = CreateDiskSnapshot'
  { -- | The unique name of the source disk (e.g., @Disk-Virginia-1@).
    --
    -- This parameter cannot be defined together with the @instance name@
    -- parameter. The @disk name@ and @instance name@ parameters are mutually
    -- exclusive.
    CreateDiskSnapshot -> Maybe Text
diskName :: Prelude.Maybe Prelude.Text,
    -- | The unique name of the source instance (e.g.,
    -- @Amazon_Linux-512MB-Virginia-1@). When this is defined, a snapshot of
    -- the instance\'s system volume is created.
    --
    -- This parameter cannot be defined together with the @disk name@
    -- parameter. The @instance name@ and @disk name@ parameters are mutually
    -- exclusive.
    CreateDiskSnapshot -> Maybe Text
instanceName :: Prelude.Maybe Prelude.Text,
    -- | The tag keys and optional values to add to the resource during create.
    --
    -- Use the @TagResource@ action to tag a resource after it\'s created.
    CreateDiskSnapshot -> Maybe [Tag]
tags :: Prelude.Maybe [Tag],
    -- | The name of the destination disk snapshot (e.g., @my-disk-snapshot@)
    -- based on the source disk.
    CreateDiskSnapshot -> Text
diskSnapshotName :: Prelude.Text
  }
  deriving (CreateDiskSnapshot -> CreateDiskSnapshot -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateDiskSnapshot -> CreateDiskSnapshot -> Bool
$c/= :: CreateDiskSnapshot -> CreateDiskSnapshot -> Bool
== :: CreateDiskSnapshot -> CreateDiskSnapshot -> Bool
$c== :: CreateDiskSnapshot -> CreateDiskSnapshot -> Bool
Prelude.Eq, ReadPrec [CreateDiskSnapshot]
ReadPrec CreateDiskSnapshot
Int -> ReadS CreateDiskSnapshot
ReadS [CreateDiskSnapshot]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateDiskSnapshot]
$creadListPrec :: ReadPrec [CreateDiskSnapshot]
readPrec :: ReadPrec CreateDiskSnapshot
$creadPrec :: ReadPrec CreateDiskSnapshot
readList :: ReadS [CreateDiskSnapshot]
$creadList :: ReadS [CreateDiskSnapshot]
readsPrec :: Int -> ReadS CreateDiskSnapshot
$creadsPrec :: Int -> ReadS CreateDiskSnapshot
Prelude.Read, Int -> CreateDiskSnapshot -> ShowS
[CreateDiskSnapshot] -> ShowS
CreateDiskSnapshot -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateDiskSnapshot] -> ShowS
$cshowList :: [CreateDiskSnapshot] -> ShowS
show :: CreateDiskSnapshot -> String
$cshow :: CreateDiskSnapshot -> String
showsPrec :: Int -> CreateDiskSnapshot -> ShowS
$cshowsPrec :: Int -> CreateDiskSnapshot -> ShowS
Prelude.Show, forall x. Rep CreateDiskSnapshot x -> CreateDiskSnapshot
forall x. CreateDiskSnapshot -> Rep CreateDiskSnapshot x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateDiskSnapshot x -> CreateDiskSnapshot
$cfrom :: forall x. CreateDiskSnapshot -> Rep CreateDiskSnapshot x
Prelude.Generic)

-- |
-- Create a value of 'CreateDiskSnapshot' 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:
--
-- 'diskName', 'createDiskSnapshot_diskName' - The unique name of the source disk (e.g., @Disk-Virginia-1@).
--
-- This parameter cannot be defined together with the @instance name@
-- parameter. The @disk name@ and @instance name@ parameters are mutually
-- exclusive.
--
-- 'instanceName', 'createDiskSnapshot_instanceName' - The unique name of the source instance (e.g.,
-- @Amazon_Linux-512MB-Virginia-1@). When this is defined, a snapshot of
-- the instance\'s system volume is created.
--
-- This parameter cannot be defined together with the @disk name@
-- parameter. The @instance name@ and @disk name@ parameters are mutually
-- exclusive.
--
-- 'tags', 'createDiskSnapshot_tags' - The tag keys and optional values to add to the resource during create.
--
-- Use the @TagResource@ action to tag a resource after it\'s created.
--
-- 'diskSnapshotName', 'createDiskSnapshot_diskSnapshotName' - The name of the destination disk snapshot (e.g., @my-disk-snapshot@)
-- based on the source disk.
newCreateDiskSnapshot ::
  -- | 'diskSnapshotName'
  Prelude.Text ->
  CreateDiskSnapshot
newCreateDiskSnapshot :: Text -> CreateDiskSnapshot
newCreateDiskSnapshot Text
pDiskSnapshotName_ =
  CreateDiskSnapshot'
    { $sel:diskName:CreateDiskSnapshot' :: Maybe Text
diskName = forall a. Maybe a
Prelude.Nothing,
      $sel:instanceName:CreateDiskSnapshot' :: Maybe Text
instanceName = forall a. Maybe a
Prelude.Nothing,
      $sel:tags:CreateDiskSnapshot' :: Maybe [Tag]
tags = forall a. Maybe a
Prelude.Nothing,
      $sel:diskSnapshotName:CreateDiskSnapshot' :: Text
diskSnapshotName = Text
pDiskSnapshotName_
    }

-- | The unique name of the source disk (e.g., @Disk-Virginia-1@).
--
-- This parameter cannot be defined together with the @instance name@
-- parameter. The @disk name@ and @instance name@ parameters are mutually
-- exclusive.
createDiskSnapshot_diskName :: Lens.Lens' CreateDiskSnapshot (Prelude.Maybe Prelude.Text)
createDiskSnapshot_diskName :: Lens' CreateDiskSnapshot (Maybe Text)
createDiskSnapshot_diskName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDiskSnapshot' {Maybe Text
diskName :: Maybe Text
$sel:diskName:CreateDiskSnapshot' :: CreateDiskSnapshot -> Maybe Text
diskName} -> Maybe Text
diskName) (\s :: CreateDiskSnapshot
s@CreateDiskSnapshot' {} Maybe Text
a -> CreateDiskSnapshot
s {$sel:diskName:CreateDiskSnapshot' :: Maybe Text
diskName = Maybe Text
a} :: CreateDiskSnapshot)

-- | The unique name of the source instance (e.g.,
-- @Amazon_Linux-512MB-Virginia-1@). When this is defined, a snapshot of
-- the instance\'s system volume is created.
--
-- This parameter cannot be defined together with the @disk name@
-- parameter. The @instance name@ and @disk name@ parameters are mutually
-- exclusive.
createDiskSnapshot_instanceName :: Lens.Lens' CreateDiskSnapshot (Prelude.Maybe Prelude.Text)
createDiskSnapshot_instanceName :: Lens' CreateDiskSnapshot (Maybe Text)
createDiskSnapshot_instanceName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDiskSnapshot' {Maybe Text
instanceName :: Maybe Text
$sel:instanceName:CreateDiskSnapshot' :: CreateDiskSnapshot -> Maybe Text
instanceName} -> Maybe Text
instanceName) (\s :: CreateDiskSnapshot
s@CreateDiskSnapshot' {} Maybe Text
a -> CreateDiskSnapshot
s {$sel:instanceName:CreateDiskSnapshot' :: Maybe Text
instanceName = Maybe Text
a} :: CreateDiskSnapshot)

-- | The tag keys and optional values to add to the resource during create.
--
-- Use the @TagResource@ action to tag a resource after it\'s created.
createDiskSnapshot_tags :: Lens.Lens' CreateDiskSnapshot (Prelude.Maybe [Tag])
createDiskSnapshot_tags :: Lens' CreateDiskSnapshot (Maybe [Tag])
createDiskSnapshot_tags = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDiskSnapshot' {Maybe [Tag]
tags :: Maybe [Tag]
$sel:tags:CreateDiskSnapshot' :: CreateDiskSnapshot -> Maybe [Tag]
tags} -> Maybe [Tag]
tags) (\s :: CreateDiskSnapshot
s@CreateDiskSnapshot' {} Maybe [Tag]
a -> CreateDiskSnapshot
s {$sel:tags:CreateDiskSnapshot' :: Maybe [Tag]
tags = Maybe [Tag]
a} :: CreateDiskSnapshot) 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 name of the destination disk snapshot (e.g., @my-disk-snapshot@)
-- based on the source disk.
createDiskSnapshot_diskSnapshotName :: Lens.Lens' CreateDiskSnapshot Prelude.Text
createDiskSnapshot_diskSnapshotName :: Lens' CreateDiskSnapshot Text
createDiskSnapshot_diskSnapshotName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDiskSnapshot' {Text
diskSnapshotName :: Text
$sel:diskSnapshotName:CreateDiskSnapshot' :: CreateDiskSnapshot -> Text
diskSnapshotName} -> Text
diskSnapshotName) (\s :: CreateDiskSnapshot
s@CreateDiskSnapshot' {} Text
a -> CreateDiskSnapshot
s {$sel:diskSnapshotName:CreateDiskSnapshot' :: Text
diskSnapshotName = Text
a} :: CreateDiskSnapshot)

instance Core.AWSRequest CreateDiskSnapshot where
  type
    AWSResponse CreateDiskSnapshot =
      CreateDiskSnapshotResponse
  request :: (Service -> Service)
-> CreateDiskSnapshot -> Request CreateDiskSnapshot
request Service -> Service
overrides =
    forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy CreateDiskSnapshot
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse CreateDiskSnapshot)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe [Operation] -> Int -> CreateDiskSnapshotResponse
CreateDiskSnapshotResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"operations" forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty)
            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 CreateDiskSnapshot where
  hashWithSalt :: Int -> CreateDiskSnapshot -> Int
hashWithSalt Int
_salt CreateDiskSnapshot' {Maybe [Tag]
Maybe Text
Text
diskSnapshotName :: Text
tags :: Maybe [Tag]
instanceName :: Maybe Text
diskName :: Maybe Text
$sel:diskSnapshotName:CreateDiskSnapshot' :: CreateDiskSnapshot -> Text
$sel:tags:CreateDiskSnapshot' :: CreateDiskSnapshot -> Maybe [Tag]
$sel:instanceName:CreateDiskSnapshot' :: CreateDiskSnapshot -> Maybe Text
$sel:diskName:CreateDiskSnapshot' :: CreateDiskSnapshot -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
diskName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
instanceName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Tag]
tags
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
diskSnapshotName

instance Prelude.NFData CreateDiskSnapshot where
  rnf :: CreateDiskSnapshot -> ()
rnf CreateDiskSnapshot' {Maybe [Tag]
Maybe Text
Text
diskSnapshotName :: Text
tags :: Maybe [Tag]
instanceName :: Maybe Text
diskName :: Maybe Text
$sel:diskSnapshotName:CreateDiskSnapshot' :: CreateDiskSnapshot -> Text
$sel:tags:CreateDiskSnapshot' :: CreateDiskSnapshot -> Maybe [Tag]
$sel:instanceName:CreateDiskSnapshot' :: CreateDiskSnapshot -> Maybe Text
$sel:diskName:CreateDiskSnapshot' :: CreateDiskSnapshot -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
diskName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
instanceName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Tag]
tags
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
diskSnapshotName

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

instance Data.ToJSON CreateDiskSnapshot where
  toJSON :: CreateDiskSnapshot -> Value
toJSON CreateDiskSnapshot' {Maybe [Tag]
Maybe Text
Text
diskSnapshotName :: Text
tags :: Maybe [Tag]
instanceName :: Maybe Text
diskName :: Maybe Text
$sel:diskSnapshotName:CreateDiskSnapshot' :: CreateDiskSnapshot -> Text
$sel:tags:CreateDiskSnapshot' :: CreateDiskSnapshot -> Maybe [Tag]
$sel:instanceName:CreateDiskSnapshot' :: CreateDiskSnapshot -> Maybe Text
$sel:diskName:CreateDiskSnapshot' :: CreateDiskSnapshot -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"diskName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
diskName,
            (Key
"instanceName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
instanceName,
            (Key
"tags" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Tag]
tags,
            forall a. a -> Maybe a
Prelude.Just
              (Key
"diskSnapshotName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
diskSnapshotName)
          ]
      )

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

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

-- | /See:/ 'newCreateDiskSnapshotResponse' smart constructor.
data CreateDiskSnapshotResponse = CreateDiskSnapshotResponse'
  { -- | An array of objects that describe the result of the action, such as the
    -- status of the request, the timestamp of the request, and the resources
    -- affected by the request.
    CreateDiskSnapshotResponse -> Maybe [Operation]
operations :: Prelude.Maybe [Operation],
    -- | The response's http status code.
    CreateDiskSnapshotResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (CreateDiskSnapshotResponse -> CreateDiskSnapshotResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateDiskSnapshotResponse -> CreateDiskSnapshotResponse -> Bool
$c/= :: CreateDiskSnapshotResponse -> CreateDiskSnapshotResponse -> Bool
== :: CreateDiskSnapshotResponse -> CreateDiskSnapshotResponse -> Bool
$c== :: CreateDiskSnapshotResponse -> CreateDiskSnapshotResponse -> Bool
Prelude.Eq, ReadPrec [CreateDiskSnapshotResponse]
ReadPrec CreateDiskSnapshotResponse
Int -> ReadS CreateDiskSnapshotResponse
ReadS [CreateDiskSnapshotResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateDiskSnapshotResponse]
$creadListPrec :: ReadPrec [CreateDiskSnapshotResponse]
readPrec :: ReadPrec CreateDiskSnapshotResponse
$creadPrec :: ReadPrec CreateDiskSnapshotResponse
readList :: ReadS [CreateDiskSnapshotResponse]
$creadList :: ReadS [CreateDiskSnapshotResponse]
readsPrec :: Int -> ReadS CreateDiskSnapshotResponse
$creadsPrec :: Int -> ReadS CreateDiskSnapshotResponse
Prelude.Read, Int -> CreateDiskSnapshotResponse -> ShowS
[CreateDiskSnapshotResponse] -> ShowS
CreateDiskSnapshotResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateDiskSnapshotResponse] -> ShowS
$cshowList :: [CreateDiskSnapshotResponse] -> ShowS
show :: CreateDiskSnapshotResponse -> String
$cshow :: CreateDiskSnapshotResponse -> String
showsPrec :: Int -> CreateDiskSnapshotResponse -> ShowS
$cshowsPrec :: Int -> CreateDiskSnapshotResponse -> ShowS
Prelude.Show, forall x.
Rep CreateDiskSnapshotResponse x -> CreateDiskSnapshotResponse
forall x.
CreateDiskSnapshotResponse -> Rep CreateDiskSnapshotResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateDiskSnapshotResponse x -> CreateDiskSnapshotResponse
$cfrom :: forall x.
CreateDiskSnapshotResponse -> Rep CreateDiskSnapshotResponse x
Prelude.Generic)

-- |
-- Create a value of 'CreateDiskSnapshotResponse' 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:
--
-- 'operations', 'createDiskSnapshotResponse_operations' - An array of objects that describe the result of the action, such as the
-- status of the request, the timestamp of the request, and the resources
-- affected by the request.
--
-- 'httpStatus', 'createDiskSnapshotResponse_httpStatus' - The response's http status code.
newCreateDiskSnapshotResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  CreateDiskSnapshotResponse
newCreateDiskSnapshotResponse :: Int -> CreateDiskSnapshotResponse
newCreateDiskSnapshotResponse Int
pHttpStatus_ =
  CreateDiskSnapshotResponse'
    { $sel:operations:CreateDiskSnapshotResponse' :: Maybe [Operation]
operations =
        forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:CreateDiskSnapshotResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | An array of objects that describe the result of the action, such as the
-- status of the request, the timestamp of the request, and the resources
-- affected by the request.
createDiskSnapshotResponse_operations :: Lens.Lens' CreateDiskSnapshotResponse (Prelude.Maybe [Operation])
createDiskSnapshotResponse_operations :: Lens' CreateDiskSnapshotResponse (Maybe [Operation])
createDiskSnapshotResponse_operations = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDiskSnapshotResponse' {Maybe [Operation]
operations :: Maybe [Operation]
$sel:operations:CreateDiskSnapshotResponse' :: CreateDiskSnapshotResponse -> Maybe [Operation]
operations} -> Maybe [Operation]
operations) (\s :: CreateDiskSnapshotResponse
s@CreateDiskSnapshotResponse' {} Maybe [Operation]
a -> CreateDiskSnapshotResponse
s {$sel:operations:CreateDiskSnapshotResponse' :: Maybe [Operation]
operations = Maybe [Operation]
a} :: CreateDiskSnapshotResponse) 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.
createDiskSnapshotResponse_httpStatus :: Lens.Lens' CreateDiskSnapshotResponse Prelude.Int
createDiskSnapshotResponse_httpStatus :: Lens' CreateDiskSnapshotResponse Int
createDiskSnapshotResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDiskSnapshotResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateDiskSnapshotResponse' :: CreateDiskSnapshotResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateDiskSnapshotResponse
s@CreateDiskSnapshotResponse' {} Int
a -> CreateDiskSnapshotResponse
s {$sel:httpStatus:CreateDiskSnapshotResponse' :: Int
httpStatus = Int
a} :: CreateDiskSnapshotResponse)

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