{-# 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-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)
--
-- 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.Lens as Lens
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
(ApproveSkill -> ApproveSkill -> Bool)
-> (ApproveSkill -> ApproveSkill -> Bool) -> Eq ApproveSkill
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]
(Int -> ReadS ApproveSkill)
-> ReadS [ApproveSkill]
-> ReadPrec ApproveSkill
-> ReadPrec [ApproveSkill]
-> Read 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
(Int -> ApproveSkill -> ShowS)
-> (ApproveSkill -> String)
-> ([ApproveSkill] -> ShowS)
-> Show ApproveSkill
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. ApproveSkill -> Rep ApproveSkill x)
-> (forall x. Rep ApproveSkill x -> ApproveSkill)
-> Generic ApproveSkill
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' :: Text -> ApproveSkill
ApproveSkill' {$sel:skillId:ApproveSkill' :: Text
skillId = Text
pSkillId_}

-- | The unique identifier of the skill.
approveSkill_skillId :: Lens.Lens' ApproveSkill Prelude.Text
approveSkill_skillId :: (Text -> f Text) -> ApproveSkill -> f ApproveSkill
approveSkill_skillId = (ApproveSkill -> Text)
-> (ApproveSkill -> Text -> ApproveSkill)
-> Lens ApproveSkill ApproveSkill Text Text
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 :: ApproveSkill -> Request ApproveSkill
request = Service -> ApproveSkill -> Request ApproveSkill
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy ApproveSkill
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ApproveSkill)))
response =
    (Int
 -> ResponseHeaders
 -> ()
 -> Either String (AWSResponse ApproveSkill))
-> Logger
-> Service
-> Proxy ApproveSkill
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ApproveSkill)))
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 -> ApproveSkillResponse
ApproveSkillResponse'
            (Int -> ApproveSkillResponse)
-> Either String Int -> Either String ApproveSkillResponse
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 ApproveSkill

instance Prelude.NFData ApproveSkill

instance Core.ToHeaders ApproveSkill where
  toHeaders :: ApproveSkill -> ResponseHeaders
toHeaders =
    ResponseHeaders -> ApproveSkill -> 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.ApproveSkill" ::
                          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 ApproveSkill where
  toJSON :: ApproveSkill -> Value
toJSON ApproveSkill' {Text
skillId :: Text
$sel:skillId:ApproveSkill' :: ApproveSkill -> 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
"SkillId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
skillId)]
      )

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

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

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