{-# 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.CreateDisk
-- 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 block storage disk that can be attached to an Amazon Lightsail
-- instance in the same Availability Zone (e.g., @us-east-2a@).
--
-- The @create disk@ 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.CreateDisk
  ( -- * Creating a Request
    CreateDisk (..),
    newCreateDisk,

    -- * Request Lenses
    createDisk_addOns,
    createDisk_tags,
    createDisk_diskName,
    createDisk_availabilityZone,
    createDisk_sizeInGb,

    -- * Destructuring the Response
    CreateDiskResponse (..),
    newCreateDiskResponse,

    -- * Response Lenses
    createDiskResponse_operations,
    createDiskResponse_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:/ 'newCreateDisk' smart constructor.
data CreateDisk = CreateDisk'
  { -- | An array of objects that represent the add-ons to enable for the new
    -- disk.
    CreateDisk -> Maybe [AddOnRequest]
addOns :: Prelude.Maybe [AddOnRequest],
    -- | 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.
    CreateDisk -> Maybe [Tag]
tags :: Prelude.Maybe [Tag],
    -- | The unique Lightsail disk name (e.g., @my-disk@).
    CreateDisk -> Text
diskName :: Prelude.Text,
    -- | The Availability Zone where you want to create the disk (e.g.,
    -- @us-east-2a@). Use the same Availability Zone as the Lightsail instance
    -- to which you want to attach the disk.
    --
    -- Use the @get regions@ operation to list the Availability Zones where
    -- Lightsail is currently available.
    CreateDisk -> Text
availabilityZone :: Prelude.Text,
    -- | The size of the disk in GB (e.g., @32@).
    CreateDisk -> Int
sizeInGb :: Prelude.Int
  }
  deriving (CreateDisk -> CreateDisk -> Bool
(CreateDisk -> CreateDisk -> Bool)
-> (CreateDisk -> CreateDisk -> Bool) -> Eq CreateDisk
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateDisk -> CreateDisk -> Bool
$c/= :: CreateDisk -> CreateDisk -> Bool
== :: CreateDisk -> CreateDisk -> Bool
$c== :: CreateDisk -> CreateDisk -> Bool
Prelude.Eq, ReadPrec [CreateDisk]
ReadPrec CreateDisk
Int -> ReadS CreateDisk
ReadS [CreateDisk]
(Int -> ReadS CreateDisk)
-> ReadS [CreateDisk]
-> ReadPrec CreateDisk
-> ReadPrec [CreateDisk]
-> Read CreateDisk
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateDisk]
$creadListPrec :: ReadPrec [CreateDisk]
readPrec :: ReadPrec CreateDisk
$creadPrec :: ReadPrec CreateDisk
readList :: ReadS [CreateDisk]
$creadList :: ReadS [CreateDisk]
readsPrec :: Int -> ReadS CreateDisk
$creadsPrec :: Int -> ReadS CreateDisk
Prelude.Read, Int -> CreateDisk -> ShowS
[CreateDisk] -> ShowS
CreateDisk -> String
(Int -> CreateDisk -> ShowS)
-> (CreateDisk -> String)
-> ([CreateDisk] -> ShowS)
-> Show CreateDisk
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateDisk] -> ShowS
$cshowList :: [CreateDisk] -> ShowS
show :: CreateDisk -> String
$cshow :: CreateDisk -> String
showsPrec :: Int -> CreateDisk -> ShowS
$cshowsPrec :: Int -> CreateDisk -> ShowS
Prelude.Show, (forall x. CreateDisk -> Rep CreateDisk x)
-> (forall x. Rep CreateDisk x -> CreateDisk) -> Generic CreateDisk
forall x. Rep CreateDisk x -> CreateDisk
forall x. CreateDisk -> Rep CreateDisk x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateDisk x -> CreateDisk
$cfrom :: forall x. CreateDisk -> Rep CreateDisk x
Prelude.Generic)

-- |
-- Create a value of 'CreateDisk' 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:
--
-- 'addOns', 'createDisk_addOns' - An array of objects that represent the add-ons to enable for the new
-- disk.
--
-- 'tags', 'createDisk_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.
--
-- 'diskName', 'createDisk_diskName' - The unique Lightsail disk name (e.g., @my-disk@).
--
-- 'availabilityZone', 'createDisk_availabilityZone' - The Availability Zone where you want to create the disk (e.g.,
-- @us-east-2a@). Use the same Availability Zone as the Lightsail instance
-- to which you want to attach the disk.
--
-- Use the @get regions@ operation to list the Availability Zones where
-- Lightsail is currently available.
--
-- 'sizeInGb', 'createDisk_sizeInGb' - The size of the disk in GB (e.g., @32@).
newCreateDisk ::
  -- | 'diskName'
  Prelude.Text ->
  -- | 'availabilityZone'
  Prelude.Text ->
  -- | 'sizeInGb'
  Prelude.Int ->
  CreateDisk
newCreateDisk :: Text -> Text -> Int -> CreateDisk
newCreateDisk
  Text
pDiskName_
  Text
pAvailabilityZone_
  Int
pSizeInGb_ =
    CreateDisk' :: Maybe [AddOnRequest]
-> Maybe [Tag] -> Text -> Text -> Int -> CreateDisk
CreateDisk'
      { $sel:addOns:CreateDisk' :: Maybe [AddOnRequest]
addOns = Maybe [AddOnRequest]
forall a. Maybe a
Prelude.Nothing,
        $sel:tags:CreateDisk' :: Maybe [Tag]
tags = Maybe [Tag]
forall a. Maybe a
Prelude.Nothing,
        $sel:diskName:CreateDisk' :: Text
diskName = Text
pDiskName_,
        $sel:availabilityZone:CreateDisk' :: Text
availabilityZone = Text
pAvailabilityZone_,
        $sel:sizeInGb:CreateDisk' :: Int
sizeInGb = Int
pSizeInGb_
      }

-- | An array of objects that represent the add-ons to enable for the new
-- disk.
createDisk_addOns :: Lens.Lens' CreateDisk (Prelude.Maybe [AddOnRequest])
createDisk_addOns :: (Maybe [AddOnRequest] -> f (Maybe [AddOnRequest]))
-> CreateDisk -> f CreateDisk
createDisk_addOns = (CreateDisk -> Maybe [AddOnRequest])
-> (CreateDisk -> Maybe [AddOnRequest] -> CreateDisk)
-> Lens
     CreateDisk CreateDisk (Maybe [AddOnRequest]) (Maybe [AddOnRequest])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDisk' {Maybe [AddOnRequest]
addOns :: Maybe [AddOnRequest]
$sel:addOns:CreateDisk' :: CreateDisk -> Maybe [AddOnRequest]
addOns} -> Maybe [AddOnRequest]
addOns) (\s :: CreateDisk
s@CreateDisk' {} Maybe [AddOnRequest]
a -> CreateDisk
s {$sel:addOns:CreateDisk' :: Maybe [AddOnRequest]
addOns = Maybe [AddOnRequest]
a} :: CreateDisk) ((Maybe [AddOnRequest] -> f (Maybe [AddOnRequest]))
 -> CreateDisk -> f CreateDisk)
-> ((Maybe [AddOnRequest] -> f (Maybe [AddOnRequest]))
    -> Maybe [AddOnRequest] -> f (Maybe [AddOnRequest]))
-> (Maybe [AddOnRequest] -> f (Maybe [AddOnRequest]))
-> CreateDisk
-> f CreateDisk
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [AddOnRequest] [AddOnRequest] [AddOnRequest] [AddOnRequest]
-> Iso
     (Maybe [AddOnRequest])
     (Maybe [AddOnRequest])
     (Maybe [AddOnRequest])
     (Maybe [AddOnRequest])
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 [AddOnRequest] [AddOnRequest] [AddOnRequest] [AddOnRequest]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | 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.
createDisk_tags :: Lens.Lens' CreateDisk (Prelude.Maybe [Tag])
createDisk_tags :: (Maybe [Tag] -> f (Maybe [Tag])) -> CreateDisk -> f CreateDisk
createDisk_tags = (CreateDisk -> Maybe [Tag])
-> (CreateDisk -> Maybe [Tag] -> CreateDisk)
-> Lens CreateDisk CreateDisk (Maybe [Tag]) (Maybe [Tag])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDisk' {Maybe [Tag]
tags :: Maybe [Tag]
$sel:tags:CreateDisk' :: CreateDisk -> Maybe [Tag]
tags} -> Maybe [Tag]
tags) (\s :: CreateDisk
s@CreateDisk' {} Maybe [Tag]
a -> CreateDisk
s {$sel:tags:CreateDisk' :: Maybe [Tag]
tags = Maybe [Tag]
a} :: CreateDisk) ((Maybe [Tag] -> f (Maybe [Tag])) -> CreateDisk -> f CreateDisk)
-> ((Maybe [Tag] -> f (Maybe [Tag]))
    -> Maybe [Tag] -> f (Maybe [Tag]))
-> (Maybe [Tag] -> f (Maybe [Tag]))
-> CreateDisk
-> f CreateDisk
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 unique Lightsail disk name (e.g., @my-disk@).
createDisk_diskName :: Lens.Lens' CreateDisk Prelude.Text
createDisk_diskName :: (Text -> f Text) -> CreateDisk -> f CreateDisk
createDisk_diskName = (CreateDisk -> Text)
-> (CreateDisk -> Text -> CreateDisk)
-> Lens CreateDisk CreateDisk Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDisk' {Text
diskName :: Text
$sel:diskName:CreateDisk' :: CreateDisk -> Text
diskName} -> Text
diskName) (\s :: CreateDisk
s@CreateDisk' {} Text
a -> CreateDisk
s {$sel:diskName:CreateDisk' :: Text
diskName = Text
a} :: CreateDisk)

-- | The Availability Zone where you want to create the disk (e.g.,
-- @us-east-2a@). Use the same Availability Zone as the Lightsail instance
-- to which you want to attach the disk.
--
-- Use the @get regions@ operation to list the Availability Zones where
-- Lightsail is currently available.
createDisk_availabilityZone :: Lens.Lens' CreateDisk Prelude.Text
createDisk_availabilityZone :: (Text -> f Text) -> CreateDisk -> f CreateDisk
createDisk_availabilityZone = (CreateDisk -> Text)
-> (CreateDisk -> Text -> CreateDisk)
-> Lens CreateDisk CreateDisk Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDisk' {Text
availabilityZone :: Text
$sel:availabilityZone:CreateDisk' :: CreateDisk -> Text
availabilityZone} -> Text
availabilityZone) (\s :: CreateDisk
s@CreateDisk' {} Text
a -> CreateDisk
s {$sel:availabilityZone:CreateDisk' :: Text
availabilityZone = Text
a} :: CreateDisk)

-- | The size of the disk in GB (e.g., @32@).
createDisk_sizeInGb :: Lens.Lens' CreateDisk Prelude.Int
createDisk_sizeInGb :: (Int -> f Int) -> CreateDisk -> f CreateDisk
createDisk_sizeInGb = (CreateDisk -> Int)
-> (CreateDisk -> Int -> CreateDisk)
-> Lens CreateDisk CreateDisk Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDisk' {Int
sizeInGb :: Int
$sel:sizeInGb:CreateDisk' :: CreateDisk -> Int
sizeInGb} -> Int
sizeInGb) (\s :: CreateDisk
s@CreateDisk' {} Int
a -> CreateDisk
s {$sel:sizeInGb:CreateDisk' :: Int
sizeInGb = Int
a} :: CreateDisk)

instance Core.AWSRequest CreateDisk where
  type AWSResponse CreateDisk = CreateDiskResponse
  request :: CreateDisk -> Request CreateDisk
request = Service -> CreateDisk -> Request CreateDisk
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy CreateDisk
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateDisk)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse CreateDisk))
-> Logger
-> Service
-> Proxy CreateDisk
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateDisk)))
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 -> CreateDiskResponse
CreateDiskResponse'
            (Maybe [Operation] -> Int -> CreateDiskResponse)
-> Either String (Maybe [Operation])
-> Either String (Int -> CreateDiskResponse)
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 -> CreateDiskResponse)
-> Either String Int -> Either String CreateDiskResponse
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 CreateDisk

instance Prelude.NFData CreateDisk

instance Core.ToHeaders CreateDisk where
  toHeaders :: CreateDisk -> ResponseHeaders
toHeaders =
    ResponseHeaders -> CreateDisk -> 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.CreateDisk" ::
                          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 CreateDisk where
  toJSON :: CreateDisk -> Value
toJSON CreateDisk' {Int
Maybe [AddOnRequest]
Maybe [Tag]
Text
sizeInGb :: Int
availabilityZone :: Text
diskName :: Text
tags :: Maybe [Tag]
addOns :: Maybe [AddOnRequest]
$sel:sizeInGb:CreateDisk' :: CreateDisk -> Int
$sel:availabilityZone:CreateDisk' :: CreateDisk -> Text
$sel:diskName:CreateDisk' :: CreateDisk -> Text
$sel:tags:CreateDisk' :: CreateDisk -> Maybe [Tag]
$sel:addOns:CreateDisk' :: CreateDisk -> Maybe [AddOnRequest]
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"addOns" Text -> [AddOnRequest] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([AddOnRequest] -> Pair) -> Maybe [AddOnRequest] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [AddOnRequest]
addOns,
            (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
"diskName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
diskName),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"availabilityZone" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
availabilityZone),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"sizeInGb" Text -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Int
sizeInGb)
          ]
      )

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

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

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

-- |
-- Create a value of 'CreateDiskResponse' 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', 'createDiskResponse_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', 'createDiskResponse_httpStatus' - The response's http status code.
newCreateDiskResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  CreateDiskResponse
newCreateDiskResponse :: Int -> CreateDiskResponse
newCreateDiskResponse Int
pHttpStatus_ =
  CreateDiskResponse' :: Maybe [Operation] -> Int -> CreateDiskResponse
CreateDiskResponse'
    { $sel:operations:CreateDiskResponse' :: Maybe [Operation]
operations = Maybe [Operation]
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:CreateDiskResponse' :: 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.
createDiskResponse_operations :: Lens.Lens' CreateDiskResponse (Prelude.Maybe [Operation])
createDiskResponse_operations :: (Maybe [Operation] -> f (Maybe [Operation]))
-> CreateDiskResponse -> f CreateDiskResponse
createDiskResponse_operations = (CreateDiskResponse -> Maybe [Operation])
-> (CreateDiskResponse -> Maybe [Operation] -> CreateDiskResponse)
-> Lens
     CreateDiskResponse
     CreateDiskResponse
     (Maybe [Operation])
     (Maybe [Operation])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDiskResponse' {Maybe [Operation]
operations :: Maybe [Operation]
$sel:operations:CreateDiskResponse' :: CreateDiskResponse -> Maybe [Operation]
operations} -> Maybe [Operation]
operations) (\s :: CreateDiskResponse
s@CreateDiskResponse' {} Maybe [Operation]
a -> CreateDiskResponse
s {$sel:operations:CreateDiskResponse' :: Maybe [Operation]
operations = Maybe [Operation]
a} :: CreateDiskResponse) ((Maybe [Operation] -> f (Maybe [Operation]))
 -> CreateDiskResponse -> f CreateDiskResponse)
-> ((Maybe [Operation] -> f (Maybe [Operation]))
    -> Maybe [Operation] -> f (Maybe [Operation]))
-> (Maybe [Operation] -> f (Maybe [Operation]))
-> CreateDiskResponse
-> f CreateDiskResponse
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.
createDiskResponse_httpStatus :: Lens.Lens' CreateDiskResponse Prelude.Int
createDiskResponse_httpStatus :: (Int -> f Int) -> CreateDiskResponse -> f CreateDiskResponse
createDiskResponse_httpStatus = (CreateDiskResponse -> Int)
-> (CreateDiskResponse -> Int -> CreateDiskResponse)
-> Lens CreateDiskResponse CreateDiskResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDiskResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateDiskResponse' :: CreateDiskResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateDiskResponse
s@CreateDiskResponse' {} Int
a -> CreateDiskResponse
s {$sel:httpStatus:CreateDiskResponse' :: Int
httpStatus = Int
a} :: CreateDiskResponse)

instance Prelude.NFData CreateDiskResponse