{-# 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-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- 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_name,
    updateGatewayGroup_description,
    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.Lens as Lens
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 name of the gateway group.
    UpdateGatewayGroup -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The updated description of the gateway group.
    UpdateGatewayGroup -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | The ARN of the gateway group to update.
    UpdateGatewayGroup -> Text
gatewayGroupArn :: Prelude.Text
  }
  deriving (UpdateGatewayGroup -> UpdateGatewayGroup -> Bool
(UpdateGatewayGroup -> UpdateGatewayGroup -> Bool)
-> (UpdateGatewayGroup -> UpdateGatewayGroup -> Bool)
-> Eq UpdateGatewayGroup
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]
(Int -> ReadS UpdateGatewayGroup)
-> ReadS [UpdateGatewayGroup]
-> ReadPrec UpdateGatewayGroup
-> ReadPrec [UpdateGatewayGroup]
-> Read 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
(Int -> UpdateGatewayGroup -> ShowS)
-> (UpdateGatewayGroup -> String)
-> ([UpdateGatewayGroup] -> ShowS)
-> Show UpdateGatewayGroup
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. UpdateGatewayGroup -> Rep UpdateGatewayGroup x)
-> (forall x. Rep UpdateGatewayGroup x -> UpdateGatewayGroup)
-> Generic UpdateGatewayGroup
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:
--
-- 'name', 'updateGatewayGroup_name' - The updated name of the gateway group.
--
-- 'description', 'updateGatewayGroup_description' - The updated description 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' :: Maybe Text -> Maybe Text -> Text -> UpdateGatewayGroup
UpdateGatewayGroup'
    { $sel:name:UpdateGatewayGroup' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:description:UpdateGatewayGroup' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:gatewayGroupArn:UpdateGatewayGroup' :: Text
gatewayGroupArn = Text
pGatewayGroupArn_
    }

-- | The updated name of the gateway group.
updateGatewayGroup_name :: Lens.Lens' UpdateGatewayGroup (Prelude.Maybe Prelude.Text)
updateGatewayGroup_name :: (Maybe Text -> f (Maybe Text))
-> UpdateGatewayGroup -> f UpdateGatewayGroup
updateGatewayGroup_name = (UpdateGatewayGroup -> Maybe Text)
-> (UpdateGatewayGroup -> Maybe Text -> UpdateGatewayGroup)
-> Lens
     UpdateGatewayGroup UpdateGatewayGroup (Maybe Text) (Maybe Text)
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 updated description of the gateway group.
updateGatewayGroup_description :: Lens.Lens' UpdateGatewayGroup (Prelude.Maybe Prelude.Text)
updateGatewayGroup_description :: (Maybe Text -> f (Maybe Text))
-> UpdateGatewayGroup -> f UpdateGatewayGroup
updateGatewayGroup_description = (UpdateGatewayGroup -> Maybe Text)
-> (UpdateGatewayGroup -> Maybe Text -> UpdateGatewayGroup)
-> Lens
     UpdateGatewayGroup UpdateGatewayGroup (Maybe Text) (Maybe Text)
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 ARN of the gateway group to update.
updateGatewayGroup_gatewayGroupArn :: Lens.Lens' UpdateGatewayGroup Prelude.Text
updateGatewayGroup_gatewayGroupArn :: (Text -> f Text) -> UpdateGatewayGroup -> f UpdateGatewayGroup
updateGatewayGroup_gatewayGroupArn = (UpdateGatewayGroup -> Text)
-> (UpdateGatewayGroup -> Text -> UpdateGatewayGroup)
-> Lens UpdateGatewayGroup UpdateGatewayGroup Text Text
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 :: UpdateGatewayGroup -> Request UpdateGatewayGroup
request = Service -> UpdateGatewayGroup -> Request UpdateGatewayGroup
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy UpdateGatewayGroup
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse UpdateGatewayGroup)))
response =
    (Int
 -> ResponseHeaders
 -> ()
 -> Either String (AWSResponse UpdateGatewayGroup))
-> Logger
-> Service
-> Proxy UpdateGatewayGroup
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse UpdateGatewayGroup)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
      ( \Int
s ResponseHeaders
h ()
x ->
          Int -> UpdateGatewayGroupResponse
UpdateGatewayGroupResponse'
            (Int -> UpdateGatewayGroupResponse)
-> Either String Int -> Either String UpdateGatewayGroupResponse
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable UpdateGatewayGroup

instance Prelude.NFData UpdateGatewayGroup

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

instance Core.ToJSON UpdateGatewayGroup where
  toJSON :: UpdateGatewayGroup -> Value
toJSON UpdateGatewayGroup' {Maybe Text
Text
gatewayGroupArn :: Text
description :: Maybe Text
name :: Maybe Text
$sel:gatewayGroupArn:UpdateGatewayGroup' :: UpdateGatewayGroup -> Text
$sel:description:UpdateGatewayGroup' :: UpdateGatewayGroup -> Maybe Text
$sel:name:UpdateGatewayGroup' :: UpdateGatewayGroup -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"Name" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
name,
            (Text
"Description" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
description,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"GatewayGroupArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
gatewayGroupArn)
          ]
      )

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

instance Core.ToQuery UpdateGatewayGroup where
  toQuery :: UpdateGatewayGroup -> QueryString
toQuery = QueryString -> UpdateGatewayGroup -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
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
(UpdateGatewayGroupResponse -> UpdateGatewayGroupResponse -> Bool)
-> (UpdateGatewayGroupResponse
    -> UpdateGatewayGroupResponse -> Bool)
-> Eq UpdateGatewayGroupResponse
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]
(Int -> ReadS UpdateGatewayGroupResponse)
-> ReadS [UpdateGatewayGroupResponse]
-> ReadPrec UpdateGatewayGroupResponse
-> ReadPrec [UpdateGatewayGroupResponse]
-> Read 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
(Int -> UpdateGatewayGroupResponse -> ShowS)
-> (UpdateGatewayGroupResponse -> String)
-> ([UpdateGatewayGroupResponse] -> ShowS)
-> Show UpdateGatewayGroupResponse
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.
 UpdateGatewayGroupResponse -> Rep UpdateGatewayGroupResponse x)
-> (forall x.
    Rep UpdateGatewayGroupResponse x -> UpdateGatewayGroupResponse)
-> Generic UpdateGatewayGroupResponse
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' :: Int -> UpdateGatewayGroupResponse
UpdateGatewayGroupResponse'
    { $sel:httpStatus:UpdateGatewayGroupResponse' :: Int
httpStatus =
        Int
pHttpStatus_
    }

-- | The response's http status code.
updateGatewayGroupResponse_httpStatus :: Lens.Lens' UpdateGatewayGroupResponse Prelude.Int
updateGatewayGroupResponse_httpStatus :: (Int -> f Int)
-> UpdateGatewayGroupResponse -> f UpdateGatewayGroupResponse
updateGatewayGroupResponse_httpStatus = (UpdateGatewayGroupResponse -> Int)
-> (UpdateGatewayGroupResponse
    -> Int -> UpdateGatewayGroupResponse)
-> Lens
     UpdateGatewayGroupResponse UpdateGatewayGroupResponse Int Int
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