{-# 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-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)
--
-- 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 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 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
(GetSuite -> GetSuite -> Bool)
-> (GetSuite -> GetSuite -> Bool) -> Eq GetSuite
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]
(Int -> ReadS GetSuite)
-> ReadS [GetSuite]
-> ReadPrec GetSuite
-> ReadPrec [GetSuite]
-> Read 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
(Int -> GetSuite -> ShowS)
-> (GetSuite -> String) -> ([GetSuite] -> ShowS) -> Show GetSuite
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. GetSuite -> Rep GetSuite x)
-> (forall x. Rep GetSuite x -> GetSuite) -> Generic GetSuite
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' :: Text -> GetSuite
GetSuite' {$sel:arn:GetSuite' :: Text
arn = Text
pArn_}

-- | The suite\'s ARN.
getSuite_arn :: Lens.Lens' GetSuite Prelude.Text
getSuite_arn :: (Text -> f Text) -> GetSuite -> f GetSuite
getSuite_arn = (GetSuite -> Text)
-> (GetSuite -> Text -> GetSuite)
-> Lens GetSuite GetSuite Text Text
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 :: GetSuite -> Request GetSuite
request = Service -> GetSuite -> Request GetSuite
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy GetSuite
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetSuite)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse GetSuite))
-> Logger
-> Service
-> Proxy GetSuite
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetSuite)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe Suite -> Int -> GetSuiteResponse
GetSuiteResponse'
            (Maybe Suite -> Int -> GetSuiteResponse)
-> Either String (Maybe Suite)
-> Either String (Int -> GetSuiteResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Suite)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"suite")
            Either String (Int -> GetSuiteResponse)
-> Either String Int -> Either String GetSuiteResponse
forall (f :: * -> *) a b. Applicative f => 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 GetSuite

instance Prelude.NFData GetSuite

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

instance Core.ToQuery GetSuite where
  toQuery :: GetSuite -> QueryString
toQuery = QueryString -> GetSuite -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
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
(GetSuiteResponse -> GetSuiteResponse -> Bool)
-> (GetSuiteResponse -> GetSuiteResponse -> Bool)
-> Eq GetSuiteResponse
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]
(Int -> ReadS GetSuiteResponse)
-> ReadS [GetSuiteResponse]
-> ReadPrec GetSuiteResponse
-> ReadPrec [GetSuiteResponse]
-> Read 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
(Int -> GetSuiteResponse -> ShowS)
-> (GetSuiteResponse -> String)
-> ([GetSuiteResponse] -> ShowS)
-> Show GetSuiteResponse
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. GetSuiteResponse -> Rep GetSuiteResponse x)
-> (forall x. Rep GetSuiteResponse x -> GetSuiteResponse)
-> Generic GetSuiteResponse
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' :: Maybe Suite -> Int -> GetSuiteResponse
GetSuiteResponse'
    { $sel:suite:GetSuiteResponse' :: Maybe Suite
suite = Maybe 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 :: (Maybe Suite -> f (Maybe Suite))
-> GetSuiteResponse -> f GetSuiteResponse
getSuiteResponse_suite = (GetSuiteResponse -> Maybe Suite)
-> (GetSuiteResponse -> Maybe Suite -> GetSuiteResponse)
-> Lens
     GetSuiteResponse GetSuiteResponse (Maybe Suite) (Maybe 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 :: (Int -> f Int) -> GetSuiteResponse -> f GetSuiteResponse
getSuiteResponse_httpStatus = (GetSuiteResponse -> Int)
-> (GetSuiteResponse -> Int -> GetSuiteResponse)
-> Lens GetSuiteResponse GetSuiteResponse Int Int
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