{-# 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.AssociateSkillWithUsers
-- 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)
--
-- Makes a private skill available for enrolled users to enable on their
-- devices.
module Amazonka.AlexaBusiness.AssociateSkillWithUsers
  ( -- * Creating a Request
    AssociateSkillWithUsers (..),
    newAssociateSkillWithUsers,

    -- * Request Lenses
    associateSkillWithUsers_skillId,

    -- * Destructuring the Response
    AssociateSkillWithUsersResponse (..),
    newAssociateSkillWithUsersResponse,

    -- * Response Lenses
    associateSkillWithUsersResponse_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:/ 'newAssociateSkillWithUsers' smart constructor.
data AssociateSkillWithUsers = AssociateSkillWithUsers'
  { -- | The private skill ID you want to make available to enrolled users.
    AssociateSkillWithUsers -> Text
skillId :: Prelude.Text
  }
  deriving (AssociateSkillWithUsers -> AssociateSkillWithUsers -> Bool
(AssociateSkillWithUsers -> AssociateSkillWithUsers -> Bool)
-> (AssociateSkillWithUsers -> AssociateSkillWithUsers -> Bool)
-> Eq AssociateSkillWithUsers
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AssociateSkillWithUsers -> AssociateSkillWithUsers -> Bool
$c/= :: AssociateSkillWithUsers -> AssociateSkillWithUsers -> Bool
== :: AssociateSkillWithUsers -> AssociateSkillWithUsers -> Bool
$c== :: AssociateSkillWithUsers -> AssociateSkillWithUsers -> Bool
Prelude.Eq, ReadPrec [AssociateSkillWithUsers]
ReadPrec AssociateSkillWithUsers
Int -> ReadS AssociateSkillWithUsers
ReadS [AssociateSkillWithUsers]
(Int -> ReadS AssociateSkillWithUsers)
-> ReadS [AssociateSkillWithUsers]
-> ReadPrec AssociateSkillWithUsers
-> ReadPrec [AssociateSkillWithUsers]
-> Read AssociateSkillWithUsers
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AssociateSkillWithUsers]
$creadListPrec :: ReadPrec [AssociateSkillWithUsers]
readPrec :: ReadPrec AssociateSkillWithUsers
$creadPrec :: ReadPrec AssociateSkillWithUsers
readList :: ReadS [AssociateSkillWithUsers]
$creadList :: ReadS [AssociateSkillWithUsers]
readsPrec :: Int -> ReadS AssociateSkillWithUsers
$creadsPrec :: Int -> ReadS AssociateSkillWithUsers
Prelude.Read, Int -> AssociateSkillWithUsers -> ShowS
[AssociateSkillWithUsers] -> ShowS
AssociateSkillWithUsers -> String
(Int -> AssociateSkillWithUsers -> ShowS)
-> (AssociateSkillWithUsers -> String)
-> ([AssociateSkillWithUsers] -> ShowS)
-> Show AssociateSkillWithUsers
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AssociateSkillWithUsers] -> ShowS
$cshowList :: [AssociateSkillWithUsers] -> ShowS
show :: AssociateSkillWithUsers -> String
$cshow :: AssociateSkillWithUsers -> String
showsPrec :: Int -> AssociateSkillWithUsers -> ShowS
$cshowsPrec :: Int -> AssociateSkillWithUsers -> ShowS
Prelude.Show, (forall x.
 AssociateSkillWithUsers -> Rep AssociateSkillWithUsers x)
-> (forall x.
    Rep AssociateSkillWithUsers x -> AssociateSkillWithUsers)
-> Generic AssociateSkillWithUsers
forall x. Rep AssociateSkillWithUsers x -> AssociateSkillWithUsers
forall x. AssociateSkillWithUsers -> Rep AssociateSkillWithUsers x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AssociateSkillWithUsers x -> AssociateSkillWithUsers
$cfrom :: forall x. AssociateSkillWithUsers -> Rep AssociateSkillWithUsers x
Prelude.Generic)

-- |
-- Create a value of 'AssociateSkillWithUsers' 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', 'associateSkillWithUsers_skillId' - The private skill ID you want to make available to enrolled users.
newAssociateSkillWithUsers ::
  -- | 'skillId'
  Prelude.Text ->
  AssociateSkillWithUsers
newAssociateSkillWithUsers :: Text -> AssociateSkillWithUsers
newAssociateSkillWithUsers Text
pSkillId_ =
  AssociateSkillWithUsers' :: Text -> AssociateSkillWithUsers
AssociateSkillWithUsers' {$sel:skillId:AssociateSkillWithUsers' :: Text
skillId = Text
pSkillId_}

-- | The private skill ID you want to make available to enrolled users.
associateSkillWithUsers_skillId :: Lens.Lens' AssociateSkillWithUsers Prelude.Text
associateSkillWithUsers_skillId :: (Text -> f Text)
-> AssociateSkillWithUsers -> f AssociateSkillWithUsers
associateSkillWithUsers_skillId = (AssociateSkillWithUsers -> Text)
-> (AssociateSkillWithUsers -> Text -> AssociateSkillWithUsers)
-> Lens AssociateSkillWithUsers AssociateSkillWithUsers Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssociateSkillWithUsers' {Text
skillId :: Text
$sel:skillId:AssociateSkillWithUsers' :: AssociateSkillWithUsers -> Text
skillId} -> Text
skillId) (\s :: AssociateSkillWithUsers
s@AssociateSkillWithUsers' {} Text
a -> AssociateSkillWithUsers
s {$sel:skillId:AssociateSkillWithUsers' :: Text
skillId = Text
a} :: AssociateSkillWithUsers)

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

instance Prelude.NFData AssociateSkillWithUsers

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

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

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

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

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

instance
  Prelude.NFData
    AssociateSkillWithUsersResponse