{-# 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.CreateComponent
-- 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 component that can be used to build, validate, test, and
-- assess your image.
module Amazonka.ImageBuilder.CreateComponent
  ( -- * Creating a Request
    CreateComponent (..),
    newCreateComponent,

    -- * Request Lenses
    createComponent_data,
    createComponent_supportedOsVersions,
    createComponent_uri,
    createComponent_kmsKeyId,
    createComponent_changeDescription,
    createComponent_description,
    createComponent_tags,
    createComponent_name,
    createComponent_semanticVersion,
    createComponent_platform,
    createComponent_clientToken,

    -- * Destructuring the Response
    CreateComponentResponse (..),
    newCreateComponentResponse,

    -- * Response Lenses
    createComponentResponse_requestId,
    createComponentResponse_clientToken,
    createComponentResponse_componentBuildVersionArn,
    createComponentResponse_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:/ 'newCreateComponent' smart constructor.
data CreateComponent = CreateComponent'
  { -- | The data of the component. Used to specify the data inline. Either
    -- @data@ or @uri@ can be used to specify the data within the component.
    CreateComponent -> Maybe Text
data' :: Prelude.Maybe Prelude.Text,
    -- | The operating system (OS) version supported by the component. If the OS
    -- information is available, a prefix match is performed against the base
    -- image OS version during image recipe creation.
    CreateComponent -> Maybe (NonEmpty Text)
supportedOsVersions :: Prelude.Maybe (Prelude.NonEmpty Prelude.Text),
    -- | The uri of the component. Must be an Amazon S3 URL and the requester
    -- must have permission to access the Amazon S3 bucket. If you use Amazon
    -- S3, you can specify component content up to your service quota. Either
    -- @data@ or @uri@ can be used to specify the data within the component.
    CreateComponent -> Maybe Text
uri :: Prelude.Maybe Prelude.Text,
    -- | The ID of the KMS key that should be used to encrypt this component.
    CreateComponent -> Maybe Text
kmsKeyId :: Prelude.Maybe Prelude.Text,
    -- | The change description of the component. Describes what change has been
    -- made in this version, or what makes this version different from other
    -- versions of this component.
    CreateComponent -> Maybe Text
changeDescription :: Prelude.Maybe Prelude.Text,
    -- | The description of the component. Describes the contents of the
    -- component.
    CreateComponent -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | The tags of the component.
    CreateComponent -> Maybe (HashMap Text Text)
tags :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
    -- | The name of the component.
    CreateComponent -> Text
name :: Prelude.Text,
    -- | The semantic version of the component. This version follows the semantic
    -- version syntax.
    --
    -- The semantic version has four nodes:
    -- \<major>.\<minor>.\<patch>\/\<build>. You can assign values for the
    -- first three, and can filter on all of them.
    --
    -- __Assignment:__ For the first three nodes you can assign any positive
    -- integer value, including zero, with an upper limit of 2^30-1, or
    -- 1073741823 for each node. Image Builder automatically assigns the build
    -- number to the fourth node.
    --
    -- __Patterns:__ You can use any numeric pattern that adheres to the
    -- assignment requirements for the nodes that you can assign. For example,
    -- you might choose a software version pattern, such as 1.0.0, or a date,
    -- such as 2021.01.01.
    CreateComponent -> Text
semanticVersion :: Prelude.Text,
    -- | The platform of the component.
    CreateComponent -> Platform
platform :: Platform,
    -- | The idempotency token of the component.
    CreateComponent -> Text
clientToken :: Prelude.Text
  }
  deriving (CreateComponent -> CreateComponent -> Bool
(CreateComponent -> CreateComponent -> Bool)
-> (CreateComponent -> CreateComponent -> Bool)
-> Eq CreateComponent
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateComponent -> CreateComponent -> Bool
$c/= :: CreateComponent -> CreateComponent -> Bool
== :: CreateComponent -> CreateComponent -> Bool
$c== :: CreateComponent -> CreateComponent -> Bool
Prelude.Eq, ReadPrec [CreateComponent]
ReadPrec CreateComponent
Int -> ReadS CreateComponent
ReadS [CreateComponent]
(Int -> ReadS CreateComponent)
-> ReadS [CreateComponent]
-> ReadPrec CreateComponent
-> ReadPrec [CreateComponent]
-> Read CreateComponent
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateComponent]
$creadListPrec :: ReadPrec [CreateComponent]
readPrec :: ReadPrec CreateComponent
$creadPrec :: ReadPrec CreateComponent
readList :: ReadS [CreateComponent]
$creadList :: ReadS [CreateComponent]
readsPrec :: Int -> ReadS CreateComponent
$creadsPrec :: Int -> ReadS CreateComponent
Prelude.Read, Int -> CreateComponent -> ShowS
[CreateComponent] -> ShowS
CreateComponent -> String
(Int -> CreateComponent -> ShowS)
-> (CreateComponent -> String)
-> ([CreateComponent] -> ShowS)
-> Show CreateComponent
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateComponent] -> ShowS
$cshowList :: [CreateComponent] -> ShowS
show :: CreateComponent -> String
$cshow :: CreateComponent -> String
showsPrec :: Int -> CreateComponent -> ShowS
$cshowsPrec :: Int -> CreateComponent -> ShowS
Prelude.Show, (forall x. CreateComponent -> Rep CreateComponent x)
-> (forall x. Rep CreateComponent x -> CreateComponent)
-> Generic CreateComponent
forall x. Rep CreateComponent x -> CreateComponent
forall x. CreateComponent -> Rep CreateComponent x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateComponent x -> CreateComponent
$cfrom :: forall x. CreateComponent -> Rep CreateComponent x
Prelude.Generic)

-- |
-- Create a value of 'CreateComponent' 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:
--
-- 'data'', 'createComponent_data' - The data of the component. Used to specify the data inline. Either
-- @data@ or @uri@ can be used to specify the data within the component.
--
-- 'supportedOsVersions', 'createComponent_supportedOsVersions' - The operating system (OS) version supported by the component. If the OS
-- information is available, a prefix match is performed against the base
-- image OS version during image recipe creation.
--
-- 'uri', 'createComponent_uri' - The uri of the component. Must be an Amazon S3 URL and the requester
-- must have permission to access the Amazon S3 bucket. If you use Amazon
-- S3, you can specify component content up to your service quota. Either
-- @data@ or @uri@ can be used to specify the data within the component.
--
-- 'kmsKeyId', 'createComponent_kmsKeyId' - The ID of the KMS key that should be used to encrypt this component.
--
-- 'changeDescription', 'createComponent_changeDescription' - The change description of the component. Describes what change has been
-- made in this version, or what makes this version different from other
-- versions of this component.
--
-- 'description', 'createComponent_description' - The description of the component. Describes the contents of the
-- component.
--
-- 'tags', 'createComponent_tags' - The tags of the component.
--
-- 'name', 'createComponent_name' - The name of the component.
--
-- 'semanticVersion', 'createComponent_semanticVersion' - The semantic version of the component. This version follows the semantic
-- version syntax.
--
-- The semantic version has four nodes:
-- \<major>.\<minor>.\<patch>\/\<build>. You can assign values for the
-- first three, and can filter on all of them.
--
-- __Assignment:__ For the first three nodes you can assign any positive
-- integer value, including zero, with an upper limit of 2^30-1, or
-- 1073741823 for each node. Image Builder automatically assigns the build
-- number to the fourth node.
--
-- __Patterns:__ You can use any numeric pattern that adheres to the
-- assignment requirements for the nodes that you can assign. For example,
-- you might choose a software version pattern, such as 1.0.0, or a date,
-- such as 2021.01.01.
--
-- 'platform', 'createComponent_platform' - The platform of the component.
--
-- 'clientToken', 'createComponent_clientToken' - The idempotency token of the component.
newCreateComponent ::
  -- | 'name'
  Prelude.Text ->
  -- | 'semanticVersion'
  Prelude.Text ->
  -- | 'platform'
  Platform ->
  -- | 'clientToken'
  Prelude.Text ->
  CreateComponent
newCreateComponent :: Text -> Text -> Platform -> Text -> CreateComponent
newCreateComponent
  Text
pName_
  Text
pSemanticVersion_
  Platform
pPlatform_
  Text
pClientToken_ =
    CreateComponent' :: Maybe Text
-> Maybe (NonEmpty Text)
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe (HashMap Text Text)
-> Text
-> Text
-> Platform
-> Text
-> CreateComponent
CreateComponent'
      { $sel:data':CreateComponent' :: Maybe Text
data' = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:supportedOsVersions:CreateComponent' :: Maybe (NonEmpty Text)
supportedOsVersions = Maybe (NonEmpty Text)
forall a. Maybe a
Prelude.Nothing,
        $sel:uri:CreateComponent' :: Maybe Text
uri = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:kmsKeyId:CreateComponent' :: Maybe Text
kmsKeyId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:changeDescription:CreateComponent' :: Maybe Text
changeDescription = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:description:CreateComponent' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:tags:CreateComponent' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing,
        $sel:name:CreateComponent' :: Text
name = Text
pName_,
        $sel:semanticVersion:CreateComponent' :: Text
semanticVersion = Text
pSemanticVersion_,
        $sel:platform:CreateComponent' :: Platform
platform = Platform
pPlatform_,
        $sel:clientToken:CreateComponent' :: Text
clientToken = Text
pClientToken_
      }

-- | The data of the component. Used to specify the data inline. Either
-- @data@ or @uri@ can be used to specify the data within the component.
createComponent_data :: Lens.Lens' CreateComponent (Prelude.Maybe Prelude.Text)
createComponent_data :: (Maybe Text -> f (Maybe Text))
-> CreateComponent -> f CreateComponent
createComponent_data = (CreateComponent -> Maybe Text)
-> (CreateComponent -> Maybe Text -> CreateComponent)
-> Lens CreateComponent CreateComponent (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateComponent' {Maybe Text
data' :: Maybe Text
$sel:data':CreateComponent' :: CreateComponent -> Maybe Text
data'} -> Maybe Text
data') (\s :: CreateComponent
s@CreateComponent' {} Maybe Text
a -> CreateComponent
s {$sel:data':CreateComponent' :: Maybe Text
data' = Maybe Text
a} :: CreateComponent)

-- | The operating system (OS) version supported by the component. If the OS
-- information is available, a prefix match is performed against the base
-- image OS version during image recipe creation.
createComponent_supportedOsVersions :: Lens.Lens' CreateComponent (Prelude.Maybe (Prelude.NonEmpty Prelude.Text))
createComponent_supportedOsVersions :: (Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> CreateComponent -> f CreateComponent
createComponent_supportedOsVersions = (CreateComponent -> Maybe (NonEmpty Text))
-> (CreateComponent -> Maybe (NonEmpty Text) -> CreateComponent)
-> Lens
     CreateComponent
     CreateComponent
     (Maybe (NonEmpty Text))
     (Maybe (NonEmpty Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateComponent' {Maybe (NonEmpty Text)
supportedOsVersions :: Maybe (NonEmpty Text)
$sel:supportedOsVersions:CreateComponent' :: CreateComponent -> Maybe (NonEmpty Text)
supportedOsVersions} -> Maybe (NonEmpty Text)
supportedOsVersions) (\s :: CreateComponent
s@CreateComponent' {} Maybe (NonEmpty Text)
a -> CreateComponent
s {$sel:supportedOsVersions:CreateComponent' :: Maybe (NonEmpty Text)
supportedOsVersions = Maybe (NonEmpty Text)
a} :: CreateComponent) ((Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
 -> CreateComponent -> f CreateComponent)
-> ((Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
    -> Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> (Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> CreateComponent
-> f CreateComponent
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (NonEmpty Text) (NonEmpty Text) (NonEmpty Text) (NonEmpty Text)
-> Iso
     (Maybe (NonEmpty Text))
     (Maybe (NonEmpty Text))
     (Maybe (NonEmpty Text))
     (Maybe (NonEmpty 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
  (NonEmpty Text) (NonEmpty Text) (NonEmpty Text) (NonEmpty Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The uri of the component. Must be an Amazon S3 URL and the requester
-- must have permission to access the Amazon S3 bucket. If you use Amazon
-- S3, you can specify component content up to your service quota. Either
-- @data@ or @uri@ can be used to specify the data within the component.
createComponent_uri :: Lens.Lens' CreateComponent (Prelude.Maybe Prelude.Text)
createComponent_uri :: (Maybe Text -> f (Maybe Text))
-> CreateComponent -> f CreateComponent
createComponent_uri = (CreateComponent -> Maybe Text)
-> (CreateComponent -> Maybe Text -> CreateComponent)
-> Lens CreateComponent CreateComponent (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateComponent' {Maybe Text
uri :: Maybe Text
$sel:uri:CreateComponent' :: CreateComponent -> Maybe Text
uri} -> Maybe Text
uri) (\s :: CreateComponent
s@CreateComponent' {} Maybe Text
a -> CreateComponent
s {$sel:uri:CreateComponent' :: Maybe Text
uri = Maybe Text
a} :: CreateComponent)

-- | The ID of the KMS key that should be used to encrypt this component.
createComponent_kmsKeyId :: Lens.Lens' CreateComponent (Prelude.Maybe Prelude.Text)
createComponent_kmsKeyId :: (Maybe Text -> f (Maybe Text))
-> CreateComponent -> f CreateComponent
createComponent_kmsKeyId = (CreateComponent -> Maybe Text)
-> (CreateComponent -> Maybe Text -> CreateComponent)
-> Lens CreateComponent CreateComponent (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateComponent' {Maybe Text
kmsKeyId :: Maybe Text
$sel:kmsKeyId:CreateComponent' :: CreateComponent -> Maybe Text
kmsKeyId} -> Maybe Text
kmsKeyId) (\s :: CreateComponent
s@CreateComponent' {} Maybe Text
a -> CreateComponent
s {$sel:kmsKeyId:CreateComponent' :: Maybe Text
kmsKeyId = Maybe Text
a} :: CreateComponent)

-- | The change description of the component. Describes what change has been
-- made in this version, or what makes this version different from other
-- versions of this component.
createComponent_changeDescription :: Lens.Lens' CreateComponent (Prelude.Maybe Prelude.Text)
createComponent_changeDescription :: (Maybe Text -> f (Maybe Text))
-> CreateComponent -> f CreateComponent
createComponent_changeDescription = (CreateComponent -> Maybe Text)
-> (CreateComponent -> Maybe Text -> CreateComponent)
-> Lens CreateComponent CreateComponent (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateComponent' {Maybe Text
changeDescription :: Maybe Text
$sel:changeDescription:CreateComponent' :: CreateComponent -> Maybe Text
changeDescription} -> Maybe Text
changeDescription) (\s :: CreateComponent
s@CreateComponent' {} Maybe Text
a -> CreateComponent
s {$sel:changeDescription:CreateComponent' :: Maybe Text
changeDescription = Maybe Text
a} :: CreateComponent)

-- | The description of the component. Describes the contents of the
-- component.
createComponent_description :: Lens.Lens' CreateComponent (Prelude.Maybe Prelude.Text)
createComponent_description :: (Maybe Text -> f (Maybe Text))
-> CreateComponent -> f CreateComponent
createComponent_description = (CreateComponent -> Maybe Text)
-> (CreateComponent -> Maybe Text -> CreateComponent)
-> Lens CreateComponent CreateComponent (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateComponent' {Maybe Text
description :: Maybe Text
$sel:description:CreateComponent' :: CreateComponent -> Maybe Text
description} -> Maybe Text
description) (\s :: CreateComponent
s@CreateComponent' {} Maybe Text
a -> CreateComponent
s {$sel:description:CreateComponent' :: Maybe Text
description = Maybe Text
a} :: CreateComponent)

-- | The tags of the component.
createComponent_tags :: Lens.Lens' CreateComponent (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
createComponent_tags :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> CreateComponent -> f CreateComponent
createComponent_tags = (CreateComponent -> Maybe (HashMap Text Text))
-> (CreateComponent
    -> Maybe (HashMap Text Text) -> CreateComponent)
-> Lens
     CreateComponent
     CreateComponent
     (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 (\CreateComponent' {Maybe (HashMap Text Text)
tags :: Maybe (HashMap Text Text)
$sel:tags:CreateComponent' :: CreateComponent -> Maybe (HashMap Text Text)
tags} -> Maybe (HashMap Text Text)
tags) (\s :: CreateComponent
s@CreateComponent' {} Maybe (HashMap Text Text)
a -> CreateComponent
s {$sel:tags:CreateComponent' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
a} :: CreateComponent) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
 -> CreateComponent -> f CreateComponent)
-> ((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)))
-> CreateComponent
-> f CreateComponent
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 name of the component.
createComponent_name :: Lens.Lens' CreateComponent Prelude.Text
createComponent_name :: (Text -> f Text) -> CreateComponent -> f CreateComponent
createComponent_name = (CreateComponent -> Text)
-> (CreateComponent -> Text -> CreateComponent)
-> Lens CreateComponent CreateComponent Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateComponent' {Text
name :: Text
$sel:name:CreateComponent' :: CreateComponent -> Text
name} -> Text
name) (\s :: CreateComponent
s@CreateComponent' {} Text
a -> CreateComponent
s {$sel:name:CreateComponent' :: Text
name = Text
a} :: CreateComponent)

-- | The semantic version of the component. This version follows the semantic
-- version syntax.
--
-- The semantic version has four nodes:
-- \<major>.\<minor>.\<patch>\/\<build>. You can assign values for the
-- first three, and can filter on all of them.
--
-- __Assignment:__ For the first three nodes you can assign any positive
-- integer value, including zero, with an upper limit of 2^30-1, or
-- 1073741823 for each node. Image Builder automatically assigns the build
-- number to the fourth node.
--
-- __Patterns:__ You can use any numeric pattern that adheres to the
-- assignment requirements for the nodes that you can assign. For example,
-- you might choose a software version pattern, such as 1.0.0, or a date,
-- such as 2021.01.01.
createComponent_semanticVersion :: Lens.Lens' CreateComponent Prelude.Text
createComponent_semanticVersion :: (Text -> f Text) -> CreateComponent -> f CreateComponent
createComponent_semanticVersion = (CreateComponent -> Text)
-> (CreateComponent -> Text -> CreateComponent)
-> Lens CreateComponent CreateComponent Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateComponent' {Text
semanticVersion :: Text
$sel:semanticVersion:CreateComponent' :: CreateComponent -> Text
semanticVersion} -> Text
semanticVersion) (\s :: CreateComponent
s@CreateComponent' {} Text
a -> CreateComponent
s {$sel:semanticVersion:CreateComponent' :: Text
semanticVersion = Text
a} :: CreateComponent)

-- | The platform of the component.
createComponent_platform :: Lens.Lens' CreateComponent Platform
createComponent_platform :: (Platform -> f Platform) -> CreateComponent -> f CreateComponent
createComponent_platform = (CreateComponent -> Platform)
-> (CreateComponent -> Platform -> CreateComponent)
-> Lens CreateComponent CreateComponent Platform Platform
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateComponent' {Platform
platform :: Platform
$sel:platform:CreateComponent' :: CreateComponent -> Platform
platform} -> Platform
platform) (\s :: CreateComponent
s@CreateComponent' {} Platform
a -> CreateComponent
s {$sel:platform:CreateComponent' :: Platform
platform = Platform
a} :: CreateComponent)

-- | The idempotency token of the component.
createComponent_clientToken :: Lens.Lens' CreateComponent Prelude.Text
createComponent_clientToken :: (Text -> f Text) -> CreateComponent -> f CreateComponent
createComponent_clientToken = (CreateComponent -> Text)
-> (CreateComponent -> Text -> CreateComponent)
-> Lens CreateComponent CreateComponent Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateComponent' {Text
clientToken :: Text
$sel:clientToken:CreateComponent' :: CreateComponent -> Text
clientToken} -> Text
clientToken) (\s :: CreateComponent
s@CreateComponent' {} Text
a -> CreateComponent
s {$sel:clientToken:CreateComponent' :: Text
clientToken = Text
a} :: CreateComponent)

instance Core.AWSRequest CreateComponent where
  type
    AWSResponse CreateComponent =
      CreateComponentResponse
  request :: CreateComponent -> Request CreateComponent
request = Service -> CreateComponent -> Request CreateComponent
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.putJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy CreateComponent
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateComponent)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse CreateComponent))
-> Logger
-> Service
-> Proxy CreateComponent
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateComponent)))
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 -> CreateComponentResponse
CreateComponentResponse'
            (Maybe Text
 -> Maybe Text -> Maybe Text -> Int -> CreateComponentResponse)
-> Either String (Maybe Text)
-> Either
     String (Maybe Text -> Maybe Text -> Int -> CreateComponentResponse)
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 -> CreateComponentResponse)
-> Either String (Maybe Text)
-> Either String (Maybe Text -> Int -> CreateComponentResponse)
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 -> CreateComponentResponse)
-> Either String (Maybe Text)
-> Either String (Int -> CreateComponentResponse)
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
"componentBuildVersionArn")
            Either String (Int -> CreateComponentResponse)
-> Either String Int -> Either String CreateComponentResponse
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 CreateComponent

instance Prelude.NFData CreateComponent

instance Core.ToHeaders CreateComponent where
  toHeaders :: CreateComponent -> ResponseHeaders
toHeaders =
    ResponseHeaders -> CreateComponent -> 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 CreateComponent where
  toJSON :: CreateComponent -> Value
toJSON CreateComponent' {Maybe (NonEmpty Text)
Maybe Text
Maybe (HashMap Text Text)
Text
Platform
clientToken :: Text
platform :: Platform
semanticVersion :: Text
name :: Text
tags :: Maybe (HashMap Text Text)
description :: Maybe Text
changeDescription :: Maybe Text
kmsKeyId :: Maybe Text
uri :: Maybe Text
supportedOsVersions :: Maybe (NonEmpty Text)
data' :: Maybe Text
$sel:clientToken:CreateComponent' :: CreateComponent -> Text
$sel:platform:CreateComponent' :: CreateComponent -> Platform
$sel:semanticVersion:CreateComponent' :: CreateComponent -> Text
$sel:name:CreateComponent' :: CreateComponent -> Text
$sel:tags:CreateComponent' :: CreateComponent -> Maybe (HashMap Text Text)
$sel:description:CreateComponent' :: CreateComponent -> Maybe Text
$sel:changeDescription:CreateComponent' :: CreateComponent -> Maybe Text
$sel:kmsKeyId:CreateComponent' :: CreateComponent -> Maybe Text
$sel:uri:CreateComponent' :: CreateComponent -> Maybe Text
$sel:supportedOsVersions:CreateComponent' :: CreateComponent -> Maybe (NonEmpty Text)
$sel:data':CreateComponent' :: CreateComponent -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"data" 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
data',
            (Text
"supportedOsVersions" Text -> NonEmpty Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (NonEmpty Text -> Pair) -> Maybe (NonEmpty Text) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (NonEmpty Text)
supportedOsVersions,
            (Text
"uri" 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
uri,
            (Text
"kmsKeyId" 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
kmsKeyId,
            (Text
"changeDescription" 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
changeDescription,
            (Text
"description" 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
description,
            (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
"name" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
name),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"semanticVersion" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
semanticVersion),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"platform" Text -> Platform -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Platform
platform),
            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 CreateComponent where
  toPath :: CreateComponent -> ByteString
toPath = ByteString -> CreateComponent -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/CreateComponent"

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

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

-- |
-- Create a value of 'CreateComponentResponse' 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', 'createComponentResponse_requestId' - The request ID that uniquely identifies this request.
--
-- 'clientToken', 'createComponentResponse_clientToken' - The idempotency token used to make this request idempotent.
--
-- 'componentBuildVersionArn', 'createComponentResponse_componentBuildVersionArn' - The Amazon Resource Name (ARN) of the component that was created by this
-- request.
--
-- 'httpStatus', 'createComponentResponse_httpStatus' - The response's http status code.
newCreateComponentResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  CreateComponentResponse
newCreateComponentResponse :: Int -> CreateComponentResponse
newCreateComponentResponse Int
pHttpStatus_ =
  CreateComponentResponse' :: Maybe Text
-> Maybe Text -> Maybe Text -> Int -> CreateComponentResponse
CreateComponentResponse'
    { $sel:requestId:CreateComponentResponse' :: Maybe Text
requestId =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:clientToken:CreateComponentResponse' :: Maybe Text
clientToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:componentBuildVersionArn:CreateComponentResponse' :: Maybe Text
componentBuildVersionArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:CreateComponentResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

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

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

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

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

instance Prelude.NFData CreateComponentResponse