Skip to content

associate_service_role_to_account async

associate_service_role_to_account(
    *,
    config_overrides: Optional[AsyncGreengrassClientConfig] = None,
    role_arn: Optional[__string] = None,
) -> AssociateServiceRoleToAccountResponse

Associates a role with your account. AWS IoT Greengrass will use the role to access your Lambda functions and AWS IoT resources. This is necessary for deployments to succeed. The role must have at least minimum permissions in the policy ''AWSGreengrassResourceAccessRolePolicy''.

Parameters:

  • role_arn (Optional[__string], default: None ) –

    The ARN of the service role you wish to associate with your account.

Raises:

Source code in docs_src/capo_greengrass/_services/async_greengrass.py
async def associate_service_role_to_account(
    self,
    *,
    config_overrides: Optional[AsyncGreengrassClientConfig] = None,
    role_arn: Optional["capo_greengrass.types.__string.__string"] = None,
) -> "capo_greengrass.types.associate_service_role_to_account_response.AssociateServiceRoleToAccountResponse":
    """Associates a role with your account. AWS IoT Greengrass will use the role to access your Lambda functions and AWS IoT resources. This is necessary for deployments to succeed. The role must have at least minimum permissions in the policy ''AWSGreengrassResourceAccessRolePolicy''.

    Args:
        role_arn: The ARN of the service role you wish to associate with your account.

    Raises:
        capo_greengrass.errors.bad_request_exception.BadRequestException: General error information.
        capo_greengrass.errors.internal_server_error_exception.InternalServerErrorException: General error information.
        capo_greengrass.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_greengrass.types.associate_service_role_to_account_request.AssociateServiceRoleToAccountRequest]",
    ) -> AsyncOperationResponse[
        "capo_greengrass.types.associate_service_role_to_account_response.AssociateServiceRoleToAccountResponse"
    ]:
        import capo_greengrass._operations.greengrass.associate_service_role_to_account

        (
            output,
            http_response,
        ) = await capo_greengrass._operations.greengrass.associate_service_role_to_account.async_associate_service_role_to_account(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("AssociateServiceRoleToAccount")
    )
    input_: capo_greengrass.types.associate_service_role_to_account_request.AssociateServiceRoleToAccountRequest = {}
    if role_arn is not None:
        input_["role_arn"] = role_arn

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output