Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(ipfs): add ipns commands #3458

Merged
merged 1 commit into from
Oct 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions cmd/scw/testdata/test-all-usage-ipns-name-create-usage.golden
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲
🟥🟥🟥 STDERR️️ 🟥🟥🟥️
You can use the `ipns key` command to list and generate more names and their respective keys.

USAGE:
scw ipns name create [arg=value ...]

ARGS:
[project-id] Project ID to use. If none is passed the default project ID will be used
[name] Name for your records
[value] Value you want to associate with your records, CID or IPNS key
[region=fr-par] Region to target. If none is passed will use default region from the config (fr-par | nl-ams | pl-waw)

FLAGS:
-h, --help help for create

GLOBAL FLAGS:
-c, --config string The path to the config file
-D, --debug Enable debug mode
-o, --output string Output format: json or human, see 'scw help output' for more info (default "human")
-p, --profile string The config profile to use
19 changes: 19 additions & 0 deletions cmd/scw/testdata/test-all-usage-ipns-name-delete-usage.golden
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲
🟥🟥🟥 STDERR️️ 🟥🟥🟥️
Delete a name by its ID.

USAGE:
scw ipns name delete [arg=value ...]

ARGS:
name-id Name ID you wish to delete
[region=fr-par] Region to target. If none is passed will use default region from the config (fr-par | nl-ams | pl-waw)

FLAGS:
-h, --help help for delete

GLOBAL FLAGS:
-c, --config string The path to the config file
-D, --debug Enable debug mode
-o, --output string Output format: json or human, see 'scw help output' for more info (default "human")
-p, --profile string The config profile to use
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲
🟥🟥🟥 STDERR️️ 🟥🟥🟥️
Export a private key by its ID.

USAGE:
scw ipns name export-key [arg=value ...]

ARGS:
name-id Name ID whose keys you want to export
[region=fr-par] Region to target. If none is passed will use default region from the config (fr-par | nl-ams | pl-waw)

FLAGS:
-h, --help help for export-key

GLOBAL FLAGS:
-c, --config string The path to the config file
-D, --debug Enable debug mode
-o, --output string Output format: json or human, see 'scw help output' for more info (default "human")
-p, --profile string The config profile to use
19 changes: 19 additions & 0 deletions cmd/scw/testdata/test-all-usage-ipns-name-get-usage.golden
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲
🟥🟥🟥 STDERR️️ 🟥🟥🟥️
Retrieve information about a specific name.

USAGE:
scw ipns name get [arg=value ...]

ARGS:
name-id Name ID whose information you want to retrieve
[region=fr-par] Region to target. If none is passed will use default region from the config (fr-par | nl-ams | pl-waw)

FLAGS:
-h, --help help for get

GLOBAL FLAGS:
-c, --config string The path to the config file
-D, --debug Enable debug mode
-o, --output string Output format: json or human, see 'scw help output' for more info (default "human")
-p, --profile string The config profile to use
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲
🟥🟥🟥 STDERR️️ 🟥🟥🟥️
Import a private key.

USAGE:
scw ipns name import-key [arg=value ...]

ARGS:
[project-id] Project ID to use. If none is passed the default project ID will be used
[name] Name for your records
private-key Base64 private key
[value] Value you want to associate with your records, CID or IPNS key
[region=fr-par] Region to target. If none is passed will use default region from the config (fr-par | nl-ams | pl-waw)

FLAGS:
-h, --help help for import-key

GLOBAL FLAGS:
-c, --config string The path to the config file
-D, --debug Enable debug mode
-o, --output string Output format: json or human, see 'scw help output' for more info (default "human")
-p, --profile string The config profile to use
21 changes: 21 additions & 0 deletions cmd/scw/testdata/test-all-usage-ipns-name-list-usage.golden
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲
🟥🟥🟥 STDERR️️ 🟥🟥🟥️
Retrieve information about all names from a Project ID.

USAGE:
scw ipns name list [arg=value ...]

ARGS:
[project-id] Project ID
[order-by] Sort the order of the returned names (created_at_asc | created_at_desc)
[organization-id] Organization ID
[region=fr-par] Region to target. If none is passed will use default region from the config (fr-par | nl-ams | pl-waw | all)

FLAGS:
-h, --help help for list

GLOBAL FLAGS:
-c, --config string The path to the config file
-D, --debug Enable debug mode
-o, --output string Output format: json or human, see 'scw help output' for more info (default "human")
-p, --profile string The config profile to use
22 changes: 22 additions & 0 deletions cmd/scw/testdata/test-all-usage-ipns-name-update-usage.golden
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲
🟥🟥🟥 STDERR️️ 🟥🟥🟥️
Update name information (CID, tag, name...).

USAGE:
scw ipns name update [arg=value ...]

ARGS:
name-id Name ID you wish to update
[name] New name you want to associate with your record
[tags.{index}] New tags you want to associate with your record
[value] Value you want to associate with your records, CID or IPNS key
[region=fr-par] Region to target. If none is passed will use default region from the config (fr-par | nl-ams | pl-waw)

FLAGS:
-h, --help help for update

GLOBAL FLAGS:
-c, --config string The path to the config file
-D, --debug Enable debug mode
-o, --output string Output format: json or human, see 'scw help output' for more info (default "human")
-p, --profile string The config profile to use
26 changes: 26 additions & 0 deletions cmd/scw/testdata/test-all-usage-ipns-name-usage.golden
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲
🟥🟥🟥 STDERR️️ 🟥🟥🟥️
This is the PKI namespace, where the private key is used to publish (sign) a record.

USAGE:
scw ipns name <command>

AVAILABLE COMMANDS:
create Create a new name
delete Delete an existing name
export-key Export your private key
get Get information about a name
import-key Import your private key
list List all names by a Project ID
update Update name information

FLAGS:
-h, --help help for name

GLOBAL FLAGS:
-c, --config string The path to the config file
-D, --debug Enable debug mode
-o, --output string Output format: json or human, see 'scw help output' for more info (default "human")
-p, --profile string The config profile to use

Use "scw ipns name [command] --help" for more information about a command.
20 changes: 20 additions & 0 deletions cmd/scw/testdata/test-all-usage-ipns-usage.golden
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲
🟥🟥🟥 STDERR️️ 🟥🟥🟥️
IPFS Naming service API

USAGE:
scw ipns <command>

AVAILABLE COMMANDS:
name A name is a hash of the public key within the IPNS (InterPlanetary Name System)

FLAGS:
-h, --help help for ipns

GLOBAL FLAGS:
-c, --config string The path to the config file
-D, --debug Enable debug mode
-o, --output string Output format: json or human, see 'scw help output' for more info (default "human")
-p, --profile string The config profile to use

Use "scw ipns [command] --help" for more information about a command.
1 change: 1 addition & 0 deletions cmd/scw/testdata/test-main-usage-usage.golden
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ AVAILABLE COMMANDS:
iam IAM API
instance Instance API
iot This API allows you to manage IoT hubs and devices
ipns IPFS Naming service API
k8s Kubernetes API
lb This API allows you to manage your Scaleway Load Balancer services
marketplace Marketplace API
Expand Down
169 changes: 169 additions & 0 deletions docs/commands/ipns.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,169 @@
<!-- DO NOT EDIT: this file is automatically generated using scw-doc-gen -->
# Documentation for `scw ipns`
IPFS Naming service API

- [A name is a hash of the public key within the IPNS (InterPlanetary Name System)](#a-name-is-a-hash-of-the-public-key-within-the-ipns-(interplanetary-name-system))
- [Create a new name](#create-a-new-name)
- [Delete an existing name](#delete-an-existing-name)
- [Export your private key](#export-your-private-key)
- [Get information about a name](#get-information-about-a-name)
- [Import your private key](#import-your-private-key)
- [List all names by a Project ID](#list-all-names-by-a-project-id)
- [Update name information](#update-name-information)


## A name is a hash of the public key within the IPNS (InterPlanetary Name System)

This is the PKI namespace, where the private key is used to publish (sign) a record.


### Create a new name

You can use the `ipns key` command to list and generate more names and their respective keys.

**Usage:**

```
scw ipns name create [arg=value ...]
```


**Args:**

| Name | | Description |
|------|---|-------------|
| project-id | | Project ID to use. If none is passed the default project ID will be used |
| name | | Name for your records |
| value | | Value you want to associate with your records, CID or IPNS key |
| region | Default: `fr-par`<br />One of: `fr-par`, `nl-ams`, `pl-waw` | Region to target. If none is passed will use default region from the config |



### Delete an existing name

Delete a name by its ID.

**Usage:**

```
scw ipns name delete [arg=value ...]
```


**Args:**

| Name | | Description |
|------|---|-------------|
| name-id | Required | Name ID you wish to delete |
| region | Default: `fr-par`<br />One of: `fr-par`, `nl-ams`, `pl-waw` | Region to target. If none is passed will use default region from the config |



### Export your private key

Export a private key by its ID.

**Usage:**

```
scw ipns name export-key [arg=value ...]
```


**Args:**

| Name | | Description |
|------|---|-------------|
| name-id | Required | Name ID whose keys you want to export |
| region | Default: `fr-par`<br />One of: `fr-par`, `nl-ams`, `pl-waw` | Region to target. If none is passed will use default region from the config |



### Get information about a name

Retrieve information about a specific name.

**Usage:**

```
scw ipns name get [arg=value ...]
```


**Args:**

| Name | | Description |
|------|---|-------------|
| name-id | Required | Name ID whose information you want to retrieve |
| region | Default: `fr-par`<br />One of: `fr-par`, `nl-ams`, `pl-waw` | Region to target. If none is passed will use default region from the config |



### Import your private key

Import a private key.

**Usage:**

```
scw ipns name import-key [arg=value ...]
```


**Args:**

| Name | | Description |
|------|---|-------------|
| project-id | | Project ID to use. If none is passed the default project ID will be used |
| name | | Name for your records |
| private-key | Required | Base64 private key |
| value | | Value you want to associate with your records, CID or IPNS key |
| region | Default: `fr-par`<br />One of: `fr-par`, `nl-ams`, `pl-waw` | Region to target. If none is passed will use default region from the config |



### List all names by a Project ID

Retrieve information about all names from a Project ID.

**Usage:**

```
scw ipns name list [arg=value ...]
```


**Args:**

| Name | | Description |
|------|---|-------------|
| project-id | | Project ID |
| order-by | One of: `created_at_asc`, `created_at_desc` | Sort the order of the returned names |
| organization-id | | Organization ID |
| region | Default: `fr-par`<br />One of: `fr-par`, `nl-ams`, `pl-waw`, `all` | Region to target. If none is passed will use default region from the config |



### Update name information

Update name information (CID, tag, name...).

**Usage:**

```
scw ipns name update [arg=value ...]
```


**Args:**

| Name | | Description |
|------|---|-------------|
| name-id | Required | Name ID you wish to update |
| name | | New name you want to associate with your record |
| tags.{index} | | New tags you want to associate with your record |
| value | | Value you want to associate with your records, CID or IPNS key |
| region | Default: `fr-par`<br />One of: `fr-par`, `nl-ams`, `pl-waw` | Region to target. If none is passed will use default region from the config |



2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ require (
github.com/moby/buildkit v0.11.6
github.com/opencontainers/go-digest v1.0.0
github.com/pkg/errors v0.9.1
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.21.0.20231025134805-9d4d800ad0ce
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.21.0.20231026082000-a1119e5a483e
github.com/skratchdot/open-golang v0.0.0-20200116055534-eef842397966
github.com/spf13/cobra v1.7.0
github.com/spf13/pflag v1.0.5
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -487,8 +487,8 @@ github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDN
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/sabhiram/go-gitignore v0.0.0-20210923224102-525f6e181f06 h1:OkMGxebDjyw0ULyrTYWeN0UNCCkmCWfjPnIA2W6oviI=
github.com/sabhiram/go-gitignore v0.0.0-20210923224102-525f6e181f06/go.mod h1:+ePHsJ1keEjQtpvf9HHw0f4ZeJ0TLRsxhunSI2hYJSs=
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.21.0.20231025134805-9d4d800ad0ce h1:h2AZP6SVZbUtuq1hgmKwAT80FHkSwNSyLl4zRHhn0NI=
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.21.0.20231025134805-9d4d800ad0ce/go.mod h1:fCa7OJZ/9DRTnOKmxvT6pn+LPWUptQAmHF/SBJUGEcg=
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.21.0.20231026082000-a1119e5a483e h1:4avaevgCuKDSd/S16Mndg/ty3FIIgevfvstXnuWBZxU=
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.21.0.20231026082000-a1119e5a483e/go.mod h1:fCa7OJZ/9DRTnOKmxvT6pn+LPWUptQAmHF/SBJUGEcg=
github.com/sclevine/spec v1.4.0 h1:z/Q9idDcay5m5irkZ28M7PtQM4aOISzOpj4bUPkDee8=
github.com/secure-systems-lab/go-securesystemslib v0.4.0 h1:b23VGrQhTA8cN2CbBw7/FulN9fTtqYUdS5+Oxzt+DUE=
github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo=
Expand Down
Loading
Loading