{-# 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-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)
--
-- 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.Lens as Lens
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
(GetGatewayGroup -> GetGatewayGroup -> Bool)
-> (GetGatewayGroup -> GetGatewayGroup -> Bool)
-> Eq GetGatewayGroup
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]
(Int -> ReadS GetGatewayGroup)
-> ReadS [GetGatewayGroup]
-> ReadPrec GetGatewayGroup
-> ReadPrec [GetGatewayGroup]
-> Read 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
(Int -> GetGatewayGroup -> ShowS)
-> (GetGatewayGroup -> String)
-> ([GetGatewayGroup] -> ShowS)
-> Show GetGatewayGroup
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. GetGatewayGroup -> Rep GetGatewayGroup x)
-> (forall x. Rep GetGatewayGroup x -> GetGatewayGroup)
-> Generic GetGatewayGroup
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' :: Text -> GetGatewayGroup
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 :: (Text -> f Text) -> GetGatewayGroup -> f GetGatewayGroup
getGatewayGroup_gatewayGroupArn = (GetGatewayGroup -> Text)
-> (GetGatewayGroup -> Text -> GetGatewayGroup)
-> Lens GetGatewayGroup GetGatewayGroup Text Text
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 :: GetGatewayGroup -> Request GetGatewayGroup
request = Service -> GetGatewayGroup -> Request GetGatewayGroup
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy GetGatewayGroup
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetGatewayGroup)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse GetGatewayGroup))
-> Logger
-> Service
-> Proxy GetGatewayGroup
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetGatewayGroup)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe GatewayGroup -> Int -> GetGatewayGroupResponse
GetGatewayGroupResponse'
            (Maybe GatewayGroup -> Int -> GetGatewayGroupResponse)
-> Either String (Maybe GatewayGroup)
-> Either String (Int -> GetGatewayGroupResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe GatewayGroup)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"GatewayGroup")
            Either String (Int -> GetGatewayGroupResponse)
-> Either String Int -> Either String GetGatewayGroupResponse
forall (f :: * -> *) a b. Applicative f => 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 GetGatewayGroup

instance Prelude.NFData GetGatewayGroup

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

instance Core.ToQuery GetGatewayGroup where
  toQuery :: GetGatewayGroup -> QueryString
toQuery = QueryString -> GetGatewayGroup -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
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
(GetGatewayGroupResponse -> GetGatewayGroupResponse -> Bool)
-> (GetGatewayGroupResponse -> GetGatewayGroupResponse -> Bool)
-> Eq GetGatewayGroupResponse
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]
(Int -> ReadS GetGatewayGroupResponse)
-> ReadS [GetGatewayGroupResponse]
-> ReadPrec GetGatewayGroupResponse
-> ReadPrec [GetGatewayGroupResponse]
-> Read 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
(Int -> GetGatewayGroupResponse -> ShowS)
-> (GetGatewayGroupResponse -> String)
-> ([GetGatewayGroupResponse] -> ShowS)
-> Show GetGatewayGroupResponse
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.
 GetGatewayGroupResponse -> Rep GetGatewayGroupResponse x)
-> (forall x.
    Rep GetGatewayGroupResponse x -> GetGatewayGroupResponse)
-> Generic GetGatewayGroupResponse
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' :: Maybe GatewayGroup -> Int -> GetGatewayGroupResponse
GetGatewayGroupResponse'
    { $sel:gatewayGroup:GetGatewayGroupResponse' :: Maybe GatewayGroup
gatewayGroup =
        Maybe 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 :: (Maybe GatewayGroup -> f (Maybe GatewayGroup))
-> GetGatewayGroupResponse -> f GetGatewayGroupResponse
getGatewayGroupResponse_gatewayGroup = (GetGatewayGroupResponse -> Maybe GatewayGroup)
-> (GetGatewayGroupResponse
    -> Maybe GatewayGroup -> GetGatewayGroupResponse)
-> Lens
     GetGatewayGroupResponse
     GetGatewayGroupResponse
     (Maybe GatewayGroup)
     (Maybe 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 :: (Int -> f Int)
-> GetGatewayGroupResponse -> f GetGatewayGroupResponse
getGatewayGroupResponse_httpStatus = (GetGatewayGroupResponse -> Int)
-> (GetGatewayGroupResponse -> Int -> GetGatewayGroupResponse)
-> Lens GetGatewayGroupResponse GetGatewayGroupResponse Int Int
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