{-# 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.UpdateComponent
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Update a component.
--
-- There are a few modes for updating a component. The @deploymentType@
-- field defines the mode.
--
-- You can\'t update a component while its deployment status, or the
-- deployment status of a service instance attached to it, is
-- @IN_PROGRESS@.
--
-- 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.UpdateComponent
  ( -- * Creating a Request
    UpdateComponent (..),
    newUpdateComponent,

    -- * Request Lenses
    updateComponent_description,
    updateComponent_serviceInstanceName,
    updateComponent_serviceName,
    updateComponent_serviceSpec,
    updateComponent_templateFile,
    updateComponent_deploymentType,
    updateComponent_name,

    -- * Destructuring the Response
    UpdateComponentResponse (..),
    newUpdateComponentResponse,

    -- * Response Lenses
    updateComponentResponse_httpStatus,
    updateComponentResponse_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:/ 'newUpdateComponent' smart constructor.
data UpdateComponent = UpdateComponent'
  { -- | An optional customer-provided description of the component.
    UpdateComponent -> Maybe (Sensitive Text)
description :: Prelude.Maybe (Data.Sensitive Prelude.Text),
    -- | The name of the service instance that you want to attach this component
    -- to. Don\'t specify to keep the component\'s current service instance
    -- attachment. Specify an empty string to detach the component from the
    -- service instance it\'s attached to. Specify non-empty values for both
    -- @serviceInstanceName@ and @serviceName@ or for neither of them.
    UpdateComponent -> Maybe Text
serviceInstanceName :: Prelude.Maybe Prelude.Text,
    -- | The name of the service that @serviceInstanceName@ is associated with.
    -- Don\'t specify to keep the component\'s current service instance
    -- attachment. Specify an empty string to detach the component from the
    -- service instance it\'s attached to. Specify non-empty values for both
    -- @serviceInstanceName@ and @serviceName@ or for neither of them.
    UpdateComponent -> 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 the component is attached to a service
    -- instance.
    UpdateComponent -> Maybe (Sensitive Text)
serviceSpec :: Prelude.Maybe (Data.Sensitive 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.
    UpdateComponent -> Maybe (Sensitive Text)
templateFile :: Prelude.Maybe (Data.Sensitive Prelude.Text),
    -- | The deployment type. It defines the mode for updating a component, as
    -- follows:
    --
    -- []
    --     @NONE@
    --
    --     In this mode, a deployment /doesn\'t/ occur. Only the requested
    --     metadata parameters are updated. You can only specify @description@
    --     in this mode.
    --
    -- []
    --     @CURRENT_VERSION@
    --
    --     In this mode, the component is deployed and updated with the new
    --     @serviceSpec@, @templateSource@, and\/or @type@ that you provide.
    --     Only requested parameters are updated.
    UpdateComponent -> ComponentDeploymentUpdateType
deploymentType :: ComponentDeploymentUpdateType,
    -- | The name of the component to update.
    UpdateComponent -> Text
name :: Prelude.Text
  }
  deriving (UpdateComponent -> UpdateComponent -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateComponent -> UpdateComponent -> Bool
$c/= :: UpdateComponent -> UpdateComponent -> Bool
== :: UpdateComponent -> UpdateComponent -> Bool
$c== :: UpdateComponent -> UpdateComponent -> Bool
Prelude.Eq, Int -> UpdateComponent -> ShowS
[UpdateComponent] -> ShowS
UpdateComponent -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateComponent] -> ShowS
$cshowList :: [UpdateComponent] -> ShowS
show :: UpdateComponent -> String
$cshow :: UpdateComponent -> String
showsPrec :: Int -> UpdateComponent -> ShowS
$cshowsPrec :: Int -> UpdateComponent -> ShowS
Prelude.Show, forall x. Rep UpdateComponent x -> UpdateComponent
forall x. UpdateComponent -> Rep UpdateComponent x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateComponent x -> UpdateComponent
$cfrom :: forall x. UpdateComponent -> Rep UpdateComponent x
Prelude.Generic)

-- |
-- Create a value of 'UpdateComponent' 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', 'updateComponent_description' - An optional customer-provided description of the component.
--
-- 'serviceInstanceName', 'updateComponent_serviceInstanceName' - The name of the service instance that you want to attach this component
-- to. Don\'t specify to keep the component\'s current service instance
-- attachment. Specify an empty string to detach the component from the
-- service instance it\'s attached to. Specify non-empty values for both
-- @serviceInstanceName@ and @serviceName@ or for neither of them.
--
-- 'serviceName', 'updateComponent_serviceName' - The name of the service that @serviceInstanceName@ is associated with.
-- Don\'t specify to keep the component\'s current service instance
-- attachment. Specify an empty string to detach the component from the
-- service instance it\'s attached to. Specify non-empty values for both
-- @serviceInstanceName@ and @serviceName@ or for neither of them.
--
-- 'serviceSpec', 'updateComponent_serviceSpec' - The service spec that you want the component to use to access service
-- inputs. Set this only when the component is attached to a service
-- instance.
--
-- 'templateFile', 'updateComponent_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.
--
-- 'deploymentType', 'updateComponent_deploymentType' - The deployment type. It defines the mode for updating a component, as
-- follows:
--
-- []
--     @NONE@
--
--     In this mode, a deployment /doesn\'t/ occur. Only the requested
--     metadata parameters are updated. You can only specify @description@
--     in this mode.
--
-- []
--     @CURRENT_VERSION@
--
--     In this mode, the component is deployed and updated with the new
--     @serviceSpec@, @templateSource@, and\/or @type@ that you provide.
--     Only requested parameters are updated.
--
-- 'name', 'updateComponent_name' - The name of the component to update.
newUpdateComponent ::
  -- | 'deploymentType'
  ComponentDeploymentUpdateType ->
  -- | 'name'
  Prelude.Text ->
  UpdateComponent
newUpdateComponent :: ComponentDeploymentUpdateType -> Text -> UpdateComponent
newUpdateComponent ComponentDeploymentUpdateType
pDeploymentType_ Text
pName_ =
  UpdateComponent'
    { $sel:description:UpdateComponent' :: Maybe (Sensitive Text)
description = forall a. Maybe a
Prelude.Nothing,
      $sel:serviceInstanceName:UpdateComponent' :: Maybe Text
serviceInstanceName = forall a. Maybe a
Prelude.Nothing,
      $sel:serviceName:UpdateComponent' :: Maybe Text
serviceName = forall a. Maybe a
Prelude.Nothing,
      $sel:serviceSpec:UpdateComponent' :: Maybe (Sensitive Text)
serviceSpec = forall a. Maybe a
Prelude.Nothing,
      $sel:templateFile:UpdateComponent' :: Maybe (Sensitive Text)
templateFile = forall a. Maybe a
Prelude.Nothing,
      $sel:deploymentType:UpdateComponent' :: ComponentDeploymentUpdateType
deploymentType = ComponentDeploymentUpdateType
pDeploymentType_,
      $sel:name:UpdateComponent' :: Text
name = Text
pName_
    }

-- | An optional customer-provided description of the component.
updateComponent_description :: Lens.Lens' UpdateComponent (Prelude.Maybe Prelude.Text)
updateComponent_description :: Lens' UpdateComponent (Maybe Text)
updateComponent_description = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateComponent' {Maybe (Sensitive Text)
description :: Maybe (Sensitive Text)
$sel:description:UpdateComponent' :: UpdateComponent -> Maybe (Sensitive Text)
description} -> Maybe (Sensitive Text)
description) (\s :: UpdateComponent
s@UpdateComponent' {} Maybe (Sensitive Text)
a -> UpdateComponent
s {$sel:description:UpdateComponent' :: Maybe (Sensitive Text)
description = Maybe (Sensitive Text)
a} :: UpdateComponent) 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 service instance that you want to attach this component
-- to. Don\'t specify to keep the component\'s current service instance
-- attachment. Specify an empty string to detach the component from the
-- service instance it\'s attached to. Specify non-empty values for both
-- @serviceInstanceName@ and @serviceName@ or for neither of them.
updateComponent_serviceInstanceName :: Lens.Lens' UpdateComponent (Prelude.Maybe Prelude.Text)
updateComponent_serviceInstanceName :: Lens' UpdateComponent (Maybe Text)
updateComponent_serviceInstanceName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateComponent' {Maybe Text
serviceInstanceName :: Maybe Text
$sel:serviceInstanceName:UpdateComponent' :: UpdateComponent -> Maybe Text
serviceInstanceName} -> Maybe Text
serviceInstanceName) (\s :: UpdateComponent
s@UpdateComponent' {} Maybe Text
a -> UpdateComponent
s {$sel:serviceInstanceName:UpdateComponent' :: Maybe Text
serviceInstanceName = Maybe Text
a} :: UpdateComponent)

-- | The name of the service that @serviceInstanceName@ is associated with.
-- Don\'t specify to keep the component\'s current service instance
-- attachment. Specify an empty string to detach the component from the
-- service instance it\'s attached to. Specify non-empty values for both
-- @serviceInstanceName@ and @serviceName@ or for neither of them.
updateComponent_serviceName :: Lens.Lens' UpdateComponent (Prelude.Maybe Prelude.Text)
updateComponent_serviceName :: Lens' UpdateComponent (Maybe Text)
updateComponent_serviceName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateComponent' {Maybe Text
serviceName :: Maybe Text
$sel:serviceName:UpdateComponent' :: UpdateComponent -> Maybe Text
serviceName} -> Maybe Text
serviceName) (\s :: UpdateComponent
s@UpdateComponent' {} Maybe Text
a -> UpdateComponent
s {$sel:serviceName:UpdateComponent' :: Maybe Text
serviceName = Maybe Text
a} :: UpdateComponent)

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

-- | 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.
updateComponent_templateFile :: Lens.Lens' UpdateComponent (Prelude.Maybe Prelude.Text)
updateComponent_templateFile :: Lens' UpdateComponent (Maybe Text)
updateComponent_templateFile = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateComponent' {Maybe (Sensitive Text)
templateFile :: Maybe (Sensitive Text)
$sel:templateFile:UpdateComponent' :: UpdateComponent -> Maybe (Sensitive Text)
templateFile} -> Maybe (Sensitive Text)
templateFile) (\s :: UpdateComponent
s@UpdateComponent' {} Maybe (Sensitive Text)
a -> UpdateComponent
s {$sel:templateFile:UpdateComponent' :: Maybe (Sensitive Text)
templateFile = Maybe (Sensitive Text)
a} :: UpdateComponent) 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 deployment type. It defines the mode for updating a component, as
-- follows:
--
-- []
--     @NONE@
--
--     In this mode, a deployment /doesn\'t/ occur. Only the requested
--     metadata parameters are updated. You can only specify @description@
--     in this mode.
--
-- []
--     @CURRENT_VERSION@
--
--     In this mode, the component is deployed and updated with the new
--     @serviceSpec@, @templateSource@, and\/or @type@ that you provide.
--     Only requested parameters are updated.
updateComponent_deploymentType :: Lens.Lens' UpdateComponent ComponentDeploymentUpdateType
updateComponent_deploymentType :: Lens' UpdateComponent ComponentDeploymentUpdateType
updateComponent_deploymentType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateComponent' {ComponentDeploymentUpdateType
deploymentType :: ComponentDeploymentUpdateType
$sel:deploymentType:UpdateComponent' :: UpdateComponent -> ComponentDeploymentUpdateType
deploymentType} -> ComponentDeploymentUpdateType
deploymentType) (\s :: UpdateComponent
s@UpdateComponent' {} ComponentDeploymentUpdateType
a -> UpdateComponent
s {$sel:deploymentType:UpdateComponent' :: ComponentDeploymentUpdateType
deploymentType = ComponentDeploymentUpdateType
a} :: UpdateComponent)

-- | The name of the component to update.
updateComponent_name :: Lens.Lens' UpdateComponent Prelude.Text
updateComponent_name :: Lens' UpdateComponent Text
updateComponent_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateComponent' {Text
name :: Text
$sel:name:UpdateComponent' :: UpdateComponent -> Text
name} -> Text
name) (\s :: UpdateComponent
s@UpdateComponent' {} Text
a -> UpdateComponent
s {$sel:name:UpdateComponent' :: Text
name = Text
a} :: UpdateComponent)

instance Core.AWSRequest UpdateComponent where
  type
    AWSResponse UpdateComponent =
      UpdateComponentResponse
  request :: (Service -> Service) -> UpdateComponent -> Request UpdateComponent
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 UpdateComponent
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdateComponent)))
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 -> UpdateComponentResponse
UpdateComponentResponse'
            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 UpdateComponent where
  hashWithSalt :: Int -> UpdateComponent -> Int
hashWithSalt Int
_salt UpdateComponent' {Maybe Text
Maybe (Sensitive Text)
Text
ComponentDeploymentUpdateType
name :: Text
deploymentType :: ComponentDeploymentUpdateType
templateFile :: Maybe (Sensitive Text)
serviceSpec :: Maybe (Sensitive Text)
serviceName :: Maybe Text
serviceInstanceName :: Maybe Text
description :: Maybe (Sensitive Text)
$sel:name:UpdateComponent' :: UpdateComponent -> Text
$sel:deploymentType:UpdateComponent' :: UpdateComponent -> ComponentDeploymentUpdateType
$sel:templateFile:UpdateComponent' :: UpdateComponent -> Maybe (Sensitive Text)
$sel:serviceSpec:UpdateComponent' :: UpdateComponent -> Maybe (Sensitive Text)
$sel:serviceName:UpdateComponent' :: UpdateComponent -> Maybe Text
$sel:serviceInstanceName:UpdateComponent' :: UpdateComponent -> Maybe Text
$sel:description:UpdateComponent' :: UpdateComponent -> 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
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 (Sensitive Text)
templateFile
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` ComponentDeploymentUpdateType
deploymentType
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
name

instance Prelude.NFData UpdateComponent where
  rnf :: UpdateComponent -> ()
rnf UpdateComponent' {Maybe Text
Maybe (Sensitive Text)
Text
ComponentDeploymentUpdateType
name :: Text
deploymentType :: ComponentDeploymentUpdateType
templateFile :: Maybe (Sensitive Text)
serviceSpec :: Maybe (Sensitive Text)
serviceName :: Maybe Text
serviceInstanceName :: Maybe Text
description :: Maybe (Sensitive Text)
$sel:name:UpdateComponent' :: UpdateComponent -> Text
$sel:deploymentType:UpdateComponent' :: UpdateComponent -> ComponentDeploymentUpdateType
$sel:templateFile:UpdateComponent' :: UpdateComponent -> Maybe (Sensitive Text)
$sel:serviceSpec:UpdateComponent' :: UpdateComponent -> Maybe (Sensitive Text)
$sel:serviceName:UpdateComponent' :: UpdateComponent -> Maybe Text
$sel:serviceInstanceName:UpdateComponent' :: UpdateComponent -> Maybe Text
$sel:description:UpdateComponent' :: UpdateComponent -> 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
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 (Sensitive Text)
templateFile
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf ComponentDeploymentUpdateType
deploymentType
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
name

instance Data.ToHeaders UpdateComponent where
  toHeaders :: UpdateComponent -> 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.UpdateComponent" ::
                          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 UpdateComponent where
  toJSON :: UpdateComponent -> Value
toJSON UpdateComponent' {Maybe Text
Maybe (Sensitive Text)
Text
ComponentDeploymentUpdateType
name :: Text
deploymentType :: ComponentDeploymentUpdateType
templateFile :: Maybe (Sensitive Text)
serviceSpec :: Maybe (Sensitive Text)
serviceName :: Maybe Text
serviceInstanceName :: Maybe Text
description :: Maybe (Sensitive Text)
$sel:name:UpdateComponent' :: UpdateComponent -> Text
$sel:deploymentType:UpdateComponent' :: UpdateComponent -> ComponentDeploymentUpdateType
$sel:templateFile:UpdateComponent' :: UpdateComponent -> Maybe (Sensitive Text)
$sel:serviceSpec:UpdateComponent' :: UpdateComponent -> Maybe (Sensitive Text)
$sel:serviceName:UpdateComponent' :: UpdateComponent -> Maybe Text
$sel:serviceInstanceName:UpdateComponent' :: UpdateComponent -> Maybe Text
$sel:description:UpdateComponent' :: UpdateComponent -> 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
"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
"templateFile" 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)
templateFile,
            forall a. a -> Maybe a
Prelude.Just
              (Key
"deploymentType" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= ComponentDeploymentUpdateType
deploymentType),
            forall a. a -> Maybe a
Prelude.Just (Key
"name" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
name)
          ]
      )

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

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

-- | /See:/ 'newUpdateComponentResponse' smart constructor.
data UpdateComponentResponse = UpdateComponentResponse'
  { -- | The response's http status code.
    UpdateComponentResponse -> Int
httpStatus :: Prelude.Int,
    -- | The detailed data of the updated component.
    UpdateComponentResponse -> Component
component :: Component
  }
  deriving (UpdateComponentResponse -> UpdateComponentResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateComponentResponse -> UpdateComponentResponse -> Bool
$c/= :: UpdateComponentResponse -> UpdateComponentResponse -> Bool
== :: UpdateComponentResponse -> UpdateComponentResponse -> Bool
$c== :: UpdateComponentResponse -> UpdateComponentResponse -> Bool
Prelude.Eq, Int -> UpdateComponentResponse -> ShowS
[UpdateComponentResponse] -> ShowS
UpdateComponentResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateComponentResponse] -> ShowS
$cshowList :: [UpdateComponentResponse] -> ShowS
show :: UpdateComponentResponse -> String
$cshow :: UpdateComponentResponse -> String
showsPrec :: Int -> UpdateComponentResponse -> ShowS
$cshowsPrec :: Int -> UpdateComponentResponse -> ShowS
Prelude.Show, forall x. Rep UpdateComponentResponse x -> UpdateComponentResponse
forall x. UpdateComponentResponse -> Rep UpdateComponentResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateComponentResponse x -> UpdateComponentResponse
$cfrom :: forall x. UpdateComponentResponse -> Rep UpdateComponentResponse x
Prelude.Generic)

-- |
-- Create a value of 'UpdateComponentResponse' 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', 'updateComponentResponse_httpStatus' - The response's http status code.
--
-- 'component', 'updateComponentResponse_component' - The detailed data of the updated component.
newUpdateComponentResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  -- | 'component'
  Component ->
  UpdateComponentResponse
newUpdateComponentResponse :: Int -> Component -> UpdateComponentResponse
newUpdateComponentResponse Int
pHttpStatus_ Component
pComponent_ =
  UpdateComponentResponse'
    { $sel:httpStatus:UpdateComponentResponse' :: Int
httpStatus = Int
pHttpStatus_,
      $sel:component:UpdateComponentResponse' :: Component
component = Component
pComponent_
    }

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

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

instance Prelude.NFData UpdateComponentResponse where
  rnf :: UpdateComponentResponse -> ()
rnf UpdateComponentResponse' {Int
Component
component :: Component
httpStatus :: Int
$sel:component:UpdateComponentResponse' :: UpdateComponentResponse -> Component
$sel:httpStatus:UpdateComponentResponse' :: UpdateComponentResponse -> 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