MysteryBox is now called SecretStash. The Nebius AI Cloud CLI, API and Terraform provider still use the
mysterybox service identifier. Keep using mysterybox in scripts and manifests.Prerequisites
- Web console
- CLI
- Go SDK
- Python SDK
- JavaScript SDK
Make sure you are in a group that has at least the
editor role within your tenant or project; for example, the default editors group. You can check this in the Administration → IAM section of the web console.- Install and configure the Nebius AI Cloud CLI.
-
Make sure that you or the service account that you use is in a group that has at least the
editorrole within your tenant or project; for example, the defaulteditorsgroup. You can check this in the Administration → IAM section of the web console.
- Install and initialize the Nebius SDK for Go.
-
Make sure that you or the service account that you use is in a group that has at least the
editorrole within your tenant or project; for example, the defaulteditorsgroup. You can check this in the Administration → IAM section of the web console.
- Install and initialize the Nebius SDK for Python.
-
Make sure that you or the service account that you use is in a group that has at least the
editorrole within your tenant or project; for example, the defaulteditorsgroup. You can check this in the Administration → IAM section of the web console.
- Install and initialize the Nebius SDK for JavaScript.
-
Make sure that you or the service account that you use is in a group that has at least the
editorrole within your tenant or project; for example, the defaulteditorsgroup. You can check this in the Administration → IAM section of the web console.
How to make a version primary
- Web console
- CLI
- Go SDK
- Python SDK
- JavaScript SDK
- In the web console, go to
Cryptography → SecretStash.
- Open the page of the required secret.
- Go to the Versions tab.
- In the line of the version that you want to make primary, click
→ Make primary.
-
List all secrets:
In the output, copy the ID of the required secret.
nebius mysterybox secret list -
Save the ID to the environment variable:
export SECRET_ID=<secret_ID> -
List all versions of the secret:
In the output, find the version that you want to make primary and copy its ID.
nebius mysterybox secret-version list --parent-id $SECRET_ID -
Specify the version ID in the following command:
nebius mysterybox secret update $SECRET_ID --primary-version-id <version_ID>
-
List all secrets. The code requests the pages of results one by one, using the next page token from each response, until all secrets are returned:
In the output, copy the ID of the required secret.
secretsService := sdk.Services().Mysterybox().V1(). Secret() secretsPageToken := "" for { secrets, err := secretsService.List( ctx, &mb.ListSecretsRequest{ PageToken: secretsPageToken, }, ) if err != nil { return fmt.Errorf("get secrets: %w", err) } fmt.Println(secrets.GetItems()) secretsPageToken = secrets.GetNextPageToken() if secretsPageToken == "" { break } } -
List all versions of the secret:
In
versionsService := sdk.Services().Mysterybox().V1(). SecretVersion() versionsPageToken := "" for { versions, err := versionsService.List( ctx, &mb.ListSecretVersionsRequest{ ParentId: "<secret_ID>", PageToken: versionsPageToken, }, ) if err != nil { return fmt.Errorf("get versions: %w", err) } fmt.Println(versions.GetItems()) versionsPageToken = versions.GetNextPageToken() if versionsPageToken == "" { break } }ParentId, specify the ID that you copied earlier. In the output, find the version that you want to make primary and copy its ID. -
Make the version primary:
In the code, specify the following parameters:
updateService := sdk.Services().Mysterybox().V1().Secret() secret, err := updateService.Get( ctx, &mb.GetSecretRequest{Id: "<secret_ID>"}, ) if err != nil { return fmt.Errorf("get secret: %w", err) } primaryVersionID := "<version_ID>" secret.Spec.PrimaryVersionId = &primaryVersionID updateOperation, err := updateService.Update( ctx, &mb.UpdateSecretRequest{ Metadata: secret.Metadata, Spec: secret.Spec, }, ) if err != nil { return fmt.Errorf("update secret: %w", err) } updateOperation, err = updateOperation.Wait(ctx) if err != nil { return fmt.Errorf("wait for secret update: %w", err) } updatedSecret, err := updateService.Get( ctx, &mb.GetSecretRequest{Id: "<secret_ID>"}, ) if err != nil { return fmt.Errorf("get updated secret: %w", err) } fmt.Println(updatedSecret)Id: ID of the secret that you copied earlier.Spec.PrimaryVersionId: ID of the version that you want to make primary.
-
List all secrets. The code requests the pages of results one by one, using the next page token from each response, until all secrets are returned:
In the output, copy the ID of the required secret.
service = SecretServiceClient(sdk) page_token = "" while True: response = await service.list( ListSecretsRequest( page_token=page_token, ), ) print(response.items) page_token = response.next_page_token if not page_token: break -
List all versions of the secret:
In
service = SecretVersionServiceClient(sdk) page_token = "" while True: response = await service.list( ListSecretVersionsRequest( parent_id="<secret_ID>", page_token=page_token, ), ) print(response.items) page_token = response.next_page_token if not page_token: breakparent_id, specify the ID that you copied earlier. In the output, find the version that you want to make primary and copy its ID. -
Make the version primary:
In the code, specify the following parameters:
service = SecretServiceClient(sdk) secret = await service.get(GetSecretRequest(id="<secret_ID>")) secret.spec.primary_version_id = "<version_ID>" operation = await service.update( UpdateSecretRequest(metadata=secret.metadata, spec=secret.spec), ) await operation.wait() updated_secret = await service.get( GetSecretRequest(id="<secret_ID>"), ) print(updated_secret)id: ID of the secret that you copied earlier.spec.primary_version_id: ID of the version that you want to make primary.
-
List all secrets. The code requests the pages of results one by one, using the next page token from each response, until all secrets are returned:
In the output, copy the ID of the required secret.
const secretsService = new SecretService(sdk); let secretsPageToken = ""; do { const secrets = await secretsService.list( ListSecretsRequest.create({ pageToken: secretsPageToken, }), ).result; console.log(secrets.items); secretsPageToken = secrets.nextPageToken; } while (secretsPageToken); -
List all versions of the secret:
In
const versionsService = new SecretVersionService(sdk); let versionsPageToken = ""; do { const versions = await versionsService.list( ListSecretVersionsRequest.create({ parentId: "<secret_ID>", pageToken: versionsPageToken, }), ).result; console.log(versions.items); versionsPageToken = versions.nextPageToken; } while (versionsPageToken);parentId, specify the ID that you copied earlier. In the output, find the version that you want to make primary and copy its ID. -
Make the version primary:
In the code, specify the following parameters:
const updateService = new SecretService(sdk); const secret = await updateService.get( GetSecretRequest.create({ id: "<secret_ID>" }), ).result; if (!secret.spec) { throw new Error("The secret has no specification."); } secret.spec.primaryVersionId = "<version_ID>"; const updateOperation = await updateService.update( UpdateSecretRequest.create({ metadata: secret.metadata, spec: secret.spec, }), ).result; await updateOperation.wait(); const updatedSecret = await updateService.get( GetSecretRequest.create({ id: "<secret_ID>" }), ).result; console.log(updatedSecret);id: ID of the secret that you copied earlier.spec.primaryVersionId: ID of the version that you want to make primary.