{-# 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.Greengrass.GetServiceRoleForAccount
(
GetServiceRoleForAccount (..),
newGetServiceRoleForAccount,
GetServiceRoleForAccountResponse (..),
newGetServiceRoleForAccountResponse,
getServiceRoleForAccountResponse_associatedAt,
getServiceRoleForAccountResponse_roleArn,
getServiceRoleForAccountResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import Amazonka.Greengrass.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 GetServiceRoleForAccount = GetServiceRoleForAccount'
{
}
deriving (GetServiceRoleForAccount -> GetServiceRoleForAccount -> Bool
(GetServiceRoleForAccount -> GetServiceRoleForAccount -> Bool)
-> (GetServiceRoleForAccount -> GetServiceRoleForAccount -> Bool)
-> Eq GetServiceRoleForAccount
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetServiceRoleForAccount -> GetServiceRoleForAccount -> Bool
$c/= :: GetServiceRoleForAccount -> GetServiceRoleForAccount -> Bool
== :: GetServiceRoleForAccount -> GetServiceRoleForAccount -> Bool
$c== :: GetServiceRoleForAccount -> GetServiceRoleForAccount -> Bool
Prelude.Eq, ReadPrec [GetServiceRoleForAccount]
ReadPrec GetServiceRoleForAccount
Int -> ReadS GetServiceRoleForAccount
ReadS [GetServiceRoleForAccount]
(Int -> ReadS GetServiceRoleForAccount)
-> ReadS [GetServiceRoleForAccount]
-> ReadPrec GetServiceRoleForAccount
-> ReadPrec [GetServiceRoleForAccount]
-> Read GetServiceRoleForAccount
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetServiceRoleForAccount]
$creadListPrec :: ReadPrec [GetServiceRoleForAccount]
readPrec :: ReadPrec GetServiceRoleForAccount
$creadPrec :: ReadPrec GetServiceRoleForAccount
readList :: ReadS [GetServiceRoleForAccount]
$creadList :: ReadS [GetServiceRoleForAccount]
readsPrec :: Int -> ReadS GetServiceRoleForAccount
$creadsPrec :: Int -> ReadS GetServiceRoleForAccount
Prelude.Read, Int -> GetServiceRoleForAccount -> ShowS
[GetServiceRoleForAccount] -> ShowS
GetServiceRoleForAccount -> String
(Int -> GetServiceRoleForAccount -> ShowS)
-> (GetServiceRoleForAccount -> String)
-> ([GetServiceRoleForAccount] -> ShowS)
-> Show GetServiceRoleForAccount
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetServiceRoleForAccount] -> ShowS
$cshowList :: [GetServiceRoleForAccount] -> ShowS
show :: GetServiceRoleForAccount -> String
$cshow :: GetServiceRoleForAccount -> String
showsPrec :: Int -> GetServiceRoleForAccount -> ShowS
$cshowsPrec :: Int -> GetServiceRoleForAccount -> ShowS
Prelude.Show, (forall x.
GetServiceRoleForAccount -> Rep GetServiceRoleForAccount x)
-> (forall x.
Rep GetServiceRoleForAccount x -> GetServiceRoleForAccount)
-> Generic GetServiceRoleForAccount
forall x.
Rep GetServiceRoleForAccount x -> GetServiceRoleForAccount
forall x.
GetServiceRoleForAccount -> Rep GetServiceRoleForAccount x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetServiceRoleForAccount x -> GetServiceRoleForAccount
$cfrom :: forall x.
GetServiceRoleForAccount -> Rep GetServiceRoleForAccount x
Prelude.Generic)
newGetServiceRoleForAccount ::
GetServiceRoleForAccount
newGetServiceRoleForAccount :: GetServiceRoleForAccount
newGetServiceRoleForAccount =
GetServiceRoleForAccount
GetServiceRoleForAccount'
instance Core.AWSRequest GetServiceRoleForAccount where
type
AWSResponse GetServiceRoleForAccount =
GetServiceRoleForAccountResponse
request :: GetServiceRoleForAccount -> Request GetServiceRoleForAccount
request = Service
-> GetServiceRoleForAccount -> Request GetServiceRoleForAccount
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
response :: Logger
-> Service
-> Proxy GetServiceRoleForAccount
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetServiceRoleForAccount)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetServiceRoleForAccount))
-> Logger
-> Service
-> Proxy GetServiceRoleForAccount
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetServiceRoleForAccount)))
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 Text -> Maybe Text -> Int -> GetServiceRoleForAccountResponse
GetServiceRoleForAccountResponse'
(Maybe Text
-> Maybe Text -> Int -> GetServiceRoleForAccountResponse)
-> Either String (Maybe Text)
-> Either
String (Maybe Text -> Int -> GetServiceRoleForAccountResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"AssociatedAt")
Either
String (Maybe Text -> Int -> GetServiceRoleForAccountResponse)
-> Either String (Maybe Text)
-> Either String (Int -> GetServiceRoleForAccountResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"RoleArn")
Either String (Int -> GetServiceRoleForAccountResponse)
-> Either String Int
-> Either String GetServiceRoleForAccountResponse
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 GetServiceRoleForAccount
instance Prelude.NFData GetServiceRoleForAccount
instance Core.ToHeaders GetServiceRoleForAccount where
toHeaders :: GetServiceRoleForAccount -> ResponseHeaders
toHeaders =
ResponseHeaders -> GetServiceRoleForAccount -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ 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.ToPath GetServiceRoleForAccount where
toPath :: GetServiceRoleForAccount -> ByteString
toPath = ByteString -> GetServiceRoleForAccount -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/greengrass/servicerole"
instance Core.ToQuery GetServiceRoleForAccount where
toQuery :: GetServiceRoleForAccount -> QueryString
toQuery = QueryString -> GetServiceRoleForAccount -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data GetServiceRoleForAccountResponse = GetServiceRoleForAccountResponse'
{
GetServiceRoleForAccountResponse -> Maybe Text
associatedAt :: Prelude.Maybe Prelude.Text,
GetServiceRoleForAccountResponse -> Maybe Text
roleArn :: Prelude.Maybe Prelude.Text,
GetServiceRoleForAccountResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetServiceRoleForAccountResponse
-> GetServiceRoleForAccountResponse -> Bool
(GetServiceRoleForAccountResponse
-> GetServiceRoleForAccountResponse -> Bool)
-> (GetServiceRoleForAccountResponse
-> GetServiceRoleForAccountResponse -> Bool)
-> Eq GetServiceRoleForAccountResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetServiceRoleForAccountResponse
-> GetServiceRoleForAccountResponse -> Bool
$c/= :: GetServiceRoleForAccountResponse
-> GetServiceRoleForAccountResponse -> Bool
== :: GetServiceRoleForAccountResponse
-> GetServiceRoleForAccountResponse -> Bool
$c== :: GetServiceRoleForAccountResponse
-> GetServiceRoleForAccountResponse -> Bool
Prelude.Eq, ReadPrec [GetServiceRoleForAccountResponse]
ReadPrec GetServiceRoleForAccountResponse
Int -> ReadS GetServiceRoleForAccountResponse
ReadS [GetServiceRoleForAccountResponse]
(Int -> ReadS GetServiceRoleForAccountResponse)
-> ReadS [GetServiceRoleForAccountResponse]
-> ReadPrec GetServiceRoleForAccountResponse
-> ReadPrec [GetServiceRoleForAccountResponse]
-> Read GetServiceRoleForAccountResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetServiceRoleForAccountResponse]
$creadListPrec :: ReadPrec [GetServiceRoleForAccountResponse]
readPrec :: ReadPrec GetServiceRoleForAccountResponse
$creadPrec :: ReadPrec GetServiceRoleForAccountResponse
readList :: ReadS [GetServiceRoleForAccountResponse]
$creadList :: ReadS [GetServiceRoleForAccountResponse]
readsPrec :: Int -> ReadS GetServiceRoleForAccountResponse
$creadsPrec :: Int -> ReadS GetServiceRoleForAccountResponse
Prelude.Read, Int -> GetServiceRoleForAccountResponse -> ShowS
[GetServiceRoleForAccountResponse] -> ShowS
GetServiceRoleForAccountResponse -> String
(Int -> GetServiceRoleForAccountResponse -> ShowS)
-> (GetServiceRoleForAccountResponse -> String)
-> ([GetServiceRoleForAccountResponse] -> ShowS)
-> Show GetServiceRoleForAccountResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetServiceRoleForAccountResponse] -> ShowS
$cshowList :: [GetServiceRoleForAccountResponse] -> ShowS
show :: GetServiceRoleForAccountResponse -> String
$cshow :: GetServiceRoleForAccountResponse -> String
showsPrec :: Int -> GetServiceRoleForAccountResponse -> ShowS
$cshowsPrec :: Int -> GetServiceRoleForAccountResponse -> ShowS
Prelude.Show, (forall x.
GetServiceRoleForAccountResponse
-> Rep GetServiceRoleForAccountResponse x)
-> (forall x.
Rep GetServiceRoleForAccountResponse x
-> GetServiceRoleForAccountResponse)
-> Generic GetServiceRoleForAccountResponse
forall x.
Rep GetServiceRoleForAccountResponse x
-> GetServiceRoleForAccountResponse
forall x.
GetServiceRoleForAccountResponse
-> Rep GetServiceRoleForAccountResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetServiceRoleForAccountResponse x
-> GetServiceRoleForAccountResponse
$cfrom :: forall x.
GetServiceRoleForAccountResponse
-> Rep GetServiceRoleForAccountResponse x
Prelude.Generic)
newGetServiceRoleForAccountResponse ::
Prelude.Int ->
GetServiceRoleForAccountResponse
newGetServiceRoleForAccountResponse :: Int -> GetServiceRoleForAccountResponse
newGetServiceRoleForAccountResponse Int
pHttpStatus_ =
GetServiceRoleForAccountResponse' :: Maybe Text -> Maybe Text -> Int -> GetServiceRoleForAccountResponse
GetServiceRoleForAccountResponse'
{ $sel:associatedAt:GetServiceRoleForAccountResponse' :: Maybe Text
associatedAt =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:roleArn:GetServiceRoleForAccountResponse' :: Maybe Text
roleArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetServiceRoleForAccountResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getServiceRoleForAccountResponse_associatedAt :: Lens.Lens' GetServiceRoleForAccountResponse (Prelude.Maybe Prelude.Text)
getServiceRoleForAccountResponse_associatedAt :: (Maybe Text -> f (Maybe Text))
-> GetServiceRoleForAccountResponse
-> f GetServiceRoleForAccountResponse
getServiceRoleForAccountResponse_associatedAt = (GetServiceRoleForAccountResponse -> Maybe Text)
-> (GetServiceRoleForAccountResponse
-> Maybe Text -> GetServiceRoleForAccountResponse)
-> Lens
GetServiceRoleForAccountResponse
GetServiceRoleForAccountResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetServiceRoleForAccountResponse' {Maybe Text
associatedAt :: Maybe Text
$sel:associatedAt:GetServiceRoleForAccountResponse' :: GetServiceRoleForAccountResponse -> Maybe Text
associatedAt} -> Maybe Text
associatedAt) (\s :: GetServiceRoleForAccountResponse
s@GetServiceRoleForAccountResponse' {} Maybe Text
a -> GetServiceRoleForAccountResponse
s {$sel:associatedAt:GetServiceRoleForAccountResponse' :: Maybe Text
associatedAt = Maybe Text
a} :: GetServiceRoleForAccountResponse)
getServiceRoleForAccountResponse_roleArn :: Lens.Lens' GetServiceRoleForAccountResponse (Prelude.Maybe Prelude.Text)
getServiceRoleForAccountResponse_roleArn :: (Maybe Text -> f (Maybe Text))
-> GetServiceRoleForAccountResponse
-> f GetServiceRoleForAccountResponse
getServiceRoleForAccountResponse_roleArn = (GetServiceRoleForAccountResponse -> Maybe Text)
-> (GetServiceRoleForAccountResponse
-> Maybe Text -> GetServiceRoleForAccountResponse)
-> Lens
GetServiceRoleForAccountResponse
GetServiceRoleForAccountResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetServiceRoleForAccountResponse' {Maybe Text
roleArn :: Maybe Text
$sel:roleArn:GetServiceRoleForAccountResponse' :: GetServiceRoleForAccountResponse -> Maybe Text
roleArn} -> Maybe Text
roleArn) (\s :: GetServiceRoleForAccountResponse
s@GetServiceRoleForAccountResponse' {} Maybe Text
a -> GetServiceRoleForAccountResponse
s {$sel:roleArn:GetServiceRoleForAccountResponse' :: Maybe Text
roleArn = Maybe Text
a} :: GetServiceRoleForAccountResponse)
getServiceRoleForAccountResponse_httpStatus :: Lens.Lens' GetServiceRoleForAccountResponse Prelude.Int
getServiceRoleForAccountResponse_httpStatus :: (Int -> f Int)
-> GetServiceRoleForAccountResponse
-> f GetServiceRoleForAccountResponse
getServiceRoleForAccountResponse_httpStatus = (GetServiceRoleForAccountResponse -> Int)
-> (GetServiceRoleForAccountResponse
-> Int -> GetServiceRoleForAccountResponse)
-> Lens
GetServiceRoleForAccountResponse
GetServiceRoleForAccountResponse
Int
Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetServiceRoleForAccountResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetServiceRoleForAccountResponse' :: GetServiceRoleForAccountResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetServiceRoleForAccountResponse
s@GetServiceRoleForAccountResponse' {} Int
a -> GetServiceRoleForAccountResponse
s {$sel:httpStatus:GetServiceRoleForAccountResponse' :: Int
httpStatus = Int
a} :: GetServiceRoleForAccountResponse)
instance
Prelude.NFData
GetServiceRoleForAccountResponse