{-# 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.GetSuite
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Gets information about a suite.
module Amazonka.DeviceFarm.GetSuite
  ( -- * Creating a Request
    GetSuite (..),
    newGetSuite,

    -- * Request Lenses
    getSuite_arn,

    -- * Destructuring the Response
    GetSuiteResponse (..),
    newGetSuiteResponse,

    -- * Response Lenses
    getSuiteResponse_suite,
    getSuiteResponse_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 a request to the get suite operation.
--
-- /See:/ 'newGetSuite' smart constructor.
data GetSuite = GetSuite'
  { -- | The suite\'s ARN.
    GetSuite -> Text
arn :: Prelude.Text
  }
  deriving (GetSuite -> GetSuite -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetSuite -> GetSuite -> Bool
$c/= :: GetSuite -> GetSuite -> Bool
== :: GetSuite -> GetSuite -> Bool
$c== :: GetSuite -> GetSuite -> Bool
Prelude.Eq, ReadPrec [GetSuite]
ReadPrec GetSuite
Int -> ReadS GetSuite
ReadS [GetSuite]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetSuite]
$creadListPrec :: ReadPrec [GetSuite]
readPrec :: ReadPrec GetSuite
$creadPrec :: ReadPrec GetSuite
readList :: ReadS [GetSuite]
$creadList :: ReadS [GetSuite]
readsPrec :: Int -> ReadS GetSuite
$creadsPrec :: Int -> ReadS GetSuite
Prelude.Read, Int -> GetSuite -> ShowS
[GetSuite] -> ShowS
GetSuite -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetSuite] -> ShowS
$cshowList :: [GetSuite] -> ShowS
show :: GetSuite -> String
$cshow :: GetSuite -> String
showsPrec :: Int -> GetSuite -> ShowS
$cshowsPrec :: Int -> GetSuite -> ShowS
Prelude.Show, forall x. Rep GetSuite x -> GetSuite
forall x. GetSuite -> Rep GetSuite x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetSuite x -> GetSuite
$cfrom :: forall x. GetSuite -> Rep GetSuite x
Prelude.Generic)

-- |
-- Create a value of 'GetSuite' 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', 'getSuite_arn' - The suite\'s ARN.
newGetSuite ::
  -- | 'arn'
  Prelude.Text ->
  GetSuite
newGetSuite :: Text -> GetSuite
newGetSuite Text
pArn_ = GetSuite' {$sel:arn:GetSuite' :: Text
arn = Text
pArn_}

-- | The suite\'s ARN.
getSuite_arn :: Lens.Lens' GetSuite Prelude.Text
getSuite_arn :: Lens' GetSuite Text
getSuite_arn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetSuite' {Text
arn :: Text
$sel:arn:GetSuite' :: GetSuite -> Text
arn} -> Text
arn) (\s :: GetSuite
s@GetSuite' {} Text
a -> GetSuite
s {$sel:arn:GetSuite' :: Text
arn = Text
a} :: GetSuite)

instance Core.AWSRequest GetSuite where
  type AWSResponse GetSuite = GetSuiteResponse
  request :: (Service -> Service) -> GetSuite -> Request GetSuite
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 GetSuite
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetSuite)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe Suite -> Int -> GetSuiteResponse
GetSuiteResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"suite")
            forall (f :: * -> *) a b. Applicative f => 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 GetSuite where
  hashWithSalt :: Int -> GetSuite -> Int
hashWithSalt Int
_salt GetSuite' {Text
arn :: Text
$sel:arn:GetSuite' :: GetSuite -> Text
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
arn

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

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

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

-- | Represents the result of a get suite request.
--
-- /See:/ 'newGetSuiteResponse' smart constructor.
data GetSuiteResponse = GetSuiteResponse'
  { -- | A collection of one or more tests.
    GetSuiteResponse -> Maybe Suite
suite :: Prelude.Maybe Suite,
    -- | The response's http status code.
    GetSuiteResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (GetSuiteResponse -> GetSuiteResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetSuiteResponse -> GetSuiteResponse -> Bool
$c/= :: GetSuiteResponse -> GetSuiteResponse -> Bool
== :: GetSuiteResponse -> GetSuiteResponse -> Bool
$c== :: GetSuiteResponse -> GetSuiteResponse -> Bool
Prelude.Eq, ReadPrec [GetSuiteResponse]
ReadPrec GetSuiteResponse
Int -> ReadS GetSuiteResponse
ReadS [GetSuiteResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetSuiteResponse]
$creadListPrec :: ReadPrec [GetSuiteResponse]
readPrec :: ReadPrec GetSuiteResponse
$creadPrec :: ReadPrec GetSuiteResponse
readList :: ReadS [GetSuiteResponse]
$creadList :: ReadS [GetSuiteResponse]
readsPrec :: Int -> ReadS GetSuiteResponse
$creadsPrec :: Int -> ReadS GetSuiteResponse
Prelude.Read, Int -> GetSuiteResponse -> ShowS
[GetSuiteResponse] -> ShowS
GetSuiteResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetSuiteResponse] -> ShowS
$cshowList :: [GetSuiteResponse] -> ShowS
show :: GetSuiteResponse -> String
$cshow :: GetSuiteResponse -> String
showsPrec :: Int -> GetSuiteResponse -> ShowS
$cshowsPrec :: Int -> GetSuiteResponse -> ShowS
Prelude.Show, forall x. Rep GetSuiteResponse x -> GetSuiteResponse
forall x. GetSuiteResponse -> Rep GetSuiteResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetSuiteResponse x -> GetSuiteResponse
$cfrom :: forall x. GetSuiteResponse -> Rep GetSuiteResponse x
Prelude.Generic)

-- |
-- Create a value of 'GetSuiteResponse' 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:
--
-- 'suite', 'getSuiteResponse_suite' - A collection of one or more tests.
--
-- 'httpStatus', 'getSuiteResponse_httpStatus' - The response's http status code.
newGetSuiteResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  GetSuiteResponse
newGetSuiteResponse :: Int -> GetSuiteResponse
newGetSuiteResponse Int
pHttpStatus_ =
  GetSuiteResponse'
    { $sel:suite:GetSuiteResponse' :: Maybe Suite
suite = forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:GetSuiteResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | A collection of one or more tests.
getSuiteResponse_suite :: Lens.Lens' GetSuiteResponse (Prelude.Maybe Suite)
getSuiteResponse_suite :: Lens' GetSuiteResponse (Maybe Suite)
getSuiteResponse_suite = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetSuiteResponse' {Maybe Suite
suite :: Maybe Suite
$sel:suite:GetSuiteResponse' :: GetSuiteResponse -> Maybe Suite
suite} -> Maybe Suite
suite) (\s :: GetSuiteResponse
s@GetSuiteResponse' {} Maybe Suite
a -> GetSuiteResponse
s {$sel:suite:GetSuiteResponse' :: Maybe Suite
suite = Maybe Suite
a} :: GetSuiteResponse)

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

instance Prelude.NFData GetSuiteResponse where
  rnf :: GetSuiteResponse -> ()
rnf GetSuiteResponse' {Int
Maybe Suite
httpStatus :: Int
suite :: Maybe Suite
$sel:httpStatus:GetSuiteResponse' :: GetSuiteResponse -> Int
$sel:suite:GetSuiteResponse' :: GetSuiteResponse -> Maybe Suite
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Suite
suite
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus