예제 #1
0
def get(client: ConnectionClient, conn_id: str, output_format: str,
        decrypted: bool):
    """
    \b
    Get connections.
    The command without id argument retrieve all connections.
    \b
    Get all connections in json format:
        odahuflowctl conn get --output-format json
    \b
    Get connection with "git-repo" id:
        odahuflowctl conn get --id git-repo
    \b
    Using jsonpath:
        odahuflowctl conn get -o 'jsonpath=[*].spec.reference'
    \f
    :param decrypted: if set than decrypted connection will be returned
    :param client: Connection HTTP client
    :param conn_id: Connection ID
    :param output_format: Output format
    :return:
    """
    if conn_id:
        if decrypted:
            conn = client.get_decrypted(conn_id)
        else:
            conn = client.get(conn_id)

        conns = [conn]
    else:
        conns = client.get_all()

    format_output(conns, output_format)
예제 #2
0
def edit(client: ConnectionClient, conn_id: str, file: str,
         output_format: str):
    """
    \b
    Update a connection.
    You should specify a path to file with a connection. The file must contain only one connection.
    For now, CLI supports YAML and JSON file formats.
    If you want to update multiple connections, you should use "odahuflowctl bulk apply" instead.
    If you provide the connection id parameter, it will override before sending to API server.
    \b
    Usage example:
        * odahuflowctl conn update -f conn.yaml --id examples-git
    \f
    :param client: Connection HTTP client
    :param conn_id: Connection ID
    :param file: Path to the file with only one connection
    :param output_format: Output format
    """
    conn = parse_resources_file_with_one_item(file).resource
    if not isinstance(conn, Connection):
        raise ValueError(f'Connection expected, but {type(conn)} provided')

    if conn_id:
        conn.id = conn_id

    click.echo(format_output([client.edit(conn)], output_format))
def edit(client: PackagingIntegrationClient, pi_id: str, file: str,
         output_format: str):
    """
    Update a packaging integration.\n
    You should specify a path to file with a packaging integration.
    The file must contain only one packaging integration.
    For now, CLI supports yaml and JSON file formats.
    If you want to update multiples packaging integrations than you should use "odahuflowctl res apply" instead.
    If you provide the packaging integration id parameter than it will be overridden before sending to API server.\n
    Usage example:\n
        * odahuflowctl pack-integration update -f pi.yaml --id examples-git
    \f
    :param client: Packaging integration HTTP client
    :param pi_id: Packaging integration ID
    :param file: Path to the file with only one packaging integration
    :param output_format: Output format
    """
    pi = parse_resources_file_with_one_item(file).resource
    if not isinstance(pi, PackagingIntegration):
        raise ValueError(
            f'Packaging integration expected, but {type(pi)} provided')

    if pi_id:
        pi.id = pi_id

    click.echo(format_output([client.edit(pi)], output_format))
def create(client: ToolchainIntegrationClient, ti_id: str, file: str,
           output_format: str):
    """
    Create a toolchain integration.\n
    You should specify a path to file with a toolchain integration.
    The file must contain only one toolchain integration.
    For now, CLI supports yaml and JSON file formats.
    If you want to create multiples toolchain integrations than you should use "odahuflowctl res apply" instead.
    If you provide the toolchain integration id parameter than it will be overridden before sending to API server.\n
    Usage example:\n
        * odahuflowctl tn-integration create -f ti.yaml --id examples-git
    \f
    :param client: Toolchain integration HTTP client
    :param ti_id: Toolchain integration ID
    :param file: Path to the file with only one toolchain integration
    :param output_format: Output format
    """
    ti = parse_resources_file_with_one_item(file).resource
    if not isinstance(ti, ToolchainIntegration):
        raise ValueError(
            f'Toolchain integration expected, but {type(ti)} provided')

    if ti_id:
        ti.id = ti_id

    click.echo(format_output([client.create(ti)], output_format))
def get(client: ToolchainIntegrationClient, ti_id: str, output_format: str):
    """
    Get toolchain integrations.\n
    The command without id argument retrieve all toolchain integrations.\n
    Get all toolchain integrations in json format:\n
        odahuflowctl tn-integration get --output-format json\n
    Get toolchain integration with "git-repo" id:\n
        odahuflowctl tn-integration get --id git-repo\n
    Using jsonpath:\n
        odahuflowctl tn-integration get -o 'jsonpath=[*].spec.reference'
    \f
    :param client: Toolchain integration HTTP client
    :param ti_id: Toolchain integration ID
    :param output_format: Output format
    :return:
    """
    tis = [client.get(ti_id)] if ti_id else client.get_all()

    format_output(tis, output_format)
예제 #6
0
def get(client: ModelRouteClient, mr_id: str, output_format: str):
    """
    Get routes.\n
    The command without id argument retrieve all routes.\n
    Get all routes in json format:\n
        odahuflowctl route get --output-format json\n
    Get model route with "git-repo" id:\n
        odahuflowctl route get --id git-repo\n
    Using jsonpath:\n
        odahuflowctl route get -o 'jsonpath=[*].spec.reference'
    \f
    :param client: ModelRoute HTTP client
    :param mr_id: ModelRoute ID
    :param output_format: Output format
    :return:
    """
    routes = [client.get(mr_id)] if mr_id else client.get_all()

    format_output(routes, output_format)
예제 #7
0
def get(client: PackagingIntegrationClient, pi_id: str, output_format: str):
    """
    Get packaging integrations.\n
    The command without id argument retrieve all packaging integrations.\n
    Get all packaging integrations in json format:\n
        odahuflowctl pack-integration get --output-format json\n
    Get packaging integration with "git-repo" id:\n
        odahuflowctl pack-integration get --id git-repo\n
    Using jsonpath:\n
        odahuflowctl pack-integration get -o 'jsonpath=[*].spec.reference'
    \f
    :param client: Packaging integration HTTP client
    :param pi_id: Packaging integration ID
    :param output_format: Output format
    :return:
    """
    pis = [client.get(pi_id)] if pi_id else client.get_all()

    format_output(pis, output_format)
예제 #8
0
def get(client: ModelTrainingClient, train_id: str, output_format: str):
    """
    \b
    Get trainings.
    The command without id argument retrieve all trainings.
    \b
    Get all trainings in json format:
        odahuflowctl train get --output-format json
    \b
    Get training with "git-repo" id:
        odahuflowctl train get --id git-repo
    \b
    Using jsonpath:
        odahuflowctl train get -o 'jsonpath=[*].spec.reference'
    \f
    :param client: Model training HTTP client
    :param train_id: Model training ID
    :param output_format: Output format
    :return:
    """
    trains = [client.get(train_id)] if train_id else client.get_all()

    format_output(trains, output_format)
예제 #9
0
def get(client: ModelDeploymentClient, md_id: str, output_format: str):
    """
    \b
    Get deployments.
    The command without id argument retrieve all deployments.
    \b
    Get all deployments in json format:
        odahuflowctl dep get --output-format json
    \b
    Get deployment with "git-repo" id:
        odahuflowctl dep get --id model-wine
    \b
    Using jsonpath:
        odahuflowctl dep get -o 'jsonpath=[*].spec.reference'
    \f
    :param client: Model deployment HTTP client
    :param md_id: Model deployment ID
    :param output_format: Output format
    :return:
    """
    mds = [client.get(md_id)] if md_id else client.get_all()

    format_output(mds, output_format)
예제 #10
0
def get(client: ModelPackagingClient, pack_id: str, output_format: str):
    """
    \b
    Get packagings.
    The command without id argument retrieve all packagings.
    \b
    Get all packagings in json format:
        odahuflowctl pack get --output-format json
    \b
    Get packaging with "git-repo" id:
        odahuflowctl pack get --id git-repo
    \b
    Using jsonpath:
        odahuflowctl pack get -o 'jsonpath=[*].spec.reference'
    \f
    :param client: Model packaging HTTP client
    :param pack_id: Model packaging ID
    :param output_format: Output format
    :return:
    """
    packs = [client.get(pack_id)] if pack_id else client.get_all()

    format_output(packs, output_format)