{-# 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.DeleteSkillAuthorization
-- 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)
--
-- Unlinks a third-party account from a skill.
module Amazonka.AlexaBusiness.DeleteSkillAuthorization
  ( -- * Creating a Request
    DeleteSkillAuthorization (..),
    newDeleteSkillAuthorization,

    -- * Request Lenses
    deleteSkillAuthorization_roomArn,
    deleteSkillAuthorization_skillId,

    -- * Destructuring the Response
    DeleteSkillAuthorizationResponse (..),
    newDeleteSkillAuthorizationResponse,

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

-- |
-- Create a value of 'DeleteSkillAuthorization' 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:
--
-- 'roomArn', 'deleteSkillAuthorization_roomArn' - The room that the skill is authorized for.
--
-- 'skillId', 'deleteSkillAuthorization_skillId' - The unique identifier of a skill.
newDeleteSkillAuthorization ::
  -- | 'skillId'
  Prelude.Text ->
  DeleteSkillAuthorization
newDeleteSkillAuthorization :: Text -> DeleteSkillAuthorization
newDeleteSkillAuthorization Text
pSkillId_ =
  DeleteSkillAuthorization' :: Maybe Text -> Text -> DeleteSkillAuthorization
DeleteSkillAuthorization'
    { $sel:roomArn:DeleteSkillAuthorization' :: Maybe Text
roomArn =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:skillId:DeleteSkillAuthorization' :: Text
skillId = Text
pSkillId_
    }

-- | The room that the skill is authorized for.
deleteSkillAuthorization_roomArn :: Lens.Lens' DeleteSkillAuthorization (Prelude.Maybe Prelude.Text)
deleteSkillAuthorization_roomArn :: (Maybe Text -> f (Maybe Text))
-> DeleteSkillAuthorization -> f DeleteSkillAuthorization
deleteSkillAuthorization_roomArn = (DeleteSkillAuthorization -> Maybe Text)
-> (DeleteSkillAuthorization
    -> Maybe Text -> DeleteSkillAuthorization)
-> Lens
     DeleteSkillAuthorization
     DeleteSkillAuthorization
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteSkillAuthorization' {Maybe Text
roomArn :: Maybe Text
$sel:roomArn:DeleteSkillAuthorization' :: DeleteSkillAuthorization -> Maybe Text
roomArn} -> Maybe Text
roomArn) (\s :: DeleteSkillAuthorization
s@DeleteSkillAuthorization' {} Maybe Text
a -> DeleteSkillAuthorization
s {$sel:roomArn:DeleteSkillAuthorization' :: Maybe Text
roomArn = Maybe Text
a} :: DeleteSkillAuthorization)

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

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

instance Prelude.NFData DeleteSkillAuthorization

instance Core.ToHeaders DeleteSkillAuthorization where
  toHeaders :: DeleteSkillAuthorization -> ResponseHeaders
toHeaders =
    ResponseHeaders -> DeleteSkillAuthorization -> 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.DeleteSkillAuthorization" ::
                          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 DeleteSkillAuthorization where
  toJSON :: DeleteSkillAuthorization -> Value
toJSON DeleteSkillAuthorization' {Maybe Text
Text
skillId :: Text
roomArn :: Maybe Text
$sel:skillId:DeleteSkillAuthorization' :: DeleteSkillAuthorization -> Text
$sel:roomArn:DeleteSkillAuthorization' :: DeleteSkillAuthorization -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"RoomArn" 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
roomArn,
            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 DeleteSkillAuthorization where
  toPath :: DeleteSkillAuthorization -> ByteString
toPath = ByteString -> DeleteSkillAuthorization -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

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

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

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

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

instance
  Prelude.NFData
    DeleteSkillAuthorizationResponse