{-# 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.ApproveSkill
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Associates a skill with the organization under the customer\'s AWS
-- account. If a skill is private, the user implicitly accepts access to
-- this skill during enablement.
module Amazonka.AlexaBusiness.ApproveSkill
  ( -- * Creating a Request
    ApproveSkill (..),
    newApproveSkill,

    -- * Request Lenses
    approveSkill_skillId,

    -- * Destructuring the Response
    ApproveSkillResponse (..),
    newApproveSkillResponse,

    -- * Response Lenses
    approveSkillResponse_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:/ 'newApproveSkill' smart constructor.
data ApproveSkill = ApproveSkill'
  { -- | The unique identifier of the skill.
    ApproveSkill -> Text
skillId :: Prelude.Text
  }
  deriving (ApproveSkill -> ApproveSkill -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ApproveSkill -> ApproveSkill -> Bool
$c/= :: ApproveSkill -> ApproveSkill -> Bool
== :: ApproveSkill -> ApproveSkill -> Bool
$c== :: ApproveSkill -> ApproveSkill -> Bool
Prelude.Eq, ReadPrec [ApproveSkill]
ReadPrec ApproveSkill
Int -> ReadS ApproveSkill
ReadS [ApproveSkill]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ApproveSkill]
$creadListPrec :: ReadPrec [ApproveSkill]
readPrec :: ReadPrec ApproveSkill
$creadPrec :: ReadPrec ApproveSkill
readList :: ReadS [ApproveSkill]
$creadList :: ReadS [ApproveSkill]
readsPrec :: Int -> ReadS ApproveSkill
$creadsPrec :: Int -> ReadS ApproveSkill
Prelude.Read, Int -> ApproveSkill -> ShowS
[ApproveSkill] -> ShowS
ApproveSkill -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ApproveSkill] -> ShowS
$cshowList :: [ApproveSkill] -> ShowS
show :: ApproveSkill -> String
$cshow :: ApproveSkill -> String
showsPrec :: Int -> ApproveSkill -> ShowS
$cshowsPrec :: Int -> ApproveSkill -> ShowS
Prelude.Show, forall x. Rep ApproveSkill x -> ApproveSkill
forall x. ApproveSkill -> Rep ApproveSkill x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ApproveSkill x -> ApproveSkill
$cfrom :: forall x. ApproveSkill -> Rep ApproveSkill x
Prelude.Generic)

-- |
-- Create a value of 'ApproveSkill' 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:
--
-- 'skillId', 'approveSkill_skillId' - The unique identifier of the skill.
newApproveSkill ::
  -- | 'skillId'
  Prelude.Text ->
  ApproveSkill
newApproveSkill :: Text -> ApproveSkill
newApproveSkill Text
pSkillId_ =
  ApproveSkill' {$sel:skillId:ApproveSkill' :: Text
skillId = Text
pSkillId_}

-- | The unique identifier of the skill.
approveSkill_skillId :: Lens.Lens' ApproveSkill Prelude.Text
approveSkill_skillId :: Lens' ApproveSkill Text
approveSkill_skillId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ApproveSkill' {Text
skillId :: Text
$sel:skillId:ApproveSkill' :: ApproveSkill -> Text
skillId} -> Text
skillId) (\s :: ApproveSkill
s@ApproveSkill' {} Text
a -> ApproveSkill
s {$sel:skillId:ApproveSkill' :: Text
skillId = Text
a} :: ApproveSkill)

instance Core.AWSRequest ApproveSkill where
  type AWSResponse ApproveSkill = ApproveSkillResponse
  request :: (Service -> Service) -> ApproveSkill -> Request ApproveSkill
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 ApproveSkill
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ApproveSkill)))
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 -> ApproveSkillResponse
ApproveSkillResponse'
            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 ApproveSkill where
  hashWithSalt :: Int -> ApproveSkill -> Int
hashWithSalt Int
_salt ApproveSkill' {Text
skillId :: Text
$sel:skillId:ApproveSkill' :: ApproveSkill -> Text
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
skillId

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

instance Data.ToHeaders ApproveSkill where
  toHeaders :: ApproveSkill -> 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.ApproveSkill" ::
                          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 ApproveSkill where
  toJSON :: ApproveSkill -> Value
toJSON ApproveSkill' {Text
skillId :: Text
$sel:skillId:ApproveSkill' :: ApproveSkill -> Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [forall a. a -> Maybe a
Prelude.Just (Key
"SkillId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
skillId)]
      )

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

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

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

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

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

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