{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- 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 qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.DeviceFarm.Types
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
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]
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
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.
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' {$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 :: Lens' DeleteRemoteAccessSession Text
deleteRemoteAccessSession_arn = 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 :: (Service -> Service)
-> DeleteRemoteAccessSession -> Request DeleteRemoteAccessSession
request Service -> Service
overrides =
    forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy DeleteRemoteAccessSession
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteRemoteAccessSession)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
      ( \Int
s ResponseHeaders
h ()
x ->
          Int -> DeleteRemoteAccessSessionResponse
DeleteRemoteAccessSessionResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable DeleteRemoteAccessSession where
  hashWithSalt :: Int -> DeleteRemoteAccessSession -> Int
hashWithSalt Int
_salt DeleteRemoteAccessSession' {Text
arn :: Text
$sel:arn:DeleteRemoteAccessSession' :: DeleteRemoteAccessSession -> Text
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
arn

instance Prelude.NFData DeleteRemoteAccessSession where
  rnf :: DeleteRemoteAccessSession -> ()
rnf DeleteRemoteAccessSession' {Text
arn :: Text
$sel:arn:DeleteRemoteAccessSession' :: DeleteRemoteAccessSession -> Text
..} = forall a. NFData a => a -> ()
Prelude.rnf Text
arn

instance Data.ToHeaders DeleteRemoteAccessSession where
  toHeaders :: DeleteRemoteAccessSession -> ResponseHeaders
toHeaders =
    forall a b. a -> b -> a
Prelude.const
      ( forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"DeviceFarm_20150623.DeleteRemoteAccessSession" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Data.ToJSON DeleteRemoteAccessSession where
  toJSON :: DeleteRemoteAccessSession -> Value
toJSON DeleteRemoteAccessSession' {Text
arn :: Text
$sel:arn:DeleteRemoteAccessSession' :: DeleteRemoteAccessSession -> Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [forall a. a -> Maybe a
Prelude.Just (Key
"arn" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
arn)]
      )

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

instance Data.ToQuery DeleteRemoteAccessSession where
  toQuery :: DeleteRemoteAccessSession -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const 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
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]
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
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.
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'
    { $sel:httpStatus:DeleteRemoteAccessSessionResponse' :: Int
httpStatus =
        Int
pHttpStatus_
    }

-- | The response's http status code.
deleteRemoteAccessSessionResponse_httpStatus :: Lens.Lens' DeleteRemoteAccessSessionResponse Prelude.Int
deleteRemoteAccessSessionResponse_httpStatus :: Lens' DeleteRemoteAccessSessionResponse Int
deleteRemoteAccessSessionResponse_httpStatus = 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
  where
  rnf :: DeleteRemoteAccessSessionResponse -> ()
rnf DeleteRemoteAccessSessionResponse' {Int
httpStatus :: Int
$sel:httpStatus:DeleteRemoteAccessSessionResponse' :: DeleteRemoteAccessSessionResponse -> Int
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus