Skip to content

add_thing_to_thing_group

add_thing_to_thing_group(
    *,
    config_overrides: Optional[IoTClientConfig] = None,
    thing_group_name: Optional[ThingGroupName] = None,
    thing_group_arn: Optional[ThingGroupArn] = None,
    thing_name: Optional[ThingName] = None,
    thing_arn: Optional[ThingArn] = None,
    override_dynamic_groups: Optional[OverrideDynamicGroups] = None,
) -> AddThingToThingGroupResponse

Adds a thing to a thing group.

Requires permission to access the AddThingToThingGroup action.

Parameters:

  • thing_group_name (Optional[ThingGroupName], default: None ) –

    The name of the group to which you are adding a thing.

  • thing_group_arn (Optional[ThingGroupArn], default: None ) –

    The ARN of the group to which you are adding a thing.

  • thing_name (Optional[ThingName], default: None ) –

    The name of the thing to add to a group.

  • thing_arn (Optional[ThingArn], default: None ) –

    The ARN of the thing to add to a group.

  • override_dynamic_groups (Optional[OverrideDynamicGroups], default: None ) –

    Override dynamic thing groups with static thing groups when 10-group limit is reached. If a thing belongs to 10 thing groups, and one or more of those groups are dynamic thing groups, adding a thing to a static group removes the thing from the last dynamic group.

Raises:

Source code in docs_src/capo_iot/_services/io_t.py
def add_thing_to_thing_group(
    self,
    *,
    config_overrides: Optional[IoTClientConfig] = None,
    thing_group_name: Optional[
        "capo_iot.types.thing_group_name.ThingGroupName"
    ] = None,
    thing_group_arn: Optional[
        "capo_iot.types.thing_group_arn.ThingGroupArn"
    ] = None,
    thing_name: Optional["capo_iot.types.thing_name.ThingName"] = None,
    thing_arn: Optional["capo_iot.types.thing_arn.ThingArn"] = None,
    override_dynamic_groups: Optional[
        "capo_iot.types.override_dynamic_groups.OverrideDynamicGroups"
    ] = None,
) -> (
    "capo_iot.types.add_thing_to_thing_group_response.AddThingToThingGroupResponse"
):
    """<p>Adds a thing to a thing group.</p> <p>Requires permission to access the <a href="https://docs.aws.amazon.com/service-authorization/latest/reference/list_awsiot.html#awsiot-actions-as-permissions">AddThingToThingGroup</a> action.</p>

    Args:
        thing_group_name: <p>The name of the group to which you are adding a thing.</p>
        thing_group_arn: <p>The ARN of the group to which you are adding a thing.</p>
        thing_name: <p>The name of the thing to add to a group.</p>
        thing_arn: <p>The ARN of the thing to add to a group.</p>
        override_dynamic_groups: <p>Override dynamic thing groups with static thing groups when 10-group limit is reached. If a thing belongs to 10 thing groups, and one or more of those groups are dynamic thing groups, adding a thing to a static group removes the thing from the last dynamic group.</p>

    Raises:
        capo_iot.errors.internal_failure_exception.InternalFailureException: <p>An unexpected error has occurred.</p>
        capo_iot.errors.invalid_request_exception.InvalidRequestException: <p>The request is not valid.</p>
        capo_iot.errors.resource_not_found_exception.ResourceNotFoundException: <p>The specified resource does not exist.</p>
        capo_iot.errors.throttling_exception.ThrottlingException: <p>The rate exceeds the limit.</p>
        capo_iot.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_iot.types.add_thing_to_thing_group_request.AddThingToThingGroupRequest]",
    ) -> OperationResponse[
        "capo_iot.types.add_thing_to_thing_group_response.AddThingToThingGroupResponse"
    ]:
        import capo_iot._operations.aws_iot_service.add_thing_to_thing_group

        output, http_response = (
            capo_iot._operations.aws_iot_service.add_thing_to_thing_group.add_thing_to_thing_group(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("AddThingToThingGroup")
    )
    input_: capo_iot.types.add_thing_to_thing_group_request.AddThingToThingGroupRequest = {}
    if thing_group_name is not None:
        input_["thing_group_name"] = thing_group_name
    if thing_group_arn is not None:
        input_["thing_group_arn"] = thing_group_arn
    if thing_name is not None:
        input_["thing_name"] = thing_name
    if thing_arn is not None:
        input_["thing_arn"] = thing_arn
    if override_dynamic_groups is not None:
        input_["override_dynamic_groups"] = override_dynamic_groups

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output