{-# 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 #-}
module Amazonka.DeviceFarm.GetInstanceProfile
(
GetInstanceProfile (..),
newGetInstanceProfile,
getInstanceProfile_arn,
GetInstanceProfileResponse (..),
newGetInstanceProfileResponse,
getInstanceProfileResponse_instanceProfile,
getInstanceProfileResponse_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
data GetInstanceProfile = GetInstanceProfile'
{
GetInstanceProfile -> Text
arn :: Prelude.Text
}
deriving (GetInstanceProfile -> GetInstanceProfile -> Bool
(GetInstanceProfile -> GetInstanceProfile -> Bool)
-> (GetInstanceProfile -> GetInstanceProfile -> Bool)
-> Eq GetInstanceProfile
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetInstanceProfile -> GetInstanceProfile -> Bool
$c/= :: GetInstanceProfile -> GetInstanceProfile -> Bool
== :: GetInstanceProfile -> GetInstanceProfile -> Bool
$c== :: GetInstanceProfile -> GetInstanceProfile -> Bool
Prelude.Eq, ReadPrec [GetInstanceProfile]
ReadPrec GetInstanceProfile
Int -> ReadS GetInstanceProfile
ReadS [GetInstanceProfile]
(Int -> ReadS GetInstanceProfile)
-> ReadS [GetInstanceProfile]
-> ReadPrec GetInstanceProfile
-> ReadPrec [GetInstanceProfile]
-> Read GetInstanceProfile
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetInstanceProfile]
$creadListPrec :: ReadPrec [GetInstanceProfile]
readPrec :: ReadPrec GetInstanceProfile
$creadPrec :: ReadPrec GetInstanceProfile
readList :: ReadS [GetInstanceProfile]
$creadList :: ReadS [GetInstanceProfile]
readsPrec :: Int -> ReadS GetInstanceProfile
$creadsPrec :: Int -> ReadS GetInstanceProfile
Prelude.Read, Int -> GetInstanceProfile -> ShowS
[GetInstanceProfile] -> ShowS
GetInstanceProfile -> String
(Int -> GetInstanceProfile -> ShowS)
-> (GetInstanceProfile -> String)
-> ([GetInstanceProfile] -> ShowS)
-> Show GetInstanceProfile
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetInstanceProfile] -> ShowS
$cshowList :: [GetInstanceProfile] -> ShowS
show :: GetInstanceProfile -> String
$cshow :: GetInstanceProfile -> String
showsPrec :: Int -> GetInstanceProfile -> ShowS
$cshowsPrec :: Int -> GetInstanceProfile -> ShowS
Prelude.Show, (forall x. GetInstanceProfile -> Rep GetInstanceProfile x)
-> (forall x. Rep GetInstanceProfile x -> GetInstanceProfile)
-> Generic GetInstanceProfile
forall x. Rep GetInstanceProfile x -> GetInstanceProfile
forall x. GetInstanceProfile -> Rep GetInstanceProfile x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetInstanceProfile x -> GetInstanceProfile
$cfrom :: forall x. GetInstanceProfile -> Rep GetInstanceProfile x
Prelude.Generic)
newGetInstanceProfile ::
Prelude.Text ->
GetInstanceProfile
newGetInstanceProfile :: Text -> GetInstanceProfile
newGetInstanceProfile Text
pArn_ =
GetInstanceProfile' :: Text -> GetInstanceProfile
GetInstanceProfile' {$sel:arn:GetInstanceProfile' :: Text
arn = Text
pArn_}
getInstanceProfile_arn :: Lens.Lens' GetInstanceProfile Prelude.Text
getInstanceProfile_arn :: (Text -> f Text) -> GetInstanceProfile -> f GetInstanceProfile
getInstanceProfile_arn = (GetInstanceProfile -> Text)
-> (GetInstanceProfile -> Text -> GetInstanceProfile)
-> Lens GetInstanceProfile GetInstanceProfile Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetInstanceProfile' {Text
arn :: Text
$sel:arn:GetInstanceProfile' :: GetInstanceProfile -> Text
arn} -> Text
arn) (\s :: GetInstanceProfile
s@GetInstanceProfile' {} Text
a -> GetInstanceProfile
s {$sel:arn:GetInstanceProfile' :: Text
arn = Text
a} :: GetInstanceProfile)
instance Core.AWSRequest GetInstanceProfile where
type
AWSResponse GetInstanceProfile =
GetInstanceProfileResponse
request :: GetInstanceProfile -> Request GetInstanceProfile
request = Service -> GetInstanceProfile -> Request GetInstanceProfile
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy GetInstanceProfile
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetInstanceProfile)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetInstanceProfile))
-> Logger
-> Service
-> Proxy GetInstanceProfile
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetInstanceProfile)))
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 InstanceProfile -> Int -> GetInstanceProfileResponse
GetInstanceProfileResponse'
(Maybe InstanceProfile -> Int -> GetInstanceProfileResponse)
-> Either String (Maybe InstanceProfile)
-> Either String (Int -> GetInstanceProfileResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe InstanceProfile)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"instanceProfile")
Either String (Int -> GetInstanceProfileResponse)
-> Either String Int -> Either String GetInstanceProfileResponse
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 GetInstanceProfile
instance Prelude.NFData GetInstanceProfile
instance Core.ToHeaders GetInstanceProfile where
toHeaders :: GetInstanceProfile -> ResponseHeaders
toHeaders =
ResponseHeaders -> GetInstanceProfile -> 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.GetInstanceProfile" ::
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 GetInstanceProfile where
toJSON :: GetInstanceProfile -> Value
toJSON GetInstanceProfile' {Text
arn :: Text
$sel:arn:GetInstanceProfile' :: GetInstanceProfile -> 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 GetInstanceProfile where
toPath :: GetInstanceProfile -> ByteString
toPath = ByteString -> GetInstanceProfile -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery GetInstanceProfile where
toQuery :: GetInstanceProfile -> QueryString
toQuery = QueryString -> GetInstanceProfile -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data GetInstanceProfileResponse = GetInstanceProfileResponse'
{
GetInstanceProfileResponse -> Maybe InstanceProfile
instanceProfile :: Prelude.Maybe InstanceProfile,
GetInstanceProfileResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetInstanceProfileResponse -> GetInstanceProfileResponse -> Bool
(GetInstanceProfileResponse -> GetInstanceProfileResponse -> Bool)
-> (GetInstanceProfileResponse
-> GetInstanceProfileResponse -> Bool)
-> Eq GetInstanceProfileResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetInstanceProfileResponse -> GetInstanceProfileResponse -> Bool
$c/= :: GetInstanceProfileResponse -> GetInstanceProfileResponse -> Bool
== :: GetInstanceProfileResponse -> GetInstanceProfileResponse -> Bool
$c== :: GetInstanceProfileResponse -> GetInstanceProfileResponse -> Bool
Prelude.Eq, ReadPrec [GetInstanceProfileResponse]
ReadPrec GetInstanceProfileResponse
Int -> ReadS GetInstanceProfileResponse
ReadS [GetInstanceProfileResponse]
(Int -> ReadS GetInstanceProfileResponse)
-> ReadS [GetInstanceProfileResponse]
-> ReadPrec GetInstanceProfileResponse
-> ReadPrec [GetInstanceProfileResponse]
-> Read GetInstanceProfileResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetInstanceProfileResponse]
$creadListPrec :: ReadPrec [GetInstanceProfileResponse]
readPrec :: ReadPrec GetInstanceProfileResponse
$creadPrec :: ReadPrec GetInstanceProfileResponse
readList :: ReadS [GetInstanceProfileResponse]
$creadList :: ReadS [GetInstanceProfileResponse]
readsPrec :: Int -> ReadS GetInstanceProfileResponse
$creadsPrec :: Int -> ReadS GetInstanceProfileResponse
Prelude.Read, Int -> GetInstanceProfileResponse -> ShowS
[GetInstanceProfileResponse] -> ShowS
GetInstanceProfileResponse -> String
(Int -> GetInstanceProfileResponse -> ShowS)
-> (GetInstanceProfileResponse -> String)
-> ([GetInstanceProfileResponse] -> ShowS)
-> Show GetInstanceProfileResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetInstanceProfileResponse] -> ShowS
$cshowList :: [GetInstanceProfileResponse] -> ShowS
show :: GetInstanceProfileResponse -> String
$cshow :: GetInstanceProfileResponse -> String
showsPrec :: Int -> GetInstanceProfileResponse -> ShowS
$cshowsPrec :: Int -> GetInstanceProfileResponse -> ShowS
Prelude.Show, (forall x.
GetInstanceProfileResponse -> Rep GetInstanceProfileResponse x)
-> (forall x.
Rep GetInstanceProfileResponse x -> GetInstanceProfileResponse)
-> Generic GetInstanceProfileResponse
forall x.
Rep GetInstanceProfileResponse x -> GetInstanceProfileResponse
forall x.
GetInstanceProfileResponse -> Rep GetInstanceProfileResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetInstanceProfileResponse x -> GetInstanceProfileResponse
$cfrom :: forall x.
GetInstanceProfileResponse -> Rep GetInstanceProfileResponse x
Prelude.Generic)
newGetInstanceProfileResponse ::
Prelude.Int ->
GetInstanceProfileResponse
newGetInstanceProfileResponse :: Int -> GetInstanceProfileResponse
newGetInstanceProfileResponse Int
pHttpStatus_ =
GetInstanceProfileResponse' :: Maybe InstanceProfile -> Int -> GetInstanceProfileResponse
GetInstanceProfileResponse'
{ $sel:instanceProfile:GetInstanceProfileResponse' :: Maybe InstanceProfile
instanceProfile =
Maybe InstanceProfile
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetInstanceProfileResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getInstanceProfileResponse_instanceProfile :: Lens.Lens' GetInstanceProfileResponse (Prelude.Maybe InstanceProfile)
getInstanceProfileResponse_instanceProfile :: (Maybe InstanceProfile -> f (Maybe InstanceProfile))
-> GetInstanceProfileResponse -> f GetInstanceProfileResponse
getInstanceProfileResponse_instanceProfile = (GetInstanceProfileResponse -> Maybe InstanceProfile)
-> (GetInstanceProfileResponse
-> Maybe InstanceProfile -> GetInstanceProfileResponse)
-> Lens
GetInstanceProfileResponse
GetInstanceProfileResponse
(Maybe InstanceProfile)
(Maybe InstanceProfile)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetInstanceProfileResponse' {Maybe InstanceProfile
instanceProfile :: Maybe InstanceProfile
$sel:instanceProfile:GetInstanceProfileResponse' :: GetInstanceProfileResponse -> Maybe InstanceProfile
instanceProfile} -> Maybe InstanceProfile
instanceProfile) (\s :: GetInstanceProfileResponse
s@GetInstanceProfileResponse' {} Maybe InstanceProfile
a -> GetInstanceProfileResponse
s {$sel:instanceProfile:GetInstanceProfileResponse' :: Maybe InstanceProfile
instanceProfile = Maybe InstanceProfile
a} :: GetInstanceProfileResponse)
getInstanceProfileResponse_httpStatus :: Lens.Lens' GetInstanceProfileResponse Prelude.Int
getInstanceProfileResponse_httpStatus :: (Int -> f Int)
-> GetInstanceProfileResponse -> f GetInstanceProfileResponse
getInstanceProfileResponse_httpStatus = (GetInstanceProfileResponse -> Int)
-> (GetInstanceProfileResponse
-> Int -> GetInstanceProfileResponse)
-> Lens
GetInstanceProfileResponse GetInstanceProfileResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetInstanceProfileResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetInstanceProfileResponse' :: GetInstanceProfileResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetInstanceProfileResponse
s@GetInstanceProfileResponse' {} Int
a -> GetInstanceProfileResponse
s {$sel:httpStatus:GetInstanceProfileResponse' :: Int
httpStatus = Int
a} :: GetInstanceProfileResponse)
instance Prelude.NFData GetInstanceProfileResponse