CLI: Connections
Learn how to use the CLI to work with connections.
Table of Contents
The CLI references “skysync.” This is expected.
Overview
You can use the CLI to create and manage connections in the DryvIQ Platform. The authentication parameters are provided within the configuration file in all examples. See the CLI: Authentication for more information.
List Connections
Parameter | Description | Required | Default |
---|---|---|---|
platform p |
Storage platform | Optional | |
search q |
Search text | Optional | |
active | Only retrieve active connections | Optional | |
pools | Only retrieve connection pools. If this switch is not included, both connections and connection pools will be returned | Optional | |
offset | Search offset | Optional | 0 |
limit | Search page size | Optional | 20 |
List All Connections Example
Command
skysync-cli connections list
Example Results
ID Name Platform Enabled IsPool PoolName
5dc531df34554edd96c31272262ad950 My Computer My Computer true TestPool
d8b3254ad46c4aa4929f478dd0d3c51d TestPool My Computer true true
Example JSON Results
[
{
"id": "5dc531df34554edd96c31272262ad950",
"name": "My Computer",
"platform": {
"name": "My Computer",
"id": "fs"
},
"pool": {
"name": "TestPool",
"id": "d8b3254ad46c4aa4929f478dd0d3c51d"
}
},
{
"id": "d8b3254ad46c4aa4929f478dd0d3c51d",
"name": "TestPool",
"platform": {
"name": "My Computer",
"id": "fs"
},
"group": true
}
]
List Box connections Example
Command
skysync-cli connections list -p box
List Active Connections Example
Command
skysync-cli connections list --active
List Connections With "test" in the Name
Command
skysync-cli connections list --search test
or
skysync-cli connections list -q "test"
List connections Skipping the First Five
Command
skysync-cli connections list --offset=5
Show a Connection
This command will show the details of the specified connection. The parameters within the two curly braces (including the braces) must be replaced with valid values.
Parameter | Description | Required |
---|---|---|
id | The ID of the connection for which details will be shown | Required |
Command With Variables
skysync-cli connections show {{id}}
Command With Example Values
skysync-cli connections show 5dc531df34554edd96c31272262ad950
Example Results
ID 5dc531df34554edd96c31272262ad950
Name My Computer
Platform My Computer
Account
Enabled true
Example Results (JSON)
[
{
"id": "5dc531df34554edd96c31272262ad950",
"name": "My Computer",
"platform": {
"name": "My Computer",
"id": "fs"
}
}
]
Expected Results for Invalid ID
If the ID entered does not correspond to an existing connection, the expected output is the following.
ID
Name
Platform
Account
Enabled true
Expected JSON Results
null
List the Platforms
The platform ID is required to create a connection. To retrieve the full list of available platforms, run the following command.
Command
skysync-cli connections platforms
Example Results
ID Name Enabled
box Box Y
fs My Computer Y
nfs Network File System Y
onedrive Microsoft OneDrive Y
sharepoint Microsoft SharePoint Y
onedrive-business Microsoft OneDrive for Business Y
office365 Microsoft Office 365 Y
Example JSON Results
[
{
"id": "box",
"name": "Box"
},
{
"id": "fs",
"name": "My Computer"
},
{
"id": "nfs",
"name": "Network File System"
},
{
"id": "onedrive",
"name": "Microsoft OneDrive"
},
{
"id": "sharepoint",
"name": "Microsoft SharePoint"
},
{
"id": "onedrive-business",
"name": "Microsoft OneDrive for Business"
},
{
"id": "office365",
"name": "Microsoft Office 365"
}
]
Show a Platform
This command will show the details of the specified platform. The parameters within the two curly braces (including the braces) must be replaced with valid values.
Parameter | Description | Required |
---|---|---|
id | The ID of the connection for which details will be shown | Required |
Command With Variables
skysync-cli connections platforms {{id}}
Command With Example Values
skysync-cli connections platforms nfs
Example Results
ID nfs
Name Network File System
Enabled Y
Example JSON Results
[
{
"id": "nfs",
"name": "Network File System"
}
]
Create a Connection
This command allows you to create a connection.
Parameter | Description | Required | Default |
---|---|---|---|
platform p |
Storage platform | Required | |
name | Connection name | Optional | |
auth-input in |
Read authentication JSON from stdin | Optional | false |
auth-file file |
The authentication JSON file | Optional |
Create a Box Connection Providing the Authentication From the stdin
This example creates a connection to Box. The command below returns a link you must open in a Web browser. This will take you to the Box login page where you will provide the authentication information and grant DryvIQ access to the account. Once you grant the authorization, the new connection will exist in the Connections list.
Command With Variables
skysync-cli connections add --platform=box --name=BoxConnection1
Box Login
Creating Connections Using Authentication From a File
The following examples show how to create various connections using authentication from a JSON file. The parameters within the two curly braces (including the braces) must be replaced with valid values.
Create an NFS Connection
Command With Variables
skysync-cli connections add --platform=nfs --name={{optionalConnectionName}} --auth-file={{authFile}}.json
Command With Example Values
skysync-cli connections add --platform=nfs --name=NFSConnection2 --auth-file=NFSConnection2.json
Contents of NFSConnection2.json
Note that the uri has the backslashes escaped.
{
"username": "{{username}}",
"password": "{{password}}",
"uri": "\\\\{{serverName}}\\{{shareName}}",
"versioning": true
}
Example Results
ID 213e6621d3594903b73d0799abde09e6
Name NFSConnection2
Platform Network File System
Enabled true
Example JSON Results
[
{
"id": "86e7c5c398fd4607a28dbbff80c69849",
"name": "NFSConnection2",
"platform": {
"name": "Network File System",
"id": "nfs"
}
}
]
Create a Box Connection
Command With Variables
skysync-cli connections add --platform=box --name={{optionalConnectionName}} --auth-file={{authFile}}.json
Command With Example Values
skysync-cli connections add --platform=box --name=BoxConnection2 --auth-file=connections/BoxConnection2.json
Refer to Creating a Box (Service Account) to utilize Box authentication through a Box Service Account.
Contents of BoxConnection2.json
{
"public_key_id": "{{boxPublicKey}}",
"client_id": "{{boxClientID}}",
"client_secret": "{{boxClientSecret}}",
"user_id": "{{boxUserId}}",
"password": "{{boxPassword}}",
"private_key": "{{boxPrivateKey}}"
}
Example Results
ID 75268591b32b46f2895fb97a368701be
Name BoxConnection2
Platform Box
Enabled true
Example JSON Results
[
{
"id": "75268591b32b46f2895fb97a368701be",
"name": "BoxConnection2",
"platform": {
"name": "Box",
"id": "box"
}
}
]
Create a Microsoft OneDrive for Business Connection
Command With Variables
skysync-cli connections add -p onedrive-business --name {{optionalConnectionName}} --auth-file {{authFile}}.json
Command With Example Values
skysync-cli connections add -p onedrive-business --name ODFBConnection1 --auth-file connections/odfb-connection-1.json
Contents of odfb-connection-1.json
The URI contains a portion of the username. Ensure you specify the correct URI to obtain expected results.
{
"username": "{{odfb-username}}",
"password": "{{odfb-password}}",
"uri": "{{odfb-uri}}",
"versioning": true
}
Example Contents of odfb-connection-1.json
{
"username": "user@example.onmicrosoft.com",
"password": "user-odfb-password",
"uri": "https://example-my.sharepoint.com/personal/user_example_onmicrosoft_com",
"versioning": true
}
Example Results
ID cda8231a40364724bc8581a264670e09
Name Microsoft OneDrive for Business (https://example-my.sharepoint.com/personal/user_example_onmicrosoft_com/)
Platform Microsoft OneDrive for Business
Enabled true
Example JSON Results
[
{
"id": "cda8231a40364724bc8581a264670e09",
"name": "Microsoft OneDrive for Business (https://example-my.sharepoint.com/personal/user_example_onmicrosoft_com/)",
"platform": {
"name": "Microsoft OneDrive for Business",
"id": "onedrive-business"
}
}
]
Create a Syncplicity connection
Command With Variables
skysync-cli connections add -p syncplicity --name {{optionalConnectionName}} --auth-file {{authFile}}.json
Command With Examples
skysync-cli connections add -p syncplicity --name SyncplicityConnection1 --auth-file connections/syncplicity-connection-1.json
Contents of syncplicity-connection-1.json
The admin_mode parameter is optional. This parameter should be set to true if admin mode is desired.
{
"client_id": "{{syncplicity_client_id}}",
"client_secret": "{{syncplicity_client_secret}}",
"app_token": "{{syncplicity_app_token}}",
"admin_mode": "{{admin_mode}}"
}
Example Results
ID cda8231a40364724bc8581a264670e09
Name SyncplicityConnection1
Platform Syncplicity
Enabled true
Example JSON Results
[
{
"id": "cda8231a40364724bc8581a264670e09",
"name": "SyncplicityConnection1",
"platform": {
"name": "Syncplicity",
"id": "syncplicity"
}
}
]
Add a Connection Pool
This command assigns a connection to a connection pool. A connection can only be assigned to one pool. If the connection was previously assigned to a different pool, running this command with a different pool will remove it from the original pool.
Parameter | Description | Required |
---|---|---|
id | ID of the connection to be assigned to a pool | Required |
name | Name of new or existing connection pool | Optional |
pool | ID of an existing connection pool | Optional |
Command
skysync-cli connections pool assign {id} [name] [pool]
Assign a Connection to a Connection Pool by Name
The named connection pool will first be created if it does not exist.
Command With Example Values
skysync-cli connections pool assign 5dc531df34554edd96c31272262ad950 --name TestPool
Assign a Connection to a Connection Pool by ID
When using an ID< the connection pool must exist. An error will result if a connection pool does not exist with the specified ID.
Command With Example Values
skysync-cli connections pool assign 5dc531df34554edd96c31272262ad950 --pool d8b3254ad46c4aa4929f478dd0d3c51d
Remove a Connection From a Connection Pool
This command removes a connection from a connection pool. Connection pool information does not need to be specified. Once this command runs, the connection will not be attached to any pools.
Parameter | Description | Required |
---|---|---|
id | ID of the connection to be removed from a connection pool | Required |
Command
skysync-cli connections pool unassign {id}
Command With Example Values
skysync-cli connections pool unassign 5dc531df34554edd96c31272262ad950
Delete a Connection
This command will delete the specified connection. The parameters within the two curly braces (including the braces) must be replaced with valid values.
Parameter | Description | Required |
---|---|---|
id | ID of the connection to be removed from a connection pool | Required |
Command With Variables
skysync-cli connections delete {{id}}
Command With Example Values
skysync-cli connections delete 5dc531df34554edd96c31272262ad950
Expected Results For Invalid ID
If the ID entered does not correspond to an existing connection, the expected output is the following. The response is only available in the default format. If JSON output is specified, no output will be provided.
The connection could not be deleted.