Skip to content

associate_service_role_to_account async

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

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/async_greengrass_v2.py
async def associate_service_role_to_account(
    self,
    role_arn: "capo_greengrassv2.types.string.String",
    *,
    config_overrides: Optional[AsyncGreengrassV2ClientConfig] = 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.
    """

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

        (
            output,
            http_response,
        ) = await capo_greengrassv2._operations.greengrass_v2.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_greengrassv2.types.associate_service_role_to_account_request.AssociateServiceRoleToAccountRequest = {
        "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