asset search

In a specified catalog, search for assets of a generic asset type (asset) or a specific asset type.

Syntax

cpd-cli asset search \
--profile=<cpd-profile-name> \
--query=<lucene-query> \
--type-name=<asset-type-name> \
[--bookmark=<pagination-bookmark>] \
[--catalog-id=<catalog-id>] \
[--context=<catalog-project-or-space-id>] \
[--counts=<counts>] \
[--cpd-config=<cpd-config-location>] \
[--cpd-scope=<cpd-scope>] \
[--drilldown=<map-string-array-list>] \
[--include=<comma-separated-list-of-response-fields>] \
[--jmes-query=<jmespath-query>] \
[--limit=<resource-limit>] \
[--output=json|yaml|table] \
[--output-file=<output-file-location>] \
[--project-id=<project-id>] \
[--quiet] \
[--raw-output=true|false] \
[--sort=<query-sort-order>] \
[--space-id=<space-identifier>] \
[--verbose]

Arguments

The asset search command has no arguments.

Options

Table 1: Command options
Option Description
--bookmark Specify a bookmark for results
pagination.
Status
Optional.
Syntax
--bookmark=<pagination-bookmark>
Default value
No default.
Valid values
Any valid pagination bookmark.
--catalog-id Specify either a catalog ID,
 project ID, or space ID (specify one only).
Status
Optional.
Syntax
--catalog-id=<catalog-id>
Default value
No default.
Valid values
A valid catalog, project, or space ID.
--context Specify the configuration context
 name.
Status
Optional.
Syntax
--context=<catalog-project-or-space-id>
Default value
Not applicable.
Valid values
A valid configuration context name.
--cpd-config The IBM Software Hub
 configuration location. For example, $HOME/.cpd-cli/config.
Status
Optional.
Syntax
--cpd-config=<cpd-config-location>
Default value
$HOME/.cpd-cli/config
Valid values
A valid IBM® Software Hub configuration location.
--cpd-scope The IBM Software Hub space, project, or catalog scope. For example, cpd://default-context/spaces/7bccdda4-9752-4f37-868e-891de6c48135.
Status
Optional.
Syntax
--cpd-scope=<cpd-scope>
Default value
No default.
Valid values
A valid IBM Software Hub space, project, or catalog scope.
--drilldown Provide a JSON string option or specify a JSON file to read from by providing a filepath option that begins with an `@` symbol. For example, `--drilldown=@path/to/file.json`.
Status
Optional.
Syntax
--drilldown=<map-string-array-list>
Default value
No default.

--help

-h

Display command help.
Status
Optional.
Syntax
--help
Default value
No default.
Valid values
Not applicable.
--include Retrieves only fields from the 'decision_optimization' and 'scoring' sections. The output response fields are specified as a comma-separated list. The option retrieves all fields when not specified.
Status
Required.
Syntax
--include=<comma-separated-list-of-response-fields>
Default value
No default.
Valid values
A comma-separated list of field names.
--jmes-query Provide a JMESPath query to customize the output.
Status
Optional.
Syntax
--jmes-query=<jmespath-query>
Default value
No default.
Valid values
A valid JMESPath query.
--limit Specify the total number of resources.
Status
Optional.
Syntax
--limit=<resource-limit>
Default value
100
Valid values
An integer value in the range 0 - 200.
--output Specify an output format.
Status
Optional.
Syntax
--output=json|yaml|text
Default value
text
Valid values
Valid formats include JSON, YAML, or text (the default format).
--output-file Specify a file path where all output is redirected.
Status
Optional.
Syntax
--output-file=<output-file-location>
Default value
No default.
Valid values
A valid output file path location.
--profile The name of the profile that you created to store information about an instance of Cloud Pak for Data and your credentials for the instance.
Status
Required.
Syntax
--profile=<cpd-profile-name>
Default value
No default.
Valid values

The name of the profile that you created.

--project-id Specify an IBM Software Hub project instance.
Status
Optional.
Syntax
--project-id=<project-id>
Default value
No default.
Valid values
A valid project identifier.
--query The Lucene query.
Status
Required.
Syntax
--query=<lucene-query>
Default value
No default.
Valid values
A valid Lucene query.
--quiet Suppress verbose messages.
Status
Optional.
Syntax
--quiet
Default value
No default.
Valid values
Not applicable.
--raw-output When set to true, single values are not surrounded by quotation marks in
 JSON output mode.
Status
Optional.
Syntax
--raw-output=true|false
Default value
false
Valid values
false
Single values in JSON output mode are surrounded by quotation marks.
true
Single values in JSON output mode are not surrounded by quotation marks.
--sort The query sort
 order.
Status
Optional.
Syntax
--sort=<query-sort-order>
Default value
No default.
Valid values
A valid query sort order.
--space-id Specify a space identifier.
Status
Optional.
Syntax
--space-id=<space-identifier>
Default value
No default.
Valid values
A valid space identifier.
--type-name The asset type name. For example,
'data_asset'.
Status
Required.
Syntax
--type-name=<asset-type-name>
Default value
No default.
Valid values
A valid asset type name.
--verbose Logs include more detailed messages.
Status
Optional.
Syntax
--verbose
Default value
No default.
Valid values
Not applicable.

Examples

Note: The following examples use environment variables. Use a script to create environment variables with the correct values for your environment. You can add the listed environment variables to the installation variables script. For more information, see Setting up installation environment variables.
Define the environment variables.
export FILE_PATH=<upload-file-path-and-name>
List a project script asset with a type name of script.
cpd-cli asset search \
--profile=${CPD_PROFILE_NAME} \
--project-id=${PROJECT_CPD_INST_OPERANDS} \
--query=<lucene-query> \
--type-name=script
Search with pagination. You can define a specific number of search results by adding a --limit parameter to the request. The following example limits the number of search results to 2.
cpd-cli asset search \
--limit=2 \
--profile=${CPD_PROFILE_NAME} \
--query=<lucene-query> \
--type-name=<asset-type-name>
When more search results are available, the response contains a next JSON object. The next object contains a bookmark section along with the original query that must be returned to retrieve the next sets of result.
{
"next": {
"bookmark": "g1AAAXXXXXXXX",
"query" : "asset.name:Asset*,"
"limit" : 2
},
"results": [
{ ..asset 1... }, { ..asset 2... }],
"total_rows": 3
}