{-# 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.DeviceFarm.DeleteRemoteAccessSession
-- 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)
--
-- Deletes a completed remote access session and its results.
module Amazonka.DeviceFarm.DeleteRemoteAccessSession
  ( -- * Creating a Request
    DeleteRemoteAccessSession (..),
    newDeleteRemoteAccessSession,

    -- * Request Lenses
    deleteRemoteAccessSession_arn,

    -- * Destructuring the Response
    DeleteRemoteAccessSessionResponse (..),
    newDeleteRemoteAccessSessionResponse,

    -- * Response Lenses
    deleteRemoteAccessSessionResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import Amazonka.DeviceFarm.Types
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | Represents the request to delete the specified remote access session.
--
-- /See:/ 'newDeleteRemoteAccessSession' smart constructor.
data DeleteRemoteAccessSession = DeleteRemoteAccessSession'
  { -- | The Amazon Resource Name (ARN) of the session for which you want to
    -- delete remote access.
    DeleteRemoteAccessSession -> Text
arn :: Prelude.Text
  }
  deriving (DeleteRemoteAccessSession -> DeleteRemoteAccessSession -> Bool
(DeleteRemoteAccessSession -> DeleteRemoteAccessSession -> Bool)
-> (DeleteRemoteAccessSession -> DeleteRemoteAccessSession -> Bool)
-> Eq DeleteRemoteAccessSession
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteRemoteAccessSession -> DeleteRemoteAccessSession -> Bool
$c/= :: DeleteRemoteAccessSession -> DeleteRemoteAccessSession -> Bool
== :: DeleteRemoteAccessSession -> DeleteRemoteAccessSession -> Bool
$c== :: DeleteRemoteAccessSession -> DeleteRemoteAccessSession -> Bool
Prelude.Eq, ReadPrec [DeleteRemoteAccessSession]
ReadPrec DeleteRemoteAccessSession
Int -> ReadS DeleteRemoteAccessSession
ReadS [DeleteRemoteAccessSession]
(Int -> ReadS DeleteRemoteAccessSession)
-> ReadS [DeleteRemoteAccessSession]
-> ReadPrec DeleteRemoteAccessSession
-> ReadPrec [DeleteRemoteAccessSession]
-> Read DeleteRemoteAccessSession
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteRemoteAccessSession]
$creadListPrec :: ReadPrec [DeleteRemoteAccessSession]
readPrec :: ReadPrec DeleteRemoteAccessSession
$creadPrec :: ReadPrec DeleteRemoteAccessSession
readList :: ReadS [DeleteRemoteAccessSession]
$creadList :: ReadS [DeleteRemoteAccessSession]
readsPrec :: Int -> ReadS DeleteRemoteAccessSession
$creadsPrec :: Int -> ReadS DeleteRemoteAccessSession
Prelude.Read, Int -> DeleteRemoteAccessSession -> ShowS
[DeleteRemoteAccessSession] -> ShowS
DeleteRemoteAccessSession -> String
(Int -> DeleteRemoteAccessSession -> ShowS)
-> (DeleteRemoteAccessSession -> String)
-> ([DeleteRemoteAccessSession] -> ShowS)
-> Show DeleteRemoteAccessSession
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteRemoteAccessSession] -> ShowS
$cshowList :: [DeleteRemoteAccessSession] -> ShowS
show :: DeleteRemoteAccessSession -> String
$cshow :: DeleteRemoteAccessSession -> String
showsPrec :: Int -> DeleteRemoteAccessSession -> ShowS
$cshowsPrec :: Int -> DeleteRemoteAccessSession -> ShowS
Prelude.Show, (forall x.
 DeleteRemoteAccessSession -> Rep DeleteRemoteAccessSession x)
-> (forall x.
    Rep DeleteRemoteAccessSession x -> DeleteRemoteAccessSession)
-> Generic DeleteRemoteAccessSession
forall x.
Rep DeleteRemoteAccessSession x -> DeleteRemoteAccessSession
forall x.
DeleteRemoteAccessSession -> Rep DeleteRemoteAccessSession x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DeleteRemoteAccessSession x -> DeleteRemoteAccessSession
$cfrom :: forall x.
DeleteRemoteAccessSession -> Rep DeleteRemoteAccessSession x
Prelude.Generic)

-- |
-- Create a value of 'DeleteRemoteAccessSession' 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:
--
-- 'arn', 'deleteRemoteAccessSession_arn' - The Amazon Resource Name (ARN) of the session for which you want to
-- delete remote access.
newDeleteRemoteAccessSession ::
  -- | 'arn'
  Prelude.Text ->
  DeleteRemoteAccessSession
newDeleteRemoteAccessSession :: Text -> DeleteRemoteAccessSession
newDeleteRemoteAccessSession Text
pArn_ =
  DeleteRemoteAccessSession' :: Text -> DeleteRemoteAccessSession
DeleteRemoteAccessSession' {$sel:arn:DeleteRemoteAccessSession' :: Text
arn = Text
pArn_}

-- | The Amazon Resource Name (ARN) of the session for which you want to
-- delete remote access.
deleteRemoteAccessSession_arn :: Lens.Lens' DeleteRemoteAccessSession Prelude.Text
deleteRemoteAccessSession_arn :: (Text -> f Text)
-> DeleteRemoteAccessSession -> f DeleteRemoteAccessSession
deleteRemoteAccessSession_arn = (DeleteRemoteAccessSession -> Text)
-> (DeleteRemoteAccessSession -> Text -> DeleteRemoteAccessSession)
-> Lens
     DeleteRemoteAccessSession DeleteRemoteAccessSession Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteRemoteAccessSession' {Text
arn :: Text
$sel:arn:DeleteRemoteAccessSession' :: DeleteRemoteAccessSession -> Text
arn} -> Text
arn) (\s :: DeleteRemoteAccessSession
s@DeleteRemoteAccessSession' {} Text
a -> DeleteRemoteAccessSession
s {$sel:arn:DeleteRemoteAccessSession' :: Text
arn = Text
a} :: DeleteRemoteAccessSession)

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

instance Prelude.NFData DeleteRemoteAccessSession

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

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

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

-- | The response from the server when a request is made to delete the remote
-- access session.
--
-- /See:/ 'newDeleteRemoteAccessSessionResponse' smart constructor.
data DeleteRemoteAccessSessionResponse = DeleteRemoteAccessSessionResponse'
  { -- | The response's http status code.
    DeleteRemoteAccessSessionResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DeleteRemoteAccessSessionResponse
-> DeleteRemoteAccessSessionResponse -> Bool
(DeleteRemoteAccessSessionResponse
 -> DeleteRemoteAccessSessionResponse -> Bool)
-> (DeleteRemoteAccessSessionResponse
    -> DeleteRemoteAccessSessionResponse -> Bool)
-> Eq DeleteRemoteAccessSessionResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteRemoteAccessSessionResponse
-> DeleteRemoteAccessSessionResponse -> Bool
$c/= :: DeleteRemoteAccessSessionResponse
-> DeleteRemoteAccessSessionResponse -> Bool
== :: DeleteRemoteAccessSessionResponse
-> DeleteRemoteAccessSessionResponse -> Bool
$c== :: DeleteRemoteAccessSessionResponse
-> DeleteRemoteAccessSessionResponse -> Bool
Prelude.Eq, ReadPrec [DeleteRemoteAccessSessionResponse]
ReadPrec DeleteRemoteAccessSessionResponse
Int -> ReadS DeleteRemoteAccessSessionResponse
ReadS [DeleteRemoteAccessSessionResponse]
(Int -> ReadS DeleteRemoteAccessSessionResponse)
-> ReadS [DeleteRemoteAccessSessionResponse]
-> ReadPrec DeleteRemoteAccessSessionResponse
-> ReadPrec [DeleteRemoteAccessSessionResponse]
-> Read DeleteRemoteAccessSessionResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteRemoteAccessSessionResponse]
$creadListPrec :: ReadPrec [DeleteRemoteAccessSessionResponse]
readPrec :: ReadPrec DeleteRemoteAccessSessionResponse
$creadPrec :: ReadPrec DeleteRemoteAccessSessionResponse
readList :: ReadS [DeleteRemoteAccessSessionResponse]
$creadList :: ReadS [DeleteRemoteAccessSessionResponse]
readsPrec :: Int -> ReadS DeleteRemoteAccessSessionResponse
$creadsPrec :: Int -> ReadS DeleteRemoteAccessSessionResponse
Prelude.Read, Int -> DeleteRemoteAccessSessionResponse -> ShowS
[DeleteRemoteAccessSessionResponse] -> ShowS
DeleteRemoteAccessSessionResponse -> String
(Int -> DeleteRemoteAccessSessionResponse -> ShowS)
-> (DeleteRemoteAccessSessionResponse -> String)
-> ([DeleteRemoteAccessSessionResponse] -> ShowS)
-> Show DeleteRemoteAccessSessionResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteRemoteAccessSessionResponse] -> ShowS
$cshowList :: [DeleteRemoteAccessSessionResponse] -> ShowS
show :: DeleteRemoteAccessSessionResponse -> String
$cshow :: DeleteRemoteAccessSessionResponse -> String
showsPrec :: Int -> DeleteRemoteAccessSessionResponse -> ShowS
$cshowsPrec :: Int -> DeleteRemoteAccessSessionResponse -> ShowS
Prelude.Show, (forall x.
 DeleteRemoteAccessSessionResponse
 -> Rep DeleteRemoteAccessSessionResponse x)
-> (forall x.
    Rep DeleteRemoteAccessSessionResponse x
    -> DeleteRemoteAccessSessionResponse)
-> Generic DeleteRemoteAccessSessionResponse
forall x.
Rep DeleteRemoteAccessSessionResponse x
-> DeleteRemoteAccessSessionResponse
forall x.
DeleteRemoteAccessSessionResponse
-> Rep DeleteRemoteAccessSessionResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DeleteRemoteAccessSessionResponse x
-> DeleteRemoteAccessSessionResponse
$cfrom :: forall x.
DeleteRemoteAccessSessionResponse
-> Rep DeleteRemoteAccessSessionResponse x
Prelude.Generic)

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

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

instance
  Prelude.NFData
    DeleteRemoteAccessSessionResponse