{-# 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.AssociateServiceRoleToAccount
(
AssociateServiceRoleToAccount (..),
newAssociateServiceRoleToAccount,
associateServiceRoleToAccount_roleArn,
AssociateServiceRoleToAccountResponse (..),
newAssociateServiceRoleToAccountResponse,
associateServiceRoleToAccountResponse_associatedAt,
associateServiceRoleToAccountResponse_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 AssociateServiceRoleToAccount = AssociateServiceRoleToAccount'
{
AssociateServiceRoleToAccount -> Text
roleArn :: Prelude.Text
}
deriving (AssociateServiceRoleToAccount
-> AssociateServiceRoleToAccount -> Bool
(AssociateServiceRoleToAccount
-> AssociateServiceRoleToAccount -> Bool)
-> (AssociateServiceRoleToAccount
-> AssociateServiceRoleToAccount -> Bool)
-> Eq AssociateServiceRoleToAccount
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AssociateServiceRoleToAccount
-> AssociateServiceRoleToAccount -> Bool
$c/= :: AssociateServiceRoleToAccount
-> AssociateServiceRoleToAccount -> Bool
== :: AssociateServiceRoleToAccount
-> AssociateServiceRoleToAccount -> Bool
$c== :: AssociateServiceRoleToAccount
-> AssociateServiceRoleToAccount -> Bool
Prelude.Eq, ReadPrec [AssociateServiceRoleToAccount]
ReadPrec AssociateServiceRoleToAccount
Int -> ReadS AssociateServiceRoleToAccount
ReadS [AssociateServiceRoleToAccount]
(Int -> ReadS AssociateServiceRoleToAccount)
-> ReadS [AssociateServiceRoleToAccount]
-> ReadPrec AssociateServiceRoleToAccount
-> ReadPrec [AssociateServiceRoleToAccount]
-> Read AssociateServiceRoleToAccount
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AssociateServiceRoleToAccount]
$creadListPrec :: ReadPrec [AssociateServiceRoleToAccount]
readPrec :: ReadPrec AssociateServiceRoleToAccount
$creadPrec :: ReadPrec AssociateServiceRoleToAccount
readList :: ReadS [AssociateServiceRoleToAccount]
$creadList :: ReadS [AssociateServiceRoleToAccount]
readsPrec :: Int -> ReadS AssociateServiceRoleToAccount
$creadsPrec :: Int -> ReadS AssociateServiceRoleToAccount
Prelude.Read, Int -> AssociateServiceRoleToAccount -> ShowS
[AssociateServiceRoleToAccount] -> ShowS
AssociateServiceRoleToAccount -> String
(Int -> AssociateServiceRoleToAccount -> ShowS)
-> (AssociateServiceRoleToAccount -> String)
-> ([AssociateServiceRoleToAccount] -> ShowS)
-> Show AssociateServiceRoleToAccount
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AssociateServiceRoleToAccount] -> ShowS
$cshowList :: [AssociateServiceRoleToAccount] -> ShowS
show :: AssociateServiceRoleToAccount -> String
$cshow :: AssociateServiceRoleToAccount -> String
showsPrec :: Int -> AssociateServiceRoleToAccount -> ShowS
$cshowsPrec :: Int -> AssociateServiceRoleToAccount -> ShowS
Prelude.Show, (forall x.
AssociateServiceRoleToAccount
-> Rep AssociateServiceRoleToAccount x)
-> (forall x.
Rep AssociateServiceRoleToAccount x
-> AssociateServiceRoleToAccount)
-> Generic AssociateServiceRoleToAccount
forall x.
Rep AssociateServiceRoleToAccount x
-> AssociateServiceRoleToAccount
forall x.
AssociateServiceRoleToAccount
-> Rep AssociateServiceRoleToAccount x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AssociateServiceRoleToAccount x
-> AssociateServiceRoleToAccount
$cfrom :: forall x.
AssociateServiceRoleToAccount
-> Rep AssociateServiceRoleToAccount x
Prelude.Generic)
newAssociateServiceRoleToAccount ::
Prelude.Text ->
AssociateServiceRoleToAccount
newAssociateServiceRoleToAccount :: Text -> AssociateServiceRoleToAccount
newAssociateServiceRoleToAccount Text
pRoleArn_ =
AssociateServiceRoleToAccount' :: Text -> AssociateServiceRoleToAccount
AssociateServiceRoleToAccount' {$sel:roleArn:AssociateServiceRoleToAccount' :: Text
roleArn = Text
pRoleArn_}
associateServiceRoleToAccount_roleArn :: Lens.Lens' AssociateServiceRoleToAccount Prelude.Text
associateServiceRoleToAccount_roleArn :: (Text -> f Text)
-> AssociateServiceRoleToAccount -> f AssociateServiceRoleToAccount
associateServiceRoleToAccount_roleArn = (AssociateServiceRoleToAccount -> Text)
-> (AssociateServiceRoleToAccount
-> Text -> AssociateServiceRoleToAccount)
-> Lens
AssociateServiceRoleToAccount
AssociateServiceRoleToAccount
Text
Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssociateServiceRoleToAccount' {Text
roleArn :: Text
$sel:roleArn:AssociateServiceRoleToAccount' :: AssociateServiceRoleToAccount -> Text
roleArn} -> Text
roleArn) (\s :: AssociateServiceRoleToAccount
s@AssociateServiceRoleToAccount' {} Text
a -> AssociateServiceRoleToAccount
s {$sel:roleArn:AssociateServiceRoleToAccount' :: Text
roleArn = Text
a} :: AssociateServiceRoleToAccount)
instance
Core.AWSRequest
AssociateServiceRoleToAccount
where
type
AWSResponse AssociateServiceRoleToAccount =
AssociateServiceRoleToAccountResponse
request :: AssociateServiceRoleToAccount
-> Request AssociateServiceRoleToAccount
request = Service
-> AssociateServiceRoleToAccount
-> Request AssociateServiceRoleToAccount
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.putJSON Service
defaultService
response :: Logger
-> Service
-> Proxy AssociateServiceRoleToAccount
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse AssociateServiceRoleToAccount)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse AssociateServiceRoleToAccount))
-> Logger
-> Service
-> Proxy AssociateServiceRoleToAccount
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse AssociateServiceRoleToAccount)))
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 -> Int -> AssociateServiceRoleToAccountResponse
AssociateServiceRoleToAccountResponse'
(Maybe Text -> Int -> AssociateServiceRoleToAccountResponse)
-> Either String (Maybe Text)
-> Either String (Int -> AssociateServiceRoleToAccountResponse)
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 (Int -> AssociateServiceRoleToAccountResponse)
-> Either String Int
-> Either String AssociateServiceRoleToAccountResponse
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
AssociateServiceRoleToAccount
instance Prelude.NFData AssociateServiceRoleToAccount
instance Core.ToHeaders AssociateServiceRoleToAccount where
toHeaders :: AssociateServiceRoleToAccount -> ResponseHeaders
toHeaders =
ResponseHeaders -> AssociateServiceRoleToAccount -> 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.ToJSON AssociateServiceRoleToAccount where
toJSON :: AssociateServiceRoleToAccount -> Value
toJSON AssociateServiceRoleToAccount' {Text
roleArn :: Text
$sel:roleArn:AssociateServiceRoleToAccount' :: AssociateServiceRoleToAccount -> 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
"RoleArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
roleArn)]
)
instance Core.ToPath AssociateServiceRoleToAccount where
toPath :: AssociateServiceRoleToAccount -> ByteString
toPath = ByteString -> AssociateServiceRoleToAccount -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/greengrass/servicerole"
instance Core.ToQuery AssociateServiceRoleToAccount where
toQuery :: AssociateServiceRoleToAccount -> QueryString
toQuery = QueryString -> AssociateServiceRoleToAccount -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data AssociateServiceRoleToAccountResponse = AssociateServiceRoleToAccountResponse'
{
AssociateServiceRoleToAccountResponse -> Maybe Text
associatedAt :: Prelude.Maybe Prelude.Text,
AssociateServiceRoleToAccountResponse -> Int
httpStatus :: Prelude.Int
}
deriving (AssociateServiceRoleToAccountResponse
-> AssociateServiceRoleToAccountResponse -> Bool
(AssociateServiceRoleToAccountResponse
-> AssociateServiceRoleToAccountResponse -> Bool)
-> (AssociateServiceRoleToAccountResponse
-> AssociateServiceRoleToAccountResponse -> Bool)
-> Eq AssociateServiceRoleToAccountResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AssociateServiceRoleToAccountResponse
-> AssociateServiceRoleToAccountResponse -> Bool
$c/= :: AssociateServiceRoleToAccountResponse
-> AssociateServiceRoleToAccountResponse -> Bool
== :: AssociateServiceRoleToAccountResponse
-> AssociateServiceRoleToAccountResponse -> Bool
$c== :: AssociateServiceRoleToAccountResponse
-> AssociateServiceRoleToAccountResponse -> Bool
Prelude.Eq, ReadPrec [AssociateServiceRoleToAccountResponse]
ReadPrec AssociateServiceRoleToAccountResponse
Int -> ReadS AssociateServiceRoleToAccountResponse
ReadS [AssociateServiceRoleToAccountResponse]
(Int -> ReadS AssociateServiceRoleToAccountResponse)
-> ReadS [AssociateServiceRoleToAccountResponse]
-> ReadPrec AssociateServiceRoleToAccountResponse
-> ReadPrec [AssociateServiceRoleToAccountResponse]
-> Read AssociateServiceRoleToAccountResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AssociateServiceRoleToAccountResponse]
$creadListPrec :: ReadPrec [AssociateServiceRoleToAccountResponse]
readPrec :: ReadPrec AssociateServiceRoleToAccountResponse
$creadPrec :: ReadPrec AssociateServiceRoleToAccountResponse
readList :: ReadS [AssociateServiceRoleToAccountResponse]
$creadList :: ReadS [AssociateServiceRoleToAccountResponse]
readsPrec :: Int -> ReadS AssociateServiceRoleToAccountResponse
$creadsPrec :: Int -> ReadS AssociateServiceRoleToAccountResponse
Prelude.Read, Int -> AssociateServiceRoleToAccountResponse -> ShowS
[AssociateServiceRoleToAccountResponse] -> ShowS
AssociateServiceRoleToAccountResponse -> String
(Int -> AssociateServiceRoleToAccountResponse -> ShowS)
-> (AssociateServiceRoleToAccountResponse -> String)
-> ([AssociateServiceRoleToAccountResponse] -> ShowS)
-> Show AssociateServiceRoleToAccountResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AssociateServiceRoleToAccountResponse] -> ShowS
$cshowList :: [AssociateServiceRoleToAccountResponse] -> ShowS
show :: AssociateServiceRoleToAccountResponse -> String
$cshow :: AssociateServiceRoleToAccountResponse -> String
showsPrec :: Int -> AssociateServiceRoleToAccountResponse -> ShowS
$cshowsPrec :: Int -> AssociateServiceRoleToAccountResponse -> ShowS
Prelude.Show, (forall x.
AssociateServiceRoleToAccountResponse
-> Rep AssociateServiceRoleToAccountResponse x)
-> (forall x.
Rep AssociateServiceRoleToAccountResponse x
-> AssociateServiceRoleToAccountResponse)
-> Generic AssociateServiceRoleToAccountResponse
forall x.
Rep AssociateServiceRoleToAccountResponse x
-> AssociateServiceRoleToAccountResponse
forall x.
AssociateServiceRoleToAccountResponse
-> Rep AssociateServiceRoleToAccountResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AssociateServiceRoleToAccountResponse x
-> AssociateServiceRoleToAccountResponse
$cfrom :: forall x.
AssociateServiceRoleToAccountResponse
-> Rep AssociateServiceRoleToAccountResponse x
Prelude.Generic)
newAssociateServiceRoleToAccountResponse ::
Prelude.Int ->
AssociateServiceRoleToAccountResponse
newAssociateServiceRoleToAccountResponse :: Int -> AssociateServiceRoleToAccountResponse
newAssociateServiceRoleToAccountResponse Int
pHttpStatus_ =
AssociateServiceRoleToAccountResponse' :: Maybe Text -> Int -> AssociateServiceRoleToAccountResponse
AssociateServiceRoleToAccountResponse'
{ $sel:associatedAt:AssociateServiceRoleToAccountResponse' :: Maybe Text
associatedAt =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:AssociateServiceRoleToAccountResponse' :: Int
httpStatus = Int
pHttpStatus_
}
associateServiceRoleToAccountResponse_associatedAt :: Lens.Lens' AssociateServiceRoleToAccountResponse (Prelude.Maybe Prelude.Text)
associateServiceRoleToAccountResponse_associatedAt :: (Maybe Text -> f (Maybe Text))
-> AssociateServiceRoleToAccountResponse
-> f AssociateServiceRoleToAccountResponse
associateServiceRoleToAccountResponse_associatedAt = (AssociateServiceRoleToAccountResponse -> Maybe Text)
-> (AssociateServiceRoleToAccountResponse
-> Maybe Text -> AssociateServiceRoleToAccountResponse)
-> Lens
AssociateServiceRoleToAccountResponse
AssociateServiceRoleToAccountResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssociateServiceRoleToAccountResponse' {Maybe Text
associatedAt :: Maybe Text
$sel:associatedAt:AssociateServiceRoleToAccountResponse' :: AssociateServiceRoleToAccountResponse -> Maybe Text
associatedAt} -> Maybe Text
associatedAt) (\s :: AssociateServiceRoleToAccountResponse
s@AssociateServiceRoleToAccountResponse' {} Maybe Text
a -> AssociateServiceRoleToAccountResponse
s {$sel:associatedAt:AssociateServiceRoleToAccountResponse' :: Maybe Text
associatedAt = Maybe Text
a} :: AssociateServiceRoleToAccountResponse)
associateServiceRoleToAccountResponse_httpStatus :: Lens.Lens' AssociateServiceRoleToAccountResponse Prelude.Int
associateServiceRoleToAccountResponse_httpStatus :: (Int -> f Int)
-> AssociateServiceRoleToAccountResponse
-> f AssociateServiceRoleToAccountResponse
associateServiceRoleToAccountResponse_httpStatus = (AssociateServiceRoleToAccountResponse -> Int)
-> (AssociateServiceRoleToAccountResponse
-> Int -> AssociateServiceRoleToAccountResponse)
-> Lens
AssociateServiceRoleToAccountResponse
AssociateServiceRoleToAccountResponse
Int
Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssociateServiceRoleToAccountResponse' {Int
httpStatus :: Int
$sel:httpStatus:AssociateServiceRoleToAccountResponse' :: AssociateServiceRoleToAccountResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: AssociateServiceRoleToAccountResponse
s@AssociateServiceRoleToAccountResponse' {} Int
a -> AssociateServiceRoleToAccountResponse
s {$sel:httpStatus:AssociateServiceRoleToAccountResponse' :: Int
httpStatus = Int
a} :: AssociateServiceRoleToAccountResponse)
instance
Prelude.NFData
AssociateServiceRoleToAccountResponse