Skip to content
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
108 changes: 107 additions & 1 deletion docs/cli/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -66828,6 +66828,13 @@
"type": "string",
"required": false,
"summary": "Contains a project ID. If specified, the result will be filtered to only those origin projects that are linked to the specified project ID in a cross-project search configuration."
},
{
"role": "flag",
"name": "tags",
"type": "string",
"required": false,
"summary": "If specified, the result will be filtered to only those projects that have the specified tags and corresponding values."
}
],
"summary": "Get Elasticsearch projects",
Expand All @@ -66844,6 +66851,20 @@
],
"name": "create",
"parameters": [
{
"role": "flag",
"name": "name",
"type": "string",
"required": true,
"summary": "Descriptive name for a project."
},
{
"role": "flag",
"name": "region-id",
"type": "string",
"required": true,
"summary": "Unique human-readable identifier for a region in Elastic Cloud."
},
{
"role": "flag",
"name": "wait",
Expand Down Expand Up @@ -67096,6 +67117,13 @@
"type": "string",
"required": false,
"summary": "Contains a project ID. If specified, the result will be filtered to only those origin projects that are linked to the specified project ID in a cross-project search configuration."
},
{
"role": "flag",
"name": "tags",
"type": "string",
"required": false,
"summary": "If specified, the result will be filtered to only those projects that have the specified tags and corresponding values."
}
],
"summary": "Get Observability projects",
Expand All @@ -67112,6 +67140,20 @@
],
"name": "create",
"parameters": [
{
"role": "flag",
"name": "name",
"type": "string",
"required": true,
"summary": "Descriptive name for a project."
},
{
"role": "flag",
"name": "region-id",
"type": "string",
"required": true,
"summary": "Unique human-readable identifier for a region in Elastic Cloud."
},
{
"role": "flag",
"name": "wait",
Expand Down Expand Up @@ -67364,6 +67406,13 @@
"type": "string",
"required": false,
"summary": "Contains a project ID. If specified, the result will be filtered to only those origin projects that are linked to the specified project ID in a cross-project search configuration."
},
{
"role": "flag",
"name": "tags",
"type": "string",
"required": false,
"summary": "If specified, the result will be filtered to only those projects that have the specified tags and corresponding values."
}
],
"summary": "Get Security projects",
Expand All @@ -67380,6 +67429,20 @@
],
"name": "create",
"parameters": [
{
"role": "flag",
"name": "name",
"type": "string",
"required": true,
"summary": "Descriptive name for a project."
},
{
"role": "flag",
"name": "region-id",
"type": "string",
"required": true,
"summary": "Unique human-readable identifier for a region in Elastic Cloud."
},
{
"role": "flag",
"name": "wait",
Expand Down Expand Up @@ -67662,6 +67725,13 @@
"type": "string",
"required": false,
"summary": "The project alias to filter the link candidates by."
},
{
"role": "flag",
"name": "tags",
"type": "string",
"required": false,
"summary": "If specified, the result will be filtered to only those projects that have the specified tags and corresponding values."
}
],
"summary": "Get Elasticsearch project link candidates",
Expand Down Expand Up @@ -67718,6 +67788,13 @@
"type": "string",
"required": false,
"summary": "The project alias to filter the link candidates by."
},
{
"role": "flag",
"name": "tags",
"type": "string",
"required": false,
"summary": "If specified, the result will be filtered to only those projects that have the specified tags and corresponding values."
}
],
"summary": "Get Observability project link candidates",
Expand Down Expand Up @@ -67774,6 +67851,13 @@
"type": "string",
"required": false,
"summary": "The project alias to filter the link candidates by."
},
{
"role": "flag",
"name": "tags",
"type": "string",
"required": false,
"summary": "If specified, the result will be filtered to only those projects that have the specified tags and corresponding values."
}
],
"summary": "Get Security project link candidates",
Expand Down Expand Up @@ -67927,7 +68011,29 @@
"traffic-filters"
],
"name": "create-traffic-filter",
"parameters": [],
"parameters": [
{
"role": "flag",
"name": "name",
"type": "string",
"required": true,
"summary": "Name of the traffic filter"
},
{
"role": "flag",
"name": "type",
"type": "string",
"required": true,
"summary": "Type of the traffic filter"
},
{
"role": "flag",
"name": "region",
"type": "string",
"required": true,
"summary": "The traffic filter can be attached only to projects in the specific region"
}
],
"summary": "Create a traffic filter",
"intent": {
"requiresAuth": true
Expand Down
6 changes: 6 additions & 0 deletions src/cloud/apis/elasticsearch-projects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
* and elastic/elastic-client-generator-js to regenerate this file again.
*/

import { z } from 'zod'
import type { CloudApiDefinition } from '../types.ts'

export const elasticsearchProjectsApis: CloudApiDefinition[] = [
Expand All @@ -21,6 +22,7 @@ export const elasticsearchProjectsApis: CloudApiDefinition[] = [
queryParams: [
{ name: "traffic_filter", type: "string", description: "Filters the returned list of projects. Only projects associated with the provided traffic_filter will be returned." },
{ name: "linked", type: "string", description: "Contains a project ID. If specified, the result will be filtered to only those origin projects that are linked to the specified project ID in a cross-project search configuration." },
{ name: "tags", type: "string", description: "If specified, the result will be filtered to only those projects that have the specified tags and corresponding values." },
],
},
{
Expand All @@ -29,6 +31,10 @@ export const elasticsearchProjectsApis: CloudApiDefinition[] = [
description: "Create an Elasticsearch project",
method: "POST",
path: "/api/v1/serverless/projects/elasticsearch",
body: z.object({
name: z.string().describe("Descriptive name for a project."),
region_id: z.string().describe("Unique human-readable identifier for a region in Elastic Cloud."),
}),
},
{
name: "get-elasticsearch-project",
Expand Down
3 changes: 3 additions & 0 deletions src/cloud/apis/linked-candidate-projects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export const linkedCandidateProjectsApis: CloudApiDefinition[] = [
{ name: "region", type: "string", description: "The region to filter the link candidate projects by." },
{ name: "name", type: "string", description: "The project name to filter the link candidates by." },
{ name: "alias", type: "string", description: "The project alias to filter the link candidates by." },
{ name: "tags", type: "string", description: "If specified, the result will be filtered to only those projects that have the specified tags and corresponding values." },
],
},
{
Expand All @@ -44,6 +45,7 @@ export const linkedCandidateProjectsApis: CloudApiDefinition[] = [
{ name: "region", type: "string", description: "The region to filter the link candidate projects by." },
{ name: "name", type: "string", description: "The project name to filter the link candidates by." },
{ name: "alias", type: "string", description: "The project alias to filter the link candidates by." },
{ name: "tags", type: "string", description: "If specified, the result will be filtered to only those projects that have the specified tags and corresponding values." },
],
},
{
Expand All @@ -61,6 +63,7 @@ export const linkedCandidateProjectsApis: CloudApiDefinition[] = [
{ name: "region", type: "string", description: "The region to filter the link candidate projects by." },
{ name: "name", type: "string", description: "The project name to filter the link candidates by." },
{ name: "alias", type: "string", description: "The project alias to filter the link candidates by." },
{ name: "tags", type: "string", description: "If specified, the result will be filtered to only those projects that have the specified tags and corresponding values." },
],
},
]
6 changes: 6 additions & 0 deletions src/cloud/apis/observability-projects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
* and elastic/elastic-client-generator-js to regenerate this file again.
*/

import { z } from 'zod'
import type { CloudApiDefinition } from '../types.ts'

export const observabilityProjectsApis: CloudApiDefinition[] = [
Expand All @@ -21,6 +22,7 @@ export const observabilityProjectsApis: CloudApiDefinition[] = [
queryParams: [
{ name: "traffic_filter", type: "string", description: "traffic filters associated with this project" },
{ name: "linked", type: "string", description: "Contains a project ID. If specified, the result will be filtered to only those origin projects that are linked to the specified project ID in a cross-project search configuration." },
{ name: "tags", type: "string", description: "If specified, the result will be filtered to only those projects that have the specified tags and corresponding values." },
],
},
{
Expand All @@ -29,6 +31,10 @@ export const observabilityProjectsApis: CloudApiDefinition[] = [
description: "Create an observability project",
method: "POST",
path: "/api/v1/serverless/projects/observability",
body: z.object({
name: z.string().describe("Descriptive name for a project."),
region_id: z.string().describe("Unique human-readable identifier for a region in Elastic Cloud."),
}),
},
{
name: "get-observability-project",
Expand Down
6 changes: 6 additions & 0 deletions src/cloud/apis/security-projects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
* and elastic/elastic-client-generator-js to regenerate this file again.
*/

import { z } from 'zod'
import type { CloudApiDefinition } from '../types.ts'

export const securityProjectsApis: CloudApiDefinition[] = [
Expand All @@ -21,6 +22,7 @@ export const securityProjectsApis: CloudApiDefinition[] = [
queryParams: [
{ name: "traffic_filter", type: "string", description: "traffic filters associated with this project" },
{ name: "linked", type: "string", description: "Contains a project ID. If specified, the result will be filtered to only those origin projects that are linked to the specified project ID in a cross-project search configuration." },
{ name: "tags", type: "string", description: "If specified, the result will be filtered to only those projects that have the specified tags and corresponding values." },
],
},
{
Expand All @@ -29,6 +31,10 @@ export const securityProjectsApis: CloudApiDefinition[] = [
description: "Create a security project",
method: "POST",
path: "/api/v1/serverless/projects/security",
body: z.object({
name: z.string().describe("Descriptive name for a project."),
region_id: z.string().describe("Unique human-readable identifier for a region in Elastic Cloud."),
}),
},
{
name: "get-security-project",
Expand Down
6 changes: 6 additions & 0 deletions src/cloud/apis/traffic-filters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
* and elastic/elastic-client-generator-js to regenerate this file again.
*/

import { z } from 'zod'
import type { CloudApiDefinition } from '../types.ts'

export const trafficFiltersApis: CloudApiDefinition[] = [
Expand All @@ -29,6 +30,11 @@ export const trafficFiltersApis: CloudApiDefinition[] = [
description: "Create a traffic filter",
method: "POST",
path: "/api/v1/serverless/traffic-filters",
body: z.object({
name: z.string().describe("Name of the traffic filter"),
type: z.string().describe("Type of the traffic filter"),
region: z.string().describe("The traffic filter can be attached only to projects in the specific region"),
}),
},
{
name: "get-traffic-filter-metadata",
Expand Down
3 changes: 0 additions & 3 deletions src/config/profiles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,6 @@ export function resolveBuiltinProfile (name: BuiltInProfile): { allowed: readonl
'kb',

// All stack commands (Elasticsearch + Kibana)
// Individual serverless-incompatible ES endpoints will be filtered in a
// future iteration once per-command availability metadata is added to the
// API manifest (see issue #283 for tracking).
'stack.*',

// Cloud cross-cutting namespaces (apply to both Hosted and Serverless)
Expand Down
16 changes: 16 additions & 0 deletions test/cloud/register.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import { describe, it } from 'node:test'
import assert from 'node:assert/strict'
import { z } from 'zod'
import { registerCloudCommands, simplifyProjectCommandName } from '../../src/cloud/register.ts'
import type { CloudApiDefinition } from '../../src/cloud/types.ts'

Expand Down Expand Up @@ -219,6 +220,21 @@ describe('registerCloudCommands', () => {
assert.deepEqual(regions.commands.map((c) => c.name()), ['list-regions', 'get-region'])
})

it('exposes --name and --region-id flags on create project commands', () => {
const defs: CloudApiDefinition[] = [
{ name: 'create-elasticsearch-project', namespace: 'elasticsearch-projects', description: 'Create', method: 'POST', path: '/api/v1/serverless/projects/elasticsearch',
body: z.object({ name: z.string(), region_id: z.string() }) },
]
const group = registerCloudCommands(defs)
const createCmd = group.commands.find((c) => c.name() === 'serverless')!
.commands.find((c) => c.name() === 'projects')!
.commands.find((c) => c.name() === 'search')!
.commands.find((c) => c.name() === 'create')!
const flags = createCmd.options.map((o) => o.long)
assert.ok(flags.includes('--name'), '--name flag should be registered')
assert.ok(flags.includes('--region-id'), '--region-id flag should be registered')
})

it('adds --wait flag to create project commands only', () => {
const defs: CloudApiDefinition[] = [
{ name: 'create-elasticsearch-project', namespace: 'elasticsearch-projects', description: 'Create', method: 'POST', path: '/api/v1/serverless/projects/elasticsearch' },
Expand Down