{-# 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-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 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.Lens as Lens
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
(CreateDiskSnapshot -> CreateDiskSnapshot -> Bool)
-> (CreateDiskSnapshot -> CreateDiskSnapshot -> Bool)
-> Eq CreateDiskSnapshot
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]
(Int -> ReadS CreateDiskSnapshot)
-> ReadS [CreateDiskSnapshot]
-> ReadPrec CreateDiskSnapshot
-> ReadPrec [CreateDiskSnapshot]
-> Read 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
(Int -> CreateDiskSnapshot -> ShowS)
-> (CreateDiskSnapshot -> String)
-> ([CreateDiskSnapshot] -> ShowS)
-> Show CreateDiskSnapshot
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. CreateDiskSnapshot -> Rep CreateDiskSnapshot x)
-> (forall x. Rep CreateDiskSnapshot x -> CreateDiskSnapshot)
-> Generic CreateDiskSnapshot
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' :: Maybe Text
-> Maybe Text -> Maybe [Tag] -> Text -> CreateDiskSnapshot
CreateDiskSnapshot'
    { $sel:diskName:CreateDiskSnapshot' :: Maybe Text
diskName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:instanceName:CreateDiskSnapshot' :: Maybe Text
instanceName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:tags:CreateDiskSnapshot' :: Maybe [Tag]
tags = Maybe [Tag]
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 :: (Maybe Text -> f (Maybe Text))
-> CreateDiskSnapshot -> f CreateDiskSnapshot
createDiskSnapshot_diskName = (CreateDiskSnapshot -> Maybe Text)
-> (CreateDiskSnapshot -> Maybe Text -> CreateDiskSnapshot)
-> Lens
     CreateDiskSnapshot CreateDiskSnapshot (Maybe Text) (Maybe Text)
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 :: (Maybe Text -> f (Maybe Text))
-> CreateDiskSnapshot -> f CreateDiskSnapshot
createDiskSnapshot_instanceName = (CreateDiskSnapshot -> Maybe Text)
-> (CreateDiskSnapshot -> Maybe Text -> CreateDiskSnapshot)
-> Lens
     CreateDiskSnapshot CreateDiskSnapshot (Maybe Text) (Maybe Text)
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 :: (Maybe [Tag] -> f (Maybe [Tag]))
-> CreateDiskSnapshot -> f CreateDiskSnapshot
createDiskSnapshot_tags = (CreateDiskSnapshot -> Maybe [Tag])
-> (CreateDiskSnapshot -> Maybe [Tag] -> CreateDiskSnapshot)
-> Lens
     CreateDiskSnapshot CreateDiskSnapshot (Maybe [Tag]) (Maybe [Tag])
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) ((Maybe [Tag] -> f (Maybe [Tag]))
 -> CreateDiskSnapshot -> f CreateDiskSnapshot)
-> ((Maybe [Tag] -> f (Maybe [Tag]))
    -> Maybe [Tag] -> f (Maybe [Tag]))
-> (Maybe [Tag] -> f (Maybe [Tag]))
-> CreateDiskSnapshot
-> f CreateDiskSnapshot
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Tag] [Tag] [Tag] [Tag]
-> Iso (Maybe [Tag]) (Maybe [Tag]) (Maybe [Tag]) (Maybe [Tag])
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 [Tag] [Tag] [Tag] [Tag]
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 :: (Text -> f Text) -> CreateDiskSnapshot -> f CreateDiskSnapshot
createDiskSnapshot_diskSnapshotName = (CreateDiskSnapshot -> Text)
-> (CreateDiskSnapshot -> Text -> CreateDiskSnapshot)
-> Lens CreateDiskSnapshot CreateDiskSnapshot Text Text
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 :: CreateDiskSnapshot -> Request CreateDiskSnapshot
request = Service -> CreateDiskSnapshot -> Request CreateDiskSnapshot
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy CreateDiskSnapshot
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse CreateDiskSnapshot)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse CreateDiskSnapshot))
-> Logger
-> Service
-> Proxy CreateDiskSnapshot
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse CreateDiskSnapshot)))
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 [Operation] -> Int -> CreateDiskSnapshotResponse
CreateDiskSnapshotResponse'
            (Maybe [Operation] -> Int -> CreateDiskSnapshotResponse)
-> Either String (Maybe [Operation])
-> Either String (Int -> CreateDiskSnapshotResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe (Maybe [Operation]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"operations" Either String (Maybe (Maybe [Operation]))
-> Maybe [Operation] -> Either String (Maybe [Operation])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [Operation]
forall a. Monoid a => a
Prelude.mempty)
            Either String (Int -> CreateDiskSnapshotResponse)
-> Either String Int -> Either String CreateDiskSnapshotResponse
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 CreateDiskSnapshot

instance Prelude.NFData CreateDiskSnapshot

instance Core.ToHeaders CreateDiskSnapshot where
  toHeaders :: CreateDiskSnapshot -> ResponseHeaders
toHeaders =
    ResponseHeaders -> CreateDiskSnapshot -> 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
"Lightsail_20161128.CreateDiskSnapshot" ::
                          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 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
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"diskName" 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
diskName,
            (Text
"instanceName" 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
instanceName,
            (Text
"tags" Text -> [Tag] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([Tag] -> Pair) -> Maybe [Tag] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Tag]
tags,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"diskSnapshotName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
diskSnapshotName)
          ]
      )

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

instance Core.ToQuery CreateDiskSnapshot where
  toQuery :: CreateDiskSnapshot -> QueryString
toQuery = QueryString -> CreateDiskSnapshot -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
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
(CreateDiskSnapshotResponse -> CreateDiskSnapshotResponse -> Bool)
-> (CreateDiskSnapshotResponse
    -> CreateDiskSnapshotResponse -> Bool)
-> Eq CreateDiskSnapshotResponse
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]
(Int -> ReadS CreateDiskSnapshotResponse)
-> ReadS [CreateDiskSnapshotResponse]
-> ReadPrec CreateDiskSnapshotResponse
-> ReadPrec [CreateDiskSnapshotResponse]
-> Read 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
(Int -> CreateDiskSnapshotResponse -> ShowS)
-> (CreateDiskSnapshotResponse -> String)
-> ([CreateDiskSnapshotResponse] -> ShowS)
-> Show CreateDiskSnapshotResponse
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.
 CreateDiskSnapshotResponse -> Rep CreateDiskSnapshotResponse x)
-> (forall x.
    Rep CreateDiskSnapshotResponse x -> CreateDiskSnapshotResponse)
-> Generic CreateDiskSnapshotResponse
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' :: Maybe [Operation] -> Int -> CreateDiskSnapshotResponse
CreateDiskSnapshotResponse'
    { $sel:operations:CreateDiskSnapshotResponse' :: Maybe [Operation]
operations =
        Maybe [Operation]
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 :: (Maybe [Operation] -> f (Maybe [Operation]))
-> CreateDiskSnapshotResponse -> f CreateDiskSnapshotResponse
createDiskSnapshotResponse_operations = (CreateDiskSnapshotResponse -> Maybe [Operation])
-> (CreateDiskSnapshotResponse
    -> Maybe [Operation] -> CreateDiskSnapshotResponse)
-> Lens
     CreateDiskSnapshotResponse
     CreateDiskSnapshotResponse
     (Maybe [Operation])
     (Maybe [Operation])
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) ((Maybe [Operation] -> f (Maybe [Operation]))
 -> CreateDiskSnapshotResponse -> f CreateDiskSnapshotResponse)
-> ((Maybe [Operation] -> f (Maybe [Operation]))
    -> Maybe [Operation] -> f (Maybe [Operation]))
-> (Maybe [Operation] -> f (Maybe [Operation]))
-> CreateDiskSnapshotResponse
-> f CreateDiskSnapshotResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Operation] [Operation] [Operation] [Operation]
-> Iso
     (Maybe [Operation])
     (Maybe [Operation])
     (Maybe [Operation])
     (Maybe [Operation])
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 [Operation] [Operation] [Operation] [Operation]
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 :: (Int -> f Int)
-> CreateDiskSnapshotResponse -> f CreateDiskSnapshotResponse
createDiskSnapshotResponse_httpStatus = (CreateDiskSnapshotResponse -> Int)
-> (CreateDiskSnapshotResponse
    -> Int -> CreateDiskSnapshotResponse)
-> Lens
     CreateDiskSnapshotResponse CreateDiskSnapshotResponse Int Int
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