diff --git a/packages/app/src/components/catalog/ChoreoCatalogFilters.tsx b/packages/app/src/components/catalog/ChoreoCatalogFilters.tsx index 5ad62b56..12fa9c82 100644 --- a/packages/app/src/components/catalog/ChoreoCatalogFilters.tsx +++ b/packages/app/src/components/catalog/ChoreoCatalogFilters.tsx @@ -25,7 +25,7 @@ export type ChoreoCatalogFiltersProps = { /** * Choreo Catalog Filters with Choreo entity kind names - * - Domain is displayed as "Organization" + * - Domain is displayed as "Namespace" * - System is displayed as "Project" * * @public diff --git a/packages/app/src/components/catalog/ChoreoCatalogTableColumns.tsx b/packages/app/src/components/catalog/ChoreoCatalogTableColumns.tsx index 2da48a09..46ef6ea9 100644 --- a/packages/app/src/components/catalog/ChoreoCatalogTableColumns.tsx +++ b/packages/app/src/components/catalog/ChoreoCatalogTableColumns.tsx @@ -37,7 +37,7 @@ function createProjectColumn(): TableColumn { /** * Custom catalog table columns function with Choreo naming: * - System → Project - * - Domain → Organization (handled by entity kind picker) + * - Domain → Namespace (handled by entity kind picker) */ export const choreoCatalogTableColumns: CatalogTableColumnsFunc = entityListContext => { diff --git a/packages/app/src/components/catalog/ChoreoEntityKindPicker.tsx b/packages/app/src/components/catalog/ChoreoEntityKindPicker.tsx index 00f9e028..9fc406b6 100644 --- a/packages/app/src/components/catalog/ChoreoEntityKindPicker.tsx +++ b/packages/app/src/components/catalog/ChoreoEntityKindPicker.tsx @@ -11,7 +11,7 @@ import { useUserGroups } from '../../hooks'; // Mapping of internal kind names to Choreo entity kind names const kindDisplayNames: Record = { - domain: 'Domain (Organization)', + domain: 'Domain (Namespace)', system: 'System (Project)', component: 'Component', api: 'API', @@ -25,7 +25,7 @@ const kindDisplayNames: Record = { }; // Custom order for displaying entity kinds in the dropdown -// Organization first, then Project, then Component, then others alphabetically +// Namespace first, then Project, then Component, then others alphabetically const kindDisplayOrder: string[] = [ 'domain', 'system', diff --git a/packages/app/src/scaffolder/BuildTemplateParameters/BuildTemplateParametersExtension.tsx b/packages/app/src/scaffolder/BuildTemplateParameters/BuildTemplateParametersExtension.tsx index 410e898b..eb7117f6 100644 --- a/packages/app/src/scaffolder/BuildTemplateParameters/BuildTemplateParametersExtension.tsx +++ b/packages/app/src/scaffolder/BuildTemplateParameters/BuildTemplateParametersExtension.tsx @@ -60,26 +60,26 @@ export const BuildTemplateParameters = ({ const discoveryApi = useApi(discoveryApiRef); const fetchApi = useApi(fetchApiRef); - // Get the selected build template and organization from form context + // Get the selected build template and namespace from form context const selectedTemplateName = formContext?.formData?.build_template_name; - const organizationName = formContext?.formData?.organization_name; + const namespaceName = formContext?.formData?.namespace_name; - // Fetch build templates when organization changes + // Fetch build templates when namespace changes useEffect(() => { let ignore = false; const fetchBuildTemplates = async () => { - if (!organizationName) { + if (!namespaceName) { setBuildTemplates([]); return; } - // Extract the actual organization name from the entity reference format - const extractOrgName = (fullOrgName: string): string => { - const parts = fullOrgName.split('/'); + // Extract the actual namespace name from the entity reference format + const extractNsName = (fullNsName: string): string => { + const parts = fullNsName.split('/'); return parts[parts.length - 1]; }; - const orgName = extractOrgName(organizationName); + const nsName = extractNsName(namespaceName); setLoading(true); @@ -87,8 +87,8 @@ export const BuildTemplateParameters = ({ const baseUrl = await discoveryApi.getBaseUrl('openchoreo'); // Use fetchApi which automatically injects Backstage + IDP tokens const response = await fetchApi.fetch( - `${baseUrl}/build-templates?organizationName=${encodeURIComponent( - orgName, + `${baseUrl}/build-templates?namespaceName=${encodeURIComponent( + nsName, )}`, ); @@ -109,7 +109,7 @@ export const BuildTemplateParameters = ({ return () => { ignore = true; }; - }, [organizationName, discoveryApi, fetchApi]); + }, [namespaceName, discoveryApi, fetchApi]); // Update parameters when template selection or templates change useEffect(() => { diff --git a/packages/app/src/scaffolder/BuildTemplatePicker/BuildTemplatePickerExtension.tsx b/packages/app/src/scaffolder/BuildTemplatePicker/BuildTemplatePickerExtension.tsx index fa5a3a7e..062a8565 100644 --- a/packages/app/src/scaffolder/BuildTemplatePicker/BuildTemplatePickerExtension.tsx +++ b/packages/app/src/scaffolder/BuildTemplatePicker/BuildTemplatePickerExtension.tsx @@ -47,29 +47,29 @@ export const BuildTemplatePicker = ({ const discoveryApi = useApi(discoveryApiRef); const fetchApi = useApi(fetchApiRef); - // Get the organization name from form context - const organizationName = formContext.formData?.organization_name; + // Get the namespace name from form context + const namespaceName = formContext.formData?.namespace_name; useEffect(() => { let ignore = false; const fetchBuildTemplates = async () => { - if (!organizationName) { + if (!namespaceName) { setBuildTemplates([]); - // Clear templates from form context when no organization + // Clear templates from form context when no namespace if (formContext.buildTemplates) { delete formContext.buildTemplates; } return; } - // Extract the actual organization name from the entity reference format - // e.g., "domain:default/my-org" -> "my-org" - const extractOrgName = (fullOrgName: string): string => { - const parts = fullOrgName.split('/'); + // Extract the actual namespace name from the entity reference format + // e.g., "domain:default/my-namespace" -> "my-namespace" + const extractNsName = (fullNsName: string): string => { + const parts = fullNsName.split('/'); return parts[parts.length - 1]; }; - const orgName = extractOrgName(organizationName); + const nsName = extractNsName(namespaceName); setLoading(true); setError(null); @@ -78,8 +78,8 @@ export const BuildTemplatePicker = ({ const baseUrl = await discoveryApi.getBaseUrl('openchoreo'); // Use fetchApi which automatically injects Backstage + IDP tokens const response = await fetchApi.fetch( - `${baseUrl}/build-templates?organizationName=${encodeURIComponent( - orgName, + `${baseUrl}/build-templates?namespaceName=${encodeURIComponent( + nsName, )}`, ); @@ -108,7 +108,7 @@ export const BuildTemplatePicker = ({ return () => { ignore = true; }; - }, [organizationName, discoveryApi, formContext, fetchApi]); + }, [namespaceName, discoveryApi, formContext, fetchApi]); const handleChange = (event: ChangeEvent<{ value: unknown }>) => { onChange(event.target.value as string); @@ -132,7 +132,7 @@ export const BuildTemplatePicker = ({ labelId={`${idSchema?.$id}-label`} value={formData || ''} onChange={handleChange} - disabled={loading || !organizationName} + disabled={loading || !namespaceName} > {loading && ( @@ -142,9 +142,9 @@ export const BuildTemplatePicker = ({ )} {!loading && buildTemplates.length === 0 && !error && ( - {organizationName + {namespaceName ? 'No build templates available' - : 'Select an organization first'} + : 'Select a namespace first'} )} {!loading && diff --git a/packages/app/src/scaffolder/BuildWorkflowParameters/BuildWorkflowParametersExtension.tsx b/packages/app/src/scaffolder/BuildWorkflowParameters/BuildWorkflowParametersExtension.tsx index 3c40eb65..c5b0afaa 100644 --- a/packages/app/src/scaffolder/BuildWorkflowParameters/BuildWorkflowParametersExtension.tsx +++ b/packages/app/src/scaffolder/BuildWorkflowParameters/BuildWorkflowParametersExtension.tsx @@ -53,10 +53,10 @@ export const BuildWorkflowParameters = ({ const discoveryApi = useApi(discoveryApiRef); const fetchApi = useApi(fetchApiRef); - // Get the selected workflow and organization from form data + // Get the selected workflow and namespace from form data // The workflow_name is a sibling field in the same section const selectedWorkflowName = formContext?.formData?.workflow_name; - const organizationName = formContext?.formData?.organization_name; + const namespaceName = formContext?.formData?.namespace_name; // Increment resetKey only when workflow actually changes // This forces Form remount only on workflow change, not on every render @@ -75,19 +75,19 @@ export const BuildWorkflowParameters = ({ let ignore = false; const fetchWorkflowSchema = async () => { - if (!selectedWorkflowName || !organizationName) { + if (!selectedWorkflowName || !namespaceName) { setWorkflowSchema(null); setError(null); return; } - // Extract the actual organization name from the entity reference format - const extractOrgName = (fullOrgName: string): string => { - const parts = fullOrgName.split('/'); + // Extract the actual namespace name from the entity reference format + const extractNsName = (fullNsName: string): string => { + const parts = fullNsName.split('/'); return parts[parts.length - 1]; }; - const orgName = extractOrgName(organizationName); + const nsName = extractNsName(namespaceName); setLoading(true); setError(null); @@ -96,8 +96,8 @@ export const BuildWorkflowParameters = ({ const baseUrl = await discoveryApi.getBaseUrl('openchoreo-ci-backend'); // Use fetchApi which automatically injects Backstage + IDP tokens const response = await fetchApi.fetch( - `${baseUrl}/workflow-schema?organizationName=${encodeURIComponent( - orgName, + `${baseUrl}/workflow-schema?namespaceName=${encodeURIComponent( + nsName, )}&workflowName=${encodeURIComponent(selectedWorkflowName)}`, ); @@ -154,7 +154,7 @@ export const BuildWorkflowParameters = ({ return () => { ignore = true; }; - }, [selectedWorkflowName, organizationName, discoveryApi, fetchApi]); + }, [selectedWorkflowName, namespaceName, discoveryApi, fetchApi]); // Sync schema to formData when workflow changes (not just when schema loads) useEffect(() => { diff --git a/packages/app/src/scaffolder/BuildWorkflowPicker/BuildWorkflowPickerExtension.tsx b/packages/app/src/scaffolder/BuildWorkflowPicker/BuildWorkflowPickerExtension.tsx index 6d180825..e1a45493 100644 --- a/packages/app/src/scaffolder/BuildWorkflowPicker/BuildWorkflowPickerExtension.tsx +++ b/packages/app/src/scaffolder/BuildWorkflowPicker/BuildWorkflowPickerExtension.tsx @@ -46,11 +46,11 @@ export const BuildWorkflowPicker = ({ const discoveryApi = useApi(discoveryApiRef); const fetchApi = useApi(fetchApiRef); - // Get workflows from enum (if provided) or organizationName from ui:options + // Get workflows from enum (if provided) or namespaceName from ui:options const enumWorkflows = (schema.enum as string[]) || null; - const organizationName = - typeof uiSchema?.['ui:options']?.organizationName === 'string' - ? uiSchema['ui:options'].organizationName + const namespaceName = + typeof uiSchema?.['ui:options']?.namespaceName === 'string' + ? uiSchema['ui:options'].namespaceName : ''; // Fetch workflows from API if enum is not provided @@ -65,8 +65,8 @@ export const BuildWorkflowPicker = ({ } // Otherwise, fetch from API - if (!organizationName) { - setError('Organization name is required to fetch workflows'); + if (!namespaceName) { + setError('Namespace name is required to fetch workflows'); return; } @@ -76,19 +76,17 @@ export const BuildWorkflowPicker = ({ try { const baseUrl = await discoveryApi.getBaseUrl('openchoreo-ci-backend'); - // Extract organization name if it's in entity reference format - const extractOrgName = (fullOrgName: string): string => { - const parts = fullOrgName.split('/'); + // Extract namespace name if it's in entity reference format + const extractNsName = (fullNsName: string): string => { + const parts = fullNsName.split('/'); return parts[parts.length - 1]; }; - const orgName = extractOrgName(organizationName); + const nsName = extractNsName(namespaceName); // Use fetchApi which automatically injects Backstage + IDP tokens const response = await fetchApi.fetch( - `${baseUrl}/workflows?organizationName=${encodeURIComponent( - orgName, - )}`, + `${baseUrl}/workflows?namespaceName=${encodeURIComponent(nsName)}`, ); if (!response.ok) { @@ -117,7 +115,7 @@ export const BuildWorkflowPicker = ({ return () => { ignore = true; }; - }, [organizationName, enumWorkflows, discoveryApi, fetchApi]); + }, [namespaceName, enumWorkflows, discoveryApi, fetchApi]); const handleChange = (event: ChangeEvent<{ value: unknown }>) => { const selectedWorkflow = event.target.value as string; diff --git a/packages/app/src/scaffolder/ComponentNamePicker/ComponentNamePickerExtension.tsx b/packages/app/src/scaffolder/ComponentNamePicker/ComponentNamePickerExtension.tsx index f9339a52..c7205e4c 100644 --- a/packages/app/src/scaffolder/ComponentNamePicker/ComponentNamePickerExtension.tsx +++ b/packages/app/src/scaffolder/ComponentNamePicker/ComponentNamePickerExtension.tsx @@ -45,13 +45,13 @@ export const ComponentNamePicker = ({ const [touched, setTouched] = useState(false); const catalogApi = useApi(catalogApiRef); - // Get the organization name from form context - const organizationName = formContext.formData?.organization_name; + // Get the namespace name from form context + const namespaceName = formContext.formData?.namespace_name; - // Extract organization name from entity reference format - const extractOrgName = useCallback((fullOrgName: string): string => { - if (!fullOrgName) return ''; - const parts = fullOrgName.split('/'); + // Extract namespace name from entity reference format + const extractNsName = useCallback((fullNsName: string): string => { + if (!fullNsName) return ''; + const parts = fullNsName.split('/'); return parts[parts.length - 1]; }, []); @@ -82,10 +82,10 @@ export const ComponentNamePicker = ({ return null; }, []); - // Check if component already exists in the organization + // Check if component already exists in the namespace const checkComponentExists = useCallback( - async (componentName: string, orgName: string): Promise => { - if (!componentName || !orgName) { + async (componentName: string, nsName: string): Promise => { + if (!componentName || !nsName) { return false; } @@ -97,12 +97,11 @@ export const ComponentNamePicker = ({ }, }); - // Filter components by organization annotation and check if name exists + // Filter components by namespace annotation and check if name exists const existsInOrg = items.some( component => - component.metadata.annotations?.[ - CHOREO_ANNOTATIONS.ORGANIZATION - ] === orgName && component.metadata.name === componentName, + component.metadata.annotations?.[CHOREO_ANNOTATIONS.NAMESPACE] === + nsName && component.metadata.name === componentName, ); return existsInOrg; @@ -126,13 +125,13 @@ export const ComponentNamePicker = ({ return; } - if (!componentName || !organizationName) { + if (!componentName || !namespaceName) { setValidationState({ error: null, isValidating: false }); return; } - const orgName = extractOrgName(organizationName); - if (!orgName) { + const nsName = extractNsName(namespaceName); + if (!nsName) { setValidationState({ error: null, isValidating: false }); return; } @@ -141,11 +140,11 @@ export const ComponentNamePicker = ({ setValidationState({ error: null, isValidating: true }); // Check if component exists - const exists = await checkComponentExists(componentName, orgName); + const exists = await checkComponentExists(componentName, nsName); if (exists) { setValidationState({ - error: `A component named "${componentName}" already exists in organization "${orgName}"`, + error: `A component named "${componentName}" already exists in namespace "${nsName}"`, isValidating: false, }); } else { @@ -159,10 +158,10 @@ export const ComponentNamePicker = ({ return () => clearTimeout(timeoutId); }, [ formData, - organizationName, + namespaceName, validateFormat, checkComponentExists, - extractOrgName, + extractNsName, ]); const handleChange = (event: ChangeEvent) => { diff --git a/packages/app/src/scaffolder/TraitsField/NoTraitsAvailableMessage.tsx b/packages/app/src/scaffolder/TraitsField/NoTraitsAvailableMessage.tsx index 8e1a3af9..5956f3c8 100644 --- a/packages/app/src/scaffolder/TraitsField/NoTraitsAvailableMessage.tsx +++ b/packages/app/src/scaffolder/TraitsField/NoTraitsAvailableMessage.tsx @@ -24,7 +24,7 @@ export const NoTraitsAvailableMessage = () => { - No Traits Available for This Organization + No Traits Available for This Namespace Traits are cross-cutting capabilities that extend components without diff --git a/packages/app/src/scaffolder/TraitsField/TraitsFieldExtension.tsx b/packages/app/src/scaffolder/TraitsField/TraitsFieldExtension.tsx index f608e62e..bc79a6ce 100644 --- a/packages/app/src/scaffolder/TraitsField/TraitsFieldExtension.tsx +++ b/packages/app/src/scaffolder/TraitsField/TraitsFieldExtension.tsx @@ -79,10 +79,10 @@ export const TraitsField = ({ const discoveryApi = useApi(discoveryApiRef); const fetchApi = useApi(fetchApiRef); - // Get organization name from ui:options - const organizationName = - typeof uiSchema?.['ui:options']?.organizationName === 'string' - ? uiSchema['ui:options'].organizationName + // Get namespace name from ui:options + const namespaceName = + typeof uiSchema?.['ui:options']?.namespaceName === 'string' + ? uiSchema['ui:options'].namespaceName : ''; // Fetch available traits on mount @@ -90,7 +90,7 @@ export const TraitsField = ({ let ignore = false; const fetchTraits = async () => { - if (!organizationName) { + if (!namespaceName) { return; } @@ -100,18 +100,18 @@ export const TraitsField = ({ try { const baseUrl = await discoveryApi.getBaseUrl('openchoreo'); - // Extract organization name if it's in entity reference format - const extractOrgName = (fullOrgName: string): string => { - const parts = fullOrgName.split('/'); + // Extract namespace name if it's in entity reference format + const extractNsName = (fullNsName: string): string => { + const parts = fullNsName.split('/'); return parts[parts.length - 1]; }; - const orgName = extractOrgName(organizationName); + const nsName = extractNsName(namespaceName); // Use fetchApi which automatically injects Backstage + IDP tokens const response = await fetchApi.fetch( - `${baseUrl}/traits?organizationName=${encodeURIComponent( - orgName, + `${baseUrl}/traits?namespaceName=${encodeURIComponent( + nsName, )}&page=1&pageSize=100`, ); @@ -140,11 +140,11 @@ export const TraitsField = ({ return () => { ignore = true; }; - }, [organizationName, discoveryApi, fetchApi]); + }, [namespaceName, discoveryApi, fetchApi]); // Fetch schema for selected trait and add it const handleAddTrait = async () => { - if (!selectedTrait || !organizationName) { + if (!selectedTrait || !namespaceName) { return; } @@ -154,18 +154,18 @@ export const TraitsField = ({ try { const baseUrl = await discoveryApi.getBaseUrl('openchoreo'); - // Extract organization name - const extractOrgName = (fullOrgName: string): string => { - const parts = fullOrgName.split('/'); + // Extract namespace name + const extractNsName = (fullNsName: string): string => { + const parts = fullNsName.split('/'); return parts[parts.length - 1]; }; - const orgName = extractOrgName(organizationName); + const nsName = extractNsName(namespaceName); // Use fetchApi which automatically injects Backstage + IDP tokens const response = await fetchApi.fetch( - `${baseUrl}/trait-schema?organizationName=${encodeURIComponent( - orgName, + `${baseUrl}/trait-schema?namespaceName=${encodeURIComponent( + nsName, )}&traitName=${encodeURIComponent(selectedTrait)}`, ); @@ -235,7 +235,7 @@ export const TraitsField = ({ )} {/* No Traits Available - Prominent Message */} - {!loadingTraits && availableTraits.length === 0 && organizationName && ( + {!loadingTraits && availableTraits.length === 0 && namespaceName && ( )} @@ -262,9 +262,9 @@ export const TraitsField = ({ )} {!loadingTraits && availableTraits.length === 0 && ( - {organizationName + {namespaceName ? 'No traits available' - : 'Select an organization first'} + : 'Select a namespace first'} )} {!loadingTraits && diff --git a/packages/openchoreo-client-node/openapi/openchoreo-api.yaml b/packages/openchoreo-client-node/openapi/openchoreo-api.yaml index 9254c41f..d139a6a4 100644 --- a/packages/openchoreo-client-node/openapi/openchoreo-api.yaml +++ b/packages/openchoreo-client-node/openapi/openchoreo-api.yaml @@ -1,7 +1,7 @@ openapi: 3.0.3 info: title: OpenChoreo API - description: OpenChoreo platform API for managing organizations, projects, components, builds, and deployments + description: OpenChoreo platform API for managing namespaces, projects, components, builds, and deployments version: 1.0.0 license: name: Apache 2.0 @@ -138,8 +138,8 @@ components: version: type: string - # Organization - OrganizationResponse: + # Namespace + NamespaceResponse: type: object required: - name @@ -151,8 +151,6 @@ components: type: string description: type: string - namespace: - type: string createdAt: type: string format: date-time @@ -165,14 +163,14 @@ components: required: - uid - name - - orgName + - namespaceName - createdAt properties: uid: - type: string # TODO: Make this required with v0.5.0. + type: string name: type: string - orgName: + namespaceName: type: string displayName: type: string @@ -205,7 +203,7 @@ components: type: object required: - name - - orgName + - namespaceName - createdAt properties: name: @@ -214,7 +212,7 @@ components: type: string description: type: string - orgName: + namespaceName: type: string createdAt: type: string @@ -259,11 +257,11 @@ components: - name - type - projectName - - orgName + - namespaceName - createdAt properties: uid: - type: string # TODO: Make this required with v0.5.0. + type: string name: type: string displayName: @@ -274,11 +272,15 @@ components: type: string projectName: type: string - orgName: + namespaceName: type: string createdAt: type: string format: date-time + deletionTimestamp: + type: string + format: date-time + nullable: true status: type: string autoDeploy: @@ -429,11 +431,11 @@ components: - name - namespace - publicVirtualHost - - organizationVirtualHost + - namespaceVirtualHost - publicHTTPPort - publicHTTPSPort - - organizationHTTPPort - - organizationHTTPSPort + - namespaceHTTPPort + - namespaceHTTPSPort - createdAt properties: name: @@ -452,7 +454,7 @@ components: type: string publicVirtualHost: type: string - organizationVirtualHost: + namespaceVirtualHost: type: string publicHTTPPort: type: integer @@ -460,10 +462,10 @@ components: publicHTTPSPort: type: integer format: int32 - organizationHTTPPort: + namespaceHTTPPort: type: integer format: int32 - organizationHTTPSPort: + namespaceHTTPSPort: type: integer format: int32 observabilityPlaneRef: @@ -549,7 +551,7 @@ components: - uuid - componentName - projectName - - orgName + - namespaceName - createdAt properties: name: @@ -560,7 +562,7 @@ components: type: string projectName: type: string - orgName: + namespaceName: type: string commit: type: string @@ -648,7 +650,7 @@ components: - uuid - componentName - projectName - - orgName + - namespaceName - createdAt properties: name: @@ -659,7 +661,7 @@ components: type: string projectName: type: string - orgName: + namespaceName: type: string commit: type: string @@ -745,7 +747,7 @@ components: - type - componentName - projectName - - orgName + - namespaceName - environment - status properties: @@ -757,7 +759,7 @@ components: type: string projectName: type: string - orgName: + namespaceName: type: string environment: type: string @@ -833,7 +835,7 @@ components: type: string project: $ref: '#/components/schemas/ExposedEndpoint' - organization: + namespace: $ref: '#/components/schemas/ExposedEndpoint' public: $ref: '#/components/schemas/ExposedEndpoint' @@ -950,7 +952,7 @@ components: - name - componentName - projectName - - orgName + - namespaceName - createdAt properties: name: @@ -959,7 +961,7 @@ components: type: string projectName: type: string - orgName: + namespaceName: type: string createdAt: type: string @@ -980,7 +982,7 @@ components: - name - componentName - projectName - - orgName + - namespaceName - environment - releaseName - createdAt @@ -991,7 +993,7 @@ components: type: string projectName: type: string - orgName: + namespaceName: type: string environment: type: string @@ -1633,6 +1635,52 @@ components: type: string format: date-time + # Webhook + WebhookEventResponse: + type: object + required: + - success + - message + - triggeredBuilds + properties: + success: + type: boolean + message: + type: string + affectedComponents: + type: array + items: + type: string + triggeredBuilds: + type: integer + + # Version + VersionResponse: + type: object + required: + - name + - version + - gitRevision + - buildTime + - goOS + - goArch + - goVersion + properties: + name: + type: string + version: + type: string + gitRevision: + type: string + buildTime: + type: string + goOS: + type: string + goArch: + type: string + goVersion: + type: string + security: - BearerAuth: [] @@ -1668,6 +1716,104 @@ paths: schema: type: string + # Version endpoint + /version: + get: + summary: Get server version information + operationId: getVersion + tags: + - Health + security: [] + responses: + '200': + description: Server version information + content: + application/json: + schema: + $ref: '#/components/schemas/VersionResponse' + + # Webhook endpoints (public - called by Git providers) + /webhooks/github: + post: + summary: Handle GitHub webhook events + operationId: handleGitHubWebhook + tags: + - Webhooks + security: [] + requestBody: + required: true + content: + application/json: + schema: + type: object + additionalProperties: true + responses: + '200': + description: Webhook processed successfully + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/APIResponse' + - type: object + properties: + data: + $ref: '#/components/schemas/WebhookEventResponse' + + /webhooks/gitlab: + post: + summary: Handle GitLab webhook events + operationId: handleGitLabWebhook + tags: + - Webhooks + security: [] + requestBody: + required: true + content: + application/json: + schema: + type: object + additionalProperties: true + responses: + '200': + description: Webhook processed successfully + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/APIResponse' + - type: object + properties: + data: + $ref: '#/components/schemas/WebhookEventResponse' + + /webhooks/bitbucket: + post: + summary: Handle Bitbucket webhook events + operationId: handleBitbucketWebhook + tags: + - Webhooks + security: [] + requestBody: + required: true + content: + application/json: + schema: + type: object + additionalProperties: true + responses: + '200': + description: Webhook processed successfully + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/APIResponse' + - type: object + properties: + data: + $ref: '#/components/schemas/WebhookEventResponse' + # Apply/Delete operations (kubectl-like) /apply: post: @@ -1719,13 +1865,13 @@ paths: schema: $ref: '#/components/schemas/APIResponse' - # Organizations - /orgs: + # Namespaces + /namespaces: get: - summary: List all organizations - operationId: listOrganizations + summary: List all namespaces + operationId: listNamespaces tags: - - Organizations + - Namespaces responses: '200': description: Successful response @@ -1744,16 +1890,16 @@ paths: items: type: array items: - $ref: '#/components/schemas/OrganizationResponse' + $ref: '#/components/schemas/NamespaceResponse' - /orgs/{orgName}: + /namespaces/{namespaceName}: get: - summary: Get a specific organization - operationId: getOrganization + summary: Get a specific namespace + operationId: getNamespace tags: - - Organizations + - Namespaces parameters: - - name: orgName + - name: namespaceName in: path required: true schema: @@ -1769,16 +1915,18 @@ paths: - type: object properties: data: - $ref: '#/components/schemas/OrganizationResponse' + $ref: '#/components/schemas/NamespaceResponse' + '404': + description: Namespace not found - /orgs/{orgName}/secret-references: + /namespaces/{namespaceName}/secret-references: get: - summary: List secret references for an organization + summary: List secret references for a namespace operationId: listSecretReferences tags: - - Organizations + - Namespaces parameters: - - name: orgName + - name: namespaceName in: path required: true schema: @@ -1803,17 +1951,17 @@ paths: items: $ref: '#/components/schemas/SecretReferenceResponse' '404': - description: Organization not found + description: Namespace not found # DataPlanes - /orgs/{orgName}/dataplanes: + /namespaces/{namespaceName}/dataplanes: get: summary: List all data planes operationId: listDataPlanes tags: - DataPlanes parameters: - - name: orgName + - name: namespaceName in: path required: true schema: @@ -1844,7 +1992,7 @@ paths: tags: - DataPlanes parameters: - - name: orgName + - name: namespaceName in: path required: true schema: @@ -1868,14 +2016,14 @@ paths: data: $ref: '#/components/schemas/DataPlaneResponse' - /orgs/{orgName}/dataplanes/{dpName}: + /namespaces/{namespaceName}/dataplanes/{dpName}: get: summary: Get a specific data plane operationId: getDataPlane tags: - DataPlanes parameters: - - name: orgName + - name: namespaceName in: path required: true schema: @@ -1899,14 +2047,14 @@ paths: $ref: '#/components/schemas/DataPlaneResponse' # Environments - /orgs/{orgName}/environments: + /namespaces/{namespaceName}/environments: get: summary: List all environments operationId: listEnvironments tags: - Environments parameters: - - name: orgName + - name: namespaceName in: path required: true schema: @@ -1937,7 +2085,7 @@ paths: tags: - Environments parameters: - - name: orgName + - name: namespaceName in: path required: true schema: @@ -1961,14 +2109,14 @@ paths: data: $ref: '#/components/schemas/EnvironmentResponse' - /orgs/{orgName}/environments/{envName}: + /namespaces/{namespaceName}/environments/{envName}: get: summary: Get a specific environment operationId: getEnvironment tags: - Environments parameters: - - name: orgName + - name: namespaceName in: path required: true schema: @@ -1991,14 +2139,14 @@ paths: data: $ref: '#/components/schemas/EnvironmentResponse' - /orgs/{orgName}/environments/{envName}/observer-url: + /namespaces/{namespaceName}/environments/{envName}/observer-url: get: summary: Get environment observer URL operationId: getEnvironmentObserverURL tags: - Observability parameters: - - name: orgName + - name: namespaceName in: path required: true schema: @@ -2024,14 +2172,14 @@ paths: description: Environment or DataPlane not found # BuildPlanes - /orgs/{orgName}/buildplanes: + /namespaces/{namespaceName}/buildplanes: get: summary: List build planes operationId: listBuildPlanes tags: - BuildPlanes parameters: - - name: orgName + - name: namespaceName in: path required: true schema: @@ -2057,14 +2205,14 @@ paths: $ref: '#/components/schemas/BuildPlaneResponse' # ComponentTypes - /orgs/{orgName}/component-types: + /namespaces/{namespaceName}/component-types: get: summary: List all component types for an organization operationId: listComponentTypes tags: - ComponentTypes parameters: - - name: orgName + - name: namespaceName in: path required: true schema: @@ -2089,14 +2237,14 @@ paths: items: $ref: '#/components/schemas/ComponentTypeResponse' - /orgs/{orgName}/component-types/{ctName}/schema: + /namespaces/{namespaceName}/component-types/{ctName}/schema: get: summary: Get the JSON schema for a specific component type operationId: getComponentTypeSchema tags: - ComponentTypes parameters: - - name: orgName + - name: namespaceName in: path required: true schema: @@ -2124,14 +2272,14 @@ paths: description: Component type not found # Workflows (generic workflows) - /orgs/{orgName}/workflows: + /namespaces/{namespaceName}/workflows: get: summary: List all workflows for an organization operationId: listWorkflows tags: - Workflows parameters: - - name: orgName + - name: namespaceName in: path required: true schema: @@ -2156,14 +2304,14 @@ paths: items: $ref: '#/components/schemas/WorkflowResponse' - /orgs/{orgName}/workflows/{workflowName}/schema: + /namespaces/{namespaceName}/workflows/{workflowName}/schema: get: summary: Get the JSON schema for a specific workflow operationId: getWorkflowSchema tags: - Workflows parameters: - - name: orgName + - name: namespaceName in: path required: true schema: @@ -2191,14 +2339,14 @@ paths: description: Workflow not found # ComponentWorkflows (component-specific workflows) - /orgs/{orgName}/component-workflows: + /namespaces/{namespaceName}/component-workflows: get: summary: List all component workflows for an organization operationId: listComponentWorkflows tags: - ComponentWorkflows parameters: - - name: orgName + - name: namespaceName in: path required: true schema: @@ -2223,14 +2371,14 @@ paths: items: $ref: '#/components/schemas/WorkflowResponse' - /orgs/{orgName}/component-workflows/{cwName}/schema: + /namespaces/{namespaceName}/component-workflows/{cwName}/schema: get: summary: Get the JSON schema for a specific component workflow operationId: getComponentWorkflowSchema tags: - ComponentWorkflows parameters: - - name: orgName + - name: namespaceName in: path required: true schema: @@ -2258,14 +2406,14 @@ paths: description: Component workflow not found # Traits - /orgs/{orgName}/traits: + /namespaces/{namespaceName}/traits: get: summary: List all traits for an organization operationId: listTraits tags: - Traits parameters: - - name: orgName + - name: namespaceName in: path required: true schema: @@ -2290,14 +2438,14 @@ paths: items: $ref: '#/components/schemas/TraitResponse' - /orgs/{orgName}/traits/{traitName}/schema: + /namespaces/{namespaceName}/traits/{traitName}/schema: get: summary: Get the JSON schema for a specific trait operationId: getTraitSchema tags: - Traits parameters: - - name: orgName + - name: namespaceName in: path required: true schema: @@ -2325,14 +2473,14 @@ paths: description: Trait not found # Projects - /orgs/{orgName}/projects: + /namespaces/{namespaceName}/projects: get: summary: List all projects in an organization operationId: listProjects tags: - Projects parameters: - - name: orgName + - name: namespaceName in: path required: true schema: @@ -2363,7 +2511,7 @@ paths: tags: - Projects parameters: - - name: orgName + - name: namespaceName in: path required: true schema: @@ -2387,14 +2535,14 @@ paths: data: $ref: '#/components/schemas/ProjectResponse' - /orgs/{orgName}/projects/{projectName}: + /namespaces/{namespaceName}/projects/{projectName}: get: summary: Get a specific project operationId: getProject tags: - Projects parameters: - - name: orgName + - name: namespaceName in: path required: true schema: @@ -2416,15 +2564,40 @@ paths: properties: data: $ref: '#/components/schemas/ProjectResponse' + delete: + summary: Delete a project + operationId: deleteProject + tags: + - Projects + parameters: + - name: namespaceName + in: path + required: true + schema: + type: string + - name: projectName + in: path + required: true + schema: + type: string + responses: + '200': + description: Project deleted successfully + content: + application/json: + schema: + $ref: '#/components/schemas/APIResponse' + '404': + description: Project not found - /orgs/{orgName}/projects/{projectName}/deployment-pipeline: + /namespaces/{namespaceName}/projects/{projectName}/deployment-pipeline: get: summary: Get project deployment pipeline operationId: getProjectDeploymentPipeline tags: - Projects parameters: - - name: orgName + - name: namespaceName in: path required: true schema: @@ -2448,14 +2621,14 @@ paths: $ref: '#/components/schemas/DeploymentPipelineResponse' # Components - /orgs/{orgName}/projects/{projectName}/components: + /namespaces/{namespaceName}/projects/{projectName}/components: get: summary: List all components in a project operationId: listComponents tags: - Components parameters: - - name: orgName + - name: namespaceName in: path required: true schema: @@ -2491,7 +2664,7 @@ paths: tags: - Components parameters: - - name: orgName + - name: namespaceName in: path required: true schema: @@ -2520,14 +2693,14 @@ paths: data: $ref: '#/components/schemas/ComponentResponse' - /orgs/{orgName}/projects/{projectName}/components/{componentName}: + /namespaces/{namespaceName}/projects/{projectName}/components/{componentName}: get: summary: Get a specific component operationId: getComponent tags: - Components parameters: - - name: orgName + - name: namespaceName in: path required: true schema: @@ -2567,7 +2740,7 @@ paths: tags: - Components parameters: - - name: orgName + - name: namespaceName in: path required: true schema: @@ -2606,15 +2779,45 @@ paths: description: Component or project not found '500': description: Internal server error + delete: + summary: Delete a component + operationId: deleteComponent + tags: + - Components + parameters: + - name: namespaceName + in: path + required: true + schema: + type: string + - name: projectName + in: path + required: true + schema: + type: string + - name: componentName + in: path + required: true + schema: + type: string + responses: + '200': + description: Component deleted successfully + content: + application/json: + schema: + $ref: '#/components/schemas/APIResponse' + '404': + description: Component not found - /orgs/{orgName}/projects/{projectName}/components/{componentName}/schema: + /namespaces/{namespaceName}/projects/{projectName}/components/{componentName}/schema: get: summary: Get the JSON schema for a specific component operationId: getComponentSchema tags: - Components parameters: - - name: orgName + - name: namespaceName in: path required: true schema: @@ -2644,14 +2847,14 @@ paths: '404': description: Component not found - /orgs/{orgName}/projects/{projectName}/components/{componentName}/traits: + /namespaces/{namespaceName}/projects/{projectName}/components/{componentName}/traits: get: summary: List all traits attached to a component operationId: listComponentTraits tags: - Components parameters: - - name: orgName + - name: namespaceName in: path required: true schema: @@ -2697,7 +2900,7 @@ paths: tags: - Components parameters: - - name: orgName + - name: namespaceName in: path required: true schema: @@ -2743,14 +2946,14 @@ paths: '404': description: Component or trait not found - /orgs/{orgName}/projects/{projectName}/components/{componentName}/workflow-parameters: + /namespaces/{namespaceName}/projects/{projectName}/components/{componentName}/workflow-parameters: patch: summary: Update component workflow parameters operationId: updateComponentWorkflowParameters tags: - ComponentWorkflows parameters: - - name: orgName + - name: namespaceName in: path required: true schema: @@ -2784,14 +2987,14 @@ paths: data: $ref: '#/components/schemas/ComponentResponse' - /orgs/{orgName}/projects/{projectName}/components/{componentName}/workflow-runs: + /namespaces/{namespaceName}/projects/{projectName}/components/{componentName}/workflow-runs: post: summary: Create a component workflow run operationId: createComponentWorkflowRun tags: - ComponentWorkflows parameters: - - name: orgName + - name: namespaceName in: path required: true schema: @@ -2833,7 +3036,7 @@ paths: tags: - ComponentWorkflows parameters: - - name: orgName + - name: namespaceName in: path required: true schema: @@ -2868,14 +3071,14 @@ paths: items: $ref: '#/components/schemas/ComponentWorkflowRunResponse' - /orgs/{orgName}/projects/{projectName}/components/{componentName}/workflow-runs/{runName}: + /namespaces/{namespaceName}/projects/{projectName}/components/{componentName}/workflow-runs/{runName}: get: summary: Get a specific component workflow run operationId: getComponentWorkflowRun tags: - ComponentWorkflows parameters: - - name: orgName + - name: namespaceName in: path required: true schema: @@ -2911,14 +3114,14 @@ paths: description: Component workflow run not found # Component Bindings - /orgs/{orgName}/projects/{projectName}/components/{componentName}/bindings: + /namespaces/{namespaceName}/projects/{projectName}/components/{componentName}/bindings: get: summary: Get component bindings operationId: getComponentBinding tags: - Bindings parameters: - - name: orgName + - name: namespaceName in: path required: true schema: @@ -2953,14 +3156,14 @@ paths: items: $ref: '#/components/schemas/BindingResponse' - /orgs/{orgName}/projects/{projectName}/components/{componentName}/bindings/{bindingName}: + /namespaces/{namespaceName}/projects/{projectName}/components/{componentName}/bindings/{bindingName}: patch: summary: Update a component binding operationId: updateComponentBinding tags: - Bindings parameters: - - name: orgName + - name: namespaceName in: path required: true schema: @@ -2995,14 +3198,14 @@ paths: $ref: '#/components/schemas/APIResponse' # Component Releases - /orgs/{orgName}/projects/{projectName}/components/{componentName}/component-releases: + /namespaces/{namespaceName}/projects/{projectName}/components/{componentName}/component-releases: get: summary: List component releases operationId: listComponentReleases tags: - Releases parameters: - - name: orgName + - name: namespaceName in: path required: true schema: @@ -3043,7 +3246,7 @@ paths: tags: - Releases parameters: - - name: orgName + - name: namespaceName in: path required: true schema: @@ -3077,14 +3280,14 @@ paths: data: $ref: '#/components/schemas/ComponentReleaseResponse' - /orgs/{orgName}/projects/{projectName}/components/{componentName}/component-releases/{releaseName}: + /namespaces/{namespaceName}/projects/{projectName}/components/{componentName}/component-releases/{releaseName}: get: summary: Get a specific component release operationId: getComponentRelease tags: - Releases parameters: - - name: orgName + - name: namespaceName in: path required: true schema: @@ -3117,14 +3320,14 @@ paths: data: $ref: '#/components/schemas/ComponentReleaseResponse' - /orgs/{orgName}/projects/{projectName}/components/{componentName}/component-releases/{releaseName}/schema: + /namespaces/{namespaceName}/projects/{projectName}/components/{componentName}/component-releases/{releaseName}/schema: get: summary: Get the JSON schema for a specific component release operationId: getComponentReleaseSchema tags: - Releases parameters: - - name: orgName + - name: namespaceName in: path required: true schema: @@ -3160,14 +3363,14 @@ paths: description: Component release not found # Release Bindings - /orgs/{orgName}/projects/{projectName}/components/{componentName}/release-bindings: + /namespaces/{namespaceName}/projects/{projectName}/components/{componentName}/release-bindings: get: summary: List release bindings operationId: listReleaseBindings tags: - Releases parameters: - - name: orgName + - name: namespaceName in: path required: true schema: @@ -3202,14 +3405,14 @@ paths: items: $ref: '#/components/schemas/ReleaseBindingResponse' - /orgs/{orgName}/projects/{projectName}/components/{componentName}/release-bindings/{bindingName}: + /namespaces/{namespaceName}/projects/{projectName}/components/{componentName}/release-bindings/{bindingName}: patch: summary: Patch a release binding operationId: patchReleaseBinding tags: - Releases parameters: - - name: orgName + - name: namespaceName in: path required: true schema: @@ -3244,14 +3447,14 @@ paths: $ref: '#/components/schemas/APIResponse' # Component Deployment - /orgs/{orgName}/projects/{projectName}/components/{componentName}/deploy: + /namespaces/{namespaceName}/projects/{projectName}/components/{componentName}/deploy: post: summary: Deploy a release to the lowest environment operationId: deployRelease tags: - Deployment parameters: - - name: orgName + - name: namespaceName in: path required: true schema: @@ -3281,14 +3484,14 @@ paths: $ref: '#/components/schemas/APIResponse' # Component Promotion - /orgs/{orgName}/projects/{projectName}/components/{componentName}/promote: + /namespaces/{namespaceName}/projects/{projectName}/components/{componentName}/promote: post: summary: Promote component to environment operationId: promoteComponent tags: - Deployment parameters: - - name: orgName + - name: namespaceName in: path required: true schema: @@ -3330,14 +3533,14 @@ paths: $ref: '#/components/schemas/BindingResponse' # Observer URLs - /orgs/{orgName}/projects/{projectName}/components/{componentName}/environments/{environmentName}/observer-url: + /namespaces/{namespaceName}/projects/{projectName}/components/{componentName}/environments/{environmentName}/observer-url: get: summary: Get runtime logs observer URL operationId: getComponentObserverURL tags: - Observability parameters: - - name: orgName + - name: namespaceName in: path required: true schema: @@ -3370,14 +3573,14 @@ paths: data: $ref: '#/components/schemas/ObserverUrlData' - /orgs/{orgName}/projects/{projectName}/components/{componentName}/observer-url: + /namespaces/{namespaceName}/projects/{projectName}/components/{componentName}/observer-url: get: summary: Get build logs observer URL operationId: getBuildObserverURL tags: - Observability parameters: - - name: orgName + - name: namespaceName in: path required: true schema: @@ -3405,14 +3608,14 @@ paths: data: $ref: '#/components/schemas/ObserverUrlData' - /orgs/{orgName}/projects/{projectName}/components/{componentName}/environments/{environmentName}/release: + /namespaces/{namespaceName}/projects/{projectName}/components/{componentName}/environments/{environmentName}/release: get: summary: Get environment release operationId: getEnvironmentRelease tags: - Releases parameters: - - name: orgName + - name: namespaceName in: path required: true schema: @@ -3448,14 +3651,14 @@ paths: description: Release not found for the specified environment # Workloads - /orgs/{orgName}/projects/{projectName}/components/{componentName}/workloads: + /namespaces/{namespaceName}/projects/{projectName}/components/{componentName}/workloads: post: summary: Create or update workload operationId: createWorkload tags: - Workloads parameters: - - name: orgName + - name: namespaceName in: path required: true schema: @@ -3497,7 +3700,7 @@ paths: tags: - Workloads parameters: - - name: orgName + - name: namespaceName in: path required: true schema: diff --git a/packages/openchoreo-client-node/openapi/openchoreo-observability-api.yaml b/packages/openchoreo-client-node/openapi/openchoreo-observability-api.yaml index 86605e3f..8e658837 100644 --- a/packages/openchoreo-client-node/openapi/openchoreo-observability-api.yaml +++ b/packages/openchoreo-client-node/openapi/openchoreo-observability-api.yaml @@ -461,7 +461,7 @@ components: - endTime - componentName - projectName - - orgName + - namespaceName properties: startTime: type: string @@ -494,10 +494,10 @@ components: type: string description: Project name example: 'my-project' - orgName: + namespaceName: type: string - description: Organization name - example: 'my-org' + description: Namespace name + example: 'my-namespace' ComponentLogsRequest: type: object @@ -507,7 +507,7 @@ components: - environmentId - componentName - projectName - - orgName + - namespaceName - environmentName # - namespace properties: @@ -589,10 +589,10 @@ components: type: string description: Environment name example: 'my-environment' - orgName: + namespaceName: type: string - description: Organization name - example: 'my-org' + description: Namespace name + example: 'my-namespace' ProjectLogsRequest: allOf: @@ -687,7 +687,7 @@ components: - projectName - environmentName - componentNames - - orgName + - namespaceName properties: projectUid: type: string @@ -761,10 +761,10 @@ components: type: string description: Environment name example: 'my-environment' - orgName: + namespaceName: type: string - description: Organization name - example: 'my-org' + description: Namespace name + example: 'my-namespace' MetricsRequest: type: object @@ -774,7 +774,7 @@ components: - projectId - componentName - projectName - - orgName + - namespaceName - environmentName properties: componentId: @@ -811,10 +811,10 @@ components: type: string description: Environment name example: 'my-environment' - orgName: + namespaceName: type: string - description: Organization name - example: 'my-org' + description: Namespace name + example: 'my-namespace' LogEntry: type: object diff --git a/packages/openchoreo-client-node/src/factory.ts b/packages/openchoreo-client-node/src/factory.ts index bbdcd61e..d305bc12 100644 --- a/packages/openchoreo-client-node/src/factory.ts +++ b/packages/openchoreo-client-node/src/factory.ts @@ -81,8 +81,8 @@ export interface OpenChoreoObservabilityClientConfig { * token: 'your-auth-token' * }); * - * const { data, error } = await client.GET('/orgs/{orgName}/projects', { - * params: { path: { orgName: 'my-org' } } + * const { data, error } = await client.GET('/namespaces/{namespaceName}/projects', { + * params: { path: { namespaceName: 'my-namespace' } } * }); * ``` */ @@ -175,8 +175,8 @@ export function createOpenChoreoObservabilityApiClient( * ```typescript * // In your Backstage backend module * const client = createOpenChoreoClientFromConfig(config, logger); - * const { data: projects } = await client.GET('/orgs/{orgName}/projects', { - * params: { path: { orgName: 'my-org' } } + * const { data: projects } = await client.GET('/namespaces/{namespaceName}/projects', { + * params: { path: { namespaceName: 'my-namespace' } } * }); * ``` * diff --git a/packages/openchoreo-client-node/src/generated/observability/types.ts b/packages/openchoreo-client-node/src/generated/observability/types.ts index eb14344e..f155b3c4 100644 --- a/packages/openchoreo-client-node/src/generated/observability/types.ts +++ b/packages/openchoreo-client-node/src/generated/observability/types.ts @@ -265,10 +265,10 @@ export interface components { */ projectName: string; /** - * @description Organization name - * @example my-org + * @description Namespace name + * @example my-namespace */ - orgName: string; + namespaceName: string; }; ComponentLogsRequest: { /** @@ -367,10 +367,10 @@ export interface components { */ environmentName: string; /** - * @description Organization name - * @example my-org + * @description Namespace name + * @example my-namespace */ - orgName: string; + namespaceName: string; }; ProjectLogsRequest: components['schemas']['ComponentLogsRequest'] & { /** @@ -486,7 +486,6 @@ export interface components { * - Prefix match: `63d7c3065ab2537*` * - Suffix match: `*135a77db` * - Single char wildcard: `63d7c3065ab2537?e6c5d6bb135a77db` - * * @example 63d7c3065ab25375* */ traceId?: string; @@ -534,10 +533,10 @@ export interface components { */ environmentName: string; /** - * @description Organization name - * @example my-org + * @description Namespace name + * @example my-namespace */ - orgName: string; + namespaceName: string; }; MetricsRequest: { /** @@ -583,10 +582,10 @@ export interface components { */ environmentName: string; /** - * @description Organization name - * @example my-org + * @description Namespace name + * @example my-namespace */ - orgName: string; + namespaceName: string; }; LogEntry: { /** @@ -629,7 +628,8 @@ export interface components { */ tookMs?: number; }; - /** @example { + /** + * @example { * "traces": [ * { * "traceId": "f3a7b9e1c4d2f5a8b6e3c9f1d4a7e2b8", @@ -648,7 +648,8 @@ export interface components { * } * ], * "tookMs": 15 - * } */ + * } + */ TraceResponse: { /** @description Array of traces with their spans */ traces?: components['schemas']['Trace'][]; @@ -728,7 +729,8 @@ export interface components { */ value?: number; }; - /** @example { + /** + * @example { * "cpuUsage": [ * { * "time": "2025-01-10T12:00:00Z", @@ -789,7 +791,8 @@ export interface components { * "value": 2147483648 * } * ] - * } */ + * } + */ ResourceMetricsTimeSeries: { /** @description CPU usage time series (in cores) */ cpuUsage?: components['schemas']['TimeValuePoint'][]; @@ -804,7 +807,8 @@ export interface components { /** @description Memory limits time series (in bytes) */ memoryLimits?: components['schemas']['TimeValuePoint'][]; }; - /** @example { + /** + * @example { * "requestCount": [ * { * "time": "2025-01-10T12:00:00Z", @@ -875,7 +879,8 @@ export interface components { * "value": 0.52 * } * ] - * } */ + * } + */ HTTPMetricsTimeSeries: { /** @description Total HTTP request count time series (requests per second) */ requestCount?: components['schemas']['TimeValuePoint'][]; @@ -1146,11 +1151,12 @@ export interface components { */ log_message: string; }; - /** @description Evidence from metrics - rendered as a styled value + /** + * @description Evidence from metrics - rendered as a styled value * * Example- metric_name="RAM usage", value="95.5%", severity=CRITICAL * renders as "95.5% RAM usage" with value in red - * */ + */ MetricEvidenceItem: { /** * @description Evidence type discriminator (enum property replaced by openapi-typescript) diff --git a/packages/openchoreo-client-node/src/generated/openchoreo/types.ts b/packages/openchoreo-client-node/src/generated/openchoreo/types.ts index 6cc0d1dd..e2090e2f 100644 --- a/packages/openchoreo-client-node/src/generated/openchoreo/types.ts +++ b/packages/openchoreo-client-node/src/generated/openchoreo/types.ts @@ -38,6 +38,74 @@ export interface paths { patch?: never; trace?: never; }; + '/version': { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** Get server version information */ + get: operations['getVersion']; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + '/webhooks/github': { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** Handle GitHub webhook events */ + post: operations['handleGitHubWebhook']; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + '/webhooks/gitlab': { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** Handle GitLab webhook events */ + post: operations['handleGitLabWebhook']; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + '/webhooks/bitbucket': { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** Handle Bitbucket webhook events */ + post: operations['handleBitbucketWebhook']; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; '/apply': { parameters: { query?: never; @@ -72,15 +140,15 @@ export interface paths { patch?: never; trace?: never; }; - '/orgs': { + '/namespaces': { parameters: { query?: never; header?: never; path?: never; cookie?: never; }; - /** List all organizations */ - get: operations['listOrganizations']; + /** List all namespaces */ + get: operations['listNamespaces']; put?: never; post?: never; delete?: never; @@ -89,15 +157,15 @@ export interface paths { patch?: never; trace?: never; }; - '/orgs/{orgName}': { + '/namespaces/{namespaceName}': { parameters: { query?: never; header?: never; path?: never; cookie?: never; }; - /** Get a specific organization */ - get: operations['getOrganization']; + /** Get a specific namespace */ + get: operations['getNamespace']; put?: never; post?: never; delete?: never; @@ -106,14 +174,14 @@ export interface paths { patch?: never; trace?: never; }; - '/orgs/{orgName}/secret-references': { + '/namespaces/{namespaceName}/secret-references': { parameters: { query?: never; header?: never; path?: never; cookie?: never; }; - /** List secret references for an organization */ + /** List secret references for a namespace */ get: operations['listSecretReferences']; put?: never; post?: never; @@ -123,7 +191,7 @@ export interface paths { patch?: never; trace?: never; }; - '/orgs/{orgName}/dataplanes': { + '/namespaces/{namespaceName}/dataplanes': { parameters: { query?: never; header?: never; @@ -141,7 +209,7 @@ export interface paths { patch?: never; trace?: never; }; - '/orgs/{orgName}/dataplanes/{dpName}': { + '/namespaces/{namespaceName}/dataplanes/{dpName}': { parameters: { query?: never; header?: never; @@ -158,7 +226,7 @@ export interface paths { patch?: never; trace?: never; }; - '/orgs/{orgName}/environments': { + '/namespaces/{namespaceName}/environments': { parameters: { query?: never; header?: never; @@ -176,7 +244,7 @@ export interface paths { patch?: never; trace?: never; }; - '/orgs/{orgName}/environments/{envName}': { + '/namespaces/{namespaceName}/environments/{envName}': { parameters: { query?: never; header?: never; @@ -193,7 +261,7 @@ export interface paths { patch?: never; trace?: never; }; - '/orgs/{orgName}/environments/{envName}/observer-url': { + '/namespaces/{namespaceName}/environments/{envName}/observer-url': { parameters: { query?: never; header?: never; @@ -210,7 +278,7 @@ export interface paths { patch?: never; trace?: never; }; - '/orgs/{orgName}/buildplanes': { + '/namespaces/{namespaceName}/buildplanes': { parameters: { query?: never; header?: never; @@ -227,7 +295,7 @@ export interface paths { patch?: never; trace?: never; }; - '/orgs/{orgName}/component-types': { + '/namespaces/{namespaceName}/component-types': { parameters: { query?: never; header?: never; @@ -244,7 +312,7 @@ export interface paths { patch?: never; trace?: never; }; - '/orgs/{orgName}/component-types/{ctName}/schema': { + '/namespaces/{namespaceName}/component-types/{ctName}/schema': { parameters: { query?: never; header?: never; @@ -261,7 +329,7 @@ export interface paths { patch?: never; trace?: never; }; - '/orgs/{orgName}/workflows': { + '/namespaces/{namespaceName}/workflows': { parameters: { query?: never; header?: never; @@ -278,7 +346,7 @@ export interface paths { patch?: never; trace?: never; }; - '/orgs/{orgName}/workflows/{workflowName}/schema': { + '/namespaces/{namespaceName}/workflows/{workflowName}/schema': { parameters: { query?: never; header?: never; @@ -295,7 +363,7 @@ export interface paths { patch?: never; trace?: never; }; - '/orgs/{orgName}/component-workflows': { + '/namespaces/{namespaceName}/component-workflows': { parameters: { query?: never; header?: never; @@ -312,7 +380,7 @@ export interface paths { patch?: never; trace?: never; }; - '/orgs/{orgName}/component-workflows/{cwName}/schema': { + '/namespaces/{namespaceName}/component-workflows/{cwName}/schema': { parameters: { query?: never; header?: never; @@ -329,7 +397,7 @@ export interface paths { patch?: never; trace?: never; }; - '/orgs/{orgName}/traits': { + '/namespaces/{namespaceName}/traits': { parameters: { query?: never; header?: never; @@ -346,7 +414,7 @@ export interface paths { patch?: never; trace?: never; }; - '/orgs/{orgName}/traits/{traitName}/schema': { + '/namespaces/{namespaceName}/traits/{traitName}/schema': { parameters: { query?: never; header?: never; @@ -363,7 +431,7 @@ export interface paths { patch?: never; trace?: never; }; - '/orgs/{orgName}/projects': { + '/namespaces/{namespaceName}/projects': { parameters: { query?: never; header?: never; @@ -381,7 +449,7 @@ export interface paths { patch?: never; trace?: never; }; - '/orgs/{orgName}/projects/{projectName}': { + '/namespaces/{namespaceName}/projects/{projectName}': { parameters: { query?: never; header?: never; @@ -392,13 +460,14 @@ export interface paths { get: operations['getProject']; put?: never; post?: never; - delete?: never; + /** Delete a project */ + delete: operations['deleteProject']; options?: never; head?: never; patch?: never; trace?: never; }; - '/orgs/{orgName}/projects/{projectName}/deployment-pipeline': { + '/namespaces/{namespaceName}/projects/{projectName}/deployment-pipeline': { parameters: { query?: never; header?: never; @@ -415,7 +484,7 @@ export interface paths { patch?: never; trace?: never; }; - '/orgs/{orgName}/projects/{projectName}/components': { + '/namespaces/{namespaceName}/projects/{projectName}/components': { parameters: { query?: never; header?: never; @@ -433,7 +502,7 @@ export interface paths { patch?: never; trace?: never; }; - '/orgs/{orgName}/projects/{projectName}/components/{componentName}': { + '/namespaces/{namespaceName}/projects/{projectName}/components/{componentName}': { parameters: { query?: never; header?: never; @@ -444,14 +513,15 @@ export interface paths { get: operations['getComponent']; put?: never; post?: never; - delete?: never; + /** Delete a component */ + delete: operations['deleteComponent']; options?: never; head?: never; /** Patch a component */ patch: operations['patchComponent']; trace?: never; }; - '/orgs/{orgName}/projects/{projectName}/components/{componentName}/schema': { + '/namespaces/{namespaceName}/projects/{projectName}/components/{componentName}/schema': { parameters: { query?: never; header?: never; @@ -468,7 +538,7 @@ export interface paths { patch?: never; trace?: never; }; - '/orgs/{orgName}/projects/{projectName}/components/{componentName}/traits': { + '/namespaces/{namespaceName}/projects/{projectName}/components/{componentName}/traits': { parameters: { query?: never; header?: never; @@ -486,7 +556,7 @@ export interface paths { patch?: never; trace?: never; }; - '/orgs/{orgName}/projects/{projectName}/components/{componentName}/workflow-parameters': { + '/namespaces/{namespaceName}/projects/{projectName}/components/{componentName}/workflow-parameters': { parameters: { query?: never; header?: never; @@ -503,7 +573,7 @@ export interface paths { patch: operations['updateComponentWorkflowParameters']; trace?: never; }; - '/orgs/{orgName}/projects/{projectName}/components/{componentName}/workflow-runs': { + '/namespaces/{namespaceName}/projects/{projectName}/components/{componentName}/workflow-runs': { parameters: { query?: never; header?: never; @@ -521,7 +591,7 @@ export interface paths { patch?: never; trace?: never; }; - '/orgs/{orgName}/projects/{projectName}/components/{componentName}/workflow-runs/{runName}': { + '/namespaces/{namespaceName}/projects/{projectName}/components/{componentName}/workflow-runs/{runName}': { parameters: { query?: never; header?: never; @@ -538,7 +608,7 @@ export interface paths { patch?: never; trace?: never; }; - '/orgs/{orgName}/projects/{projectName}/components/{componentName}/bindings': { + '/namespaces/{namespaceName}/projects/{projectName}/components/{componentName}/bindings': { parameters: { query?: never; header?: never; @@ -555,7 +625,7 @@ export interface paths { patch?: never; trace?: never; }; - '/orgs/{orgName}/projects/{projectName}/components/{componentName}/bindings/{bindingName}': { + '/namespaces/{namespaceName}/projects/{projectName}/components/{componentName}/bindings/{bindingName}': { parameters: { query?: never; header?: never; @@ -572,7 +642,7 @@ export interface paths { patch: operations['updateComponentBinding']; trace?: never; }; - '/orgs/{orgName}/projects/{projectName}/components/{componentName}/component-releases': { + '/namespaces/{namespaceName}/projects/{projectName}/components/{componentName}/component-releases': { parameters: { query?: never; header?: never; @@ -590,7 +660,7 @@ export interface paths { patch?: never; trace?: never; }; - '/orgs/{orgName}/projects/{projectName}/components/{componentName}/component-releases/{releaseName}': { + '/namespaces/{namespaceName}/projects/{projectName}/components/{componentName}/component-releases/{releaseName}': { parameters: { query?: never; header?: never; @@ -607,7 +677,7 @@ export interface paths { patch?: never; trace?: never; }; - '/orgs/{orgName}/projects/{projectName}/components/{componentName}/component-releases/{releaseName}/schema': { + '/namespaces/{namespaceName}/projects/{projectName}/components/{componentName}/component-releases/{releaseName}/schema': { parameters: { query?: never; header?: never; @@ -624,7 +694,7 @@ export interface paths { patch?: never; trace?: never; }; - '/orgs/{orgName}/projects/{projectName}/components/{componentName}/release-bindings': { + '/namespaces/{namespaceName}/projects/{projectName}/components/{componentName}/release-bindings': { parameters: { query?: never; header?: never; @@ -641,7 +711,7 @@ export interface paths { patch?: never; trace?: never; }; - '/orgs/{orgName}/projects/{projectName}/components/{componentName}/release-bindings/{bindingName}': { + '/namespaces/{namespaceName}/projects/{projectName}/components/{componentName}/release-bindings/{bindingName}': { parameters: { query?: never; header?: never; @@ -658,7 +728,7 @@ export interface paths { patch: operations['patchReleaseBinding']; trace?: never; }; - '/orgs/{orgName}/projects/{projectName}/components/{componentName}/deploy': { + '/namespaces/{namespaceName}/projects/{projectName}/components/{componentName}/deploy': { parameters: { query?: never; header?: never; @@ -675,7 +745,7 @@ export interface paths { patch?: never; trace?: never; }; - '/orgs/{orgName}/projects/{projectName}/components/{componentName}/promote': { + '/namespaces/{namespaceName}/projects/{projectName}/components/{componentName}/promote': { parameters: { query?: never; header?: never; @@ -692,7 +762,7 @@ export interface paths { patch?: never; trace?: never; }; - '/orgs/{orgName}/projects/{projectName}/components/{componentName}/environments/{environmentName}/observer-url': { + '/namespaces/{namespaceName}/projects/{projectName}/components/{componentName}/environments/{environmentName}/observer-url': { parameters: { query?: never; header?: never; @@ -709,7 +779,7 @@ export interface paths { patch?: never; trace?: never; }; - '/orgs/{orgName}/projects/{projectName}/components/{componentName}/observer-url': { + '/namespaces/{namespaceName}/projects/{projectName}/components/{componentName}/observer-url': { parameters: { query?: never; header?: never; @@ -726,7 +796,7 @@ export interface paths { patch?: never; trace?: never; }; - '/orgs/{orgName}/projects/{projectName}/components/{componentName}/environments/{environmentName}/release': { + '/namespaces/{namespaceName}/projects/{projectName}/components/{componentName}/environments/{environmentName}/release': { parameters: { query?: never; header?: never; @@ -743,7 +813,7 @@ export interface paths { patch?: never; trace?: never; }; - '/orgs/{orgName}/projects/{projectName}/components/{componentName}/workloads': { + '/namespaces/{namespaceName}/projects/{projectName}/components/{componentName}/workloads': { parameters: { query?: never; header?: never; @@ -981,11 +1051,10 @@ export interface components { property?: string; version?: string; }; - OrganizationResponse: { + NamespaceResponse: { name: string; displayName?: string; description?: string; - namespace?: string; /** Format: date-time */ createdAt: string; status?: string; @@ -993,7 +1062,7 @@ export interface components { ProjectResponse: { uid: string; name: string; - orgName: string; + namespaceName: string; displayName?: string; description?: string; deploymentPipeline?: string; @@ -1011,7 +1080,7 @@ export interface components { name: string; displayName?: string; description?: string; - orgName: string; + namespaceName: string; /** Format: date-time */ createdAt: string; status?: string; @@ -1033,9 +1102,11 @@ export interface components { description?: string; type: string; projectName: string; - orgName: string; + namespaceName: string; /** Format: date-time */ createdAt: string; + /** Format: date-time */ + deletionTimestamp?: string | null; status?: string; autoDeploy?: boolean; service?: { @@ -1119,15 +1190,15 @@ export interface components { imagePullSecretRefs?: string[]; secretStoreRef?: string; publicVirtualHost: string; - organizationVirtualHost: string; + namespaceVirtualHost: string; /** Format: int32 */ publicHTTPPort: number; /** Format: int32 */ publicHTTPSPort: number; /** Format: int32 */ - organizationHTTPPort: number; + namespaceHTTPPort: number; /** Format: int32 */ - organizationHTTPSPort: number; + namespaceHTTPSPort: number; observabilityPlaneRef?: string; /** Format: date-time */ createdAt: string; @@ -1168,7 +1239,7 @@ export interface components { uuid: string; componentName: string; projectName: string; - orgName: string; + namespaceName: string; commit?: string; status?: string; /** Format: date-time */ @@ -1206,7 +1277,7 @@ export interface components { uuid: string; componentName: string; projectName: string; - orgName: string; + namespaceName: string; commit?: string; status?: string; /** Format: date-time */ @@ -1246,7 +1317,7 @@ export interface components { type: string; componentName: string; projectName: string; - orgName: string; + namespaceName: string; environment: string; status: components['schemas']['BindingStatus']; serviceBinding?: components['schemas']['ServiceBinding']; @@ -1284,7 +1355,7 @@ export interface components { name: string; type: string; project?: components['schemas']['ExposedEndpoint']; - organization?: components['schemas']['ExposedEndpoint']; + namespace?: components['schemas']['ExposedEndpoint']; public?: components['schemas']['ExposedEndpoint']; }; ExposedEndpoint: { @@ -1339,18 +1410,19 @@ export interface components { /** @description Message returned when observability is not configured */ message?: string; }; - /** @description Immutable snapshot of component configuration. + /** + * @description Immutable snapshot of component configuration. * Note: The following fields are immutable after creation and cannot be modified: * - componentType * - traits * - componentProfile * - workload - * */ + */ ComponentReleaseResponse: { name: string; componentName: string; projectName: string; - orgName: string; + namespaceName: string; /** Format: date-time */ createdAt: string; status?: string; @@ -1362,7 +1434,7 @@ export interface components { name: string; componentName: string; projectName: string; - orgName: string; + namespaceName: string; environment: string; releaseName: string; componentTypeEnvOverrides?: { @@ -1632,6 +1704,21 @@ export interface components { /** Format: date-time */ evaluatedAt?: string; }; + WebhookEventResponse: { + success: boolean; + message: string; + affectedComponents?: string[]; + triggeredBuilds: number; + }; + VersionResponse: { + name: string; + version: string; + gitRevision: string; + buildTime: string; + goOS: string; + goArch: string; + goVersion: string; + }; }; responses: never; parameters: never; @@ -1681,6 +1768,110 @@ export interface operations { }; }; }; + getVersion: { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description Server version information */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + 'application/json': components['schemas']['VersionResponse']; + }; + }; + }; + }; + handleGitHubWebhook: { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + requestBody: { + content: { + 'application/json': { + [key: string]: unknown; + }; + }; + }; + responses: { + /** @description Webhook processed successfully */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + 'application/json': components['schemas']['APIResponse'] & { + data?: components['schemas']['WebhookEventResponse']; + }; + }; + }; + }; + }; + handleGitLabWebhook: { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + requestBody: { + content: { + 'application/json': { + [key: string]: unknown; + }; + }; + }; + responses: { + /** @description Webhook processed successfully */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + 'application/json': components['schemas']['APIResponse'] & { + data?: components['schemas']['WebhookEventResponse']; + }; + }; + }; + }; + }; + handleBitbucketWebhook: { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + requestBody: { + content: { + 'application/json': { + [key: string]: unknown; + }; + }; + }; + responses: { + /** @description Webhook processed successfully */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + 'application/json': components['schemas']['APIResponse'] & { + data?: components['schemas']['WebhookEventResponse']; + }; + }; + }; + }; + }; applyResource: { parameters: { query?: never; @@ -1742,7 +1933,7 @@ export interface operations { }; }; }; - listOrganizations: { + listNamespaces: { parameters: { query?: never; header?: never; @@ -1759,19 +1950,19 @@ export interface operations { content: { 'application/json': components['schemas']['APIResponse'] & { data?: components['schemas']['ListResponse'] & { - items?: components['schemas']['OrganizationResponse'][]; + items?: components['schemas']['NamespaceResponse'][]; }; }; }; }; }; }; - getOrganization: { + getNamespace: { parameters: { query?: never; header?: never; path: { - orgName: string; + namespaceName: string; }; cookie?: never; }; @@ -1784,10 +1975,17 @@ export interface operations { }; content: { 'application/json': components['schemas']['APIResponse'] & { - data?: components['schemas']['OrganizationResponse']; + data?: components['schemas']['NamespaceResponse']; }; }; }; + /** @description Namespace not found */ + 404: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; }; }; listSecretReferences: { @@ -1795,7 +1993,7 @@ export interface operations { query?: never; header?: never; path: { - orgName: string; + namespaceName: string; }; cookie?: never; }; @@ -1814,7 +2012,7 @@ export interface operations { }; }; }; - /** @description Organization not found */ + /** @description Namespace not found */ 404: { headers: { [name: string]: unknown; @@ -1828,7 +2026,7 @@ export interface operations { query?: never; header?: never; path: { - orgName: string; + namespaceName: string; }; cookie?: never; }; @@ -1854,7 +2052,7 @@ export interface operations { query?: never; header?: never; path: { - orgName: string; + namespaceName: string; }; cookie?: never; }; @@ -1882,7 +2080,7 @@ export interface operations { query?: never; header?: never; path: { - orgName: string; + namespaceName: string; dpName: string; }; cookie?: never; @@ -1907,7 +2105,7 @@ export interface operations { query?: never; header?: never; path: { - orgName: string; + namespaceName: string; }; cookie?: never; }; @@ -1933,7 +2131,7 @@ export interface operations { query?: never; header?: never; path: { - orgName: string; + namespaceName: string; }; cookie?: never; }; @@ -1961,7 +2159,7 @@ export interface operations { query?: never; header?: never; path: { - orgName: string; + namespaceName: string; envName: string; }; cookie?: never; @@ -1986,7 +2184,7 @@ export interface operations { query?: never; header?: never; path: { - orgName: string; + namespaceName: string; envName: string; }; cookie?: never; @@ -2018,7 +2216,7 @@ export interface operations { query?: never; header?: never; path: { - orgName: string; + namespaceName: string; }; cookie?: never; }; @@ -2044,7 +2242,7 @@ export interface operations { query?: never; header?: never; path: { - orgName: string; + namespaceName: string; }; cookie?: never; }; @@ -2070,7 +2268,7 @@ export interface operations { query?: never; header?: never; path: { - orgName: string; + namespaceName: string; ctName: string; }; cookie?: never; @@ -2105,7 +2303,7 @@ export interface operations { query?: never; header?: never; path: { - orgName: string; + namespaceName: string; }; cookie?: never; }; @@ -2131,7 +2329,7 @@ export interface operations { query?: never; header?: never; path: { - orgName: string; + namespaceName: string; workflowName: string; }; cookie?: never; @@ -2166,7 +2364,7 @@ export interface operations { query?: never; header?: never; path: { - orgName: string; + namespaceName: string; }; cookie?: never; }; @@ -2192,7 +2390,7 @@ export interface operations { query?: never; header?: never; path: { - orgName: string; + namespaceName: string; cwName: string; }; cookie?: never; @@ -2227,7 +2425,7 @@ export interface operations { query?: never; header?: never; path: { - orgName: string; + namespaceName: string; }; cookie?: never; }; @@ -2253,7 +2451,7 @@ export interface operations { query?: never; header?: never; path: { - orgName: string; + namespaceName: string; traitName: string; }; cookie?: never; @@ -2288,7 +2486,7 @@ export interface operations { query?: never; header?: never; path: { - orgName: string; + namespaceName: string; }; cookie?: never; }; @@ -2314,7 +2512,7 @@ export interface operations { query?: never; header?: never; path: { - orgName: string; + namespaceName: string; }; cookie?: never; }; @@ -2342,7 +2540,7 @@ export interface operations { query?: never; header?: never; path: { - orgName: string; + namespaceName: string; projectName: string; }; cookie?: never; @@ -2362,12 +2560,42 @@ export interface operations { }; }; }; + deleteProject: { + parameters: { + query?: never; + header?: never; + path: { + namespaceName: string; + projectName: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description Project deleted successfully */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + 'application/json': components['schemas']['APIResponse']; + }; + }; + /** @description Project not found */ + 404: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + }; + }; getProjectDeploymentPipeline: { parameters: { query?: never; header?: never; path: { - orgName: string; + namespaceName: string; projectName: string; }; cookie?: never; @@ -2392,7 +2620,7 @@ export interface operations { query?: never; header?: never; path: { - orgName: string; + namespaceName: string; projectName: string; }; cookie?: never; @@ -2419,7 +2647,7 @@ export interface operations { query?: never; header?: never; path: { - orgName: string; + namespaceName: string; projectName: string; }; cookie?: never; @@ -2451,7 +2679,7 @@ export interface operations { }; header?: never; path: { - orgName: string; + namespaceName: string; projectName: string; componentName: string; }; @@ -2472,12 +2700,43 @@ export interface operations { }; }; }; + deleteComponent: { + parameters: { + query?: never; + header?: never; + path: { + namespaceName: string; + projectName: string; + componentName: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description Component deleted successfully */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + 'application/json': components['schemas']['APIResponse']; + }; + }; + /** @description Component not found */ + 404: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + }; + }; patchComponent: { parameters: { query?: never; header?: never; path: { - orgName: string; + namespaceName: string; projectName: string; componentName: string; }; @@ -2528,7 +2787,7 @@ export interface operations { query?: never; header?: never; path: { - orgName: string; + namespaceName: string; projectName: string; componentName: string; }; @@ -2561,7 +2820,7 @@ export interface operations { query?: never; header?: never; path: { - orgName: string; + namespaceName: string; projectName: string; componentName: string; }; @@ -2611,7 +2870,7 @@ export interface operations { query?: never; header?: never; path: { - orgName: string; + namespaceName: string; projectName: string; componentName: string; }; @@ -2665,7 +2924,7 @@ export interface operations { query?: never; header?: never; path: { - orgName: string; + namespaceName: string; projectName: string; componentName: string; }; @@ -2695,7 +2954,7 @@ export interface operations { query?: never; header?: never; path: { - orgName: string; + namespaceName: string; projectName: string; componentName: string; }; @@ -2726,7 +2985,7 @@ export interface operations { }; header?: never; path: { - orgName: string; + namespaceName: string; projectName: string; componentName: string; }; @@ -2759,7 +3018,7 @@ export interface operations { query?: never; header?: never; path: { - orgName: string; + namespaceName: string; projectName: string; componentName: string; runName: string; @@ -2793,7 +3052,7 @@ export interface operations { query?: never; header?: never; path: { - orgName: string; + namespaceName: string; projectName: string; componentName: string; }; @@ -2821,7 +3080,7 @@ export interface operations { query?: never; header?: never; path: { - orgName: string; + namespaceName: string; projectName: string; componentName: string; bindingName: string; @@ -2850,7 +3109,7 @@ export interface operations { query?: never; header?: never; path: { - orgName: string; + namespaceName: string; projectName: string; componentName: string; }; @@ -2878,7 +3137,7 @@ export interface operations { query?: never; header?: never; path: { - orgName: string; + namespaceName: string; projectName: string; componentName: string; }; @@ -2908,7 +3167,7 @@ export interface operations { query?: never; header?: never; path: { - orgName: string; + namespaceName: string; projectName: string; componentName: string; releaseName: string; @@ -2935,7 +3194,7 @@ export interface operations { query?: never; header?: never; path: { - orgName: string; + namespaceName: string; projectName: string; componentName: string; releaseName: string; @@ -2969,7 +3228,7 @@ export interface operations { query?: never; header?: never; path: { - orgName: string; + namespaceName: string; projectName: string; componentName: string; }; @@ -2997,7 +3256,7 @@ export interface operations { query?: never; header?: never; path: { - orgName: string; + namespaceName: string; projectName: string; componentName: string; bindingName: string; @@ -3026,7 +3285,7 @@ export interface operations { query?: never; header?: never; path: { - orgName: string; + namespaceName: string; projectName: string; componentName: string; }; @@ -3054,7 +3313,7 @@ export interface operations { query?: never; header?: never; path: { - orgName: string; + namespaceName: string; projectName: string; componentName: string; }; @@ -3086,7 +3345,7 @@ export interface operations { query?: never; header?: never; path: { - orgName: string; + namespaceName: string; projectName: string; componentName: string; environmentName: string; @@ -3113,7 +3372,7 @@ export interface operations { query?: never; header?: never; path: { - orgName: string; + namespaceName: string; projectName: string; componentName: string; }; @@ -3139,7 +3398,7 @@ export interface operations { query?: never; header?: never; path: { - orgName: string; + namespaceName: string; projectName: string; componentName: string; environmentName: string; @@ -3173,7 +3432,7 @@ export interface operations { query?: never; header?: never; path: { - orgName: string; + namespaceName: string; projectName: string; componentName: string; }; @@ -3199,7 +3458,7 @@ export interface operations { query?: never; header?: never; path: { - orgName: string; + namespaceName: string; projectName: string; componentName: string; }; diff --git a/plugins/catalog-backend-module-openchoreo/src/converters/CtdToTemplateConverter.test.ts b/plugins/catalog-backend-module-openchoreo/src/converters/CtdToTemplateConverter.test.ts index 56741fd6..ed7c677d 100644 --- a/plugins/catalog-backend-module-openchoreo/src/converters/CtdToTemplateConverter.test.ts +++ b/plugins/catalog-backend-module-openchoreo/src/converters/CtdToTemplateConverter.test.ts @@ -156,12 +156,12 @@ describe('CtdToTemplateConverter', () => { // First section should be Component Metadata expect(parameters[0].title).toBe('Component Metadata'); expect(parameters[0].required).toEqual([ - 'organization_name', + 'namespace_name', 'project_name', 'component_name', ]); expect(parameters[0].properties.component_name).toBeDefined(); - expect(parameters[0].properties.organization_name).toBeDefined(); + expect(parameters[0].properties.namespace_name).toBeDefined(); expect(parameters[0].properties.project_name).toBeDefined(); expect(parameters[0].properties.displayName).toBeDefined(); expect(parameters[0].properties.description).toBeDefined(); @@ -170,9 +170,7 @@ describe('CtdToTemplateConverter', () => { expect(parameters[0].properties.component_name['ui:field']).toBe( 'EntityNamePicker', ); - expect(parameters[0].properties.organization_name['ui:disabled']).toBe( - true, - ); // Organization is fixed from CTD + expect(parameters[0].properties.namespace_name['ui:disabled']).toBe(true); // Namespace is fixed from CTD expect(parameters[0].properties.project_name['ui:field']).toBe( 'EntityPicker', ); @@ -605,7 +603,7 @@ describe('CtdToTemplateConverter', () => { const steps = result.spec?.steps as any[]; const input = steps[0].input; - expect(input.orgName).toBe('${{ parameters.organization_name }}'); + expect(input.namespaceName).toBe('${{ parameters.namespace_name }}'); expect(input.projectName).toBe('${{ parameters.project_name }}'); expect(input.componentName).toBe('${{ parameters.component_name }}'); expect(input.displayName).toBe('${{ parameters.displayName }}'); diff --git a/plugins/catalog-backend-module-openchoreo/src/converters/CtdToTemplateConverter.ts b/plugins/catalog-backend-module-openchoreo/src/converters/CtdToTemplateConverter.ts index 2d429054..9ae5fa06 100644 --- a/plugins/catalog-backend-module-openchoreo/src/converters/CtdToTemplateConverter.ts +++ b/plugins/catalog-backend-module-openchoreo/src/converters/CtdToTemplateConverter.ts @@ -39,7 +39,7 @@ export class CtdToTemplateConverter { */ convertCtdToTemplateEntity( componentType: ComponentType, - organizationName: string, + namespaceName: string, ): Entity { const templateName = this.generateTemplateName(componentType.metadata.name); const title = @@ -76,7 +76,7 @@ export class CtdToTemplateConverter { type: 'Component Type', // All component type templates use 'Component Type' type // Enable user token injection for user-based authorization at OpenChoreo API EXPERIMENTAL_formDecorators: [{ id: 'openchoreo:inject-user-token' }], - parameters: this.generateParameters(componentType, organizationName), + parameters: this.generateParameters(componentType, namespaceName), steps: this.generateSteps(componentType), output: { links: [ @@ -147,14 +147,14 @@ export class CtdToTemplateConverter { */ private generateParameters( componentType: ComponentType, - organizationName: string, + namespaceName: string, ): any[] { const parameters: any[] = []; // Section 1: Component Metadata (standard fields) parameters.push({ title: 'Component Metadata', - required: ['organization_name', 'project_name', 'component_name'], + required: ['namespace_name', 'project_name', 'component_name'], properties: { component_name: { title: 'Component Name', @@ -172,11 +172,11 @@ export class CtdToTemplateConverter { type: 'string', description: 'Brief description of what this component does', }, - organization_name: { - title: 'Organization', + namespace_name: { + title: 'Namespace', type: 'string', description: 'Auto selected based on Component Type', - default: organizationName, + default: namespaceName, 'ui:disabled': true, }, project_name: { @@ -211,12 +211,10 @@ export class CtdToTemplateConverter { } // Section 3: CI/CD Setup (always shown - workflows fetched dynamically if not in allowedWorkflows) - parameters.push( - this.generateCISetupSection(componentType, organizationName), - ); + parameters.push(this.generateCISetupSection(componentType, namespaceName)); // Section 4: Traits - parameters.push(this.generateTraitsSection(organizationName)); + parameters.push(this.generateTraitsSection(namespaceName)); return parameters; } @@ -228,7 +226,7 @@ export class CtdToTemplateConverter { */ private generateCISetupSection( componentType: ComponentType, - organizationName: string, + namespaceName: string, ): any { const hasAllowedWorkflows = componentType.metadata.allowedWorkflows && @@ -241,7 +239,7 @@ export class CtdToTemplateConverter { description: 'Select the build workflow to use for this component', 'ui:field': 'BuildWorkflowPicker', 'ui:options': { - organizationName: organizationName, + namespaceName: namespaceName, }, }; @@ -306,7 +304,7 @@ export class CtdToTemplateConverter { * Generate Traits section * Allows users to add multiple traits to the component */ - private generateTraitsSection(organizationName: string): any { + private generateTraitsSection(namespaceName: string): any { return { title: 'Traits', description: @@ -319,7 +317,7 @@ export class CtdToTemplateConverter { 'Select and configure traits for your component. You can add multiple traits.', 'ui:field': 'TraitsField', 'ui:options': { - organizationName: organizationName, + namespaceName: namespaceName, }, items: { type: 'object', @@ -569,8 +567,8 @@ export class CtdToTemplateConverter { name: 'Create OpenChoreo Component', action: 'openchoreo:component:create', input: { - // Section 1: Component Metadata (use old field names for backward compatibility) - orgName: '${{ parameters.organization_name }}', + // Section 1: Component Metadata + namespaceName: '${{ parameters.namespace_name }}', projectName: '${{ parameters.project_name }}', componentName: '${{ parameters.component_name }}', displayName: '${{ parameters.displayName }}', diff --git a/plugins/catalog-backend-module-openchoreo/src/kinds/DataplaneEntityV1alpha1.ts b/plugins/catalog-backend-module-openchoreo/src/kinds/DataplaneEntityV1alpha1.ts index 274e9a1b..9d1f7bbe 100644 --- a/plugins/catalog-backend-module-openchoreo/src/kinds/DataplaneEntityV1alpha1.ts +++ b/plugins/catalog-backend-module-openchoreo/src/kinds/DataplaneEntityV1alpha1.ts @@ -39,9 +39,9 @@ export interface DataplaneEntityV1alpha1 extends Entity { */ publicVirtualHost?: string; /** - * Organization virtual host for this dataplane + * Namespace virtual host for this dataplane */ - organizationVirtualHost?: string; + namespaceVirtualHost?: string; /** * Public HTTP port */ @@ -51,13 +51,13 @@ export interface DataplaneEntityV1alpha1 extends Entity { */ publicHTTPSPort?: number; /** - * Organization HTTP port + * Namespace HTTP port */ - organizationHTTPPort?: number; + namespaceHTTPPort?: number; /** - * Organization HTTPS port + * Namespace HTTPS port */ - organizationHTTPSPort?: number; + namespaceHTTPSPort?: number; /** * Observability plane reference */ diff --git a/plugins/catalog-backend-module-openchoreo/src/provider/OpenChoreoEntityProvider.ts b/plugins/catalog-backend-module-openchoreo/src/provider/OpenChoreoEntityProvider.ts index 9050ca58..00123631 100644 --- a/plugins/catalog-backend-module-openchoreo/src/provider/OpenChoreoEntityProvider.ts +++ b/plugins/catalog-backend-module-openchoreo/src/provider/OpenChoreoEntityProvider.ts @@ -14,8 +14,7 @@ import { OpenChoreoTokenService } from '@openchoreo/openchoreo-auth'; // Use generated types from OpenAPI spec type ModelsProject = OpenChoreoComponents['schemas']['ProjectResponse']; -type ModelsOrganization = - OpenChoreoComponents['schemas']['OrganizationResponse']; +type ModelsNamespace = OpenChoreoComponents['schemas']['NamespaceResponse']; type ModelsComponent = OpenChoreoComponents['schemas']['ComponentResponse']; type ModelsEnvironment = OpenChoreoComponents['schemas']['EnvironmentResponse']; type ModelsDataPlane = OpenChoreoComponents['schemas']['DataPlaneResponse']; @@ -95,9 +94,7 @@ export class OpenChoreoEntityProvider implements EntityProvider { } try { - this.logger.info( - 'Fetching organizations and projects from OpenChoreo API', - ); + this.logger.info('Fetching namespaces and projects from OpenChoreo API'); // Get service token for background task (client credentials flow) let token: string | undefined; @@ -119,52 +116,52 @@ export class OpenChoreoEntityProvider implements EntityProvider { logger: this.logger, }); - // First, get all organizations + // First, get all namespaces const { - data: orgData, - error: orgError, - response: orgResponse, - } = await client.GET('/orgs'); + data: nsData, + error: nsError, + response: nsResponse, + } = await client.GET('/namespaces'); - if (orgError || !orgResponse.ok) { + if (nsError || !nsResponse.ok) { throw new Error( - `Failed to fetch organizations: ${orgResponse.status} ${orgResponse.statusText}`, + `Failed to fetch namespaces: ${nsResponse.status} ${nsResponse.statusText}`, ); } - if (!orgData.success || !orgData.data?.items) { - throw new Error('Failed to retrieve organization list'); + if (!nsData.success || !nsData.data?.items) { + throw new Error('Failed to retrieve namespace list'); } - const organizations = orgData.data.items as ModelsOrganization[]; + const namespaces = nsData.data.items as ModelsNamespace[]; this.logger.debug( - `Found ${organizations.length} organizations from OpenChoreo`, + `Found ${namespaces.length} namespaces from OpenChoreo`, ); const allEntities: Entity[] = []; - // Create Domain entities for each organization - const domainEntities: Entity[] = organizations.map(org => - this.translateOrganizationToDomain(org), + // Create Domain entities for each namespace + const domainEntities: Entity[] = namespaces.map(ns => + this.translateNamespaceToDomain(ns), ); allEntities.push(...domainEntities); - // Get environments for each organization and create Environment entities - for (const org of organizations) { + // Get environments for each namespace and create Environment entities + for (const ns of namespaces) { try { const { data: envData, error: envError, response: envResponse, - } = await client.GET('/orgs/{orgName}/environments', { + } = await client.GET('/namespaces/{namespaceName}/environments', { params: { - path: { orgName: org.name! }, + path: { namespaceName: ns.name! }, }, }); if (envError || !envResponse.ok) { this.logger.warn( - `Failed to fetch environments for organization ${org.name}: ${envResponse.status}`, + `Failed to fetch environments for namespace ${ns.name}: ${envResponse.status}`, ); continue; } @@ -174,36 +171,36 @@ export class OpenChoreoEntityProvider implements EntityProvider { ? (envData.data.items as ModelsEnvironment[]) : []; this.logger.debug( - `Found ${environments.length} environments in organization: ${org.name}`, + `Found ${environments.length} environments in namespace: ${ns.name}`, ); const environmentEntities: Entity[] = environments.map(environment => - this.translateEnvironmentToEntity(environment, org.name!), + this.translateEnvironmentToEntity(environment, ns.name!), ); allEntities.push(...environmentEntities); } catch (error) { this.logger.warn( - `Failed to fetch environments for organization ${org.name}: ${error}`, + `Failed to fetch environments for namespace ${ns.name}: ${error}`, ); } } - // Get dataplanes for each organization and create Dataplane entities - for (const org of organizations) { + // Get dataplanes for each namespace and create Dataplane entities + for (const ns of namespaces) { try { const { data: dpData, error: dpError, response: dpResponse, - } = await client.GET('/orgs/{orgName}/dataplanes', { + } = await client.GET('/namespaces/{namespaceName}/dataplanes', { params: { - path: { orgName: org.name! }, + path: { namespaceName: ns.name! }, }, }); if (dpError || !dpResponse.ok) { this.logger.warn( - `Failed to fetch dataplanes for organization ${org.name}: ${dpResponse.status}`, + `Failed to fetch dataplanes for namespace ${ns.name}: ${dpResponse.status}`, ); continue; } @@ -213,36 +210,36 @@ export class OpenChoreoEntityProvider implements EntityProvider { ? (dpData.data.items as ModelsDataPlane[]) : []; this.logger.debug( - `Found ${dataplanes.length} dataplanes in organization: ${org.name}`, + `Found ${dataplanes.length} dataplanes in namespace: ${ns.name}`, ); const dataplaneEntities: Entity[] = dataplanes.map(dataplane => - this.translateDataplaneToEntity(dataplane, org.name!), + this.translateDataplaneToEntity(dataplane, ns.name!), ); allEntities.push(...dataplaneEntities); } catch (error) { this.logger.warn( - `Failed to fetch dataplanes for organization ${org.name}: ${error}`, + `Failed to fetch dataplanes for namespace ${ns.name}: ${error}`, ); } } - // Get projects for each organization and create System entities - for (const org of organizations) { + // Get projects for each namespace and create System entities + for (const ns of namespaces) { try { const { data: projData, error: projError, response: projResponse, - } = await client.GET('/orgs/{orgName}/projects', { + } = await client.GET('/namespaces/{namespaceName}/projects', { params: { - path: { orgName: org.name! }, + path: { namespaceName: ns.name! }, }, }); if (projError || !projResponse.ok) { this.logger.warn( - `Failed to fetch projects for organization ${org.name}: ${projResponse.status}`, + `Failed to fetch projects for namespace ${ns.name}: ${projResponse.status}`, ); continue; } @@ -252,11 +249,11 @@ export class OpenChoreoEntityProvider implements EntityProvider { ? (projData.data.items as ModelsProject[]) : []; this.logger.debug( - `Found ${projects.length} projects in organization: ${org.name}`, + `Found ${projects.length} projects in namespace: ${ns.name}`, ); const systemEntities: Entity[] = projects.map(project => - this.translateProjectToEntity(project, org.name!), + this.translateProjectToEntity(project, ns.name!), ); allEntities.push(...systemEntities); @@ -268,10 +265,13 @@ export class OpenChoreoEntityProvider implements EntityProvider { error: compError, response: compResponse, } = await client.GET( - '/orgs/{orgName}/projects/{projectName}/components', + '/namespaces/{namespaceName}/projects/{projectName}/components', { params: { - path: { orgName: org.name!, projectName: project.name! }, + path: { + namespaceName: ns.name!, + projectName: project.name!, + }, }, }, ); @@ -303,11 +303,11 @@ export class OpenChoreoEntityProvider implements EntityProvider { error: detailError, response: detailResponse, } = await client.GET( - '/orgs/{orgName}/projects/{projectName}/components/{componentName}', + '/namespaces/{namespaceName}/projects/{projectName}/components/{componentName}', { params: { path: { - orgName: org.name!, + namespaceName: ns.name!, projectName: project.name!, componentName: component.name!, }, @@ -330,7 +330,7 @@ export class OpenChoreoEntityProvider implements EntityProvider { // Fallback to basic component entity const componentEntity = this.translateComponentToEntity( component, - org.name!, + ns.name!, project.name!, ); allEntities.push(componentEntity); @@ -343,7 +343,7 @@ export class OpenChoreoEntityProvider implements EntityProvider { const componentEntity = this.translateServiceComponentToEntity( completeComponent, - org.name!, + ns.name!, project.name!, ); allEntities.push(componentEntity); @@ -352,7 +352,7 @@ export class OpenChoreoEntityProvider implements EntityProvider { if (completeComponent.workload?.endpoints) { const apiEntities = this.createApiEntitiesFromWorkload( completeComponent, - org.name!, + ns.name!, project.name!, ); allEntities.push(...apiEntities); @@ -364,7 +364,7 @@ export class OpenChoreoEntityProvider implements EntityProvider { // Fallback to basic component entity const componentEntity = this.translateComponentToEntity( component, - org.name!, + ns.name!, project.name!, ); allEntities.push(componentEntity); @@ -373,7 +373,7 @@ export class OpenChoreoEntityProvider implements EntityProvider { // Create basic component entity for non-Service components const componentEntity = this.translateComponentToEntity( component, - org.name!, + ns.name!, project.name!, ); allEntities.push(componentEntity); @@ -381,23 +381,23 @@ export class OpenChoreoEntityProvider implements EntityProvider { } } catch (error) { this.logger.warn( - `Failed to fetch components for project ${project.name} in organization ${org.name}: ${error}`, + `Failed to fetch components for project ${project.name} in namespace ${ns.name}: ${error}`, ); } } } catch (error) { this.logger.warn( - `Failed to fetch projects for organization ${org.name}: ${error}`, + `Failed to fetch projects for namespace ${ns.name}: ${error}`, ); } } // Fetch Component Type Definitions and generate Template entities // Use the new two-step API: list + schema for each CTD - for (const org of organizations) { + for (const ns of namespaces) { try { this.logger.info( - `Fetching Component Type Definitions from OpenChoreo API for org: ${org.name}`, + `Fetching Component Type Definitions from OpenChoreo API for namespace: ${ns.name}`, ); // Step 1: List CTDs (complete metadata including allowedWorkflows) @@ -405,9 +405,9 @@ export class OpenChoreoEntityProvider implements EntityProvider { data: listData, error: listError, response: listResponse, - } = await client.GET('/orgs/{orgName}/component-types', { + } = await client.GET('/namespaces/{namespaceName}/component-types', { params: { - path: { orgName: org.name! }, + path: { namespaceName: ns.name! }, }, }); @@ -418,7 +418,7 @@ export class OpenChoreoEntityProvider implements EntityProvider { !listData.data?.items ) { this.logger.warn( - `Failed to fetch component types for org ${org.name}: ${listResponse.status}`, + `Failed to fetch component types for namespace ${ns.name}: ${listResponse.status}`, ); continue; } @@ -426,7 +426,7 @@ export class OpenChoreoEntityProvider implements EntityProvider { const componentTypeItems = listData.data .items as OpenChoreoComponents['schemas']['ComponentTypeResponse'][]; this.logger.debug( - `Found ${componentTypeItems.length} CTDs in organization: ${org.name} (total: ${listData.data.totalCount})`, + `Found ${componentTypeItems.length} CTDs in namespace: ${ns.name} (total: ${listData.data.totalCount})`, ); // Step 2: Fetch schemas in parallel for better performance @@ -438,10 +438,10 @@ export class OpenChoreoEntityProvider implements EntityProvider { error: schemaError, response: schemaResponse, } = await client.GET( - '/orgs/{orgName}/component-types/{ctName}/schema', + '/namespaces/{namespaceName}/component-types/{ctName}/schema', { params: { - path: { orgName: org.name!, ctName: listItem.name! }, + path: { namespaceName: ns.name!, ctName: listItem.name! }, }, }, ); @@ -453,7 +453,7 @@ export class OpenChoreoEntityProvider implements EntityProvider { !schemaData?.data ) { this.logger.warn( - `Failed to fetch schema for CTD ${listItem.name} in org ${org.name}: ${schemaResponse.status}`, + `Failed to fetch schema for CTD ${listItem.name} in namespace ${ns.name}: ${schemaResponse.status}`, ); return null; } @@ -476,7 +476,7 @@ export class OpenChoreoEntityProvider implements EntityProvider { return fullComponentType; } catch (error) { this.logger.warn( - `Failed to fetch schema for CTD ${listItem.name} in org ${org.name}: ${error}`, + `Failed to fetch schema for CTD ${listItem.name} in namespace ${ns.name}: ${error}`, ); return null; } @@ -493,7 +493,7 @@ export class OpenChoreoEntityProvider implements EntityProvider { .map(ctd => { try { const templateEntity = - this.ctdConverter.convertCtdToTemplateEntity(ctd, org.name!); + this.ctdConverter.convertCtdToTemplateEntity(ctd, ns.name!); // Add the required Backstage catalog annotations if (!templateEntity.metadata.annotations) { templateEntity.metadata.annotations = {}; @@ -516,11 +516,11 @@ export class OpenChoreoEntityProvider implements EntityProvider { allEntities.push(...templateEntities); this.logger.info( - `Successfully generated ${templateEntities.length} template entities from CTDs in org: ${org.name}`, + `Successfully generated ${templateEntities.length} template entities from CTDs in namespace: ${ns.name}`, ); } catch (error) { this.logger.warn( - `Failed to fetch Component Type Definitions for org ${org.name}: ${error}`, + `Failed to fetch Component Type Definitions for namespace ${ns.name}: ${error}`, ); } } @@ -550,32 +550,27 @@ export class OpenChoreoEntityProvider implements EntityProvider { } /** - * Translates a ModelsOrganization from OpenChoreo API to a Backstage Domain entity + * Translates a ModelsNamespace from OpenChoreo API to a Backstage Domain entity */ - private translateOrganizationToDomain( - organization: ModelsOrganization, - ): Entity { + private translateNamespaceToDomain(namespace: ModelsNamespace): Entity { const domainEntity: Entity = { apiVersion: 'backstage.io/v1alpha1', kind: 'Domain', metadata: { - name: organization.name, - title: organization.displayName || organization.name, - description: organization.description || organization.name, + name: namespace.name, + title: namespace.displayName || namespace.name, + description: namespace.description || namespace.name, // namespace: 'default', - tags: ['openchoreo', 'organization', 'domain'], + tags: ['openchoreo', 'namespace', 'domain'], annotations: { 'backstage.io/managed-by-location': `provider:${this.getProviderName()}`, 'backstage.io/managed-by-origin-location': `provider:${this.getProviderName()}`, - [CHOREO_ANNOTATIONS.ORGANIZATION]: organization.name, - ...(organization.namespace && { - [CHOREO_ANNOTATIONS.NAMESPACE]: organization.namespace, - }), - ...(organization.createdAt && { - [CHOREO_ANNOTATIONS.CREATED_AT]: organization.createdAt, + [CHOREO_ANNOTATIONS.NAMESPACE]: namespace.name, + ...(namespace.createdAt && { + [CHOREO_ANNOTATIONS.CREATED_AT]: namespace.createdAt, }), - ...(organization.status && { - [CHOREO_ANNOTATIONS.STATUS]: organization.status, + ...(namespace.status && { + [CHOREO_ANNOTATIONS.STATUS]: namespace.status, }), }, labels: { @@ -595,7 +590,7 @@ export class OpenChoreoEntityProvider implements EntityProvider { */ private translateProjectToEntity( project: ModelsProject, - orgName: string, + namespaceName: string, ): Entity { const systemEntity: Entity = { apiVersion: 'backstage.io/v1alpha1', @@ -604,7 +599,7 @@ export class OpenChoreoEntityProvider implements EntityProvider { name: project.name, title: project.displayName || project.name, description: project.description || project.name, - namespace: project.orgName, + namespace: project.namespaceName, tags: ['openchoreo', 'project'], annotations: { 'backstage.io/managed-by-location': `provider:${this.getProviderName()}`, @@ -613,7 +608,7 @@ export class OpenChoreoEntityProvider implements EntityProvider { ...(project.uid && { [CHOREO_ANNOTATIONS.PROJECT_UID]: project.uid, }), - [CHOREO_ANNOTATIONS.ORGANIZATION]: orgName, + [CHOREO_ANNOTATIONS.NAMESPACE]: namespaceName, }, labels: { 'openchoreo.io/managed': 'true', @@ -622,7 +617,7 @@ export class OpenChoreoEntityProvider implements EntityProvider { }, spec: { owner: this.defaultOwner, - domain: orgName, + domain: namespaceName, }, }; @@ -634,7 +629,7 @@ export class OpenChoreoEntityProvider implements EntityProvider { */ private translateEnvironmentToEntity( environment: ModelsEnvironment, - orgName: string, + namespaceName: string, ): EnvironmentEntityV1alpha1 { const environmentEntity: EnvironmentEntityV1alpha1 = { apiVersion: 'backstage.io/v1alpha1', @@ -653,13 +648,10 @@ export class OpenChoreoEntityProvider implements EntityProvider { 'backstage.io/managed-by-location': `provider:${this.getProviderName()}`, 'backstage.io/managed-by-origin-location': `provider:${this.getProviderName()}`, [CHOREO_ANNOTATIONS.ENVIRONMENT]: environment.name, - [CHOREO_ANNOTATIONS.ORGANIZATION]: orgName, + [CHOREO_ANNOTATIONS.NAMESPACE]: namespaceName, ...(environment.uid && { [CHOREO_ANNOTATIONS.ENVIRONMENT_UID]: environment.uid, }), - ...(environment.namespace && { - [CHOREO_ANNOTATIONS.NAMESPACE]: environment.namespace, - }), ...(environment.createdAt && { [CHOREO_ANNOTATIONS.CREATED_AT]: environment.createdAt, }), @@ -688,7 +680,7 @@ export class OpenChoreoEntityProvider implements EntityProvider { spec: { type: environment.isProduction ? 'production' : 'non-production', owner: 'guests', // This could be configured or mapped from environment metadata - domain: orgName, // Link to the parent domain (organization) + domain: namespaceName, // Link to the parent domain (namespace) isProduction: environment.isProduction, dataPlaneRef: environment.dataPlaneRef, dnsPrefix: environment.dnsPrefix, @@ -703,7 +695,7 @@ export class OpenChoreoEntityProvider implements EntityProvider { */ private translateDataplaneToEntity( dataplane: ModelsDataPlane, - orgName: string, + namespaceName: string, ): DataplaneEntityV1alpha1 { const dataplaneEntity: DataplaneEntityV1alpha1 = { apiVersion: 'backstage.io/v1alpha1', @@ -716,22 +708,21 @@ export class OpenChoreoEntityProvider implements EntityProvider { annotations: { 'backstage.io/managed-by-location': `provider:${this.getProviderName()}`, 'backstage.io/managed-by-origin-location': `provider:${this.getProviderName()}`, - [CHOREO_ANNOTATIONS.ORGANIZATION]: orgName, - [CHOREO_ANNOTATIONS.NAMESPACE]: dataplane.namespace || '', + [CHOREO_ANNOTATIONS.NAMESPACE]: namespaceName, [CHOREO_ANNOTATIONS.CREATED_AT]: dataplane.createdAt || '', [CHOREO_ANNOTATIONS.STATUS]: dataplane.status || '', 'openchoreo.io/public-virtual-host': dataplane.publicVirtualHost || '', - 'openchoreo.io/organization-virtual-host': - dataplane.organizationVirtualHost || '', + 'openchoreo.io/namespace-virtual-host': + dataplane.namespaceVirtualHost || '', 'openchoreo.io/public-http-port': dataplane.publicHTTPPort?.toString() || '', 'openchoreo.io/public-https-port': dataplane.publicHTTPSPort?.toString() || '', - 'openchoreo.io/organization-http-port': - dataplane.organizationHTTPPort?.toString() || '', - 'openchoreo.io/organization-https-port': - dataplane.organizationHTTPSPort?.toString() || '', + 'openchoreo.io/namespace-http-port': + dataplane.namespaceHTTPPort?.toString() || '', + 'openchoreo.io/namespace-https-port': + dataplane.namespaceHTTPSPort?.toString() || '', 'openchoreo.io/observability-plane-ref': dataplane.observabilityPlaneRef || '', }, @@ -743,13 +734,13 @@ export class OpenChoreoEntityProvider implements EntityProvider { spec: { type: 'kubernetes', owner: 'guests', // This could be configured or mapped from dataplane metadata - domain: orgName, // Link to the parent domain (organization) + domain: namespaceName, // Link to the parent domain (namespace) publicVirtualHost: dataplane.publicVirtualHost, - organizationVirtualHost: dataplane.organizationVirtualHost, + namespaceVirtualHost: dataplane.namespaceVirtualHost, publicHTTPPort: dataplane.publicHTTPPort, publicHTTPSPort: dataplane.publicHTTPSPort, - organizationHTTPPort: dataplane.organizationHTTPPort, - organizationHTTPSPort: dataplane.organizationHTTPSPort, + namespaceHTTPPort: dataplane.namespaceHTTPPort, + namespaceHTTPSPort: dataplane.namespaceHTTPSPort, observabilityPlaneRef: dataplane.observabilityPlaneRef, }, }; @@ -763,13 +754,13 @@ export class OpenChoreoEntityProvider implements EntityProvider { */ private translateComponentToEntity( component: ModelsComponent, - orgName: string, + namespaceName: string, projectName: string, providesApis?: string[], ): Entity { return translateComponent( component, - orgName, + namespaceName, projectName, { defaultOwner: this.defaultOwner, @@ -785,7 +776,7 @@ export class OpenChoreoEntityProvider implements EntityProvider { */ private translateServiceComponentToEntity( completeComponent: ModelsCompleteComponent, - orgName: string, + namespaceName: string, projectName: string, ): Entity { // Generate API names for providesApis @@ -801,7 +792,7 @@ export class OpenChoreoEntityProvider implements EntityProvider { // Reuse the base translateComponentToEntity method return this.translateComponentToEntity( completeComponent, - orgName, + namespaceName, projectName, providesApis, ); @@ -812,7 +803,7 @@ export class OpenChoreoEntityProvider implements EntityProvider { */ private createApiEntitiesFromWorkload( completeComponent: ModelsCompleteComponent, - orgName: string, + namespaceName: string, projectName: string, ): Entity[] { const apiEntities: Entity[] = []; @@ -839,7 +830,7 @@ export class OpenChoreoEntityProvider implements EntityProvider { [CHOREO_ANNOTATIONS.ENDPOINT_TYPE]: endpoint.type, [CHOREO_ANNOTATIONS.ENDPOINT_PORT]: endpoint.port.toString(), [CHOREO_ANNOTATIONS.PROJECT]: projectName, - [CHOREO_ANNOTATIONS.ORGANIZATION]: orgName, + [CHOREO_ANNOTATIONS.NAMESPACE]: namespaceName, }, labels: { 'openchoreo.io/managed': 'true', diff --git a/plugins/catalog-backend-module-openchoreo/src/utils/entityTranslation.ts b/plugins/catalog-backend-module-openchoreo/src/utils/entityTranslation.ts index 913351ee..42cd5298 100644 --- a/plugins/catalog-backend-module-openchoreo/src/utils/entityTranslation.ts +++ b/plugins/catalog-backend-module-openchoreo/src/utils/entityTranslation.ts @@ -33,7 +33,7 @@ export interface ComponentEntityTranslationConfig { * and immediate insertion (scaffolder action) to ensure consistency. * * @param component - Component from OpenChoreo API - * @param orgName - Organization name + * @param namespaceName - Namespace name * @param projectName - Project name * @param config - Translation configuration * @param providesApis - Optional list of API entity refs this component provides @@ -41,7 +41,7 @@ export interface ComponentEntityTranslationConfig { */ export function translateComponentToEntity( component: ModelsComponent, - orgName: string, + namespaceName: string, projectName: string, config: ComponentEntityTranslationConfig, providesApis?: string[], @@ -52,7 +52,7 @@ export function translateComponentToEntity( metadata: { name: component.name, title: component.name, - namespace: orgName, + namespace: namespaceName, ...(component.description && { description: component.description }), tags: config.componentTypeUtils.generateTags(component.type || 'unknown'), annotations: { @@ -66,7 +66,7 @@ export function translateComponentToEntity( [CHOREO_ANNOTATIONS.COMPONENT_TYPE]: component.type, }), [CHOREO_ANNOTATIONS.PROJECT]: projectName, - [CHOREO_ANNOTATIONS.ORGANIZATION]: orgName, + [CHOREO_ANNOTATIONS.NAMESPACE]: namespaceName, ...(component.createdAt && { [CHOREO_ANNOTATIONS.CREATED_AT]: component.createdAt, }), diff --git a/plugins/openchoreo-backend/src/router.ts b/plugins/openchoreo-backend/src/router.ts index 1d362a18..07ee3427 100644 --- a/plugins/openchoreo-backend/src/router.ts +++ b/plugins/openchoreo-backend/src/router.ts @@ -64,11 +64,11 @@ export async function createRouter({ const requireAuth = createRequireAuthMiddleware(tokenService, authEnabled); router.get('/deploy', async (req, res) => { - const { componentName, projectName, organizationName } = req.query; + const { componentName, projectName, namespaceName } = req.query; - if (!componentName || !projectName || !organizationName) { + if (!componentName || !projectName || !namespaceName) { throw new InputError( - 'componentName, projectName and organizationName are required query parameters', + 'componentName, projectName and namespaceName are required query parameters', ); } @@ -79,7 +79,7 @@ export async function createRouter({ { componentName: componentName as string, projectName: projectName as string, - organizationName: organizationName as string, + namespaceName: namespaceName as string, }, userToken, ), @@ -87,7 +87,7 @@ export async function createRouter({ }); router.post('/promote-deployment', requireAuth, async (req, res) => { - const { sourceEnv, targetEnv, componentName, projectName, orgName } = + const { sourceEnv, targetEnv, componentName, projectName, namespaceName } = req.body; if ( @@ -95,10 +95,10 @@ export async function createRouter({ !targetEnv || !componentName || !projectName || - !orgName + !namespaceName ) { throw new InputError( - 'sourceEnv, targetEnv, componentName, projectName and orgName are required in request body', + 'sourceEnv, targetEnv, componentName, projectName and namespaceName are required in request body', ); } @@ -111,7 +111,7 @@ export async function createRouter({ targetEnvironment: targetEnv, componentName: componentName as string, projectName: projectName as string, - organizationName: orgName as string, + namespaceName: namespaceName as string, }, userToken, ), @@ -119,11 +119,11 @@ export async function createRouter({ }); router.delete('/delete-release-binding', requireAuth, async (req, res) => { - const { componentName, projectName, orgName, environment } = req.body; + const { componentName, projectName, namespaceName, environment } = req.body; - if (!componentName || !projectName || !orgName || !environment) { + if (!componentName || !projectName || !namespaceName || !environment) { throw new InputError( - 'componentName, projectName, orgName and environment are required in request body', + 'componentName, projectName, namespaceName and environment are required in request body', ); } @@ -134,7 +134,7 @@ export async function createRouter({ { componentName: componentName as string, projectName: projectName as string, - organizationName: orgName as string, + namespaceName: namespaceName as string, environment: environment as string, }, userToken, @@ -143,18 +143,23 @@ export async function createRouter({ }); router.patch('/update-binding', requireAuth, async (req, res) => { - const { componentName, projectName, orgName, bindingName, releaseState } = - req.body; + const { + componentName, + projectName, + namespaceName, + bindingName, + releaseState, + } = req.body; if ( !componentName || !projectName || - !orgName || + !namespaceName || !bindingName || !releaseState ) { throw new InputError( - 'componentName, projectName, orgName, bindingName and releaseState are required in request body', + 'componentName, projectName, namespaceName, bindingName and releaseState are required in request body', ); } @@ -171,7 +176,7 @@ export async function createRouter({ { componentName: componentName as string, projectName: projectName as string, - organizationName: orgName as string, + namespaceName: namespaceName as string, bindingName: bindingName as string, releaseState: releaseState as 'Active' | 'Suspend' | 'Undeploy', }, @@ -183,11 +188,11 @@ export async function createRouter({ router.get( '/cell-diagram', async (req: express.Request, res: express.Response) => { - const { projectName, organizationName } = req.query; + const { projectName, namespaceName } = req.query; - if (!projectName || !organizationName) { + if (!projectName || !namespaceName) { throw new InputError( - 'projectName and organizationName are required query parameters', + 'projectName and namespaceName are required query parameters', ); } @@ -197,7 +202,7 @@ export async function createRouter({ await cellDiagramInfoService.fetchProjectInfo( { projectName: projectName as string, - orgName: organizationName as string, + namespaceName: namespaceName as string, }, userToken, ), @@ -207,17 +212,17 @@ export async function createRouter({ // Endpoint for listing traits router.get('/traits', async (req, res) => { - const { organizationName, page, pageSize } = req.query; + const { namespaceName, page, pageSize } = req.query; - if (!organizationName) { - throw new InputError('organizationName is a required query parameter'); + if (!namespaceName) { + throw new InputError('namespaceName is a required query parameter'); } const userToken = getUserTokenFromRequest(req); res.json( await traitInfoService.fetchTraits( - organizationName as string, + namespaceName as string, page ? parseInt(page as string, 10) : undefined, pageSize ? parseInt(pageSize as string, 10) : undefined, userToken, @@ -227,10 +232,10 @@ export async function createRouter({ // Endpoint for fetching addon schema router.get('/trait-schema', async (req, res) => { - const { organizationName, traitName } = req.query; + const { namespaceName, traitName } = req.query; - if (!organizationName) { - throw new InputError('organizationName is a required query parameter'); + if (!namespaceName) { + throw new InputError('namespaceName is a required query parameter'); } if (!traitName) { @@ -241,7 +246,7 @@ export async function createRouter({ res.json( await traitInfoService.fetchTraitSchema( - organizationName as string, + namespaceName as string, traitName as string, userToken, ), @@ -250,11 +255,11 @@ export async function createRouter({ // Endpoint for listing component traits router.get('/component-traits', async (req, res) => { - const { organizationName, projectName, componentName } = req.query; + const { namespaceName, projectName, componentName } = req.query; - if (!organizationName || !projectName || !componentName) { + if (!namespaceName || !projectName || !componentName) { throw new InputError( - 'organizationName, projectName and componentName are required query parameters', + 'namespaceName, projectName and componentName are required query parameters', ); } @@ -262,7 +267,7 @@ export async function createRouter({ res.json( await traitInfoService.fetchComponentTraits( - organizationName as string, + namespaceName as string, projectName as string, componentName as string, userToken, @@ -272,11 +277,11 @@ export async function createRouter({ // Endpoint for updating component traits router.put('/component-traits', requireAuth, async (req, res) => { - const { organizationName, projectName, componentName, traits } = req.body; + const { namespaceName, projectName, componentName, traits } = req.body; - if (!organizationName || !projectName || !componentName) { + if (!namespaceName || !projectName || !componentName) { throw new InputError( - 'organizationName, projectName and componentName are required in request body', + 'namespaceName, projectName and componentName are required in request body', ); } @@ -288,7 +293,7 @@ export async function createRouter({ res.json( await traitInfoService.updateComponentTraits( - organizationName as string, + namespaceName as string, projectName as string, componentName as string, { traits }, @@ -297,11 +302,11 @@ export async function createRouter({ ); }); router.get('/builds', async (req, res) => { - const { componentName, projectName, organizationName } = req.query; + const { componentName, projectName, namespaceName } = req.query; - if (!componentName || !projectName || !organizationName) { + if (!componentName || !projectName || !namespaceName) { throw new InputError( - 'componentName, projectName and organizationName are required query parameters', + 'componentName, projectName and namespaceName are required query parameters', ); } @@ -309,7 +314,7 @@ export async function createRouter({ res.json( await buildInfoService.fetchBuilds( - organizationName as string, + namespaceName as string, projectName as string, componentName as string, userToken, @@ -318,11 +323,11 @@ export async function createRouter({ }); router.post('/builds', requireAuth, async (req, res) => { - const { componentName, projectName, organizationName, commit } = req.body; + const { componentName, projectName, namespaceName, commit } = req.body; - if (!componentName || !projectName || !organizationName) { + if (!componentName || !projectName || !namespaceName) { throw new InputError( - 'componentName, projectName and organizationName are required in request body', + 'componentName, projectName and namespaceName are required in request body', ); } @@ -330,7 +335,7 @@ export async function createRouter({ res.json( await buildInfoService.triggerBuild( - organizationName as string, + namespaceName as string, projectName as string, componentName as string, commit as string | undefined, @@ -340,11 +345,11 @@ export async function createRouter({ }); router.get('/component', async (req, res) => { - const { componentName, projectName, organizationName } = req.query; + const { componentName, projectName, namespaceName } = req.query; - if (!componentName || !projectName || !organizationName) { + if (!componentName || !projectName || !namespaceName) { throw new InputError( - 'componentName, projectName and organizationName are required query parameters', + 'componentName, projectName and namespaceName are required query parameters', ); } @@ -352,7 +357,7 @@ export async function createRouter({ res.json( await componentInfoService.fetchComponentDetails( - organizationName as string, + namespaceName as string, projectName as string, componentName as string, userToken, @@ -361,12 +366,11 @@ export async function createRouter({ }); router.patch('/component', requireAuth, async (req, res) => { - const { componentName, projectName, organizationName, autoDeploy } = - req.body; + const { componentName, projectName, namespaceName, autoDeploy } = req.body; - if (!componentName || !projectName || !organizationName) { + if (!componentName || !projectName || !namespaceName) { throw new InputError( - 'componentName, projectName and organizationName are required in request body', + 'componentName, projectName and namespaceName are required in request body', ); } @@ -378,7 +382,7 @@ export async function createRouter({ res.json( await componentInfoService.patchComponent( - organizationName as string, + namespaceName as string, projectName as string, componentName as string, autoDeploy as boolean, @@ -388,11 +392,11 @@ export async function createRouter({ }); router.get('/project', async (req, res) => { - const { projectName, organizationName } = req.query; + const { projectName, namespaceName } = req.query; - if (!projectName || !organizationName) { + if (!projectName || !namespaceName) { throw new InputError( - 'projectName and organizationName are required query parameters', + 'projectName and namespaceName are required query parameters', ); } @@ -400,7 +404,7 @@ export async function createRouter({ res.json( await projectInfoService.fetchProjectDetails( - organizationName as string, + namespaceName as string, projectName as string, userToken, ), @@ -408,11 +412,11 @@ export async function createRouter({ }); router.get('/deployment-pipeline', async (req, res) => { - const { projectName, organizationName } = req.query; + const { projectName, namespaceName } = req.query; - if (!projectName || !organizationName) { + if (!projectName || !namespaceName) { throw new InputError( - 'projectName and organizationName are required query parameters', + 'projectName and namespaceName are required query parameters', ); } @@ -420,7 +424,7 @@ export async function createRouter({ res.json( await projectInfoService.fetchProjectDeploymentPipeline( - organizationName as string, + namespaceName as string, projectName as string, userToken, ), @@ -428,7 +432,7 @@ export async function createRouter({ }); router.get('/build-logs', async (req, res) => { - const { componentName, buildId, buildUuid, projectName, orgName } = + const { componentName, buildId, buildUuid, projectName, namespaceName } = req.query; if (!componentName || !buildId || !buildUuid) { @@ -441,7 +445,7 @@ export async function createRouter({ try { const result = await buildInfoService.fetchBuildLogs( - orgName as string, + namespaceName as string, projectName as string, componentName as string, buildId as string, @@ -461,11 +465,11 @@ export async function createRouter({ }); router.get('/workload', async (req, res) => { - const { componentName, projectName, organizationName } = req.query; + const { componentName, projectName, namespaceName } = req.query; - if (!componentName || !projectName || !organizationName) { + if (!componentName || !projectName || !namespaceName) { throw new InputError( - 'componentName, projectName and organizationName are required query parameters', + 'componentName, projectName and namespaceName are required query parameters', ); } @@ -476,7 +480,7 @@ export async function createRouter({ { componentName: componentName as string, projectName: projectName as string, - organizationName: organizationName as string, + namespaceName: namespaceName as string, }, userToken, ); @@ -494,12 +498,12 @@ export async function createRouter({ }); router.post('/workload', requireAuth, async (req, res) => { - const { componentName, projectName, organizationName } = req.query; + const { componentName, projectName, namespaceName } = req.query; const workloadSpec = req.body; - if (!componentName || !projectName || !organizationName) { + if (!componentName || !projectName || !namespaceName) { throw new InputError( - 'componentName, projectName and organizationName are required query parameters', + 'componentName, projectName and namespaceName are required query parameters', ); } @@ -516,7 +520,7 @@ export async function createRouter({ { componentName: componentName as string, projectName: projectName as string, - organizationName: organizationName as string, + namespaceName: namespaceName as string, workloadSpec, }, userToken, @@ -562,12 +566,12 @@ export async function createRouter({ }); router.post('/create-release', requireAuth, async (req, res) => { - const { componentName, projectName, organizationName } = req.query; + const { componentName, projectName, namespaceName } = req.query; const { releaseName } = req.body; - if (!componentName || !projectName || !organizationName) { + if (!componentName || !projectName || !namespaceName) { throw new InputError( - 'componentName, projectName and organizationName are required query parameters', + 'componentName, projectName and namespaceName are required query parameters', ); } @@ -578,7 +582,7 @@ export async function createRouter({ { componentName: componentName as string, projectName: projectName as string, - organizationName: organizationName as string, + namespaceName: namespaceName as string, releaseName: releaseName as string | undefined, }, userToken, @@ -587,12 +591,12 @@ export async function createRouter({ }); router.post('/deploy-release', requireAuth, async (req, res) => { - const { componentName, projectName, organizationName } = req.query; + const { componentName, projectName, namespaceName } = req.query; const { releaseName } = req.body; - if (!componentName || !projectName || !organizationName) { + if (!componentName || !projectName || !namespaceName) { throw new InputError( - 'componentName, projectName and organizationName are required query parameters', + 'componentName, projectName and namespaceName are required query parameters', ); } @@ -607,7 +611,7 @@ export async function createRouter({ { componentName: componentName as string, projectName: projectName as string, - organizationName: organizationName as string, + namespaceName: namespaceName as string, releaseName: releaseName as string, }, userToken, @@ -616,12 +620,12 @@ export async function createRouter({ }); router.get('/component-release-schema', async (req, res) => { - const { componentName, projectName, organizationName, releaseName } = + const { componentName, projectName, namespaceName, releaseName } = req.query; - if (!componentName || !projectName || !organizationName || !releaseName) { + if (!componentName || !projectName || !namespaceName || !releaseName) { throw new InputError( - 'componentName, projectName, organizationName and releaseName are required query parameters', + 'componentName, projectName, namespaceName and releaseName are required query parameters', ); } @@ -632,7 +636,7 @@ export async function createRouter({ { componentName: componentName as string, projectName: projectName as string, - organizationName: organizationName as string, + namespaceName: namespaceName as string, releaseName: releaseName as string, }, userToken, @@ -641,11 +645,11 @@ export async function createRouter({ }); router.get('/release-bindings', async (req, res) => { - const { componentName, projectName, organizationName } = req.query; + const { componentName, projectName, namespaceName } = req.query; - if (!componentName || !projectName || !organizationName) { + if (!componentName || !projectName || !namespaceName) { throw new InputError( - 'componentName, projectName and organizationName are required query parameters', + 'componentName, projectName and namespaceName are required query parameters', ); } @@ -656,7 +660,7 @@ export async function createRouter({ { componentName: componentName as string, projectName: projectName as string, - organizationName: organizationName as string, + namespaceName: namespaceName as string, }, userToken, ), @@ -667,7 +671,7 @@ export async function createRouter({ const { componentName, projectName, - orgName, + namespaceName, environment, componentTypeEnvOverrides, traitOverrides, @@ -675,9 +679,9 @@ export async function createRouter({ releaseName, } = req.body; - if (!componentName || !projectName || !orgName || !environment) { + if (!componentName || !projectName || !namespaceName || !environment) { throw new InputError( - 'componentName, projectName, orgName and environment are required in request body', + 'componentName, projectName, namespaceName and environment are required in request body', ); } @@ -688,7 +692,7 @@ export async function createRouter({ { componentName: componentName as string, projectName: projectName as string, - organizationName: orgName as string, + namespaceName: namespaceName as string, environment: environment as string, componentTypeEnvOverrides: componentTypeEnvOverrides, traitOverrides: traitOverrides, @@ -701,17 +705,12 @@ export async function createRouter({ }); router.get('/environment-release', async (req, res) => { - const { componentName, projectName, organizationName, environmentName } = + const { componentName, projectName, namespaceName, environmentName } = req.query; - if ( - !componentName || - !projectName || - !organizationName || - !environmentName - ) { + if (!componentName || !projectName || !namespaceName || !environmentName) { throw new InputError( - 'componentName, projectName, organizationName and environmentName are required query parameters', + 'componentName, projectName, namespaceName and environmentName are required query parameters', ); } @@ -722,7 +721,7 @@ export async function createRouter({ { componentName: componentName as string, projectName: projectName as string, - organizationName: organizationName as string, + namespaceName: namespaceName as string, environmentName: environmentName as string, }, userToken, @@ -732,17 +731,17 @@ export async function createRouter({ // Endpoint for listing secret references router.get('/secret-references', async (req, res) => { - const { organizationName } = req.query; + const { namespaceName } = req.query; - if (!organizationName) { - throw new InputError('organizationName is a required query parameter'); + if (!namespaceName) { + throw new InputError('namespaceName is a required query parameter'); } const userToken = getUserTokenFromRequest(req); res.json( await secretReferencesInfoService.fetchSecretReferences( - organizationName as string, + namespaceName as string, userToken, ), ); @@ -860,27 +859,31 @@ export async function createRouter({ // Hierarchy Data Endpoints (for Access Control autocomplete) // ===================== - // Organizations - router.get('/orgs', async (req, res) => { + // Namespaces + router.get('/namespaces', async (req, res) => { const userToken = getUserTokenFromRequest(req); - res.json(await authzService.listOrganizations(userToken)); + res.json(await authzService.listNamespaces(userToken)); }); - // Projects (for a given organization) - router.get('/orgs/:orgName/projects', async (req, res) => { - const { orgName } = req.params; + // Projects (for a given namespace) + router.get('/namespaces/:namespaceName/projects', async (req, res) => { + const { namespaceName } = req.params; const userToken = getUserTokenFromRequest(req); - res.json(await authzService.listProjects(orgName, userToken)); + res.json(await authzService.listProjects(namespaceName, userToken)); }); - // Components (for a given organization and project) + // Components (for a given namespace and project) router.get( - '/orgs/:orgName/projects/:projectName/components', + '/namespaces/:namespaceName/projects/:projectName/components', async (req, res) => { - const { orgName, projectName } = req.params; + const { namespaceName, projectName } = req.params; const userToken = getUserTokenFromRequest(req); res.json( - await authzService.listComponents(orgName, projectName, userToken), + await authzService.listComponents( + namespaceName, + projectName, + userToken, + ), ); }, ); @@ -888,10 +891,10 @@ export async function createRouter({ // DataPlane endpoint router.get('/dataplanes/:dpName', async (req, res) => { const { dpName } = req.params; - const { organizationName } = req.query; + const { namespaceName } = req.query; - if (!organizationName) { - throw new InputError('organizationName is a required query parameter'); + if (!namespaceName) { + throw new InputError('namespaceName is a required query parameter'); } const userToken = getUserTokenFromRequest(req); @@ -899,7 +902,7 @@ export async function createRouter({ res.json( await dataPlaneInfoService.fetchDataPlaneDetails( { - organizationName: organizationName as string, + namespaceName: namespaceName as string, dataplaneName: dpName, }, userToken, diff --git a/plugins/openchoreo-backend/src/services/AuthzService/AuthzService.ts b/plugins/openchoreo-backend/src/services/AuthzService/AuthzService.ts index 446870c8..cec44eaf 100644 --- a/plugins/openchoreo-backend/src/services/AuthzService/AuthzService.ts +++ b/plugins/openchoreo-backend/src/services/AuthzService/AuthzService.ts @@ -458,52 +458,52 @@ export class AuthzService { // Hierarchy Data Methods (for Access Control autocomplete) // ===================== - // Organizations - async listOrganizations( + // Namespaces + async listNamespaces( userToken?: string, ): Promise<{ data: Array<{ name: string; displayName?: string }> }> { - this.logger.debug('Fetching all organizations'); + this.logger.debug('Fetching all namespaces'); try { const client = this.createClient(userToken); - const { data, error, response } = await client.GET('/orgs'); + const { data, error, response } = await client.GET('/namespaces'); if (error || !response.ok) { const errorMsg = extractErrorMessage( error, response, - 'Failed to fetch organizations', + 'Failed to fetch namespaces', ); throw new Error(errorMsg); } // OpenChoreo API returns { data: { items: [...] } } - const orgsResponse = data as { + const nsResponse = data as { data?: { items?: Array<{ name: string }> }; }; - const items = orgsResponse.data?.items || []; - this.logger.debug(`Successfully fetched ${items.length} organizations`); + const items = nsResponse.data?.items || []; + this.logger.debug(`Successfully fetched ${items.length} namespaces`); return { data: items }; } catch (err) { - this.logger.error(`Failed to fetch organizations: ${err}`); + this.logger.error(`Failed to fetch namespaces: ${err}`); throw err; } } // Projects async listProjects( - orgName: string, + namespaceName: string, userToken?: string, ): Promise<{ data: Array<{ name: string; displayName?: string }> }> { - this.logger.debug(`Fetching projects for organization: ${orgName}`); + this.logger.debug(`Fetching projects for namespace: ${namespaceName}`); try { const client = this.createClient(userToken); const { data, error, response } = await client.GET( - '/orgs/{orgName}/projects', + '/namespaces/{namespaceName}/projects', { - params: { path: { orgName } }, + params: { path: { namespaceName } }, }, ); @@ -522,32 +522,34 @@ export class AuthzService { }; const items = projectsResponse.data?.items || []; this.logger.debug( - `Successfully fetched ${items.length} projects for org ${orgName}`, + `Successfully fetched ${items.length} projects for namespace ${namespaceName}`, ); return { data: items }; } catch (err) { - this.logger.error(`Failed to fetch projects for org ${orgName}: ${err}`); + this.logger.error( + `Failed to fetch projects for namespace ${namespaceName}: ${err}`, + ); throw err; } } // Components async listComponents( - orgName: string, + namespaceName: string, projectName: string, userToken?: string, ): Promise<{ data: Array<{ name: string; displayName?: string }> }> { this.logger.debug( - `Fetching components for org: ${orgName}, project: ${projectName}`, + `Fetching components for namespace: ${namespaceName}, project: ${projectName}`, ); try { const client = this.createClient(userToken); const { data, error, response } = await client.GET( - '/orgs/{orgName}/projects/{projectName}/components', + '/namespaces/{namespaceName}/projects/{projectName}/components', { - params: { path: { orgName, projectName } }, + params: { path: { namespaceName, projectName } }, }, ); @@ -566,13 +568,13 @@ export class AuthzService { }; const items = componentsResponse.data?.items || []; this.logger.debug( - `Successfully fetched ${items.length} components for ${orgName}/${projectName}`, + `Successfully fetched ${items.length} components for ${namespaceName}/${projectName}`, ); return { data: items }; } catch (err) { this.logger.error( - `Failed to fetch components for ${orgName}/${projectName}: ${err}`, + `Failed to fetch components for ${namespaceName}/${projectName}: ${err}`, ); throw err; } diff --git a/plugins/openchoreo-backend/src/services/BuildService/BuildInfoService.ts b/plugins/openchoreo-backend/src/services/BuildService/BuildInfoService.ts index aa82220f..95a92da3 100644 --- a/plugins/openchoreo-backend/src/services/BuildService/BuildInfoService.ts +++ b/plugins/openchoreo-backend/src/services/BuildService/BuildInfoService.ts @@ -27,13 +27,13 @@ export class BuildInfoService { } async fetchBuilds( - orgName: string, + namespaceName: string, projectName: string, componentName: string, token?: string, ): Promise { this.logger.debug( - `Fetching component workflow runs for component: ${componentName} in project: ${projectName}, organization: ${orgName}`, + `Fetching component workflow runs for component: ${componentName} in project: ${projectName}, namespace: ${namespaceName}`, ); try { @@ -44,10 +44,10 @@ export class BuildInfoService { }); const { data, error, response } = await client.GET( - '/orgs/{orgName}/projects/{projectName}/components/{componentName}/workflow-runs', + '/namespaces/{namespaceName}/projects/{projectName}/components/{componentName}/workflow-runs', { params: { - path: { orgName, projectName, componentName }, + path: { namespaceName, projectName, componentName }, }, }, ); @@ -77,14 +77,14 @@ export class BuildInfoService { } async getWorkflowRun( - orgName: string, + namespaceName: string, projectName: string, componentName: string, runName: string, token?: string, ): Promise { this.logger.debug( - `Fetching workflow run: ${runName} for component: ${componentName} in project: ${projectName}, organization: ${orgName}`, + `Fetching workflow run: ${runName} for component: ${componentName} in project: ${projectName}, namespace: ${namespaceName}`, ); try { @@ -95,10 +95,10 @@ export class BuildInfoService { }); const { data, error, response } = await client.GET( - '/orgs/{orgName}/projects/{projectName}/components/{componentName}/workflow-runs/{runName}', + '/namespaces/{namespaceName}/projects/{projectName}/components/{componentName}/workflow-runs/{runName}', { params: { - path: { orgName, projectName, componentName, runName }, + path: { namespaceName, projectName, componentName, runName }, }, }, ); @@ -124,14 +124,14 @@ export class BuildInfoService { } async triggerBuild( - orgName: string, + namespaceName: string, projectName: string, componentName: string, commit?: string, token?: string, ): Promise { this.logger.info( - `Triggering component workflow for component: ${componentName} in project: ${projectName}, organization: ${orgName}${ + `Triggering component workflow for component: ${componentName} in project: ${projectName}, namespace: ${namespaceName}${ commit ? ` with commit: ${commit}` : '' }`, ); @@ -144,10 +144,10 @@ export class BuildInfoService { }); const { data, error, response } = await client.POST( - '/orgs/{orgName}/projects/{projectName}/components/{componentName}/workflow-runs', + '/namespaces/{namespaceName}/projects/{projectName}/components/{componentName}/workflow-runs', { params: { - path: { orgName, projectName, componentName }, + path: { namespaceName, projectName, componentName }, query: commit ? { commit } : undefined, }, }, @@ -176,7 +176,7 @@ export class BuildInfoService { } async fetchBuildLogs( - orgName: string, + namespaceName: string, projectName: string, componentName: string, buildId: string, @@ -201,11 +201,11 @@ export class BuildInfoService { error: urlError, response: urlResponse, } = await mainClient.GET( - '/orgs/{orgName}/projects/{projectName}/components/{componentName}/observer-url', + '/namespaces/{namespaceName}/projects/{projectName}/components/{componentName}/observer-url', { params: { path: { - orgName, + namespaceName, projectName, componentName, }, @@ -256,7 +256,7 @@ export class BuildInfoService { sortOrder: sortOrder || 'asc', componentName, projectName, - orgName, + namespaceName, }, }, ); diff --git a/plugins/openchoreo-backend/src/services/CellDiagramService/CellDiagramInfoService.ts b/plugins/openchoreo-backend/src/services/CellDiagramService/CellDiagramInfoService.ts index cacc4162..fdf4ce0d 100644 --- a/plugins/openchoreo-backend/src/services/CellDiagramService/CellDiagramInfoService.ts +++ b/plugins/openchoreo-backend/src/services/CellDiagramService/CellDiagramInfoService.ts @@ -66,16 +66,16 @@ export class CellDiagramInfoService implements CellDiagramService { * Fetches project information including its components and their configurations. * @param {Object} request - The request object * @param {string} request.projectName - Name of the project to fetch - * @param {string} request.orgName - Name of the organization the project belongs to + * @param {string} request.namespaceName - Name of the namespace the project belongs to * @returns {Promise} Project information if found, undefined otherwise */ async fetchProjectInfo( { projectName, - orgName, + namespaceName, }: { projectName: string; - orgName: string; + namespaceName: string; }, token?: string, ): Promise { @@ -91,10 +91,10 @@ export class CellDiagramInfoService implements CellDiagramService { error: listError, response: listResponse, } = await client.GET( - '/orgs/{orgName}/projects/{projectName}/components', + '/namespaces/{namespaceName}/projects/{projectName}/components', { params: { - path: { orgName, projectName }, + path: { namespaceName, projectName }, }, }, ); @@ -123,11 +123,11 @@ export class CellDiagramInfoService implements CellDiagramService { error: componentError, response: componentResponse, } = await client.GET( - '/orgs/{orgName}/projects/{projectName}/components/{componentName}', + '/namespaces/{namespaceName}/projects/{projectName}/components/{componentName}', { params: { path: { - orgName, + namespaceName, projectName, componentName, }, @@ -170,7 +170,7 @@ export class CellDiagramInfoService implements CellDiagramService { component.workload?.connections as | { [key: string]: WorkloadConnection } | undefined, - orgName, + namespaceName, projectName, completeComponents, ); @@ -268,7 +268,7 @@ export class CellDiagramInfoService implements CellDiagramService { private generateConnections( connections: { [key: string]: WorkloadConnection } | undefined, - orgName: string, + namespaceName: string, projectName: string, completeComponents: ModelsCompleteComponent[], ): CellDiagramConnection[] { @@ -290,8 +290,8 @@ export class CellDiagramInfoService implements CellDiagramService { const connectionId = isInternal && dependentComponent - ? `${orgName}:${projectName}:${dependentComponent.name}:${connection.params.endpoint}` - : `${orgName}:${dependentProjectName}:${dependentComponentName}:${connection.params.endpoint}`; + ? `${namespaceName}:${projectName}:${dependentComponent.name}:${connection.params.endpoint}` + : `${namespaceName}:${dependentProjectName}:${dependentComponentName}:${connection.params.endpoint}`; conns.push({ id: connectionId, diff --git a/plugins/openchoreo-backend/src/services/ComponentService/ComponentInfoService.ts b/plugins/openchoreo-backend/src/services/ComponentService/ComponentInfoService.ts index 5412dade..2de0cf34 100644 --- a/plugins/openchoreo-backend/src/services/ComponentService/ComponentInfoService.ts +++ b/plugins/openchoreo-backend/src/services/ComponentService/ComponentInfoService.ts @@ -20,19 +20,19 @@ export class ComponentInfoService { /** * Fetches component details from OpenChoreo API. * - * @param orgName - Organization name + * @param namespaceName - Namespace name * @param projectName - Project name * @param componentName - Component name * @param token - Optional user token (overrides default token if provided) */ async fetchComponentDetails( - orgName: string, + namespaceName: string, projectName: string, componentName: string, token?: string, ): Promise { this.logger.debug( - `Fetching component details for: ${componentName} in project: ${projectName}, organization: ${orgName}`, + `Fetching component details for: ${componentName} in project: ${projectName}, namespace: ${namespaceName}`, ); try { @@ -43,10 +43,10 @@ export class ComponentInfoService { }); const { data, error, response } = await client.GET( - '/orgs/{orgName}/projects/{projectName}/components/{componentName}', + '/namespaces/{namespaceName}/projects/{projectName}/components/{componentName}', { params: { - path: { orgName, projectName, componentName }, + path: { namespaceName, projectName, componentName }, }, }, ); @@ -78,21 +78,21 @@ export class ComponentInfoService { /** * Patches a component in OpenChoreo API. * - * @param orgName - Organization name + * @param namespaceName - Namespace name * @param projectName - Project name * @param componentName - Component name * @param autoDeploy - Auto deploy setting * @param token - Optional user token (overrides default token if provided) */ async patchComponent( - orgName: string, + namespaceName: string, projectName: string, componentName: string, autoDeploy: boolean, token?: string, ): Promise { this.logger.debug( - `Patching component: ${componentName} in project: ${projectName}, organization: ${orgName} with autoDeploy: ${autoDeploy}`, + `Patching component: ${componentName} in project: ${projectName}, namespace: ${namespaceName} with autoDeploy: ${autoDeploy}`, ); try { @@ -103,10 +103,10 @@ export class ComponentInfoService { }); const { data, error, response } = await client.PATCH( - '/orgs/{orgName}/projects/{projectName}/components/{componentName}', + '/namespaces/{namespaceName}/projects/{projectName}/components/{componentName}', { params: { - path: { orgName, projectName, componentName }, + path: { namespaceName, projectName, componentName }, }, body: { autoDeploy, diff --git a/plugins/openchoreo-backend/src/services/DashboardService/DashboardInfoService.ts b/plugins/openchoreo-backend/src/services/DashboardService/DashboardInfoService.ts index 431ec4dd..9e112806 100644 --- a/plugins/openchoreo-backend/src/services/DashboardService/DashboardInfoService.ts +++ b/plugins/openchoreo-backend/src/services/DashboardService/DashboardInfoService.ts @@ -15,13 +15,13 @@ export class DashboardInfoService { } async fetchDashboardMetrics( - orgName: string, + namespaceName: string, projectName: string, componentName: string, token?: string, ): Promise { this.logger.info( - `Fetching bindings count for component: ${componentName} in project: ${projectName}, organization: ${orgName}`, + `Fetching bindings count for component: ${componentName} in project: ${projectName}, namespace: ${namespaceName}`, ); try { @@ -33,11 +33,11 @@ export class DashboardInfoService { // Fetch bindings for the component const { data, error, response } = await client.GET( - '/orgs/{orgName}/projects/{projectName}/components/{componentName}/bindings', + '/namespaces/{namespaceName}/projects/{projectName}/components/{componentName}/bindings', { params: { path: { - orgName, + namespaceName, projectName, componentName, }, @@ -71,7 +71,7 @@ export class DashboardInfoService { async fetchComponentsBindingsCount( components: Array<{ - orgName: string; + namespaceName: string; projectName: string; componentName: string; }>, @@ -84,9 +84,9 @@ export class DashboardInfoService { try { // Fetch bindings for all components in parallel const bindingsCounts = await Promise.all( - components.map(({ orgName, projectName, componentName }) => + components.map(({ namespaceName, projectName, componentName }) => this.fetchDashboardMetrics( - orgName, + namespaceName, projectName, componentName, token, diff --git a/plugins/openchoreo-backend/src/services/DataPlaneService/DataPlaneInfoService.ts b/plugins/openchoreo-backend/src/services/DataPlaneService/DataPlaneInfoService.ts index 0eca8895..b1edb823 100644 --- a/plugins/openchoreo-backend/src/services/DataPlaneService/DataPlaneInfoService.ts +++ b/plugins/openchoreo-backend/src/services/DataPlaneService/DataPlaneInfoService.ts @@ -29,7 +29,7 @@ export class DataPlaneInfoService { * Fetches details for a specific data plane. * * @param {Object} request - The request parameters - * @param {string} request.organizationName - Name of the organization owning the data plane + * @param {string} request.namespaceName - Name of the namespace owning the data plane * @param {string} request.dataplaneName - Name of the data plane to fetch * @param {string} [token] - Optional user token for authentication * @returns {Promise} Data plane details @@ -37,7 +37,7 @@ export class DataPlaneInfoService { */ async fetchDataPlaneDetails( request: { - organizationName: string; + namespaceName: string; dataplaneName: string; }, token?: string, @@ -45,7 +45,7 @@ export class DataPlaneInfoService { const startTime = Date.now(); try { this.logger.debug( - `Fetching data plane details for: ${request.dataplaneName} in organization: ${request.organizationName}`, + `Fetching data plane details for: ${request.dataplaneName} in namespace: ${request.namespaceName}`, ); const client = createOpenChoreoApiClient({ @@ -55,11 +55,11 @@ export class DataPlaneInfoService { }); const { data, error, response } = await client.GET( - '/orgs/{orgName}/dataplanes/{dpName}', + '/namespaces/{namespaceName}/dataplanes/{dpName}', { params: { path: { - orgName: request.organizationName, + namespaceName: request.namespaceName, dpName: request.dataplaneName, }, }, diff --git a/plugins/openchoreo-backend/src/services/EnvironmentService/EnvironmentInfoService.ts b/plugins/openchoreo-backend/src/services/EnvironmentService/EnvironmentInfoService.ts index 4cf4c641..4f1293db 100644 --- a/plugins/openchoreo-backend/src/services/EnvironmentService/EnvironmentInfoService.ts +++ b/plugins/openchoreo-backend/src/services/EnvironmentService/EnvironmentInfoService.ts @@ -40,7 +40,7 @@ export class EnvironmentInfoService implements EnvironmentService { * @param {Object} request - The request parameters * @param {string} request.projectName - Name of the project containing the component * @param {string} request.componentName - Name of the component to fetch deployment info for - * @param {string} request.organizationName - Name of the organization owning the project + * @param {string} request.namespaceName - Name of the namespace owning the project * @returns {Promise} Array of environments with their deployment information * @throws {Error} When there's an error fetching data from the API */ @@ -48,7 +48,7 @@ export class EnvironmentInfoService implements EnvironmentService { request: { projectName: string; componentName: string; - organizationName: string; + namespaceName: string; }, token?: string, ): Promise { @@ -93,9 +93,9 @@ export class EnvironmentInfoService implements EnvironmentService { const environmentsPromise = createTimedPromise( (async () => { const { data, error, response } = await client.GET( - '/orgs/{orgName}/environments', + '/namespaces/{namespaceName}/environments', { - params: { path: { orgName: request.organizationName } }, + params: { path: { namespaceName: request.namespaceName } }, }, ); if (error || !response.ok) { @@ -109,11 +109,11 @@ export class EnvironmentInfoService implements EnvironmentService { const bindingsPromise = createTimedPromise( (async () => { const { data, error, response } = await client.GET( - '/orgs/{orgName}/projects/{projectName}/components/{componentName}/release-bindings', + '/namespaces/{namespaceName}/projects/{projectName}/components/{componentName}/release-bindings', { params: { path: { - orgName: request.organizationName, + namespaceName: request.namespaceName, projectName: request.projectName, componentName: request.componentName, }, @@ -133,11 +133,11 @@ export class EnvironmentInfoService implements EnvironmentService { const pipelinePromise = createTimedPromise( (async () => { const { data, error, response } = await client.GET( - '/orgs/{orgName}/projects/{projectName}/deployment-pipeline', + '/namespaces/{namespaceName}/projects/{projectName}/deployment-pipeline', { params: { path: { - orgName: request.organizationName, + namespaceName: request.namespaceName, projectName: request.projectName, }, }, @@ -174,7 +174,7 @@ export class EnvironmentInfoService implements EnvironmentService { if (!environmentsResponse.ok) { this.logger.error( - `Failed to fetch environments for organization ${request.organizationName}`, + `Failed to fetch environments for namespace ${request.namespaceName}`, ); return []; } @@ -505,7 +505,7 @@ export class EnvironmentInfoService implements EnvironmentService { * @param {string} request.targetEnvironment - Target environment name * @param {string} request.componentName - Name of the component to promote * @param {string} request.projectName - Name of the project containing the component - * @param {string} request.organizationName - Name of the organization owning the project + * @param {string} request.namespaceName - Name of the namespace owning the project * @returns {Promise} Array of environments with updated deployment information * @throws {Error} When there's an error promoting the component */ @@ -515,7 +515,7 @@ export class EnvironmentInfoService implements EnvironmentService { targetEnvironment: string; componentName: string; projectName: string; - organizationName: string; + namespaceName: string; }, token?: string, ): Promise { @@ -533,11 +533,11 @@ export class EnvironmentInfoService implements EnvironmentService { // Call the promotion API const { data, error, response } = await client.POST( - '/orgs/{orgName}/projects/{projectName}/components/{componentName}/promote', + '/namespaces/{namespaceName}/projects/{projectName}/components/{componentName}/promote', { params: { path: { - orgName: request.organizationName, + namespaceName: request.namespaceName, projectName: request.projectName, componentName: request.componentName, }, @@ -565,7 +565,7 @@ export class EnvironmentInfoService implements EnvironmentService { { componentName: request.componentName, projectName: request.projectName, - organizationName: request.organizationName, + namespaceName: request.namespaceName, }, token, ); @@ -593,7 +593,7 @@ export class EnvironmentInfoService implements EnvironmentService { * @param {Object} request - The delete request parameters * @param {string} request.componentName - Name of the component * @param {string} request.projectName - Name of the project containing the component - * @param {string} request.organizationName - Name of the organization owning the project + * @param {string} request.namespaceName - Name of the namespace owning the project * @param {string} request.environment - Environment to unpromote from * @returns {Promise} Array of environments with updated deployment information * @throws {Error} When there's an error deleting the binding @@ -602,7 +602,7 @@ export class EnvironmentInfoService implements EnvironmentService { request: { componentName: string; projectName: string; - organizationName: string; + namespaceName: string; environment: string; }, token?: string, @@ -629,7 +629,7 @@ export class EnvironmentInfoService implements EnvironmentService { kind: 'ReleaseBinding', metadata: { name: bindingName, - namespace: request.organizationName, + namespace: request.namespaceName, }, }, }); @@ -647,7 +647,7 @@ export class EnvironmentInfoService implements EnvironmentService { { componentName: request.componentName, projectName: request.projectName, - organizationName: request.organizationName, + namespaceName: request.namespaceName, }, token, ); @@ -675,7 +675,7 @@ export class EnvironmentInfoService implements EnvironmentService { * @param {Object} request - The update request parameters * @param {string} request.componentName - Name of the component * @param {string} request.projectName - Name of the project containing the component - * @param {string} request.organizationName - Name of the organization owning the project + * @param {string} request.namespaceName - Name of the namespace owning the project * @param {string} request.bindingName - Name of the binding to update * @param {'Active' | 'Suspend' | 'Undeploy'} request.releaseState - The new release state * @returns {Promise} Array of environments with updated deployment information @@ -685,7 +685,7 @@ export class EnvironmentInfoService implements EnvironmentService { request: { componentName: string; projectName: string; - organizationName: string; + namespaceName: string; bindingName: string; releaseState: 'Active' | 'Suspend' | 'Undeploy'; }, @@ -705,11 +705,11 @@ export class EnvironmentInfoService implements EnvironmentService { // Call the update binding API const { error, response } = await client.PATCH( - '/orgs/{orgName}/projects/{projectName}/components/{componentName}/bindings/{bindingName}', + '/namespaces/{namespaceName}/projects/{projectName}/components/{componentName}/bindings/{bindingName}', { params: { path: { - orgName: request.organizationName, + namespaceName: request.namespaceName, projectName: request.projectName, componentName: request.componentName, bindingName: request.bindingName, @@ -734,7 +734,7 @@ export class EnvironmentInfoService implements EnvironmentService { { componentName: request.componentName, projectName: request.projectName, - organizationName: request.organizationName, + namespaceName: request.namespaceName, }, token, ); @@ -762,7 +762,7 @@ export class EnvironmentInfoService implements EnvironmentService { * @param {Object} request - The create release request parameters * @param {string} request.componentName - Name of the component * @param {string} request.projectName - Name of the project containing the component - * @param {string} request.organizationName - Name of the organization + * @param {string} request.namespaceName - Name of the namespace * @param {string} [request.releaseName] - Optional release name (auto-generated if omitted) * @returns {Promise} Response from the OpenChoreo API */ @@ -770,7 +770,7 @@ export class EnvironmentInfoService implements EnvironmentService { request: { componentName: string; projectName: string; - organizationName: string; + namespaceName: string; releaseName?: string; }, token?: string, @@ -793,11 +793,11 @@ export class EnvironmentInfoService implements EnvironmentService { } const { data, error, response } = await client.POST( - '/orgs/{orgName}/projects/{projectName}/components/{componentName}/component-releases', + '/namespaces/{namespaceName}/projects/{projectName}/components/{componentName}/component-releases', { params: { path: { - orgName: request.organizationName, + namespaceName: request.namespaceName, projectName: request.projectName, componentName: request.componentName, }, @@ -834,7 +834,7 @@ export class EnvironmentInfoService implements EnvironmentService { * @param {Object} request - The deploy request parameters * @param {string} request.componentName - Name of the component * @param {string} request.projectName - Name of the project containing the component - * @param {string} request.organizationName - Name of the organization + * @param {string} request.namespaceName - Name of the namespace * @param {string} request.releaseName - Name of the release to deploy * @returns {Promise} Updated environment information */ @@ -842,7 +842,7 @@ export class EnvironmentInfoService implements EnvironmentService { request: { componentName: string; projectName: string; - organizationName: string; + namespaceName: string; releaseName: string; }, token?: string, @@ -860,15 +860,15 @@ export class EnvironmentInfoService implements EnvironmentService { }); this.logger.debug( - `Deploy release request: org=${request.organizationName}, project=${request.projectName}, component=${request.componentName}, release=${request.releaseName}`, + `Deploy release request: namespace=${request.namespaceName}, project=${request.projectName}, component=${request.componentName}, release=${request.releaseName}`, ); const { error, response } = await client.POST( - '/orgs/{orgName}/projects/{projectName}/components/{componentName}/deploy', + '/namespaces/{namespaceName}/projects/{projectName}/components/{componentName}/deploy', { params: { path: { - orgName: request.organizationName, + namespaceName: request.namespaceName, projectName: request.projectName, componentName: request.componentName, }, @@ -894,7 +894,7 @@ export class EnvironmentInfoService implements EnvironmentService { { componentName: request.componentName, projectName: request.projectName, - organizationName: request.organizationName, + namespaceName: request.namespaceName, }, token, ); @@ -922,7 +922,7 @@ export class EnvironmentInfoService implements EnvironmentService { * @param {Object} request - The request parameters * @param {string} request.componentName - Name of the component * @param {string} request.projectName - Name of the project containing the component - * @param {string} request.organizationName - Name of the organization + * @param {string} request.namespaceName - Name of the namespace * @param {string} request.releaseName - Name of the release to get schema for * @returns {Promise} JSON Schema for the release's override configuration */ @@ -930,7 +930,7 @@ export class EnvironmentInfoService implements EnvironmentService { request: { componentName: string; projectName: string; - organizationName: string; + namespaceName: string; releaseName: string; }, token?: string, @@ -948,11 +948,11 @@ export class EnvironmentInfoService implements EnvironmentService { }); const { data, error, response } = await client.GET( - '/orgs/{orgName}/projects/{projectName}/components/{componentName}/component-releases/{releaseName}/schema', + '/namespaces/{namespaceName}/projects/{projectName}/components/{componentName}/component-releases/{releaseName}/schema', { params: { path: { - orgName: request.organizationName, + namespaceName: request.namespaceName, projectName: request.projectName, componentName: request.componentName, releaseName: request.releaseName, @@ -989,14 +989,14 @@ export class EnvironmentInfoService implements EnvironmentService { * @param {Object} request - The request parameters * @param {string} request.componentName - Name of the component * @param {string} request.projectName - Name of the project containing the component - * @param {string} request.organizationName - Name of the organization + * @param {string} request.namespaceName - Name of the namespace * @returns {Promise} List of release bindings */ async fetchReleaseBindings( request: { componentName: string; projectName: string; - organizationName: string; + namespaceName: string; }, token?: string, ) { @@ -1013,11 +1013,11 @@ export class EnvironmentInfoService implements EnvironmentService { }); const { data, error, response } = await client.GET( - '/orgs/{orgName}/projects/{projectName}/components/{componentName}/release-bindings', + '/namespaces/{namespaceName}/projects/{projectName}/components/{componentName}/release-bindings', { params: { path: { - orgName: request.organizationName, + namespaceName: request.namespaceName, projectName: request.projectName, componentName: request.componentName, }, @@ -1054,7 +1054,7 @@ export class EnvironmentInfoService implements EnvironmentService { * @param {Object} request - The request parameters * @param {string} request.componentName - Name of the component * @param {string} request.projectName - Name of the project containing the component - * @param {string} request.organizationName - Name of the organization + * @param {string} request.namespaceName - Name of the namespace * @param {string} request.environment - Environment to patch binding for * @param {any} request.componentTypeEnvOverrides - Component type environment overrides to apply * @param {any} request.traitOverrides - Trait-specific overrides to apply @@ -1065,7 +1065,7 @@ export class EnvironmentInfoService implements EnvironmentService { request: { componentName: string; projectName: string; - organizationName: string; + namespaceName: string; environment: string; componentTypeEnvOverrides: any; traitOverrides?: any; @@ -1090,11 +1090,11 @@ export class EnvironmentInfoService implements EnvironmentService { const bindingName = `${request.componentName}-${request.environment}`; const { data, error, response } = await client.PATCH( - '/orgs/{orgName}/projects/{projectName}/components/{componentName}/release-bindings/{bindingName}', + '/namespaces/{namespaceName}/projects/{projectName}/components/{componentName}/release-bindings/{bindingName}', { params: { path: { - orgName: request.organizationName, + namespaceName: request.namespaceName, projectName: request.projectName, componentName: request.componentName, bindingName: bindingName, @@ -1139,7 +1139,7 @@ export class EnvironmentInfoService implements EnvironmentService { * @param {Object} request - The request parameters * @param {string} request.componentName - Name of the component * @param {string} request.projectName - Name of the project containing the component - * @param {string} request.organizationName - Name of the organization + * @param {string} request.namespaceName - Name of the namespace * @param {string} request.environmentName - Name of the environment * @returns {Promise} Release information including spec and status */ @@ -1147,7 +1147,7 @@ export class EnvironmentInfoService implements EnvironmentService { request: { componentName: string; projectName: string; - organizationName: string; + namespaceName: string; environmentName: string; }, token?: string, @@ -1165,11 +1165,11 @@ export class EnvironmentInfoService implements EnvironmentService { }); const { data, error, response } = await client.GET( - '/orgs/{orgName}/projects/{projectName}/components/{componentName}/environments/{environmentName}/release', + '/namespaces/{namespaceName}/projects/{projectName}/components/{componentName}/environments/{environmentName}/release', { params: { path: { - orgName: request.organizationName, + namespaceName: request.namespaceName, projectName: request.projectName, componentName: request.componentName, environmentName: request.environmentName, diff --git a/plugins/openchoreo-backend/src/services/ProjectService/ProjectInfoService.ts b/plugins/openchoreo-backend/src/services/ProjectService/ProjectInfoService.ts index 806132fe..50039b13 100644 --- a/plugins/openchoreo-backend/src/services/ProjectService/ProjectInfoService.ts +++ b/plugins/openchoreo-backend/src/services/ProjectService/ProjectInfoService.ts @@ -19,12 +19,12 @@ export class ProjectInfoService { } async fetchProjectDetails( - orgName: string, + namespaceName: string, projectName: string, token?: string, ): Promise { this.logger.debug( - `Fetching project details for: ${projectName} in organization: ${orgName}`, + `Fetching project details for: ${projectName} in namespace: ${namespaceName}`, ); try { @@ -35,10 +35,10 @@ export class ProjectInfoService { }); const { data, error, response } = await client.GET( - '/orgs/{orgName}/projects/{projectName}', + '/namespaces/{namespaceName}/projects/{projectName}', { params: { - path: { orgName, projectName }, + path: { namespaceName, projectName }, }, }, ); @@ -68,12 +68,12 @@ export class ProjectInfoService { } async fetchProjectDeploymentPipeline( - orgName: string, + namespaceName: string, projectName: string, token?: string, ): Promise { this.logger.debug( - `Fetching deployment pipeline for project: ${projectName} in organization: ${orgName}`, + `Fetching deployment pipeline for project: ${projectName} in namespace: ${namespaceName}`, ); try { const client = createOpenChoreoApiClient({ @@ -83,10 +83,10 @@ export class ProjectInfoService { }); const { data, error, response } = await client.GET( - '/orgs/{orgName}/projects/{projectName}/deployment-pipeline', + '/namespaces/{namespaceName}/projects/{projectName}/deployment-pipeline', { params: { - path: { orgName, projectName }, + path: { namespaceName, projectName }, }, }, ); diff --git a/plugins/openchoreo-backend/src/services/RuntimeLogsService/RuntimeLogsService.ts b/plugins/openchoreo-backend/src/services/RuntimeLogsService/RuntimeLogsService.ts index 05b2483f..266697ed 100644 --- a/plugins/openchoreo-backend/src/services/RuntimeLogsService/RuntimeLogsService.ts +++ b/plugins/openchoreo-backend/src/services/RuntimeLogsService/RuntimeLogsService.ts @@ -54,7 +54,7 @@ export class RuntimeLogsInfoService implements RuntimeLogsService { endTime?: string; limit?: number; }, - orgName: string, + namespaceName: string, projectName: string, token?: string, ): Promise { @@ -86,11 +86,11 @@ export class RuntimeLogsInfoService implements RuntimeLogsService { error: urlError, response: urlResponse, } = await mainClient.GET( - '/orgs/{orgName}/projects/{projectName}/components/{componentName}/environments/{environmentName}/observer-url', + '/namespaces/{namespaceName}/projects/{projectName}/components/{componentName}/environments/{environmentName}/observer-url', { params: { path: { - orgName, + namespaceName, projectName, componentName, environmentName, @@ -140,7 +140,7 @@ export class RuntimeLogsInfoService implements RuntimeLogsService { environmentId, componentName, projectName, - orgName, + namespaceName, environmentName, limit, sortOrder: 'desc', diff --git a/plugins/openchoreo-backend/src/services/SecretReferencesService/SecretReferencesService.ts b/plugins/openchoreo-backend/src/services/SecretReferencesService/SecretReferencesService.ts index f692bb04..c9bbae51 100644 --- a/plugins/openchoreo-backend/src/services/SecretReferencesService/SecretReferencesService.ts +++ b/plugins/openchoreo-backend/src/services/SecretReferencesService/SecretReferencesService.ts @@ -18,11 +18,11 @@ export class SecretReferencesService { } async fetchSecretReferences( - orgName: string, + namespaceName: string, token?: string, ): Promise { this.logger.debug( - `Fetching secret references for organization: ${orgName}`, + `Fetching secret references for namespace: ${namespaceName}`, ); try { @@ -33,10 +33,10 @@ export class SecretReferencesService { }); const { data, error, response } = await client.GET( - '/orgs/{orgName}/secret-references', + '/namespaces/{namespaceName}/secret-references', { params: { - path: { orgName }, + path: { namespaceName }, }, }, ); @@ -56,12 +56,12 @@ export class SecretReferencesService { const secretReferences: ModelsSecretReferences = data as ModelsSecretReferences; this.logger.debug( - `Successfully fetched secret references for organization: ${orgName}`, + `Successfully fetched secret references for namespace: ${namespaceName}`, ); return secretReferences; } catch (error) { this.logger.error( - `Failed to fetch secret references for ${orgName}: ${error}`, + `Failed to fetch secret references for ${namespaceName}: ${error}`, ); throw error; } diff --git a/plugins/openchoreo-backend/src/services/TraitService/TraitInfoService.ts b/plugins/openchoreo-backend/src/services/TraitService/TraitInfoService.ts index 89507882..83b0b339 100644 --- a/plugins/openchoreo-backend/src/services/TraitService/TraitInfoService.ts +++ b/plugins/openchoreo-backend/src/services/TraitService/TraitInfoService.ts @@ -39,13 +39,13 @@ export class TraitInfoService { } async fetchTraits( - orgName: string, + namespaceName: string, page: number = 1, pageSize: number = 100, token?: string, ): Promise { this.logger.debug( - `Fetching traits (traits) for organization: ${orgName} (page: ${page}, pageSize: ${pageSize})`, + `Fetching traits (traits) for namespace: ${namespaceName} (page: ${page}, pageSize: ${pageSize})`, ); try { @@ -56,10 +56,10 @@ export class TraitInfoService { }); const { data, error, response } = await client.GET( - '/orgs/{orgName}/traits', + '/namespaces/{namespaceName}/traits', { params: { - path: { orgName }, + path: { namespaceName }, }, }, ); @@ -79,22 +79,24 @@ export class TraitInfoService { this.logger.debug( `Successfully fetched ${ traitListResponse.data?.items?.length || 0 - } traits for org: ${orgName}`, + } traits for namespace: ${namespaceName}`, ); return traitListResponse; } catch (error) { - this.logger.error(`Failed to fetch traits for org ${orgName}: ${error}`); + this.logger.error( + `Failed to fetch traits for namespace ${namespaceName}: ${error}`, + ); throw error; } } async fetchTraitSchema( - orgName: string, + namespaceName: string, traitName: string, token?: string, ): Promise { this.logger.debug( - `Fetching schema for trait (trait): ${traitName} in org: ${orgName}`, + `Fetching schema for trait (trait): ${traitName} in namespace: ${namespaceName}`, ); try { @@ -105,10 +107,10 @@ export class TraitInfoService { }); const { data, error, response } = await client.GET( - '/orgs/{orgName}/traits/{traitName}/schema', + '/namespaces/{namespaceName}/traits/{traitName}/schema', { params: { - path: { orgName, traitName: traitName }, + path: { namespaceName, traitName: traitName }, }, }, ); @@ -129,20 +131,20 @@ export class TraitInfoService { return schemaResponse; } catch (error) { this.logger.error( - `Failed to fetch schema for trait ${traitName} in org ${orgName}: ${error}`, + `Failed to fetch schema for trait ${traitName} in namespace ${namespaceName}: ${error}`, ); throw error; } } async fetchComponentTraits( - orgName: string, + namespaceName: string, projectName: string, componentName: string, userToken?: string, ): Promise { this.logger.debug( - `Fetching component traits for: ${componentName} in project: ${projectName}, organization: ${orgName}`, + `Fetching component traits for: ${componentName} in project: ${projectName}, namespace: ${namespaceName}`, ); try { @@ -153,10 +155,10 @@ export class TraitInfoService { }); const { data, error, response } = await client.GET( - '/orgs/{orgName}/projects/{projectName}/components/{componentName}/traits', + '/namespaces/{namespaceName}/projects/{projectName}/components/{componentName}/traits', { params: { - path: { orgName, projectName, componentName }, + path: { namespaceName, projectName, componentName }, }, }, ); @@ -188,14 +190,14 @@ export class TraitInfoService { } async updateComponentTraits( - orgName: string, + namespaceName: string, projectName: string, componentName: string, traits: UpdateComponentTraitsRequest, userToken?: string, ): Promise { this.logger.debug( - `Updating component traits for: ${componentName} in project: ${projectName}, organization: ${orgName}`, + `Updating component traits for: ${componentName} in project: ${projectName}, namespace: ${namespaceName}`, ); try { @@ -206,10 +208,10 @@ export class TraitInfoService { }); const { data, error, response } = await client.PUT( - '/orgs/{orgName}/projects/{projectName}/components/{componentName}/traits', + '/namespaces/{namespaceName}/projects/{projectName}/components/{componentName}/traits', { params: { - path: { orgName, projectName, componentName }, + path: { namespaceName, projectName, componentName }, }, body: traits, }, diff --git a/plugins/openchoreo-backend/src/services/WorkloadService/WorkloadInfoService.ts b/plugins/openchoreo-backend/src/services/WorkloadService/WorkloadInfoService.ts index 6855c8e0..70fcfa4e 100644 --- a/plugins/openchoreo-backend/src/services/WorkloadService/WorkloadInfoService.ts +++ b/plugins/openchoreo-backend/src/services/WorkloadService/WorkloadInfoService.ts @@ -32,7 +32,7 @@ export class WorkloadInfoService implements WorkloadService { * @param {Object} request - The request parameters * @param {string} request.projectName - Name of the project containing the component * @param {string} request.componentName - Name of the component to fetch workload info for - * @param {string} request.organizationName - Name of the organization owning the project + * @param {string} request.namespaceName - Name of the namespace owning the project * @returns {Promise} The workload configuration * @throws {Error} When there's an error fetching data from the API */ @@ -40,15 +40,15 @@ export class WorkloadInfoService implements WorkloadService { request: { projectName: string; componentName: string; - organizationName: string; + namespaceName: string; }, token?: string, ): Promise { - const { projectName, componentName, organizationName } = request; + const { projectName, componentName, namespaceName } = request; try { this.logger.info( - `Fetching workload info for component: ${componentName} in project: ${projectName}, org: ${organizationName}`, + `Fetching workload info for component: ${componentName} in project: ${projectName}, namespace: ${namespaceName}`, ); const client = createOpenChoreoApiClient({ @@ -58,11 +58,11 @@ export class WorkloadInfoService implements WorkloadService { }); const { data, error, response } = await client.GET( - '/orgs/{orgName}/projects/{projectName}/components/{componentName}/workloads', + '/namespaces/{namespaceName}/projects/{projectName}/components/{componentName}/workloads', { params: { path: { - orgName: organizationName, + namespaceName, projectName, componentName, }, @@ -93,7 +93,7 @@ export class WorkloadInfoService implements WorkloadService { * @param {Object} request - The request parameters * @param {string} request.projectName - Name of the project containing the component * @param {string} request.componentName - Name of the component to apply workload for - * @param {string} request.organizationName - Name of the organization owning the project + * @param {string} request.namespaceName - Name of the namespace owning the project * @param {ModelsWorkload} request.workloadSpec - The workload specification to apply * @returns {Promise} The result of the apply operation * @throws {Error} When there's an error applying the workload @@ -102,17 +102,16 @@ export class WorkloadInfoService implements WorkloadService { request: { projectName: string; componentName: string; - organizationName: string; + namespaceName: string; workloadSpec: ModelsWorkload; }, token?: string, ): Promise { - const { projectName, componentName, organizationName, workloadSpec } = - request; + const { projectName, componentName, namespaceName, workloadSpec } = request; try { this.logger.info( - `Applying workload for component: ${componentName} in project: ${projectName}, org: ${organizationName}`, + `Applying workload for component: ${componentName} in project: ${projectName}, namespace: ${namespaceName}`, ); const client = createOpenChoreoApiClient({ @@ -122,11 +121,11 @@ export class WorkloadInfoService implements WorkloadService { }); const { data, error, response } = await client.POST( - '/orgs/{orgName}/projects/{projectName}/components/{componentName}/workloads', + '/namespaces/{namespaceName}/projects/{projectName}/components/{componentName}/workloads', { params: { path: { - orgName: organizationName, + namespaceName, projectName, componentName, }, diff --git a/plugins/openchoreo-backend/src/types.ts b/plugins/openchoreo-backend/src/types.ts index 3a01bb44..a115f37e 100644 --- a/plugins/openchoreo-backend/src/types.ts +++ b/plugins/openchoreo-backend/src/types.ts @@ -11,7 +11,7 @@ export interface EnvironmentService { fetchDeploymentInfo(request: { projectName: string; componentName: string; - organizationName: string; + namespaceName: string; }): Promise; promoteComponent(request: { @@ -19,13 +19,13 @@ export interface EnvironmentService { targetEnvironment: string; componentName: string; projectName: string; - organizationName: string; + namespaceName: string; }): Promise; updateComponentBinding(request: { componentName: string; projectName: string; - organizationName: string; + namespaceName: string; bindingName: string; releaseState: 'Active' | 'Suspend' | 'Undeploy'; }): Promise; @@ -112,7 +112,7 @@ export interface CellDiagramService { fetchProjectInfo( request: { projectName: string; - orgName: string; + namespaceName: string; }, token?: string, ): Promise; @@ -123,7 +123,7 @@ export interface WorkloadService { request: { projectName: string; componentName: string; - organizationName: string; + namespaceName: string; }, token?: string, ): Promise; @@ -132,7 +132,7 @@ export interface WorkloadService { request: { projectName: string; componentName: string; - organizationName: string; + namespaceName: string; workloadSpec: any; }, token?: string, @@ -152,7 +152,7 @@ export interface RuntimeLogsService { limit?: number; offset?: number; }, - orgName: string, + namespaceName: string, projectName: string, token?: string, ): Promise; @@ -160,7 +160,7 @@ export interface RuntimeLogsService { export interface SecretReferencesService { fetchSecretReferences( - orgName: string, + namespaceName: string, token?: string, ): Promise; } diff --git a/plugins/openchoreo-ci-backend/src/router.ts b/plugins/openchoreo-ci-backend/src/router.ts index ebdee6a9..b68a13a3 100644 --- a/plugins/openchoreo-ci-backend/src/router.ts +++ b/plugins/openchoreo-ci-backend/src/router.ts @@ -29,11 +29,11 @@ export async function createRouter({ const requireAuth = createRequireAuthMiddleware(tokenService, authEnabled); router.get('/builds', async (req, res) => { - const { componentName, projectName, organizationName } = req.query; + const { componentName, projectName, namespaceName } = req.query; - if (!componentName || !projectName || !organizationName) { + if (!componentName || !projectName || !namespaceName) { throw new InputError( - 'componentName, projectName and organizationName are required query parameters', + 'componentName, projectName and namespaceName are required query parameters', ); } @@ -41,7 +41,7 @@ export async function createRouter({ res.json( await workflowService.fetchBuilds( - organizationName as string, + namespaceName as string, projectName as string, componentName as string, userToken, @@ -50,11 +50,11 @@ export async function createRouter({ }); router.post('/builds', requireAuth, async (req, res) => { - const { componentName, projectName, organizationName, commit } = req.body; + const { componentName, projectName, namespaceName, commit } = req.body; - if (!componentName || !projectName || !organizationName) { + if (!componentName || !projectName || !namespaceName) { throw new InputError( - 'componentName, projectName and organizationName are required in request body', + 'componentName, projectName and namespaceName are required in request body', ); } @@ -62,7 +62,7 @@ export async function createRouter({ res.json( await workflowService.triggerBuild( - organizationName as string, + namespaceName as string, projectName as string, componentName as string, commit as string | undefined, @@ -72,11 +72,11 @@ export async function createRouter({ }); router.get('/workflow-run', async (req, res) => { - const { componentName, projectName, organizationName, runName } = req.query; + const { componentName, projectName, namespaceName, runName } = req.query; - if (!componentName || !projectName || !organizationName || !runName) { + if (!componentName || !projectName || !namespaceName || !runName) { throw new InputError( - 'componentName, projectName, organizationName and runName are required query parameters', + 'componentName, projectName, namespaceName and runName are required query parameters', ); } @@ -84,7 +84,7 @@ export async function createRouter({ res.json( await workflowService.getWorkflowRun( - organizationName as string, + namespaceName as string, projectName as string, componentName as string, runName as string, @@ -94,28 +94,25 @@ export async function createRouter({ }); router.get('/workflows', async (req, res) => { - const { organizationName } = req.query; + const { namespaceName } = req.query; - if (!organizationName) { - throw new InputError('organizationName is required query parameter'); + if (!namespaceName) { + throw new InputError('namespaceName is required query parameter'); } const userToken = getUserTokenFromRequest(req); res.json( - await workflowService.fetchWorkflows( - organizationName as string, - userToken, - ), + await workflowService.fetchWorkflows(namespaceName as string, userToken), ); }); router.get('/workflow-schema', async (req, res) => { - const { organizationName, workflowName } = req.query; + const { namespaceName, workflowName } = req.query; - if (!organizationName || !workflowName) { + if (!namespaceName || !workflowName) { throw new InputError( - 'organizationName and workflowName are required query parameters', + 'namespaceName and workflowName are required query parameters', ); } @@ -123,7 +120,7 @@ export async function createRouter({ res.json( await workflowService.fetchWorkflowSchema( - organizationName as string, + namespaceName as string, workflowName as string, userToken, ), @@ -131,11 +128,11 @@ export async function createRouter({ }); router.patch('/workflow-parameters', requireAuth, async (req, res) => { - const { organizationName, projectName, componentName } = req.query; + const { namespaceName, projectName, componentName } = req.query; - if (!organizationName || !projectName || !componentName) { + if (!namespaceName || !projectName || !componentName) { throw new InputError( - 'organizationName, projectName and componentName are required query parameters', + 'namespaceName, projectName and componentName are required query parameters', ); } @@ -144,7 +141,7 @@ export async function createRouter({ res.json( await workflowService.updateComponentWorkflowParameters( - organizationName as string, + namespaceName as string, projectName as string, componentName as string, systemParameters, @@ -155,11 +152,11 @@ export async function createRouter({ }); router.get('/build-logs', async (req, res) => { - const { componentName, buildId, projectName, orgName } = req.query; + const { componentName, buildId, projectName, namespaceName } = req.query; - if (!componentName || !buildId || !projectName || !orgName) { + if (!componentName || !buildId || !projectName || !namespaceName) { throw new InputError( - 'componentName, buildId, projectName and orgName are required query parameters', + 'componentName, buildId, projectName and namespaceName are required query parameters', ); } @@ -167,7 +164,7 @@ export async function createRouter({ try { const logs = await workflowService.fetchBuildLogs( - orgName as string, + namespaceName as string, projectName as string, componentName as string, buildId as string, diff --git a/plugins/openchoreo-ci-backend/src/services/WorkflowService.ts b/plugins/openchoreo-ci-backend/src/services/WorkflowService.ts index 75d0e52b..065872ce 100644 --- a/plugins/openchoreo-ci-backend/src/services/WorkflowService.ts +++ b/plugins/openchoreo-ci-backend/src/services/WorkflowService.ts @@ -46,13 +46,13 @@ export class WorkflowService { // ==================== Build Operations ==================== async fetchBuilds( - orgName: string, + namespaceName: string, projectName: string, componentName: string, token?: string, ): Promise { this.logger.debug( - `Fetching component workflow runs for component: ${componentName} in project: ${projectName}, organization: ${orgName}`, + `Fetching component workflow runs for component: ${componentName} in project: ${projectName}, namespace: ${namespaceName}`, ); try { @@ -63,10 +63,10 @@ export class WorkflowService { }); const { data, error, response } = await client.GET( - '/orgs/{orgName}/projects/{projectName}/components/{componentName}/workflow-runs', + '/namespaces/{namespaceName}/projects/{projectName}/components/{componentName}/workflow-runs', { params: { - path: { orgName, projectName, componentName }, + path: { namespaceName, projectName, componentName }, }, }, ); @@ -96,14 +96,14 @@ export class WorkflowService { } async getWorkflowRun( - orgName: string, + namespaceName: string, projectName: string, componentName: string, runName: string, token?: string, ): Promise { this.logger.debug( - `Fetching workflow run: ${runName} for component: ${componentName} in project: ${projectName}, organization: ${orgName}`, + `Fetching workflow run: ${runName} for component: ${componentName} in project: ${projectName}, namespace: ${namespaceName}`, ); try { @@ -114,10 +114,10 @@ export class WorkflowService { }); const { data, error, response } = await client.GET( - '/orgs/{orgName}/projects/{projectName}/components/{componentName}/workflow-runs/{runName}', + '/namespaces/{namespaceName}/projects/{projectName}/components/{componentName}/workflow-runs/{runName}', { params: { - path: { orgName, projectName, componentName, runName }, + path: { namespaceName, projectName, componentName, runName }, }, }, ); @@ -143,14 +143,14 @@ export class WorkflowService { } async triggerBuild( - orgName: string, + namespaceName: string, projectName: string, componentName: string, commit?: string, token?: string, ): Promise { this.logger.info( - `Triggering component workflow for component: ${componentName} in project: ${projectName}, organization: ${orgName}${ + `Triggering component workflow for component: ${componentName} in project: ${projectName}, namespace: ${namespaceName}${ commit ? ` with commit: ${commit}` : '' }`, ); @@ -163,10 +163,10 @@ export class WorkflowService { }); const { data, error, response } = await client.POST( - '/orgs/{orgName}/projects/{projectName}/components/{componentName}/workflow-runs', + '/namespaces/{namespaceName}/projects/{projectName}/components/{componentName}/workflow-runs', { params: { - path: { orgName, projectName, componentName }, + path: { namespaceName, projectName, componentName }, query: commit ? { commit } : undefined, }, }, @@ -195,7 +195,7 @@ export class WorkflowService { } async fetchBuildLogs( - orgName: string, + namespaceName: string, projectName: string, componentName: string, buildId: string, @@ -220,11 +220,11 @@ export class WorkflowService { error: urlError, response: urlResponse, } = await mainClient.GET( - '/orgs/{orgName}/projects/{projectName}/components/{componentName}/observer-url', + '/namespaces/{namespaceName}/projects/{projectName}/components/{componentName}/observer-url', { params: { path: { - orgName, + namespaceName, projectName, componentName, }, @@ -275,7 +275,7 @@ export class WorkflowService { sortOrder: sortOrder || 'asc', componentName, projectName, - orgName, + namespaceName, }, }, ); @@ -321,13 +321,15 @@ export class WorkflowService { // ==================== Workflow Schema Operations ==================== /** - * Fetch list of component workflows for an organization + * Fetch list of component workflows for a namespace */ async fetchWorkflows( - orgName: string, + namespaceName: string, token?: string, ): Promise { - this.logger.debug(`Fetching component workflows for org: ${orgName}`); + this.logger.debug( + `Fetching component workflows for namespace: ${namespaceName}`, + ); try { const client = createOpenChoreoApiClient({ @@ -337,10 +339,10 @@ export class WorkflowService { }); const { data, error, response } = await client.GET( - '/orgs/{orgName}/component-workflows', + '/namespaces/{namespaceName}/component-workflows', { params: { - path: { orgName }, + path: { namespaceName }, }, }, ); @@ -358,12 +360,12 @@ export class WorkflowService { const workflowList: WorkflowListResponse = data as WorkflowListResponse; this.logger.debug( - `Successfully fetched ${workflowList.data.items.length} component workflows for org: ${orgName}`, + `Successfully fetched ${workflowList.data.items.length} component workflows for namespace: ${namespaceName}`, ); return workflowList; } catch (error) { this.logger.error( - `Failed to fetch component workflows for org ${orgName}: ${error}`, + `Failed to fetch component workflows for namespace ${namespaceName}: ${error}`, ); throw error; } @@ -373,12 +375,12 @@ export class WorkflowService { * Fetch JSONSchema for a specific component workflow */ async fetchWorkflowSchema( - orgName: string, + namespaceName: string, workflowName: string, token?: string, ): Promise { this.logger.debug( - `Fetching schema for component workflow: ${workflowName} in org: ${orgName}`, + `Fetching schema for component workflow: ${workflowName} in namespace: ${namespaceName}`, ); try { @@ -389,10 +391,10 @@ export class WorkflowService { }); const { data, error, response } = await client.GET( - '/orgs/{orgName}/component-workflows/{cwName}/schema', + '/namespaces/{namespaceName}/component-workflows/{cwName}/schema', { params: { - path: { orgName, cwName: workflowName }, + path: { namespaceName, cwName: workflowName }, }, }, ); @@ -416,7 +418,7 @@ export class WorkflowService { return workflowSchema; } catch (error) { this.logger.error( - `Failed to fetch schema for component workflow ${workflowName} in org ${orgName}: ${error}`, + `Failed to fetch schema for component workflow ${workflowName} in namespace ${namespaceName}: ${error}`, ); throw error; } @@ -426,7 +428,7 @@ export class WorkflowService { * Update component workflow parameters (PATCH) */ async updateComponentWorkflowParameters( - orgName: string, + namespaceName: string, projectName: string, componentName: string, systemParameters: { [key: string]: unknown }, @@ -434,7 +436,7 @@ export class WorkflowService { token?: string, ): Promise { this.logger.debug( - `Updating workflow parameters for component: ${componentName} in project: ${projectName}, org: ${orgName}`, + `Updating workflow parameters for component: ${componentName} in project: ${projectName}, namespace: ${namespaceName}`, ); try { @@ -445,10 +447,10 @@ export class WorkflowService { }); const { data, error, response } = await client.PATCH( - '/orgs/{orgName}/projects/{projectName}/components/{componentName}/workflow-parameters', + '/namespaces/{namespaceName}/projects/{projectName}/components/{componentName}/workflow-parameters', { params: { - path: { orgName, projectName, componentName }, + path: { namespaceName, projectName, componentName }, }, body: { systemParameters: systemParameters as any, diff --git a/plugins/openchoreo-ci/src/api/OpenChoreoCiClient.ts b/plugins/openchoreo-ci/src/api/OpenChoreoCiClient.ts index f7590820..3adc6f07 100644 --- a/plugins/openchoreo-ci/src/api/OpenChoreoCiClient.ts +++ b/plugins/openchoreo-ci/src/api/OpenChoreoCiClient.ts @@ -17,23 +17,22 @@ import type { interface EntityMetadata { component: string; project: string; - organization: string; + namespace: string; } function extractEntityMetadata(entity: Entity): EntityMetadata { const component = entity.metadata.annotations?.[CHOREO_ANNOTATIONS.COMPONENT]; const project = entity.metadata.annotations?.[CHOREO_ANNOTATIONS.PROJECT]; - const organization = - entity.metadata.annotations?.[CHOREO_ANNOTATIONS.ORGANIZATION]; + const namespace = entity.metadata.annotations?.[CHOREO_ANNOTATIONS.NAMESPACE]; - if (!component || !project || !organization) { + if (!component || !project || !namespace) { throw new Error( 'Missing required OpenChoreo annotations in entity. ' + - `Required: ${CHOREO_ANNOTATIONS.COMPONENT}, ${CHOREO_ANNOTATIONS.PROJECT}, ${CHOREO_ANNOTATIONS.ORGANIZATION}`, + `Required: ${CHOREO_ANNOTATIONS.COMPONENT}, ${CHOREO_ANNOTATIONS.PROJECT}, ${CHOREO_ANNOTATIONS.NAMESPACE}`, ); } - return { component, project, organization }; + return { component, project, namespace }; } function entityMetadataToParams( @@ -42,7 +41,7 @@ function entityMetadataToParams( return { componentName: metadata.component, projectName: metadata.project, - organizationName: metadata.organization, + namespaceName: metadata.namespace, }; } @@ -95,12 +94,12 @@ export class OpenChoreoCiClient implements OpenChoreoCiClientApi { } async fetchWorkflowSchema( - organizationName: string, + namespaceName: string, workflowName: string, ): Promise { return this.apiFetch('/workflow-schema', { params: { - organizationName, + namespaceName, workflowName, }, }); @@ -128,7 +127,7 @@ export class OpenChoreoCiClient implements OpenChoreoCiClientApi { !build.name || !build.uuid || !build.projectName || - !build.orgName + !build.namespaceName ) { throw new Error( 'Build object is missing required fields for fetching logs', @@ -140,7 +139,7 @@ export class OpenChoreoCiClient implements OpenChoreoCiClientApi { componentName: build.componentName, buildId: build.name, projectName: build.projectName, - orgName: build.orgName, + namespaceName: build.namespaceName, }, }); } diff --git a/plugins/openchoreo-ci/src/api/OpenChoreoCiClientApi.ts b/plugins/openchoreo-ci/src/api/OpenChoreoCiClientApi.ts index 25017eff..bfd16b6d 100644 --- a/plugins/openchoreo-ci/src/api/OpenChoreoCiClientApi.ts +++ b/plugins/openchoreo-ci/src/api/OpenChoreoCiClientApi.ts @@ -34,7 +34,7 @@ export interface WorkflowSchemaResponse { export interface OpenChoreoCiClientApi { /** Fetch workflow schema for configuration */ fetchWorkflowSchema( - organizationName: string, + namespaceName: string, workflowName: string, ): Promise; diff --git a/plugins/openchoreo-ci/src/components/WorkflowConfigPage/WorkflowConfigPage.tsx b/plugins/openchoreo-ci/src/components/WorkflowConfigPage/WorkflowConfigPage.tsx index ec314e12..b54ba7e2 100644 --- a/plugins/openchoreo-ci/src/components/WorkflowConfigPage/WorkflowConfigPage.tsx +++ b/plugins/openchoreo-ci/src/components/WorkflowConfigPage/WorkflowConfigPage.tsx @@ -75,15 +75,15 @@ export const WorkflowConfigPage = ({ setError(null); try { - const organization = - entity.metadata.annotations?.[CHOREO_ANNOTATIONS.ORGANIZATION]; + const namespace = + entity.metadata.annotations?.[CHOREO_ANNOTATIONS.NAMESPACE]; - if (!organization) { - throw new Error('Organization not found in entity'); + if (!namespace) { + throw new Error('Namespace not found in entity'); } const schemaResponse = await client.fetchWorkflowSchema( - organization, + namespace, workflowName, ); diff --git a/plugins/openchoreo-ci/src/components/Workflows/Workflows.tsx b/plugins/openchoreo-ci/src/components/Workflows/Workflows.tsx index faff71df..48917f2a 100644 --- a/plugins/openchoreo-ci/src/components/Workflows/Workflows.tsx +++ b/plugins/openchoreo-ci/src/components/Workflows/Workflows.tsx @@ -84,7 +84,7 @@ export const Workflows = () => { const triggerWorkflowOp = useAsyncOperation( useCallback( async (commit?: string) => { - const { componentName, projectName, organizationName } = + const { componentName, projectName, namespaceName } = await getEntityDetails(); const baseUrl = await discoveryApi.getBaseUrl('openchoreo-ci-backend'); @@ -96,7 +96,7 @@ export const Workflows = () => { body: JSON.stringify({ componentName, projectName, - organizationName, + namespaceName, commit, }), }); diff --git a/plugins/openchoreo-ci/src/hooks/useWorkflowData.ts b/plugins/openchoreo-ci/src/hooks/useWorkflowData.ts index 47da9fdc..991e7e7f 100644 --- a/plugins/openchoreo-ci/src/hooks/useWorkflowData.ts +++ b/plugins/openchoreo-ci/src/hooks/useWorkflowData.ts @@ -35,7 +35,7 @@ export function useWorkflowData() { const fetchComponentDetails = useCallback(async () => { try { - const { componentName, projectName, organizationName } = + const { componentName, projectName, namespaceName } = await getEntityDetails(); const baseUrl = await discoveryApi.getBaseUrl('openchoreo'); @@ -45,7 +45,7 @@ export function useWorkflowData() { componentName, )}&projectName=${encodeURIComponent( projectName, - )}&organizationName=${encodeURIComponent(organizationName)}`, + )}&namespaceName=${encodeURIComponent(namespaceName)}`, ); if (!response.ok) { @@ -61,7 +61,7 @@ export function useWorkflowData() { const fetchBuilds = useCallback(async () => { try { - const { componentName, projectName, organizationName } = + const { componentName, projectName, namespaceName } = await getEntityDetails(); const baseUrl = await discoveryApi.getBaseUrl('openchoreo-ci-backend'); @@ -71,7 +71,7 @@ export function useWorkflowData() { componentName, )}&projectName=${encodeURIComponent( projectName, - )}&organizationName=${encodeURIComponent(organizationName)}`, + )}&namespaceName=${encodeURIComponent(namespaceName)}`, ); if (!response.ok) { diff --git a/plugins/openchoreo-ci/src/hooks/useWorkflowRun.ts b/plugins/openchoreo-ci/src/hooks/useWorkflowRun.ts index 0b614596..b97194a3 100644 --- a/plugins/openchoreo-ci/src/hooks/useWorkflowRun.ts +++ b/plugins/openchoreo-ci/src/hooks/useWorkflowRun.ts @@ -64,7 +64,7 @@ export function useWorkflowRun(runName?: string): UseWorkflowRunResult { setLoading(true); setError(null); - const { componentName, projectName, organizationName } = + const { componentName, projectName, namespaceName } = await getEntityDetails(); const baseUrl = await discoveryApi.getBaseUrl('openchoreo-ci-backend'); @@ -73,8 +73,8 @@ export function useWorkflowRun(runName?: string): UseWorkflowRunResult { componentName, )}&projectName=${encodeURIComponent( projectName, - )}&organizationName=${encodeURIComponent( - organizationName, + )}&namespaceName=${encodeURIComponent( + namespaceName, )}&runName=${encodeURIComponent(runName)}`, ); diff --git a/plugins/openchoreo-common/src/constants.ts b/plugins/openchoreo-common/src/constants.ts index aed4f09d..57aed443 100644 --- a/plugins/openchoreo-common/src/constants.ts +++ b/plugins/openchoreo-common/src/constants.ts @@ -1,6 +1,5 @@ export const CHOREO_ANNOTATIONS = { PROJECT: 'openchoreo.io/project', - ORGANIZATION: 'openchoreo.io/organization', DEPLOYMENT: 'openchoreo.io/deployment', ENDPOINT: 'openchoreo.io/endpoint', ENVIRONMENT: 'openchoreo.io/environment', diff --git a/plugins/openchoreo-common/src/index.ts b/plugins/openchoreo-common/src/index.ts index 9f27bc46..74863795 100644 --- a/plugins/openchoreo-common/src/index.ts +++ b/plugins/openchoreo-common/src/index.ts @@ -12,7 +12,7 @@ export { openchoreoComponentUpdatePermission, openchoreoProjectCreatePermission, openchoreoProjectReadPermission, - openchoreoOrganizationReadPermission, + openchoreoNamespaceReadPermission, openchoreoEnvironmentCreatePermission, openchoreoEnvironmentReadPermission, openchoreoReleaseCreatePermission, diff --git a/plugins/openchoreo-common/src/permissions.ts b/plugins/openchoreo-common/src/permissions.ts index 3b735b91..a6671b6e 100644 --- a/plugins/openchoreo-common/src/permissions.ts +++ b/plugins/openchoreo-common/src/permissions.ts @@ -9,7 +9,7 @@ export const OPENCHOREO_RESOURCE_TYPE_PROJECT = 'openchoreo-project'; /** * Permission to create a new component. - * Requires organization and project context. + * Requires namespace and project context. */ export const openchoreoComponentCreatePermission = createPermission({ name: 'openchoreo.component.create', @@ -68,7 +68,7 @@ export const openchoreoComponentUpdatePermission = createPermission({ /** * Permission to create a new project. - * Requires organization context. + * Requires namespace context. */ export const openchoreoProjectCreatePermission = createPermission({ name: 'openchoreo.project.create', @@ -86,17 +86,17 @@ export const openchoreoProjectReadPermission = createPermission({ }); /** - * Permission to read/view organization details. - * Org-scoped permission. + * Permission to read/view namespace details. + * Namespace-scoped permission. */ -export const openchoreoOrganizationReadPermission = createPermission({ - name: 'openchoreo.organization.read', +export const openchoreoNamespaceReadPermission = createPermission({ + name: 'openchoreo.namespace.read', attributes: { action: 'read' }, }); /** * Permission to create a new environment. - * Requires organization context. + * Requires namespace context. */ export const openchoreoEnvironmentCreatePermission = createPermission({ name: 'openchoreo.environment.create', @@ -245,7 +245,7 @@ export const openchoreoPermissions = [ openchoreoComponentUpdatePermission, openchoreoProjectCreatePermission, openchoreoProjectReadPermission, - openchoreoOrganizationReadPermission, + openchoreoNamespaceReadPermission, openchoreoEnvironmentCreatePermission, openchoreoEnvironmentReadPermission, openchoreoReleaseCreatePermission, @@ -277,7 +277,7 @@ export const OPENCHOREO_PERMISSION_TO_ACTION: Record = { 'openchoreo.component.deploy': 'component:deploy', 'openchoreo.project.create': 'project:create', 'openchoreo.project.read': 'project:view', - 'openchoreo.organization.read': 'organization:view', + 'openchoreo.namespace.read': 'namespace:view', 'openchoreo.environment.create': 'environment:create', 'openchoreo.environment.read': 'environment:view', 'openchoreo.release.create': 'componentrelease:create', @@ -312,7 +312,7 @@ export const CATALOG_PERMISSION_TO_ACTION: Record = { * * - Component: Maps to OpenChoreo components * - System: Maps to OpenChoreo projects - * - Domain: Maps to OpenChoreo organizations + * - Domain: Maps to OpenChoreo namespaces */ export const OPENCHOREO_MANAGED_ENTITY_KINDS = [ 'Component', @@ -328,7 +328,7 @@ export const OPENCHOREO_MANAGED_ENTITY_KINDS = [ * Each kind maps to a different resource type in OpenChoreo: * - Component → component:* actions * - System → project:* actions - * - Domain → organization:* actions + * - Domain → namespace:* actions */ export const CATALOG_KIND_TO_ACTION: Record> = { component: { @@ -340,6 +340,6 @@ export const CATALOG_KIND_TO_ACTION: Record> = { 'catalog.entity.read': 'project:view', }, domain: { - 'catalog.entity.read': 'organization:view', + 'catalog.entity.read': 'namespace:view', }, }; diff --git a/plugins/openchoreo-observability-backend/src/plugin.test.ts b/plugins/openchoreo-observability-backend/src/plugin.test.ts index b3d33162..0c9f0526 100644 --- a/plugins/openchoreo-observability-backend/src/plugin.test.ts +++ b/plugins/openchoreo-observability-backend/src/plugin.test.ts @@ -60,7 +60,7 @@ describe('plugin', () => { fetchMetricsByComponent: jest .fn() .mockResolvedValue(mockResourceMetricsTimeSeries), - fetchEnvironmentsByOrganization: jest.fn().mockResolvedValue([]), + fetchEnvironmentsByNamespace: jest.fn().mockResolvedValue([]), fetchTracesByProject: jest.fn().mockResolvedValue({ traces: [], tookMs: 0, @@ -83,7 +83,7 @@ describe('plugin', () => { .send({ componentId: 'component-1', environmentId: 'environment-1', - orgName: 'org-1', + namespaceName: 'namespace-1', projectName: 'project-1', options: { limit: 100, @@ -106,7 +106,7 @@ describe('plugin', () => { fetchMetricsByComponent: jest .fn() .mockRejectedValue(new Error('Failed to fetch metrics')), - fetchEnvironmentsByOrganization: jest + fetchEnvironmentsByNamespace: jest .fn() .mockRejectedValue(new Error('Failed to fetch environments')), fetchTracesByProject: jest @@ -131,7 +131,7 @@ describe('plugin', () => { .send({ componentId: 'component-1', environmentId: 'environment-1', - orgName: 'org-1', + namespaceName: 'namespace-1', projectName: 'project-1', options: { limit: 100, diff --git a/plugins/openchoreo-observability-backend/src/router.test.ts b/plugins/openchoreo-observability-backend/src/router.test.ts index dd86e58e..a4edea49 100644 --- a/plugins/openchoreo-observability-backend/src/router.test.ts +++ b/plugins/openchoreo-observability-backend/src/router.test.ts @@ -59,7 +59,7 @@ describe('createRouter', () => { beforeEach(async () => { observabilityService = { fetchMetricsByComponent: jest.fn(), - fetchEnvironmentsByOrganization: jest.fn(), + fetchEnvironmentsByNamespace: jest.fn(), fetchTracesByProject: jest.fn(), fetchRCAReportsByProject: jest.fn(), fetchRCAReportByAlert: jest.fn(), @@ -94,7 +94,7 @@ describe('createRouter', () => { .send({ componentId: 'component-1', environmentId: 'environment-1', - orgName: 'org-1', + namespaceName: 'org-1', projectName: 'project-1', options: { limit: 100, @@ -122,7 +122,7 @@ describe('createRouter', () => { .send({ componentId: 'component-1', environmentId: 'environment-1', - orgName: 'org-1', + namespaceName: 'org-1', projectName: 'project-1', options: { limit: 100, diff --git a/plugins/openchoreo-observability-backend/src/router.ts b/plugins/openchoreo-observability-backend/src/router.ts index 1daa3222..48245b2e 100644 --- a/plugins/openchoreo-observability-backend/src/router.ts +++ b/plugins/openchoreo-observability-backend/src/router.ts @@ -37,7 +37,7 @@ export async function createRouter({ _req.body.componentId, _req.body.projectId, _req.body.environmentId, - _req.body.orgName, + _req.body.namespaceName, _req.body.projectName, _req.body.environmentName, _req.body.componentName, @@ -65,7 +65,7 @@ export async function createRouter({ _req.body.componentId, _req.body.projectId, _req.body.environmentId, - _req.body.orgName, + _req.body.namespaceName, _req.body.projectName, _req.body.environmentName, _req.body.componentName, @@ -85,15 +85,15 @@ export async function createRouter({ if (authEnabled) { await httpAuth.credentials(req, { allow: ['user'] }); } - const { organization } = req.query; - if (!organization) { - return res.status(400).json({ error: 'Organization is required' }); + const { namespace } = req.query; + if (!namespace) { + return res.status(400).json({ error: 'Namespace is required' }); } const userToken = getUserTokenFromRequest(req); try { const environments = - await observabilityService.fetchEnvironmentsByOrganization( - organization as string, + await observabilityService.fetchEnvironmentsByNamespace( + namespace as string, userToken, ); return res.status(200).json({ environments }); @@ -117,7 +117,7 @@ export async function createRouter({ const traces = await observabilityService.fetchTracesByProject( _req.body.projectId, _req.body.environmentId, - _req.body.orgName, + _req.body.namespaceName, _req.body.projectName, _req.body.environmentName, _req.body.componentUids || [], @@ -144,7 +144,7 @@ export async function createRouter({ const reports = await observabilityService.fetchRCAReportsByProject( _req.body.projectId, _req.body.environmentId, - _req.body.orgName, + _req.body.namespaceName, _req.body.environmentName, _req.body.componentUids || [], _req.body.options, @@ -172,7 +172,7 @@ export async function createRouter({ try { const report = await observabilityService.fetchRCAReportByAlert( alertId, - _req.body.orgName, + _req.body.namespaceName, _req.body.environmentName, _req.body.options, userToken, diff --git a/plugins/openchoreo-observability-backend/src/services/ObservabilityService.ts b/plugins/openchoreo-observability-backend/src/services/ObservabilityService.ts index 975f8021..255e7581 100644 --- a/plugins/openchoreo-observability-backend/src/services/ObservabilityService.ts +++ b/plugins/openchoreo-observability-backend/src/services/ObservabilityService.ts @@ -54,15 +54,15 @@ export class ObservabilityService { } /** - * Resolves the observability URL for a given organization and environment. + * Resolves the observability URL for a given namespace and environment. * - * @param orgName - The organization name + * @param namespaceName - The namespace name * @param environmentName - The environment name * @param userToken - Optional user token for authentication * @returns The resolved observer URL */ private async resolveObserverUrl( - orgName: string, + namespaceName: string, environmentName: string, userToken?: string, ): Promise { @@ -81,11 +81,11 @@ export class ObservabilityService { error: urlError, response: urlResponse, } = await mainClient.GET( - '/orgs/{orgName}/environments/{envName}/observer-url', + '/namespaces/{namespaceName}/environments/{envName}/observer-url', { params: { path: { - orgName, + namespaceName, envName: environmentName, }, }, @@ -106,11 +106,11 @@ export class ObservabilityService { const observerUrl = urlData.data.observerUrl; if (!observerUrl) { - throw new ObservabilityNotConfiguredError(orgName); + throw new ObservabilityNotConfiguredError(namespaceName); } this.logger.debug( - `Resolved observer URL: ${observerUrl} for org ${orgName}, environment ${environmentName}`, + `Resolved observer URL: ${observerUrl} for namespace ${namespaceName}, environment ${environmentName}`, ); return observerUrl; @@ -119,17 +119,17 @@ export class ObservabilityService { /** * Fetches environments for observability filtering purposes. * - * @param organizationName - The organization name + * @param namespaceName - The namespace name * @param userToken - Optional user token for authentication (takes precedence over default token) */ - async fetchEnvironmentsByOrganization( - organizationName: string, + async fetchEnvironmentsByNamespace( + namespaceName: string, userToken?: string, ): Promise { const startTime = Date.now(); try { this.logger.debug( - `Starting environment fetch for organization: ${organizationName}`, + `Starting environment fetch for namespace: ${namespaceName}`, ); const client = createOpenChoreoApiClient({ @@ -139,24 +139,24 @@ export class ObservabilityService { }); const { data, error, response } = await client.GET( - '/orgs/{orgName}/environments', + '/namespaces/{namespaceName}/environments', { params: { - path: { orgName: organizationName }, + path: { namespaceName }, }, }, ); if (error || !response.ok) { this.logger.error( - `Failed to fetch environments for organization ${organizationName}: ${response.status} ${response.statusText}`, + `Failed to fetch environments for namespace ${namespaceName}: ${response.status} ${response.statusText}`, ); return []; } if (!data.success || !data.data?.items) { this.logger.warn( - `No environments found for organization ${organizationName}`, + `No environments found for namespace ${namespaceName}`, ); return []; } @@ -172,7 +172,7 @@ export class ObservabilityService { } catch (error: unknown) { const totalTime = Date.now() - startTime; this.logger.error( - `Error fetching environments for organization ${organizationName} (${totalTime}ms):`, + `Error fetching environments for namespace ${namespaceName} (${totalTime}ms):`, error as Error, ); return []; @@ -185,7 +185,7 @@ export class ObservabilityService { * @param componentId - The ID of the component * @param projectId - The ID of the project * @param environmentId - The ID of the environment - * @param orgName - The organization name + * @param namespaceName - The namespace name * @param projectName - The project name * @param environmentName - The name of the environment * @param componentName - The name of the component @@ -201,7 +201,7 @@ export class ObservabilityService { componentId: string, projectId: string, environmentId: string, - orgName: string, + namespaceName: string, projectName: string, environmentName: string, componentName: string, @@ -216,11 +216,11 @@ export class ObservabilityService { const startTime = Date.now(); try { this.logger.info( - `Fetching runtime logs for component ${componentName} in organization ${orgName} and environment ${environmentName}`, + `Fetching runtime logs for component ${componentName} in namespace ${namespaceName} and environment ${environmentName}`, ); const observerUrl = await this.resolveObserverUrl( - orgName, + namespaceName, environmentName, userToken, ); @@ -251,7 +251,7 @@ export class ObservabilityService { environmentId, componentName, projectName, - orgName, + namespaceName, environmentName, limit: options?.limit || 100, sortOrder: 'desc', @@ -336,7 +336,7 @@ export class ObservabilityService { * @param componentId - The ID of the component * @param projectId - The ID of the project * @param environmentId - The ID of the environment - * @param orgName - The organization name + * @param namespaceName - The namespace name * @param projectName - The project name * @param environmentName - The name of the environment * @param componentName - The name of the component @@ -352,7 +352,7 @@ export class ObservabilityService { componentId: string, projectId: string, environmentId: string, - orgName: string, + namespaceName: string, projectName: string, environmentName: string, componentName: string, @@ -381,10 +381,15 @@ export class ObservabilityService { error: urlError, response: urlResponse, } = await mainClient.GET( - '/orgs/{orgName}/projects/{projectName}/components/{componentName}/environments/{environmentName}/observer-url', + '/namespaces/{namespaceName}/projects/{projectName}/components/{componentName}/environments/{environmentName}/observer-url', { params: { - path: { orgName, projectName, componentName, environmentName }, + path: { + namespaceName, + projectName, + componentName, + environmentName, + }, }, }, ); @@ -428,7 +433,7 @@ export class ObservabilityService { projectId, componentName, projectName, - orgName, + namespaceName, environmentName, limit: options?.limit || 100, offset: options?.offset || 0, @@ -449,7 +454,7 @@ export class ObservabilityService { projectId, componentName, projectName, - orgName, + namespaceName, environmentName, limit: options?.limit || 100, offset: options?.offset || 0, @@ -532,7 +537,7 @@ export class ObservabilityService { * * @param projectId - The ID of the project * @param environmentId - The ID of the environment - * @param orgName - The organization name + * @param namespaceName - The namespace name * @param projectName - The project name * @param environmentName - The name of the environment * @param componentUids - Array of component UIDs to filter traces (optional) @@ -548,7 +553,7 @@ export class ObservabilityService { async fetchTracesByProject( projectId: string, environmentId: string, - orgName: string, + namespaceName: string, projectName: string, environmentName: string, componentUids: string[], @@ -585,7 +590,7 @@ export class ObservabilityService { // Resolve the observer URL using the helper function const observerUrl = await this.resolveObserverUrl( - orgName, + namespaceName, environmentName, userToken, ); @@ -618,7 +623,7 @@ export class ObservabilityService { sortOrder: options?.sortOrder || 'desc', componentNames, projectName, - orgName, + namespaceName, environmentName, }; @@ -689,7 +694,7 @@ export class ObservabilityService { * * @param projectId - The ID of the project * @param environmentId - The ID of the environment - * @param orgName - The organization name + * @param namespaceName - The namespace name * @param environmentName - The name of the environment * @param componentUids - Array of component UIDs to filter reports (optional) * @param options - Parameters for filtering reports @@ -703,7 +708,7 @@ export class ObservabilityService { async fetchRCAReportsByProject( projectId: string, environmentId: string, - orgName: string, + namespaceName: string, environmentName: string, componentUids: string[], options: { @@ -733,7 +738,7 @@ export class ObservabilityService { // Resolve the observer URL using the helper function const observerUrl = await this.resolveObserverUrl( - orgName, + namespaceName, environmentName, userToken, ); @@ -819,7 +824,7 @@ export class ObservabilityService { * then fetches the RCA report from the observability service. * * @param alertId - The ID of the alert - * @param orgName - The organization name + * @param namespaceName - The namespace name * @param environmentName - The name of the environment * @param options - Optional parameters * @param options.version - Specific version number of the report to retrieve @@ -828,7 +833,7 @@ export class ObservabilityService { */ async fetchRCAReportByAlert( alertId: string, - orgName: string, + namespaceName: string, environmentName: string, options?: { version?: number; @@ -852,7 +857,7 @@ export class ObservabilityService { // Resolve the observer URL using the helper function const observerUrl = await this.resolveObserverUrl( - orgName, + namespaceName, environmentName, userToken, ); diff --git a/plugins/openchoreo-observability/src/api/ObservabilityApi.ts b/plugins/openchoreo-observability/src/api/ObservabilityApi.ts index 1c1606ed..b50ff7c8 100644 --- a/plugins/openchoreo-observability/src/api/ObservabilityApi.ts +++ b/plugins/openchoreo-observability/src/api/ObservabilityApi.ts @@ -11,7 +11,7 @@ export interface ObservabilityApi { componentId: string, projectId: string, environmentId: string, - orgName: string, + namespaceName: string, projectName: string, environmentName: string, componentName: string, @@ -29,7 +29,7 @@ export interface ObservabilityApi { environmentId: string, environmentName: string, componentName: string, - orgName: string, + namespaceName: string, projectName: string, options?: { limit?: number; @@ -43,7 +43,7 @@ export interface ObservabilityApi { projectId: string, environmentId: string, environmentName: string, - orgName: string, + namespaceName: string, projectName: string, componentUids: string[], options?: { @@ -62,7 +62,7 @@ export interface ObservabilityApi { projectId: string, environmentId: string, environmentName: string, - orgName: string, + namespaceName: string, projectName: string, componentUids: string[], options?: { @@ -82,7 +82,7 @@ export interface ObservabilityApi { projectId: string, environmentId: string, environmentName: string, - orgName: string, + namespaceName: string, projectName: string, options?: { version?: number; @@ -109,7 +109,7 @@ export class ObservabilityClient implements ObservabilityApi { environmentId: string, environmentName: string, componentName: string, - orgName: string, + namespaceName: string, projectName: string, options?: { limit?: number; @@ -129,7 +129,7 @@ export class ObservabilityClient implements ObservabilityApi { environmentId, environmentName, componentName, - orgName, + namespaceName, projectName, options, }), @@ -178,7 +178,7 @@ export class ObservabilityClient implements ObservabilityApi { projectId: string, environmentId: string, environmentName: string, - orgName: string, + namespaceName: string, projectName: string, componentUids: string[], options?: { @@ -201,7 +201,7 @@ export class ObservabilityClient implements ObservabilityApi { projectId, environmentId, environmentName, - orgName, + namespaceName, projectName, componentUids, options, @@ -232,7 +232,7 @@ export class ObservabilityClient implements ObservabilityApi { projectId: string, environmentId: string, environmentName: string, - orgName: string, + namespaceName: string, projectName: string, componentUids: string[], options?: { @@ -255,7 +255,7 @@ export class ObservabilityClient implements ObservabilityApi { projectId, environmentId, environmentName, - orgName, + namespaceName, projectName, componentUids, options, @@ -291,7 +291,7 @@ export class ObservabilityClient implements ObservabilityApi { projectId: string, environmentId: string, environmentName: string, - orgName: string, + namespaceName: string, projectName: string, options?: { version?: number; @@ -308,7 +308,7 @@ export class ObservabilityClient implements ObservabilityApi { projectId, environmentId, environmentName, - orgName, + namespaceName, projectName, options, }), @@ -337,7 +337,7 @@ export class ObservabilityClient implements ObservabilityApi { componentId: string, projectId: string, environmentId: string, - orgName: string, + namespaceName: string, projectName: string, environmentName: string, componentName: string, @@ -352,7 +352,7 @@ export class ObservabilityClient implements ObservabilityApi { 'openchoreo-observability-backend', ); const url = new URL(`${baseUrl}/logs/component/${componentName}`); - url.searchParams.set('orgName', orgName); + url.searchParams.set('namespaceName', namespaceName); url.searchParams.set('projectName', projectName); const response = await this.fetchApi.fetch(url.toString(), { @@ -361,7 +361,7 @@ export class ObservabilityClient implements ObservabilityApi { componentId, projectId, environmentId, - orgName, + namespaceName, projectName, environmentName, componentName, diff --git a/plugins/openchoreo-observability/src/components/Metrics/ObservabilityMetricsPage.tsx b/plugins/openchoreo-observability/src/components/Metrics/ObservabilityMetricsPage.tsx index d359c39a..127c3f09 100644 --- a/plugins/openchoreo-observability/src/components/Metrics/ObservabilityMetricsPage.tsx +++ b/plugins/openchoreo-observability/src/components/Metrics/ObservabilityMetricsPage.tsx @@ -19,8 +19,8 @@ import { MetricsFilters } from './MetricsFilters'; import { MetricGraphByComponent } from './MetricGraphByComponent'; import { MetricsActions } from './MetricsActions'; import { - useGetOrgAndProjectByEntity, - useGetEnvironmentsByOrganization, + useGetNamespaceAndProjectByEntity, + useGetEnvironmentsByNamespace, useUrlFilters, useMetrics, } from '../../hooks'; @@ -46,15 +46,15 @@ export const ObservabilityMetricsPage = () => { } = useMetricsPermission(); const { - organization, + namespace, project, - error: organizationError, - } = useGetOrgAndProjectByEntity(entity); + error: namespaceError, + } = useGetNamespaceAndProjectByEntity(entity); const { environments, loading: environmentsLoading, error: environmentsError, - } = useGetEnvironmentsByOrganization(organization); + } = useGetEnvironmentsByNamespace(namespace); // URL-synced filters - must be after environments are available const { filters, updateFilters } = useUrlFilters({ @@ -70,7 +70,7 @@ export const ObservabilityMetricsPage = () => { refresh, componentId, projectId, - } = useMetrics(filters, entity, organization as string, project as string); + } = useMetrics(filters, entity, namespace as string, project as string); // Track previous filter values to detect changes const previousFiltersRef = useRef({ @@ -122,7 +122,7 @@ export const ObservabilityMetricsPage = () => { refresh(); }; - if (organizationError) { + if (namespaceError) { // TODO: Add a toast notification here return <>; } diff --git a/plugins/openchoreo-observability/src/components/RCA/RCAPage.tsx b/plugins/openchoreo-observability/src/components/RCA/RCAPage.tsx index f427c263..c9d13ced 100644 --- a/plugins/openchoreo-observability/src/components/RCA/RCAPage.tsx +++ b/plugins/openchoreo-observability/src/components/RCA/RCAPage.tsx @@ -8,7 +8,7 @@ import { useEntity } from '@backstage/plugin-catalog-react'; import { CHOREO_ANNOTATIONS } from '@openchoreo/backstage-plugin-common'; import { useFilters, - useGetEnvironmentsByOrganization, + useGetEnvironmentsByNamespace, useRCAReports, extractEntityUids, useEntitiesByUids, @@ -21,13 +21,12 @@ import { EntityLinkContext } from './RCAReport/EntityLinkContext'; const RCAListView = () => { const { entity } = useEntity(); - const organization = - entity.metadata.annotations?.[CHOREO_ANNOTATIONS.ORGANIZATION]; + const namespace = entity.metadata.annotations?.[CHOREO_ANNOTATIONS.NAMESPACE]; const { environments, loading: environmentsLoading, error: environmentsError, - } = useGetEnvironmentsByOrganization(organization); + } = useGetEnvironmentsByNamespace(namespace); const { filters, updateFilters } = useFilters(); const { diff --git a/plugins/openchoreo-observability/src/components/RCA/RCAReport.tsx b/plugins/openchoreo-observability/src/components/RCA/RCAReport.tsx index 816e67c7..bed3d99e 100644 --- a/plugins/openchoreo-observability/src/components/RCA/RCAReport.tsx +++ b/plugins/openchoreo-observability/src/components/RCA/RCAReport.tsx @@ -6,7 +6,7 @@ import { useEntity } from '@backstage/plugin-catalog-react'; import { useRCAReportByAlert, useFilters, - useGetEnvironmentsByOrganization, + useGetEnvironmentsByNamespace, } from '../../hooks'; import { CHOREO_ANNOTATIONS } from '@openchoreo/backstage-plugin-common'; import { RCAReportView } from './RCAReport/RCAReportView'; @@ -16,11 +16,10 @@ export const RCAReport = () => { const navigate = useNavigate(); const { entity } = useEntity(); const { filters } = useFilters(); - const organization = - entity.metadata.annotations?.[CHOREO_ANNOTATIONS.ORGANIZATION]; + const namespace = entity.metadata.annotations?.[CHOREO_ANNOTATIONS.NAMESPACE]; // Get environments to ensure we have environment data - const { environments } = useGetEnvironmentsByOrganization(organization); + const { environments } = useGetEnvironmentsByNamespace(namespace); const environment = filters.environment || environments[0]; const { diff --git a/plugins/openchoreo-observability/src/components/RuntimeLogs/ObservabilityRuntimeLogsPage.tsx b/plugins/openchoreo-observability/src/components/RuntimeLogs/ObservabilityRuntimeLogsPage.tsx index 66729263..8174ffea 100644 --- a/plugins/openchoreo-observability/src/components/RuntimeLogs/ObservabilityRuntimeLogsPage.tsx +++ b/plugins/openchoreo-observability/src/components/RuntimeLogs/ObservabilityRuntimeLogsPage.tsx @@ -8,8 +8,8 @@ import { LogsTable } from './LogsTable'; import { LogsActions } from './LogsActions'; import { useRuntimeLogs, - useGetOrgAndProjectByEntity, - useGetEnvironmentsByOrganization, + useGetNamespaceAndProjectByEntity, + useGetEnvironmentsByNamespace, useUrlFiltersForRuntimeLogs, } from '../../hooks'; import { @@ -29,15 +29,15 @@ export const ObservabilityRuntimeLogsPage = () => { const { entity } = useEntity(); - // Get organization and project names from entity - const { organization, project } = useGetOrgAndProjectByEntity(entity); + // Get namespace and project names from entity + const { namespace, project } = useGetNamespaceAndProjectByEntity(entity); // Fetch environments from observability backend const { environments: observabilityEnvironments, loading: environmentsLoading, error: environmentsError, - } = useGetEnvironmentsByOrganization(organization); + } = useGetEnvironmentsByNamespace(namespace); // Map observability Environment type to RuntimeLogs Environment type const environments = useMemo(() => { @@ -69,7 +69,7 @@ export const ObservabilityRuntimeLogsPage = () => { refresh, componentId, projectId, - } = useRuntimeLogs(entity, organization || '', project || '', { + } = useRuntimeLogs(entity, namespace || '', project || '', { environmentId: filters.environmentId, environmentName: selectedEnvironment?.resourceName || '', timeRange: filters.timeRange, @@ -111,7 +111,7 @@ export const ObservabilityRuntimeLogsPage = () => { if ( filters.environmentId && selectedEnvironment && - organization && + namespace && project && componentId && projectId && @@ -128,7 +128,7 @@ export const ObservabilityRuntimeLogsPage = () => { projectId, fetchLogs, selectedEnvironment, - organization, + namespace, project, ]); diff --git a/plugins/openchoreo-observability/src/components/Traces/ObservabilityTracesPage.tsx b/plugins/openchoreo-observability/src/components/Traces/ObservabilityTracesPage.tsx index 60517821..38532073 100644 --- a/plugins/openchoreo-observability/src/components/Traces/ObservabilityTracesPage.tsx +++ b/plugins/openchoreo-observability/src/components/Traces/ObservabilityTracesPage.tsx @@ -9,7 +9,7 @@ import { convertToTableFormat } from './utils'; import { useUrlFilters, useTraces, - useGetEnvironmentsByOrganization, + useGetEnvironmentsByNamespace, useGetComponentsByProject, } from '../../hooks'; import { Trace, Environment } from '../../types'; @@ -18,13 +18,12 @@ import { Alert } from '@material-ui/lab'; export const ObservabilityTracesPage = () => { const { entity } = useEntity(); - const organization = - entity.metadata.annotations?.[CHOREO_ANNOTATIONS.ORGANIZATION]; + const namespace = entity.metadata.annotations?.[CHOREO_ANNOTATIONS.NAMESPACE]; const { environments, loading: environmentsLoading, error: environmentsError, - } = useGetEnvironmentsByOrganization(organization); + } = useGetEnvironmentsByNamespace(namespace); const { components, loading: componentsLoading, diff --git a/plugins/openchoreo-observability/src/hooks/index.ts b/plugins/openchoreo-observability/src/hooks/index.ts index d5b4038f..11f28660 100644 --- a/plugins/openchoreo-observability/src/hooks/index.ts +++ b/plugins/openchoreo-observability/src/hooks/index.ts @@ -1,5 +1,5 @@ -export { useGetOrgAndProjectByEntity } from './useGetOrgAndProjectByEntity'; -export { useGetEnvironmentsByOrganization } from './useGetEnvironmentsByOrganization'; +export { useGetNamespaceAndProjectByEntity } from './useGetNamespaceAndProjectByEntity'; +export { useGetEnvironmentsByNamespace } from './useGetEnvironmentsByNamespace'; export { useFilters } from './useFilters'; export { useUrlFilters } from './useUrlFilters'; export { useMetrics } from './useMetrics'; diff --git a/plugins/openchoreo-observability/src/hooks/useGetComponentsByProject.ts b/plugins/openchoreo-observability/src/hooks/useGetComponentsByProject.ts index e1ed0cf1..03ba8ec0 100644 --- a/plugins/openchoreo-observability/src/hooks/useGetComponentsByProject.ts +++ b/plugins/openchoreo-observability/src/hooks/useGetComponentsByProject.ts @@ -10,7 +10,7 @@ export interface Component { displayName?: string; description?: string; project?: string; - organization?: string; + namespace?: string; } export interface UseGetComponentsByProjectResult { @@ -29,8 +29,7 @@ export const useGetComponentsByProject = ( entity: Entity, ): UseGetComponentsByProjectResult => { const catalogApi = useApi(catalogApiRef); - const organization = - entity.metadata.annotations?.[CHOREO_ANNOTATIONS.ORGANIZATION]; + const namespace = entity.metadata.annotations?.[CHOREO_ANNOTATIONS.NAMESPACE]; const project = entity.metadata.name; const [components, setComponents] = useState([]); const [loading, setLoading] = useState(true); @@ -38,11 +37,9 @@ export const useGetComponentsByProject = ( useEffect(() => { const fetchComponents = async () => { - if (!organization || !project) { + if (!namespace || !project) { setLoading(false); - setError( - 'Organization or project name not found in entity annotations', - ); + setError('Namespace or project name not found in entity annotations'); setComponents([]); return; } @@ -52,22 +49,22 @@ export const useGetComponentsByProject = ( setError(null); // Fetch components from Backstage catalog API - // Filter by kind=Component and matching organization/project annotations + // Filter by kind=Component and matching namespace/project annotations const catalogEntities = await catalogApi.getEntities({ filter: { kind: 'Component', }, }); - // Filter components that belong to this project and organization + // Filter components that belong to this project and namespace const projectComponents = catalogEntities.items .filter(component => { - const compOrg = - component.metadata.annotations?.[CHOREO_ANNOTATIONS.ORGANIZATION]; + const compNamespace = + component.metadata.annotations?.[CHOREO_ANNOTATIONS.NAMESPACE]; const compProject = component.metadata.annotations?.[CHOREO_ANNOTATIONS.PROJECT]; - return compOrg === organization && compProject === project; + return compNamespace === namespace && compProject === project; }) .map(component => ({ uid: @@ -80,10 +77,9 @@ export const useGetComponentsByProject = ( project: component.metadata.annotations?.[CHOREO_ANNOTATIONS.PROJECT] || project, - organization: - component.metadata.annotations?.[ - CHOREO_ANNOTATIONS.ORGANIZATION - ] || organization, + namespace: + component.metadata.annotations?.[CHOREO_ANNOTATIONS.NAMESPACE] || + namespace, })); setComponents(projectComponents); @@ -98,7 +94,7 @@ export const useGetComponentsByProject = ( }; fetchComponents(); - }, [organization, project, catalogApi]); + }, [namespace, project, catalogApi]); return { components, loading, error }; }; diff --git a/plugins/openchoreo-observability/src/hooks/useGetEnvironmentsByOrganization.ts b/plugins/openchoreo-observability/src/hooks/useGetEnvironmentsByNamespace.ts similarity index 72% rename from plugins/openchoreo-observability/src/hooks/useGetEnvironmentsByOrganization.ts rename to plugins/openchoreo-observability/src/hooks/useGetEnvironmentsByNamespace.ts index b5654c28..087a47f8 100644 --- a/plugins/openchoreo-observability/src/hooks/useGetEnvironmentsByOrganization.ts +++ b/plugins/openchoreo-observability/src/hooks/useGetEnvironmentsByNamespace.ts @@ -3,21 +3,21 @@ import { useApi } from '@backstage/core-plugin-api'; import { discoveryApiRef, fetchApiRef } from '@backstage/core-plugin-api'; import { Environment } from '../types'; -export interface UseGetEnvironmentsByOrganizationResult { +export interface UseGetEnvironmentsByNamespaceResult { environments: Environment[]; loading: boolean; error: string | null; } /** - * Hook to fetch environments for a specific organization from the observability backend. + * Hook to fetch environments for a specific namespace from the observability backend. * - * @param organizationName - The name of the organization to fetch environments for + * @param namespaceName - The name of the namespace to fetch environments for * @returns Object containing environments array, loading state, and error */ -export const useGetEnvironmentsByOrganization = ( - organizationName: string | undefined, -): UseGetEnvironmentsByOrganizationResult => { +export const useGetEnvironmentsByNamespace = ( + namespaceName: string | undefined, +): UseGetEnvironmentsByNamespaceResult => { const discoveryApi = useApi(discoveryApiRef); const fetchApi = useApi(fetchApiRef); const [environments, setEnvironments] = useState([]); @@ -26,9 +26,9 @@ export const useGetEnvironmentsByOrganization = ( useEffect(() => { const fetchEnvironments = async () => { - if (!organizationName) { + if (!namespaceName) { setLoading(false); - setError('Organization name is required'); + setError('Namespace name is required'); setEnvironments([]); return; } @@ -41,8 +41,8 @@ export const useGetEnvironmentsByOrganization = ( 'openchoreo-observability-backend', ); const response = await fetchApi.fetch( - `${baseUrl}/environments?organization=${encodeURIComponent( - organizationName, + `${baseUrl}/environments?namespace=${encodeURIComponent( + namespaceName, )}`, ); @@ -65,7 +65,7 @@ export const useGetEnvironmentsByOrganization = ( }; fetchEnvironments(); - }, [organizationName, discoveryApi, fetchApi]); + }, [namespaceName, discoveryApi, fetchApi]); return { environments, loading, error }; }; diff --git a/plugins/openchoreo-observability/src/hooks/useGetOrgAndProjectByEntity.ts b/plugins/openchoreo-observability/src/hooks/useGetNamespaceAndProjectByEntity.ts similarity index 53% rename from plugins/openchoreo-observability/src/hooks/useGetOrgAndProjectByEntity.ts rename to plugins/openchoreo-observability/src/hooks/useGetNamespaceAndProjectByEntity.ts index e892c7da..5867d810 100644 --- a/plugins/openchoreo-observability/src/hooks/useGetOrgAndProjectByEntity.ts +++ b/plugins/openchoreo-observability/src/hooks/useGetNamespaceAndProjectByEntity.ts @@ -2,52 +2,52 @@ import { Entity } from '@backstage/catalog-model'; import { useMemo } from 'react'; import { CHOREO_ANNOTATIONS } from '@openchoreo/backstage-plugin-common'; -export interface UseGetOrgAndProjectByEntityResult { - organization: string | undefined; +export interface UseGetNamespaceAndProjectByEntityResult { + namespace: string | undefined; project: string | undefined; error: string | null; } /** - * Hook to extract the organization and project name from an entity's annotations. + * Hook to extract the namespace and project name from an entity's annotations. * - * @param entity - The Backstage entity to extract the organization and project from - * @returns Object containing organization name, project name, and error + * @param entity - The Backstage entity to extract the namespace and project from + * @returns Object containing namespace name, project name, and error */ -export const useGetOrgAndProjectByEntity = ( +export const useGetNamespaceAndProjectByEntity = ( entity: Entity, -): UseGetOrgAndProjectByEntityResult => { +): UseGetNamespaceAndProjectByEntityResult => { const result = useMemo(() => { try { - const organization = - entity?.metadata?.annotations?.[CHOREO_ANNOTATIONS.ORGANIZATION]; + const namespace = + entity?.metadata?.annotations?.[CHOREO_ANNOTATIONS.NAMESPACE]; const project = entity?.metadata?.annotations?.[CHOREO_ANNOTATIONS.PROJECT]; - if (!organization) { + if (!namespace) { return { - organization: undefined, + namespace: undefined, project: undefined, - error: `Organization annotation '${CHOREO_ANNOTATIONS.ORGANIZATION}' not found in entity`, + error: `Namespace annotation '${CHOREO_ANNOTATIONS.NAMESPACE}' not found in entity`, }; } if (!project) { return { - organization, + namespace, project: undefined, error: `Project annotation '${CHOREO_ANNOTATIONS.PROJECT}' not found in entity`, }; } return { - organization, + namespace, project, error: null, }; } catch (err) { return { - organization: undefined, + namespace: undefined, project: undefined, error: err instanceof Error ? err.message : 'Unknown error', }; diff --git a/plugins/openchoreo-observability/src/hooks/useMetrics.ts b/plugins/openchoreo-observability/src/hooks/useMetrics.ts index 6cf05b7f..ff78b29a 100644 --- a/plugins/openchoreo-observability/src/hooks/useMetrics.ts +++ b/plugins/openchoreo-observability/src/hooks/useMetrics.ts @@ -17,12 +17,11 @@ async function getComponentDetails( ): Promise<{ uid?: string }> { const component = entity.metadata.annotations?.[CHOREO_ANNOTATIONS.COMPONENT]; const project = entity.metadata.annotations?.[CHOREO_ANNOTATIONS.PROJECT]; - const organization = - entity.metadata.annotations?.[CHOREO_ANNOTATIONS.ORGANIZATION]; + const namespace = entity.metadata.annotations?.[CHOREO_ANNOTATIONS.NAMESPACE]; - if (!component || !project || !organization) { + if (!component || !project || !namespace) { throw new Error( - 'Component name, project name, or organization name not found in entity annotations', + 'Component name, project name, or namespace name not found in entity annotations', ); } @@ -33,7 +32,7 @@ async function getComponentDetails( const params = new URLSearchParams({ componentName: component, projectName: project, - organizationName: organization, + namespaceName: namespace, }); backendUrl.search = params.toString(); @@ -56,12 +55,11 @@ async function getProjectDetails( fetchApi: any, ): Promise<{ uid?: string }> { const project = entity.metadata.annotations?.[CHOREO_ANNOTATIONS.PROJECT]; - const organization = - entity.metadata.annotations?.[CHOREO_ANNOTATIONS.ORGANIZATION]; + const namespace = entity.metadata.annotations?.[CHOREO_ANNOTATIONS.NAMESPACE]; - if (!project || !organization) { + if (!project || !namespace) { throw new Error( - 'Project name or organization name not found in entity annotations', + 'Project name or namespace name not found in entity annotations', ); } @@ -71,7 +69,7 @@ async function getProjectDetails( const params = new URLSearchParams({ projectName: project, - organizationName: organization, + namespaceName: namespace, }); backendUrl.search = params.toString(); @@ -91,7 +89,7 @@ async function getProjectDetails( export function useMetrics( filters: Filters, entity: Entity, - organization: string, + namespaceName: string, project: string, ) { const observabilityApi = useApi(observabilityApiRef); @@ -156,7 +154,7 @@ export function useMetrics( filters.environment.uid, filters.environment.name, componentName, - organization, + namespaceName, project, { limit: 100, @@ -182,7 +180,7 @@ export function useMetrics( filters.environment, filters.timeRange, metrics, - organization, + namespaceName, project, componentId, projectId, diff --git a/plugins/openchoreo-observability/src/hooks/useRCAReportByAlert.ts b/plugins/openchoreo-observability/src/hooks/useRCAReportByAlert.ts index ce238fc7..570a4345 100644 --- a/plugins/openchoreo-observability/src/hooks/useRCAReportByAlert.ts +++ b/plugins/openchoreo-observability/src/hooks/useRCAReportByAlert.ts @@ -15,12 +15,11 @@ async function getProjectDetails( fetchApi: any, ): Promise<{ uid?: string }> { const project = entity.metadata.name as string; - const organization = - entity.metadata.annotations?.[CHOREO_ANNOTATIONS.ORGANIZATION]; + const namespace = entity.metadata.annotations?.[CHOREO_ANNOTATIONS.NAMESPACE]; - if (!project || !organization) { + if (!project || !namespace) { throw new Error( - 'Project name or organization name not found in entity annotations', + 'Project name or namespace name not found in entity annotations', ); } @@ -30,7 +29,7 @@ async function getProjectDetails( const params = new URLSearchParams({ projectName: project, - organizationName: organization, + namespaceName: namespace, }); backendUrl.search = params.toString(); @@ -61,8 +60,7 @@ export function useRCAReportByAlert( const [error, setError] = useState(null); const [projectId, setProjectId] = useState(null); - const organization = - entity.metadata.annotations?.[CHOREO_ANNOTATIONS.ORGANIZATION]; + const namespace = entity.metadata.annotations?.[CHOREO_ANNOTATIONS.NAMESPACE]; const fetchReport = useCallback( async (version?: number) => { @@ -79,7 +77,7 @@ export function useRCAReportByAlert( projectId, environmentId, environmentName, - organization || '', + namespace || '', entity.metadata.name as string, version ? { version } : undefined, ); @@ -98,7 +96,7 @@ export function useRCAReportByAlert( alertId, environmentId, environmentName, - organization, + namespace, projectId, entity, ], diff --git a/plugins/openchoreo-observability/src/hooks/useRCAReports.ts b/plugins/openchoreo-observability/src/hooks/useRCAReports.ts index 1c481b52..0aac139b 100644 --- a/plugins/openchoreo-observability/src/hooks/useRCAReports.ts +++ b/plugins/openchoreo-observability/src/hooks/useRCAReports.ts @@ -16,12 +16,11 @@ async function getProjectDetails( fetchApi: any, ): Promise<{ uid?: string }> { const project = entity.metadata.name as string; - const organization = - entity.metadata.annotations?.[CHOREO_ANNOTATIONS.ORGANIZATION]; + const namespace = entity.metadata.annotations?.[CHOREO_ANNOTATIONS.NAMESPACE]; - if (!project || !organization) { + if (!project || !namespace) { throw new Error( - 'Project name or organization name not found in entity annotations', + 'Project name or namespace name not found in entity annotations', ); } @@ -31,7 +30,7 @@ async function getProjectDetails( const params = new URLSearchParams({ projectName: project, - organizationName: organization, + namespaceName: namespace, }); backendUrl.search = params.toString(); @@ -58,8 +57,7 @@ export function useRCAReports(filters: Filters, entity: Entity) { const [projectId, setProjectId] = useState(null); const [totalCount, setTotalCount] = useState(undefined); - const organization = - entity.metadata.annotations?.[CHOREO_ANNOTATIONS.ORGANIZATION]; + const namespace = entity.metadata.annotations?.[CHOREO_ANNOTATIONS.NAMESPACE]; // Memoize componentIds string for dependency array const componentIdsKey = useMemo( @@ -92,7 +90,7 @@ export function useRCAReports(filters: Filters, entity: Entity) { projectId, filters.environment.uid, filters.environment.name, - organization || '', + namespace || '', entity.metadata.name as string, componentUids, { @@ -122,7 +120,7 @@ export function useRCAReports(filters: Filters, entity: Entity) { filters.componentIds, filters.rcaStatus, reports, - organization, + namespace, projectId, entity, ], diff --git a/plugins/openchoreo-observability/src/hooks/useRuntimeLogs.ts b/plugins/openchoreo-observability/src/hooks/useRuntimeLogs.ts index 712d327b..2682e1b7 100644 --- a/plugins/openchoreo-observability/src/hooks/useRuntimeLogs.ts +++ b/plugins/openchoreo-observability/src/hooks/useRuntimeLogs.ts @@ -17,12 +17,11 @@ async function getComponentDetails( ): Promise<{ uid?: string }> { const component = entity.metadata.annotations?.[CHOREO_ANNOTATIONS.COMPONENT]; const project = entity.metadata.annotations?.[CHOREO_ANNOTATIONS.PROJECT]; - const organization = - entity.metadata.annotations?.[CHOREO_ANNOTATIONS.ORGANIZATION]; + const namespace = entity.metadata.annotations?.[CHOREO_ANNOTATIONS.NAMESPACE]; - if (!component || !project || !organization) { + if (!component || !project || !namespace) { throw new Error( - 'Component name, project name, or organization name not found in entity annotations', + 'Component name, project name, or namespace name not found in entity annotations', ); } @@ -33,7 +32,7 @@ async function getComponentDetails( const params = new URLSearchParams({ componentName: component, projectName: project, - organizationName: organization, + namespaceName: namespace, }); backendUrl.search = params.toString(); @@ -56,12 +55,11 @@ async function getProjectDetails( fetchApi: any, ): Promise<{ uid?: string }> { const project = entity.metadata.annotations?.[CHOREO_ANNOTATIONS.PROJECT]; - const organization = - entity.metadata.annotations?.[CHOREO_ANNOTATIONS.ORGANIZATION]; + const namespace = entity.metadata.annotations?.[CHOREO_ANNOTATIONS.NAMESPACE]; - if (!project || !organization) { + if (!project || !namespace) { throw new Error( - 'Project name or organization name not found in entity annotations', + 'Project name or namespace name not found in entity annotations', ); } @@ -71,7 +69,7 @@ async function getProjectDetails( const params = new URLSearchParams({ projectName: project, - organizationName: organization, + namespaceName: namespace, }); backendUrl.search = params.toString(); @@ -115,14 +113,14 @@ export interface UseRuntimeLogsResult { * then calls the observability API with all required parameters. * * @param entity - The Backstage entity - * @param organization - Organization name + * @param namespaceName - Namespace name * @param project - Project name * @param options - Runtime logs options (environment, time range, log levels, etc.) * @returns Runtime logs data and control functions */ export function useRuntimeLogs( entity: Entity, - organization: string, + namespaceName: string, project: string, options: UseRuntimeLogsOptions, ): UseRuntimeLogsResult { @@ -197,7 +195,7 @@ export function useRuntimeLogs( componentId, projectId, options.environmentId, - organization, + namespaceName, project, options.environmentName, componentName, @@ -231,7 +229,7 @@ export function useRuntimeLogs( options.logLevels, options.limit, logs, - organization, + namespaceName, project, componentId, projectId, diff --git a/plugins/openchoreo-observability/src/hooks/useTraces.ts b/plugins/openchoreo-observability/src/hooks/useTraces.ts index 19293de9..e461890f 100644 --- a/plugins/openchoreo-observability/src/hooks/useTraces.ts +++ b/plugins/openchoreo-observability/src/hooks/useTraces.ts @@ -15,12 +15,11 @@ async function getProjectDetails( fetchApi: any, ): Promise<{ uid?: string }> { const project = entity.metadata.name as string; - const organization = - entity.metadata.annotations?.[CHOREO_ANNOTATIONS.ORGANIZATION]; + const namespace = entity.metadata.annotations?.[CHOREO_ANNOTATIONS.NAMESPACE]; - if (!project || !organization) { + if (!project || !namespace) { throw new Error( - 'Project name or organization name not found in entity annotations', + 'Project name or namespace name not found in entity annotations', ); } @@ -30,7 +29,7 @@ async function getProjectDetails( const params = new URLSearchParams({ projectName: project, - organizationName: organization, + namespaceName: namespace, }); backendUrl.search = params.toString(); @@ -56,8 +55,7 @@ export function useTraces(filters: Filters, entity: Entity) { const [error, setError] = useState(null); const [projectId, setProjectId] = useState(null); - const organization = - entity.metadata.annotations?.[CHOREO_ANNOTATIONS.ORGANIZATION]; + const namespace = entity.metadata.annotations?.[CHOREO_ANNOTATIONS.NAMESPACE]; // Memoize componentIds string for dependency array const componentIdsKey = useMemo( @@ -101,7 +99,7 @@ export function useTraces(filters: Filters, entity: Entity) { projectId, filters.environment.uid, filters.environment.name, - organization || '', + namespace || '', entity.metadata.name as string, componentUids, { @@ -127,7 +125,7 @@ export function useTraces(filters: Filters, entity: Entity) { filters.timeRange, filters.componentIds, traces, - organization, + namespace, projectId, entity, ], diff --git a/plugins/openchoreo-react/src/hooks/useComponentEntityDetails.ts b/plugins/openchoreo-react/src/hooks/useComponentEntityDetails.ts index 439e2353..a5e84385 100644 --- a/plugins/openchoreo-react/src/hooks/useComponentEntityDetails.ts +++ b/plugins/openchoreo-react/src/hooks/useComponentEntityDetails.ts @@ -6,18 +6,18 @@ import { useEntity, catalogApiRef } from '@backstage/plugin-catalog-react'; export interface ComponentEntityDetails { componentName: string; projectName: string; - organizationName: string; + namespaceName: string; } /** - * Custom hook to extract OpenChoreo component entity details (component, project, organization) + * Custom hook to extract OpenChoreo component entity details (component, project, namespace) * from the current Backstage entity context by traversing entity relationships. * * This hook internally calls useEntity() to get the current entity and navigates * the Backstage catalog to find: * - Component name from the current entity * - Project name from entity.spec.system - * - Organization name from the project entity's spec.domain or annotations + * - Namespace name from the project entity's spec.domain or annotations * * @returns An object with getEntityDetails callback function * @@ -28,7 +28,7 @@ export interface ComponentEntityDetails { * useEffect(() => { * const fetchData = async () => { * try { - * const { componentName, projectName, organizationName } = await getEntityDetails(); + * const { componentName, projectName, namespaceName } = await getEntityDetails(); * // Use the details... * } catch (error) { * console.error('Failed to get entity details:', error); @@ -60,7 +60,7 @@ export function useComponentEntityDetails() { const projectName = typeof systemValue === 'string' ? systemValue : String(systemValue); - // Fetch the project entity to get the organization + // Fetch the project entity to get the namespace const projectEntityRef = `system:default/${projectName}`; const projectEntity = await catalogApi.getEntityByRef(projectEntityRef); @@ -68,26 +68,26 @@ export function useComponentEntityDetails() { throw new Error(`Project entity not found: ${projectEntityRef}`); } - // Get organization from the project entity's spec.domain or annotations - let organizationValue = projectEntity.spec?.domain; - if (!organizationValue) { - organizationValue = - projectEntity.metadata.annotations?.['openchoreo.io/organization']; + // Get namespace from the project entity's spec.domain or annotations + let namespaceValue = projectEntity.spec?.domain; + if (!namespaceValue) { + namespaceValue = + projectEntity.metadata.annotations?.['openchoreo.io/namespace']; } - if (!organizationValue) { + if (!namespaceValue) { throw new Error( - `Organization name not found in project entity: ${projectEntityRef}`, + `Namespace name not found in project entity: ${projectEntityRef}`, ); } - // Convert organization value to string (it could be string or object) - const organizationName = - typeof organizationValue === 'string' - ? organizationValue - : String(organizationValue); + // Convert namespace value to string (it could be string or object) + const namespaceName = + typeof namespaceValue === 'string' + ? namespaceValue + : String(namespaceValue); - return { componentName, projectName, organizationName }; + return { componentName, projectName, namespaceName }; }, [entity, catalogApi]); return { getEntityDetails }; @@ -119,7 +119,7 @@ export async function extractComponentEntityDetails( const projectName = typeof systemValue === 'string' ? systemValue : String(systemValue); - // Fetch the project entity to get the organization + // Fetch the project entity to get the namespace const projectEntityRef = `system:default/${projectName}`; const projectEntity = await catalogApi.getEntityByRef(projectEntityRef); @@ -127,23 +127,23 @@ export async function extractComponentEntityDetails( throw new Error(`Project entity not found: ${projectEntityRef}`); } - // Get organization from the project entity's spec.domain or annotations - let organizationValue = projectEntity.spec?.domain; - if (!organizationValue) { - organizationValue = - projectEntity.metadata.annotations?.['openchoreo.io/organization']; + // Get namespace from the project entity's spec.domain or annotations + let namespaceValue = projectEntity.spec?.domain; + if (!namespaceValue) { + namespaceValue = + projectEntity.metadata.annotations?.['openchoreo.io/namespace']; } - if (!organizationValue) { + if (!namespaceValue) { throw new Error( - `Organization name not found in project entity: ${projectEntityRef}`, + `Namespace name not found in project entity: ${projectEntityRef}`, ); } - const organizationName = - typeof organizationValue === 'string' - ? organizationValue - : String(organizationValue); + const namespaceName = + typeof namespaceValue === 'string' + ? namespaceValue + : String(namespaceValue); - return { componentName, projectName, organizationName }; + return { componentName, projectName, namespaceName }; } diff --git a/plugins/openchoreo-react/src/hooks/useSecretReferences.ts b/plugins/openchoreo-react/src/hooks/useSecretReferences.ts index e70e9b24..b827bf3d 100644 --- a/plugins/openchoreo-react/src/hooks/useSecretReferences.ts +++ b/plugins/openchoreo-react/src/hooks/useSecretReferences.ts @@ -37,11 +37,11 @@ async function fetchSecretReferences( discovery: DiscoveryApi, fetchApi: FetchApi, ): Promise { - const organizationName = - entity.metadata.annotations?.[CHOREO_ANNOTATIONS.ORGANIZATION]; + const namespaceName = + entity.metadata.annotations?.[CHOREO_ANNOTATIONS.NAMESPACE]; - if (!organizationName) { - throw new Error('Missing organization annotation'); + if (!namespaceName) { + throw new Error('Missing namespace annotation'); } const backendUrl = new URL( @@ -49,7 +49,7 @@ async function fetchSecretReferences( ); const params = new URLSearchParams({ - organizationName, + namespaceName, }); backendUrl.search = params.toString(); @@ -72,7 +72,7 @@ export interface UseSecretReferencesResult { } /** - * Hook to fetch secret references for the current entity's organization. + * Hook to fetch secret references for the current entity's namespace. * Automatically fetches on mount and cleans up on unmount. * * @returns Object containing secretReferences array, isLoading flag, and error message diff --git a/plugins/openchoreo/src/api/OpenChoreoClient.ts b/plugins/openchoreo/src/api/OpenChoreoClient.ts index 45a792b4..4923109e 100644 --- a/plugins/openchoreo/src/api/OpenChoreoClient.ts +++ b/plugins/openchoreo/src/api/OpenChoreoClient.ts @@ -20,7 +20,7 @@ import type { RoleEntitlementMapping, RoleMappingFilters, UserTypeConfig, - OrganizationSummary, + NamespaceSummary, ProjectSummary, ComponentSummary, } from './OpenChoreoClientApi'; @@ -59,9 +59,9 @@ const API_ENDPOINTS = { // Configuration endpoints USER_TYPES: '/user-types', // Hierarchy data endpoints - ORGANIZATIONS: '/orgs', - PROJECTS: '/projects', // GET /orgs/{orgName}/projects - COMPONENTS: '/components', // GET /orgs/{orgName}/projects/{projectName}/components + NAMESPACES: '/namespaces', + PROJECTS: '/projects', // GET /namespaces/{namespaceName}/projects + COMPONENTS: '/components', // GET /namespaces/{namespaceName}/projects/{projectName}/components } as const; // ============================================ @@ -71,36 +71,34 @@ const API_ENDPOINTS = { interface EntityMetadata { component: string; project: string; - organization: string; + namespace: string; } function extractEntityMetadata(entity: Entity): EntityMetadata { const component = entity.metadata.annotations?.[CHOREO_ANNOTATIONS.COMPONENT]; const project = entity.metadata.annotations?.[CHOREO_ANNOTATIONS.PROJECT]; - const organization = - entity.metadata.annotations?.[CHOREO_ANNOTATIONS.ORGANIZATION]; + const namespace = entity.metadata.annotations?.[CHOREO_ANNOTATIONS.NAMESPACE]; - if (!component || !project || !organization) { + if (!component || !project || !namespace) { throw new Error( 'Missing required OpenChoreo annotations in entity. ' + - `Required: ${CHOREO_ANNOTATIONS.COMPONENT}, ${CHOREO_ANNOTATIONS.PROJECT}, ${CHOREO_ANNOTATIONS.ORGANIZATION}`, + `Required: ${CHOREO_ANNOTATIONS.COMPONENT}, ${CHOREO_ANNOTATIONS.PROJECT}, ${CHOREO_ANNOTATIONS.NAMESPACE}`, ); } - return { component, project, organization }; + return { component, project, namespace }; } function tryExtractEntityMetadata(entity: Entity): EntityMetadata | null { const component = entity.metadata.annotations?.[CHOREO_ANNOTATIONS.COMPONENT]; const project = entity.metadata.annotations?.[CHOREO_ANNOTATIONS.PROJECT]; - const organization = - entity.metadata.annotations?.[CHOREO_ANNOTATIONS.ORGANIZATION]; + const namespace = entity.metadata.annotations?.[CHOREO_ANNOTATIONS.NAMESPACE]; - if (!component || !project || !organization) { + if (!component || !project || !namespace) { return null; } - return { component, project, organization }; + return { component, project, namespace }; } function entityMetadataToParams( @@ -109,7 +107,7 @@ function entityMetadataToParams( return { componentName: metadata.component, projectName: metadata.project, - organizationName: metadata.organization, + namespaceName: metadata.namespace, }; } @@ -196,7 +194,7 @@ export class OpenChoreoClient implements OpenChoreoClientApi { sourceEnvironment: string, targetEnvironment: string, ): Promise { - const { component, project, organization } = extractEntityMetadata(entity); + const { component, project, namespace } = extractEntityMetadata(entity); return this.apiFetch(API_ENDPOINTS.PROMOTE_DEPLOYMENT, { method: 'POST', @@ -205,7 +203,7 @@ export class OpenChoreoClient implements OpenChoreoClientApi { targetEnv: targetEnvironment, componentName: component, projectName: project, - orgName: organization, + namespaceName: namespace, }, }); } @@ -214,12 +212,12 @@ export class OpenChoreoClient implements OpenChoreoClientApi { entity: Entity, environment: string, ): Promise { - const { component, project, organization } = extractEntityMetadata(entity); + const { component, project, namespace } = extractEntityMetadata(entity); return this.apiFetch(API_ENDPOINTS.DELETE_RELEASE_BINDING, { method: 'DELETE', body: { - orgName: organization, + namespaceName: namespace, projectName: project, componentName: component, environment, @@ -232,12 +230,12 @@ export class OpenChoreoClient implements OpenChoreoClientApi { bindingName: string, releaseState: 'Active' | 'Suspend' | 'Undeploy', ): Promise { - const { component, project, organization } = extractEntityMetadata(entity); + const { component, project, namespace } = extractEntityMetadata(entity); return this.apiFetch(API_ENDPOINTS.UPDATE_BINDING, { method: 'PATCH', body: { - orgName: organization, + namespaceName: namespace, projectName: project, componentName: component, bindingName, @@ -247,12 +245,12 @@ export class OpenChoreoClient implements OpenChoreoClientApi { } async patchComponent(entity: Entity, autoDeploy: boolean): Promise { - const { component, project, organization } = extractEntityMetadata(entity); + const { component, project, namespace } = extractEntityMetadata(entity); return this.apiFetch(API_ENDPOINTS.COMPONENT, { method: 'PATCH', body: { - organizationName: organization, + namespaceName: namespace, projectName: project, componentName: component, autoDeploy, @@ -316,10 +314,10 @@ export class OpenChoreoClient implements OpenChoreoClientApi { workloadOverrides?: any, releaseName?: string, ): Promise { - const { component, project, organization } = extractEntityMetadata(entity); + const { component, project, namespace } = extractEntityMetadata(entity); const patchReq: Record = { - orgName: organization, + namespaceName: namespace, projectName: project, componentName: component, environment, @@ -388,14 +386,14 @@ export class OpenChoreoClient implements OpenChoreoClientApi { // ============================================ async fetchWorkflowSchema( - organizationName: string, + namespaceName: string, workflowName: string, ): Promise { return this.apiFetch( API_ENDPOINTS.WORKFLOW_SCHEMA, { params: { - organizationName, + namespaceName, workflowName, }, }, @@ -471,7 +469,7 @@ export class OpenChoreoClient implements OpenChoreoClientApi { limit: (params.limit || 100).toString(), sortOrder: params.sortOrder || 'desc', projectName: params.projectName, - orgName: params.orgName, + namespaceName: params.namespaceName, }, }, ); @@ -496,10 +494,10 @@ export class OpenChoreoClient implements OpenChoreoClientApi { !build.name || !build.uuid || !build.projectName || - !build.orgName + !build.namespaceName ) { throw new Error( - 'Component name, Build ID, UUID, Project name, or Organization name not available', + 'Component name, Build ID, UUID, Project name, or Namespace name not available', ); } @@ -508,7 +506,7 @@ export class OpenChoreoClient implements OpenChoreoClientApi { buildId: build.name, buildUuid: build.uuid, projectName: build.projectName, - orgName: build.orgName, + namespaceName: build.namespaceName, limit: 100, sortOrder: 'desc', }); @@ -517,14 +515,14 @@ export class OpenChoreoClient implements OpenChoreoClientApi { async fetchBuilds( componentName: string, projectName: string, - organizationName: string, + namespaceName: string, ): Promise { try { return await this.apiFetch(API_ENDPOINTS.BUILDS, { params: { componentName, projectName, - organizationName, + namespaceName, }, }); } catch { @@ -538,17 +536,17 @@ export class OpenChoreoClient implements OpenChoreoClientApi { async getCellDiagramInfo(entity: Entity): Promise { const project = entity.metadata.name; - const organization = - entity.metadata.annotations?.[CHOREO_ANNOTATIONS.ORGANIZATION]; + const namespace = + entity.metadata.annotations?.[CHOREO_ANNOTATIONS.NAMESPACE]; - if (!project || !organization) { + if (!project || !namespace) { return []; } return this.apiFetch(API_ENDPOINTS.CELL_DIAGRAM, { params: { projectName: project, - organizationName: organization, + namespaceName: namespace, }, }); } @@ -568,29 +566,29 @@ export class OpenChoreoClient implements OpenChoreoClientApi { async fetchSecretReferences( entity: Entity, ): Promise { - const organizationName = - entity.metadata.annotations?.[CHOREO_ANNOTATIONS.ORGANIZATION]; + const namespaceName = + entity.metadata.annotations?.[CHOREO_ANNOTATIONS.NAMESPACE]; - if (!organizationName) { - throw new Error('Missing organization annotation'); + if (!namespaceName) { + throw new Error('Missing namespace annotation'); } return this.apiFetch( API_ENDPOINTS.SECRET_REFERENCES, { - params: { organizationName }, + params: { namespaceName }, }, ); } async fetchDeploymentPipeline( projectName: string, - organizationName: string, + namespaceName: string, ): Promise { return this.apiFetch(API_ENDPOINTS.DEPLOYMENT_PIPELINE, { params: { projectName, - organizationName, + namespaceName, }, }); } @@ -616,7 +614,7 @@ export class OpenChoreoClient implements OpenChoreoClientApi { return this.apiFetch(API_ENDPOINTS.COMPONENT_TRAITS, { method: 'PUT', body: { - organizationName: metadata.organization, + namespaceName: metadata.namespace, projectName: metadata.project, componentName: metadata.component, traits, @@ -754,40 +752,40 @@ export class OpenChoreoClient implements OpenChoreoClientApi { // Hierarchy Data Operations // ============================================ - async listOrganizations(): Promise { - const response = await this.apiFetch<{ data: OrganizationSummary[] }>( - API_ENDPOINTS.ORGANIZATIONS, + async listNamespaces(): Promise { + const response = await this.apiFetch<{ data: NamespaceSummary[] }>( + API_ENDPOINTS.NAMESPACES, ); return response.data || []; } - async listProjects(orgName: string): Promise { + async listProjects(namespaceName: string): Promise { const response = await this.apiFetch<{ data: ProjectSummary[] }>( - `/orgs/${encodeURIComponent(orgName)}/projects`, + `/namespaces/${encodeURIComponent(namespaceName)}/projects`, ); return response.data || []; } async listComponents( - orgName: string, + namespaceName: string, projectName: string, ): Promise { const response = await this.apiFetch<{ data: ComponentSummary[] }>( - `/orgs/${encodeURIComponent(orgName)}/projects/${encodeURIComponent( - projectName, - )}/components`, + `/namespaces/${encodeURIComponent( + namespaceName, + )}/projects/${encodeURIComponent(projectName)}/components`, ); return response.data || []; } async fetchDataPlaneDetails( - organizationName: string, + namespaceName: string, dataplaneName: string, ): Promise { const response = await this.apiFetch( `/dataplanes/${encodeURIComponent( dataplaneName, - )}?organizationName=${encodeURIComponent(organizationName)}`, + )}?namespaceName=${encodeURIComponent(namespaceName)}`, ); return response; } diff --git a/plugins/openchoreo/src/api/OpenChoreoClientApi.ts b/plugins/openchoreo/src/api/OpenChoreoClientApi.ts index f679700a..cf118f65 100644 --- a/plugins/openchoreo/src/api/OpenChoreoClientApi.ts +++ b/plugins/openchoreo/src/api/OpenChoreoClientApi.ts @@ -64,7 +64,7 @@ export interface WorkflowSchemaResponse { /** Component info for dashboard */ export interface ComponentInfo { - orgName: string; + namespaceName: string; projectName: string; componentName: string; } @@ -106,8 +106,8 @@ export interface Entitlement { } export interface ResourceHierarchy { - organization?: string; - organization_units?: string[]; + namespace?: string; + namespace_units?: string[]; project?: string; component?: string; } @@ -149,8 +149,8 @@ export interface UserTypeConfig { authMechanisms: AuthMechanismConfig[]; } -/** Organization summary for listing */ -export interface OrganizationSummary { +/** Namespace summary for listing */ +export interface NamespaceSummary { name: string; displayName?: string; } @@ -171,7 +171,7 @@ export interface ComponentSummary { export interface BuildLogsParams { componentName: string; projectName: string; - orgName: string; + namespaceName: string; buildId: string; buildUuid: string; limit?: number; @@ -270,7 +270,7 @@ export interface OpenChoreoClientApi { /** Fetch workflow schema */ fetchWorkflowSchema( - organizationName: string, + namespaceName: string, workflowName: string, ): Promise; @@ -301,7 +301,7 @@ export interface OpenChoreoClientApi { fetchBuilds( componentName: string, projectName: string, - organizationName: string, + namespaceName: string, ): Promise; // === Other === @@ -312,13 +312,13 @@ export interface OpenChoreoClientApi { /** Fetch total bindings count for dashboard */ fetchTotalBindingsCount(components: ComponentInfo[]): Promise; - /** Fetch secret references for an organization */ + /** Fetch secret references for a namespace */ fetchSecretReferences(entity: Entity): Promise; /** Fetch deployment pipeline for a project */ fetchDeploymentPipeline( projectName: string, - organizationName: string, + namespaceName: string, ): Promise; // === Traits Operations === @@ -379,15 +379,15 @@ export interface OpenChoreoClientApi { // === Hierarchy Data Operations === - /** List all organizations */ - listOrganizations(): Promise; + /** List all namespaces */ + listNamespaces(): Promise; - /** List projects for an organization */ - listProjects(orgName: string): Promise; + /** List projects for a namespace */ + listProjects(namespaceName: string): Promise; /** List components for a project */ listComponents( - orgName: string, + namespaceName: string, projectName: string, ): Promise; @@ -395,7 +395,7 @@ export interface OpenChoreoClientApi { /** Fetch data plane details */ fetchDataPlaneDetails( - organizationName: string, + namespaceName: string, dataplaneName: string, ): Promise; } diff --git a/plugins/openchoreo/src/components/AccessControl/MappingsTab/MappingDialog.tsx b/plugins/openchoreo/src/components/AccessControl/MappingsTab/MappingDialog.tsx index 69ae2219..3f1e391b 100644 --- a/plugins/openchoreo/src/components/AccessControl/MappingsTab/MappingDialog.tsx +++ b/plugins/openchoreo/src/components/AccessControl/MappingsTab/MappingDialog.tsx @@ -99,13 +99,13 @@ export const MappingDialog = ({ subjectType: matchingUserType?.type || userTypes[0]?.type || '', entitlementValue: editingMapping.entitlement.value, scopeType: - editingMapping.hierarchy.organization || + editingMapping.hierarchy.namespace || editingMapping.hierarchy.project || editingMapping.hierarchy.component ? 'specific' : 'global', - organization: editingMapping.hierarchy.organization || '', - orgUnits: editingMapping.hierarchy.organization_units || [], + namespace: editingMapping.hierarchy.namespace || '', + namespaceUnits: editingMapping.hierarchy.namespace_units || [], project: editingMapping.hierarchy.project || '', component: editingMapping.hierarchy.component || '', effect: editingMapping.effect, @@ -174,9 +174,9 @@ export const MappingDialog = ({ wizardState.scopeType === 'global' ? {} : { - organization: wizardState.organization || undefined, - organization_units: - wizardState.orgUnits.filter(u => u.trim()) || undefined, + namespace: wizardState.namespace || undefined, + namespace_units: + wizardState.namespaceUnits.filter(u => u.trim()) || undefined, project: wizardState.project || undefined, component: wizardState.component || undefined, }, diff --git a/plugins/openchoreo/src/components/AccessControl/MappingsTab/MappingsTab.tsx b/plugins/openchoreo/src/components/AccessControl/MappingsTab/MappingsTab.tsx index 184523eb..72d5b0c6 100644 --- a/plugins/openchoreo/src/components/AccessControl/MappingsTab/MappingsTab.tsx +++ b/plugins/openchoreo/src/components/AccessControl/MappingsTab/MappingsTab.tsx @@ -121,9 +121,9 @@ const useStyles = makeStyles(theme => ({ const formatHierarchy = (hierarchy: ResourceHierarchy): string => { const parts: string[] = []; - if (hierarchy.organization) parts.push(`org/${hierarchy.organization}`); - if (hierarchy.organization_units?.length) { - parts.push(`units/${hierarchy.organization_units.join('/')}`); + if (hierarchy.namespace) parts.push(`namespace/${hierarchy.namespace}`); + if (hierarchy.namespace_units?.length) { + parts.push(`units/${hierarchy.namespace_units.join('/')}`); } if (hierarchy.project) parts.push(`project/${hierarchy.project}`); if (hierarchy.component) parts.push(`component/${hierarchy.component}`); diff --git a/plugins/openchoreo/src/components/AccessControl/MappingsTab/wizard/ReviewStep.tsx b/plugins/openchoreo/src/components/AccessControl/MappingsTab/wizard/ReviewStep.tsx index fa70e9f9..9eae4638 100644 --- a/plugins/openchoreo/src/components/AccessControl/MappingsTab/wizard/ReviewStep.tsx +++ b/plugins/openchoreo/src/components/AccessControl/MappingsTab/wizard/ReviewStep.tsx @@ -82,7 +82,7 @@ export const ReviewStep = ({ state, userTypes }: WizardStepProps) => { } const parts: string[] = []; - if (state.organization) parts.push(state.organization); + if (state.namespace) parts.push(state.namespace); if (state.project) parts.push(state.project); if (state.component) { parts.push(state.component); @@ -107,7 +107,7 @@ export const ReviewStep = ({ state, userTypes }: WizardStepProps) => { if (state.component) return `the "${state.component}" component`; if (state.project) return `all components in the "${state.project}" project`; - return `all resources in "${state.organization}"`; + return `all resources in "${state.namespace}"`; }; return `${action} ${subject} with ${entitlementClaim}="${ diff --git a/plugins/openchoreo/src/components/AccessControl/MappingsTab/wizard/ScopeStep.tsx b/plugins/openchoreo/src/components/AccessControl/MappingsTab/wizard/ScopeStep.tsx index ac28a51c..7a3ad04c 100644 --- a/plugins/openchoreo/src/components/AccessControl/MappingsTab/wizard/ScopeStep.tsx +++ b/plugins/openchoreo/src/components/AccessControl/MappingsTab/wizard/ScopeStep.tsx @@ -10,7 +10,8 @@ import { import { Autocomplete } from '@material-ui/lab'; import { makeStyles } from '@material-ui/core/styles'; import { WizardState } from './types'; -import { useOrganizations, useProjects, useComponents } from '../../hooks'; +import { useNamespaces, useProjects, useComponents } from '../../hooks'; +import type { NamespaceSummary } from '../../../../api/OpenChoreoClientApi'; import { NotificationBanner } from '@openchoreo/backstage-plugin-react'; const useStyles = makeStyles(theme => ({ @@ -77,12 +78,12 @@ export const ScopeStep = ({ state, onChange }: ScopeStepProps) => { const classes = useStyles(); // Hierarchy data hooks - const { organizations, loading: orgsLoading } = useOrganizations(); + const { namespaces, loading: namespacesLoading } = useNamespaces(); const { projects, loading: projectsLoading } = useProjects( - state.organization || undefined, + state.namespace || undefined, ); const { components, loading: componentsLoading } = useComponents( - state.organization || undefined, + state.namespace || undefined, state.project || undefined, ); @@ -91,17 +92,17 @@ export const ScopeStep = ({ state, onChange }: ScopeStepProps) => { scopeType, // Reset hierarchy when switching to global ...(scopeType === 'global' && { - organization: '', - orgUnits: [], + namespace: '', + namespaceUnits: [], project: '', component: '', }), }); }; - const handleOrganizationChange = (value: string | null) => { + const handleNamespaceChange = (value: string | null) => { onChange({ - organization: value || '', + namespace: value || '', project: '', component: '', }); @@ -124,7 +125,7 @@ export const ScopeStep = ({ state, onChange }: ScopeStepProps) => { } const parts: string[] = []; - if (state.organization) parts.push(state.organization); + if (state.namespace) parts.push(state.namespace); if (state.project) parts.push(state.project); if (state.component) { parts.push(state.component); @@ -160,7 +161,7 @@ export const ScopeStep = ({ state, onChange }: ScopeStepProps) => { } - label="Specific scope (organization, project, or component)" + label="Specific scope (namespace, project, or component)" /> @@ -168,29 +169,29 @@ export const ScopeStep = ({ state, onChange }: ScopeStepProps) => { {state.scopeType === 'specific' && ( - Organization + Namespace o.name)} - value={state.organization} - onChange={(_, value) => handleOrganizationChange(value)} + options={namespaces.map((ns: NamespaceSummary) => ns.name)} + value={state.namespace} + onChange={(_, value) => handleNamespaceChange(value)} onInputChange={(_, value, reason) => { if (reason === 'input') { - handleOrganizationChange(value); + handleNamespaceChange(value); } }} - loading={orgsLoading} + loading={namespacesLoading} renderInput={params => ( - {orgsLoading && ( + {namespacesLoading && ( )} {params.InputProps.endAdornment} @@ -205,9 +206,9 @@ export const ScopeStep = ({ state, onChange }: ScopeStepProps) => { Project - {state.organization + {state.namespace ? 'Leave empty to apply to all projects' - : 'Select an organization first'} + : 'Select a namespace first'} { handleProjectChange(value); } }} - disabled={!state.organization} + disabled={!state.namespace} loading={projectsLoading} renderInput={params => ( Promise; } -export function useOrganizations(): UseOrganizationsResult { - const [organizations, setOrganizations] = useState([]); +export function useNamespaces(): UseNamespacesResult { + const [namespaces, setNamespaces] = useState([]); const [loading, setLoading] = useState(true); const [error, setError] = useState(null); @@ -29,11 +29,11 @@ export function useOrganizations(): UseOrganizationsResult { try { setLoading(true); setError(null); - const result = await client.listOrganizations(); - setOrganizations(result); + const result = await client.listNamespaces(); + setNamespaces(result); } catch (err) { setError( - err instanceof Error ? err : new Error('Failed to fetch organizations'), + err instanceof Error ? err : new Error('Failed to fetch namespaces'), ); } finally { setLoading(false); @@ -45,7 +45,7 @@ export function useOrganizations(): UseOrganizationsResult { }, [refresh]); return { - organizations, + namespaces, loading, error, refresh, @@ -63,7 +63,9 @@ interface UseProjectsResult { refresh: () => Promise; } -export function useProjects(orgName: string | undefined): UseProjectsResult { +export function useProjects( + namespaceName: string | undefined, +): UseProjectsResult { const [projects, setProjects] = useState([]); const [loading, setLoading] = useState(false); const [error, setError] = useState(null); @@ -71,7 +73,7 @@ export function useProjects(orgName: string | undefined): UseProjectsResult { const client = useApi(openChoreoClientApiRef); const refresh = useCallback(async () => { - if (!orgName) { + if (!namespaceName) { setProjects([]); return; } @@ -79,7 +81,7 @@ export function useProjects(orgName: string | undefined): UseProjectsResult { try { setLoading(true); setError(null); - const result = await client.listProjects(orgName); + const result = await client.listProjects(namespaceName); setProjects(result); } catch (err) { setError( @@ -88,7 +90,7 @@ export function useProjects(orgName: string | undefined): UseProjectsResult { } finally { setLoading(false); } - }, [client, orgName]); + }, [client, namespaceName]); useEffect(() => { refresh(); @@ -114,7 +116,7 @@ interface UseComponentsResult { } export function useComponents( - orgName: string | undefined, + namespaceName: string | undefined, projectName: string | undefined, ): UseComponentsResult { const [components, setComponents] = useState([]); @@ -124,7 +126,7 @@ export function useComponents( const client = useApi(openChoreoClientApiRef); const refresh = useCallback(async () => { - if (!orgName || !projectName) { + if (!namespaceName || !projectName) { setComponents([]); return; } @@ -132,7 +134,7 @@ export function useComponents( try { setLoading(true); setError(null); - const result = await client.listComponents(orgName, projectName); + const result = await client.listComponents(namespaceName, projectName); setComponents(result); } catch (err) { setError( @@ -141,7 +143,7 @@ export function useComponents( } finally { setLoading(false); } - }, [client, orgName, projectName]); + }, [client, namespaceName, projectName]); useEffect(() => { refresh(); diff --git a/plugins/openchoreo/src/components/Environments/Workload/WorkloadButton.tsx b/plugins/openchoreo/src/components/Environments/Workload/WorkloadButton.tsx index 40c02e32..1b34ec0f 100644 --- a/plugins/openchoreo/src/components/Environments/Workload/WorkloadButton.tsx +++ b/plugins/openchoreo/src/components/Environments/Workload/WorkloadButton.tsx @@ -62,18 +62,18 @@ export const WorkloadButton = ({ const componentName = entity.metadata.name; const projectName = entity.metadata.annotations?.['openchoreo.io/project']; - const organizationName = - entity.metadata.annotations?.['openchoreo.io/organization']; + const namespaceName = + entity.metadata.annotations?.['openchoreo.io/namespace']; const baseUrl = await discovery.getBaseUrl('openchoreo'); - if (projectName && organizationName && componentName) { + if (projectName && namespaceName && componentName) { const response = await fetchApi.fetch( `${baseUrl}/builds?componentName=${encodeURIComponent( componentName, )}&projectName=${encodeURIComponent( projectName, - )}&organizationName=${encodeURIComponent(organizationName)}`, + )}&namespaceName=${encodeURIComponent(namespaceName)}`, ); if (!response.ok) { diff --git a/plugins/openchoreo/src/components/Environments/Workload/WorkloadConfigPage.tsx b/plugins/openchoreo/src/components/Environments/Workload/WorkloadConfigPage.tsx index a2b1d27a..bb06050d 100644 --- a/plugins/openchoreo/src/components/Environments/Workload/WorkloadConfigPage.tsx +++ b/plugins/openchoreo/src/components/Environments/Workload/WorkloadConfigPage.tsx @@ -131,18 +131,18 @@ export const WorkloadConfigPage = ({ const componentName = entity.metadata.name; const projectName = entity.metadata.annotations?.['openchoreo.io/project']; - const organizationName = - entity.metadata.annotations?.['openchoreo.io/organization']; + const namespaceName = + entity.metadata.annotations?.['openchoreo.io/namespace']; const baseUrl = await discovery.getBaseUrl('openchoreo'); - if (projectName && organizationName && componentName) { + if (projectName && namespaceName && componentName) { const response = await fetchApi.fetch( `${baseUrl}/builds?componentName=${encodeURIComponent( componentName, )}&projectName=${encodeURIComponent( projectName, - )}&organizationName=${encodeURIComponent(organizationName)}`, + )}&namespaceName=${encodeURIComponent(namespaceName)}`, ); if (!response.ok) { diff --git a/plugins/openchoreo/src/components/Environments/hooks/useInvokeUrl.ts b/plugins/openchoreo/src/components/Environments/hooks/useInvokeUrl.ts index 652c85f1..4abf6a83 100644 --- a/plugins/openchoreo/src/components/Environments/hooks/useInvokeUrl.ts +++ b/plugins/openchoreo/src/components/Environments/hooks/useInvokeUrl.ts @@ -33,16 +33,16 @@ export function useInvokeUrl( setLoading(true); try { - // Extract organization name from entity - const organizationName = - entity.metadata.annotations?.['openchoreo.dev/organization']; + // Extract namespace name from entity + const namespaceName = + entity.metadata.annotations?.['openchoreo.io/namespace']; // Fetch dataplane details if dataPlaneRef is provided let port = DEFAULT_HTTP_PORT; - if (dataPlaneRef && organizationName) { + if (dataPlaneRef && namespaceName) { try { const dataPlaneDetails = await client.fetchDataPlaneDetails( - organizationName, + namespaceName, dataPlaneRef, ); // Use publicHTTPPort if available and not 0 diff --git a/plugins/openchoreo/src/components/HomePage/MyProjectsWidget/MyProjectsWidget.tsx b/plugins/openchoreo/src/components/HomePage/MyProjectsWidget/MyProjectsWidget.tsx index 17fd3d6b..924f73c7 100644 --- a/plugins/openchoreo/src/components/HomePage/MyProjectsWidget/MyProjectsWidget.tsx +++ b/plugins/openchoreo/src/components/HomePage/MyProjectsWidget/MyProjectsWidget.tsx @@ -42,12 +42,12 @@ export const MyProjectsWidget = () => { const componentInfoList = componentsResponse.items .map(component => { const annotations = component.metadata.annotations || {}; - const orgName = annotations[CHOREO_ANNOTATIONS.ORGANIZATION]; + const namespaceName = annotations[CHOREO_ANNOTATIONS.NAMESPACE]; const projectName = annotations[CHOREO_ANNOTATIONS.PROJECT]; const componentName = annotations[CHOREO_ANNOTATIONS.COMPONENT]; - if (orgName && projectName && componentName) { - return { orgName, projectName, componentName }; + if (namespaceName && projectName && componentName) { + return { namespaceName, projectName, componentName }; } return null; }) @@ -55,7 +55,7 @@ export const MyProjectsWidget = () => { ( info, ): info is { - orgName: string; + namespaceName: string; projectName: string; componentName: string; } => info !== null, diff --git a/plugins/openchoreo/src/components/Projects/hooks/useComponentsWithDeployment.ts b/plugins/openchoreo/src/components/Projects/hooks/useComponentsWithDeployment.ts index c90c11bf..c799b8e1 100644 --- a/plugins/openchoreo/src/components/Projects/hooks/useComponentsWithDeployment.ts +++ b/plugins/openchoreo/src/components/Projects/hooks/useComponentsWithDeployment.ts @@ -44,10 +44,10 @@ export function useComponentsWithDeployment( const fetchComponents = useCallback(async () => { const projectName = systemEntity.metadata.name; - const organization = - systemEntity.metadata.annotations?.[CHOREO_ANNOTATIONS.ORGANIZATION]; + const namespace = + systemEntity.metadata.annotations?.[CHOREO_ANNOTATIONS.NAMESPACE]; - if (!projectName || !organization) { + if (!projectName || !namespace) { setComponents([]); setLoading(false); return; @@ -80,7 +80,7 @@ export function useComponentsWithDeployment( // Fetch release bindings and builds in parallel const [releaseBindingsData, buildsData] = await Promise.all([ client.fetchReleaseBindings(component as Entity), - client.fetchBuilds(componentName, projectName, organization), + client.fetchBuilds(componentName, projectName, namespace), ]); // Parse deployment status from release bindings diff --git a/plugins/openchoreo/src/components/Projects/hooks/useDeploymentPipeline.ts b/plugins/openchoreo/src/components/Projects/hooks/useDeploymentPipeline.ts index 1c308f6c..dba8da98 100644 --- a/plugins/openchoreo/src/components/Projects/hooks/useDeploymentPipeline.ts +++ b/plugins/openchoreo/src/components/Projects/hooks/useDeploymentPipeline.ts @@ -30,18 +30,18 @@ export const useDeploymentPipeline = () => { setLoading(true); setError(null); - // Get project and organization from system entity + // Get project and namespace from system entity const projectName = entity.metadata.name; - const organization = - entity.metadata.annotations?.[CHOREO_ANNOTATIONS.ORGANIZATION]; + const namespace = + entity.metadata.annotations?.[CHOREO_ANNOTATIONS.NAMESPACE]; - if (!projectName || !organization) { - throw new Error('Missing project or organization information'); + if (!projectName || !namespace) { + throw new Error('Missing project or namespace information'); } // Fetch deployment pipeline from Backstage backend const pipelineData: DeploymentPipelineResponse = - await client.fetchDeploymentPipeline(projectName, organization); + await client.fetchDeploymentPipeline(projectName, namespace); // Extract environments from promotion paths in order // The promotion paths define the deployment flow: source -> targets diff --git a/plugins/openchoreo/src/components/Projects/hooks/useEnvironments.ts b/plugins/openchoreo/src/components/Projects/hooks/useEnvironments.ts index d24f0afa..6ebbbaf1 100644 --- a/plugins/openchoreo/src/components/Projects/hooks/useEnvironments.ts +++ b/plugins/openchoreo/src/components/Projects/hooks/useEnvironments.ts @@ -25,10 +25,10 @@ export function useEnvironments(systemEntity: Entity): UseEnvironmentsResult { const [error, setError] = useState(null); const fetchEnvironments = useCallback(async () => { - const organization = - systemEntity.metadata.annotations?.[CHOREO_ANNOTATIONS.ORGANIZATION]; + const namespace = + systemEntity.metadata.annotations?.[CHOREO_ANNOTATIONS.NAMESPACE]; - if (!organization) { + if (!namespace) { setEnvironments([]); setLoading(false); return; @@ -42,8 +42,7 @@ export function useEnvironments(systemEntity: Entity): UseEnvironmentsResult { const { items } = await catalogApi.getEntities({ filter: { kind: 'Environment', - [`metadata.annotations.${CHOREO_ANNOTATIONS.ORGANIZATION}`]: - organization, + [`metadata.annotations.${CHOREO_ANNOTATIONS.NAMESPACE}`]: namespace, }, }); diff --git a/plugins/openchoreo/src/components/RuntimeLogs/OverviewCard/useLogsSummary.ts b/plugins/openchoreo/src/components/RuntimeLogs/OverviewCard/useLogsSummary.ts index 6d446495..63c3e7c9 100644 --- a/plugins/openchoreo/src/components/RuntimeLogs/OverviewCard/useLogsSummary.ts +++ b/plugins/openchoreo/src/components/RuntimeLogs/OverviewCard/useLogsSummary.ts @@ -52,11 +52,11 @@ export function useLogsSummary() { // Get project ID const project = entity.metadata.annotations?.[CHOREO_ANNOTATIONS.PROJECT]; - const organization = - entity.metadata.annotations?.[CHOREO_ANNOTATIONS.ORGANIZATION]; + const namespace = + entity.metadata.annotations?.[CHOREO_ANNOTATIONS.NAMESPACE]; - if (!project || !organization) { - throw new Error('Project or organization not found in annotations'); + if (!project || !namespace) { + throw new Error('Project or namespace not found in annotations'); } // Fetch project details to get projectId @@ -65,7 +65,7 @@ export function useLogsSummary() { ); projectUrl.search = new URLSearchParams({ projectName: project, - organizationName: organization, + namespaceName: namespace, }).toString(); const projectResponse = await fetchApi.fetch(projectUrl.toString()); @@ -97,12 +97,12 @@ export function useLogsSummary() { entity.metadata.annotations?.[CHOREO_ANNOTATIONS.COMPONENT]; const projectName = entity.metadata.annotations?.[CHOREO_ANNOTATIONS.PROJECT]; - const orgName = - entity.metadata.annotations?.[CHOREO_ANNOTATIONS.ORGANIZATION]; + const namespaceName = + entity.metadata.annotations?.[CHOREO_ANNOTATIONS.NAMESPACE]; - if (!componentName || !projectName || !orgName) { + if (!componentName || !projectName || !namespaceName) { throw new Error( - 'Component name, project, or organization not found in annotations', + 'Component name, project, or namespace not found in annotations', ); } @@ -113,8 +113,8 @@ export function useLogsSummary() { 'openchoreo-observability-backend', ); const url = new URL( - `${baseUrl}/logs/component/${componentName}?orgName=${encodeURIComponent( - orgName, + `${baseUrl}/logs/component/${componentName}?namespaceName=${encodeURIComponent( + namespaceName, )}&projectName=${encodeURIComponent(projectName)}`, ); @@ -129,7 +129,7 @@ export function useLogsSummary() { environmentId: selectedEnv.id, environmentName: selectedEnv.resourceName, componentName, - orgName, + namespaceName, projectName, options: { limit: 100, // Limit for performance, we just need counts diff --git a/plugins/openchoreo/src/components/Traits/AddTraitDialog.tsx b/plugins/openchoreo/src/components/Traits/AddTraitDialog.tsx index 070b43de..28e4c860 100644 --- a/plugins/openchoreo/src/components/Traits/AddTraitDialog.tsx +++ b/plugins/openchoreo/src/components/Traits/AddTraitDialog.tsx @@ -155,8 +155,8 @@ export const AddTraitDialog: React.FC = ({ const baseUrl = await discoveryApi.getBaseUrl('openchoreo'); const response = await fetchApi.fetch( - `${baseUrl}/traits?organizationName=${encodeURIComponent( - metadata.organization, + `${baseUrl}/traits?namespaceName=${encodeURIComponent( + metadata.namespace, )}&page=1&pageSize=100`, ); @@ -185,7 +185,7 @@ export const AddTraitDialog: React.FC = ({ return () => { ignore = true; }; - }, [open, metadata.organization, discoveryApi, fetchApi]); + }, [open, metadata.namespace, discoveryApi, fetchApi]); // Fetch schema when trait is selected useEffect(() => { @@ -207,8 +207,8 @@ export const AddTraitDialog: React.FC = ({ const baseUrl = await discoveryApi.getBaseUrl('openchoreo'); const response = await fetchApi.fetch( - `${baseUrl}/trait-schema?organizationName=${encodeURIComponent( - metadata.organization, + `${baseUrl}/trait-schema?namespaceName=${encodeURIComponent( + metadata.namespace, )}&traitName=${encodeURIComponent(selectedTrait)}`, ); @@ -246,7 +246,7 @@ export const AddTraitDialog: React.FC = ({ return () => { ignore = true; }; - }, [selectedTrait, metadata.organization, discoveryApi, fetchApi]); + }, [selectedTrait, metadata.namespace, discoveryApi, fetchApi]); // Validate instance name useEffect(() => { diff --git a/plugins/openchoreo/src/components/Traits/EditTraitDialog.tsx b/plugins/openchoreo/src/components/Traits/EditTraitDialog.tsx index 834c2a80..4a74315e 100644 --- a/plugins/openchoreo/src/components/Traits/EditTraitDialog.tsx +++ b/plugins/openchoreo/src/components/Traits/EditTraitDialog.tsx @@ -158,8 +158,8 @@ export const EditTraitDialog: React.FC = ({ const baseUrl = await discoveryApi.getBaseUrl('openchoreo'); const response = await fetchApi.fetch( - `${baseUrl}/trait-schema?organizationName=${encodeURIComponent( - metadata.organization, + `${baseUrl}/trait-schema?namespaceName=${encodeURIComponent( + metadata.namespace, )}&traitName=${encodeURIComponent(trait.name)}`, ); @@ -192,7 +192,7 @@ export const EditTraitDialog: React.FC = ({ return () => { ignore = true; }; - }, [trait, open, metadata.organization, discoveryApi, fetchApi]); + }, [trait, open, metadata.namespace, discoveryApi, fetchApi]); // Validate instance name useEffect(() => { diff --git a/plugins/openchoreo/src/components/Workflows/OverviewCard/useWorkflowsSummary.ts b/plugins/openchoreo/src/components/Workflows/OverviewCard/useWorkflowsSummary.ts index 343b1825..b581d274 100644 --- a/plugins/openchoreo/src/components/Workflows/OverviewCard/useWorkflowsSummary.ts +++ b/plugins/openchoreo/src/components/Workflows/OverviewCard/useWorkflowsSummary.ts @@ -37,7 +37,7 @@ export function useWorkflowsSummary() { const fetchData = useCallback(async () => { try { - const { componentName, projectName, organizationName } = + const { componentName, projectName, namespaceName } = await getEntityDetails(); const baseUrl = await discoveryApi.getBaseUrl('openchoreo'); @@ -49,14 +49,14 @@ export function useWorkflowsSummary() { componentName, )}&projectName=${encodeURIComponent( projectName, - )}&organizationName=${encodeURIComponent(organizationName)}`, + )}&namespaceName=${encodeURIComponent(namespaceName)}`, ), fetchApi.fetch( `${baseUrl}/builds?componentName=${encodeURIComponent( componentName, )}&projectName=${encodeURIComponent( projectName, - )}&organizationName=${encodeURIComponent(organizationName)}`, + )}&namespaceName=${encodeURIComponent(namespaceName)}`, ), ]); @@ -99,7 +99,7 @@ export function useWorkflowsSummary() { const triggerBuild = useCallback(async () => { setState(prev => ({ ...prev, triggeringBuild: true })); try { - const { componentName, projectName, organizationName } = + const { componentName, projectName, namespaceName } = await getEntityDetails(); const baseUrl = await discoveryApi.getBaseUrl('openchoreo'); @@ -112,7 +112,7 @@ export function useWorkflowsSummary() { body: JSON.stringify({ componentName, projectName, - organizationName, + namespaceName, }), }); diff --git a/plugins/openchoreo/src/utils/entityUtils.ts b/plugins/openchoreo/src/utils/entityUtils.ts index b04b9f94..c448e912 100644 --- a/plugins/openchoreo/src/utils/entityUtils.ts +++ b/plugins/openchoreo/src/utils/entityUtils.ts @@ -4,7 +4,7 @@ import { CHOREO_ANNOTATIONS } from '@openchoreo/backstage-plugin-common'; export interface EntityMetadata { component: string; project: string; - organization: string; + namespace: string; } /** @@ -12,22 +12,21 @@ export interface EntityMetadata { * Throws if required annotations are missing. * * @example - * const { component, project, organization } = extractEntityMetadata(entity); + * const { component, project, namespace } = extractEntityMetadata(entity); */ export function extractEntityMetadata(entity: Entity): EntityMetadata { const component = entity.metadata.annotations?.[CHOREO_ANNOTATIONS.COMPONENT]; const project = entity.metadata.annotations?.[CHOREO_ANNOTATIONS.PROJECT]; - const organization = - entity.metadata.annotations?.[CHOREO_ANNOTATIONS.ORGANIZATION]; + const namespace = entity.metadata.annotations?.[CHOREO_ANNOTATIONS.NAMESPACE]; - if (!component || !project || !organization) { + if (!component || !project || !namespace) { throw new Error( 'Missing required OpenChoreo annotations in entity. ' + - `Required: ${CHOREO_ANNOTATIONS.COMPONENT}, ${CHOREO_ANNOTATIONS.PROJECT}, ${CHOREO_ANNOTATIONS.ORGANIZATION}`, + `Required: ${CHOREO_ANNOTATIONS.COMPONENT}, ${CHOREO_ANNOTATIONS.PROJECT}, ${CHOREO_ANNOTATIONS.NAMESPACE}`, ); } - return { component, project, organization }; + return { component, project, namespace }; } /** @@ -45,19 +44,18 @@ export function tryExtractEntityMetadata( ): EntityMetadata | null { const component = entity.metadata.annotations?.[CHOREO_ANNOTATIONS.COMPONENT]; const project = entity.metadata.annotations?.[CHOREO_ANNOTATIONS.PROJECT]; - const organization = - entity.metadata.annotations?.[CHOREO_ANNOTATIONS.ORGANIZATION]; + const namespace = entity.metadata.annotations?.[CHOREO_ANNOTATIONS.NAMESPACE]; - if (!component || !project || !organization) { + if (!component || !project || !namespace) { return null; } - return { component, project, organization }; + return { component, project, namespace }; } /** * Creates standard query params from entity metadata. - * Useful for API calls that require component/project/organization params. + * Useful for API calls that require component/project/namespace params. */ export function entityMetadataToParams( metadata: EntityMetadata, @@ -65,6 +63,6 @@ export function entityMetadataToParams( return { componentName: metadata.component, projectName: metadata.project, - organizationName: metadata.organization, + namespaceName: metadata.namespace, }; } diff --git a/plugins/permission-backend-module-openchoreo-policy/src/policy/OpenChoreoPermissionPolicy.ts b/plugins/permission-backend-module-openchoreo-policy/src/policy/OpenChoreoPermissionPolicy.ts index 6bcb88d8..342c5c5d 100644 --- a/plugins/permission-backend-module-openchoreo-policy/src/policy/OpenChoreoPermissionPolicy.ts +++ b/plugins/permission-backend-module-openchoreo-policy/src/policy/OpenChoreoPermissionPolicy.ts @@ -208,7 +208,7 @@ export class OpenChoreoPermissionPolicy implements PermissionPolicy { * Different entity kinds map to different OpenChoreo resources: * - Component → component:* actions * - System → project:* actions - * - Domain → organization:* actions + * - Domain → namespace:* actions */ private async handleCatalogPermission( request: PolicyQuery, @@ -386,7 +386,7 @@ export class OpenChoreoPermissionPolicy implements PermissionPolicy { * Allows if user has ANY create capability: * - component:create * - project:create - * - organization:create + * - namespace:create * * This is a global check - the actual scope validation happens * when the entity is registered and its annotations are checked. @@ -414,16 +414,16 @@ export class OpenChoreoPermissionPolicy implements PermissionPolicy { const hasProjectCreate = (capabilities.capabilities?.['project:create']?.allowed?.length ?? 0) > 0; - const hasOrgCreate = - (capabilities.capabilities?.['organization:create']?.allowed?.length ?? + const hasNamespaceCreate = + (capabilities.capabilities?.['namespace:create']?.allowed?.length ?? 0) > 0; const hasAnyCreate = - hasComponentCreate || hasProjectCreate || hasOrgCreate; + hasComponentCreate || hasProjectCreate || hasNamespaceCreate; this.logger.debug( `catalog.entity.create: ${hasAnyCreate ? 'ALLOW' : 'DENY'} ` + - `(component:${hasComponentCreate}, project:${hasProjectCreate}, org:${hasOrgCreate})`, + `(component:${hasComponentCreate}, project:${hasProjectCreate}, namespace:${hasNamespaceCreate})`, ); return { diff --git a/plugins/permission-backend-module-openchoreo-policy/src/rules/index.ts b/plugins/permission-backend-module-openchoreo-policy/src/rules/index.ts index 62f8acdb..c1e84cc8 100644 --- a/plugins/permission-backend-module-openchoreo-policy/src/rules/index.ts +++ b/plugins/permission-backend-module-openchoreo-policy/src/rules/index.ts @@ -51,7 +51,7 @@ const { conditions, createConditionalDecision } = createConditionExports({ * request.permission, * openchoreoConditions.matchesCapability({ * action: 'component:deploy', - * capability: { allowed: [{ path: 'org/*' }] } + * capability: { allowed: [{ path: 'namespace/*' }] } * }) * ); * ``` diff --git a/plugins/permission-backend-module-openchoreo-policy/src/rules/matchesCapability.ts b/plugins/permission-backend-module-openchoreo-policy/src/rules/matchesCapability.ts index 9f436303..0e4f30ee 100644 --- a/plugins/permission-backend-module-openchoreo-policy/src/rules/matchesCapability.ts +++ b/plugins/permission-backend-module-openchoreo-policy/src/rules/matchesCapability.ts @@ -39,27 +39,28 @@ export type MatchesCapabilityParams = z.infer; /** * Parses capability path from backend format. * - * Backend format: "org/{orgName}/project/{projectName}/component/{componentName}" - * or wildcards like "org/*", "org/{orgName}/project/*", etc. + * Backend format: "namespace/{namespaceName}/project/{projectName}/component/{componentName}" + * or wildcards like "namespace/*", "namespace/{namespaceName}/project/*", etc. * - * Returns parsed { org, project, component } values. + * Returns parsed { namespace, project, component } values. */ function parseCapabilityPath(path: string): { - org?: string; + namespace?: string; project?: string; component?: string; } { // Handle global wildcard if (path === '*') { - return { org: '*', project: '*', component: '*' }; + return { namespace: '*', project: '*', component: '*' }; } - const result: { org?: string; project?: string; component?: string } = {}; + const result: { namespace?: string; project?: string; component?: string } = + {}; - // Parse org/orgName pattern - const orgMatch = path.match(/^org\/([^/]+)/); - if (orgMatch) { - result.org = orgMatch[1]; + // Parse namespace/namespaceName pattern + const namespaceMatch = path.match(/^namespace\/([^/]+)/); + if (namespaceMatch) { + result.namespace = namespaceMatch[1]; } // Parse project/projectName pattern @@ -82,13 +83,13 @@ function parseCapabilityPath(path: string): { * * Paths from backend are in format: * - "*" - matches everything - * - "org/{orgName}/*" - matches all resources in the org - * - "org/{orgName}/project/{projectName}/*" - matches all resources in the project - * - "org/{orgName}/project/{projectName}/component/{componentName}" - matches specific component + * - "namespace/{namespaceName}/*" - matches all resources in the namespace + * - "namespace/{namespaceName}/project/{projectName}/*" - matches all resources in the project + * - "namespace/{namespaceName}/project/{projectName}/component/{componentName}" - matches specific component */ function matchesScope( path: string, - scope: { org?: string; project?: string; component?: string }, + scope: { namespace?: string; project?: string; component?: string }, ): boolean { // Wildcard matches everything if (path === '*') { @@ -97,13 +98,17 @@ function matchesScope( const parsed = parseCapabilityPath(path); - // Check organization - if (parsed.org && parsed.org !== '*' && parsed.org !== scope.org) { + // Check namespace + if ( + parsed.namespace && + parsed.namespace !== '*' && + parsed.namespace !== scope.namespace + ) { return false; } - // If org is wildcard or path only specifies org, it matches - if (parsed.org === '*' || (!parsed.project && !parsed.component)) { + // If namespace is wildcard or path only specifies namespace, it matches + if (parsed.namespace === '*' || (!parsed.project && !parsed.component)) { return true; } @@ -150,17 +155,18 @@ export const matchesCapability = createPermissionRule({ const { allowedPaths, deniedPaths } = params; // Extract scope from entity annotations - const org = entity.metadata.annotations?.[CHOREO_ANNOTATIONS.ORGANIZATION]; + const namespace = + entity.metadata.annotations?.[CHOREO_ANNOTATIONS.NAMESPACE]; const project = entity.metadata.annotations?.[CHOREO_ANNOTATIONS.PROJECT]; const component = entity.metadata.annotations?.[CHOREO_ANNOTATIONS.COMPONENT]; - // If no org annotation, we can't check - deny - if (!org) { + // If no namespace annotation, we can't check - deny + if (!namespace) { return false; } - const scope = { org, project, component }; + const scope = { namespace, project, component }; // Check if explicitly denied at this scope for (const deniedPath of deniedPaths) { diff --git a/plugins/permission-backend-module-openchoreo-policy/src/rules/matchesCatalogEntityCapability.ts b/plugins/permission-backend-module-openchoreo-policy/src/rules/matchesCatalogEntityCapability.ts index ef383411..5994b08b 100644 --- a/plugins/permission-backend-module-openchoreo-policy/src/rules/matchesCatalogEntityCapability.ts +++ b/plugins/permission-backend-module-openchoreo-policy/src/rules/matchesCatalogEntityCapability.ts @@ -53,23 +53,24 @@ export type MatchesCatalogEntityCapabilityParams = z.infer; /** * Parses capability path from backend format. * - * Backend format: "org/{orgName}/project/{projectName}/component/{componentName}" - * or wildcards like "org/*", "org/{orgName}/project/*", etc. + * Backend format: "namespace/{namespaceName}/project/{projectName}/component/{componentName}" + * or wildcards like "namespace/*", "namespace/{namespaceName}/project/*", etc. */ function parseCapabilityPath(path: string): { - org?: string; + namespace?: string; project?: string; component?: string; } { if (path === '*') { - return { org: '*', project: '*', component: '*' }; + return { namespace: '*', project: '*', component: '*' }; } - const result: { org?: string; project?: string; component?: string } = {}; + const result: { namespace?: string; project?: string; component?: string } = + {}; - const orgMatch = path.match(/^org\/([^/]+)/); - if (orgMatch) { - result.org = orgMatch[1]; + const namespaceMatch = path.match(/^namespace\/([^/]+)/); + if (namespaceMatch) { + result.namespace = namespaceMatch[1]; } const projectMatch = path.match(/project\/([^/]+)/); @@ -85,16 +86,11 @@ function parseCapabilityPath(path: string): { return result; } -/** - * Entity level type for path specificity checking. - */ -type EntityLevel = 'domain' | 'system' | 'component'; - /** * Checks if a capability path matches the given scope. * * The entityLevel parameter ensures paths are not more specific than the entity: - * - Domain: only accepts org-level paths (no project or component) + * - Domain: only accepts namespace-level paths (no project or component) * - System: only accepts project-level or broader paths (no component) * - Component: accepts any level * @@ -102,7 +98,7 @@ type EntityLevel = 'domain' | 'system' | 'component'; */ function matchesScope( path: string, - scope: { org?: string; project?: string; component?: string }, + scope: { namespace?: string; project?: string; component?: string }, entityLevel: EntityLevel, ): boolean { if (path === '*') { @@ -126,13 +122,17 @@ function matchesScope( } } - // Check organization - if (parsed.org && parsed.org !== '*' && parsed.org !== scope.org) { + // Check namespace + if ( + parsed.namespace && + parsed.namespace !== '*' && + parsed.namespace !== scope.namespace + ) { return false; } - // If org is wildcard or path only specifies org, it matches - if (parsed.org === '*' || (!parsed.project && !parsed.component)) { + // If namespace is wildcard or path only specifies namespace, it matches + if (parsed.namespace === '*' || (!parsed.project && !parsed.component)) { return true; } @@ -162,6 +162,11 @@ function matchesScope( return true; } +/** + * Entity level type for path specificity checking. + */ +type EntityLevel = 'domain' | 'system' | 'component'; + /** * Checks if a path is valid for the given entity level. * Used by toQuery to filter out paths that are too specific. @@ -220,33 +225,33 @@ export const matchesCatalogEntityCapability = createCatalogPermissionRule({ // Extract scope from entity annotations based on entity kind // Different entity kinds use different annotations: - // - Domain: only organization - // - System: organization + project-id - // - Component: organization + project + component - let scope: { org?: string; project?: string; component?: string }; + // - Domain: only namespace + // - System: namespace + project-id + // - Component: namespace + project + component + let scope: { namespace?: string; project?: string; component?: string }; if (entityKind === 'domain') { - // Domain only has organization + // Domain only has namespace scope = { - org: entity.metadata.annotations?.[CHOREO_ANNOTATIONS.ORGANIZATION], + namespace: entity.metadata.annotations?.[CHOREO_ANNOTATIONS.NAMESPACE], }; } else if (entityKind === 'system') { - // System has organization and project-id + // System has namespace and project-id scope = { - org: entity.metadata.annotations?.[CHOREO_ANNOTATIONS.ORGANIZATION], + namespace: entity.metadata.annotations?.[CHOREO_ANNOTATIONS.NAMESPACE], project: entity.metadata.annotations?.[CHOREO_ANNOTATIONS.PROJECT_ID], }; } else { - // Component has organization, project, and component + // Component has namespace, project, and component scope = { - org: entity.metadata.annotations?.[CHOREO_ANNOTATIONS.ORGANIZATION], + namespace: entity.metadata.annotations?.[CHOREO_ANNOTATIONS.NAMESPACE], project: entity.metadata.annotations?.[CHOREO_ANNOTATIONS.PROJECT], component: entity.metadata.annotations?.[CHOREO_ANNOTATIONS.COMPONENT], }; } - // If no org annotation, this isn't an OpenChoreo entity - allow by default - if (!scope.org) { + // If no namespace annotation, this isn't an OpenChoreo entity - allow by default + if (!scope.namespace) { return true; } @@ -294,9 +299,9 @@ export const matchesCatalogEntityCapability = createCatalogPermissionRule({ not: managedKindFilter, }; - // Filter for non-OpenChoreo entities (those without org annotation) - const noOrgAnnotationFilter: EntitiesSearchFilter = { - key: `metadata.annotations.${CHOREO_ANNOTATIONS.ORGANIZATION}`, + // Filter for non-OpenChoreo entities (those without namespace annotation) + const noNamespaceAnnotationFilter: EntitiesSearchFilter = { + key: `metadata.annotations.${CHOREO_ANNOTATIONS.NAMESPACE}`, }; // Build filters for each managed kind @@ -314,9 +319,9 @@ export const matchesCatalogEntityCapability = createCatalogPermissionRule({ if (!capability) { // No capability defined for this kind - only allow non-OpenChoreo entities - // (those without openchoreo.io/organization annotation) + // (those without openchoreo.io/namespace annotation) kindFilters.push({ - allOf: [singleKindFilter, { not: noOrgAnnotationFilter }] as [ + allOf: [singleKindFilter, { not: noNamespaceAnnotationFilter }] as [ PermissionCriteria, ...PermissionCriteria[], ], @@ -327,7 +332,7 @@ export const matchesCatalogEntityCapability = createCatalogPermissionRule({ const { allowedPaths } = capability; // Filter paths to only those valid for this entity level - // e.g., domain only accepts org-level paths, system excludes component-level paths + // e.g., domain only accepts namespace-level paths, system excludes component-level paths const validPaths = allowedPaths.filter(path => isPathValidForLevel(path, entityLevel), ); @@ -335,7 +340,7 @@ export const matchesCatalogEntityCapability = createCatalogPermissionRule({ // If no valid paths after filtering, only allow non-OpenChoreo entities if (validPaths.length === 0) { kindFilters.push({ - allOf: [singleKindFilter, { not: noOrgAnnotationFilter }] as [ + allOf: [singleKindFilter, { not: noNamespaceAnnotationFilter }] as [ PermissionCriteria, ...PermissionCriteria[], ], @@ -345,7 +350,7 @@ export const matchesCatalogEntityCapability = createCatalogPermissionRule({ // Check for wildcard access for this kind (only considering valid paths) const hasWildcardAccess = validPaths.some( - path => path === '*' || parseCapabilityPath(path).org === '*', + path => path === '*' || parseCapabilityPath(path).namespace === '*', ); if (hasWildcardAccess) { @@ -354,9 +359,9 @@ export const matchesCatalogEntityCapability = createCatalogPermissionRule({ continue; } - // Non-OpenChoreo entities of this kind (without org annotation) are always allowed + // Non-OpenChoreo entities of this kind (without namespace annotation) are always allowed const nonOpenchoreoOfKind: PermissionCriteria = { - allOf: [singleKindFilter, { not: noOrgAnnotationFilter }] as [ + allOf: [singleKindFilter, { not: noNamespaceAnnotationFilter }] as [ PermissionCriteria, ...PermissionCriteria[], ], @@ -370,11 +375,11 @@ export const matchesCatalogEntityCapability = createCatalogPermissionRule({ singleKindFilter, ]; - // Add org filter if specific (not wildcard) - if (parsed.org && parsed.org !== '*') { + // Add namespace filter if specific (not wildcard) + if (parsed.namespace && parsed.namespace !== '*') { conditions.push({ - key: `metadata.annotations.${CHOREO_ANNOTATIONS.ORGANIZATION}`, - values: [parsed.org], + key: `metadata.annotations.${CHOREO_ANNOTATIONS.NAMESPACE}`, + values: [parsed.namespace], }); } diff --git a/plugins/permission-backend-module-openchoreo-policy/src/services/AuthzProfileCache.ts b/plugins/permission-backend-module-openchoreo-policy/src/services/AuthzProfileCache.ts index 1e9444c4..40428c0e 100644 --- a/plugins/permission-backend-module-openchoreo-policy/src/services/AuthzProfileCache.ts +++ b/plugins/permission-backend-module-openchoreo-policy/src/services/AuthzProfileCache.ts @@ -46,7 +46,7 @@ export class AuthzProfileCache { * Retrieves cached capabilities for the given user and scope. * * @param userToken - The user's OpenChoreo token - * @param org - Organization name + * @param org - Namespace name * @param project - Optional project name * @param component - Optional component name * @returns Cached capabilities or undefined if not found @@ -65,7 +65,7 @@ export class AuthzProfileCache { * Stores capabilities in the cache. * * @param userToken - The user's OpenChoreo token - * @param org - Organization name + * @param org - Namespace name * @param capabilities - The capabilities response to cache * @param ttlMs - TTL in milliseconds (derived from token expiration) * @param project - Optional project name @@ -87,7 +87,7 @@ export class AuthzProfileCache { * Deletes cached capabilities for the given user and scope. * * @param userToken - The user's OpenChoreo token - * @param org - Organization name + * @param org - Namespace name * @param project - Optional project name * @param component - Optional component name */ @@ -116,7 +116,7 @@ export class AuthzProfileCache { * This is used when the token is not available (e.g., internal permission calls). * * @param userEntityRef - The user's entity reference (e.g., "user:default/email@example.com") - * @param org - Optional organization name + * @param org - Optional namespace name * @returns Cached capabilities or undefined if not found */ async getByUser( @@ -134,7 +134,7 @@ export class AuthzProfileCache { * @param userEntityRef - The user's entity reference * @param capabilities - The capabilities response to cache * @param ttlMs - TTL in milliseconds (derived from token expiration) - * @param org - Optional organization name + * @param org - Optional namespace name */ async setByUser( userEntityRef: string, diff --git a/plugins/permission-backend-module-openchoreo-policy/src/services/AuthzProfileService.ts b/plugins/permission-backend-module-openchoreo-policy/src/services/AuthzProfileService.ts index 2a28c597..9dff1664 100644 --- a/plugins/permission-backend-module-openchoreo-policy/src/services/AuthzProfileService.ts +++ b/plugins/permission-backend-module-openchoreo-policy/src/services/AuthzProfileService.ts @@ -83,19 +83,19 @@ export class AuthzProfileService { * Fetches user capabilities, optionally filtered by scope. * * @param userToken - The user's OpenChoreo IDP token - * @param scope - Optional scope (org, project, component) to filter capabilities + * @param scope - Optional scope (namespace, project, component) to filter capabilities * @returns The user's capabilities (global if no scope provided) */ async getCapabilities( userToken: string, scope?: OpenChoreoScope, ): Promise { - const org = scope?.org; + const namespace = scope?.namespace; const project = scope?.project; const component = scope?.component; - // Check cache first (use 'global' as key when no org specified) - const cacheKey = org ?? 'global'; + // Check cache first (use 'global' as key when no namespace specified) + const cacheKey = namespace ?? 'global'; if (this.cache) { const cached = await this.cache.get( userToken, @@ -106,7 +106,7 @@ export class AuthzProfileService { if (cached) { this.logger.debug( `Cache hit for capabilities: org=${ - org ?? 'global' + namespace ?? 'global' } project=${project} component=${component}`, ); return cached; @@ -115,7 +115,7 @@ export class AuthzProfileService { this.logger.debug( `Fetching capabilities from API: org=${ - org ?? 'global' + namespace ?? 'global' } project=${project} component=${component}`, ); @@ -123,19 +123,19 @@ export class AuthzProfileService { const client = this.createClient(userToken); // Build query parameters - only include if provided - // TODO: Remove hardcoded org once API supports optional org + // TODO: Remove hardcoded namespace once API supports optional namespace const query: { org?: string; project?: string; component?: string; ou?: string[]; } = { - org: org ?? 'default', + org: namespace ?? 'default', }; if (project) query.project = project; if (component) query.component = component; - if (scope?.orgUnits?.length) query.ou = scope.orgUnits; + if (scope?.namespaceUnits?.length) query.ou = scope.namespaceUnits; const { data, error, response } = await client.GET('/authz/profile', { params: { query }, @@ -178,7 +178,7 @@ export class AuthzProfileService { } catch (err) { this.logger.error( `Failed to fetch capabilities for org=${ - org ?? 'global' + namespace ?? 'global' } project=${project} component=${component}: ${err}`, ); throw err; @@ -205,7 +205,7 @@ export class AuthzProfileService { userToken?: string, scope?: OpenChoreoScope, ): Promise { - const cacheKey = scope?.org ?? 'global'; + const cacheKey = scope?.namespace ?? 'global'; // Try cache by userEntityRef first (works without token) if (this.cache) { diff --git a/plugins/permission-backend-module-openchoreo-policy/src/services/types.ts b/plugins/permission-backend-module-openchoreo-policy/src/services/types.ts index 855dba00..3a45fbf1 100644 --- a/plugins/permission-backend-module-openchoreo-policy/src/services/types.ts +++ b/plugins/permission-backend-module-openchoreo-policy/src/services/types.ts @@ -27,12 +27,12 @@ export type CapabilityResource = * Scope for permission evaluation. */ export interface OpenChoreoScope { - /** Organization name (required) */ - org: string; + /** Namespace name (required) */ + namespace: string; /** Project name (optional) */ project?: string; /** Component name (optional) */ component?: string; - /** Organization units (optional) */ - orgUnits?: string[]; + /** Namespace units (optional) */ + namespaceUnits?: string[]; } diff --git a/plugins/platform-engineer-core-backend/src/router.ts b/plugins/platform-engineer-core-backend/src/router.ts index d980d8f1..10654cdd 100644 --- a/plugins/platform-engineer-core-backend/src/router.ts +++ b/plugins/platform-engineer-core-backend/src/router.ts @@ -41,14 +41,14 @@ export async function createRouter( } }); - // Get environments for a specific organization - router.get('/environments/:orgName', async (req, res) => { + // Get environments for a specific namespace + router.get('/environments/:namespaceName', async (req, res) => { try { - const { orgName } = req.params; + const { namespaceName } = req.params; const userToken = getUserTokenFromRequest(req); const environments = - await platformEnvironmentService.fetchEnvironmentsByOrganization( - orgName, + await platformEnvironmentService.fetchEnvironmentsByNamespace( + namespaceName, userToken, ); res.json({ @@ -82,14 +82,14 @@ export async function createRouter( } }); - // Get dataplanes for a specific organization - router.get('/dataplanes/:orgName', async (req, res) => { + // Get dataplanes for a specific namespace + router.get('/dataplanes/:namespaceName', async (req, res) => { try { - const { orgName } = req.params; + const { namespaceName } = req.params; const userToken = getUserTokenFromRequest(req); const dataplanes = - await platformEnvironmentService.fetchDataplanesByOrganization( - orgName, + await platformEnvironmentService.fetchDataplanesByNamespace( + namespaceName, userToken, ); res.json({ @@ -156,7 +156,7 @@ export async function createRouter( return res.status(400).json({ success: false, error: - 'Invalid request body. Expected { components: Array<{orgName, projectName, componentName}> }', + 'Invalid request body. Expected { components: Array<{namespaceName, projectName, componentName}> }', }); } @@ -191,7 +191,7 @@ export async function createRouter( return res.status(400).json({ success: false, error: - 'Invalid request body. Expected { components: Array<{orgName, projectName, componentName}> }', + 'Invalid request body. Expected { components: Array<{namespaceName, projectName, componentName}> }', }); } @@ -223,7 +223,7 @@ export async function createRouter( return res.status(400).json({ success: false, error: - 'Invalid request body. Expected { components: Array<{orgName, projectName, componentName}> }', + 'Invalid request body. Expected { components: Array<{namespaceName, projectName, componentName}> }', }); } diff --git a/plugins/platform-engineer-core-backend/src/services/PlatformEnvironmentService.ts b/plugins/platform-engineer-core-backend/src/services/PlatformEnvironmentService.ts index 2b67e8b7..84a3ab46 100644 --- a/plugins/platform-engineer-core-backend/src/services/PlatformEnvironmentService.ts +++ b/plugins/platform-engineer-core-backend/src/services/PlatformEnvironmentService.ts @@ -19,7 +19,7 @@ import { /** * Service for managing platform-wide environment information. - * This service provides a platform engineer's view of all environments across organizations. + * This service provides a platform engineer's view of all environments across namespaces. */ export class PlatformEnvironmentInfoService implements PlatformEnvironmentService @@ -40,7 +40,7 @@ export class PlatformEnvironmentInfoService } /** - * Fetches all environments across all organizations. + * Fetches all environments across all namespaces. * This provides a platform-wide view for platform engineers. */ async fetchAllEnvironments(userToken?: string): Promise { @@ -54,14 +54,14 @@ export class PlatformEnvironmentInfoService logger: this.logger, }); - // For now, we'll fetch environments from a default organization - // In a real implementation, you might need to fetch from multiple organizations + // For now, we'll fetch environments from a default namespace + // In a real implementation, you might need to fetch from multiple namespaces // or have a platform-wide API endpoint const { data, error, response } = await client.GET( - '/orgs/{orgName}/environments', + '/namespaces/{namespaceName}/environments', { params: { - path: { orgName: 'default' }, // This should be configurable or fetched from a platform API + path: { namespaceName: 'default' }, // This should be configurable or fetched from a platform API }, }, ); @@ -98,16 +98,16 @@ export class PlatformEnvironmentInfoService } /** - * Fetches environments for a specific organization. + * Fetches environments for a specific namespace. */ - async fetchEnvironmentsByOrganization( - organizationName: string, + async fetchEnvironmentsByNamespace( + namespaceName: string, userToken?: string, ): Promise { const startTime = Date.now(); try { this.logger.debug( - `Starting environment fetch for organization: ${organizationName}`, + `Starting environment fetch for namespace: ${namespaceName}`, ); const client = createOpenChoreoApiClient({ @@ -117,44 +117,41 @@ export class PlatformEnvironmentInfoService }); const { data, error, response } = await client.GET( - '/orgs/{orgName}/environments', + '/namespaces/{namespaceName}/environments', { params: { - path: { orgName: organizationName }, + path: { namespaceName: namespaceName }, }, }, ); if (error || !response.ok) { this.logger.error( - `Failed to fetch environments for organization ${organizationName}: ${response.status} ${response.statusText}`, + `Failed to fetch environments for namespace ${namespaceName}: ${response.status} ${response.statusText}`, ); return []; } if (!data.success || !data.data?.items) { this.logger.warn( - `No environments found for organization ${organizationName}`, + `No environments found for namespace ${namespaceName}`, ); return []; } const environments = data.data.items; - const result = this.transformEnvironmentData( - environments, - organizationName, - ); + const result = this.transformEnvironmentData(environments, namespaceName); const totalTime = Date.now() - startTime; this.logger.debug( - `Environment fetch completed for ${organizationName}: ${result.length} environments found (${totalTime}ms)`, + `Environment fetch completed for ${namespaceName}: ${result.length} environments found (${totalTime}ms)`, ); return result; } catch (error: unknown) { const totalTime = Date.now() - startTime; this.logger.error( - `Error fetching environments for organization ${organizationName} (${totalTime}ms):`, + `Error fetching environments for namespace ${namespaceName} (${totalTime}ms):`, error as Error, ); return []; @@ -162,7 +159,7 @@ export class PlatformEnvironmentInfoService } /** - * Fetches all dataplanes across all organizations. + * Fetches all dataplanes across all namespaces. * This provides a platform-wide view for platform engineers. */ async fetchAllDataplanes(userToken?: string): Promise { @@ -176,14 +173,14 @@ export class PlatformEnvironmentInfoService logger: this.logger, }); - // For now, we'll fetch dataplanes from a default organization - // In a real implementation, you might need to fetch from multiple organizations + // For now, we'll fetch dataplanes from a default namespace + // In a real implementation, you might need to fetch from multiple namespaces // or have a platform-wide API endpoint const { data, error, response } = await client.GET( - '/orgs/{orgName}/dataplanes', + '/namespaces/{namespaceName}/dataplanes', { params: { - path: { orgName: 'default' }, // This should be configurable or fetched from a platform API + path: { namespaceName: 'default' }, // This should be configurable or fetched from a platform API }, }, ); @@ -220,16 +217,16 @@ export class PlatformEnvironmentInfoService } /** - * Fetches dataplanes for a specific organization. + * Fetches dataplanes for a specific namespace. */ - async fetchDataplanesByOrganization( - organizationName: string, + async fetchDataplanesByNamespace( + namespaceName: string, userToken?: string, ): Promise { const startTime = Date.now(); try { this.logger.debug( - `Starting dataplane fetch for organization: ${organizationName}`, + `Starting dataplane fetch for namespace: ${namespaceName}`, ); const client = createOpenChoreoApiClient({ @@ -239,41 +236,39 @@ export class PlatformEnvironmentInfoService }); const { data, error, response } = await client.GET( - '/orgs/{orgName}/dataplanes', + '/namespaces/{namespaceName}/dataplanes', { params: { - path: { orgName: organizationName }, + path: { namespaceName: namespaceName }, }, }, ); if (error || !response.ok) { this.logger.error( - `Failed to fetch dataplanes for organization ${organizationName}: ${response.status} ${response.statusText}`, + `Failed to fetch dataplanes for namespace ${namespaceName}: ${response.status} ${response.statusText}`, ); return []; } if (!data.success || !data.data?.items) { - this.logger.warn( - `No dataplanes found for organization ${organizationName}`, - ); + this.logger.warn(`No dataplanes found for namespace ${namespaceName}`); return []; } const dataplanes = data.data.items; - const result = this.transformDataPlaneData(dataplanes, organizationName); + const result = this.transformDataPlaneData(dataplanes, namespaceName); const totalTime = Date.now() - startTime; this.logger.debug( - `Dataplane fetch completed for ${organizationName}: ${result.length} dataplanes found (${totalTime}ms)`, + `Dataplane fetch completed for ${namespaceName}: ${result.length} dataplanes found (${totalTime}ms)`, ); return result; } catch (error: unknown) { const totalTime = Date.now() - startTime; this.logger.error( - `Error fetching dataplanes for organization ${organizationName} (${totalTime}ms):`, + `Error fetching dataplanes for namespace ${namespaceName} (${totalTime}ms):`, error as Error, ); return []; @@ -381,7 +376,7 @@ export class PlatformEnvironmentInfoService */ async fetchComponentCountsPerEnvironment( components: Array<{ - orgName: string; + namespaceName: string; projectName: string; componentName: string; }>, @@ -411,11 +406,11 @@ export class PlatformEnvironmentInfoService try { // Get bindings for this component const { data, error, response } = await client.GET( - '/orgs/{orgName}/projects/{projectName}/components/{componentName}/release-bindings', + '/namespaces/{namespaceName}/projects/{projectName}/components/{componentName}/release-bindings', { params: { path: { - orgName: component.orgName, + namespaceName: component.namespaceName, projectName: component.projectName, componentName: component.componentName, }, @@ -437,7 +432,7 @@ export class PlatformEnvironmentInfoService } } catch (error) { this.logger.warn( - `Failed to fetch bindings for component ${component.orgName}/${component.projectName}/${component.componentName}:`, + `Failed to fetch bindings for component ${component.namespaceName}/${component.projectName}/${component.componentName}:`, error instanceof Error ? error : new Error(String(error)), ); } @@ -468,7 +463,7 @@ export class PlatformEnvironmentInfoService */ async fetchDistinctDeployedComponentsCount( components: Array<{ - orgName: string; + namespaceName: string; projectName: string; componentName: string; }>, @@ -498,11 +493,11 @@ export class PlatformEnvironmentInfoService try { // Get bindings for this component const { data, error, response } = await client.GET( - '/orgs/{orgName}/projects/{projectName}/components/{componentName}/release-bindings', + '/namespaces/{namespaceName}/projects/{projectName}/components/{componentName}/release-bindings', { params: { path: { - orgName: component.orgName, + namespaceName: component.namespaceName, projectName: component.projectName, componentName: component.componentName, }, @@ -518,12 +513,12 @@ export class PlatformEnvironmentInfoService data.data.items.length > 0 ) { // If component has at least one binding, count it as deployed - const componentKey = `${component.orgName}/${component.projectName}/${component.componentName}`; + const componentKey = `${component.namespaceName}/${component.projectName}/${component.componentName}`; deployedComponents.add(componentKey); } } catch (error) { this.logger.warn( - `Failed to fetch bindings for component ${component.orgName}/${component.projectName}/${component.componentName}:`, + `Failed to fetch bindings for component ${component.namespaceName}/${component.projectName}/${component.componentName}:`, error instanceof Error ? error : new Error(String(error)), ); } @@ -555,7 +550,7 @@ export class PlatformEnvironmentInfoService */ async fetchHealthyWorkloadCount( components: Array<{ - orgName: string; + namespaceName: string; projectName: string; componentName: string; }>, @@ -585,11 +580,11 @@ export class PlatformEnvironmentInfoService try { // Get bindings for this component const { data, error, response } = await client.GET( - '/orgs/{orgName}/projects/{projectName}/components/{componentName}/release-bindings', + '/namespaces/{namespaceName}/projects/{projectName}/components/{componentName}/release-bindings', { params: { path: { - orgName: component.orgName, + namespaceName: component.namespaceName, projectName: component.projectName, componentName: component.componentName, }, @@ -608,7 +603,7 @@ export class PlatformEnvironmentInfoService return 0; } catch (error) { this.logger.warn( - `Failed to fetch bindings for component ${component.orgName}/${component.projectName}/${component.componentName}:`, + `Failed to fetch bindings for component ${component.namespaceName}/${component.projectName}/${component.componentName}:`, error instanceof Error ? error : new Error(String(error)), ); return 0; @@ -641,7 +636,7 @@ export class PlatformEnvironmentInfoService private transformEnvironmentData( environmentData: ModelsEnvironment[], - organizationName: string, + namespaceName: string, ): Environment[] { return environmentData.map(env => { const transformedEnv: Environment = { @@ -649,7 +644,7 @@ export class PlatformEnvironmentInfoService namespace: env.namespace || '', displayName: env.displayName || env.name, description: env.description || '', - organization: organizationName, + namespaceName: namespaceName, dataPlaneRef: env.dataPlaneRef || '', isProduction: env.isProduction ?? false, dnsPrefix: env.dnsPrefix || '', @@ -663,7 +658,7 @@ export class PlatformEnvironmentInfoService private transformDataPlaneData( dataplaneData: ModelsDataPlane[], - organizationName: string, + namespaceName: string, ): DataPlane[] { return dataplaneData.map(dp => { const transformedDataPlane: DataPlane = { @@ -671,15 +666,15 @@ export class PlatformEnvironmentInfoService namespace: dp.namespace, displayName: dp.displayName, description: dp.description, - organization: organizationName, + namespaceName: namespaceName, imagePullSecretRefs: dp.imagePullSecretRefs, secretStoreRef: dp.secretStoreRef, publicVirtualHost: dp.publicVirtualHost, - organizationVirtualHost: dp.organizationVirtualHost, + namespaceVirtualHost: dp.namespaceVirtualHost, publicHTTPPort: dp.publicHTTPPort, publicHTTPSPort: dp.publicHTTPSPort, - organizationHTTPPort: dp.organizationHTTPPort, - organizationHTTPSPort: dp.organizationHTTPSPort, + namespaceHTTPPort: dp.namespaceHTTPPort, + namespaceHTTPSPort: dp.namespaceHTTPSPort, observabilityPlaneRef: dp.observabilityPlaneRef, createdAt: dp.createdAt, status: dp.status, diff --git a/plugins/platform-engineer-core-backend/src/types.ts b/plugins/platform-engineer-core-backend/src/types.ts index 233df678..409c7053 100644 --- a/plugins/platform-engineer-core-backend/src/types.ts +++ b/plugins/platform-engineer-core-backend/src/types.ts @@ -3,7 +3,7 @@ export interface Environment { namespace: string; displayName: string; description: string; - organization: string; + namespaceName: string; dataPlaneRef: string; isProduction: boolean; dnsPrefix: string; @@ -17,15 +17,15 @@ export interface DataPlane { namespace?: string; displayName?: string; description?: string; - organization: string; + namespaceName: string; imagePullSecretRefs?: string[]; secretStoreRef?: string; publicVirtualHost?: string; - organizationVirtualHost?: string; + namespaceVirtualHost?: string; publicHTTPPort?: number; publicHTTPSPort?: number; - organizationHTTPPort?: number; - organizationHTTPSPort?: number; + namespaceHTTPPort?: number; + namespaceHTTPSPort?: number; observabilityPlaneRef?: string; createdAt?: string; status?: string; @@ -37,28 +37,28 @@ export interface DataPlaneWithEnvironments extends DataPlane { export interface PlatformEnvironmentService { /** - * Fetches all environments across all organizations + * Fetches all environments across all namespaces */ fetchAllEnvironments(userToken?: string): Promise; /** - * Fetches environments for a specific organization + * Fetches environments for a specific namespace */ - fetchEnvironmentsByOrganization( - organizationName: string, + fetchEnvironmentsByNamespace( + namespaceName: string, userToken?: string, ): Promise; /** - * Fetches all dataplanes across all organizations + * Fetches all dataplanes across all namespaces */ fetchAllDataplanes(userToken?: string): Promise; /** - * Fetches dataplanes for a specific organization + * Fetches dataplanes for a specific namespace */ - fetchDataplanesByOrganization( - organizationName: string, + fetchDataplanesByNamespace( + namespaceName: string, userToken?: string, ): Promise; @@ -81,7 +81,7 @@ export interface PlatformEnvironmentService { */ fetchComponentCountsPerEnvironment( components: Array<{ - orgName: string; + namespaceName: string; projectName: string; componentName: string; }>, @@ -93,7 +93,7 @@ export interface PlatformEnvironmentService { */ fetchDistinctDeployedComponentsCount( components: Array<{ - orgName: string; + namespaceName: string; projectName: string; componentName: string; }>, @@ -106,7 +106,7 @@ export interface PlatformEnvironmentService { */ fetchHealthyWorkloadCount( components: Array<{ - orgName: string; + namespaceName: string; projectName: string; componentName: string; }>, diff --git a/plugins/platform-engineer-core/src/api/dataplanes.ts b/plugins/platform-engineer-core/src/api/dataplanes.ts index b58b4b1b..113346d6 100644 --- a/plugins/platform-engineer-core/src/api/dataplanes.ts +++ b/plugins/platform-engineer-core/src/api/dataplanes.ts @@ -23,20 +23,20 @@ export async function fetchAllDataplanes( return data.data || []; } -export async function fetchDataplanesByOrganization( - organizationName: string, +export async function fetchDataplanesByNamespace( + namespaceName: string, discovery: DiscoveryApi, fetchApi: FetchApi, ): Promise { const backendUrl = `${await discovery.getBaseUrl( 'platform-engineer-core', - )}/dataplanes/${organizationName}`; + )}/dataplanes/${namespaceName}`; const res = await fetchApi.fetch(backendUrl); if (!res.ok) { throw new Error( - `Failed to fetch dataplanes for ${organizationName}: ${res.statusText}`, + `Failed to fetch dataplanes for ${namespaceName}: ${res.statusText}`, ); } diff --git a/plugins/platform-engineer-core/src/api/dataplanesWithEnvironmentsAndComponents.ts b/plugins/platform-engineer-core/src/api/dataplanesWithEnvironmentsAndComponents.ts index f8e0f7a1..80fe797d 100644 --- a/plugins/platform-engineer-core/src/api/dataplanesWithEnvironmentsAndComponents.ts +++ b/plugins/platform-engineer-core/src/api/dataplanesWithEnvironmentsAndComponents.ts @@ -3,7 +3,7 @@ import { CatalogApi } from '@backstage/catalog-client'; import { DataPlaneWithEnvironments } from '../types'; interface ComponentInfo { - orgName: string; + namespaceName: string; projectName: string; componentName: string; } @@ -51,8 +51,8 @@ export async function fetchDataplanesWithEnvironmentsAndComponents( // Extract org, project, and component name from annotations or metadata // These might be stored in different ways depending on your setup - const orgName = - annotations['openchoreo.io/organization'] || + const namespaceName = + annotations['openchoreo.io/namespace'] || annotations['backstage.io/managed-by-location']?.split('/')[3] || 'default'; // fallback @@ -63,9 +63,9 @@ export async function fetchDataplanesWithEnvironmentsAndComponents( const componentName = component.metadata.name; - if (orgName && projectName && componentName) { + if (namespaceName && projectName && componentName) { componentInfos.push({ - orgName, + namespaceName, projectName, componentName, }); diff --git a/plugins/platform-engineer-core/src/api/distinctDeployedComponents.ts b/plugins/platform-engineer-core/src/api/distinctDeployedComponents.ts index e0541e35..f9498a65 100644 --- a/plugins/platform-engineer-core/src/api/distinctDeployedComponents.ts +++ b/plugins/platform-engineer-core/src/api/distinctDeployedComponents.ts @@ -2,7 +2,7 @@ import { DiscoveryApi, FetchApi } from '@backstage/core-plugin-api'; import { CatalogApi } from '@backstage/catalog-client'; interface ComponentInfo { - orgName: string; + namespaceName: string; projectName: string; componentName: string; } @@ -27,8 +27,8 @@ export async function fetchDistinctDeployedComponentsCount( const annotations = component.metadata.annotations || {}; // Extract org, project, and component name from annotations or metadata - const orgName = - annotations['openchoreo.io/organization'] || + const namespaceName = + annotations['openchoreo.io/namespace'] || annotations['backstage.io/managed-by-location']?.split('/')[3] || 'default'; // fallback @@ -39,9 +39,9 @@ export async function fetchDistinctDeployedComponentsCount( const componentName = component.metadata.name; - if (orgName && projectName && componentName) { + if (namespaceName && projectName && componentName) { componentInfos.push({ - orgName, + namespaceName, projectName, componentName, }); diff --git a/plugins/platform-engineer-core/src/api/environments.ts b/plugins/platform-engineer-core/src/api/environments.ts index cb1798f5..13e750ca 100644 --- a/plugins/platform-engineer-core/src/api/environments.ts +++ b/plugins/platform-engineer-core/src/api/environments.ts @@ -23,20 +23,20 @@ export async function fetchAllEnvironments( return data.data || []; } -export async function fetchEnvironmentsByOrganization( - organizationName: string, +export async function fetchEnvironmentsByNamespace( + namespaceName: string, discovery: DiscoveryApi, fetchApi: FetchApi, ): Promise { const backendUrl = `${await discovery.getBaseUrl( 'platform-engineer-core', - )}/environments/${organizationName}`; + )}/environments/${namespaceName}`; const res = await fetchApi.fetch(backendUrl); if (!res.ok) { throw new Error( - `Failed to fetch environments for ${organizationName}: ${res.statusText}`, + `Failed to fetch environments for ${namespaceName}: ${res.statusText}`, ); } diff --git a/plugins/platform-engineer-core/src/api/platformOverview.ts b/plugins/platform-engineer-core/src/api/platformOverview.ts index fe007f79..71ebc607 100644 --- a/plugins/platform-engineer-core/src/api/platformOverview.ts +++ b/plugins/platform-engineer-core/src/api/platformOverview.ts @@ -3,7 +3,7 @@ import { CatalogApi } from '@backstage/catalog-client'; import { DataPlane, Environment } from '../types'; interface ComponentInfo { - orgName: string; + namespaceName: string; projectName: string; componentName: string; } @@ -63,8 +63,8 @@ export async function fetchPlatformOverview( const annotations = component.metadata.annotations || {}; // Extract org, project, and component name from annotations or metadata - const orgName = - annotations['openchoreo.io/organization'] || + const namespaceName = + annotations['openchoreo.io/namespace'] || annotations['backstage.io/managed-by-location']?.split('/')[3] || 'default'; // fallback @@ -75,9 +75,9 @@ export async function fetchPlatformOverview( const componentName = component.metadata.name; - if (orgName && projectName && componentName) { + if (namespaceName && projectName && componentName) { componentInfos.push({ - orgName, + namespaceName, projectName, componentName, }); diff --git a/plugins/platform-engineer-core/src/components/PlatformDetailsCard/EnvironmentCard.tsx b/plugins/platform-engineer-core/src/components/PlatformDetailsCard/EnvironmentCard.tsx index 35160794..a1106433 100644 --- a/plugins/platform-engineer-core/src/components/PlatformDetailsCard/EnvironmentCard.tsx +++ b/plugins/platform-engineer-core/src/components/PlatformDetailsCard/EnvironmentCard.tsx @@ -3,7 +3,7 @@ import AppsIcon from '@material-ui/icons/Apps'; import { useStyles } from './styles'; interface Environment { - organization: string; + namespaceName: string; name: string; displayName?: string; isProduction: boolean; @@ -22,7 +22,7 @@ export const EnvironmentCard = ({ environment }: EnvironmentCardProps) => { return ( diff --git a/plugins/platform-engineer-core/src/components/PlatformDetailsCard/EnvironmentsGrid.tsx b/plugins/platform-engineer-core/src/components/PlatformDetailsCard/EnvironmentsGrid.tsx index fd97af7d..47fafecf 100644 --- a/plugins/platform-engineer-core/src/components/PlatformDetailsCard/EnvironmentsGrid.tsx +++ b/plugins/platform-engineer-core/src/components/PlatformDetailsCard/EnvironmentsGrid.tsx @@ -3,7 +3,7 @@ import { EnvironmentCard } from './EnvironmentCard'; import { useStyles } from './styles'; interface Environment { - organization: string; + namespaceName: string; name: string; displayName?: string; isProduction: boolean; @@ -29,7 +29,7 @@ export const EnvironmentsGrid = ({ environments }: EnvironmentsGridProps) => { }) .map(environment => ( ))} diff --git a/plugins/platform-engineer-core/src/components/PlatformDetailsCard/PlatformDetailsCard.tsx b/plugins/platform-engineer-core/src/components/PlatformDetailsCard/PlatformDetailsCard.tsx index 83616876..6d555534 100644 --- a/plugins/platform-engineer-core/src/components/PlatformDetailsCard/PlatformDetailsCard.tsx +++ b/plugins/platform-engineer-core/src/components/PlatformDetailsCard/PlatformDetailsCard.tsx @@ -50,7 +50,7 @@ export const PlatformDetailsCard = ({ {dataplane.environments.length} environments •{' '} - {dataplane.organization} + {dataplane.namespaceName} diff --git a/plugins/platform-engineer-core/src/types.ts b/plugins/platform-engineer-core/src/types.ts index 7476296f..8d22ef09 100644 --- a/plugins/platform-engineer-core/src/types.ts +++ b/plugins/platform-engineer-core/src/types.ts @@ -3,7 +3,7 @@ export interface Environment { namespace: string; displayName: string; description: string; - organization: string; + namespaceName: string; dataPlaneRef: string; isProduction: boolean; dnsPrefix: string; @@ -17,7 +17,7 @@ export interface DataPlane { namespace?: string; displayName?: string; description?: string; - organization: string; + namespaceName: string; imagePullSecretRefs?: string[]; secretStoreRef?: string; kubernetesClusterName?: string; diff --git a/plugins/scaffolder-backend-module-openchoreo/src/actions/component.ts b/plugins/scaffolder-backend-module-openchoreo/src/actions/component.ts index 10eefcc2..5f249f32 100644 --- a/plugins/scaffolder-backend-module-openchoreo/src/actions/component.ts +++ b/plugins/scaffolder-backend-module-openchoreo/src/actions/component.ts @@ -37,10 +37,10 @@ export const createComponentAction = ( zImpl .object({ // Keep existing validation for required fields - orgName: zImpl + namespaceName: zImpl .string() .describe( - 'The name of the organization where the component will be created', + 'The name of the namespace where the component will be created', ), projectName: zImpl .string() @@ -81,9 +81,9 @@ export const createComponentAction = ( projectName: zImpl .string() .describe('The project where the component was created'), - organizationName: zImpl + namespaceName: zImpl .string() - .describe('The organization where the component was created'), + .describe('The namespace where the component was created'), }), }, async handler(ctx) { @@ -91,9 +91,9 @@ export const createComponentAction = ( `Creating component with parameters: ${JSON.stringify(ctx.input)}`, ); - // Extract organization name from domain format (e.g., "domain:default/default-org" -> "default-org") - const extractOrgName = (fullOrgName: string): string => { - const parts = fullOrgName.split('/'); + // Extract namespace name from domain format (e.g., "domain:default/default-ns" -> "default-ns") + const extractNamespaceName = (fullNamespaceName: string): string => { + const parts = fullNamespaceName.split('/'); return parts[parts.length - 1]; }; @@ -103,17 +103,17 @@ export const createComponentAction = ( return parts[parts.length - 1]; }; - const orgName = extractOrgName(ctx.input.orgName); + const namespaceName = extractNamespaceName(ctx.input.namespaceName); const projectName = extractProjectName(ctx.input.projectName); ctx.logger.info( - `Extracted organization name: ${orgName} from ${ctx.input.orgName}`, + `Extracted namespace name: ${namespaceName} from ${ctx.input.namespaceName}`, ); ctx.logger.info( `Extracted project name: ${projectName} from ${ctx.input.projectName}`, ); - // Check if component with the same name already exists in this organization + // Check if component with the same name already exists in this namespace // Note: This requires catalog-backend to be accessible try { const catalogApi = new CatalogClient({ @@ -127,23 +127,22 @@ export const createComponentAction = ( }, }); - // Filter components by organization annotation and check if name exists - const existsInOrg = items.some( + // Filter components by namespace annotation and check if name exists + const existsInNamespace = items.some( component => - component.metadata.annotations?.[ - CHOREO_ANNOTATIONS.ORGANIZATION - ] === orgName && + component.metadata.annotations?.[CHOREO_ANNOTATIONS.NAMESPACE] === + namespaceName && component.metadata.name === ctx.input.componentName, ); - if (existsInOrg) { + if (existsInNamespace) { throw new Error( - `A component named "${ctx.input.componentName}" already exists in organization "${orgName}". Please choose a different name.`, + `A component named "${ctx.input.componentName}" already exists in namespace "${namespaceName}". Please choose a different name.`, ); } ctx.logger.debug( - `Component name "${ctx.input.componentName}" is available in organization "${orgName}"`, + `Component name "${ctx.input.componentName}" is available in namespace "${namespaceName}"`, ); } catch (error) { // If it's our duplicate error, rethrow it @@ -178,7 +177,7 @@ export const createComponentAction = ( // Extract CTD-specific parameters by filtering out known scaffolder fields const knownScaffolderFields = new Set([ - 'orgName', + 'namespaceName', 'projectName', 'componentName', 'displayName', @@ -211,7 +210,7 @@ export const createComponentAction = ( componentName: ctx.input.componentName, displayName: ctx.input.displayName, description: ctx.input.description, - organizationName: orgName, + namespaceName: namespaceName, projectName: projectName, componentType: ctx.input.componentType, componentTypeWorkloadType: @@ -311,7 +310,7 @@ export const createComponentAction = ( description: ctx.input.description, type: fullComponentType, // Use full type format: deployment/service projectName: projectName, - orgName: orgName, + namespaceName: namespaceName, status: 'Active', // New components are active by default createdAt: new Date().toISOString(), autoDeploy: autoDeploy, @@ -341,7 +340,7 @@ export const createComponentAction = ( // Use the shared translation utility for consistency with scheduled sync const entity = translateComponentToEntity( component, - orgName, + namespaceName, projectName, { defaultOwner, @@ -372,7 +371,7 @@ export const createComponentAction = ( // Set outputs for the scaffolder ctx.output('componentName', ctx.input.componentName); ctx.output('projectName', projectName); - ctx.output('organizationName', orgName); + ctx.output('namespaceName', namespaceName); ctx.logger.info( `Component '${ctx.input.componentName}' created successfully in project '${projectName}'`, diff --git a/plugins/scaffolder-backend-module-openchoreo/src/actions/componentResourceBuilder.ts b/plugins/scaffolder-backend-module-openchoreo/src/actions/componentResourceBuilder.ts index 7c59d788..4f38f8c7 100644 --- a/plugins/scaffolder-backend-module-openchoreo/src/actions/componentResourceBuilder.ts +++ b/plugins/scaffolder-backend-module-openchoreo/src/actions/componentResourceBuilder.ts @@ -11,7 +11,7 @@ export interface ComponentResourceInput { componentName: string; displayName?: string; description?: string; - organizationName: string; + namespaceName: string; projectName: string; // Section 2: Component Type Configuration @@ -49,7 +49,7 @@ export function buildComponentResource( kind: 'Component', metadata: { name: input.componentName, - namespace: input.organizationName, + namespace: input.namespaceName, annotations: {}, }, spec: { diff --git a/plugins/scaffolder-backend-module-openchoreo/src/actions/componentResourceInterface.ts b/plugins/scaffolder-backend-module-openchoreo/src/actions/componentResourceInterface.ts index 0f5d6fc6..509b0ac7 100644 --- a/plugins/scaffolder-backend-module-openchoreo/src/actions/componentResourceInterface.ts +++ b/plugins/scaffolder-backend-module-openchoreo/src/actions/componentResourceInterface.ts @@ -69,7 +69,7 @@ export interface ComponentSpec { export interface ComponentMetadata { /** Component name */ name: string; - /** Organization namespace */ + /** Namespace */ namespace: string; /** Annotations for display name and description */ annotations?: { diff --git a/plugins/scaffolder-backend-module-openchoreo/src/actions/project.ts b/plugins/scaffolder-backend-module-openchoreo/src/actions/project.ts index 0fa3530f..fbdd4c4b 100644 --- a/plugins/scaffolder-backend-module-openchoreo/src/actions/project.ts +++ b/plugins/scaffolder-backend-module-openchoreo/src/actions/project.ts @@ -10,9 +10,9 @@ export const createProjectAction = (config: Config) => { schema: { input: (zImpl: typeof z) => zImpl.object({ - orgName: zImpl + namespaceName: zImpl .string() - .describe('The name of the organization to create the project in'), + .describe('The name of the namespace to create the project in'), projectName: zImpl .string() .describe('The name of the project to create'), @@ -34,9 +34,9 @@ export const createProjectAction = (config: Config) => { projectName: zImpl .string() .describe('The name of the created project'), - organizationName: zImpl + namespaceName: zImpl .string() - .describe('The organization where the project was created'), + .describe('The namespace where the project was created'), }), }, async handler(ctx) { @@ -44,15 +44,15 @@ export const createProjectAction = (config: Config) => { `Creating project with parameters: ${JSON.stringify(ctx.input)}`, ); - // Extract organization name from domain format (e.g., "domain:default/default-org" -> "default-org") - const extractOrgName = (fullOrgName: string): string => { - const parts = fullOrgName.split('/'); + // Extract namespace name from domain format (e.g., "domain:default/default-ns" -> "default-ns") + const extractNamespaceName = (fullNamespaceName: string): string => { + const parts = fullNamespaceName.split('/'); return parts[parts.length - 1]; }; - const orgName = extractOrgName(ctx.input.orgName); + const namespaceName = extractNamespaceName(ctx.input.namespaceName); ctx.logger.debug( - `Extracted organization name: ${orgName} from ${ctx.input.orgName}`, + `Extracted namespace name: ${namespaceName} from ${ctx.input.namespaceName}`, ); // Get the base URL from configuration @@ -89,10 +89,10 @@ export const createProjectAction = (config: Config) => { try { const { data, error, response } = await client.POST( - '/orgs/{orgName}/projects', + '/namespaces/{namespaceName}/projects', { params: { - path: { orgName }, + path: { namespaceName }, }, body: { name: ctx.input.projectName, @@ -119,7 +119,7 @@ export const createProjectAction = (config: Config) => { // Set outputs for the scaffolder ctx.output('projectName', data.data.name || ctx.input.projectName); - ctx.output('organizationName', orgName); + ctx.output('namespaceName', namespaceName); } catch (error) { ctx.logger.error(`Error creating project: ${error}`); throw new Error(`Failed to create project: ${error}`); diff --git a/templates/create-openchoreo-component/template.yaml b/templates/create-openchoreo-component/template.yaml index a4f9cc25..4d8e118f 100644 --- a/templates/create-openchoreo-component/template.yaml +++ b/templates/create-openchoreo-component/template.yaml @@ -15,7 +15,7 @@ spec: parameters: - title: Component Metadata required: - - organization_name + - namespace_name - project_name - component_name - component_type @@ -41,8 +41,8 @@ spec: ui:options: catalogFilter: - kind: System - organization_name: - title: Organization Name + namespace_name: + title: Namespace Name type: string description: Help others understand what this project is for. ui:field: EntityPicker @@ -133,7 +133,7 @@ spec: name: Create OpenChoreo Component action: openchoreo:component:create input: - orgName: ${{ parameters.organization_name }} + namespaceName: ${{ parameters.namespace_name }} projectName: ${{ parameters.project_name }} componentName: ${{ parameters.component_name }} displayName: ${{ parameters.displayName }} diff --git a/templates/create-openchoreo-project/template.yaml b/templates/create-openchoreo-project/template.yaml index e842d6c4..5932c175 100644 --- a/templates/create-openchoreo-project/template.yaml +++ b/templates/create-openchoreo-project/template.yaml @@ -15,7 +15,7 @@ spec: parameters: - title: OpenChoreo Project Details required: - - organization_name + - namespace_name - project_name properties: project_name: @@ -31,10 +31,10 @@ spec: title: Description type: string description: Help others understand what this project is for. - organization_name: - title: Organization Name + namespace_name: + title: Namespace Name type: string - description: Organization where the project will be created + description: Namespace where the project will be created ui:field: EntityPicker ui:options: catalogFilter: @@ -53,7 +53,7 @@ spec: name: Create OpenChoreo Project action: openchoreo:project:create input: - orgName: ${{ parameters.organization_name }} + namespaceName: ${{ parameters.namespace_name }} projectName: ${{ parameters.project_name }} displayName: ${{ parameters.displayName }} description: ${{ parameters.description }}