diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 1705d1bd..10a10237 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -1,5 +1,10 @@ version: 2 updates: + - package-ecosystem: "uv" + directory: "/" + schedule: + interval: "weekly" + open-pull-requests-limit: 10 - package-ecosystem: "github-actions" directory: "/" schedule: diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1b13246d..dbb90909 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -11,10 +11,11 @@ env: jobs: Build: runs-on: self-hosted + if : ${{ github.actor != 'dependabot[bot]' }} strategy: fail-fast: true steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v6 - name: Build Genesis Core env: PUSH_CFG: ${{ secrets.PUSH_CFG }} @@ -40,7 +41,7 @@ jobs: echo "${VERSION}" > "${ARTIFACTS_PATH}/version.txt" - name: Upload the build artifacts - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v7 with: name: build_artifacts path: artifacts/ diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 96e2c24c..925b152c 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -21,7 +21,7 @@ jobs: uses: actions/checkout@v4 with: fetch-depth: 0 - - uses: actions/setup-python@v5 + - uses: actions/setup-python@v6 with: python-version: 3.12 - name: Install requirements @@ -45,11 +45,11 @@ jobs: with: ref: gh-pages - name: Setup Pages - uses: actions/configure-pages@v5 + uses: actions/configure-pages@v6 - name: Upload artifact - uses: actions/upload-pages-artifact@v3 + uses: actions/upload-pages-artifact@v4 with: path: '.' - name: Deploy to GitHub Pages id: deployment - uses: actions/deploy-pages@v4 + uses: actions/deploy-pages@v5 diff --git a/.github/workflows/markdownlint.yml b/.github/workflows/markdownlint.yml index 3a8a6c21..a1ac8e34 100644 --- a/.github/workflows/markdownlint.yml +++ b/.github/workflows/markdownlint.yml @@ -19,7 +19,7 @@ jobs: with: files: '**/*.md' separator: "," - - uses: DavidAnson/markdownlint-cli2-action@v22 + - uses: DavidAnson/markdownlint-cli2-action@v23 if: steps.changed-files.outputs.any_changed == 'true' with: globs: ${{ steps.changed-files.outputs.all_changed_files }} diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 9baf6f86..fe4f5a12 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -20,9 +20,9 @@ jobs: matrix: python-version: [ "3.12" ] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v6 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v5 + uses: actions/setup-python@v6 with: python-version: ${{ matrix.python-version }} - name: Install requirements @@ -60,9 +60,9 @@ jobs: # Maps tcp port 5432 on service container to the host - 5432:5432 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v6 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v5 + uses: actions/setup-python@v6 with: python-version: ${{ matrix.python-version }} - name: Install dependencies @@ -86,9 +86,9 @@ jobs: matrix: python-version: ["3.12"] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v6 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v5 + uses: actions/setup-python@v6 with: python-version: ${{ matrix.python-version }} - name: Install dependencies diff --git a/docs/openapi/openapi_boot.yaml b/docs/openapi/openapi_boot.yaml new file mode 100644 index 00000000..7d5977a3 --- /dev/null +++ b/docs/openapi/openapi_boot.yaml @@ -0,0 +1,1249 @@ +openapi: 3.0.3 +info: + title: Genesis Core v1 Boot API + version: 0.1.dev205+g5e9177075.d20260327 + description: OpenAPI - Genesis Core v1 +components: + responses: + Error: + description: Error response. + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + schemas: + Error: + title: error + description: Error occurred while processing request + type: object + required: + - status + - json + properties: + status: + type: integer + description: The HTTP status code + minimum: 400 + exclusiveMaximum: true + example: 503 + json: + type: object + description: Detail error map + required: + - code + - type + - message + properties: + code: + type: integer + description: The HTTP status code + minimum: 400 + exclusiveMaximum: true + example: 503 + type: + type: string + description: Error class name + example: OSError + message: + type: string + description: Error message + example: A human-readable explanation of problem + example: + code: 400 + json: + code: 400 + type: ValidationErrorException + message: Validation error occurred. + UniversalAgent_Get: + type: object + properties: + uuid: + type: string + format: uuid + name: + type: string + minLength: 0 + maxLength: 255 + description: + type: string + minLength: 0 + maxLength: 255 + default: '' + created_at: + type: string + x-ogen-time-format: '2006-01-02T15:04:05.000576Z' + format: date-time + default: '2006-01-02T15:04:05.000576Z' + updated_at: + type: string + x-ogen-time-format: '2006-01-02T15:04:05.000576Z' + format: date-time + default: '2006-01-02T15:04:05.000576Z' + capabilities: + type: object + additionalProperties: + oneOf: + - type: string + - type: integer + - type: boolean + - type: object + - type: array + items: {} + default: {} + facts: + type: object + additionalProperties: + oneOf: + - type: string + - type: integer + - type: boolean + - type: object + - type: array + items: {} + default: {} + node: + type: string + format: uuid + status: + type: string + enum: + - ACTIVE + - DISABLED + - ERROR + - NEW + default: NEW + required: + - uuid + - name + - created_at + - updated_at + - node + UniversalAgent_Create: + type: object + properties: + uuid: + type: string + format: uuid + name: + type: string + minLength: 0 + maxLength: 255 + description: + type: string + minLength: 0 + maxLength: 255 + default: '' + created_at: + type: string + x-ogen-time-format: '2006-01-02T15:04:05.000576Z' + format: date-time + default: '2006-01-02T15:04:05.000576Z' + updated_at: + type: string + x-ogen-time-format: '2006-01-02T15:04:05.000576Z' + format: date-time + default: '2006-01-02T15:04:05.000576Z' + capabilities: + type: object + additionalProperties: + oneOf: + - type: string + - type: integer + - type: boolean + - type: object + - type: array + items: {} + default: {} + facts: + type: object + additionalProperties: + oneOf: + - type: string + - type: integer + - type: boolean + - type: object + - type: array + items: {} + default: {} + node: + type: string + format: uuid + status: + type: string + enum: + - ACTIVE + - DISABLED + - ERROR + - NEW + default: NEW + required: + - uuid + - name + - created_at + - updated_at + - node + UniversalAgent_Update: + type: object + properties: + uuid: + type: string + format: uuid + name: + type: string + minLength: 0 + maxLength: 255 + description: + type: string + minLength: 0 + maxLength: 255 + default: '' + created_at: + type: string + x-ogen-time-format: '2006-01-02T15:04:05.000576Z' + format: date-time + default: '2006-01-02T15:04:05.000576Z' + updated_at: + type: string + x-ogen-time-format: '2006-01-02T15:04:05.000576Z' + format: date-time + default: '2006-01-02T15:04:05.000576Z' + capabilities: + type: object + additionalProperties: + oneOf: + - type: string + - type: integer + - type: boolean + - type: object + - type: array + items: {} + default: {} + facts: + type: object + additionalProperties: + oneOf: + - type: string + - type: integer + - type: boolean + - type: object + - type: array + items: {} + default: {} + node: + type: string + format: uuid + status: + type: string + enum: + - ACTIVE + - DISABLED + - ERROR + - NEW + default: NEW + required: + - uuid + - name + - created_at + - updated_at + - node + MachineNetboot_Get: + type: object + properties: + uuid: + type: string + format: uuid + created_at: + type: string + x-ogen-time-format: '2006-01-02T15:04:05.000576Z' + format: date-time + default: '2006-01-02T15:04:05.000576Z' + updated_at: + type: string + x-ogen-time-format: '2006-01-02T15:04:05.000576Z' + format: date-time + default: '2006-01-02T15:04:05.000576Z' + project_id: + type: string + format: uuid + name: + type: string + minLength: 0 + maxLength: 255 + default: '' + description: + type: string + minLength: 0 + maxLength: 255 + default: '' + cores: + type: integer + minimum: 0 + maximum: 4096 + ram: + type: integer + minimum: 0 + maximum: 9223372036854775807 + status: + type: string + enum: + - ACTIVE + - ERROR + - FLASHED + - IDLE + - IN_PROGRESS + - NEED_RESCHEDULE + - NEW + - SCHEDULED + - STARTED + default: NEW + machine_type: + type: string + enum: + - HW + - VM + default: VM + node: + type: string + format: uuid + nullable: true + pool: + type: string + format: uuid + nullable: true + boot: + type: string + enum: + - cdrom + - hd0 + - hd1 + - hd2 + - hd3 + - hd4 + - hd5 + - hd6 + - hd7 + - network + default: network + image: + type: string + minLength: 0 + maxLength: 255 + nullable: true + firmware_uuid: + type: string + format: uuid + nullable: true + block_devices: + type: object + additionalProperties: + oneOf: + - type: string + - type: integer + - type: boolean + - type: object + - type: array + items: {} + default: {} + required: + - created_at + - updated_at + - project_id + - cores + - ram + KindModel_Filter: + type: object + properties: + kind: + type: string + minLength: 0 + maxLength: 64 + required: + - kind + KindModel_Get: + type: object + properties: + kind: + type: string + minLength: 0 + maxLength: 64 + required: + - kind + Resource_Get: + type: object + properties: + created_at: + type: string + x-ogen-time-format: '2006-01-02T15:04:05.000576Z' + format: date-time + default: '2006-01-02T15:04:05.000576Z' + updated_at: + type: string + x-ogen-time-format: '2006-01-02T15:04:05.000576Z' + format: date-time + default: '2006-01-02T15:04:05.000576Z' + uuid: + type: string + format: uuid + kind: + type: string + value: + type: object + additionalProperties: + oneOf: + - type: string + - type: integer + - type: boolean + - type: object + - type: array + items: {} + hash: + type: string + minLength: 0 + maxLength: 256 + default: '' + full_hash: + type: string + minLength: 0 + maxLength: 256 + default: '' + status: + type: string + minLength: 0 + maxLength: 32 + default: ACTIVE + node: + type: string + format: uuid + nullable: true + res_uuid: + type: string + format: uuid + required: + - created_at + - updated_at + - kind + - res_uuid + Resource_Create: + type: object + properties: + created_at: + type: string + x-ogen-time-format: '2006-01-02T15:04:05.000576Z' + format: date-time + default: '2006-01-02T15:04:05.000576Z' + updated_at: + type: string + x-ogen-time-format: '2006-01-02T15:04:05.000576Z' + format: date-time + default: '2006-01-02T15:04:05.000576Z' + uuid: + type: string + format: uuid + kind: + type: string + value: + type: object + additionalProperties: + oneOf: + - type: string + - type: integer + - type: boolean + - type: object + - type: array + items: {} + hash: + type: string + minLength: 0 + maxLength: 256 + default: '' + full_hash: + type: string + minLength: 0 + maxLength: 256 + default: '' + status: + type: string + minLength: 0 + maxLength: 32 + default: ACTIVE + node: + type: string + format: uuid + nullable: true + res_uuid: + type: string + format: uuid + required: + - created_at + - updated_at + - kind + - res_uuid + Resource_Update: + type: object + properties: + created_at: + type: string + x-ogen-time-format: '2006-01-02T15:04:05.000576Z' + format: date-time + default: '2006-01-02T15:04:05.000576Z' + updated_at: + type: string + x-ogen-time-format: '2006-01-02T15:04:05.000576Z' + format: date-time + default: '2006-01-02T15:04:05.000576Z' + uuid: + type: string + format: uuid + kind: + type: string + value: + type: object + additionalProperties: + oneOf: + - type: string + - type: integer + - type: boolean + - type: object + - type: array + items: {} + hash: + type: string + minLength: 0 + maxLength: 256 + default: '' + full_hash: + type: string + minLength: 0 + maxLength: 256 + default: '' + status: + type: string + minLength: 0 + maxLength: 32 + default: ACTIVE + node: + type: string + format: uuid + nullable: true + res_uuid: + type: string + format: uuid + required: + - created_at + - updated_at + - kind + - res_uuid + NodeEncryptionKey_Get: + type: object + properties: + uuid: + type: string + format: uuid + created_at: + type: string + x-ogen-time-format: '2006-01-02T15:04:05.000576Z' + format: date-time + default: '2006-01-02T15:04:05.000576Z' + updated_at: + type: string + x-ogen-time-format: '2006-01-02T15:04:05.000576Z' + format: date-time + default: '2006-01-02T15:04:05.000576Z' + private_key: + type: string + minLength: 0 + maxLength: 44 + encryption_disabled_until: + type: string + x-ogen-time-format: '2006-01-02T15:04:05.000576Z' + format: date-time + default: '2006-01-02T15:04:05.000576Z' + required: + - created_at + - updated_at + - private_key + parameters: + UniversalAgentUuid: + name: UniversalAgentUuid + in: path + schema: + type: string + format: uuid + required: true + name: + name: name + in: query + schema: + type: string + minLength: 0 + maxLength: 255 + default: '' + description: + name: description + in: query + schema: + type: string + minLength: 0 + maxLength: 255 + default: '' + created_at: + name: created_at + in: query + schema: + type: string + x-ogen-time-format: '2006-01-02T15:04:05.000576Z' + format: date-time + default: '2006-01-02T15:04:05.000576Z' + updated_at: + name: updated_at + in: query + schema: + type: string + x-ogen-time-format: '2006-01-02T15:04:05.000576Z' + format: date-time + default: '2006-01-02T15:04:05.000576Z' + capabilities: + name: capabilities + in: query + schema: + type: object + additionalProperties: + oneOf: + - type: string + - type: integer + - type: boolean + - type: object + - type: array + items: {} + default: {} + facts: + name: facts + in: query + schema: + type: object + additionalProperties: + oneOf: + - type: string + - type: integer + - type: boolean + - type: object + - type: array + items: {} + default: {} + node: + name: node + in: query + schema: + type: string + format: uuid + nullable: true + status: + name: status + in: query + schema: + type: string + minLength: 0 + maxLength: 32 + default: ACTIVE + MachineNetbootUuid: + name: MachineNetbootUuid + in: path + schema: + type: string + format: uuid + required: true + project_id: + name: project_id + in: query + schema: + type: string + format: uuid + cores: + name: cores + in: query + schema: + type: integer + minimum: 0 + maximum: 4096 + ram: + name: ram + in: query + schema: + type: integer + minimum: 0 + maximum: 9223372036854775807 + machine_type: + name: machine_type + in: query + schema: + type: string + enum: + - HW + - VM + default: VM + pool: + name: pool + in: query + schema: + type: string + format: uuid + nullable: true + boot: + name: boot + in: query + schema: + type: string + enum: + - cdrom + - hd0 + - hd1 + - hd2 + - hd3 + - hd4 + - hd5 + - hd6 + - hd7 + - network + default: network + image: + name: image + in: query + schema: + type: string + minLength: 0 + maxLength: 255 + nullable: true + firmware_uuid: + name: firmware_uuid + in: query + schema: + type: string + format: uuid + nullable: true + block_devices: + name: block_devices + in: query + schema: + type: object + additionalProperties: + oneOf: + - type: string + - type: integer + - type: boolean + - type: object + - type: array + items: {} + default: {} + KindModelKind: + name: KindModelKind + in: path + schema: + type: string + minLength: 0 + maxLength: 64 + required: true + uuid: + name: uuid + in: query + schema: + type: string + format: uuid + kind: + name: kind + in: query + schema: + type: string + value: + name: value + in: query + schema: + type: object + additionalProperties: + oneOf: + - type: string + - type: integer + - type: boolean + - type: object + - type: array + items: {} + hash: + name: hash + in: query + schema: + type: string + minLength: 0 + maxLength: 256 + default: '' + full_hash: + name: full_hash + in: query + schema: + type: string + minLength: 0 + maxLength: 256 + default: '' + ResourceRes_uuid: + name: ResourceRes_uuid + in: path + schema: + type: string + format: uuid + required: true + NodeEncryptionKeyUuid: + name: NodeEncryptionKeyUuid + in: path + schema: + type: string + format: uuid + required: true + private_key: + name: private_key + in: query + schema: + type: string + minLength: 0 + maxLength: 44 + encryption_disabled_until: + name: encryption_disabled_until + in: query + schema: + type: string + x-ogen-time-format: '2006-01-02T15:04:05.000576Z' + format: date-time + default: '2006-01-02T15:04:05.000576Z' +paths: + /: + get: + summary: Base application url + responses: + '200': + description: Get nested urls + content: + application/json: + schema: + type: array + items: + type: string + default: + $ref: '#/components/responses/Error' + operationId: Get_urls + /specifications/: + get: + summary: Get OpenApiSpecificationRoute OpenApiSpecificationControllers + tags: [] + parameters: [] + responses: + '200': + description: Get nested urls + content: + application/json: + schema: + type: array + items: + type: string + default: + $ref: '#/components/responses/Error' + operationId: Filter_specifications + /specifications/3.0.3: + get: + summary: OpenApi specification + tags: [] + parameters: [] + responses: + '200': + description: OpenApi specification + content: + application/json: + schema: + type: object + properties: {} + default: + $ref: '#/components/responses/Error' + operationId: Get_OpenApi_specification + /v1/: + get: + summary: Returns a list of all routes in the main route that are collection + tags: [] + parameters: + - name: filters + description: "the filters to apply when filtering the routes (Is not\nimplemented + now)\n" + schema: + type: string + in: query + - name: order_by + description: "fields to order the routes by (Is not implemented\nnow)\n" + schema: + type: string + in: query + responses: + '200': + description: Get nested urls + content: + application/json: + schema: + type: array + items: + type: string + default: + $ref: '#/components/responses/Error' + operationId: Filter_v1 + /v1/agents/: + post: + summary: Create UniversalAgent + tags: + - UniversalAgent + parameters: [] + responses: + '201': + description: UniversalAgent_Create + content: + application/json: + schema: + $ref: '#/components/schemas/UniversalAgent_Create' + default: + $ref: '#/components/responses/Error' + operationId: Create_v1_agents + requestBody: + description: UniversalAgent_Create + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/UniversalAgent_Create' + /v1/agents/{UniversalAgentUuid}: + get: + summary: Get UniversalAgent + tags: + - UniversalAgent + parameters: + - name: UniversalAgentUuid + in: path + schema: + type: string + format: uuid + required: true + responses: + '200': + description: UniversalAgent_Get + content: + application/json: + schema: + $ref: '#/components/schemas/UniversalAgent_Get' + default: + $ref: '#/components/responses/Error' + operationId: Get_v1_agents_UniversalAgentUuid + put: + summary: Update UniversalAgent + tags: + - UniversalAgent + parameters: + - name: UniversalAgentUuid + in: path + schema: + type: string + format: uuid + required: true + responses: + '200': + description: UniversalAgent_Update + content: + application/json: + schema: + $ref: '#/components/schemas/UniversalAgent_Update' + default: + $ref: '#/components/responses/Error' + operationId: Update_v1_agents_UniversalAgentUuid + requestBody: + description: UniversalAgent_Update + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/UniversalAgent_Update' + delete: + summary: Delete UniversalAgent + tags: + - UniversalAgent + parameters: + - name: UniversalAgentUuid + in: path + schema: + type: string + format: uuid + required: true + responses: + '204': + description: UniversalAgent_Delete + default: + $ref: '#/components/responses/Error' + operationId: Delete_v1_agents_UniversalAgentUuid + /v1/agents/{UniversalAgentUuid}/actions/get_payload: + get: + summary: Get_payload UniversalAgent + tags: + - UniversalAgent + parameters: + - name: UniversalAgentUuid + in: path + schema: + type: string + format: uuid + required: true + responses: + '200': + description: Get nested urls + content: + application/json: + schema: {} + default: + $ref: '#/components/responses/Error' + operationId: Get_payload_v1_agents_UniversalAgentUuid_actions_get_payload + /v1/boots/{MachineNetbootUuid}: + get: + summary: Get MachineNetboot + tags: + - MachineNetboot + parameters: + - name: MachineNetbootUuid + in: path + schema: + type: string + format: uuid + required: true + responses: + '200': + description: MachineNetboot_Get + content: + application/json: + schema: + $ref: '#/components/schemas/MachineNetboot_Get' + default: + $ref: '#/components/responses/Error' + operationId: Get_v1_boots_MachineNetbootUuid + /v1/kind/: + get: + summary: Get KindModels + tags: + - KindModel + parameters: + - name: kind + in: query + schema: + type: string + responses: + '200': + description: KindModel_Filter + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/KindModel_Filter' + default: + $ref: '#/components/responses/Error' + operationId: Filter_v1_kind + /v1/kind/{KindModelKind}: + get: + summary: Get KindModel + tags: + - KindModel + parameters: + - name: KindModelKind + in: path + schema: + type: string + minLength: 0 + maxLength: 64 + required: true + responses: + '200': + description: KindModel_Get + content: + application/json: + schema: + $ref: '#/components/schemas/KindModel_Get' + default: + $ref: '#/components/responses/Error' + operationId: Get_v1_kind_KindModelKind + /v1/kind/{KindModelKind}/resources/: + post: + summary: Create Resource + tags: + - Resource + parameters: + - name: KindModelKind + in: path + schema: + type: string + minLength: 0 + maxLength: 64 + required: true + responses: + '201': + description: Resource_Create + content: + application/json: + schema: + $ref: '#/components/schemas/Resource_Create' + default: + $ref: '#/components/responses/Error' + operationId: Create_v1_kind_KindModelKind_resources + requestBody: + description: Resource_Create + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/Resource_Create' + /v1/kind/{KindModelKind}/resources/{ResourceRes_uuid}: + get: + summary: Get Resource + tags: + - Resource + parameters: + - name: KindModelKind + in: path + schema: + type: string + minLength: 0 + maxLength: 64 + required: true + - name: ResourceRes_uuid + in: path + schema: + type: string + format: uuid + required: true + responses: + '200': + description: Resource_Get + content: + application/json: + schema: + $ref: '#/components/schemas/Resource_Get' + default: + $ref: '#/components/responses/Error' + operationId: Get_v1_kind_KindModelKind_resources_ResourceRes_uuid + put: + summary: Update Resource + tags: + - Resource + parameters: + - name: KindModelKind + in: path + schema: + type: string + minLength: 0 + maxLength: 64 + required: true + - name: ResourceRes_uuid + in: path + schema: + type: string + format: uuid + required: true + responses: + '200': + description: Resource_Update + content: + application/json: + schema: + $ref: '#/components/schemas/Resource_Update' + default: + $ref: '#/components/responses/Error' + operationId: Update_v1_kind_KindModelKind_resources_ResourceRes_uuid + requestBody: + description: Resource_Update + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/Resource_Update' + delete: + summary: Delete Resource + tags: + - Resource + parameters: + - name: KindModelKind + in: path + schema: + type: string + minLength: 0 + maxLength: 64 + required: true + - name: ResourceRes_uuid + in: path + schema: + type: string + format: uuid + required: true + responses: + '204': + description: Resource_Delete + default: + $ref: '#/components/responses/Error' + operationId: Delete_v1_kind_KindModelKind_resources_ResourceRes_uuid + /v1/nodes/{NodeEncryptionKeyUuid}: + /v1/nodes/{NodeEncryptionKeyUuid}: + get: + summary: Get NodeEncryptionKey + tags: + - NodeEncryptionKey + parameters: + - name: NodeEncryptionKeyUuid + in: path + schema: + type: string + format: uuid + required: true + responses: + '200': + description: NodeEncryptionKey_Get + content: + application/json: + schema: + $ref: '#/components/schemas/NodeEncryptionKey_Get' + default: + $ref: '#/components/responses/Error' + operationId: Get_v1_nodes_NodeEncryptionKeyUuid + /v1/nodes/{NodeEncryptionKeyUuid}/actions/refresh_secret/invoke: + post: + summary: Refresh_secret NodeEncryptionKey + tags: + - NodeEncryptionKey + parameters: + - name: NodeEncryptionKeyUuid + in: path + schema: + type: string + format: uuid + required: true + responses: + '200': + description: Get nested urls + content: + application/json: + schema: {} + default: + $ref: '#/components/responses/Error' + operationId: Refresh_secret_v1_nodes_NodeEncryptionKeyUuid_actions_refresh_secret_invoke +servers: + - url: http://127.0.0.1:10000 + description: '' + variables: + version: + enum: + - v1 + default: v1 +tags: + - name: UniversalAgent + description: '' + - name: MachineNetboot + description: '' + - name: Resource + description: '' + - name: KindModel + description: '' + - name: NodeEncryptionKey + description: '' diff --git a/docs/openapi/openapi_orch.yaml b/docs/openapi/openapi_orch.yaml new file mode 100644 index 00000000..3fff2ba6 --- /dev/null +++ b/docs/openapi/openapi_orch.yaml @@ -0,0 +1,335 @@ +openapi: 3.0.3 +info: + title: Genesis Core v1 Orch API + version: 0.1.dev205+g5e9177075.d20260327 + description: OpenAPI - Genesis Core v1 +components: + responses: + Error: + description: Error response. + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + schemas: + Error: + title: error + description: Error occurred while processing request + type: object + required: + - status + - json + properties: + status: + type: integer + description: The HTTP status code + minimum: 400 + exclusiveMaximum: true + example: 503 + json: + type: object + description: Detail error map + required: + - code + - type + - message + properties: + code: + type: integer + description: The HTTP status code + minimum: 400 + exclusiveMaximum: true + example: 503 + type: + type: string + description: Error class name + example: OSError + message: + type: string + description: Error message + example: A human-readable explanation of problem + example: + code: 400 + json: + code: 400 + type: ValidationErrorException + message: Validation error occurred. + UniversalAgent_Get: + type: object + properties: + uuid: + type: string + format: uuid + name: + type: string + minLength: 0 + maxLength: 255 + description: + type: string + minLength: 0 + maxLength: 255 + default: '' + created_at: + type: string + x-ogen-time-format: '2006-01-02T15:04:05.000576Z' + format: date-time + default: '2006-01-02T15:04:05.000576Z' + updated_at: + type: string + x-ogen-time-format: '2006-01-02T15:04:05.000576Z' + format: date-time + default: '2006-01-02T15:04:05.000576Z' + capabilities: + type: object + additionalProperties: + oneOf: + - type: string + - type: integer + - type: boolean + - type: object + - type: array + items: {} + default: {} + facts: + type: object + additionalProperties: + oneOf: + - type: string + - type: integer + - type: boolean + - type: object + - type: array + items: {} + default: {} + node: + type: string + format: uuid + status: + type: string + enum: + - ACTIVE + - DISABLED + - ERROR + - NEW + default: NEW + required: + - uuid + - name + - created_at + - updated_at + - node + parameters: + UniversalAgentUuid: + name: UniversalAgentUuid + in: path + schema: + type: string + format: uuid + required: true + name: + name: name + in: query + schema: + type: string + minLength: 0 + maxLength: 255 + description: + name: description + in: query + schema: + type: string + minLength: 0 + maxLength: 255 + default: '' + created_at: + name: created_at + in: query + schema: + type: string + x-ogen-time-format: '2006-01-02T15:04:05.000576Z' + format: date-time + default: '2006-01-02T15:04:05.000576Z' + updated_at: + name: updated_at + in: query + schema: + type: string + x-ogen-time-format: '2006-01-02T15:04:05.000576Z' + format: date-time + default: '2006-01-02T15:04:05.000576Z' + capabilities: + name: capabilities + in: query + schema: + type: object + additionalProperties: + oneOf: + - type: string + - type: integer + - type: boolean + - type: object + - type: array + items: {} + default: {} + facts: + name: facts + in: query + schema: + type: object + additionalProperties: + oneOf: + - type: string + - type: integer + - type: boolean + - type: object + - type: array + items: {} + default: {} + node: + name: node + in: query + schema: + type: string + format: uuid + status: + name: status + in: query + schema: + type: string + enum: + - ACTIVE + - DISABLED + - ERROR + - NEW + default: NEW +paths: + /: + get: + summary: Base application url + responses: + '200': + description: Get nested urls + content: + application/json: + schema: + type: array + items: + type: string + default: + $ref: '#/components/responses/Error' + operationId: Get_urls + /specifications/: + get: + summary: Get OpenApiSpecificationRoute OpenApiSpecificationControllers + tags: [] + parameters: [] + responses: + '200': + description: Get nested urls + content: + application/json: + schema: + type: array + items: + type: string + default: + $ref: '#/components/responses/Error' + operationId: Filter_specifications + /specifications/3.0.3: + get: + summary: OpenApi specification + tags: [] + parameters: [] + responses: + '200': + description: OpenApi specification + content: + application/json: + schema: + type: object + properties: {} + default: + $ref: '#/components/responses/Error' + operationId: Get_OpenApi_specification + /v1/: + get: + summary: Returns a list of all routes in the main route that are collection + tags: [] + parameters: + - name: filters + description: "the filters to apply when filtering the routes (Is not\nimplemented + now)\n" + schema: + type: string + in: query + - name: order_by + description: "fields to order the routes by (Is not implemented\nnow)\n" + schema: + type: string + in: query + responses: + '200': + description: Get nested urls + content: + application/json: + schema: + type: array + items: + type: string + default: + $ref: '#/components/responses/Error' + operationId: Filter_v1 + /v1/agents/{UniversalAgentUuid}: + get: + summary: Get UniversalAgent + tags: + - UniversalAgent + parameters: + - name: UniversalAgentUuid + in: path + schema: + type: string + format: uuid + required: true + responses: + '200': + description: UniversalAgent_Get + content: + application/json: + schema: + $ref: '#/components/schemas/UniversalAgent_Get' + default: + $ref: '#/components/responses/Error' + operationId: Get_v1_agents_UniversalAgentUuid + /v1/agents/{UniversalAgentUuid}/actions/get_payload: + get: + summary: Get_payload UniversalAgent + tags: + - UniversalAgent + parameters: + - name: UniversalAgentUuid + in: path + schema: + type: string + format: uuid + required: true + responses: + '200': + description: Get nested urls + content: + application/json: + schema: {} + default: + $ref: '#/components/responses/Error' + operationId: Get_payload_v1_agents_UniversalAgentUuid_actions_get_payload +servers: + - url: http://127.0.0.1:10002 + description: '' + variables: + version: + enum: + - v1 + default: v1 +tags: + - name: UniversalAgent + description: '' diff --git a/docs/openapi/openapi_status.yaml b/docs/openapi/openapi_status.yaml new file mode 100644 index 00000000..8b152cfd --- /dev/null +++ b/docs/openapi/openapi_status.yaml @@ -0,0 +1,913 @@ +openapi: 3.0.3 +info: + title: Genesis Core v1 Status API + version: 0.1.dev205+g5e9177075.d20260327 + description: OpenAPI - Genesis Core v1 +components: + responses: + Error: + description: Error response. + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + schemas: + Error: + title: error + description: Error occurred while processing request + type: object + required: + - status + - json + properties: + status: + type: integer + description: The HTTP status code + minimum: 400 + exclusiveMaximum: true + example: 503 + json: + type: object + description: Detail error map + required: + - code + - type + - message + properties: + code: + type: integer + description: The HTTP status code + minimum: 400 + exclusiveMaximum: true + example: 503 + type: + type: string + description: Error class name + example: OSError + message: + type: string + description: Error message + example: A human-readable explanation of problem + example: + code: 400 + json: + code: 400 + type: ValidationErrorException + message: Validation error occurred. + UniversalAgent_Get: + type: object + properties: + uuid: + type: string + format: uuid + name: + type: string + minLength: 0 + maxLength: 255 + description: + type: string + minLength: 0 + maxLength: 255 + default: '' + created_at: + type: string + x-ogen-time-format: '2006-01-02T15:04:05.000576Z' + format: date-time + default: '2006-01-02T15:04:05.000576Z' + updated_at: + type: string + x-ogen-time-format: '2006-01-02T15:04:05.000576Z' + format: date-time + default: '2006-01-02T15:04:05.000576Z' + capabilities: + type: object + additionalProperties: + oneOf: + - type: string + - type: integer + - type: boolean + - type: object + - type: array + items: {} + default: {} + facts: + type: object + additionalProperties: + oneOf: + - type: string + - type: integer + - type: boolean + - type: object + - type: array + items: {} + default: {} + node: + type: string + format: uuid + status: + type: string + enum: + - ACTIVE + - DISABLED + - ERROR + - NEW + default: NEW + required: + - uuid + - name + - created_at + - updated_at + - node + UniversalAgent_Create: + type: object + properties: + uuid: + type: string + format: uuid + name: + type: string + minLength: 0 + maxLength: 255 + description: + type: string + minLength: 0 + maxLength: 255 + default: '' + created_at: + type: string + x-ogen-time-format: '2006-01-02T15:04:05.000576Z' + format: date-time + default: '2006-01-02T15:04:05.000576Z' + updated_at: + type: string + x-ogen-time-format: '2006-01-02T15:04:05.000576Z' + format: date-time + default: '2006-01-02T15:04:05.000576Z' + capabilities: + type: object + additionalProperties: + oneOf: + - type: string + - type: integer + - type: boolean + - type: object + - type: array + items: {} + default: {} + facts: + type: object + additionalProperties: + oneOf: + - type: string + - type: integer + - type: boolean + - type: object + - type: array + items: {} + default: {} + node: + type: string + format: uuid + status: + type: string + enum: + - ACTIVE + - DISABLED + - ERROR + - NEW + default: NEW + required: + - uuid + - name + - created_at + - updated_at + - node + UniversalAgent_Update: + type: object + properties: + uuid: + type: string + format: uuid + name: + type: string + minLength: 0 + maxLength: 255 + description: + type: string + minLength: 0 + maxLength: 255 + default: '' + created_at: + type: string + x-ogen-time-format: '2006-01-02T15:04:05.000576Z' + format: date-time + default: '2006-01-02T15:04:05.000576Z' + updated_at: + type: string + x-ogen-time-format: '2006-01-02T15:04:05.000576Z' + format: date-time + default: '2006-01-02T15:04:05.000576Z' + capabilities: + type: object + additionalProperties: + oneOf: + - type: string + - type: integer + - type: boolean + - type: object + - type: array + items: {} + default: {} + facts: + type: object + additionalProperties: + oneOf: + - type: string + - type: integer + - type: boolean + - type: object + - type: array + items: {} + default: {} + node: + type: string + format: uuid + status: + type: string + enum: + - ACTIVE + - DISABLED + - ERROR + - NEW + default: NEW + required: + - uuid + - name + - created_at + - updated_at + - node + KindModel_Filter: + type: object + properties: + kind: + type: string + minLength: 0 + maxLength: 64 + required: + - kind + KindModel_Get: + type: object + properties: + kind: + type: string + minLength: 0 + maxLength: 64 + required: + - kind + Resource_Get: + type: object + properties: + created_at: + type: string + x-ogen-time-format: '2006-01-02T15:04:05.000576Z' + format: date-time + default: '2006-01-02T15:04:05.000576Z' + updated_at: + type: string + x-ogen-time-format: '2006-01-02T15:04:05.000576Z' + format: date-time + default: '2006-01-02T15:04:05.000576Z' + uuid: + type: string + format: uuid + kind: + type: string + value: + type: object + additionalProperties: + oneOf: + - type: string + - type: integer + - type: boolean + - type: object + - type: array + items: {} + hash: + type: string + minLength: 0 + maxLength: 256 + default: '' + full_hash: + type: string + minLength: 0 + maxLength: 256 + default: '' + status: + type: string + minLength: 0 + maxLength: 32 + default: ACTIVE + node: + type: string + format: uuid + nullable: true + res_uuid: + type: string + format: uuid + required: + - created_at + - updated_at + - kind + - res_uuid + Resource_Create: + type: object + properties: + created_at: + type: string + x-ogen-time-format: '2006-01-02T15:04:05.000576Z' + format: date-time + default: '2006-01-02T15:04:05.000576Z' + updated_at: + type: string + x-ogen-time-format: '2006-01-02T15:04:05.000576Z' + format: date-time + default: '2006-01-02T15:04:05.000576Z' + uuid: + type: string + format: uuid + kind: + type: string + value: + type: object + additionalProperties: + oneOf: + - type: string + - type: integer + - type: boolean + - type: object + - type: array + items: {} + hash: + type: string + minLength: 0 + maxLength: 256 + default: '' + full_hash: + type: string + minLength: 0 + maxLength: 256 + default: '' + status: + type: string + minLength: 0 + maxLength: 32 + default: ACTIVE + node: + type: string + format: uuid + nullable: true + res_uuid: + type: string + format: uuid + required: + - created_at + - updated_at + - kind + - res_uuid + Resource_Update: + type: object + properties: + created_at: + type: string + x-ogen-time-format: '2006-01-02T15:04:05.000576Z' + format: date-time + default: '2006-01-02T15:04:05.000576Z' + updated_at: + type: string + x-ogen-time-format: '2006-01-02T15:04:05.000576Z' + format: date-time + default: '2006-01-02T15:04:05.000576Z' + uuid: + type: string + format: uuid + kind: + type: string + value: + type: object + additionalProperties: + oneOf: + - type: string + - type: integer + - type: boolean + - type: object + - type: array + items: {} + hash: + type: string + minLength: 0 + maxLength: 256 + default: '' + full_hash: + type: string + minLength: 0 + maxLength: 256 + default: '' + status: + type: string + minLength: 0 + maxLength: 32 + default: ACTIVE + node: + type: string + format: uuid + nullable: true + res_uuid: + type: string + format: uuid + required: + - created_at + - updated_at + - kind + - res_uuid + parameters: + UniversalAgentUuid: + name: UniversalAgentUuid + in: path + schema: + type: string + format: uuid + required: true + name: + name: name + in: query + schema: + type: string + minLength: 0 + maxLength: 255 + description: + name: description + in: query + schema: + type: string + minLength: 0 + maxLength: 255 + default: '' + created_at: + name: created_at + in: query + schema: + type: string + x-ogen-time-format: '2006-01-02T15:04:05.000576Z' + format: date-time + default: '2006-01-02T15:04:05.000576Z' + updated_at: + name: updated_at + in: query + schema: + type: string + x-ogen-time-format: '2006-01-02T15:04:05.000576Z' + format: date-time + default: '2006-01-02T15:04:05.000576Z' + capabilities: + name: capabilities + in: query + schema: + type: object + additionalProperties: + oneOf: + - type: string + - type: integer + - type: boolean + - type: object + - type: array + items: {} + default: {} + facts: + name: facts + in: query + schema: + type: object + additionalProperties: + oneOf: + - type: string + - type: integer + - type: boolean + - type: object + - type: array + items: {} + default: {} + node: + name: node + in: query + schema: + type: string + format: uuid + nullable: true + status: + name: status + in: query + schema: + type: string + minLength: 0 + maxLength: 32 + default: ACTIVE + KindModelKind: + name: KindModelKind + in: path + schema: + type: string + minLength: 0 + maxLength: 64 + required: true + uuid: + name: uuid + in: query + schema: + type: string + format: uuid + kind: + name: kind + in: query + schema: + type: string + value: + name: value + in: query + schema: + type: object + additionalProperties: + oneOf: + - type: string + - type: integer + - type: boolean + - type: object + - type: array + items: {} + hash: + name: hash + in: query + schema: + type: string + minLength: 0 + maxLength: 256 + default: '' + full_hash: + name: full_hash + in: query + schema: + type: string + minLength: 0 + maxLength: 256 + default: '' + ResourceRes_uuid: + name: ResourceRes_uuid + in: path + schema: + type: string + format: uuid + required: true +paths: + /: + get: + summary: Base application url + responses: + '200': + description: Get nested urls + content: + application/json: + schema: + type: array + items: + type: string + default: + $ref: '#/components/responses/Error' + operationId: Get_urls + /specifications/: + get: + summary: Get OpenApiSpecificationRoute OpenApiSpecificationControllers + tags: [] + parameters: [] + responses: + '200': + description: Get nested urls + content: + application/json: + schema: + type: array + items: + type: string + default: + $ref: '#/components/responses/Error' + operationId: Filter_specifications + /specifications/3.0.3: + get: + summary: OpenApi specification + tags: [] + parameters: [] + responses: + '200': + description: OpenApi specification + content: + application/json: + schema: + type: object + properties: {} + default: + $ref: '#/components/responses/Error' + operationId: Get_OpenApi_specification + /v1/: + get: + summary: Returns a list of all routes in the main route that are collection + tags: [] + parameters: + - name: filters + description: "the filters to apply when filtering the routes (Is not\nimplemented + now)\n" + schema: + type: string + in: query + - name: order_by + description: "fields to order the routes by (Is not implemented\nnow)\n" + schema: + type: string + in: query + responses: + '200': + description: Get nested urls + content: + application/json: + schema: + type: array + items: + type: string + default: + $ref: '#/components/responses/Error' + operationId: Filter_v1 + /v1/agents/: + post: + summary: Create UniversalAgent + tags: + - UniversalAgent + parameters: [] + responses: + '201': + description: UniversalAgent_Create + content: + application/json: + schema: + $ref: '#/components/schemas/UniversalAgent_Create' + default: + $ref: '#/components/responses/Error' + operationId: Create_v1_agents + requestBody: + description: UniversalAgent_Create + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/UniversalAgent_Create' + /v1/agents/{UniversalAgentUuid}: + get: + summary: Get UniversalAgent + tags: + - UniversalAgent + parameters: + - name: UniversalAgentUuid + in: path + schema: + type: string + format: uuid + required: true + responses: + '200': + description: UniversalAgent_Get + content: + application/json: + schema: + $ref: '#/components/schemas/UniversalAgent_Get' + default: + $ref: '#/components/responses/Error' + operationId: Get_v1_agents_UniversalAgentUuid + put: + summary: Update UniversalAgent + tags: + - UniversalAgent + parameters: + - name: UniversalAgentUuid + in: path + schema: + type: string + format: uuid + required: true + responses: + '200': + description: UniversalAgent_Update + content: + application/json: + schema: + $ref: '#/components/schemas/UniversalAgent_Update' + default: + $ref: '#/components/responses/Error' + operationId: Update_v1_agents_UniversalAgentUuid + requestBody: + description: UniversalAgent_Update + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/UniversalAgent_Update' + delete: + summary: Delete UniversalAgent + tags: + - UniversalAgent + parameters: + - name: UniversalAgentUuid + in: path + schema: + type: string + format: uuid + required: true + responses: + '204': + description: UniversalAgent_Delete + default: + $ref: '#/components/responses/Error' + operationId: Delete_v1_agents_UniversalAgentUuid + /v1/kind/: + get: + summary: Get KindModels + tags: + - KindModel + parameters: + - name: kind + in: query + schema: + type: string + responses: + '200': + description: KindModel_Filter + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/KindModel_Filter' + default: + $ref: '#/components/responses/Error' + operationId: Filter_v1_kind + /v1/kind/{KindModelKind}: + get: + summary: Get KindModel + tags: + - KindModel + parameters: + - name: KindModelKind + in: path + schema: + type: string + minLength: 0 + maxLength: 64 + required: true + responses: + '200': + description: KindModel_Get + content: + application/json: + schema: + $ref: '#/components/schemas/KindModel_Get' + default: + $ref: '#/components/responses/Error' + operationId: Get_v1_kind_KindModelKind + /v1/kind/{KindModelKind}/resources/: + post: + summary: Create Resource + tags: + - Resource + parameters: + - name: KindModelKind + in: path + schema: + type: string + minLength: 0 + maxLength: 64 + required: true + responses: + '201': + description: Resource_Create + content: + application/json: + schema: + $ref: '#/components/schemas/Resource_Create' + default: + $ref: '#/components/responses/Error' + operationId: Create_v1_kind_KindModelKind_resources + requestBody: + description: Resource_Create + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/Resource_Create' + /v1/kind/{KindModelKind}/resources/{ResourceRes_uuid}: + get: + summary: Get Resource + tags: + - Resource + parameters: + - name: KindModelKind + in: path + schema: + type: string + minLength: 0 + maxLength: 64 + required: true + - name: ResourceRes_uuid + in: path + schema: + type: string + format: uuid + required: true + responses: + '200': + description: Resource_Get + content: + application/json: + schema: + $ref: '#/components/schemas/Resource_Get' + default: + $ref: '#/components/responses/Error' + operationId: Get_v1_kind_KindModelKind_resources_ResourceRes_uuid + put: + summary: Update Resource + tags: + - Resource + parameters: + - name: KindModelKind + in: path + schema: + type: string + minLength: 0 + maxLength: 64 + required: true + - name: ResourceRes_uuid + in: path + schema: + type: string + format: uuid + required: true + responses: + '200': + description: Resource_Update + content: + application/json: + schema: + $ref: '#/components/schemas/Resource_Update' + default: + $ref: '#/components/responses/Error' + operationId: Update_v1_kind_KindModelKind_resources_ResourceRes_uuid + requestBody: + description: Resource_Update + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/Resource_Update' + delete: + summary: Delete Resource + tags: + - Resource + parameters: + - name: KindModelKind + in: path + schema: + type: string + minLength: 0 + maxLength: 64 + required: true + - name: ResourceRes_uuid + in: path + schema: + type: string + format: uuid + required: true + responses: + '204': + description: Resource_Delete + default: + $ref: '#/components/responses/Error' + operationId: Delete_v1_kind_KindModelKind_resources_ResourceRes_uuid +servers: + - url: http://127.0.0.1:10004 + description: '' + variables: + version: + enum: + - v1 + default: v1 +tags: + - name: UniversalAgent + description: '' + - name: Resource + description: '' + - name: KindModel + description: '' diff --git a/docs/openapi/openapi_user.yaml b/docs/openapi/openapi_user.yaml index d160c7c4..3752f432 100644 --- a/docs/openapi/openapi_user.yaml +++ b/docs/openapi/openapi_user.yaml @@ -1,7 +1,7 @@ openapi: 3.0.3 info: title: Genesis Core v1 User API - version: 0.1.dev192+gadafb9403.d20260318 + version: 0.1.dev204+g87300a3b9.d20260401 description: OpenAPI - Genesis Core v1 components: responses: @@ -3480,6 +3480,314 @@ components: - created_at - updated_at - version + Export_Get: + type: object + properties: + uuid: + type: string + format: uuid + created_at: + type: string + x-ogen-time-format: '2006-01-02T15:04:05.000576Z' + format: date-time + default: '2006-01-02T15:04:05.000576Z' + updated_at: + type: string + x-ogen-time-format: '2006-01-02T15:04:05.000576Z' + format: date-time + default: '2006-01-02T15:04:05.000576Z' + element: + type: string + name: + type: string + minLength: 1 + maxLength: 255 + kind: + type: string + enum: + - resource + default: resource + link: + type: string + minLength: 2 + maxLength: 255 + required: + - created_at + - updated_at + - element + - link + Export_Create: + type: object + properties: + uuid: + type: string + format: uuid + created_at: + type: string + x-ogen-time-format: '2006-01-02T15:04:05.000576Z' + format: date-time + default: '2006-01-02T15:04:05.000576Z' + updated_at: + type: string + x-ogen-time-format: '2006-01-02T15:04:05.000576Z' + format: date-time + default: '2006-01-02T15:04:05.000576Z' + element: + type: string + name: + type: string + minLength: 1 + maxLength: 255 + kind: + type: string + enum: + - resource + default: resource + link: + type: string + minLength: 2 + maxLength: 255 + required: + - created_at + - updated_at + - element + - link + Export_Update: + type: object + properties: + uuid: + type: string + format: uuid + created_at: + type: string + x-ogen-time-format: '2006-01-02T15:04:05.000576Z' + format: date-time + default: '2006-01-02T15:04:05.000576Z' + updated_at: + type: string + x-ogen-time-format: '2006-01-02T15:04:05.000576Z' + format: date-time + default: '2006-01-02T15:04:05.000576Z' + element: + type: string + name: + type: string + minLength: 1 + maxLength: 255 + kind: + type: string + enum: + - resource + default: resource + link: + type: string + minLength: 2 + maxLength: 255 + required: + - created_at + - updated_at + - element + - link + Export_Filter: + type: object + properties: + uuid: + type: string + format: uuid + created_at: + type: string + x-ogen-time-format: '2006-01-02T15:04:05.000576Z' + format: date-time + default: '2006-01-02T15:04:05.000576Z' + updated_at: + type: string + x-ogen-time-format: '2006-01-02T15:04:05.000576Z' + format: date-time + default: '2006-01-02T15:04:05.000576Z' + element: + type: string + name: + type: string + minLength: 1 + maxLength: 255 + kind: + type: string + enum: + - resource + default: resource + link: + type: string + minLength: 2 + maxLength: 255 + required: + - created_at + - updated_at + - element + - link + Import_Get: + type: object + properties: + uuid: + type: string + format: uuid + created_at: + type: string + x-ogen-time-format: '2006-01-02T15:04:05.000576Z' + format: date-time + default: '2006-01-02T15:04:05.000576Z' + updated_at: + type: string + x-ogen-time-format: '2006-01-02T15:04:05.000576Z' + format: date-time + default: '2006-01-02T15:04:05.000576Z' + element: + type: string + from_element: + type: string + from_resource: + type: string + name: + type: string + minLength: 1 + maxLength: 255 + kind: + type: string + enum: + - resource + default: resource + link: + type: string + minLength: 2 + maxLength: 256 + required: + - created_at + - updated_at + - element + - from_element + - from_resource + Import_Create: + type: object + properties: + uuid: + type: string + format: uuid + created_at: + type: string + x-ogen-time-format: '2006-01-02T15:04:05.000576Z' + format: date-time + default: '2006-01-02T15:04:05.000576Z' + updated_at: + type: string + x-ogen-time-format: '2006-01-02T15:04:05.000576Z' + format: date-time + default: '2006-01-02T15:04:05.000576Z' + element: + type: string + from_element: + type: string + from_resource: + type: string + name: + type: string + minLength: 1 + maxLength: 255 + kind: + type: string + enum: + - resource + default: resource + link: + type: string + minLength: 2 + maxLength: 256 + required: + - created_at + - updated_at + - element + - from_element + - from_resource + Import_Update: + type: object + properties: + uuid: + type: string + format: uuid + created_at: + type: string + x-ogen-time-format: '2006-01-02T15:04:05.000576Z' + format: date-time + default: '2006-01-02T15:04:05.000576Z' + updated_at: + type: string + x-ogen-time-format: '2006-01-02T15:04:05.000576Z' + format: date-time + default: '2006-01-02T15:04:05.000576Z' + element: + type: string + from_element: + type: string + from_resource: + type: string + name: + type: string + minLength: 1 + maxLength: 255 + kind: + type: string + enum: + - resource + default: resource + link: + type: string + minLength: 2 + maxLength: 256 + required: + - created_at + - updated_at + - element + - from_element + - from_resource + Import_Filter: + type: object + properties: + uuid: + type: string + format: uuid + created_at: + type: string + x-ogen-time-format: '2006-01-02T15:04:05.000576Z' + format: date-time + default: '2006-01-02T15:04:05.000576Z' + updated_at: + type: string + x-ogen-time-format: '2006-01-02T15:04:05.000576Z' + format: date-time + default: '2006-01-02T15:04:05.000576Z' + element: + type: string + from_element: + type: string + from_resource: + type: string + name: + type: string + minLength: 1 + maxLength: 255 + kind: + type: string + enum: + - resource + default: resource + link: + type: string + minLength: 2 + maxLength: 256 + required: + - created_at + - updated_at + - element + - from_element + - from_resource Resource_Get: type: object properties: @@ -13649,8 +13957,8 @@ components: type: string minLength: 2 maxLength: 256 - ResourceUuid: - name: ResourceUuid + ExportUuid: + name: ExportUuid in: path schema: type: string @@ -13661,6 +13969,37 @@ components: in: query schema: type: string + kind: + name: kind + in: query + schema: + type: string + minLength: 2 + maxLength: 256 + ImportUuid: + name: ImportUuid + in: path + schema: + type: string + format: uuid + required: true + from_element: + name: from_element + in: query + schema: + type: string + from_resource: + name: from_resource + in: query + schema: + type: string + ResourceUuid: + name: ResourceUuid + in: path + schema: + type: string + format: uuid + required: true resource_link_prefix: name: resource_link_prefix in: query @@ -13687,20 +14026,13 @@ components: type: string default: full_hash: - name: full_hash - in: query - schema: - type: string - minLength: 0 - maxLength: 256 - default: '' - kind: - name: kind + name: full_hash in: query schema: type: string - minLength: 2 + minLength: 0 maxLength: 256 + default: '' ManifestUuid: name: ManifestUuid in: path @@ -16527,6 +16859,280 @@ paths: default: $ref: '#/components/responses/Error' operationId: Delete_v1_em_elements_ElementUuid + /v1/em/elements/{ElementUuid}/exports/: + get: + summary: Get Exports + tags: + - Export + parameters: + - name: ElementUuid + in: path + schema: + type: string + format: uuid + required: true + responses: + '200': + description: Export_Filter + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/Export_Filter' + default: + $ref: '#/components/responses/Error' + operationId: Filter_v1_em_elements_ElementUuid_exports + post: + summary: Create Export + tags: + - Export + parameters: + - name: ElementUuid + in: path + schema: + type: string + format: uuid + required: true + responses: + '201': + description: Export_Create + content: + application/json: + schema: + $ref: '#/components/schemas/Export_Create' + default: + $ref: '#/components/responses/Error' + operationId: Create_v1_em_elements_ElementUuid_exports + requestBody: + description: Export_Create + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/Export_Create' + /v1/em/elements/{ElementUuid}/exports/{ExportUuid}: + get: + summary: Get Export + tags: + - Export + parameters: + - name: ElementUuid + in: path + schema: + type: string + format: uuid + required: true + - name: ExportUuid + in: path + schema: + type: string + format: uuid + required: true + responses: + '200': + description: Export_Get + content: + application/json: + schema: + $ref: '#/components/schemas/Export_Get' + default: + $ref: '#/components/responses/Error' + operationId: Get_v1_em_elements_ElementUuid_exports_ExportUuid + put: + summary: Update Export + tags: + - Export + parameters: + - name: ElementUuid + in: path + schema: + type: string + format: uuid + required: true + - name: ExportUuid + in: path + schema: + type: string + format: uuid + required: true + responses: + '200': + description: Export_Update + content: + application/json: + schema: + $ref: '#/components/schemas/Export_Update' + default: + $ref: '#/components/responses/Error' + operationId: Update_v1_em_elements_ElementUuid_exports_ExportUuid + requestBody: + description: Export_Update + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/Export_Update' + delete: + summary: Delete Export + tags: + - Export + parameters: + - name: ElementUuid + in: path + schema: + type: string + format: uuid + required: true + - name: ExportUuid + in: path + schema: + type: string + format: uuid + required: true + responses: + '204': + description: Export_Delete + default: + $ref: '#/components/responses/Error' + operationId: Delete_v1_em_elements_ElementUuid_exports_ExportUuid + /v1/em/elements/{ElementUuid}/imports/: + get: + summary: Get Imports + tags: + - Import + parameters: + - name: ElementUuid + in: path + schema: + type: string + format: uuid + required: true + responses: + '200': + description: Import_Filter + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/Import_Filter' + default: + $ref: '#/components/responses/Error' + operationId: Filter_v1_em_elements_ElementUuid_imports + post: + summary: Create Import + tags: + - Import + parameters: + - name: ElementUuid + in: path + schema: + type: string + format: uuid + required: true + responses: + '201': + description: Import_Create + content: + application/json: + schema: + $ref: '#/components/schemas/Import_Create' + default: + $ref: '#/components/responses/Error' + operationId: Create_v1_em_elements_ElementUuid_imports + requestBody: + description: Import_Create + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/Import_Create' + /v1/em/elements/{ElementUuid}/imports/{ImportUuid}: + get: + summary: Get Import + tags: + - Import + parameters: + - name: ElementUuid + in: path + schema: + type: string + format: uuid + required: true + - name: ImportUuid + in: path + schema: + type: string + format: uuid + required: true + responses: + '200': + description: Import_Get + content: + application/json: + schema: + $ref: '#/components/schemas/Import_Get' + default: + $ref: '#/components/responses/Error' + operationId: Get_v1_em_elements_ElementUuid_imports_ImportUuid + put: + summary: Update Import + tags: + - Import + parameters: + - name: ElementUuid + in: path + schema: + type: string + format: uuid + required: true + - name: ImportUuid + in: path + schema: + type: string + format: uuid + required: true + responses: + '200': + description: Import_Update + content: + application/json: + schema: + $ref: '#/components/schemas/Import_Update' + default: + $ref: '#/components/responses/Error' + operationId: Update_v1_em_elements_ElementUuid_imports_ImportUuid + requestBody: + description: Import_Update + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/Import_Update' + delete: + summary: Delete Import + tags: + - Import + parameters: + - name: ElementUuid + in: path + schema: + type: string + format: uuid + required: true + - name: ImportUuid + in: path + schema: + type: string + format: uuid + required: true + responses: + '204': + description: Import_Delete + default: + $ref: '#/components/responses/Error' + operationId: Delete_v1_em_elements_ElementUuid_imports_ImportUuid /v1/em/elements/{ElementUuid}/resources/: get: summary: Get Resources @@ -16809,6 +17415,32 @@ paths: application/json: schema: $ref: '#/components/schemas/Manifest_Create' + /v1/em/manifests/validate/: + post: + summary: Validate manifest + tags: [] + parameters: [] + responses: + '200': + description: '' + content: + application/json: + schema: + type: object + properties: {} + default: + $ref: '#/components/responses/Error' + operationId: Create_v1_em_manifests_validate + requestBody: + description: '' + required: true + content: + application/json: + schema: + type: object + properties: + manifest: + type: object /v1/em/manifests/{ManifestUuid}: get: summary: Get Manifest @@ -17923,6 +18555,33 @@ paths: default: $ref: '#/components/responses/Error' operationId: Filter_v1_iam_idp_IdpUuid_well_known + post: + summary: Create WellKnownRoute WellKnownController + tags: [] + parameters: + - name: IdpUuid + in: path + schema: + type: string + format: uuid + required: true + responses: + '201': + description: Unknown_Create + content: + application/json: + schema: + $ref: '#/components/schemas/Unknown_Create' + default: + $ref: '#/components/responses/Error' + operationId: Create_v1_iam_idp_IdpUuid_well_known + requestBody: + description: Unknown_Create + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/Unknown_Create' /v1/iam/idp/{IdpUuid}/actions/authorize/invoke: get: summary: Authorize Idp @@ -21518,6 +22177,10 @@ tags: description: '' - name: Domain description: '' + - name: Export + description: '' + - name: Import + description: '' - name: Resource description: '' - name: Element diff --git a/genesis/manifests/examples/core.element.yaml b/genesis/manifests/examples/core.element.yaml index 97bcfee5..b5d3efab 100644 --- a/genesis/manifests/examples/core.element.yaml +++ b/genesis/manifests/examples/core.element.yaml @@ -1,367 +1,166 @@ -Name: core -Description: Core element. -SchemaVersion: 1 -Version: "0.0.1" - -Requirements: [] - -Resources: - - $core.endpoints: - management: - kind: internal_client - #endpoint: http://localhost:11010/v1/ - - - $core.compute.nodes: - bootstrap: - name: bootstrap - root_disk_size: 20 - cores: 1 - ram: 1024 - iamge: http://192.168.100.31:8081/genesis-base.raw - - - $core.element.services: - migrations: - name: Genesis Core Migrations - description: Genesis Core Migrations service - target: - kind: node - node: $core.compute.nodes.$bootstrap:uuid - controller: - kind: systemd - service: - kind: oneshot - exec_start: ra-apply-migration --config-file /etc/genesis_core/genesis_core.conf --path /opt/genesis_core/migrations/ - - user_api: - name: Genesis Core User Api - description: Genesis Core User API service - target: - kind: node - node: $core.compute.nodes.$bootstrap:uuid - controller: - kind: systemd - service: - kind: daemon - exec_start: gc-user-api --config-file /etc/genesis_core/genesis_core.conf - depends_on: - - $core.element.services.$migrations:get_uri() - - orch_api: - name: Genesis Core Orch Api - description: Genesis Core Orch API service - target: - kind: node - node: $core.compute.nodes.$bootstrap:uuid - controller: - kind: systemd - service: - kind: daemon - exec_start: gc-orch-api --config-file /etc/genesis_core/genesis_core.conf - depends_on: - - $core.element.services.$migrations:get_uri() - - core_agent: - name: Genesis Core Agent - description: Genesis Core Agent - target: - kind: node - node: $core.compute.nodes.$bootstrap:uuid - controller: - kind: systemd - service: - kind: daemon - exec_start: gc-gservice --config-file /etc/genesis_core/genesis_core.conf - depends_on: - - $core.element.services.$migrations:get_uri() - - - $core.iam.users: - admin: - uuid: "00000000-0000-0000-0000-000000000000" - username: "admin" - description: "System administrator" - first_name: "Admin" - last_name: "User" - surname: "" - email: "admin@example.com" - - - $core.iam.organizations: - admin: - uuid: "00000000-0000-0000-0000-000000000000" - name: "admin" - description: "Admin Organization" - genesis_corporation: - uuid: "11111111-1111-1111-1111-111111111111" - name: "Genesis Corporation" - description": "The organization serves as the central platform for all services and elements developed by Genesis Corporation." - - - $core.iam.organization_members: - admin: - uuid: "210a146e-0ddd-4021-85cd-51760d9b0cbd" - organization: "$core.iam.organizations.$admin:get_uri()" - user: "$core.iam.users.$admin:get_uri()" - role: "OWNER" - - - $core.iam.projects: - admin: - uuid: "00000000-0000-0000-0000-000000000000" - name: "admin" - description: "Admin Project" - organization: $core.iam.organizations.$admin:get_uri() - iam_core: - uuid: "c938820c-ab9c-56e4-919c-acd0e881996f" - name: "iam-core" - description: "Identity and Access Management Core Project" - organization: $core.iam.organizations.$genesis_corporation:get_uri() - compute: - uuid: "46f57877-f477-5916-bcd1-718d34cf3414" - name: "compute-core" - description: "Comptue and Baremetal Core Project" - organization: "$core.iam.organizations.$genesis_corporation:get_uri()" - - - $core.iam.permissions: - admin: - uuid: "00000000-0000-0000-0000-000000000000" - name: "*.*.*" - description: "Allow All" - - iam_user_list: - uuid: "a8a7eea2-7514-53ac-a408-8b1235352310" - name: "iam.user.list" - description: "Allows listing users in the system" - iam_user_read_all: - uuid: "f64bbebd-c389-53b1-bed2-c725dc7dd1e8" - name: "iam.user.read_all" - description: "Allows reading all user profiles" - iam_user_write_all: - uuid: "880c3129-34ee-5fae-ab1f-6c8412333d49" - name: "iam.user.write_all" - description: "Allows modifying any user`s data" - iam_user_delete_all: - uuid: "e25b27ac-85c1-50c9-b0a9-696048649c28" - name: "iam.user.delete_all" - description: "Allows deleting any user account" - iam_user_delete: - uuid: "bccfb7f4-9775-535b-8967-1d42c5d213f9" - name: "iam.user.delete" - description: "Allows users to delete their own account" - - iam_organization_create: - uuid: "51330c56-c241-520f-8b83-234a0ab7ba1d" - name: "iam.organization.create" - description: "Allows creating new organizations" - iam_organization_read_all: - uuid: "c228157c-7923-59bf-8177-ab12c1e6f9c7" - name: "iam.organization.read_all" - description: "Allows viewing all organization details" - iam_organization_write_all: - uuid: "87c5691b-3f77-50eb-853b-abb0b4ff4a82" - name: "iam.organization.write_all" - description: "Allows modifying any organization`s data" - iam_organization_delete: - uuid: "eea5828b-f702-5286-80b5-8afcc75cee71" - name: "iam.organization.delete" - description: "Allows deleting own organization" - iam_organization_delete_all: - uuid: "28da4c50-4487-5514-8131-dd898a7e0abd" - name: "iam.organization.delete_all" - description: "Allows deleting any organization" - - iam_project_list_all: - uuid: "eb8f0274-61eb-52ed-b054-18cd08b4ec99" - name: "iam.project.list_all" - description: "Allows listing projects in the system" - iam_project_read_all: - uuid: "626d4b57-3cc7-56d6-bf30-7c2ada04d6b0" - name: "iam.project.read_all" - description: "Allows reading all project details" - iam_project_write_all: - uuid: "c6c21054-6d17-5d67-b981-0ce0ef20e4e2" - name: "iam.project.write_all" - description: "Allows modifying any project`s data" - iam_project_delete_all: - uuid: "654071ab-12af-52c0-8391-ebbb582a0423" - name: "iam.project.delete_all" - description: "Allows deleting any project" - - iam_permission_create: - uuid: "d9727cf5-6857-55dc-8030-d13693cc15df" - name: "iam.permission.create" - description: "Allows creating new permissions" - iam_permission_read: - uuid: "98938bd5-b26b-5733-931b-471504c27c1c" - name: "iam.permission.read" - description: "Allows reading permissions" - iam_permission_update: - uuid: "9c540d33-dfd1-565c-82b4-3099ff277c6c" - name: "iam.permission.update" - description: "Allows updating existing permissions" - iam_permission_delete: - uuid: "03ca3f7f-9ef9-5169-a147-85fa0ff6a28d" - name: "iam.permission.delete" - description: "Allows deleting permissions" - - iam_permission_binding_create: - uuid: "9c60333d-ab15-504c-af52-095a752237e2" - name: "iam.permission_binding.create" - description: "Allows creating permission bindings" - iam_permission_binding_read: - uuid: "e56faea9-9c58-5ab2-b508-6f467117c9f9" - name: "iam.permission_binding.read" - description: "Allows reading permission bindings" - iam_permission_binding_update: - uuid: "f4c9feb1-a5fc-5a92-b75b-eb47821514e2" - name: "iam.permission_binding.update" - description: "Allows updating permission bindings" - iam_permission_binding_delete: - uuid: "81a119f2-3d32-5ab9-908b-f9b63a9cc8e6" - name: "iam.permission_binding.delete" - description: "Allows deleting permission bindings" - - iam_role_create: - uuid: "5d3e126d-85be-5efb-9200-b7655db64fb4" - name: "iam.role.create" - description: "Allows creating new roles" - iam_role_read: - uuid: "4737a4f2-dd9e-584c-9cb2-3927364481db" - name: "iam.role.read" - description: "Allows reading roles" - iam_role_write: - uuid: "b9d6d6ee-8310-58a2-a25f-ca972a7e009f" - name: "iam.role.write" - description: "Allows updating existing roles" - iam_role_delete: - uuid: "131ccaac-c6e5-5dfe-8ec2-4eeca913c938" - name: "iam.role.delete" - description: "Allows deleting roles" - - iam_role_binding_create: - uuid: "4c6a94fc-e18f-5d0e-8ada-daaf5d470dd2" - name: "iam.role_binding.create" - description: "Allows creating role bindings" - iam_role_binding_read: - uuid: "ff96b360-0f40-5aa4-9396-5de7aba31cb1" - name: "iam.role_binding.read" - description: "Allows reading role bindings" - iam_role_binding_update: - uuid: "91f74ad1-1359-5b5e-b4ff-62a580caa746" - name: "iam.role_binding.update" - description: "Allows updating role bindings" - iam_role_binding_delete: - uuid: "d72c8adf-737b-5bbe-a026-61834dc309b6" - name: "iam.role_binding.delete" - description: "Allows deleting role bindings" - - iam_client_create: - uuid: "29eeff9b-d316-590d-916a-766238fd669d" - name: "iam.iam_client.create" - description: "Allows creating IAM clients" - iam_client_read_all: - uuid: "4435daf0-0d20-5a00-adc8-90fd9a298147" - name: "iam.iam_client.read_all" - description: "Allows reading all IAM clients" - iam_client_update: - uuid: "6d891b35-d0d9-5327-8b85-aa7a191b69c7" - name: "iam.iam_client.update" - description: "Allows updating IAM clients" - iam_client_delete: - uuid: "9da293c0-1ba8-548a-a490-287d0266b507" - name: "iam.iam_client.delete" - description: "Allows deleting IAM clients" - - compute_node_read: - uuid: "62dc01b3-f556-5ba3-bcd6-709c52d7418c" - name: "compute.node.read" - description: "List and read own nodes" - compute_node_create: - uuid: "086988df-a84b-5c42-8f3a-1fd3d0dd3878" - name: "compute.node.create" - description: "Create own nodes" - compute_node_update: - uuid: "44b6c954-867f-558b-9dba-b8c7baf9df38" - name: "compute.node.update" - description: "Update own nodes" - compute_node_delete: - uuid: "31eff665-2e96-5202-873a-a2f3c812a281" - name: "compute.node.delete" - description: "Delete own nodes" - - - $core.iam.roles: - admin: - uuid: "00000000-0000-0000-0000-000000000000" - name: "admin" - description: "Admin Role" - newcomer: - uuid: "726f6c65-0000-0000-0000-000000000001" - name: "newcomer" - description: "Default role for newly registered users. Provides basic system access and onboarding capabilities." - owner: - uuid: "726f6c65-0000-0000-0000-000000000002" - name: "owner" - description: "Project ownership role. Grants full administrative privileges within a specific project. Automatically assigned during project creation process." - - - $core.iam.permission_bindings: - admin: - uuid: "00000000-0000-0000-0000-000000000000" - role: "$core.iam.roles.$admin:get_uri()" - permission: "$core.iam.permissions.$admin:get_uri()" - newcomer_iam_user_delete: - uuid: "82870529-2614-49ef-b583-7f2100d13c50" - project_id: "$core.iam.projects.$iam_core:uuid" - role: "$core.iam.roles.$newcomer:get_uri()" - permission: "$core.iam.permissions.$iam_user_delete:get_uri()" - newcomer_iam_organization_create: - uuid: "1f7d5e14-6f66-4bfe-a825-c669c8409021" - project_id: "$core.iam.projects.$iam_core:uuid" - role: "$core.iam.roles.$newcomer:get_uri()" - permission: "$core.iam.permissions.$iam_organization_create:get_uri()" - newcomer_iam_organization_delete: - uuid: "4e68d259-9c70-48b9-be23-55961b332338" - project_id: "$core.iam.projects.$iam_core:uuid" - role: "$core.iam.roles.$newcomer:get_uri()" - permission: "$core.iam.permissions.$iam_organization_delete:get_uri()" - owner_compute_node_read: - uuid: "82f1a5a6-f03b-4503-8aa8-dd59fed64097" - project_id: "$core.iam.projects.$compute:uuid" - role: "$core.iam.roles.$owner:get_uri()" - permission: "$core.iam.permissions.$compute_node_read:get_uri()" - owner_compute_node_create: - uuid: "b916340d-db13-4cd3-90ea-a410bcb99270" - project_id: "$core.iam.projects.$compute:uuid" - role: "$core.iam.roles.$owner:get_uri()" - permission: "$core.iam.permissions.$compute_node_create:get_uri()" - owner_compute_node_update: - uuid: "5fa0e254-f7ff-4652-8d4a-70b6e54fcabf" - project_id: "$core.iam.projects.$compute:uuid" - role: "$core.iam.roles.$owner:get_uri()" - permission: "$core.iam.permissions.$compute_node_update:get_uri()" - owner_compute_node_delete: - uuid: "a500cddf-0431-4766-ad01-f09d0ee39d57" - project_id: "$core.iam.projects.$compute:uuid" - role: "$core.iam.roles.$owner:get_uri()" - permission: "$core.iam.permissions.$compute_node_delete:get_uri()" - - - $core.iam.role_bindings: - admin: - uuid: "00000000-0000-0000-0000-000000000000" - user: "$core.iam.users.$admin:get_uri()" - role: "$core.iam.roles.$admin:get_uri()" - - - $core.iam.clients: - genesis_core: - uuid: "00000000-0000-0000-0000-000000000000" - name: "GenesisCoreClient" - description: "Genesis Core OIDC Client" - client_id: "GenesisCoreClientId" - redirect_url: "http://127.0.0.1:11010/v1/" +name: "core" +description: "Genesis Core element" +schema_version: 1 +version: "0.0.1" +api_version: "v1" + +resources: + $core.vs.profiles: + develop: + name: "develop" + profile_type: "GLOBAL" + project_id: "12345678-c625-4fee-81d5-f691897b8142" + description: "The develop profile" + small: + name: "small" + profile_type: "GLOBAL" + project_id: "12345678-c625-4fee-81d5-f691897b8142" + description: "The small profile" + medium: + name: "medium" + profile_type: "GLOBAL" + project_id: "12345678-c625-4fee-81d5-f691897b8142" + description: "The medium profile" + large: + name: "large" + profile_type: "GLOBAL" + project_id: "12345678-c625-4fee-81d5-f691897b8142" + description: "The large profile" + legacy: + name: "legacy" + profile_type: "GLOBAL" + project_id: "12345678-c625-4fee-81d5-f691897b8142" + description: "The legacy profile" + + $core.vs.variables: + default_replicas: + name: "default_replicas" + project_id: "12345678-c625-4fee-81d5-f691897b8142" + setter: + kind: profile + fallback_strategy: ignore + profiles: + - profile: $core.vs.profiles.$develop:uuid + value: 1 + - profile: $core.vs.profiles.$small:uuid + value: 1 + - profile: $core.vs.profiles.$medium:uuid + value: 2 + - profile: $core.vs.profiles.$large:uuid + value: 3 + - profile: $core.vs.profiles.$legacy:uuid + value: 1 + default_cores: + name: "default_cores" + project_id: "12345678-c625-4fee-81d5-f691897b8142" + setter: + kind: profile + fallback_strategy: ignore + profiles: + - profile: $core.vs.profiles.$develop:uuid + value: 1 + - profile: $core.vs.profiles.$small:uuid + value: 2 + - profile: $core.vs.profiles.$medium:uuid + value: 4 + - profile: $core.vs.profiles.$large:uuid + value: 8 + - profile: $core.vs.profiles.$legacy:uuid + value: 2 + default_ram: + name: "default_ram" + project_id: "12345678-c625-4fee-81d5-f691897b8142" + setter: + kind: profile + fallback_strategy: ignore + profiles: + - profile: $core.vs.profiles.$develop:uuid + value: 1024 + - profile: $core.vs.profiles.$small:uuid + value: 2048 + - profile: $core.vs.profiles.$medium:uuid + value: 8192 + - profile: $core.vs.profiles.$large:uuid + value: 16384 + - profile: $core.vs.profiles.$legacy:uuid + value: 4096 + + # The variable is set at the bootstrap process and keep IP address of + # the core node. We cannot use the core set since it has a list of IPs. + # TODO(akremenetsky): Switch to the list when the core support HA. + core_ip_address: + uuid: "55814431-ede5-4c4e-abd6-e61600a3069b" + name: "core_ip_address" + project_id: "12345678-c625-4fee-81d5-f691897b8142" + setter: + kind: selector + selector_strategy: latest + + $core.compute.sets: + core_set: + name: core-set + project_id: "12345678-c625-4fee-81d5-f691897b8142" + uuid: "70c88222-b4d9-46c3-9340-aa5bfaaa4b94" + cores: $core.vs.variables.$default_cores:value + ram: $core.vs.variables.$default_ram:value + replicas: $core.vs.variables.$default_replicas:value + disk_spec: + kind: "disks" + disks: + - size: 10 + image: "https://repository.genesis-core.tech/genesis_core/0.0.1/genesis_core.raw.gz" + - size: 10 + label: data + + $core.dns.domains: + local_domain: + uuid: "afd4b306-8960-4a77-8e7d-42d46db8a7cf" + name: "local.genesis-core.tech" + project_id: "12345678-c625-4fee-81d5-f691897b8142" + + $core.dns.domains.$local_domain.records: + local_soa_record: + uuid: "affb6c9d-7e89-5482-a2cb-f52347d60116" + domain: "$core.dns.domains.$local_domain:uuid" + project_id: "12345678-c625-4fee-81d5-f691897b8142" + type: "SOA" + record: + kind: "SOA" + name: "@" + ttl: 3600 + retry: 3600 + expire: 604800 + serial: 0 + refresh: 10800 + primary_dns: "a.misconfigured.dns.server.invalid" + local_core_record: + uuid: "6de6aa08-f229-4b81-bf4a-9207ebe2dac4" + domain: "$core.dns.domains.$local_domain:uuid" + project_id: "12345678-c625-4fee-81d5-f691897b8142" + type: "A" + record: + kind: "A" + name: "core" + address: $core.vs.variables.$core_ip_address:value + +exports: + local_domain: + link: "$core.dns.domains.$local_domain" + var_core_ip_address: + link: "$core.vs.variables.$core_ip_address" + var_default_cores: + link: "$core.vs.variables.$default_cores" + var_default_ram: + link: "$core.vs.variables.$default_ram" + var_default_replicas: + link: "$core.vs.variables.$default_replicas" + profile_develop: + link: "$core.vs.profiles.$develop" + profile_small: + link: "$core.vs.profiles.$small" + profile_medium: + link: "$core.vs.profiles.$medium" + profile_large: + link: "$core.vs.profiles.$large" + profile_legacy: + link: "$core.vs.profiles.$legacy" diff --git a/genesis/manifests/specification/base_spec.yaml b/genesis/manifests/specification/base_spec.yaml new file mode 100644 index 00000000..a0a80c4f --- /dev/null +++ b/genesis/manifests/specification/base_spec.yaml @@ -0,0 +1,37 @@ +type: object +required: + - name + - description + - schema_version + - version + - api_version + - resources +properties: + name: + type: string + maxLength: 255 + description: + type: string + schema_version: + type: integer + enum: + - 1 + version: + type: string + minLength: 5 + maxLength: 64 + api_version: + type: string + enum: + - v1 + requirements: + type: object + resources: + type: object + properties: {} + exports: + type: object + imports: + type: object +components: + schemas: {} diff --git a/genesis/manifests/specification/full_spec.yaml b/genesis/manifests/specification/full_spec.yaml new file mode 100644 index 00000000..d16bbd80 --- /dev/null +++ b/genesis/manifests/specification/full_spec.yaml @@ -0,0 +1,2415 @@ +components: + schemas: + Certificate_Create: + properties: + cert: + maxLength: 10240 + minLength: 1 + nullable: true + type: string + constructor: + default: + kind: plain + oneOf: + - properties: + kind: + enum: + - plain + type: string + type: object + type: object + created_at: + default: '2006-01-02T15:04:05.000576Z' + format: date-time + type: string + x-ogen-time-format: '2006-01-02T15:04:05.000576Z' + description: + default: '' + maxLength: 255 + minLength: 0 + type: string + domains: + items: + pattern: ^(\*\.){0,1}([a-zA-Z0-9-_]{1,61}\.{0,1}){0,30}$ + type: string + type: array + email: + maxLength: 254 + minLength: 5 + type: string + expiration_at: + format: date-time + nullable: true + type: string + x-ogen-time-format: '2006-01-02T15:04:05.000576Z' + expiration_threshold: + default: 14 + maximum: 9223372036854775807 + minimum: 0 + type: integer + key: + maxLength: 10240 + minLength: 1 + nullable: true + type: string + method: + default: + kind: dns_core + oneOf: + - properties: + kind: + enum: + - dns_core + type: string + type: object + type: object + name: + default: '' + maxLength: 255 + minLength: 0 + type: string + overcome_threshold: + type: boolean + project_id: + format: uuid + type: string + status: + default: NEW + enum: + - ACTIVE + - ERROR + - IN_PROGRESS + - NEW + type: string + updated_at: + default: '2006-01-02T15:04:05.000576Z' + format: date-time + type: string + x-ogen-time-format: '2006-01-02T15:04:05.000576Z' + uuid: + format: uuid + type: string + required: + - project_id + - constructor + - method + - domains + type: object + Config_Create: + properties: + body: + oneOf: + - properties: + content: + default: '' + maxLength: 9223372036854775807 + minLength: 0 + type: string + kind: + enum: + - text + type: string + type: object + - properties: + kind: + enum: + - template + type: string + template: + default: '' + maxLength: 9223372036854775807 + minLength: 0 + type: string + variables: + additionalProperties: + oneOf: + - type: string + - type: integer + - type: boolean + - type: object + - items: {} + type: array + default: {} + type: object + type: object + type: object + created_at: + default: '2006-01-02T15:04:05.000576Z' + format: date-time + type: string + x-ogen-time-format: '2006-01-02T15:04:05.000576Z' + description: + default: '' + maxLength: 255 + minLength: 0 + type: string + group: + default: root + maxLength: 128 + minLength: 0 + type: string + mode: + default: '0644' + pattern: ^0[0-7][0-7][0-7]$ + type: string + name: + default: '' + maxLength: 255 + minLength: 0 + type: string + on_change: + default: + kind: no_action + oneOf: + - properties: + kind: + enum: + - no_action + type: string + type: object + - properties: + command: + default: '' + maxLength: 262144 + minLength: 0 + type: string + kind: + enum: + - shell + type: string + type: object + type: object + owner: + default: root + maxLength: 128 + minLength: 0 + type: string + path: + maxLength: 255 + minLength: 1 + type: string + project_id: + format: uuid + type: string + status: + default: NEW + enum: + - ACTIVE + - ERROR + - IN_PROGRESS + - NEW + type: string + target: + oneOf: + - properties: + kind: + enum: + - node + type: string + node: + format: uuid + type: string + type: object + - properties: + kind: + enum: + - node_set + type: string + node_set: + format: uuid + type: string + type: object + type: object + updated_at: + default: '2006-01-02T15:04:05.000576Z' + format: date-time + type: string + x-ogen-time-format: '2006-01-02T15:04:05.000576Z' + uuid: + format: uuid + type: string + required: + - project_id + - path + - target + - body + type: object + Domain_Create: + properties: + created_at: + default: '2006-01-02T15:04:05.000576Z' + format: date-time + type: string + x-ogen-time-format: '2006-01-02T15:04:05.000576Z' + id: + maximum: 9223372036854775807 + minimum: -9223372036854775807 + type: integer + name: + maxLength: 9223372036854775807 + minLength: 0 + type: string + project_id: + format: uuid + type: string + updated_at: + default: '2006-01-02T15:04:05.000576Z' + format: date-time + type: string + x-ogen-time-format: '2006-01-02T15:04:05.000576Z' + uuid: + format: uuid + type: string + required: + - project_id + - name + type: object + Element_Create: + properties: + api_version: + maxLength: 16 + minLength: 1 + nullable: true + type: string + created_at: + default: '2006-01-02T15:04:05.000576Z' + format: date-time + type: string + x-ogen-time-format: '2006-01-02T15:04:05.000576Z' + description: + default: '' + maxLength: 255 + minLength: 0 + type: string + install_type: + default: MANUAL + enum: + - AUTO_AS_DEPENDENCY + - MANUAL + type: string + link: + maxLength: 9223372036854775807 + minLength: 0 + type: string + name: + maxLength: 255 + minLength: 0 + type: string + profile: + type: string + status: + default: NEW + enum: + - ACTIVE + - IN_PROGRESS + - NEW + type: string + updated_at: + default: '2006-01-02T15:04:05.000576Z' + format: date-time + type: string + x-ogen-time-format: '2006-01-02T15:04:05.000576Z' + uuid: + format: uuid + type: string + version: + maxLength: 64 + minLength: 5 + type: string + required: + - name + - version + type: object + IamClient_Create: + properties: + client_id: + maxLength: 64 + minLength: 0 + type: string + created_at: + default: '2006-01-02T15:04:05.000576Z' + format: date-time + type: string + x-ogen-time-format: '2006-01-02T15:04:05.000576Z' + description: + default: '' + maxLength: 255 + minLength: 0 + type: string + name: + maxLength: 255 + minLength: 0 + type: string + project_id: + format: uuid + nullable: true + type: string + secret: + maxLength: 128 + minLength: 5 + type: string + signature_algorithm: + default: + kind: HS256 + previous_secret_uuid: null + secret_uuid: 00000000-0000-0000-0000-000000000001 + oneOf: + - properties: + kind: + enum: + - HS256 + type: string + previous_secret_uuid: + format: uuid + nullable: true + type: string + secret_uuid: + format: uuid + type: string + type: object + - properties: + kind: + enum: + - RS256 + type: string + previous_secret_uuid: + format: uuid + nullable: true + type: string + secret_uuid: + format: uuid + type: string + type: object + type: object + status: + default: ACTIVE + enum: + - ACTIVE + type: string + updated_at: + default: '2006-01-02T15:04:05.000576Z' + format: date-time + type: string + x-ogen-time-format: '2006-01-02T15:04:05.000576Z' + uuid: + format: uuid + type: string + required: + - name + - client_id + type: object + Idp_Create: + properties: + callback: + oneOf: + - properties: + callback: + maxLength: 256 + minLength: 0 + type: string + kind: + enum: + - callback_uri + type: string + type: object + - properties: + callbacks: + default: [] + items: + maxLength: 256 + minLength: 0 + type: string + type: array + kind: + enum: + - callback_uri_list + type: string + type: object + - properties: + kind: + enum: + - callback_regexp + type: string + pattern: + maxLength: 256 + minLength: 0 + type: string + type: object + type: object + created_at: + default: '2006-01-02T15:04:05.000576Z' + format: date-time + type: string + x-ogen-time-format: '2006-01-02T15:04:05.000576Z' + description: + default: '' + maxLength: 255 + minLength: 0 + type: string + iam_client: + type: string + name: + maxLength: 255 + minLength: 0 + type: string + nonce_required: + type: boolean + project_id: + format: uuid + nullable: true + type: string + scope: + default: openid + maxLength: 64 + minLength: 0 + type: string + status: + default: ACTIVE + enum: + - ACTIVE + type: string + updated_at: + default: '2006-01-02T15:04:05.000576Z' + format: date-time + type: string + x-ogen-time-format: '2006-01-02T15:04:05.000576Z' + uuid: + format: uuid + type: string + required: + - name + - iam_client + - callback + type: object + LB_Create: + properties: + created_at: + default: '2006-01-02T15:04:05.000576Z' + format: date-time + type: string + x-ogen-time-format: '2006-01-02T15:04:05.000576Z' + description: + default: '' + maxLength: 255 + minLength: 0 + type: string + ipsv4: + default: [] + items: + maxLength: 15 + minLength: 0 + type: string + type: array + name: + default: '' + maxLength: 255 + minLength: 0 + type: string + project_id: + format: uuid + type: string + status: + default: NEW + enum: + - ACTIVE + - ERROR + - IN_PROGRESS + - NEW + type: string + type: + default: + cpu: 1 + disk_size: 10 + kind: core + nodes_number: 1 + ram: 512 + oneOf: + - properties: + cpu: + default: 1 + maximum: 128 + minimum: 1 + type: integer + disk_size: + default: 10 + maximum: 1073741824 + minimum: 10 + type: integer + kind: + enum: + - core + type: string + nodes_number: + default: 1 + maximum: 16 + minimum: 1 + type: integer + ram: + default: 512 + maximum: 1073741824 + minimum: 512 + type: integer + type: object + - properties: + kind: + enum: + - core_agent + type: string + type: object + type: object + updated_at: + default: '2006-01-02T15:04:05.000576Z' + format: date-time + type: string + x-ogen-time-format: '2006-01-02T15:04:05.000576Z' + uuid: + format: uuid + type: string + required: + - project_id + - type + type: object + MachinePool_Create: + properties: + agent: + format: uuid + nullable: true + type: string + all_cores: + default: 0 + maximum: 9223372036854775807 + minimum: -9223372036854775807 + type: integer + all_ram: + default: 0 + maximum: 9223372036854775807 + minimum: -9223372036854775807 + type: integer + avail_cores: + default: 0 + maximum: 9223372036854775807 + minimum: -9223372036854775807 + type: integer + avail_ram: + default: 0 + maximum: 9223372036854775807 + minimum: -9223372036854775807 + type: integer + builder: + format: uuid + nullable: true + type: string + cores_ratio: + default: 1.0 + format: float + maximum: 1.7976931348623157e+308 + minimum: 0.0 + type: number + created_at: + default: '2006-01-02T15:04:05.000576Z' + format: date-time + type: string + x-ogen-time-format: '2006-01-02T15:04:05.000576Z' + description: + default: '' + maxLength: 255 + minLength: 0 + type: string + driver_spec: + additionalProperties: + oneOf: + - type: string + - type: integer + - type: boolean + - type: object + - items: {} + type: array + default: {} + type: object + machine_type: + default: VM + enum: + - HW + - VM + type: string + name: + default: '' + maxLength: 255 + minLength: 0 + type: string + ram_ratio: + default: 1.0 + format: float + maximum: 1.7976931348623157e+308 + minimum: 0.0 + type: number + status: + default: DISABLED + enum: + - ACTIVE + - DISABLED + - IN_PROGRESS + - MAINTENANCE + type: string + storage_pools: + default: [] + items: + oneOf: + - properties: + available_actual: + default: 0 + maximum: 9223372036854775807 + minimum: 0 + type: integer + capacity_provisioned: + default: 0 + maximum: 9223372036854775807 + minimum: 0 + type: integer + capacity_usable: + default: 0 + maximum: 9223372036854775807 + minimum: 0 + type: integer + description: + default: '' + maxLength: 255 + minLength: 0 + type: string + kind: + enum: + - thin_storage_pool + type: string + name: + default: '' + maxLength: 255 + minLength: 0 + type: string + oversubscription_ratio: + default: 1.0 + format: float + maximum: 1.7976931348623157e+308 + minimum: 0.0 + type: number + pool_type: + maxLength: 9223372036854775807 + minLength: 0 + type: string + uuid: + format: uuid + type: string + type: object + type: object + type: array + updated_at: + default: '2006-01-02T15:04:05.000576Z' + format: date-time + type: string + x-ogen-time-format: '2006-01-02T15:04:05.000576Z' + uuid: + format: uuid + type: string + type: object + Manifest_Create: + properties: + api_version: + maxLength: 16 + minLength: 1 + nullable: true + type: string + created_at: + default: '2006-01-02T15:04:05.000576Z' + format: date-time + type: string + x-ogen-time-format: '2006-01-02T15:04:05.000576Z' + description: + default: '' + maxLength: 255 + minLength: 0 + type: string + exports: + additionalProperties: + oneOf: + - type: string + - type: integer + - type: boolean + - type: object + - items: {} + type: array + default: {} + type: object + imports: + additionalProperties: + oneOf: + - type: string + - type: integer + - type: boolean + - type: object + - items: {} + type: array + default: {} + type: object + name: + maxLength: 255 + minLength: 0 + type: string + project_id: + format: uuid + type: string + requirements: + additionalProperties: + oneOf: + - type: string + - type: integer + - type: boolean + - type: object + - items: {} + type: array + default: {} + type: object + resources: + additionalProperties: + oneOf: + - type: string + - type: integer + - type: boolean + - type: object + - items: {} + type: array + default: {} + type: object + schema_version: + default: 1 + maximum: 1 + minimum: 1 + type: integer + status: + default: ACTIVE + enum: + - ACTIVE + - IN_PROGRESS + - NEW + type: string + updated_at: + default: '2006-01-02T15:04:05.000576Z' + format: date-time + type: string + x-ogen-time-format: '2006-01-02T15:04:05.000576Z' + uuid: + format: uuid + type: string + version: + maxLength: 64 + minLength: 5 + type: string + required: + - name + - version + type: object + NodeSet_Create: + properties: + cores: + maximum: 4096 + minimum: 0 + type: integer + created_at: + default: '2006-01-02T15:04:05.000576Z' + format: date-time + type: string + x-ogen-time-format: '2006-01-02T15:04:05.000576Z' + default_network: + additionalProperties: + oneOf: + - type: string + - type: integer + - type: boolean + - type: object + - items: {} + type: array + default: {} + type: object + description: + default: '' + maxLength: 255 + minLength: 0 + type: string + disk_spec: + oneOf: + - properties: + image: + maxLength: 255 + minLength: 0 + type: string + kind: + enum: + - root_disk + type: string + size: + default: 10 + maximum: 1000000 + minimum: 1 + type: integer + type: object + - properties: + disks: + default: [] + items: + properties: + fs: + maxLength: 256 + minLength: 0 + type: string + image: + maxLength: 256 + minLength: 0 + type: string + label: + maxLength: 128 + minLength: 0 + type: string + mount_point: + maxLength: 512 + minLength: 0 + type: string + size: + maximum: 1000000 + minimum: 1 + type: integer + type: object + type: array + kind: + enum: + - disks + type: string + type: object + type: object + name: + default: '' + maxLength: 255 + minLength: 0 + type: string + node_type: + default: VM + enum: + - HW + - VM + type: string + nodes: + additionalProperties: + oneOf: + - type: string + - type: integer + - type: boolean + - type: object + - items: {} + type: array + default: {} + type: object + project_id: + format: uuid + type: string + ram: + maximum: 9223372036854775807 + minimum: 0 + type: integer + replicas: + default: 1 + maximum: 4096 + minimum: 0 + type: integer + set_type: + default: SET + enum: + - SET + type: string + status: + default: NEW + enum: + - ACTIVE + - ERROR + - IN_PROGRESS + - NEW + - SCHEDULED + - STARTED + type: string + updated_at: + default: '2006-01-02T15:04:05.000576Z' + format: date-time + type: string + x-ogen-time-format: '2006-01-02T15:04:05.000576Z' + uuid: + format: uuid + type: string + required: + - project_id + - cores + - ram + - disk_spec + type: object + Node_Create: + properties: + cores: + maximum: 4096 + minimum: 1 + type: integer + created_at: + default: '2006-01-02T15:04:05.000576Z' + format: date-time + type: string + x-ogen-time-format: '2006-01-02T15:04:05.000576Z' + default_network: + additionalProperties: + oneOf: + - type: string + - type: integer + - type: boolean + - type: object + - items: {} + type: array + default: {} + type: object + description: + default: '' + maxLength: 255 + minLength: 0 + type: string + disk_spec: + oneOf: + - properties: + image: + maxLength: 255 + minLength: 0 + type: string + kind: + enum: + - root_disk + type: string + size: + default: 10 + maximum: 1000000 + minimum: 1 + type: integer + type: object + - properties: + disks: + default: [] + items: + properties: + fs: + maxLength: 256 + minLength: 0 + type: string + image: + maxLength: 256 + minLength: 0 + type: string + label: + maxLength: 128 + minLength: 0 + type: string + mount_point: + maxLength: 512 + minLength: 0 + type: string + size: + maximum: 1000000 + minimum: 1 + type: integer + type: object + type: array + kind: + enum: + - disks + type: string + type: object + type: object + hostname: + nullable: true + pattern: (?=^.{1,253}$)(^((?![-])[a-zA-Z0-9-]{1,63}(? None: _render_or_restore_template(src, dst, persisted, context) # Save persisted version os.makedirs(os.path.dirname(persisted), exist_ok=True) - with open(persisted, "w", encoding="utf-8") as fp, open( - dst, "r", encoding="utf-8" - ) as fd: + with ( + open(persisted, "w", encoding="utf-8") as fp, + open(dst, "r", encoding="utf-8") as fd, + ): fp.write(fd.read()) LOG.info("Saved persisted template %s", persisted) diff --git a/genesis_core/common/exceptions.py b/genesis_core/common/exceptions.py index c2fca230..8dcc6b53 100644 --- a/genesis_core/common/exceptions.py +++ b/genesis_core/common/exceptions.py @@ -32,3 +32,9 @@ class CommonForbiddenException(GCException): class CommonValueErrorException(GCException): __template__ = "The provided value is invalid." + + +class OpenApiValidateException(GCException): + __template__ = "OpenApiValidateException: {err}" + + err: str diff --git a/genesis_core/common/utils.py b/genesis_core/common/utils.py index 2cbe671c..8479a467 100644 --- a/genesis_core/common/utils.py +++ b/genesis_core/common/utils.py @@ -14,6 +14,7 @@ # License for the specific language governing permissions and limitations # under the License. +import os import typing as tp import uuid as sys_uuid from importlib.metadata import entry_points @@ -84,3 +85,11 @@ def remove_nested_dm(dm_class, parent_field_name, parent, session=None, **kwargs def get_or_create_uuid_from_dict(data: tp.Dict[str, tp.Any]) -> sys_uuid.UUID: return sys_uuid.UUID(data.get("uuid", str(sys_uuid.uuid4()))) + + +def get_project_path() -> str: + # Repository path + return os.sep.join(__file__.split(os.sep)[:-3]) + + +PROJECT_PATH = get_project_path() diff --git a/genesis_core/elements/dm/models.py b/genesis_core/elements/dm/models.py index a135f3f9..2d4258f2 100644 --- a/genesis_core/elements/dm/models.py +++ b/genesis_core/elements/dm/models.py @@ -41,6 +41,10 @@ from genesis_core.common.dm import targets as ct from genesis_core.common import utils as cm_utils from genesis_core.elements.dm import utils +from genesis_core.elements.dm.validate import ( + load_base_manifest_schema, + validate_manifest, +) from genesis_core.elements import constants as cc from genesis_core.vs.dm import models as vs_models @@ -119,6 +123,7 @@ class Manifest( models.ModelWithRequiredNameDesc, models.ModelWithTimestamp, orm.SQLStorableMixin, + models.DumpToSimpleViewMixin, ): __tablename__ = "em_manifests" @@ -173,9 +178,7 @@ class Manifest( ) def install(self): - if element := Element.objects.get_one_or_none( - filters={"name": ra_filters.EQ(self.name)} - ): + if Element.objects.get_one_or_none(filters={"name": ra_filters.EQ(self.name)}): raise ValueError(f"Element '{self.name}' already exists.") element_engine.load_from_database() @@ -359,6 +362,11 @@ def uninstall(self): element_engine.remove_element(element) return self + def validate(self): + element_engine.load_schema() + validate_manifest(self.dump_to_simple_view(), element_engine.schema) + return self + class Element( models.ModelWithUUID, @@ -857,6 +865,7 @@ class ImportEnum(str, enum.Enum): class Import( models.ModelWithUUID, models.ModelWithTimestamp, + models.CustomPropertiesMixin, orm.SQLStorableMixin, ): __tablename__ = "em_imports" @@ -1059,6 +1068,11 @@ def __init__(self): super().__init__() self._namespaces = {} self._resource_exports = {} + self.schema = {} + + def load_schema(self): + if not self.schema: + self.schema = load_base_manifest_schema() def load_element_from_manifest(self, manifest): schema_version = utils.get_required_field(manifest, "SchemaVersion") diff --git a/genesis_core/elements/dm/validate.py b/genesis_core/elements/dm/validate.py new file mode 100644 index 00000000..e40dc37a --- /dev/null +++ b/genesis_core/elements/dm/validate.py @@ -0,0 +1,78 @@ +# Copyright 2025 Genesis Corporation. +# +# All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +import logging +import os +import yaml +import typing as tp + +from jsonschema.exceptions import ValidationError +import openapi_schema_validator + +from genesis_core.common import exceptions +from genesis_core.common.utils import PROJECT_PATH + +LOG = logging.getLogger(__name__) + + +def load_base_manifest_schema() -> dict: + with open( + os.path.join( + PROJECT_PATH, "genesis", "manifests", "specification", "base_spec.yaml" + ), + "r", + ) as f: + return yaml.safe_load(f) + + +def load_full_manifest_schema() -> dict: + with open( + os.path.join( + PROJECT_PATH, "genesis", "manifests", "specification", "full_spec.yaml" + ), + "r", + ) as f: + return yaml.safe_load(f) + + +def dump_full_manifest_schema(data): + with open( + os.path.join( + PROJECT_PATH, "genesis", "manifests", "specification", "full_spec.yaml" + ), + "w", + ) as f: + yaml.safe_dump(data, f) + + +def load_user_api_spec() -> dict: + with open( + os.path.join(PROJECT_PATH, "docs", "openapi", "openapi_user.yaml"), + "r", + ) as f: + return yaml.safe_load(f) + + +def validate_manifest(data: dict, schema: tp.Optional[dict]) -> None: + if data and schema: + try: + openapi_schema_validator.validate( + data, schema, cls=openapi_schema_validator.OAS30Validator + ) + except ValidationError as err: + LOG.exception("Failed to validate data %s: %s", data, err) + raise exceptions.OpenApiValidateException(err=str(err)) + return None diff --git a/genesis_core/tests/functional/conftest.py b/genesis_core/tests/functional/conftest.py index 08a82a9c..5e1cdb7d 100644 --- a/genesis_core/tests/functional/conftest.py +++ b/genesis_core/tests/functional/conftest.py @@ -27,7 +27,7 @@ from gcl_sdk.infra.dm import models as sdk_infra_models from gcl_sdk.agents.universal.dm import models as sdk_ua_models from restalchemy.dm import filters as dm_filters -from restalchemy.tests.functional import consts + from restalchemy.storage.sql import engines from genesis_core.common import constants as c @@ -36,8 +36,14 @@ from genesis_core.compute import constants as nc from genesis_core.compute.dm import models as node_models from genesis_core.compute.node_set.dm import models as node_set_models +from genesis_core.elements.dm.validate import ( + load_base_manifest_schema, + load_full_manifest_schema, + load_user_api_spec, +) from genesis_core.user_api.api import app as user_app from genesis_core.user_api.iam import constants as iam_c +from genesis_core.tests.functional import consts from genesis_core.tests.functional import utils as test_utils from genesis_core.config.dm import models as conf_models from genesis_core.config import constants as cc @@ -915,3 +921,18 @@ def setup_db_for_worker(worker_id): engine.close_connection(conn) del engine engines.engine_factory.destroy_engine() + + +@pytest.fixture(scope="session") +def base_manifest_schema(): + return load_base_manifest_schema() + + +@pytest.fixture(scope="session") +def full_manifest_schema(): + return load_full_manifest_schema() + + +@pytest.fixture(scope="session") +def user_api_spec(): + return load_user_api_spec() diff --git a/genesis_core/tests/functional/consts.py b/genesis_core/tests/functional/consts.py new file mode 100644 index 00000000..c8baa07a --- /dev/null +++ b/genesis_core/tests/functional/consts.py @@ -0,0 +1,29 @@ +# vim: tabstop=4 shiftwidth=4 softtabstop=4 +# +# Copyright 2016 Eugene Frolov +# +# All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +import os + +_DATABASE_URI_DEFAULT = ( + "postgresql://genesis_core:genesis_core@127.0.0.1:5432/genesis_core" +) + +DATABASE_URI = os.getenv("DATABASE_URI", _DATABASE_URI_DEFAULT) + + +def get_database_uri(): + return os.getenv("DATABASE_URI", _DATABASE_URI_DEFAULT) diff --git a/genesis_core/tests/functional/manifests/__init__.py b/genesis_core/tests/functional/manifests/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/genesis_core/tests/functional/manifests/test_validate.py b/genesis_core/tests/functional/manifests/test_validate.py new file mode 100644 index 00000000..697d5fd3 --- /dev/null +++ b/genesis_core/tests/functional/manifests/test_validate.py @@ -0,0 +1,89 @@ +# Copyright 2025 Genesis Corporation. +# +# All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +import pytest +import requests +import yaml + +from genesis_core.elements.dm.validate import ( + validate_manifest, + dump_full_manifest_schema, +) + +REPO_URL = "https://repository.genesis-core.tech/genesis-elements" + + +class TestSpec: + @pytest.mark.parametrize( + "element", + [ + "communal_pg_cluster", + "core", + "dbaas", + "core-node-set-example", + "core-service-example", + "genesis_notification", + ], + ) + def test_validate_manifests( + self, element, base_manifest_schema, full_manifest_schema + ): + resp = requests.get(f"{REPO_URL}/{element}/latest/manifests/{element}.yaml") + if resp.status_code == 404: + pytest.skip(f"latest version for {element} is not available") + assert resp.status_code == 200 + manifest = yaml.safe_load(resp.text) + validate_manifest(manifest, base_manifest_schema) + validate_manifest(manifest, full_manifest_schema) + + @pytest.mark.skip(reason="for manual running") + def test_build_full_schema(self, base_manifest_schema, user_api_spec): + path_schema = [] + for path, path_obj in user_api_spec["paths"].items(): + path_parts = path.split("/") + if len(path_parts) > 5: + continue + post_path = path_obj.get("post") + if post_path: + operation_id = post_path.get("operationId") + if operation_id and operation_id.startswith("Create_v1"): + schema_ref = post_path["requestBody"]["content"][ + "application/json" + ]["schema"] + model_name = schema_ref["$ref"].split("/")[-1] + api_part_1 = path_parts[2] + api_part_2 = path_parts[3] + model = user_api_spec["components"]["schemas"][model_name] + resource = f"$core.{api_part_1}.{api_part_2}" + path_schema.append( + { + "path": path, + "schema": schema_ref, + "resource": resource, + "model_name": model_name, + "model": model, + } + ) + base_manifest_schema["components"]["schemas"][model_name] = model + base_manifest_schema["properties"]["resources"]["properties"][ + resource + ] = { + "type": "object", + "additionalProperties": schema_ref, + } + + assert path_schema + dump_full_manifest_schema(base_manifest_schema) diff --git a/genesis_core/tests/functional/restapi/em/__init__.py b/genesis_core/tests/functional/restapi/em/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/genesis_core/tests/functional/restapi/em/test_em.py b/genesis_core/tests/functional/restapi/em/test_em.py new file mode 100644 index 00000000..0aa2d60b --- /dev/null +++ b/genesis_core/tests/functional/restapi/em/test_em.py @@ -0,0 +1,112 @@ +# Copyright 2025 Genesis Corporation. +# +# All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +import os +import yaml + +from gcl_iam.tests.functional import clients as iam_clients + +from genesis_core.common.utils import PROJECT_PATH + + +class TestEmUserApi: + def test_manifests( + self, + user_api_client: iam_clients.GenesisCoreTestRESTClient, + auth_user_admin: iam_clients.GenesisCoreAuth, + ): + + client = user_api_client(auth_user_admin) + url = client.build_collection_uri(["em", "elements"]) + + response = client.get(url) + assert response.status_code == 200 + assert isinstance(response.json(), list) + assert len(response.json()) == 0 + + with open( + os.path.join( + PROJECT_PATH, "genesis", "manifests", "examples", "core.element.yaml" + ), + "r", + ) as f: + manifest = yaml.safe_load(f) + + url = client.build_collection_uri(["em", "manifests"]) + response = client.post(url, json=manifest) + assert response.status_code == 201 + + manifest_data = response.json() + manifest_uuid = manifest_data["uuid"] + + url = client.build_resource_uri( + ["em", "manifests", manifest_uuid, "actions", "validate"] + ) + response = client.get(url) + assert response.status_code == 200 + + url = client.build_resource_uri( + ["em", "manifests", manifest_uuid, "actions", "install", "invoke"] + ) + response = client.post(url) + assert response.status_code == 200 + + url = client.build_collection_uri(["em", "elements"]) + + response = client.get(url) + assert response.status_code == 200 + element_data = response.json() + assert len(element_data) == 1 + element_uuid = element_data[0]["uuid"] + + url = client.build_collection_uri(["em", "elements", element_uuid, "exports"]) + response = client.get(url) + assert response.status_code == 200 + + exports_data = response.json() + assert isinstance(exports_data, list) + assert len(element_data) > 0 + + url = client.build_collection_uri(["em", "elements", element_uuid, "imports"]) + response = client.get(url) + assert response.status_code == 200 + + imports_data = response.json() + assert isinstance(imports_data, list) + + url = client.build_resource_uri( + ["em", "manifests", manifest_uuid, "actions", "uninstall", "invoke"] + ) + response = client.post(url) + assert response.status_code == 200 + + url = client.build_collection_uri(["em", "elements"]) + + response = client.get(url) + assert response.status_code == 200 + element_data = response.json() + assert len(element_data) == 0 + + url = client.build_resource_uri(["em", "manifests", manifest_uuid]) + response = client.delete(url) + assert response.status_code == 204 + + url = client.build_collection_uri(["em", "manifests"]) + + response = client.get(url) + assert response.status_code == 200 + manifest_data = response.json() + assert len(manifest_data) == 0 diff --git a/genesis_core/tests/functional/restapi/iam/test_idp.py b/genesis_core/tests/functional/restapi/iam/test_idp.py index fadecfe6..9b2a5ce9 100644 --- a/genesis_core/tests/functional/restapi/iam/test_idp.py +++ b/genesis_core/tests/functional/restapi/iam/test_idp.py @@ -149,9 +149,7 @@ def test_create_idp_with_callback_regexp_success( assert response.status_code == 201 idp = response.json() assert idp["callback"]["kind"] == "callback_regexp" - assert idp["callback"]["pattern"] == ( - r"https://example\.test/callback(/.*)?" - ) + assert idp["callback"]["pattern"] == (r"https://example\.test/callback(/.*)?") def test_list_idp_no_permission_fails(self, user_api_client, auth_test1_user): client = user_api_client(auth_test1_user) diff --git a/genesis_core/tests/functional/utils.py b/genesis_core/tests/functional/utils.py index 3e969e21..3656b56f 100644 --- a/genesis_core/tests/functional/utils.py +++ b/genesis_core/tests/functional/utils.py @@ -46,7 +46,6 @@ def find_free_port(cls) -> int: s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) return s.getsockname()[1] - @classmethod def setup_class(cls): cls.init_engine() @@ -100,7 +99,7 @@ def apply_all_migrations(self) -> None: migration_path=str(pathlib.Path(sdk_migrations.__file__).parent), first_migration=sdk_migrations.INIT_MIGRATION_FILENAME, last_migration=None, - ) + ) self._migration = self.apply_migrations( migration_path=os.path.join( os.path.dirname(os.path.abspath(__file__)), diff --git a/genesis_core/user_api/em/api/controllers.py b/genesis_core/user_api/em/api/controllers.py index 0e1601d0..7182cd76 100644 --- a/genesis_core/user_api/em/api/controllers.py +++ b/genesis_core/user_api/em/api/controllers.py @@ -14,7 +14,6 @@ # License for the specific language governing permissions and limitations # under the License. - from gcl_iam.api import controllers as iam_controllers from restalchemy.dm import filters as dm_filters from restalchemy.api import actions @@ -60,6 +59,10 @@ def upgrade(self, resource): def uninstall(self, resource): return resource.uninstall() + @actions.get + def validate(self, resource): + return resource.validate() + class ElementController( iam_controllers.PolicyBasedWithoutProjectController, @@ -149,6 +152,36 @@ def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) +class ElementExportController( + controllers.BaseNestedResourceControllerPaginated, +): + __pr_name__ = "element" + __resource__ = resources.ResourceByRAModel( + model_class=models.Export, + process_filters=True, + convert_underscore=False, + ) + + def __init__(self, *args, **kwargs): + models.element_engine.load_from_database() + super().__init__(*args, **kwargs) + + +class ElementImportController( + controllers.BaseNestedResourceControllerPaginated, +): + __pr_name__ = "element" + __resource__ = resources.ResourceByModelWithCustomProps( + model_class=models.Import, + process_filters=True, + convert_underscore=False, + ) + + def __init__(self, *args, **kwargs): + models.element_engine.load_from_database() + super().__init__(*args, **kwargs) + + class ServicesController(iam_controllers.PolicyBasedController): """Controller for /v1/em/services/ endpoint""" diff --git a/genesis_core/user_api/em/api/routes.py b/genesis_core/user_api/em/api/routes.py index 8f4b299f..2a56e8bf 100644 --- a/genesis_core/user_api/em/api/routes.py +++ b/genesis_core/user_api/em/api/routes.py @@ -37,6 +37,12 @@ class ManifestUninstallActionRoute(routes.Action): __controller__ = controllers.ManifestController +class ManifestValidateActionRoute(routes.Action): + """Handler for /v1/em/manifests//actions/validate/invoke endpoint""" + + __controller__ = controllers.ManifestController + + class ManifestRoute(routes.Route): """Handler for /v1/em/manifests/ endpoint""" @@ -45,6 +51,7 @@ class ManifestRoute(routes.Route): install = routes.action(ManifestInstallActionRoute, invoke=True) upgrade = routes.action(ManifestUpgradeActionRoute, invoke=True) uninstall = routes.action(ManifestUninstallActionRoute, invoke=True) + validate = routes.action(ManifestValidateActionRoute, invoke=False) class ElementResourceRoute(routes.Route): @@ -53,6 +60,18 @@ class ElementResourceRoute(routes.Route): __controller__ = controllers.ElementResourceController +class ElementExportRoute(routes.Route): + """Handler for /v1/em/elements//exports/ endpoint""" + + __controller__ = controllers.ElementExportController + + +class ElementImportRoute(routes.Route): + """Handler for /v1/em/elements//imports/ endpoint""" + + __controller__ = controllers.ElementImportController + + class ElementSetProfileActionRoute(routes.Action): """Handler for /v1/em/elements//actions/set_profile/invoke endpoint""" @@ -71,6 +90,8 @@ class ElementRoute(routes.Route): __controller__ = controllers.ElementController resources = routes.route(ElementResourceRoute, resource_route=True) + exports = routes.route(ElementExportRoute, resource_route=True) + imports = routes.route(ElementImportRoute, resource_route=True) set_profile = routes.action(ElementSetProfileActionRoute, invoke=True) clear_profile = routes.action(ElementClearProfileActionRoute, invoke=True) diff --git a/genesis_core/user_api/iam/dm/models.py b/genesis_core/user_api/iam/dm/models.py index 6cd45936..c8892022 100644 --- a/genesis_core/user_api/iam/dm/models.py +++ b/genesis_core/user_api/iam/dm/models.py @@ -911,7 +911,7 @@ class HS256SignatureAlgorithm(ra_types_dynamic.AbstractKindModel): @property def secret(self): return secret_models.Password.objects.get_one( - filters={"uuid": str(self.secret_uuid)} + filters={"uuid": ra_filters.EQ(str(self.secret_uuid))} ) @property @@ -920,7 +920,7 @@ def previous_secret(self): return None return secret_models.Password.objects.get_one( - filters={"uuid": str(self.previous_secret_uuid)} + filters={"uuid": ra_filters.EQ(str(self.previous_secret_uuid))} ) def update_secret_uuid(self, new_secret_uuid): @@ -947,7 +947,7 @@ class RS256SignatureAlgorithm(ra_types_dynamic.AbstractKindModel): @property def secret(self): return secret_models.RSAKey.objects.get_one( - filters={"uuid": str(self.secret_uuid)} + filters={"uuid": ra_filters.EQ(str(self.secret_uuid))} ) @property @@ -956,7 +956,7 @@ def previous_secret(self): return None return secret_models.RSAKey.objects.get_one( - filters={"uuid": str(self.previous_secret_uuid)} + filters={"uuid": ra_filters.EQ(str(self.previous_secret_uuid))} ) def safe_update_secret_uuid(self, new_secret_uuid):