connection create

Create a connection with shared credentials.

Syntax

cpd-cli connection create \
--datasource-type=<datasaource-type-id> \
--name=<connection-name> \
--profile=<cpd-profile-name> \
[--asset-category=SYSTEM|USER] \
[--catalog-id=<catalog-id>] \
[--child-source-system=<child-source-systems-list>] \
[--context=source|target] \
[--cpd-config=<cpd-config-location>] \
[--cpd-scope=<cpd-scope>] \
[--description=<description>] \
[--flags=<connection-flags>] \
[--gateway-id=<secure-gateway-id>] \
[--interaction-properties=<connection-interaction-properties>] \
[--jmes-query=<jmespath-query>] \
[--location-definition=<connection-location>] \
[--origin-country=<data-asset-country>] \
[--output=json|yaml|table] \
[--output-file=<output-file-location>] \
[--owner-id=<connection-owner-id>] \
[--project-id=<project-id>] \
[--properties=<connections-properties>] \
[--quiet] \
[--raw-output=true|false] \
[--ref-asset-id=<reference-catalog-connection-id>] \
[--ref-catalog-id=<catalog-connection-id>] \
[--rov=<rules-of-visibility>] \
[--skip-enforcement] \
[--source-system=<source-system-information>] \
[--space-id=<space-identifier>] \
[--tags<tag1,tag2,...>] \
[--test=true|false] \
[--verbose]

Arguments

The connection create command has no arguments.

Options

Table 1: Command options
Option Description
--asset-category Specify the asset
 category.
Status
Optional.
Syntax
--asset-category=SYSTEM|USER
Default value
No default.
Valid values
SYSTEM|USER
--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.
--child-source-system Specify a list of child source
 systems.
Status
Optional.
Syntax
--child-source-system=<child-source-systems-list>
Default value
No default.
Valid values
A valid list of child source systems.
--context Specify whether assets are discovered for reading (source) or writing (target). 'source' is the default when
 no value is specified.
Status
Optional.
Syntax
--context=source|target
Default value
source
Valid values
source
Assets are discovered for reading.
target
Assets are discovered for writing.
--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.
--datasource-type Specify the name or ID of the data
source type to connect to. For example, "cfdcb449-1204-44ba-baa6-9a8a878e6aa7" or
"db2".
Status
Required.
Syntax
--datasource-type=<datasaource-type-id>
Default value
No default.
Valid values
A valid data source name or ID.
--description Specify a connection
 description.
Status
Optional.
Syntax
--description=<description>
Default value
No default.
Valid values
A valid connection description.
--flags Specify a comma-separated list of
 flags that must be present for the connection to be included in the list. Only connections with no
 flags are returned when the option is not specified.
Status
Optional.
Syntax
--entity-flags=<flag1,flag2,...>
Default value
No default.
Valid values
A comma-separated list of flags.
--gateway-id Specify a secure gateway ID to use with the connection. A secure gateway is required when you connecting to an on-premises data source.
The secure gateway ID is created with the Secure Gateway Service. Your on-premises secure gateway
 client must be connected to the gateway with this ID. For example,
'E9oXGRIhv1e_prod_ng'.
Status
Optional.
Syntax
--gateway-id=<secure-gateway-id>
Default value
No default.
Valid values
A secure gateway ID.

--help

-h

Display command help.
Status
Optional.
Syntax
--help
Default value
No default.
Valid values
Not applicable.
--interaction-properties Specify the interaction properties that are allowed for a connection.
Status
Optional.
Syntax
--interaction-properties=<connection-interaction-properties>
Default value
No default.
Valid values
A valid list of interaction properties.
--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.
--location-definition Specify the connection
 location.
Status
Optional.
Syntax
--location-definition=<connection-location>
Default value
No default.
Valid values
A valid connection location.
--name
Status
Required.
Syntax
--name=<connection-name>
Default value
Specify the connection
 name.
No default.
Valid values
A valid connection name.
--origin-country Specify the data asset ISO 3166 origin country code.
Status
Optional.
Syntax
--origin-country=<data-asset-country>
Default value
us
Valid values
A valid ISO 3166 origin country code.
--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.
--owner-id Specify the connection owner or creator ID. The owner or creator ID is provided when a service ID token is used to create a
 connection.
Status
Optional.
Syntax
--owner-id=<connection-owner-id>
Default value
No default.
Valid values
A valid connection owner or creator ID.
--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.
--properties Specify a JSON object
that contains a set of properties to configure asset browsing
aspects.
Status
Optional.
Syntax
--properties=<connections-properties>
Default value
No default.
Valid values
A valid JSON object.
--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.
--ref-asset-id Specify the ID of the connection in the reference catalog that the connection refers to for properties values.
Status
Optional.
Syntax
--ref-asset-id=<reference-catalog-connection-id>
Default value
No default.
Valid values
A valid reference catalog connection ID.
--ref-catalog-id Specify the catalog ID that the
 connection refers to for properties values.
Status
Optional.
Syntax
--ref-catalog-id=<catalog-connection-id>
Default value
No default.
Valid values
A valid catalog connection ID.
--rov Specify the rules of visibility for connections.
Status
Optional.
Syntax
--rov=<rules-of-visibility>
Default value
No default.
Valid values
Any valid rules of visibility for connections.
--skip-enforcement When the option is specified, shared credentials disablement and vault credentials enforcement guards are disabled for creation
 and updates.
Status
Optional.
Syntax
--skip-enforcement
Default value
Not applicable.
Valid values
Not applicable.
--source-system Specify custom data that is
 associated with an object.
Status
Optional.
Syntax
--source-system=<source-system-information>
Default value
No default.
Valid values
Any valid custom data.
--space-id Specify a space identifier.
Status
Optional.
Syntax
--space-id=<space-identifier>
Default value
No default.
Valid values
A valid space identifier.
--tags Specify the data asset tags. Multiple tags can be specified.
Status
Optional.
Syntax
--tags=<tag1,tag2,...>
Default value
No default.
Valid values
A valid list of comma-separated data asset tags.
--test When the option is set to 'true', the connection is tested before it is saved The connection is not saved when a connection is not
 established.
Status
Optional.
Syntax
--test=true|false
Default value
true
Valid values
true
The connection is tested before it is saved.
false
The connection is not tested before it is saved.
--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 CONNECTION_DESCRIPTION=<The connection description>
export CONNECTION_NAME=<The connection name>
export CREATE_CONN_PROPERTIES= '''
{
      "database": "<database>",
      "host": "<host>",
      "password": "<password>",
      "username": "<username>"
}
'''
export COUNTRY_CODE=<The data asset ISO 3166 origin country code>
export DS_TYPE=<The datasource type name or identifier>
export OUTPUT_TYPE=<The output format ('json', 'yaml', or 'text')>
Create a connection.
cpd-cli connection create \
--description=${CONNECTION_DESCRIPTION} \
--datasource-type=${DS_TYPE} \
--origin-country=${COUNTRY_CODE} \
--output=${OUTPUT_TYPE} \
--profile=${CPD_PROFILE_NAME} \
--project-id=zen \
--properties=${CREATE_CONN_PROPERTIES} \
--name=${CONNECTION_NAME}