amazonka-resourcegroups-2.0: gen/Amazonka/ResourceGroups/UpdateGroup.hs
{-# 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.ResourceGroups.UpdateGroup
-- 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 the description for an existing group. You cannot update the
-- name of a resource group.
--
-- __Minimum permissions__
--
-- To run this command, you must have the following permissions:
--
-- - @resource-groups:UpdateGroup@
module Amazonka.ResourceGroups.UpdateGroup
( -- * Creating a Request
UpdateGroup (..),
newUpdateGroup,
-- * Request Lenses
updateGroup_description,
updateGroup_group,
updateGroup_groupName,
-- * Destructuring the Response
UpdateGroupResponse (..),
newUpdateGroupResponse,
-- * Response Lenses
updateGroupResponse_group,
updateGroupResponse_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 Amazonka.ResourceGroups.Types
import qualified Amazonka.Response as Response
-- | /See:/ 'newUpdateGroup' smart constructor.
data UpdateGroup = UpdateGroup'
{ -- | The new description that you want to update the resource group with.
-- Descriptions can contain letters, numbers, hyphens, underscores,
-- periods, and spaces.
description :: Prelude.Maybe Prelude.Text,
-- | The name or the ARN of the resource group to modify.
group' :: Prelude.Maybe Prelude.Text,
-- | Don\'t use this parameter. Use @Group@ instead.
groupName :: Prelude.Maybe Prelude.Text
}
deriving (Prelude.Eq, Prelude.Read, Prelude.Show, Prelude.Generic)
-- |
-- Create a value of 'UpdateGroup' 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', 'updateGroup_description' - The new description that you want to update the resource group with.
-- Descriptions can contain letters, numbers, hyphens, underscores,
-- periods, and spaces.
--
-- 'group'', 'updateGroup_group' - The name or the ARN of the resource group to modify.
--
-- 'groupName', 'updateGroup_groupName' - Don\'t use this parameter. Use @Group@ instead.
newUpdateGroup ::
UpdateGroup
newUpdateGroup =
UpdateGroup'
{ description = Prelude.Nothing,
group' = Prelude.Nothing,
groupName = Prelude.Nothing
}
-- | The new description that you want to update the resource group with.
-- Descriptions can contain letters, numbers, hyphens, underscores,
-- periods, and spaces.
updateGroup_description :: Lens.Lens' UpdateGroup (Prelude.Maybe Prelude.Text)
updateGroup_description = Lens.lens (\UpdateGroup' {description} -> description) (\s@UpdateGroup' {} a -> s {description = a} :: UpdateGroup)
-- | The name or the ARN of the resource group to modify.
updateGroup_group :: Lens.Lens' UpdateGroup (Prelude.Maybe Prelude.Text)
updateGroup_group = Lens.lens (\UpdateGroup' {group'} -> group') (\s@UpdateGroup' {} a -> s {group' = a} :: UpdateGroup)
-- | Don\'t use this parameter. Use @Group@ instead.
updateGroup_groupName :: Lens.Lens' UpdateGroup (Prelude.Maybe Prelude.Text)
updateGroup_groupName = Lens.lens (\UpdateGroup' {groupName} -> groupName) (\s@UpdateGroup' {} a -> s {groupName = a} :: UpdateGroup)
instance Core.AWSRequest UpdateGroup where
type AWSResponse UpdateGroup = UpdateGroupResponse
request overrides =
Request.postJSON (overrides defaultService)
response =
Response.receiveJSON
( \s h x ->
UpdateGroupResponse'
Prelude.<$> (x Data..?> "Group")
Prelude.<*> (Prelude.pure (Prelude.fromEnum s))
)
instance Prelude.Hashable UpdateGroup where
hashWithSalt _salt UpdateGroup' {..} =
_salt
`Prelude.hashWithSalt` description
`Prelude.hashWithSalt` group'
`Prelude.hashWithSalt` groupName
instance Prelude.NFData UpdateGroup where
rnf UpdateGroup' {..} =
Prelude.rnf description
`Prelude.seq` Prelude.rnf group'
`Prelude.seq` Prelude.rnf groupName
instance Data.ToHeaders UpdateGroup where
toHeaders = Prelude.const Prelude.mempty
instance Data.ToJSON UpdateGroup where
toJSON UpdateGroup' {..} =
Data.object
( Prelude.catMaybes
[ ("Description" Data..=) Prelude.<$> description,
("Group" Data..=) Prelude.<$> group',
("GroupName" Data..=) Prelude.<$> groupName
]
)
instance Data.ToPath UpdateGroup where
toPath = Prelude.const "/update-group"
instance Data.ToQuery UpdateGroup where
toQuery = Prelude.const Prelude.mempty
-- | /See:/ 'newUpdateGroupResponse' smart constructor.
data UpdateGroupResponse = UpdateGroupResponse'
{ -- | The update description of the resource group.
group' :: Prelude.Maybe Group,
-- | The response's http status code.
httpStatus :: Prelude.Int
}
deriving (Prelude.Eq, Prelude.Read, Prelude.Show, Prelude.Generic)
-- |
-- Create a value of 'UpdateGroupResponse' 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:
--
-- 'group'', 'updateGroupResponse_group' - The update description of the resource group.
--
-- 'httpStatus', 'updateGroupResponse_httpStatus' - The response's http status code.
newUpdateGroupResponse ::
-- | 'httpStatus'
Prelude.Int ->
UpdateGroupResponse
newUpdateGroupResponse pHttpStatus_ =
UpdateGroupResponse'
{ group' = Prelude.Nothing,
httpStatus = pHttpStatus_
}
-- | The update description of the resource group.
updateGroupResponse_group :: Lens.Lens' UpdateGroupResponse (Prelude.Maybe Group)
updateGroupResponse_group = Lens.lens (\UpdateGroupResponse' {group'} -> group') (\s@UpdateGroupResponse' {} a -> s {group' = a} :: UpdateGroupResponse)
-- | The response's http status code.
updateGroupResponse_httpStatus :: Lens.Lens' UpdateGroupResponse Prelude.Int
updateGroupResponse_httpStatus = Lens.lens (\UpdateGroupResponse' {httpStatus} -> httpStatus) (\s@UpdateGroupResponse' {} a -> s {httpStatus = a} :: UpdateGroupResponse)
instance Prelude.NFData UpdateGroupResponse where
rnf UpdateGroupResponse' {..} =
Prelude.rnf group'
`Prelude.seq` Prelude.rnf httpStatus