{-# 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.AlexaBusiness.UpdateGatewayGroup
-- 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 details of a gateway group. If any optional field is not
-- provided, the existing corresponding value is left unmodified.
module Amazonka.AlexaBusiness.UpdateGatewayGroup
  ( -- * Creating a Request
    UpdateGatewayGroup (..),
    newUpdateGatewayGroup,

    -- * Request Lenses
    updateGatewayGroup_description,
    updateGatewayGroup_name,
    updateGatewayGroup_gatewayGroupArn,

    -- * Destructuring the Response
    UpdateGatewayGroupResponse (..),
    newUpdateGatewayGroupResponse,

    -- * Response Lenses
    updateGatewayGroupResponse_httpStatus,
  )
where

import Amazonka.AlexaBusiness.Types
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

-- | /See:/ 'newUpdateGatewayGroup' smart constructor.
data UpdateGatewayGroup = UpdateGatewayGroup'
  { -- | The updated description of the gateway group.
    UpdateGatewayGroup -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | The updated name of the gateway group.
    UpdateGatewayGroup -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The ARN of the gateway group to update.
    UpdateGatewayGroup -> Text
gatewayGroupArn :: Prelude.Text
  }
  deriving (UpdateGatewayGroup -> UpdateGatewayGroup -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateGatewayGroup -> UpdateGatewayGroup -> Bool
$c/= :: UpdateGatewayGroup -> UpdateGatewayGroup -> Bool
== :: UpdateGatewayGroup -> UpdateGatewayGroup -> Bool
$c== :: UpdateGatewayGroup -> UpdateGatewayGroup -> Bool
Prelude.Eq, ReadPrec [UpdateGatewayGroup]
ReadPrec UpdateGatewayGroup
Int -> ReadS UpdateGatewayGroup
ReadS [UpdateGatewayGroup]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateGatewayGroup]
$creadListPrec :: ReadPrec [UpdateGatewayGroup]
readPrec :: ReadPrec UpdateGatewayGroup
$creadPrec :: ReadPrec UpdateGatewayGroup
readList :: ReadS [UpdateGatewayGroup]
$creadList :: ReadS [UpdateGatewayGroup]
readsPrec :: Int -> ReadS UpdateGatewayGroup
$creadsPrec :: Int -> ReadS UpdateGatewayGroup
Prelude.Read, Int -> UpdateGatewayGroup -> ShowS
[UpdateGatewayGroup] -> ShowS
UpdateGatewayGroup -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateGatewayGroup] -> ShowS
$cshowList :: [UpdateGatewayGroup] -> ShowS
show :: UpdateGatewayGroup -> String
$cshow :: UpdateGatewayGroup -> String
showsPrec :: Int -> UpdateGatewayGroup -> ShowS
$cshowsPrec :: Int -> UpdateGatewayGroup -> ShowS
Prelude.Show, forall x. Rep UpdateGatewayGroup x -> UpdateGatewayGroup
forall x. UpdateGatewayGroup -> Rep UpdateGatewayGroup x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateGatewayGroup x -> UpdateGatewayGroup
$cfrom :: forall x. UpdateGatewayGroup -> Rep UpdateGatewayGroup x
Prelude.Generic)

-- |
-- Create a value of 'UpdateGatewayGroup' 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', 'updateGatewayGroup_description' - The updated description of the gateway group.
--
-- 'name', 'updateGatewayGroup_name' - The updated name of the gateway group.
--
-- 'gatewayGroupArn', 'updateGatewayGroup_gatewayGroupArn' - The ARN of the gateway group to update.
newUpdateGatewayGroup ::
  -- | 'gatewayGroupArn'
  Prelude.Text ->
  UpdateGatewayGroup
newUpdateGatewayGroup :: Text -> UpdateGatewayGroup
newUpdateGatewayGroup Text
pGatewayGroupArn_ =
  UpdateGatewayGroup'
    { $sel:description:UpdateGatewayGroup' :: Maybe Text
description = forall a. Maybe a
Prelude.Nothing,
      $sel:name:UpdateGatewayGroup' :: Maybe Text
name = forall a. Maybe a
Prelude.Nothing,
      $sel:gatewayGroupArn:UpdateGatewayGroup' :: Text
gatewayGroupArn = Text
pGatewayGroupArn_
    }

-- | The updated description of the gateway group.
updateGatewayGroup_description :: Lens.Lens' UpdateGatewayGroup (Prelude.Maybe Prelude.Text)
updateGatewayGroup_description :: Lens' UpdateGatewayGroup (Maybe Text)
updateGatewayGroup_description = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateGatewayGroup' {Maybe Text
description :: Maybe Text
$sel:description:UpdateGatewayGroup' :: UpdateGatewayGroup -> Maybe Text
description} -> Maybe Text
description) (\s :: UpdateGatewayGroup
s@UpdateGatewayGroup' {} Maybe Text
a -> UpdateGatewayGroup
s {$sel:description:UpdateGatewayGroup' :: Maybe Text
description = Maybe Text
a} :: UpdateGatewayGroup)

-- | The updated name of the gateway group.
updateGatewayGroup_name :: Lens.Lens' UpdateGatewayGroup (Prelude.Maybe Prelude.Text)
updateGatewayGroup_name :: Lens' UpdateGatewayGroup (Maybe Text)
updateGatewayGroup_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateGatewayGroup' {Maybe Text
name :: Maybe Text
$sel:name:UpdateGatewayGroup' :: UpdateGatewayGroup -> Maybe Text
name} -> Maybe Text
name) (\s :: UpdateGatewayGroup
s@UpdateGatewayGroup' {} Maybe Text
a -> UpdateGatewayGroup
s {$sel:name:UpdateGatewayGroup' :: Maybe Text
name = Maybe Text
a} :: UpdateGatewayGroup)

-- | The ARN of the gateway group to update.
updateGatewayGroup_gatewayGroupArn :: Lens.Lens' UpdateGatewayGroup Prelude.Text
updateGatewayGroup_gatewayGroupArn :: Lens' UpdateGatewayGroup Text
updateGatewayGroup_gatewayGroupArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateGatewayGroup' {Text
gatewayGroupArn :: Text
$sel:gatewayGroupArn:UpdateGatewayGroup' :: UpdateGatewayGroup -> Text
gatewayGroupArn} -> Text
gatewayGroupArn) (\s :: UpdateGatewayGroup
s@UpdateGatewayGroup' {} Text
a -> UpdateGatewayGroup
s {$sel:gatewayGroupArn:UpdateGatewayGroup' :: Text
gatewayGroupArn = Text
a} :: UpdateGatewayGroup)

instance Core.AWSRequest UpdateGatewayGroup where
  type
    AWSResponse UpdateGatewayGroup =
      UpdateGatewayGroupResponse
  request :: (Service -> Service)
-> UpdateGatewayGroup -> Request UpdateGatewayGroup
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 UpdateGatewayGroup
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse UpdateGatewayGroup)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
      ( \Int
s ResponseHeaders
h ()
x ->
          Int -> UpdateGatewayGroupResponse
UpdateGatewayGroupResponse'
            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))
      )

instance Prelude.Hashable UpdateGatewayGroup where
  hashWithSalt :: Int -> UpdateGatewayGroup -> Int
hashWithSalt Int
_salt UpdateGatewayGroup' {Maybe Text
Text
gatewayGroupArn :: Text
name :: Maybe Text
description :: Maybe Text
$sel:gatewayGroupArn:UpdateGatewayGroup' :: UpdateGatewayGroup -> Text
$sel:name:UpdateGatewayGroup' :: UpdateGatewayGroup -> Maybe Text
$sel:description:UpdateGatewayGroup' :: UpdateGatewayGroup -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
description
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
name
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
gatewayGroupArn

instance Prelude.NFData UpdateGatewayGroup where
  rnf :: UpdateGatewayGroup -> ()
rnf UpdateGatewayGroup' {Maybe Text
Text
gatewayGroupArn :: Text
name :: Maybe Text
description :: Maybe Text
$sel:gatewayGroupArn:UpdateGatewayGroup' :: UpdateGatewayGroup -> Text
$sel:name:UpdateGatewayGroup' :: UpdateGatewayGroup -> Maybe Text
$sel:description:UpdateGatewayGroup' :: UpdateGatewayGroup -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
description
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
name
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
gatewayGroupArn

instance Data.ToHeaders UpdateGatewayGroup where
  toHeaders :: UpdateGatewayGroup -> 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
"AlexaForBusiness.UpdateGatewayGroup" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Data.ToJSON UpdateGatewayGroup where
  toJSON :: UpdateGatewayGroup -> Value
toJSON UpdateGatewayGroup' {Maybe Text
Text
gatewayGroupArn :: Text
name :: Maybe Text
description :: Maybe Text
$sel:gatewayGroupArn:UpdateGatewayGroup' :: UpdateGatewayGroup -> Text
$sel:name:UpdateGatewayGroup' :: UpdateGatewayGroup -> Maybe Text
$sel:description:UpdateGatewayGroup' :: UpdateGatewayGroup -> Maybe 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 Text
description,
            (Key
"Name" 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
name,
            forall a. a -> Maybe a
Prelude.Just
              (Key
"GatewayGroupArn" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
gatewayGroupArn)
          ]
      )

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

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

-- | /See:/ 'newUpdateGatewayGroupResponse' smart constructor.
data UpdateGatewayGroupResponse = UpdateGatewayGroupResponse'
  { -- | The response's http status code.
    UpdateGatewayGroupResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (UpdateGatewayGroupResponse -> UpdateGatewayGroupResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateGatewayGroupResponse -> UpdateGatewayGroupResponse -> Bool
$c/= :: UpdateGatewayGroupResponse -> UpdateGatewayGroupResponse -> Bool
== :: UpdateGatewayGroupResponse -> UpdateGatewayGroupResponse -> Bool
$c== :: UpdateGatewayGroupResponse -> UpdateGatewayGroupResponse -> Bool
Prelude.Eq, ReadPrec [UpdateGatewayGroupResponse]
ReadPrec UpdateGatewayGroupResponse
Int -> ReadS UpdateGatewayGroupResponse
ReadS [UpdateGatewayGroupResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateGatewayGroupResponse]
$creadListPrec :: ReadPrec [UpdateGatewayGroupResponse]
readPrec :: ReadPrec UpdateGatewayGroupResponse
$creadPrec :: ReadPrec UpdateGatewayGroupResponse
readList :: ReadS [UpdateGatewayGroupResponse]
$creadList :: ReadS [UpdateGatewayGroupResponse]
readsPrec :: Int -> ReadS UpdateGatewayGroupResponse
$creadsPrec :: Int -> ReadS UpdateGatewayGroupResponse
Prelude.Read, Int -> UpdateGatewayGroupResponse -> ShowS
[UpdateGatewayGroupResponse] -> ShowS
UpdateGatewayGroupResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateGatewayGroupResponse] -> ShowS
$cshowList :: [UpdateGatewayGroupResponse] -> ShowS
show :: UpdateGatewayGroupResponse -> String
$cshow :: UpdateGatewayGroupResponse -> String
showsPrec :: Int -> UpdateGatewayGroupResponse -> ShowS
$cshowsPrec :: Int -> UpdateGatewayGroupResponse -> ShowS
Prelude.Show, forall x.
Rep UpdateGatewayGroupResponse x -> UpdateGatewayGroupResponse
forall x.
UpdateGatewayGroupResponse -> Rep UpdateGatewayGroupResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep UpdateGatewayGroupResponse x -> UpdateGatewayGroupResponse
$cfrom :: forall x.
UpdateGatewayGroupResponse -> Rep UpdateGatewayGroupResponse x
Prelude.Generic)

-- |
-- Create a value of 'UpdateGatewayGroupResponse' 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', 'updateGatewayGroupResponse_httpStatus' - The response's http status code.
newUpdateGatewayGroupResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  UpdateGatewayGroupResponse
newUpdateGatewayGroupResponse :: Int -> UpdateGatewayGroupResponse
newUpdateGatewayGroupResponse Int
pHttpStatus_ =
  UpdateGatewayGroupResponse'
    { $sel:httpStatus:UpdateGatewayGroupResponse' :: Int
httpStatus =
        Int
pHttpStatus_
    }

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

instance Prelude.NFData UpdateGatewayGroupResponse where
  rnf :: UpdateGatewayGroupResponse -> ()
rnf UpdateGatewayGroupResponse' {Int
httpStatus :: Int
$sel:httpStatus:UpdateGatewayGroupResponse' :: UpdateGatewayGroupResponse -> Int
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus