{-# 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.GetSkillGroup
-- 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)
--
-- Gets skill group details by skill group ARN.
module Amazonka.AlexaBusiness.GetSkillGroup
  ( -- * Creating a Request
    GetSkillGroup (..),
    newGetSkillGroup,

    -- * Request Lenses
    getSkillGroup_skillGroupArn,

    -- * Destructuring the Response
    GetSkillGroupResponse (..),
    newGetSkillGroupResponse,

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

-- |
-- Create a value of 'GetSkillGroup' 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:
--
-- 'skillGroupArn', 'getSkillGroup_skillGroupArn' - The ARN of the skill group for which to get details. Required.
newGetSkillGroup ::
  GetSkillGroup
newGetSkillGroup :: GetSkillGroup
newGetSkillGroup =
  GetSkillGroup' :: Maybe Text -> GetSkillGroup
GetSkillGroup' {$sel:skillGroupArn:GetSkillGroup' :: Maybe Text
skillGroupArn = Maybe Text
forall a. Maybe a
Prelude.Nothing}

-- | The ARN of the skill group for which to get details. Required.
getSkillGroup_skillGroupArn :: Lens.Lens' GetSkillGroup (Prelude.Maybe Prelude.Text)
getSkillGroup_skillGroupArn :: (Maybe Text -> f (Maybe Text)) -> GetSkillGroup -> f GetSkillGroup
getSkillGroup_skillGroupArn = (GetSkillGroup -> Maybe Text)
-> (GetSkillGroup -> Maybe Text -> GetSkillGroup)
-> Lens GetSkillGroup GetSkillGroup (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetSkillGroup' {Maybe Text
skillGroupArn :: Maybe Text
$sel:skillGroupArn:GetSkillGroup' :: GetSkillGroup -> Maybe Text
skillGroupArn} -> Maybe Text
skillGroupArn) (\s :: GetSkillGroup
s@GetSkillGroup' {} Maybe Text
a -> GetSkillGroup
s {$sel:skillGroupArn:GetSkillGroup' :: Maybe Text
skillGroupArn = Maybe Text
a} :: GetSkillGroup)

instance Core.AWSRequest GetSkillGroup where
  type
    AWSResponse GetSkillGroup =
      GetSkillGroupResponse
  request :: GetSkillGroup -> Request GetSkillGroup
request = Service -> GetSkillGroup -> Request GetSkillGroup
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy GetSkillGroup
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetSkillGroup)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse GetSkillGroup))
-> Logger
-> Service
-> Proxy GetSkillGroup
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetSkillGroup)))
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 SkillGroup -> Int -> GetSkillGroupResponse
GetSkillGroupResponse'
            (Maybe SkillGroup -> Int -> GetSkillGroupResponse)
-> Either String (Maybe SkillGroup)
-> Either String (Int -> GetSkillGroupResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe SkillGroup)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"SkillGroup")
            Either String (Int -> GetSkillGroupResponse)
-> Either String Int -> Either String GetSkillGroupResponse
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 GetSkillGroup

instance Prelude.NFData GetSkillGroup

instance Core.ToHeaders GetSkillGroup where
  toHeaders :: GetSkillGroup -> ResponseHeaders
toHeaders =
    ResponseHeaders -> GetSkillGroup -> 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.GetSkillGroup" ::
                          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 GetSkillGroup where
  toJSON :: GetSkillGroup -> Value
toJSON GetSkillGroup' {Maybe Text
skillGroupArn :: Maybe Text
$sel:skillGroupArn:GetSkillGroup' :: GetSkillGroup -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"SkillGroupArn" 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
skillGroupArn
          ]
      )

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

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

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

-- |
-- Create a value of 'GetSkillGroupResponse' 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:
--
-- 'skillGroup', 'getSkillGroupResponse_skillGroup' - The details of the skill group requested. Required.
--
-- 'httpStatus', 'getSkillGroupResponse_httpStatus' - The response's http status code.
newGetSkillGroupResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  GetSkillGroupResponse
newGetSkillGroupResponse :: Int -> GetSkillGroupResponse
newGetSkillGroupResponse Int
pHttpStatus_ =
  GetSkillGroupResponse' :: Maybe SkillGroup -> Int -> GetSkillGroupResponse
GetSkillGroupResponse'
    { $sel:skillGroup:GetSkillGroupResponse' :: Maybe SkillGroup
skillGroup =
        Maybe SkillGroup
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:GetSkillGroupResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The details of the skill group requested. Required.
getSkillGroupResponse_skillGroup :: Lens.Lens' GetSkillGroupResponse (Prelude.Maybe SkillGroup)
getSkillGroupResponse_skillGroup :: (Maybe SkillGroup -> f (Maybe SkillGroup))
-> GetSkillGroupResponse -> f GetSkillGroupResponse
getSkillGroupResponse_skillGroup = (GetSkillGroupResponse -> Maybe SkillGroup)
-> (GetSkillGroupResponse
    -> Maybe SkillGroup -> GetSkillGroupResponse)
-> Lens
     GetSkillGroupResponse
     GetSkillGroupResponse
     (Maybe SkillGroup)
     (Maybe SkillGroup)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetSkillGroupResponse' {Maybe SkillGroup
skillGroup :: Maybe SkillGroup
$sel:skillGroup:GetSkillGroupResponse' :: GetSkillGroupResponse -> Maybe SkillGroup
skillGroup} -> Maybe SkillGroup
skillGroup) (\s :: GetSkillGroupResponse
s@GetSkillGroupResponse' {} Maybe SkillGroup
a -> GetSkillGroupResponse
s {$sel:skillGroup:GetSkillGroupResponse' :: Maybe SkillGroup
skillGroup = Maybe SkillGroup
a} :: GetSkillGroupResponse)

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

instance Prelude.NFData GetSkillGroupResponse