{-# 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.AssociateSkillWithSkillGroup
-- 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 a skill group.
module Amazonka.AlexaBusiness.AssociateSkillWithSkillGroup
  ( -- * Creating a Request
    AssociateSkillWithSkillGroup (..),
    newAssociateSkillWithSkillGroup,

    -- * Request Lenses
    associateSkillWithSkillGroup_skillGroupArn,
    associateSkillWithSkillGroup_skillId,

    -- * Destructuring the Response
    AssociateSkillWithSkillGroupResponse (..),
    newAssociateSkillWithSkillGroupResponse,

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

-- |
-- Create a value of 'AssociateSkillWithSkillGroup' 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', 'associateSkillWithSkillGroup_skillGroupArn' - The ARN of the skill group to associate the skill to. Required.
--
-- 'skillId', 'associateSkillWithSkillGroup_skillId' - The unique identifier of the skill.
newAssociateSkillWithSkillGroup ::
  -- | 'skillId'
  Prelude.Text ->
  AssociateSkillWithSkillGroup
newAssociateSkillWithSkillGroup :: Text -> AssociateSkillWithSkillGroup
newAssociateSkillWithSkillGroup Text
pSkillId_ =
  AssociateSkillWithSkillGroup' :: Maybe Text -> Text -> AssociateSkillWithSkillGroup
AssociateSkillWithSkillGroup'
    { $sel:skillGroupArn:AssociateSkillWithSkillGroup' :: Maybe Text
skillGroupArn =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:skillId:AssociateSkillWithSkillGroup' :: Text
skillId = Text
pSkillId_
    }

-- | The ARN of the skill group to associate the skill to. Required.
associateSkillWithSkillGroup_skillGroupArn :: Lens.Lens' AssociateSkillWithSkillGroup (Prelude.Maybe Prelude.Text)
associateSkillWithSkillGroup_skillGroupArn :: (Maybe Text -> f (Maybe Text))
-> AssociateSkillWithSkillGroup -> f AssociateSkillWithSkillGroup
associateSkillWithSkillGroup_skillGroupArn = (AssociateSkillWithSkillGroup -> Maybe Text)
-> (AssociateSkillWithSkillGroup
    -> Maybe Text -> AssociateSkillWithSkillGroup)
-> Lens
     AssociateSkillWithSkillGroup
     AssociateSkillWithSkillGroup
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssociateSkillWithSkillGroup' {Maybe Text
skillGroupArn :: Maybe Text
$sel:skillGroupArn:AssociateSkillWithSkillGroup' :: AssociateSkillWithSkillGroup -> Maybe Text
skillGroupArn} -> Maybe Text
skillGroupArn) (\s :: AssociateSkillWithSkillGroup
s@AssociateSkillWithSkillGroup' {} Maybe Text
a -> AssociateSkillWithSkillGroup
s {$sel:skillGroupArn:AssociateSkillWithSkillGroup' :: Maybe Text
skillGroupArn = Maybe Text
a} :: AssociateSkillWithSkillGroup)

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

instance Core.AWSRequest AssociateSkillWithSkillGroup where
  type
    AWSResponse AssociateSkillWithSkillGroup =
      AssociateSkillWithSkillGroupResponse
  request :: AssociateSkillWithSkillGroup
-> Request AssociateSkillWithSkillGroup
request = Service
-> AssociateSkillWithSkillGroup
-> Request AssociateSkillWithSkillGroup
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy AssociateSkillWithSkillGroup
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse AssociateSkillWithSkillGroup)))
response =
    (Int
 -> ResponseHeaders
 -> ()
 -> Either String (AWSResponse AssociateSkillWithSkillGroup))
-> Logger
-> Service
-> Proxy AssociateSkillWithSkillGroup
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse AssociateSkillWithSkillGroup)))
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 -> AssociateSkillWithSkillGroupResponse
AssociateSkillWithSkillGroupResponse'
            (Int -> AssociateSkillWithSkillGroupResponse)
-> Either String Int
-> Either String AssociateSkillWithSkillGroupResponse
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
    AssociateSkillWithSkillGroup

instance Prelude.NFData AssociateSkillWithSkillGroup

instance Core.ToHeaders AssociateSkillWithSkillGroup where
  toHeaders :: AssociateSkillWithSkillGroup -> ResponseHeaders
toHeaders =
    ResponseHeaders -> AssociateSkillWithSkillGroup -> 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.AssociateSkillWithSkillGroup" ::
                          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 AssociateSkillWithSkillGroup where
  toJSON :: AssociateSkillWithSkillGroup -> Value
toJSON AssociateSkillWithSkillGroup' {Maybe Text
Text
skillId :: Text
skillGroupArn :: Maybe Text
$sel:skillId:AssociateSkillWithSkillGroup' :: AssociateSkillWithSkillGroup -> Text
$sel:skillGroupArn:AssociateSkillWithSkillGroup' :: AssociateSkillWithSkillGroup -> 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,
            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 AssociateSkillWithSkillGroup where
  toPath :: AssociateSkillWithSkillGroup -> ByteString
toPath = ByteString -> AssociateSkillWithSkillGroup -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

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

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

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

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

instance
  Prelude.NFData
    AssociateSkillWithSkillGroupResponse