{-# 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.AssociateRoleToGroup
(
AssociateRoleToGroup (..),
newAssociateRoleToGroup,
associateRoleToGroup_groupId,
associateRoleToGroup_roleArn,
AssociateRoleToGroupResponse (..),
newAssociateRoleToGroupResponse,
associateRoleToGroupResponse_associatedAt,
associateRoleToGroupResponse_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 AssociateRoleToGroup = AssociateRoleToGroup'
{
AssociateRoleToGroup -> Text
groupId :: Prelude.Text,
AssociateRoleToGroup -> Text
roleArn :: Prelude.Text
}
deriving (AssociateRoleToGroup -> AssociateRoleToGroup -> Bool
(AssociateRoleToGroup -> AssociateRoleToGroup -> Bool)
-> (AssociateRoleToGroup -> AssociateRoleToGroup -> Bool)
-> Eq AssociateRoleToGroup
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AssociateRoleToGroup -> AssociateRoleToGroup -> Bool
$c/= :: AssociateRoleToGroup -> AssociateRoleToGroup -> Bool
== :: AssociateRoleToGroup -> AssociateRoleToGroup -> Bool
$c== :: AssociateRoleToGroup -> AssociateRoleToGroup -> Bool
Prelude.Eq, ReadPrec [AssociateRoleToGroup]
ReadPrec AssociateRoleToGroup
Int -> ReadS AssociateRoleToGroup
ReadS [AssociateRoleToGroup]
(Int -> ReadS AssociateRoleToGroup)
-> ReadS [AssociateRoleToGroup]
-> ReadPrec AssociateRoleToGroup
-> ReadPrec [AssociateRoleToGroup]
-> Read AssociateRoleToGroup
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AssociateRoleToGroup]
$creadListPrec :: ReadPrec [AssociateRoleToGroup]
readPrec :: ReadPrec AssociateRoleToGroup
$creadPrec :: ReadPrec AssociateRoleToGroup
readList :: ReadS [AssociateRoleToGroup]
$creadList :: ReadS [AssociateRoleToGroup]
readsPrec :: Int -> ReadS AssociateRoleToGroup
$creadsPrec :: Int -> ReadS AssociateRoleToGroup
Prelude.Read, Int -> AssociateRoleToGroup -> ShowS
[AssociateRoleToGroup] -> ShowS
AssociateRoleToGroup -> String
(Int -> AssociateRoleToGroup -> ShowS)
-> (AssociateRoleToGroup -> String)
-> ([AssociateRoleToGroup] -> ShowS)
-> Show AssociateRoleToGroup
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AssociateRoleToGroup] -> ShowS
$cshowList :: [AssociateRoleToGroup] -> ShowS
show :: AssociateRoleToGroup -> String
$cshow :: AssociateRoleToGroup -> String
showsPrec :: Int -> AssociateRoleToGroup -> ShowS
$cshowsPrec :: Int -> AssociateRoleToGroup -> ShowS
Prelude.Show, (forall x. AssociateRoleToGroup -> Rep AssociateRoleToGroup x)
-> (forall x. Rep AssociateRoleToGroup x -> AssociateRoleToGroup)
-> Generic AssociateRoleToGroup
forall x. Rep AssociateRoleToGroup x -> AssociateRoleToGroup
forall x. AssociateRoleToGroup -> Rep AssociateRoleToGroup x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AssociateRoleToGroup x -> AssociateRoleToGroup
$cfrom :: forall x. AssociateRoleToGroup -> Rep AssociateRoleToGroup x
Prelude.Generic)
newAssociateRoleToGroup ::
Prelude.Text ->
Prelude.Text ->
AssociateRoleToGroup
newAssociateRoleToGroup :: Text -> Text -> AssociateRoleToGroup
newAssociateRoleToGroup Text
pGroupId_ Text
pRoleArn_ =
AssociateRoleToGroup' :: Text -> Text -> AssociateRoleToGroup
AssociateRoleToGroup'
{ $sel:groupId:AssociateRoleToGroup' :: Text
groupId = Text
pGroupId_,
$sel:roleArn:AssociateRoleToGroup' :: Text
roleArn = Text
pRoleArn_
}
associateRoleToGroup_groupId :: Lens.Lens' AssociateRoleToGroup Prelude.Text
associateRoleToGroup_groupId :: (Text -> f Text) -> AssociateRoleToGroup -> f AssociateRoleToGroup
associateRoleToGroup_groupId = (AssociateRoleToGroup -> Text)
-> (AssociateRoleToGroup -> Text -> AssociateRoleToGroup)
-> Lens AssociateRoleToGroup AssociateRoleToGroup Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssociateRoleToGroup' {Text
groupId :: Text
$sel:groupId:AssociateRoleToGroup' :: AssociateRoleToGroup -> Text
groupId} -> Text
groupId) (\s :: AssociateRoleToGroup
s@AssociateRoleToGroup' {} Text
a -> AssociateRoleToGroup
s {$sel:groupId:AssociateRoleToGroup' :: Text
groupId = Text
a} :: AssociateRoleToGroup)
associateRoleToGroup_roleArn :: Lens.Lens' AssociateRoleToGroup Prelude.Text
associateRoleToGroup_roleArn :: (Text -> f Text) -> AssociateRoleToGroup -> f AssociateRoleToGroup
associateRoleToGroup_roleArn = (AssociateRoleToGroup -> Text)
-> (AssociateRoleToGroup -> Text -> AssociateRoleToGroup)
-> Lens AssociateRoleToGroup AssociateRoleToGroup Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssociateRoleToGroup' {Text
roleArn :: Text
$sel:roleArn:AssociateRoleToGroup' :: AssociateRoleToGroup -> Text
roleArn} -> Text
roleArn) (\s :: AssociateRoleToGroup
s@AssociateRoleToGroup' {} Text
a -> AssociateRoleToGroup
s {$sel:roleArn:AssociateRoleToGroup' :: Text
roleArn = Text
a} :: AssociateRoleToGroup)
instance Core.AWSRequest AssociateRoleToGroup where
type
AWSResponse AssociateRoleToGroup =
AssociateRoleToGroupResponse
request :: AssociateRoleToGroup -> Request AssociateRoleToGroup
request = Service -> AssociateRoleToGroup -> Request AssociateRoleToGroup
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.putJSON Service
defaultService
response :: Logger
-> Service
-> Proxy AssociateRoleToGroup
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse AssociateRoleToGroup)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse AssociateRoleToGroup))
-> Logger
-> Service
-> Proxy AssociateRoleToGroup
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse AssociateRoleToGroup)))
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 -> AssociateRoleToGroupResponse
AssociateRoleToGroupResponse'
(Maybe Text -> Int -> AssociateRoleToGroupResponse)
-> Either String (Maybe Text)
-> Either String (Int -> AssociateRoleToGroupResponse)
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 -> AssociateRoleToGroupResponse)
-> Either String Int -> Either String AssociateRoleToGroupResponse
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 AssociateRoleToGroup
instance Prelude.NFData AssociateRoleToGroup
instance Core.ToHeaders AssociateRoleToGroup where
toHeaders :: AssociateRoleToGroup -> ResponseHeaders
toHeaders =
ResponseHeaders -> AssociateRoleToGroup -> 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 AssociateRoleToGroup where
toJSON :: AssociateRoleToGroup -> Value
toJSON AssociateRoleToGroup' {Text
roleArn :: Text
groupId :: Text
$sel:roleArn:AssociateRoleToGroup' :: AssociateRoleToGroup -> Text
$sel:groupId:AssociateRoleToGroup' :: AssociateRoleToGroup -> 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 AssociateRoleToGroup where
toPath :: AssociateRoleToGroup -> ByteString
toPath AssociateRoleToGroup' {Text
roleArn :: Text
groupId :: Text
$sel:roleArn:AssociateRoleToGroup' :: AssociateRoleToGroup -> Text
$sel:groupId:AssociateRoleToGroup' :: AssociateRoleToGroup -> Text
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ByteString
"/greengrass/groups/", Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
groupId, ByteString
"/role"]
instance Core.ToQuery AssociateRoleToGroup where
toQuery :: AssociateRoleToGroup -> QueryString
toQuery = QueryString -> AssociateRoleToGroup -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data AssociateRoleToGroupResponse = AssociateRoleToGroupResponse'
{
AssociateRoleToGroupResponse -> Maybe Text
associatedAt :: Prelude.Maybe Prelude.Text,
AssociateRoleToGroupResponse -> Int
httpStatus :: Prelude.Int
}
deriving (AssociateRoleToGroupResponse
-> AssociateRoleToGroupResponse -> Bool
(AssociateRoleToGroupResponse
-> AssociateRoleToGroupResponse -> Bool)
-> (AssociateRoleToGroupResponse
-> AssociateRoleToGroupResponse -> Bool)
-> Eq AssociateRoleToGroupResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AssociateRoleToGroupResponse
-> AssociateRoleToGroupResponse -> Bool
$c/= :: AssociateRoleToGroupResponse
-> AssociateRoleToGroupResponse -> Bool
== :: AssociateRoleToGroupResponse
-> AssociateRoleToGroupResponse -> Bool
$c== :: AssociateRoleToGroupResponse
-> AssociateRoleToGroupResponse -> Bool
Prelude.Eq, ReadPrec [AssociateRoleToGroupResponse]
ReadPrec AssociateRoleToGroupResponse
Int -> ReadS AssociateRoleToGroupResponse
ReadS [AssociateRoleToGroupResponse]
(Int -> ReadS AssociateRoleToGroupResponse)
-> ReadS [AssociateRoleToGroupResponse]
-> ReadPrec AssociateRoleToGroupResponse
-> ReadPrec [AssociateRoleToGroupResponse]
-> Read AssociateRoleToGroupResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AssociateRoleToGroupResponse]
$creadListPrec :: ReadPrec [AssociateRoleToGroupResponse]
readPrec :: ReadPrec AssociateRoleToGroupResponse
$creadPrec :: ReadPrec AssociateRoleToGroupResponse
readList :: ReadS [AssociateRoleToGroupResponse]
$creadList :: ReadS [AssociateRoleToGroupResponse]
readsPrec :: Int -> ReadS AssociateRoleToGroupResponse
$creadsPrec :: Int -> ReadS AssociateRoleToGroupResponse
Prelude.Read, Int -> AssociateRoleToGroupResponse -> ShowS
[AssociateRoleToGroupResponse] -> ShowS
AssociateRoleToGroupResponse -> String
(Int -> AssociateRoleToGroupResponse -> ShowS)
-> (AssociateRoleToGroupResponse -> String)
-> ([AssociateRoleToGroupResponse] -> ShowS)
-> Show AssociateRoleToGroupResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AssociateRoleToGroupResponse] -> ShowS
$cshowList :: [AssociateRoleToGroupResponse] -> ShowS
show :: AssociateRoleToGroupResponse -> String
$cshow :: AssociateRoleToGroupResponse -> String
showsPrec :: Int -> AssociateRoleToGroupResponse -> ShowS
$cshowsPrec :: Int -> AssociateRoleToGroupResponse -> ShowS
Prelude.Show, (forall x.
AssociateRoleToGroupResponse -> Rep AssociateRoleToGroupResponse x)
-> (forall x.
Rep AssociateRoleToGroupResponse x -> AssociateRoleToGroupResponse)
-> Generic AssociateRoleToGroupResponse
forall x.
Rep AssociateRoleToGroupResponse x -> AssociateRoleToGroupResponse
forall x.
AssociateRoleToGroupResponse -> Rep AssociateRoleToGroupResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AssociateRoleToGroupResponse x -> AssociateRoleToGroupResponse
$cfrom :: forall x.
AssociateRoleToGroupResponse -> Rep AssociateRoleToGroupResponse x
Prelude.Generic)
newAssociateRoleToGroupResponse ::
Prelude.Int ->
AssociateRoleToGroupResponse
newAssociateRoleToGroupResponse :: Int -> AssociateRoleToGroupResponse
newAssociateRoleToGroupResponse Int
pHttpStatus_ =
AssociateRoleToGroupResponse' :: Maybe Text -> Int -> AssociateRoleToGroupResponse
AssociateRoleToGroupResponse'
{ $sel:associatedAt:AssociateRoleToGroupResponse' :: Maybe Text
associatedAt =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:AssociateRoleToGroupResponse' :: Int
httpStatus = Int
pHttpStatus_
}
associateRoleToGroupResponse_associatedAt :: Lens.Lens' AssociateRoleToGroupResponse (Prelude.Maybe Prelude.Text)
associateRoleToGroupResponse_associatedAt :: (Maybe Text -> f (Maybe Text))
-> AssociateRoleToGroupResponse -> f AssociateRoleToGroupResponse
associateRoleToGroupResponse_associatedAt = (AssociateRoleToGroupResponse -> Maybe Text)
-> (AssociateRoleToGroupResponse
-> Maybe Text -> AssociateRoleToGroupResponse)
-> Lens
AssociateRoleToGroupResponse
AssociateRoleToGroupResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssociateRoleToGroupResponse' {Maybe Text
associatedAt :: Maybe Text
$sel:associatedAt:AssociateRoleToGroupResponse' :: AssociateRoleToGroupResponse -> Maybe Text
associatedAt} -> Maybe Text
associatedAt) (\s :: AssociateRoleToGroupResponse
s@AssociateRoleToGroupResponse' {} Maybe Text
a -> AssociateRoleToGroupResponse
s {$sel:associatedAt:AssociateRoleToGroupResponse' :: Maybe Text
associatedAt = Maybe Text
a} :: AssociateRoleToGroupResponse)
associateRoleToGroupResponse_httpStatus :: Lens.Lens' AssociateRoleToGroupResponse Prelude.Int
associateRoleToGroupResponse_httpStatus :: (Int -> f Int)
-> AssociateRoleToGroupResponse -> f AssociateRoleToGroupResponse
associateRoleToGroupResponse_httpStatus = (AssociateRoleToGroupResponse -> Int)
-> (AssociateRoleToGroupResponse
-> Int -> AssociateRoleToGroupResponse)
-> Lens
AssociateRoleToGroupResponse AssociateRoleToGroupResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssociateRoleToGroupResponse' {Int
httpStatus :: Int
$sel:httpStatus:AssociateRoleToGroupResponse' :: AssociateRoleToGroupResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: AssociateRoleToGroupResponse
s@AssociateRoleToGroupResponse' {} Int
a -> AssociateRoleToGroupResponse
s {$sel:httpStatus:AssociateRoleToGroupResponse' :: Int
httpStatus = Int
a} :: AssociateRoleToGroupResponse)
instance Prelude.NFData AssociateRoleToGroupResponse