{-# 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.ImageBuilder.CreateImage
-- 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. This request will create a new image along with all
-- of the configured output resources defined in the distribution
-- configuration. You must specify exactly one recipe for your image, using
-- either a ContainerRecipeArn or an ImageRecipeArn.
module Amazonka.ImageBuilder.CreateImage
  ( -- * Creating a Request
    CreateImage (..),
    newCreateImage,

    -- * Request Lenses
    createImage_containerRecipeArn,
    createImage_imageTestsConfiguration,
    createImage_enhancedImageMetadataEnabled,
    createImage_distributionConfigurationArn,
    createImage_imageRecipeArn,
    createImage_tags,
    createImage_infrastructureConfigurationArn,
    createImage_clientToken,

    -- * Destructuring the Response
    CreateImageResponse (..),
    newCreateImageResponse,

    -- * Response Lenses
    createImageResponse_requestId,
    createImageResponse_clientToken,
    createImageResponse_imageBuildVersionArn,
    createImageResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import Amazonka.ImageBuilder.Types
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:/ 'newCreateImage' smart constructor.
data CreateImage = CreateImage'
  { -- | The Amazon Resource Name (ARN) of the container recipe that defines how
    -- images are configured and tested.
    CreateImage -> Maybe Text
containerRecipeArn :: Prelude.Maybe Prelude.Text,
    -- | The image tests configuration of the image.
    CreateImage -> Maybe ImageTestsConfiguration
imageTestsConfiguration :: Prelude.Maybe ImageTestsConfiguration,
    -- | Collects additional information about the image being created, including
    -- the operating system (OS) version and package list. This information is
    -- used to enhance the overall experience of using EC2 Image Builder.
    -- Enabled by default.
    CreateImage -> Maybe Bool
enhancedImageMetadataEnabled :: Prelude.Maybe Prelude.Bool,
    -- | The Amazon Resource Name (ARN) of the distribution configuration that
    -- defines and configures the outputs of your pipeline.
    CreateImage -> Maybe Text
distributionConfigurationArn :: Prelude.Maybe Prelude.Text,
    -- | The Amazon Resource Name (ARN) of the image recipe that defines how
    -- images are configured, tested, and assessed.
    CreateImage -> Maybe Text
imageRecipeArn :: Prelude.Maybe Prelude.Text,
    -- | The tags of the image.
    CreateImage -> Maybe (HashMap Text Text)
tags :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
    -- | The Amazon Resource Name (ARN) of the infrastructure configuration that
    -- defines the environment in which your image will be built and tested.
    CreateImage -> Text
infrastructureConfigurationArn :: Prelude.Text,
    -- | The idempotency token used to make this request idempotent.
    CreateImage -> Text
clientToken :: Prelude.Text
  }
  deriving (CreateImage -> CreateImage -> Bool
(CreateImage -> CreateImage -> Bool)
-> (CreateImage -> CreateImage -> Bool) -> Eq CreateImage
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateImage -> CreateImage -> Bool
$c/= :: CreateImage -> CreateImage -> Bool
== :: CreateImage -> CreateImage -> Bool
$c== :: CreateImage -> CreateImage -> Bool
Prelude.Eq, ReadPrec [CreateImage]
ReadPrec CreateImage
Int -> ReadS CreateImage
ReadS [CreateImage]
(Int -> ReadS CreateImage)
-> ReadS [CreateImage]
-> ReadPrec CreateImage
-> ReadPrec [CreateImage]
-> Read CreateImage
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateImage]
$creadListPrec :: ReadPrec [CreateImage]
readPrec :: ReadPrec CreateImage
$creadPrec :: ReadPrec CreateImage
readList :: ReadS [CreateImage]
$creadList :: ReadS [CreateImage]
readsPrec :: Int -> ReadS CreateImage
$creadsPrec :: Int -> ReadS CreateImage
Prelude.Read, Int -> CreateImage -> ShowS
[CreateImage] -> ShowS
CreateImage -> String
(Int -> CreateImage -> ShowS)
-> (CreateImage -> String)
-> ([CreateImage] -> ShowS)
-> Show CreateImage
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateImage] -> ShowS
$cshowList :: [CreateImage] -> ShowS
show :: CreateImage -> String
$cshow :: CreateImage -> String
showsPrec :: Int -> CreateImage -> ShowS
$cshowsPrec :: Int -> CreateImage -> ShowS
Prelude.Show, (forall x. CreateImage -> Rep CreateImage x)
-> (forall x. Rep CreateImage x -> CreateImage)
-> Generic CreateImage
forall x. Rep CreateImage x -> CreateImage
forall x. CreateImage -> Rep CreateImage x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateImage x -> CreateImage
$cfrom :: forall x. CreateImage -> Rep CreateImage x
Prelude.Generic)

-- |
-- Create a value of 'CreateImage' 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:
--
-- 'containerRecipeArn', 'createImage_containerRecipeArn' - The Amazon Resource Name (ARN) of the container recipe that defines how
-- images are configured and tested.
--
-- 'imageTestsConfiguration', 'createImage_imageTestsConfiguration' - The image tests configuration of the image.
--
-- 'enhancedImageMetadataEnabled', 'createImage_enhancedImageMetadataEnabled' - Collects additional information about the image being created, including
-- the operating system (OS) version and package list. This information is
-- used to enhance the overall experience of using EC2 Image Builder.
-- Enabled by default.
--
-- 'distributionConfigurationArn', 'createImage_distributionConfigurationArn' - The Amazon Resource Name (ARN) of the distribution configuration that
-- defines and configures the outputs of your pipeline.
--
-- 'imageRecipeArn', 'createImage_imageRecipeArn' - The Amazon Resource Name (ARN) of the image recipe that defines how
-- images are configured, tested, and assessed.
--
-- 'tags', 'createImage_tags' - The tags of the image.
--
-- 'infrastructureConfigurationArn', 'createImage_infrastructureConfigurationArn' - The Amazon Resource Name (ARN) of the infrastructure configuration that
-- defines the environment in which your image will be built and tested.
--
-- 'clientToken', 'createImage_clientToken' - The idempotency token used to make this request idempotent.
newCreateImage ::
  -- | 'infrastructureConfigurationArn'
  Prelude.Text ->
  -- | 'clientToken'
  Prelude.Text ->
  CreateImage
newCreateImage :: Text -> Text -> CreateImage
newCreateImage
  Text
pInfrastructureConfigurationArn_
  Text
pClientToken_ =
    CreateImage' :: Maybe Text
-> Maybe ImageTestsConfiguration
-> Maybe Bool
-> Maybe Text
-> Maybe Text
-> Maybe (HashMap Text Text)
-> Text
-> Text
-> CreateImage
CreateImage'
      { $sel:containerRecipeArn:CreateImage' :: Maybe Text
containerRecipeArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:imageTestsConfiguration:CreateImage' :: Maybe ImageTestsConfiguration
imageTestsConfiguration = Maybe ImageTestsConfiguration
forall a. Maybe a
Prelude.Nothing,
        $sel:enhancedImageMetadataEnabled:CreateImage' :: Maybe Bool
enhancedImageMetadataEnabled = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
        $sel:distributionConfigurationArn:CreateImage' :: Maybe Text
distributionConfigurationArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:imageRecipeArn:CreateImage' :: Maybe Text
imageRecipeArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:tags:CreateImage' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing,
        $sel:infrastructureConfigurationArn:CreateImage' :: Text
infrastructureConfigurationArn =
          Text
pInfrastructureConfigurationArn_,
        $sel:clientToken:CreateImage' :: Text
clientToken = Text
pClientToken_
      }

-- | The Amazon Resource Name (ARN) of the container recipe that defines how
-- images are configured and tested.
createImage_containerRecipeArn :: Lens.Lens' CreateImage (Prelude.Maybe Prelude.Text)
createImage_containerRecipeArn :: (Maybe Text -> f (Maybe Text)) -> CreateImage -> f CreateImage
createImage_containerRecipeArn = (CreateImage -> Maybe Text)
-> (CreateImage -> Maybe Text -> CreateImage)
-> Lens CreateImage CreateImage (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateImage' {Maybe Text
containerRecipeArn :: Maybe Text
$sel:containerRecipeArn:CreateImage' :: CreateImage -> Maybe Text
containerRecipeArn} -> Maybe Text
containerRecipeArn) (\s :: CreateImage
s@CreateImage' {} Maybe Text
a -> CreateImage
s {$sel:containerRecipeArn:CreateImage' :: Maybe Text
containerRecipeArn = Maybe Text
a} :: CreateImage)

-- | The image tests configuration of the image.
createImage_imageTestsConfiguration :: Lens.Lens' CreateImage (Prelude.Maybe ImageTestsConfiguration)
createImage_imageTestsConfiguration :: (Maybe ImageTestsConfiguration
 -> f (Maybe ImageTestsConfiguration))
-> CreateImage -> f CreateImage
createImage_imageTestsConfiguration = (CreateImage -> Maybe ImageTestsConfiguration)
-> (CreateImage -> Maybe ImageTestsConfiguration -> CreateImage)
-> Lens
     CreateImage
     CreateImage
     (Maybe ImageTestsConfiguration)
     (Maybe ImageTestsConfiguration)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateImage' {Maybe ImageTestsConfiguration
imageTestsConfiguration :: Maybe ImageTestsConfiguration
$sel:imageTestsConfiguration:CreateImage' :: CreateImage -> Maybe ImageTestsConfiguration
imageTestsConfiguration} -> Maybe ImageTestsConfiguration
imageTestsConfiguration) (\s :: CreateImage
s@CreateImage' {} Maybe ImageTestsConfiguration
a -> CreateImage
s {$sel:imageTestsConfiguration:CreateImage' :: Maybe ImageTestsConfiguration
imageTestsConfiguration = Maybe ImageTestsConfiguration
a} :: CreateImage)

-- | Collects additional information about the image being created, including
-- the operating system (OS) version and package list. This information is
-- used to enhance the overall experience of using EC2 Image Builder.
-- Enabled by default.
createImage_enhancedImageMetadataEnabled :: Lens.Lens' CreateImage (Prelude.Maybe Prelude.Bool)
createImage_enhancedImageMetadataEnabled :: (Maybe Bool -> f (Maybe Bool)) -> CreateImage -> f CreateImage
createImage_enhancedImageMetadataEnabled = (CreateImage -> Maybe Bool)
-> (CreateImage -> Maybe Bool -> CreateImage)
-> Lens CreateImage CreateImage (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateImage' {Maybe Bool
enhancedImageMetadataEnabled :: Maybe Bool
$sel:enhancedImageMetadataEnabled:CreateImage' :: CreateImage -> Maybe Bool
enhancedImageMetadataEnabled} -> Maybe Bool
enhancedImageMetadataEnabled) (\s :: CreateImage
s@CreateImage' {} Maybe Bool
a -> CreateImage
s {$sel:enhancedImageMetadataEnabled:CreateImage' :: Maybe Bool
enhancedImageMetadataEnabled = Maybe Bool
a} :: CreateImage)

-- | The Amazon Resource Name (ARN) of the distribution configuration that
-- defines and configures the outputs of your pipeline.
createImage_distributionConfigurationArn :: Lens.Lens' CreateImage (Prelude.Maybe Prelude.Text)
createImage_distributionConfigurationArn :: (Maybe Text -> f (Maybe Text)) -> CreateImage -> f CreateImage
createImage_distributionConfigurationArn = (CreateImage -> Maybe Text)
-> (CreateImage -> Maybe Text -> CreateImage)
-> Lens CreateImage CreateImage (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateImage' {Maybe Text
distributionConfigurationArn :: Maybe Text
$sel:distributionConfigurationArn:CreateImage' :: CreateImage -> Maybe Text
distributionConfigurationArn} -> Maybe Text
distributionConfigurationArn) (\s :: CreateImage
s@CreateImage' {} Maybe Text
a -> CreateImage
s {$sel:distributionConfigurationArn:CreateImage' :: Maybe Text
distributionConfigurationArn = Maybe Text
a} :: CreateImage)

-- | The Amazon Resource Name (ARN) of the image recipe that defines how
-- images are configured, tested, and assessed.
createImage_imageRecipeArn :: Lens.Lens' CreateImage (Prelude.Maybe Prelude.Text)
createImage_imageRecipeArn :: (Maybe Text -> f (Maybe Text)) -> CreateImage -> f CreateImage
createImage_imageRecipeArn = (CreateImage -> Maybe Text)
-> (CreateImage -> Maybe Text -> CreateImage)
-> Lens CreateImage CreateImage (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateImage' {Maybe Text
imageRecipeArn :: Maybe Text
$sel:imageRecipeArn:CreateImage' :: CreateImage -> Maybe Text
imageRecipeArn} -> Maybe Text
imageRecipeArn) (\s :: CreateImage
s@CreateImage' {} Maybe Text
a -> CreateImage
s {$sel:imageRecipeArn:CreateImage' :: Maybe Text
imageRecipeArn = Maybe Text
a} :: CreateImage)

-- | The tags of the image.
createImage_tags :: Lens.Lens' CreateImage (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
createImage_tags :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> CreateImage -> f CreateImage
createImage_tags = (CreateImage -> Maybe (HashMap Text Text))
-> (CreateImage -> Maybe (HashMap Text Text) -> CreateImage)
-> Lens
     CreateImage
     CreateImage
     (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 (\CreateImage' {Maybe (HashMap Text Text)
tags :: Maybe (HashMap Text Text)
$sel:tags:CreateImage' :: CreateImage -> Maybe (HashMap Text Text)
tags} -> Maybe (HashMap Text Text)
tags) (\s :: CreateImage
s@CreateImage' {} Maybe (HashMap Text Text)
a -> CreateImage
s {$sel:tags:CreateImage' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
a} :: CreateImage) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
 -> CreateImage -> f CreateImage)
-> ((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)))
-> CreateImage
-> f CreateImage
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 Amazon Resource Name (ARN) of the infrastructure configuration that
-- defines the environment in which your image will be built and tested.
createImage_infrastructureConfigurationArn :: Lens.Lens' CreateImage Prelude.Text
createImage_infrastructureConfigurationArn :: (Text -> f Text) -> CreateImage -> f CreateImage
createImage_infrastructureConfigurationArn = (CreateImage -> Text)
-> (CreateImage -> Text -> CreateImage)
-> Lens CreateImage CreateImage Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateImage' {Text
infrastructureConfigurationArn :: Text
$sel:infrastructureConfigurationArn:CreateImage' :: CreateImage -> Text
infrastructureConfigurationArn} -> Text
infrastructureConfigurationArn) (\s :: CreateImage
s@CreateImage' {} Text
a -> CreateImage
s {$sel:infrastructureConfigurationArn:CreateImage' :: Text
infrastructureConfigurationArn = Text
a} :: CreateImage)

-- | The idempotency token used to make this request idempotent.
createImage_clientToken :: Lens.Lens' CreateImage Prelude.Text
createImage_clientToken :: (Text -> f Text) -> CreateImage -> f CreateImage
createImage_clientToken = (CreateImage -> Text)
-> (CreateImage -> Text -> CreateImage)
-> Lens CreateImage CreateImage Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateImage' {Text
clientToken :: Text
$sel:clientToken:CreateImage' :: CreateImage -> Text
clientToken} -> Text
clientToken) (\s :: CreateImage
s@CreateImage' {} Text
a -> CreateImage
s {$sel:clientToken:CreateImage' :: Text
clientToken = Text
a} :: CreateImage)

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

instance Prelude.NFData CreateImage

instance Core.ToHeaders CreateImage where
  toHeaders :: CreateImage -> ResponseHeaders
toHeaders =
    ResponseHeaders -> CreateImage -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ 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 CreateImage where
  toJSON :: CreateImage -> Value
toJSON CreateImage' {Maybe Bool
Maybe Text
Maybe (HashMap Text Text)
Maybe ImageTestsConfiguration
Text
clientToken :: Text
infrastructureConfigurationArn :: Text
tags :: Maybe (HashMap Text Text)
imageRecipeArn :: Maybe Text
distributionConfigurationArn :: Maybe Text
enhancedImageMetadataEnabled :: Maybe Bool
imageTestsConfiguration :: Maybe ImageTestsConfiguration
containerRecipeArn :: Maybe Text
$sel:clientToken:CreateImage' :: CreateImage -> Text
$sel:infrastructureConfigurationArn:CreateImage' :: CreateImage -> Text
$sel:tags:CreateImage' :: CreateImage -> Maybe (HashMap Text Text)
$sel:imageRecipeArn:CreateImage' :: CreateImage -> Maybe Text
$sel:distributionConfigurationArn:CreateImage' :: CreateImage -> Maybe Text
$sel:enhancedImageMetadataEnabled:CreateImage' :: CreateImage -> Maybe Bool
$sel:imageTestsConfiguration:CreateImage' :: CreateImage -> Maybe ImageTestsConfiguration
$sel:containerRecipeArn:CreateImage' :: CreateImage -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"containerRecipeArn" 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
containerRecipeArn,
            (Text
"imageTestsConfiguration" Text -> ImageTestsConfiguration -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (ImageTestsConfiguration -> Pair)
-> Maybe ImageTestsConfiguration -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ImageTestsConfiguration
imageTestsConfiguration,
            (Text
"enhancedImageMetadataEnabled" 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
enhancedImageMetadataEnabled,
            (Text
"distributionConfigurationArn" 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
distributionConfigurationArn,
            (Text
"imageRecipeArn" 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
imageRecipeArn,
            (Text
"tags" 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)
tags,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              ( Text
"infrastructureConfigurationArn"
                  Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
infrastructureConfigurationArn
              ),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"clientToken" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
clientToken)
          ]
      )

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

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

-- | /See:/ 'newCreateImageResponse' smart constructor.
data CreateImageResponse = CreateImageResponse'
  { -- | The request ID that uniquely identifies this request.
    CreateImageResponse -> Maybe Text
requestId :: Prelude.Maybe Prelude.Text,
    -- | The idempotency token used to make this request idempotent.
    CreateImageResponse -> Maybe Text
clientToken :: Prelude.Maybe Prelude.Text,
    -- | The Amazon Resource Name (ARN) of the image that was created by this
    -- request.
    CreateImageResponse -> Maybe Text
imageBuildVersionArn :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    CreateImageResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (CreateImageResponse -> CreateImageResponse -> Bool
(CreateImageResponse -> CreateImageResponse -> Bool)
-> (CreateImageResponse -> CreateImageResponse -> Bool)
-> Eq CreateImageResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateImageResponse -> CreateImageResponse -> Bool
$c/= :: CreateImageResponse -> CreateImageResponse -> Bool
== :: CreateImageResponse -> CreateImageResponse -> Bool
$c== :: CreateImageResponse -> CreateImageResponse -> Bool
Prelude.Eq, ReadPrec [CreateImageResponse]
ReadPrec CreateImageResponse
Int -> ReadS CreateImageResponse
ReadS [CreateImageResponse]
(Int -> ReadS CreateImageResponse)
-> ReadS [CreateImageResponse]
-> ReadPrec CreateImageResponse
-> ReadPrec [CreateImageResponse]
-> Read CreateImageResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateImageResponse]
$creadListPrec :: ReadPrec [CreateImageResponse]
readPrec :: ReadPrec CreateImageResponse
$creadPrec :: ReadPrec CreateImageResponse
readList :: ReadS [CreateImageResponse]
$creadList :: ReadS [CreateImageResponse]
readsPrec :: Int -> ReadS CreateImageResponse
$creadsPrec :: Int -> ReadS CreateImageResponse
Prelude.Read, Int -> CreateImageResponse -> ShowS
[CreateImageResponse] -> ShowS
CreateImageResponse -> String
(Int -> CreateImageResponse -> ShowS)
-> (CreateImageResponse -> String)
-> ([CreateImageResponse] -> ShowS)
-> Show CreateImageResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateImageResponse] -> ShowS
$cshowList :: [CreateImageResponse] -> ShowS
show :: CreateImageResponse -> String
$cshow :: CreateImageResponse -> String
showsPrec :: Int -> CreateImageResponse -> ShowS
$cshowsPrec :: Int -> CreateImageResponse -> ShowS
Prelude.Show, (forall x. CreateImageResponse -> Rep CreateImageResponse x)
-> (forall x. Rep CreateImageResponse x -> CreateImageResponse)
-> Generic CreateImageResponse
forall x. Rep CreateImageResponse x -> CreateImageResponse
forall x. CreateImageResponse -> Rep CreateImageResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateImageResponse x -> CreateImageResponse
$cfrom :: forall x. CreateImageResponse -> Rep CreateImageResponse x
Prelude.Generic)

-- |
-- Create a value of 'CreateImageResponse' 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:
--
-- 'requestId', 'createImageResponse_requestId' - The request ID that uniquely identifies this request.
--
-- 'clientToken', 'createImageResponse_clientToken' - The idempotency token used to make this request idempotent.
--
-- 'imageBuildVersionArn', 'createImageResponse_imageBuildVersionArn' - The Amazon Resource Name (ARN) of the image that was created by this
-- request.
--
-- 'httpStatus', 'createImageResponse_httpStatus' - The response's http status code.
newCreateImageResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  CreateImageResponse
newCreateImageResponse :: Int -> CreateImageResponse
newCreateImageResponse Int
pHttpStatus_ =
  CreateImageResponse' :: Maybe Text
-> Maybe Text -> Maybe Text -> Int -> CreateImageResponse
CreateImageResponse'
    { $sel:requestId:CreateImageResponse' :: Maybe Text
requestId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:clientToken:CreateImageResponse' :: Maybe Text
clientToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:imageBuildVersionArn:CreateImageResponse' :: Maybe Text
imageBuildVersionArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:CreateImageResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The request ID that uniquely identifies this request.
createImageResponse_requestId :: Lens.Lens' CreateImageResponse (Prelude.Maybe Prelude.Text)
createImageResponse_requestId :: (Maybe Text -> f (Maybe Text))
-> CreateImageResponse -> f CreateImageResponse
createImageResponse_requestId = (CreateImageResponse -> Maybe Text)
-> (CreateImageResponse -> Maybe Text -> CreateImageResponse)
-> Lens
     CreateImageResponse CreateImageResponse (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateImageResponse' {Maybe Text
requestId :: Maybe Text
$sel:requestId:CreateImageResponse' :: CreateImageResponse -> Maybe Text
requestId} -> Maybe Text
requestId) (\s :: CreateImageResponse
s@CreateImageResponse' {} Maybe Text
a -> CreateImageResponse
s {$sel:requestId:CreateImageResponse' :: Maybe Text
requestId = Maybe Text
a} :: CreateImageResponse)

-- | The idempotency token used to make this request idempotent.
createImageResponse_clientToken :: Lens.Lens' CreateImageResponse (Prelude.Maybe Prelude.Text)
createImageResponse_clientToken :: (Maybe Text -> f (Maybe Text))
-> CreateImageResponse -> f CreateImageResponse
createImageResponse_clientToken = (CreateImageResponse -> Maybe Text)
-> (CreateImageResponse -> Maybe Text -> CreateImageResponse)
-> Lens
     CreateImageResponse CreateImageResponse (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateImageResponse' {Maybe Text
clientToken :: Maybe Text
$sel:clientToken:CreateImageResponse' :: CreateImageResponse -> Maybe Text
clientToken} -> Maybe Text
clientToken) (\s :: CreateImageResponse
s@CreateImageResponse' {} Maybe Text
a -> CreateImageResponse
s {$sel:clientToken:CreateImageResponse' :: Maybe Text
clientToken = Maybe Text
a} :: CreateImageResponse)

-- | The Amazon Resource Name (ARN) of the image that was created by this
-- request.
createImageResponse_imageBuildVersionArn :: Lens.Lens' CreateImageResponse (Prelude.Maybe Prelude.Text)
createImageResponse_imageBuildVersionArn :: (Maybe Text -> f (Maybe Text))
-> CreateImageResponse -> f CreateImageResponse
createImageResponse_imageBuildVersionArn = (CreateImageResponse -> Maybe Text)
-> (CreateImageResponse -> Maybe Text -> CreateImageResponse)
-> Lens
     CreateImageResponse CreateImageResponse (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateImageResponse' {Maybe Text
imageBuildVersionArn :: Maybe Text
$sel:imageBuildVersionArn:CreateImageResponse' :: CreateImageResponse -> Maybe Text
imageBuildVersionArn} -> Maybe Text
imageBuildVersionArn) (\s :: CreateImageResponse
s@CreateImageResponse' {} Maybe Text
a -> CreateImageResponse
s {$sel:imageBuildVersionArn:CreateImageResponse' :: Maybe Text
imageBuildVersionArn = Maybe Text
a} :: CreateImageResponse)

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

instance Prelude.NFData CreateImageResponse