{-# 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.Proton.CreateComponent
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Create an Proton component. A component is an infrastructure extension
-- for a service instance.
--
-- For more information about components, see
-- <https://docs.aws.amazon.com/proton/latest/userguide/ag-components.html Proton components>
-- in the /Proton User Guide/.
module Amazonka.Proton.CreateComponent
  ( -- * Creating a Request
    CreateComponent (..),
    newCreateComponent,

    -- * Request Lenses
    createComponent_description,
    createComponent_environmentName,
    createComponent_serviceInstanceName,
    createComponent_serviceName,
    createComponent_serviceSpec,
    createComponent_tags,
    createComponent_manifest,
    createComponent_name,
    createComponent_templateFile,

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

    -- * Response Lenses
    createComponentResponse_httpStatus,
    createComponentResponse_component,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
import Amazonka.Proton.Types
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newCreateComponent' smart constructor.
data CreateComponent = CreateComponent'
  { -- | An optional customer-provided description of the component.
    CreateComponent -> Maybe (Sensitive Text)
description :: Prelude.Maybe (Data.Sensitive Prelude.Text),
    -- | The name of the Proton environment that you want to associate this
    -- component with. You must specify this when you don\'t specify
    -- @serviceInstanceName@ and @serviceName@.
    CreateComponent -> Maybe Text
environmentName :: Prelude.Maybe Prelude.Text,
    -- | The name of the service instance that you want to attach this component
    -- to. If you don\'t specify this, the component isn\'t attached to any
    -- service instance. Specify both @serviceInstanceName@ and @serviceName@
    -- or neither of them.
    CreateComponent -> Maybe Text
serviceInstanceName :: Prelude.Maybe Prelude.Text,
    -- | The name of the service that @serviceInstanceName@ is associated with.
    -- If you don\'t specify this, the component isn\'t attached to any service
    -- instance. Specify both @serviceInstanceName@ and @serviceName@ or
    -- neither of them.
    CreateComponent -> Maybe Text
serviceName :: Prelude.Maybe Prelude.Text,
    -- | The service spec that you want the component to use to access service
    -- inputs. Set this only when you attach the component to a service
    -- instance.
    CreateComponent -> Maybe (Sensitive Text)
serviceSpec :: Prelude.Maybe (Data.Sensitive Prelude.Text),
    -- | An optional list of metadata items that you can associate with the
    -- Proton component. A tag is a key-value pair.
    --
    -- For more information, see
    -- <https://docs.aws.amazon.com/proton/latest/userguide/resources.html Proton resources and tagging>
    -- in the /Proton User Guide/.
    CreateComponent -> Maybe [Tag]
tags :: Prelude.Maybe [Tag],
    -- | A path to a manifest file that lists the Infrastructure as Code (IaC)
    -- file, template language, and rendering engine for infrastructure that a
    -- custom component provisions.
    CreateComponent -> Sensitive Text
manifest :: Data.Sensitive Prelude.Text,
    -- | The customer-provided name of the component.
    CreateComponent -> Text
name :: Prelude.Text,
    -- | A path to the Infrastructure as Code (IaC) file describing
    -- infrastructure that a custom component provisions.
    --
    -- Components support a single IaC file, even if you use Terraform as your
    -- template language.
    CreateComponent -> Sensitive Text
templateFile :: Data.Sensitive Prelude.Text
  }
  deriving (CreateComponent -> CreateComponent -> Bool
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, Int -> CreateComponent -> ShowS
[CreateComponent] -> ShowS
CreateComponent -> String
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. 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:
--
-- 'description', 'createComponent_description' - An optional customer-provided description of the component.
--
-- 'environmentName', 'createComponent_environmentName' - The name of the Proton environment that you want to associate this
-- component with. You must specify this when you don\'t specify
-- @serviceInstanceName@ and @serviceName@.
--
-- 'serviceInstanceName', 'createComponent_serviceInstanceName' - The name of the service instance that you want to attach this component
-- to. If you don\'t specify this, the component isn\'t attached to any
-- service instance. Specify both @serviceInstanceName@ and @serviceName@
-- or neither of them.
--
-- 'serviceName', 'createComponent_serviceName' - The name of the service that @serviceInstanceName@ is associated with.
-- If you don\'t specify this, the component isn\'t attached to any service
-- instance. Specify both @serviceInstanceName@ and @serviceName@ or
-- neither of them.
--
-- 'serviceSpec', 'createComponent_serviceSpec' - The service spec that you want the component to use to access service
-- inputs. Set this only when you attach the component to a service
-- instance.
--
-- 'tags', 'createComponent_tags' - An optional list of metadata items that you can associate with the
-- Proton component. A tag is a key-value pair.
--
-- For more information, see
-- <https://docs.aws.amazon.com/proton/latest/userguide/resources.html Proton resources and tagging>
-- in the /Proton User Guide/.
--
-- 'manifest', 'createComponent_manifest' - A path to a manifest file that lists the Infrastructure as Code (IaC)
-- file, template language, and rendering engine for infrastructure that a
-- custom component provisions.
--
-- 'name', 'createComponent_name' - The customer-provided name of the component.
--
-- 'templateFile', 'createComponent_templateFile' - A path to the Infrastructure as Code (IaC) file describing
-- infrastructure that a custom component provisions.
--
-- Components support a single IaC file, even if you use Terraform as your
-- template language.
newCreateComponent ::
  -- | 'manifest'
  Prelude.Text ->
  -- | 'name'
  Prelude.Text ->
  -- | 'templateFile'
  Prelude.Text ->
  CreateComponent
newCreateComponent :: Text -> Text -> Text -> CreateComponent
newCreateComponent Text
pManifest_ Text
pName_ Text
pTemplateFile_ =
  CreateComponent'
    { $sel:description:CreateComponent' :: Maybe (Sensitive Text)
description = forall a. Maybe a
Prelude.Nothing,
      $sel:environmentName:CreateComponent' :: Maybe Text
environmentName = forall a. Maybe a
Prelude.Nothing,
      $sel:serviceInstanceName:CreateComponent' :: Maybe Text
serviceInstanceName = forall a. Maybe a
Prelude.Nothing,
      $sel:serviceName:CreateComponent' :: Maybe Text
serviceName = forall a. Maybe a
Prelude.Nothing,
      $sel:serviceSpec:CreateComponent' :: Maybe (Sensitive Text)
serviceSpec = forall a. Maybe a
Prelude.Nothing,
      $sel:tags:CreateComponent' :: Maybe [Tag]
tags = forall a. Maybe a
Prelude.Nothing,
      $sel:manifest:CreateComponent' :: Sensitive Text
manifest = forall a. Iso' (Sensitive a) a
Data._Sensitive forall t b. AReview t b -> b -> t
Lens.# Text
pManifest_,
      $sel:name:CreateComponent' :: Text
name = Text
pName_,
      $sel:templateFile:CreateComponent' :: Sensitive Text
templateFile = forall a. Iso' (Sensitive a) a
Data._Sensitive forall t b. AReview t b -> b -> t
Lens.# Text
pTemplateFile_
    }

-- | An optional customer-provided description of the component.
createComponent_description :: Lens.Lens' CreateComponent (Prelude.Maybe Prelude.Text)
createComponent_description :: Lens' CreateComponent (Maybe Text)
createComponent_description = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateComponent' {Maybe (Sensitive Text)
description :: Maybe (Sensitive Text)
$sel:description:CreateComponent' :: CreateComponent -> Maybe (Sensitive Text)
description} -> Maybe (Sensitive Text)
description) (\s :: CreateComponent
s@CreateComponent' {} Maybe (Sensitive Text)
a -> CreateComponent
s {$sel:description:CreateComponent' :: Maybe (Sensitive Text)
description = Maybe (Sensitive Text)
a} :: CreateComponent) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall a. Iso' (Sensitive a) a
Data._Sensitive

-- | The name of the Proton environment that you want to associate this
-- component with. You must specify this when you don\'t specify
-- @serviceInstanceName@ and @serviceName@.
createComponent_environmentName :: Lens.Lens' CreateComponent (Prelude.Maybe Prelude.Text)
createComponent_environmentName :: Lens' CreateComponent (Maybe Text)
createComponent_environmentName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateComponent' {Maybe Text
environmentName :: Maybe Text
$sel:environmentName:CreateComponent' :: CreateComponent -> Maybe Text
environmentName} -> Maybe Text
environmentName) (\s :: CreateComponent
s@CreateComponent' {} Maybe Text
a -> CreateComponent
s {$sel:environmentName:CreateComponent' :: Maybe Text
environmentName = Maybe Text
a} :: CreateComponent)

-- | The name of the service instance that you want to attach this component
-- to. If you don\'t specify this, the component isn\'t attached to any
-- service instance. Specify both @serviceInstanceName@ and @serviceName@
-- or neither of them.
createComponent_serviceInstanceName :: Lens.Lens' CreateComponent (Prelude.Maybe Prelude.Text)
createComponent_serviceInstanceName :: Lens' CreateComponent (Maybe Text)
createComponent_serviceInstanceName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateComponent' {Maybe Text
serviceInstanceName :: Maybe Text
$sel:serviceInstanceName:CreateComponent' :: CreateComponent -> Maybe Text
serviceInstanceName} -> Maybe Text
serviceInstanceName) (\s :: CreateComponent
s@CreateComponent' {} Maybe Text
a -> CreateComponent
s {$sel:serviceInstanceName:CreateComponent' :: Maybe Text
serviceInstanceName = Maybe Text
a} :: CreateComponent)

-- | The name of the service that @serviceInstanceName@ is associated with.
-- If you don\'t specify this, the component isn\'t attached to any service
-- instance. Specify both @serviceInstanceName@ and @serviceName@ or
-- neither of them.
createComponent_serviceName :: Lens.Lens' CreateComponent (Prelude.Maybe Prelude.Text)
createComponent_serviceName :: Lens' CreateComponent (Maybe Text)
createComponent_serviceName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateComponent' {Maybe Text
serviceName :: Maybe Text
$sel:serviceName:CreateComponent' :: CreateComponent -> Maybe Text
serviceName} -> Maybe Text
serviceName) (\s :: CreateComponent
s@CreateComponent' {} Maybe Text
a -> CreateComponent
s {$sel:serviceName:CreateComponent' :: Maybe Text
serviceName = Maybe Text
a} :: CreateComponent)

-- | The service spec that you want the component to use to access service
-- inputs. Set this only when you attach the component to a service
-- instance.
createComponent_serviceSpec :: Lens.Lens' CreateComponent (Prelude.Maybe Prelude.Text)
createComponent_serviceSpec :: Lens' CreateComponent (Maybe Text)
createComponent_serviceSpec = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateComponent' {Maybe (Sensitive Text)
serviceSpec :: Maybe (Sensitive Text)
$sel:serviceSpec:CreateComponent' :: CreateComponent -> Maybe (Sensitive Text)
serviceSpec} -> Maybe (Sensitive Text)
serviceSpec) (\s :: CreateComponent
s@CreateComponent' {} Maybe (Sensitive Text)
a -> CreateComponent
s {$sel:serviceSpec:CreateComponent' :: Maybe (Sensitive Text)
serviceSpec = Maybe (Sensitive Text)
a} :: CreateComponent) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall a. Iso' (Sensitive a) a
Data._Sensitive

-- | An optional list of metadata items that you can associate with the
-- Proton component. A tag is a key-value pair.
--
-- For more information, see
-- <https://docs.aws.amazon.com/proton/latest/userguide/resources.html Proton resources and tagging>
-- in the /Proton User Guide/.
createComponent_tags :: Lens.Lens' CreateComponent (Prelude.Maybe [Tag])
createComponent_tags :: Lens' CreateComponent (Maybe [Tag])
createComponent_tags = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateComponent' {Maybe [Tag]
tags :: Maybe [Tag]
$sel:tags:CreateComponent' :: CreateComponent -> Maybe [Tag]
tags} -> Maybe [Tag]
tags) (\s :: CreateComponent
s@CreateComponent' {} Maybe [Tag]
a -> CreateComponent
s {$sel:tags:CreateComponent' :: Maybe [Tag]
tags = Maybe [Tag]
a} :: CreateComponent) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | A path to a manifest file that lists the Infrastructure as Code (IaC)
-- file, template language, and rendering engine for infrastructure that a
-- custom component provisions.
createComponent_manifest :: Lens.Lens' CreateComponent Prelude.Text
createComponent_manifest :: Lens' CreateComponent Text
createComponent_manifest = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateComponent' {Sensitive Text
manifest :: Sensitive Text
$sel:manifest:CreateComponent' :: CreateComponent -> Sensitive Text
manifest} -> Sensitive Text
manifest) (\s :: CreateComponent
s@CreateComponent' {} Sensitive Text
a -> CreateComponent
s {$sel:manifest:CreateComponent' :: Sensitive Text
manifest = Sensitive Text
a} :: CreateComponent) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a. Iso' (Sensitive a) a
Data._Sensitive

-- | The customer-provided name of the component.
createComponent_name :: Lens.Lens' CreateComponent Prelude.Text
createComponent_name :: Lens' CreateComponent Text
createComponent_name = 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)

-- | A path to the Infrastructure as Code (IaC) file describing
-- infrastructure that a custom component provisions.
--
-- Components support a single IaC file, even if you use Terraform as your
-- template language.
createComponent_templateFile :: Lens.Lens' CreateComponent Prelude.Text
createComponent_templateFile :: Lens' CreateComponent Text
createComponent_templateFile = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateComponent' {Sensitive Text
templateFile :: Sensitive Text
$sel:templateFile:CreateComponent' :: CreateComponent -> Sensitive Text
templateFile} -> Sensitive Text
templateFile) (\s :: CreateComponent
s@CreateComponent' {} Sensitive Text
a -> CreateComponent
s {$sel:templateFile:CreateComponent' :: Sensitive Text
templateFile = Sensitive Text
a} :: CreateComponent) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a. Iso' (Sensitive a) a
Data._Sensitive

instance Core.AWSRequest CreateComponent where
  type
    AWSResponse CreateComponent =
      CreateComponentResponse
  request :: (Service -> Service) -> CreateComponent -> Request CreateComponent
request Service -> Service
overrides =
    forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy CreateComponent
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateComponent)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Int -> Component -> CreateComponentResponse
CreateComponentResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String a
Data..:> Key
"component")
      )

instance Prelude.Hashable CreateComponent where
  hashWithSalt :: Int -> CreateComponent -> Int
hashWithSalt Int
_salt CreateComponent' {Maybe [Tag]
Maybe Text
Maybe (Sensitive Text)
Text
Sensitive Text
templateFile :: Sensitive Text
name :: Text
manifest :: Sensitive Text
tags :: Maybe [Tag]
serviceSpec :: Maybe (Sensitive Text)
serviceName :: Maybe Text
serviceInstanceName :: Maybe Text
environmentName :: Maybe Text
description :: Maybe (Sensitive Text)
$sel:templateFile:CreateComponent' :: CreateComponent -> Sensitive Text
$sel:name:CreateComponent' :: CreateComponent -> Text
$sel:manifest:CreateComponent' :: CreateComponent -> Sensitive Text
$sel:tags:CreateComponent' :: CreateComponent -> Maybe [Tag]
$sel:serviceSpec:CreateComponent' :: CreateComponent -> Maybe (Sensitive Text)
$sel:serviceName:CreateComponent' :: CreateComponent -> Maybe Text
$sel:serviceInstanceName:CreateComponent' :: CreateComponent -> Maybe Text
$sel:environmentName:CreateComponent' :: CreateComponent -> Maybe Text
$sel:description:CreateComponent' :: CreateComponent -> Maybe (Sensitive Text)
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (Sensitive Text)
description
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
environmentName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
serviceInstanceName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
serviceName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (Sensitive Text)
serviceSpec
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Tag]
tags
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Sensitive Text
manifest
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
name
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Sensitive Text
templateFile

instance Prelude.NFData CreateComponent where
  rnf :: CreateComponent -> ()
rnf CreateComponent' {Maybe [Tag]
Maybe Text
Maybe (Sensitive Text)
Text
Sensitive Text
templateFile :: Sensitive Text
name :: Text
manifest :: Sensitive Text
tags :: Maybe [Tag]
serviceSpec :: Maybe (Sensitive Text)
serviceName :: Maybe Text
serviceInstanceName :: Maybe Text
environmentName :: Maybe Text
description :: Maybe (Sensitive Text)
$sel:templateFile:CreateComponent' :: CreateComponent -> Sensitive Text
$sel:name:CreateComponent' :: CreateComponent -> Text
$sel:manifest:CreateComponent' :: CreateComponent -> Sensitive Text
$sel:tags:CreateComponent' :: CreateComponent -> Maybe [Tag]
$sel:serviceSpec:CreateComponent' :: CreateComponent -> Maybe (Sensitive Text)
$sel:serviceName:CreateComponent' :: CreateComponent -> Maybe Text
$sel:serviceInstanceName:CreateComponent' :: CreateComponent -> Maybe Text
$sel:environmentName:CreateComponent' :: CreateComponent -> Maybe Text
$sel:description:CreateComponent' :: CreateComponent -> Maybe (Sensitive Text)
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe (Sensitive Text)
description
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
environmentName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
serviceInstanceName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
serviceName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (Sensitive Text)
serviceSpec
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Tag]
tags
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Sensitive Text
manifest
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
name
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Sensitive Text
templateFile

instance Data.ToHeaders CreateComponent where
  toHeaders :: CreateComponent -> ResponseHeaders
toHeaders =
    forall a b. a -> b -> a
Prelude.const
      ( forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"AwsProton20200720.CreateComponent" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.0" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Data.ToJSON CreateComponent where
  toJSON :: CreateComponent -> Value
toJSON CreateComponent' {Maybe [Tag]
Maybe Text
Maybe (Sensitive Text)
Text
Sensitive Text
templateFile :: Sensitive Text
name :: Text
manifest :: Sensitive Text
tags :: Maybe [Tag]
serviceSpec :: Maybe (Sensitive Text)
serviceName :: Maybe Text
serviceInstanceName :: Maybe Text
environmentName :: Maybe Text
description :: Maybe (Sensitive Text)
$sel:templateFile:CreateComponent' :: CreateComponent -> Sensitive Text
$sel:name:CreateComponent' :: CreateComponent -> Text
$sel:manifest:CreateComponent' :: CreateComponent -> Sensitive Text
$sel:tags:CreateComponent' :: CreateComponent -> Maybe [Tag]
$sel:serviceSpec:CreateComponent' :: CreateComponent -> Maybe (Sensitive Text)
$sel:serviceName:CreateComponent' :: CreateComponent -> Maybe Text
$sel:serviceInstanceName:CreateComponent' :: CreateComponent -> Maybe Text
$sel:environmentName:CreateComponent' :: CreateComponent -> Maybe Text
$sel:description:CreateComponent' :: CreateComponent -> Maybe (Sensitive Text)
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"description" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (Sensitive Text)
description,
            (Key
"environmentName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
environmentName,
            (Key
"serviceInstanceName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
serviceInstanceName,
            (Key
"serviceName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
serviceName,
            (Key
"serviceSpec" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (Sensitive Text)
serviceSpec,
            (Key
"tags" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Tag]
tags,
            forall a. a -> Maybe a
Prelude.Just (Key
"manifest" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Sensitive Text
manifest),
            forall a. a -> Maybe a
Prelude.Just (Key
"name" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
name),
            forall a. a -> Maybe a
Prelude.Just (Key
"templateFile" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Sensitive Text
templateFile)
          ]
      )

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

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

-- | /See:/ 'newCreateComponentResponse' smart constructor.
data CreateComponentResponse = CreateComponentResponse'
  { -- | The response's http status code.
    CreateComponentResponse -> Int
httpStatus :: Prelude.Int,
    -- | The detailed data of the created component.
    CreateComponentResponse -> Component
component :: Component
  }
  deriving (CreateComponentResponse -> CreateComponentResponse -> Bool
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, Int -> CreateComponentResponse -> ShowS
[CreateComponentResponse] -> ShowS
CreateComponentResponse -> String
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. 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:
--
-- 'httpStatus', 'createComponentResponse_httpStatus' - The response's http status code.
--
-- 'component', 'createComponentResponse_component' - The detailed data of the created component.
newCreateComponentResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  -- | 'component'
  Component ->
  CreateComponentResponse
newCreateComponentResponse :: Int -> Component -> CreateComponentResponse
newCreateComponentResponse Int
pHttpStatus_ Component
pComponent_ =
  CreateComponentResponse'
    { $sel:httpStatus:CreateComponentResponse' :: Int
httpStatus = Int
pHttpStatus_,
      $sel:component:CreateComponentResponse' :: Component
component = Component
pComponent_
    }

-- | The response's http status code.
createComponentResponse_httpStatus :: Lens.Lens' CreateComponentResponse Prelude.Int
createComponentResponse_httpStatus :: Lens' CreateComponentResponse Int
createComponentResponse_httpStatus = 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)

-- | The detailed data of the created component.
createComponentResponse_component :: Lens.Lens' CreateComponentResponse Component
createComponentResponse_component :: Lens' CreateComponentResponse Component
createComponentResponse_component = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateComponentResponse' {Component
component :: Component
$sel:component:CreateComponentResponse' :: CreateComponentResponse -> Component
component} -> Component
component) (\s :: CreateComponentResponse
s@CreateComponentResponse' {} Component
a -> CreateComponentResponse
s {$sel:component:CreateComponentResponse' :: Component
component = Component
a} :: CreateComponentResponse)

instance Prelude.NFData CreateComponentResponse where
  rnf :: CreateComponentResponse -> ()
rnf CreateComponentResponse' {Int
Component
component :: Component
httpStatus :: Int
$sel:component:CreateComponentResponse' :: CreateComponentResponse -> Component
$sel:httpStatus:CreateComponentResponse' :: CreateComponentResponse -> Int
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Component
component