Skip to content

associate_role_to_group async

associate_role_to_group(
    group_id: __string,
    *,
    config_overrides: Optional[AsyncGreengrassClientConfig] = None,
    role_arn: Optional[__string] = None,
) -> AssociateRoleToGroupResponse

Associates a role with a group. Your Greengrass core will use the role to access AWS cloud services. The role's permissions should allow Greengrass core Lambda functions to perform actions against the cloud.

Parameters:

  • group_id (__string) –

    The ID of the Greengrass group.

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

    The ARN of the role you wish to associate with this group. The existence of the role is not validated.

Raises:

Source code in docs_src/capo_greengrass/_services/async_greengrass.py
async def associate_role_to_group(
    self,
    group_id: "capo_greengrass.types.__string.__string",
    *,
    config_overrides: Optional[AsyncGreengrassClientConfig] = None,
    role_arn: Optional["capo_greengrass.types.__string.__string"] = None,
) -> "capo_greengrass.types.associate_role_to_group_response.AssociateRoleToGroupResponse":
    """Associates a role with a group. Your Greengrass core will use the role to access AWS cloud services. The role's permissions should allow Greengrass core Lambda functions to perform actions against the cloud.

    Args:
        group_id: The ID of the Greengrass group.
        role_arn: The ARN of the role you wish to associate with this group. The existence of the role is not validated.

    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_role_to_group_request.AssociateRoleToGroupRequest]",
    ) -> AsyncOperationResponse[
        "capo_greengrass.types.associate_role_to_group_response.AssociateRoleToGroupResponse"
    ]:
        import capo_greengrass._operations.greengrass.associate_role_to_group

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

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("AssociateRoleToGroup")
    )
    input_: capo_greengrass.types.associate_role_to_group_request.AssociateRoleToGroupRequest = {
        "group_id": group_id
    }
    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