{-# 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.AppStream.CreateUpdatedImage
-- 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 new image with the latest Windows operating system updates,
-- driver updates, and AppStream 2.0 agent software.
--
-- For more information, see the \"Update an Image by Using Managed
-- AppStream 2.0 Image Updates\" section in
-- <https://docs.aws.amazon.com/appstream2/latest/developerguide/administer-images.html Administer Your AppStream 2.0 Images>,
-- in the /Amazon AppStream 2.0 Administration Guide/.
module Amazonka.AppStream.CreateUpdatedImage
  ( -- * Creating a Request
    CreateUpdatedImage (..),
    newCreateUpdatedImage,

    -- * Request Lenses
    createUpdatedImage_newImageTags,
    createUpdatedImage_newImageDescription,
    createUpdatedImage_newImageDisplayName,
    createUpdatedImage_dryRun,
    createUpdatedImage_existingImageName,
    createUpdatedImage_newImageName,

    -- * Destructuring the Response
    CreateUpdatedImageResponse (..),
    newCreateUpdatedImageResponse,

    -- * Response Lenses
    createUpdatedImageResponse_image,
    createUpdatedImageResponse_canUpdateImage,
    createUpdatedImageResponse_httpStatus,
  )
where

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

-- | /See:/ 'newCreateUpdatedImage' smart constructor.
data CreateUpdatedImage = CreateUpdatedImage'
  { -- | The tags to associate with the new image. A tag is a key-value pair, and
    -- the value is optional. For example, Environment=Test. If you do not
    -- specify a value, Environment=.
    --
    -- Generally allowed characters are: letters, numbers, and spaces
    -- representable in UTF-8, and the following special characters:
    --
    -- _ . : \/ = + \\ - \@
    --
    -- If you do not specify a value, the value is set to an empty string.
    --
    -- For more information about tags, see
    -- <https://docs.aws.amazon.com/appstream2/latest/developerguide/tagging-basic.html Tagging Your Resources>
    -- in the /Amazon AppStream 2.0 Administration Guide/.
    CreateUpdatedImage -> Maybe (HashMap Text Text)
newImageTags' :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
    -- | The description to display for the new image.
    CreateUpdatedImage -> Maybe Text
newImageDescription' :: Prelude.Maybe Prelude.Text,
    -- | The name to display for the new image.
    CreateUpdatedImage -> Maybe Text
newImageDisplayName' :: Prelude.Maybe Prelude.Text,
    -- | Indicates whether to display the status of image update availability
    -- before AppStream 2.0 initiates the process of creating a new updated
    -- image. If this value is set to @true@, AppStream 2.0 displays whether
    -- image updates are available. If this value is set to @false@, AppStream
    -- 2.0 initiates the process of creating a new updated image without
    -- displaying whether image updates are available.
    CreateUpdatedImage -> Maybe Bool
dryRun :: Prelude.Maybe Prelude.Bool,
    -- | The name of the image to update.
    CreateUpdatedImage -> Text
existingImageName :: Prelude.Text,
    -- | The name of the new image. The name must be unique within the AWS
    -- account and Region.
    CreateUpdatedImage -> Text
newImageName' :: Prelude.Text
  }
  deriving (CreateUpdatedImage -> CreateUpdatedImage -> Bool
(CreateUpdatedImage -> CreateUpdatedImage -> Bool)
-> (CreateUpdatedImage -> CreateUpdatedImage -> Bool)
-> Eq CreateUpdatedImage
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateUpdatedImage -> CreateUpdatedImage -> Bool
$c/= :: CreateUpdatedImage -> CreateUpdatedImage -> Bool
== :: CreateUpdatedImage -> CreateUpdatedImage -> Bool
$c== :: CreateUpdatedImage -> CreateUpdatedImage -> Bool
Prelude.Eq, ReadPrec [CreateUpdatedImage]
ReadPrec CreateUpdatedImage
Int -> ReadS CreateUpdatedImage
ReadS [CreateUpdatedImage]
(Int -> ReadS CreateUpdatedImage)
-> ReadS [CreateUpdatedImage]
-> ReadPrec CreateUpdatedImage
-> ReadPrec [CreateUpdatedImage]
-> Read CreateUpdatedImage
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateUpdatedImage]
$creadListPrec :: ReadPrec [CreateUpdatedImage]
readPrec :: ReadPrec CreateUpdatedImage
$creadPrec :: ReadPrec CreateUpdatedImage
readList :: ReadS [CreateUpdatedImage]
$creadList :: ReadS [CreateUpdatedImage]
readsPrec :: Int -> ReadS CreateUpdatedImage
$creadsPrec :: Int -> ReadS CreateUpdatedImage
Prelude.Read, Int -> CreateUpdatedImage -> ShowS
[CreateUpdatedImage] -> ShowS
CreateUpdatedImage -> String
(Int -> CreateUpdatedImage -> ShowS)
-> (CreateUpdatedImage -> String)
-> ([CreateUpdatedImage] -> ShowS)
-> Show CreateUpdatedImage
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateUpdatedImage] -> ShowS
$cshowList :: [CreateUpdatedImage] -> ShowS
show :: CreateUpdatedImage -> String
$cshow :: CreateUpdatedImage -> String
showsPrec :: Int -> CreateUpdatedImage -> ShowS
$cshowsPrec :: Int -> CreateUpdatedImage -> ShowS
Prelude.Show, (forall x. CreateUpdatedImage -> Rep CreateUpdatedImage x)
-> (forall x. Rep CreateUpdatedImage x -> CreateUpdatedImage)
-> Generic CreateUpdatedImage
forall x. Rep CreateUpdatedImage x -> CreateUpdatedImage
forall x. CreateUpdatedImage -> Rep CreateUpdatedImage x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateUpdatedImage x -> CreateUpdatedImage
$cfrom :: forall x. CreateUpdatedImage -> Rep CreateUpdatedImage x
Prelude.Generic)

-- |
-- Create a value of 'CreateUpdatedImage' 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:
--
-- 'newImageTags'', 'createUpdatedImage_newImageTags' - The tags to associate with the new image. A tag is a key-value pair, and
-- the value is optional. For example, Environment=Test. If you do not
-- specify a value, Environment=.
--
-- Generally allowed characters are: letters, numbers, and spaces
-- representable in UTF-8, and the following special characters:
--
-- _ . : \/ = + \\ - \@
--
-- If you do not specify a value, the value is set to an empty string.
--
-- For more information about tags, see
-- <https://docs.aws.amazon.com/appstream2/latest/developerguide/tagging-basic.html Tagging Your Resources>
-- in the /Amazon AppStream 2.0 Administration Guide/.
--
-- 'newImageDescription'', 'createUpdatedImage_newImageDescription' - The description to display for the new image.
--
-- 'newImageDisplayName'', 'createUpdatedImage_newImageDisplayName' - The name to display for the new image.
--
-- 'dryRun', 'createUpdatedImage_dryRun' - Indicates whether to display the status of image update availability
-- before AppStream 2.0 initiates the process of creating a new updated
-- image. If this value is set to @true@, AppStream 2.0 displays whether
-- image updates are available. If this value is set to @false@, AppStream
-- 2.0 initiates the process of creating a new updated image without
-- displaying whether image updates are available.
--
-- 'existingImageName', 'createUpdatedImage_existingImageName' - The name of the image to update.
--
-- 'newImageName'', 'createUpdatedImage_newImageName' - The name of the new image. The name must be unique within the AWS
-- account and Region.
newCreateUpdatedImage ::
  -- | 'existingImageName'
  Prelude.Text ->
  -- | 'newImageName''
  Prelude.Text ->
  CreateUpdatedImage
newCreateUpdatedImage :: Text -> Text -> CreateUpdatedImage
newCreateUpdatedImage
  Text
pExistingImageName_
  Text
pNewImageName_ =
    CreateUpdatedImage' :: Maybe (HashMap Text Text)
-> Maybe Text
-> Maybe Text
-> Maybe Bool
-> Text
-> Text
-> CreateUpdatedImage
CreateUpdatedImage'
      { $sel:newImageTags':CreateUpdatedImage' :: Maybe (HashMap Text Text)
newImageTags' =
          Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing,
        $sel:newImageDescription':CreateUpdatedImage' :: Maybe Text
newImageDescription' = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:newImageDisplayName':CreateUpdatedImage' :: Maybe Text
newImageDisplayName' = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:dryRun:CreateUpdatedImage' :: Maybe Bool
dryRun = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
        $sel:existingImageName:CreateUpdatedImage' :: Text
existingImageName = Text
pExistingImageName_,
        $sel:newImageName':CreateUpdatedImage' :: Text
newImageName' = Text
pNewImageName_
      }

-- | The tags to associate with the new image. A tag is a key-value pair, and
-- the value is optional. For example, Environment=Test. If you do not
-- specify a value, Environment=.
--
-- Generally allowed characters are: letters, numbers, and spaces
-- representable in UTF-8, and the following special characters:
--
-- _ . : \/ = + \\ - \@
--
-- If you do not specify a value, the value is set to an empty string.
--
-- For more information about tags, see
-- <https://docs.aws.amazon.com/appstream2/latest/developerguide/tagging-basic.html Tagging Your Resources>
-- in the /Amazon AppStream 2.0 Administration Guide/.
createUpdatedImage_newImageTags :: Lens.Lens' CreateUpdatedImage (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
createUpdatedImage_newImageTags :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> CreateUpdatedImage -> f CreateUpdatedImage
createUpdatedImage_newImageTags = (CreateUpdatedImage -> Maybe (HashMap Text Text))
-> (CreateUpdatedImage
    -> Maybe (HashMap Text Text) -> CreateUpdatedImage)
-> Lens
     CreateUpdatedImage
     CreateUpdatedImage
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateUpdatedImage' {Maybe (HashMap Text Text)
newImageTags' :: Maybe (HashMap Text Text)
$sel:newImageTags':CreateUpdatedImage' :: CreateUpdatedImage -> Maybe (HashMap Text Text)
newImageTags'} -> Maybe (HashMap Text Text)
newImageTags') (\s :: CreateUpdatedImage
s@CreateUpdatedImage' {} Maybe (HashMap Text Text)
a -> CreateUpdatedImage
s {$sel:newImageTags':CreateUpdatedImage' :: Maybe (HashMap Text Text)
newImageTags' = Maybe (HashMap Text Text)
a} :: CreateUpdatedImage) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
 -> CreateUpdatedImage -> f CreateUpdatedImage)
-> ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
    -> Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> CreateUpdatedImage
-> f CreateUpdatedImage
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
-> Iso
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
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
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The description to display for the new image.
createUpdatedImage_newImageDescription :: Lens.Lens' CreateUpdatedImage (Prelude.Maybe Prelude.Text)
createUpdatedImage_newImageDescription :: (Maybe Text -> f (Maybe Text))
-> CreateUpdatedImage -> f CreateUpdatedImage
createUpdatedImage_newImageDescription = (CreateUpdatedImage -> Maybe Text)
-> (CreateUpdatedImage -> Maybe Text -> CreateUpdatedImage)
-> Lens
     CreateUpdatedImage CreateUpdatedImage (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateUpdatedImage' {Maybe Text
newImageDescription' :: Maybe Text
$sel:newImageDescription':CreateUpdatedImage' :: CreateUpdatedImage -> Maybe Text
newImageDescription'} -> Maybe Text
newImageDescription') (\s :: CreateUpdatedImage
s@CreateUpdatedImage' {} Maybe Text
a -> CreateUpdatedImage
s {$sel:newImageDescription':CreateUpdatedImage' :: Maybe Text
newImageDescription' = Maybe Text
a} :: CreateUpdatedImage)

-- | The name to display for the new image.
createUpdatedImage_newImageDisplayName :: Lens.Lens' CreateUpdatedImage (Prelude.Maybe Prelude.Text)
createUpdatedImage_newImageDisplayName :: (Maybe Text -> f (Maybe Text))
-> CreateUpdatedImage -> f CreateUpdatedImage
createUpdatedImage_newImageDisplayName = (CreateUpdatedImage -> Maybe Text)
-> (CreateUpdatedImage -> Maybe Text -> CreateUpdatedImage)
-> Lens
     CreateUpdatedImage CreateUpdatedImage (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateUpdatedImage' {Maybe Text
newImageDisplayName' :: Maybe Text
$sel:newImageDisplayName':CreateUpdatedImage' :: CreateUpdatedImage -> Maybe Text
newImageDisplayName'} -> Maybe Text
newImageDisplayName') (\s :: CreateUpdatedImage
s@CreateUpdatedImage' {} Maybe Text
a -> CreateUpdatedImage
s {$sel:newImageDisplayName':CreateUpdatedImage' :: Maybe Text
newImageDisplayName' = Maybe Text
a} :: CreateUpdatedImage)

-- | Indicates whether to display the status of image update availability
-- before AppStream 2.0 initiates the process of creating a new updated
-- image. If this value is set to @true@, AppStream 2.0 displays whether
-- image updates are available. If this value is set to @false@, AppStream
-- 2.0 initiates the process of creating a new updated image without
-- displaying whether image updates are available.
createUpdatedImage_dryRun :: Lens.Lens' CreateUpdatedImage (Prelude.Maybe Prelude.Bool)
createUpdatedImage_dryRun :: (Maybe Bool -> f (Maybe Bool))
-> CreateUpdatedImage -> f CreateUpdatedImage
createUpdatedImage_dryRun = (CreateUpdatedImage -> Maybe Bool)
-> (CreateUpdatedImage -> Maybe Bool -> CreateUpdatedImage)
-> Lens
     CreateUpdatedImage CreateUpdatedImage (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateUpdatedImage' {Maybe Bool
dryRun :: Maybe Bool
$sel:dryRun:CreateUpdatedImage' :: CreateUpdatedImage -> Maybe Bool
dryRun} -> Maybe Bool
dryRun) (\s :: CreateUpdatedImage
s@CreateUpdatedImage' {} Maybe Bool
a -> CreateUpdatedImage
s {$sel:dryRun:CreateUpdatedImage' :: Maybe Bool
dryRun = Maybe Bool
a} :: CreateUpdatedImage)

-- | The name of the image to update.
createUpdatedImage_existingImageName :: Lens.Lens' CreateUpdatedImage Prelude.Text
createUpdatedImage_existingImageName :: (Text -> f Text) -> CreateUpdatedImage -> f CreateUpdatedImage
createUpdatedImage_existingImageName = (CreateUpdatedImage -> Text)
-> (CreateUpdatedImage -> Text -> CreateUpdatedImage)
-> Lens CreateUpdatedImage CreateUpdatedImage Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateUpdatedImage' {Text
existingImageName :: Text
$sel:existingImageName:CreateUpdatedImage' :: CreateUpdatedImage -> Text
existingImageName} -> Text
existingImageName) (\s :: CreateUpdatedImage
s@CreateUpdatedImage' {} Text
a -> CreateUpdatedImage
s {$sel:existingImageName:CreateUpdatedImage' :: Text
existingImageName = Text
a} :: CreateUpdatedImage)

-- | The name of the new image. The name must be unique within the AWS
-- account and Region.
createUpdatedImage_newImageName :: Lens.Lens' CreateUpdatedImage Prelude.Text
createUpdatedImage_newImageName :: (Text -> f Text) -> CreateUpdatedImage -> f CreateUpdatedImage
createUpdatedImage_newImageName = (CreateUpdatedImage -> Text)
-> (CreateUpdatedImage -> Text -> CreateUpdatedImage)
-> Lens CreateUpdatedImage CreateUpdatedImage Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateUpdatedImage' {Text
newImageName' :: Text
$sel:newImageName':CreateUpdatedImage' :: CreateUpdatedImage -> Text
newImageName'} -> Text
newImageName') (\s :: CreateUpdatedImage
s@CreateUpdatedImage' {} Text
a -> CreateUpdatedImage
s {$sel:newImageName':CreateUpdatedImage' :: Text
newImageName' = Text
a} :: CreateUpdatedImage)

instance Core.AWSRequest CreateUpdatedImage where
  type
    AWSResponse CreateUpdatedImage =
      CreateUpdatedImageResponse
  request :: CreateUpdatedImage -> Request CreateUpdatedImage
request = Service -> CreateUpdatedImage -> Request CreateUpdatedImage
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy CreateUpdatedImage
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse CreateUpdatedImage)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse CreateUpdatedImage))
-> Logger
-> Service
-> Proxy CreateUpdatedImage
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse CreateUpdatedImage)))
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 Image -> Maybe Bool -> Int -> CreateUpdatedImageResponse
CreateUpdatedImageResponse'
            (Maybe Image -> Maybe Bool -> Int -> CreateUpdatedImageResponse)
-> Either String (Maybe Image)
-> Either String (Maybe Bool -> Int -> CreateUpdatedImageResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Image)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"image")
            Either String (Maybe Bool -> Int -> CreateUpdatedImageResponse)
-> Either String (Maybe Bool)
-> Either String (Int -> CreateUpdatedImageResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"canUpdateImage")
            Either String (Int -> CreateUpdatedImageResponse)
-> Either String Int -> Either String CreateUpdatedImageResponse
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 CreateUpdatedImage

instance Prelude.NFData CreateUpdatedImage

instance Core.ToHeaders CreateUpdatedImage where
  toHeaders :: CreateUpdatedImage -> ResponseHeaders
toHeaders =
    ResponseHeaders -> CreateUpdatedImage -> 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
"PhotonAdminProxyService.CreateUpdatedImage" ::
                          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 CreateUpdatedImage where
  toJSON :: CreateUpdatedImage -> Value
toJSON CreateUpdatedImage' {Maybe Bool
Maybe Text
Maybe (HashMap Text Text)
Text
newImageName' :: Text
existingImageName :: Text
dryRun :: Maybe Bool
newImageDisplayName' :: Maybe Text
newImageDescription' :: Maybe Text
newImageTags' :: Maybe (HashMap Text Text)
$sel:newImageName':CreateUpdatedImage' :: CreateUpdatedImage -> Text
$sel:existingImageName:CreateUpdatedImage' :: CreateUpdatedImage -> Text
$sel:dryRun:CreateUpdatedImage' :: CreateUpdatedImage -> Maybe Bool
$sel:newImageDisplayName':CreateUpdatedImage' :: CreateUpdatedImage -> Maybe Text
$sel:newImageDescription':CreateUpdatedImage' :: CreateUpdatedImage -> Maybe Text
$sel:newImageTags':CreateUpdatedImage' :: CreateUpdatedImage -> Maybe (HashMap Text Text)
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"newImageTags" Text -> HashMap Text Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (HashMap Text Text -> Pair)
-> Maybe (HashMap Text Text) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap Text Text)
newImageTags',
            (Text
"newImageDescription" 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
newImageDescription',
            (Text
"newImageDisplayName" 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
newImageDisplayName',
            (Text
"dryRun" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
dryRun,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"existingImageName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
existingImageName),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"newImageName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
newImageName')
          ]
      )

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

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

-- | /See:/ 'newCreateUpdatedImageResponse' smart constructor.
data CreateUpdatedImageResponse = CreateUpdatedImageResponse'
  { CreateUpdatedImageResponse -> Maybe Image
image :: Prelude.Maybe Image,
    -- | Indicates whether a new image can be created.
    CreateUpdatedImageResponse -> Maybe Bool
canUpdateImage :: Prelude.Maybe Prelude.Bool,
    -- | The response's http status code.
    CreateUpdatedImageResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (CreateUpdatedImageResponse -> CreateUpdatedImageResponse -> Bool
(CreateUpdatedImageResponse -> CreateUpdatedImageResponse -> Bool)
-> (CreateUpdatedImageResponse
    -> CreateUpdatedImageResponse -> Bool)
-> Eq CreateUpdatedImageResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateUpdatedImageResponse -> CreateUpdatedImageResponse -> Bool
$c/= :: CreateUpdatedImageResponse -> CreateUpdatedImageResponse -> Bool
== :: CreateUpdatedImageResponse -> CreateUpdatedImageResponse -> Bool
$c== :: CreateUpdatedImageResponse -> CreateUpdatedImageResponse -> Bool
Prelude.Eq, ReadPrec [CreateUpdatedImageResponse]
ReadPrec CreateUpdatedImageResponse
Int -> ReadS CreateUpdatedImageResponse
ReadS [CreateUpdatedImageResponse]
(Int -> ReadS CreateUpdatedImageResponse)
-> ReadS [CreateUpdatedImageResponse]
-> ReadPrec CreateUpdatedImageResponse
-> ReadPrec [CreateUpdatedImageResponse]
-> Read CreateUpdatedImageResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateUpdatedImageResponse]
$creadListPrec :: ReadPrec [CreateUpdatedImageResponse]
readPrec :: ReadPrec CreateUpdatedImageResponse
$creadPrec :: ReadPrec CreateUpdatedImageResponse
readList :: ReadS [CreateUpdatedImageResponse]
$creadList :: ReadS [CreateUpdatedImageResponse]
readsPrec :: Int -> ReadS CreateUpdatedImageResponse
$creadsPrec :: Int -> ReadS CreateUpdatedImageResponse
Prelude.Read, Int -> CreateUpdatedImageResponse -> ShowS
[CreateUpdatedImageResponse] -> ShowS
CreateUpdatedImageResponse -> String
(Int -> CreateUpdatedImageResponse -> ShowS)
-> (CreateUpdatedImageResponse -> String)
-> ([CreateUpdatedImageResponse] -> ShowS)
-> Show CreateUpdatedImageResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateUpdatedImageResponse] -> ShowS
$cshowList :: [CreateUpdatedImageResponse] -> ShowS
show :: CreateUpdatedImageResponse -> String
$cshow :: CreateUpdatedImageResponse -> String
showsPrec :: Int -> CreateUpdatedImageResponse -> ShowS
$cshowsPrec :: Int -> CreateUpdatedImageResponse -> ShowS
Prelude.Show, (forall x.
 CreateUpdatedImageResponse -> Rep CreateUpdatedImageResponse x)
-> (forall x.
    Rep CreateUpdatedImageResponse x -> CreateUpdatedImageResponse)
-> Generic CreateUpdatedImageResponse
forall x.
Rep CreateUpdatedImageResponse x -> CreateUpdatedImageResponse
forall x.
CreateUpdatedImageResponse -> Rep CreateUpdatedImageResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateUpdatedImageResponse x -> CreateUpdatedImageResponse
$cfrom :: forall x.
CreateUpdatedImageResponse -> Rep CreateUpdatedImageResponse x
Prelude.Generic)

-- |
-- Create a value of 'CreateUpdatedImageResponse' 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:
--
-- 'image', 'createUpdatedImageResponse_image' - Undocumented member.
--
-- 'canUpdateImage', 'createUpdatedImageResponse_canUpdateImage' - Indicates whether a new image can be created.
--
-- 'httpStatus', 'createUpdatedImageResponse_httpStatus' - The response's http status code.
newCreateUpdatedImageResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  CreateUpdatedImageResponse
newCreateUpdatedImageResponse :: Int -> CreateUpdatedImageResponse
newCreateUpdatedImageResponse Int
pHttpStatus_ =
  CreateUpdatedImageResponse' :: Maybe Image -> Maybe Bool -> Int -> CreateUpdatedImageResponse
CreateUpdatedImageResponse'
    { $sel:image:CreateUpdatedImageResponse' :: Maybe Image
image =
        Maybe Image
forall a. Maybe a
Prelude.Nothing,
      $sel:canUpdateImage:CreateUpdatedImageResponse' :: Maybe Bool
canUpdateImage = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:CreateUpdatedImageResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | Undocumented member.
createUpdatedImageResponse_image :: Lens.Lens' CreateUpdatedImageResponse (Prelude.Maybe Image)
createUpdatedImageResponse_image :: (Maybe Image -> f (Maybe Image))
-> CreateUpdatedImageResponse -> f CreateUpdatedImageResponse
createUpdatedImageResponse_image = (CreateUpdatedImageResponse -> Maybe Image)
-> (CreateUpdatedImageResponse
    -> Maybe Image -> CreateUpdatedImageResponse)
-> Lens
     CreateUpdatedImageResponse
     CreateUpdatedImageResponse
     (Maybe Image)
     (Maybe Image)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateUpdatedImageResponse' {Maybe Image
image :: Maybe Image
$sel:image:CreateUpdatedImageResponse' :: CreateUpdatedImageResponse -> Maybe Image
image} -> Maybe Image
image) (\s :: CreateUpdatedImageResponse
s@CreateUpdatedImageResponse' {} Maybe Image
a -> CreateUpdatedImageResponse
s {$sel:image:CreateUpdatedImageResponse' :: Maybe Image
image = Maybe Image
a} :: CreateUpdatedImageResponse)

-- | Indicates whether a new image can be created.
createUpdatedImageResponse_canUpdateImage :: Lens.Lens' CreateUpdatedImageResponse (Prelude.Maybe Prelude.Bool)
createUpdatedImageResponse_canUpdateImage :: (Maybe Bool -> f (Maybe Bool))
-> CreateUpdatedImageResponse -> f CreateUpdatedImageResponse
createUpdatedImageResponse_canUpdateImage = (CreateUpdatedImageResponse -> Maybe Bool)
-> (CreateUpdatedImageResponse
    -> Maybe Bool -> CreateUpdatedImageResponse)
-> Lens
     CreateUpdatedImageResponse
     CreateUpdatedImageResponse
     (Maybe Bool)
     (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateUpdatedImageResponse' {Maybe Bool
canUpdateImage :: Maybe Bool
$sel:canUpdateImage:CreateUpdatedImageResponse' :: CreateUpdatedImageResponse -> Maybe Bool
canUpdateImage} -> Maybe Bool
canUpdateImage) (\s :: CreateUpdatedImageResponse
s@CreateUpdatedImageResponse' {} Maybe Bool
a -> CreateUpdatedImageResponse
s {$sel:canUpdateImage:CreateUpdatedImageResponse' :: Maybe Bool
canUpdateImage = Maybe Bool
a} :: CreateUpdatedImageResponse)

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

instance Prelude.NFData CreateUpdatedImageResponse