Skip to content

create_thing_group

create_thing_group(
    thing_group_name: ThingGroupName,
    *,
    config_overrides: Optional[IoTClientConfig] = None,
    parent_group_name: Optional[ThingGroupName] = None,
    thing_group_properties: Optional[ThingGroupProperties] = None,
    tags: Optional[TagList] = None,
) -> CreateThingGroupResponse

Create a thing group.

This is a control plane operation. See Authorization for information about authorizing control plane actions.

If the ThingGroup that you create has the exact same attributes as an existing ThingGroup, you will get a 200 success response.

Requires permission to access the CreateThingGroup action.

Parameters:

Raises:

Source code in docs_src/capo_iot/_services/io_t.py
def create_thing_group(
    self,
    thing_group_name: "capo_iot.types.thing_group_name.ThingGroupName",
    *,
    config_overrides: Optional[IoTClientConfig] = None,
    parent_group_name: Optional[
        "capo_iot.types.thing_group_name.ThingGroupName"
    ] = None,
    thing_group_properties: Optional[
        "capo_iot.types.thing_group_properties.ThingGroupProperties"
    ] = None,
    tags: Optional["capo_iot.types.tag_list.TagList"] = None,
) -> "capo_iot.types.create_thing_group_response.CreateThingGroupResponse":
    """<p>Create a thing group.</p> <note> <p>This is a control plane operation. See <a href="https://docs.aws.amazon.com/iot/latest/developerguide/iot-authorization.html">Authorization</a> for information about authorizing control plane actions.</p> <p>If the <code>ThingGroup</code> that you create has the exact same attributes as an existing <code>ThingGroup</code>, you will get a 200 success response. </p> </note> <p>Requires permission to access the <a href="https://docs.aws.amazon.com/service-authorization/latest/reference/list_awsiot.html#awsiot-actions-as-permissions">CreateThingGroup</a> action.</p>

    Args:
        thing_group_name: <p>The thing group name to create.</p>
        parent_group_name: <p>The name of the parent thing group.</p>
        thing_group_properties: <p>The thing group properties.</p>
        tags: <p>Metadata which can be used to manage the thing 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_already_exists_exception.ResourceAlreadyExistsException: <p>The resource already exists.</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.create_thing_group_request.CreateThingGroupRequest]",
    ) -> OperationResponse[
        "capo_iot.types.create_thing_group_response.CreateThingGroupResponse"
    ]:
        import capo_iot._operations.aws_iot_service.create_thing_group

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

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateThingGroup")
    )
    input_: capo_iot.types.create_thing_group_request.CreateThingGroupRequest = {
        "thing_group_name": thing_group_name
    }
    if parent_group_name is not None:
        input_["parent_group_name"] = parent_group_name
    if thing_group_properties is not None:
        input_["thing_group_properties"] = thing_group_properties
    if tags is not None:
        input_["tags"] = tags

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