{-# 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.ServiceCatalogAppRegistry.UpdateApplication
-- Copyright : (c) 2013-2023 Brendan Hay
-- License : Mozilla Public License, v. 2.0.
-- Maintainer : Brendan Hay
-- Stability : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Updates an existing application with new attributes.
module Amazonka.ServiceCatalogAppRegistry.UpdateApplication
( -- * Creating a Request
UpdateApplication (..),
newUpdateApplication,
-- * Request Lenses
updateApplication_description,
updateApplication_name,
updateApplication_application,
-- * Destructuring the Response
UpdateApplicationResponse (..),
newUpdateApplicationResponse,
-- * Response Lenses
updateApplicationResponse_application,
updateApplicationResponse_httpStatus,
)
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 qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
import Amazonka.ServiceCatalogAppRegistry.Types
-- | /See:/ 'newUpdateApplication' smart constructor.
data UpdateApplication = UpdateApplication'
{ -- | The new description of the application.
description :: Prelude.Maybe Prelude.Text,
-- | Deprecated: The new name of the application. The name must be unique in
-- the region in which you are updating the application. Please do not use
-- this field as we have stopped supporting name updates.
name :: Prelude.Maybe Prelude.Text,
-- | The name or ID of the application that will be updated.
application :: Prelude.Text
}
deriving (Prelude.Eq, Prelude.Read, Prelude.Show, Prelude.Generic)
-- |
-- Create a value of 'UpdateApplication' 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', 'updateApplication_description' - The new description of the application.
--
-- 'name', 'updateApplication_name' - Deprecated: The new name of the application. The name must be unique in
-- the region in which you are updating the application. Please do not use
-- this field as we have stopped supporting name updates.
--
-- 'application', 'updateApplication_application' - The name or ID of the application that will be updated.
newUpdateApplication ::
-- | 'application'
Prelude.Text ->
UpdateApplication
newUpdateApplication pApplication_ =
UpdateApplication'
{ description = Prelude.Nothing,
name = Prelude.Nothing,
application = pApplication_
}
-- | The new description of the application.
updateApplication_description :: Lens.Lens' UpdateApplication (Prelude.Maybe Prelude.Text)
updateApplication_description = Lens.lens (\UpdateApplication' {description} -> description) (\s@UpdateApplication' {} a -> s {description = a} :: UpdateApplication)
-- | Deprecated: The new name of the application. The name must be unique in
-- the region in which you are updating the application. Please do not use
-- this field as we have stopped supporting name updates.
updateApplication_name :: Lens.Lens' UpdateApplication (Prelude.Maybe Prelude.Text)
updateApplication_name = Lens.lens (\UpdateApplication' {name} -> name) (\s@UpdateApplication' {} a -> s {name = a} :: UpdateApplication)
-- | The name or ID of the application that will be updated.
updateApplication_application :: Lens.Lens' UpdateApplication Prelude.Text
updateApplication_application = Lens.lens (\UpdateApplication' {application} -> application) (\s@UpdateApplication' {} a -> s {application = a} :: UpdateApplication)
instance Core.AWSRequest UpdateApplication where
type
AWSResponse UpdateApplication =
UpdateApplicationResponse
request overrides =
Request.patchJSON (overrides defaultService)
response =
Response.receiveJSON
( \s h x ->
UpdateApplicationResponse'
Prelude.<$> (x Data..?> "application")
Prelude.<*> (Prelude.pure (Prelude.fromEnum s))
)
instance Prelude.Hashable UpdateApplication where
hashWithSalt _salt UpdateApplication' {..} =
_salt
`Prelude.hashWithSalt` description
`Prelude.hashWithSalt` name
`Prelude.hashWithSalt` application
instance Prelude.NFData UpdateApplication where
rnf UpdateApplication' {..} =
Prelude.rnf description
`Prelude.seq` Prelude.rnf name
`Prelude.seq` Prelude.rnf application
instance Data.ToHeaders UpdateApplication where
toHeaders =
Prelude.const
( Prelude.mconcat
[ "Content-Type"
Data.=# ( "application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Data.ToJSON UpdateApplication where
toJSON UpdateApplication' {..} =
Data.object
( Prelude.catMaybes
[ ("description" Data..=) Prelude.<$> description,
("name" Data..=) Prelude.<$> name
]
)
instance Data.ToPath UpdateApplication where
toPath UpdateApplication' {..} =
Prelude.mconcat
["/applications/", Data.toBS application]
instance Data.ToQuery UpdateApplication where
toQuery = Prelude.const Prelude.mempty
-- | /See:/ 'newUpdateApplicationResponse' smart constructor.
data UpdateApplicationResponse = UpdateApplicationResponse'
{ -- | The updated information of the application.
application :: Prelude.Maybe Application,
-- | The response's http status code.
httpStatus :: Prelude.Int
}
deriving (Prelude.Eq, Prelude.Read, Prelude.Show, Prelude.Generic)
-- |
-- Create a value of 'UpdateApplicationResponse' 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:
--
-- 'application', 'updateApplicationResponse_application' - The updated information of the application.
--
-- 'httpStatus', 'updateApplicationResponse_httpStatus' - The response's http status code.
newUpdateApplicationResponse ::
-- | 'httpStatus'
Prelude.Int ->
UpdateApplicationResponse
newUpdateApplicationResponse pHttpStatus_ =
UpdateApplicationResponse'
{ application =
Prelude.Nothing,
httpStatus = pHttpStatus_
}
-- | The updated information of the application.
updateApplicationResponse_application :: Lens.Lens' UpdateApplicationResponse (Prelude.Maybe Application)
updateApplicationResponse_application = Lens.lens (\UpdateApplicationResponse' {application} -> application) (\s@UpdateApplicationResponse' {} a -> s {application = a} :: UpdateApplicationResponse)
-- | The response's http status code.
updateApplicationResponse_httpStatus :: Lens.Lens' UpdateApplicationResponse Prelude.Int
updateApplicationResponse_httpStatus = Lens.lens (\UpdateApplicationResponse' {httpStatus} -> httpStatus) (\s@UpdateApplicationResponse' {} a -> s {httpStatus = a} :: UpdateApplicationResponse)
instance Prelude.NFData UpdateApplicationResponse where
rnf UpdateApplicationResponse' {..} =
Prelude.rnf application
`Prelude.seq` Prelude.rnf httpStatus