Associates a Greengrass service role with IoT Greengrass for your Amazon Web Services account in this Amazon Web Services Region. IoT Greengrass uses this role to verify the identity of client devices and manage core device connectivity information. The role must include the AWSGreengrassResourceAccessRolePolicy managed policy or a custom policy that defines equivalent permissions for the IoT Greengrass features that you use. For more information, see Greengrass service role in the IoT Greengrass Version 2 Developer Guide.
Parameters:
-
role_arn
(String)
–
The Amazon Resource Name (ARN) of the service role to associate with IoT Greengrass for your Amazon Web Services account in this Amazon Web Services Region.
Raises:
-
InternalServerException
–
IoT Greengrass can't process your request right now. Try again later.
-
ValidationException
–
The request isn't valid. This can occur if your request contains malformed JSON or unsupported characters.
-
UnknownServiceError
–
The service returned an error code this client does not model.
Source code in docs_src/capo_greengrassv2/_services/greengrass_v2.py
| def associate_service_role_to_account(
self,
role_arn: "capo_greengrassv2.types.string.String",
*,
config_overrides: Optional[GreengrassV2ClientConfig] = None,
) -> "capo_greengrassv2.types.associate_service_role_to_account_response.AssociateServiceRoleToAccountResponse":
"""<p>Associates a Greengrass service role with IoT Greengrass for your Amazon Web Services account in this Amazon Web Services Region. IoT Greengrass uses this role to verify the identity of client devices and manage core device connectivity information. The role must include the <a href="https://console.aws.amazon.com/iam/home#/policies/arn:awsiam::aws:policy/service-role/AWSGreengrassResourceAccessRolePolicy">AWSGreengrassResourceAccessRolePolicy</a> managed policy or a custom policy that defines equivalent permissions for the IoT Greengrass features that you use. For more information, see <a href="https://docs.aws.amazon.com/greengrass/v2/developerguide/greengrass-service-role.html">Greengrass service role</a> in the <i>IoT Greengrass Version 2 Developer Guide</i>.</p>
Args:
role_arn: <p>The Amazon Resource Name (ARN) of the service role to associate with IoT Greengrass for your Amazon Web Services account in this Amazon Web Services Region.</p>
Raises:
capo_greengrassv2.errors.internal_server_exception.InternalServerException: <p>IoT Greengrass can't process your request right now. Try again later.</p>
capo_greengrassv2.errors.validation_exception.ValidationException: <p>The request isn't valid. This can occur if your request contains malformed JSON or unsupported characters.</p>
capo_greengrassv2.errors.UnknownServiceError: The service returned an error code this client does not model.
"""
def _handler(
req: "OperationRequest[capo_greengrassv2.types.associate_service_role_to_account_request.AssociateServiceRoleToAccountRequest]",
) -> OperationResponse[
"capo_greengrassv2.types.associate_service_role_to_account_response.AssociateServiceRoleToAccountResponse"
]:
import capo_greengrassv2._operations.greengrass_v2.associate_service_role_to_account
output, http_response = (
capo_greengrassv2._operations.greengrass_v2.associate_service_role_to_account.associate_service_role_to_account(
req.options, req.input
)
)
return OperationResponse(output=output, response=http_response)
interceptors_, options_ = self.operation_options(
config_overrides, OperationLogging("AssociateServiceRoleToAccount")
)
input_: capo_greengrassv2.types.associate_service_role_to_account_request.AssociateServiceRoleToAccountRequest = {
"role_arn": role_arn
}
response = execute_pipeline(
OperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
response.response.close()
return response.output
|