{-# 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.GetGatewayGroup
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Retrieves the details of a gateway group.
module Amazonka.AlexaBusiness.GetGatewayGroup
  ( -- * Creating a Request
    GetGatewayGroup (..),
    newGetGatewayGroup,

    -- * Request Lenses
    getGatewayGroup_gatewayGroupArn,

    -- * Destructuring the Response
    GetGatewayGroupResponse (..),
    newGetGatewayGroupResponse,

    -- * Response Lenses
    getGatewayGroupResponse_gatewayGroup,
    getGatewayGroupResponse_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:/ 'newGetGatewayGroup' smart constructor.
data GetGatewayGroup = GetGatewayGroup'
  { -- | The ARN of the gateway group to get.
    GetGatewayGroup -> Text
gatewayGroupArn :: Prelude.Text
  }
  deriving (GetGatewayGroup -> GetGatewayGroup -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetGatewayGroup -> GetGatewayGroup -> Bool
$c/= :: GetGatewayGroup -> GetGatewayGroup -> Bool
== :: GetGatewayGroup -> GetGatewayGroup -> Bool
$c== :: GetGatewayGroup -> GetGatewayGroup -> Bool
Prelude.Eq, ReadPrec [GetGatewayGroup]
ReadPrec GetGatewayGroup
Int -> ReadS GetGatewayGroup
ReadS [GetGatewayGroup]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetGatewayGroup]
$creadListPrec :: ReadPrec [GetGatewayGroup]
readPrec :: ReadPrec GetGatewayGroup
$creadPrec :: ReadPrec GetGatewayGroup
readList :: ReadS [GetGatewayGroup]
$creadList :: ReadS [GetGatewayGroup]
readsPrec :: Int -> ReadS GetGatewayGroup
$creadsPrec :: Int -> ReadS GetGatewayGroup
Prelude.Read, Int -> GetGatewayGroup -> ShowS
[GetGatewayGroup] -> ShowS
GetGatewayGroup -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetGatewayGroup] -> ShowS
$cshowList :: [GetGatewayGroup] -> ShowS
show :: GetGatewayGroup -> String
$cshow :: GetGatewayGroup -> String
showsPrec :: Int -> GetGatewayGroup -> ShowS
$cshowsPrec :: Int -> GetGatewayGroup -> ShowS
Prelude.Show, forall x. Rep GetGatewayGroup x -> GetGatewayGroup
forall x. GetGatewayGroup -> Rep GetGatewayGroup x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetGatewayGroup x -> GetGatewayGroup
$cfrom :: forall x. GetGatewayGroup -> Rep GetGatewayGroup x
Prelude.Generic)

-- |
-- Create a value of 'GetGatewayGroup' 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:
--
-- 'gatewayGroupArn', 'getGatewayGroup_gatewayGroupArn' - The ARN of the gateway group to get.
newGetGatewayGroup ::
  -- | 'gatewayGroupArn'
  Prelude.Text ->
  GetGatewayGroup
newGetGatewayGroup :: Text -> GetGatewayGroup
newGetGatewayGroup Text
pGatewayGroupArn_ =
  GetGatewayGroup'
    { $sel:gatewayGroupArn:GetGatewayGroup' :: Text
gatewayGroupArn =
        Text
pGatewayGroupArn_
    }

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

instance Core.AWSRequest GetGatewayGroup where
  type
    AWSResponse GetGatewayGroup =
      GetGatewayGroupResponse
  request :: (Service -> Service) -> GetGatewayGroup -> Request GetGatewayGroup
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 GetGatewayGroup
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetGatewayGroup)))
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 ->
          Maybe GatewayGroup -> Int -> GetGatewayGroupResponse
GetGatewayGroupResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"GatewayGroup")
            forall (f :: * -> *) a b. Applicative f => 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 GetGatewayGroup where
  hashWithSalt :: Int -> GetGatewayGroup -> Int
hashWithSalt Int
_salt GetGatewayGroup' {Text
gatewayGroupArn :: Text
$sel:gatewayGroupArn:GetGatewayGroup' :: GetGatewayGroup -> Text
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
gatewayGroupArn

instance Prelude.NFData GetGatewayGroup where
  rnf :: GetGatewayGroup -> ()
rnf GetGatewayGroup' {Text
gatewayGroupArn :: Text
$sel:gatewayGroupArn:GetGatewayGroup' :: GetGatewayGroup -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
gatewayGroupArn

instance Data.ToHeaders GetGatewayGroup where
  toHeaders :: GetGatewayGroup -> 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.GetGatewayGroup" ::
                          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 GetGatewayGroup where
  toJSON :: GetGatewayGroup -> Value
toJSON GetGatewayGroup' {Text
gatewayGroupArn :: Text
$sel:gatewayGroupArn:GetGatewayGroup' :: GetGatewayGroup -> Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ 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 GetGatewayGroup where
  toPath :: GetGatewayGroup -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"

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

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

-- |
-- Create a value of 'GetGatewayGroupResponse' 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:
--
-- 'gatewayGroup', 'getGatewayGroupResponse_gatewayGroup' - Undocumented member.
--
-- 'httpStatus', 'getGatewayGroupResponse_httpStatus' - The response's http status code.
newGetGatewayGroupResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  GetGatewayGroupResponse
newGetGatewayGroupResponse :: Int -> GetGatewayGroupResponse
newGetGatewayGroupResponse Int
pHttpStatus_ =
  GetGatewayGroupResponse'
    { $sel:gatewayGroup:GetGatewayGroupResponse' :: Maybe GatewayGroup
gatewayGroup =
        forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:GetGatewayGroupResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | Undocumented member.
getGatewayGroupResponse_gatewayGroup :: Lens.Lens' GetGatewayGroupResponse (Prelude.Maybe GatewayGroup)
getGatewayGroupResponse_gatewayGroup :: Lens' GetGatewayGroupResponse (Maybe GatewayGroup)
getGatewayGroupResponse_gatewayGroup = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetGatewayGroupResponse' {Maybe GatewayGroup
gatewayGroup :: Maybe GatewayGroup
$sel:gatewayGroup:GetGatewayGroupResponse' :: GetGatewayGroupResponse -> Maybe GatewayGroup
gatewayGroup} -> Maybe GatewayGroup
gatewayGroup) (\s :: GetGatewayGroupResponse
s@GetGatewayGroupResponse' {} Maybe GatewayGroup
a -> GetGatewayGroupResponse
s {$sel:gatewayGroup:GetGatewayGroupResponse' :: Maybe GatewayGroup
gatewayGroup = Maybe GatewayGroup
a} :: GetGatewayGroupResponse)

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

instance Prelude.NFData GetGatewayGroupResponse where
  rnf :: GetGatewayGroupResponse -> ()
rnf GetGatewayGroupResponse' {Int
Maybe GatewayGroup
httpStatus :: Int
gatewayGroup :: Maybe GatewayGroup
$sel:httpStatus:GetGatewayGroupResponse' :: GetGatewayGroupResponse -> Int
$sel:gatewayGroup:GetGatewayGroupResponse' :: GetGatewayGroupResponse -> Maybe GatewayGroup
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe GatewayGroup
gatewayGroup
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus