Skip to content

create_device_definition async

create_device_definition(
    *,
    config_overrides: Optional[AsyncGreengrassClientConfig] = None,
    amzn_client_token: Optional[__string] = None,
    initial_version: Optional[DeviceDefinitionVersion] = None,
    name: Optional[__string] = None,
    tags: Optional[Tags] = None,
) -> CreateDeviceDefinitionResponse

Creates a device definition. You may provide the initial version of the device definition now or use ''CreateDeviceDefinitionVersion'' at a later time.

Parameters:

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

    A client token used to correlate requests and responses.

  • initial_version (Optional[DeviceDefinitionVersion], default: None ) –

    Information about the initial version of the device definition.

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

    The name of the device definition.

  • tags (Optional[Tags], default: None ) –

    Tag(s) to add to the new resource.

Raises:

Source code in docs_src/capo_greengrass/_services/async_greengrass.py
async def create_device_definition(
    self,
    *,
    config_overrides: Optional[AsyncGreengrassClientConfig] = None,
    amzn_client_token: Optional["capo_greengrass.types.__string.__string"] = None,
    initial_version: Optional[
        "capo_greengrass.types.device_definition_version.DeviceDefinitionVersion"
    ] = None,
    name: Optional["capo_greengrass.types.__string.__string"] = None,
    tags: Optional["capo_greengrass.types.tags.Tags"] = None,
) -> "capo_greengrass.types.create_device_definition_response.CreateDeviceDefinitionResponse":
    """Creates a device definition. You may provide the initial version of the device definition now or use ''CreateDeviceDefinitionVersion'' at a later time.

    Args:
        amzn_client_token: A client token used to correlate requests and responses.
        initial_version: Information about the initial version of the device definition.
        name: The name of the device definition.
        tags: Tag(s) to add to the new resource.

    Raises:
        capo_greengrass.errors.bad_request_exception.BadRequestException: 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.create_device_definition_request.CreateDeviceDefinitionRequest]",
    ) -> AsyncOperationResponse[
        "capo_greengrass.types.create_device_definition_response.CreateDeviceDefinitionResponse"
    ]:
        import capo_greengrass._operations.greengrass.create_device_definition

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

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateDeviceDefinition")
    )
    input_: capo_greengrass.types.create_device_definition_request.CreateDeviceDefinitionRequest = {}
    if amzn_client_token is not None:
        input_["amzn_client_token"] = amzn_client_token
    if initial_version is not None:
        input_["initial_version"] = initial_version
    if name is not None:
        input_["name"] = name
    if tags is not None:
        input_["tags"] = tags

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output