Skip to content

create_flow_template

create_flow_template(
    definition: DefinitionDocument,
    *,
    config_overrides: Optional[IoTThingsGraphClientConfig] = None,
    compatible_namespace_version: Optional[Version] = None,
) -> CreateFlowTemplateResponse

Creates a workflow template. Workflows can be created only in the user's namespace. (The public namespace contains only entities.) The workflow can contain only entities in the specified namespace. The workflow is validated against the entities in the latest version of the user's namespace unless another namespace version is specified in the request.

Parameters:

  • definition (DefinitionDocument) –

    The workflow DefinitionDocument.

  • compatible_namespace_version (Optional[Version], default: None ) –

    The namespace version in which the workflow is to be created.

    If no value is specified, the latest version is used by default.

Raises:

Source code in docs_src/capo_iotthingsgraph/_services/io_t_things_graph.py
def create_flow_template(
    self,
    definition: "capo_iotthingsgraph.types.definition_document.DefinitionDocument",
    *,
    config_overrides: Optional[IoTThingsGraphClientConfig] = None,
    compatible_namespace_version: Optional[
        "capo_iotthingsgraph.types.version.Version"
    ] = None,
) -> "capo_iotthingsgraph.types.create_flow_template_response.CreateFlowTemplateResponse":
    """<p>Creates a workflow template. Workflows can be created only in the user's namespace. (The public namespace contains only entities.) The workflow can contain only entities in the specified namespace. The workflow is validated against the entities in the latest version of the user's namespace unless another namespace version is specified in the request.</p>

    Args:
        definition: <p>The workflow <code>DefinitionDocument</code>.</p>
        compatible_namespace_version: <p>The namespace version in which the workflow is to be created.</p> <p>If no value is specified, the latest version is used by default.</p>

    Raises:
        capo_iotthingsgraph.errors.internal_failure_exception.InternalFailureException: <p></p>
        capo_iotthingsgraph.errors.invalid_request_exception.InvalidRequestException: <p></p>
        capo_iotthingsgraph.errors.limit_exceeded_exception.LimitExceededException: <p></p>
        capo_iotthingsgraph.errors.resource_already_exists_exception.ResourceAlreadyExistsException: <p></p>
        capo_iotthingsgraph.errors.throttling_exception.ThrottlingException: <p></p>
        capo_iotthingsgraph.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_iotthingsgraph.types.create_flow_template_request.CreateFlowTemplateRequest]",
    ) -> OperationResponse[
        "capo_iotthingsgraph.types.create_flow_template_response.CreateFlowTemplateResponse"
    ]:
        import capo_iotthingsgraph._operations.iot_things_graph_front_end_service.create_flow_template

        output, http_response = (
            capo_iotthingsgraph._operations.iot_things_graph_front_end_service.create_flow_template.create_flow_template(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateFlowTemplate")
    )
    input_: capo_iotthingsgraph.types.create_flow_template_request.CreateFlowTemplateRequest = {
        "definition": definition
    }
    if compatible_namespace_version is not None:
        input_["compatible_namespace_version"] = compatible_namespace_version

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