Skip to content

associate_role_to_group

associate_role_to_group(
    group_id: __string,
    *,
    config_overrides: Optional[GreengrassClientConfig] = 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/greengrass.py
def associate_role_to_group(
    self,
    group_id: "capo_greengrass.types.__string.__string",
    *,
    config_overrides: Optional[GreengrassClientConfig] = 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.
    """

    def _handler(
        req: "OperationRequest[capo_greengrass.types.associate_role_to_group_request.AssociateRoleToGroupRequest]",
    ) -> OperationResponse[
        "capo_greengrass.types.associate_role_to_group_response.AssociateRoleToGroupResponse"
    ]:
        import capo_greengrass._operations.greengrass.associate_role_to_group

        output, http_response = (
            capo_greengrass._operations.greengrass.associate_role_to_group.associate_role_to_group(
                req.options, req.input
            )
        )
        return OperationResponse(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 = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output