Creates a new thing type. If this call is made multiple times using the same thing type name and configuration, the call will succeed. If this call is made with the same thing type name but different configuration a ResourceAlreadyExistsException is thrown.
Requires permission to access the CreateThingType action.
Parameters:
-
thing_type_name
(ThingTypeName)
–
The name of the thing type.
-
thing_type_properties
(Optional[ThingTypeProperties], default:
None
)
–
The ThingTypeProperties for the thing type to create. It contains information about the new thing type including a description, and a list of searchable thing attribute names.
-
tags
(Optional[TagList], default:
None
)
–
Metadata which can be used to manage the thing type.
Raises:
Source code in docs_src/capo_iot/_services/io_t.py
| def create_thing_type(
self,
thing_type_name: "capo_iot.types.thing_type_name.ThingTypeName",
*,
config_overrides: Optional[IoTClientConfig] = None,
thing_type_properties: Optional[
"capo_iot.types.thing_type_properties.ThingTypeProperties"
] = None,
tags: Optional["capo_iot.types.tag_list.TagList"] = None,
) -> "capo_iot.types.create_thing_type_response.CreateThingTypeResponse":
"""<p>Creates a new thing type. If this call is made multiple times using the same thing type name and configuration, the call will succeed. If this call is made with the same thing type name but different configuration a <code>ResourceAlreadyExistsException</code> is thrown. </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">CreateThingType</a> action.</p>
Args:
thing_type_name: <p>The name of the thing type.</p>
thing_type_properties: <p>The ThingTypeProperties for the thing type to create. It contains information about the new thing type including a description, and a list of searchable thing attribute names.</p>
tags: <p>Metadata which can be used to manage the thing type.</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.service_unavailable_exception.ServiceUnavailableException: <p>The service is temporarily unavailable.</p>
capo_iot.errors.throttling_exception.ThrottlingException: <p>The rate exceeds the limit.</p>
capo_iot.errors.unauthorized_exception.UnauthorizedException: <p>You are not authorized to perform this operation.</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_type_request.CreateThingTypeRequest]",
) -> OperationResponse[
"capo_iot.types.create_thing_type_response.CreateThingTypeResponse"
]:
import capo_iot._operations.aws_iot_service.create_thing_type
output, http_response = (
capo_iot._operations.aws_iot_service.create_thing_type.create_thing_type(
req.options, req.input
)
)
return OperationResponse(output=output, response=http_response)
interceptors_, options_ = self.operation_options(
config_overrides, OperationLogging("CreateThingType")
)
input_: capo_iot.types.create_thing_type_request.CreateThingTypeRequest = {
"thing_type_name": thing_type_name
}
if thing_type_properties is not None:
input_["thing_type_properties"] = thing_type_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
|