diff --git a/internal/api.yml b/internal/api.yml index 43d6f9fa..3b41f6a7 100644 --- a/internal/api.yml +++ b/internal/api.yml @@ -39,10 +39,12 @@ paths: $ref: paths/environment/ips.yml /v1/environment/services: $ref: paths/environment/services.yml + /v1/environment/virtual-machines: + $ref: paths/environment/virtual-machines.yml /v1/environment/services/lb/telemetry/snapshots: $ref: paths/environment/lbtelemetry.yml /v1/environment/scoped-variables: - $ref: paths/environment/scopedVariables.yml + $ref: paths/environment/scoped-variables.yml # Hubs /v1/hub: @@ -56,13 +58,13 @@ paths: /v1/server/instances: $ref: paths/server/instances.yml /v1/server/instances/telemetry: - $ref: paths/server/instanceTelemetry.yml + $ref: paths/server/instance-telemetry.yml /v1/server/containers: $ref: paths/server/containers.yml /v1/server/images: $ref: paths/server/images.yml /v1/server/images/download: - $ref: paths/server/imageDownload.yml + $ref: paths/server/image-download.yml # Containers /v1/container: @@ -81,6 +83,8 @@ paths: # Monitoring /v1/monitoring/metrics: $ref: paths/monitoring/metrics.yml + /v1/monitoring/events: + $ref: paths/monitoring/events.yml # VPN /v1/vpn/login: @@ -93,7 +97,16 @@ paths: $ref: paths/sdn/instances.yml /v1/sdn/networks/environments: $ref: paths/sdn/environments.yml + + # Virtual Machines + /v1/virtual-machine: + $ref: paths/virtual-machine/virtual-machine.yml + /v1/virtual-machine/domains: + $ref: paths/virtual-machine/domains.yml + # Object Cache + /v1/object-cache: + $ref: paths/object-cache/object-cache.yml components: securitySchemes: tokenAuth: diff --git a/internal/components/monitoring/Event.yml b/internal/components/monitoring/Event.yml new file mode 100644 index 00000000..d83de828 --- /dev/null +++ b/internal/components/monitoring/Event.yml @@ -0,0 +1,58 @@ +title: Event +description: A custom event submitted to the monitoring system. +type: object +required: + - event + - type + - priority +properties: + metadata: + anyOf: + - type: object + properties: + component: + type: object + description: The associated component for this event. + properties: + id: + type: string + type: + type: string + - type: "null" + event: + type: string + description: The event name. + type: + type: string + enum: + - info + - warning + - error + - success + - alert + - notice + - audit + priority: + type: string + enum: + - critical + - high + - medium + - normal + - low + text: + description: The text describing the event that has occurred. + type: + - string + - "null" + extra: + type: object + additionalProperties: true + labels: + type: object + additionalProperties: + type: string + tags: + type: array + items: + type: string diff --git a/internal/components/object-cache/ObjectCacheSave.yml b/internal/components/object-cache/ObjectCacheSave.yml new file mode 100644 index 00000000..5c531521 --- /dev/null +++ b/internal/components/object-cache/ObjectCacheSave.yml @@ -0,0 +1,23 @@ +title: ObjectCacheSave +description: An item saved in the internal API object cache. +type: object +required: + - scope + - expires + - key + - value +properties: + scope: + type: string + enum: + - global + - environment + - container + - instance + expires: + $ref: ../../../components/schemas/Duration.yml + key: + type: string + value: + type: string + \ No newline at end of file diff --git a/internal/paths/environment/instances.yml b/internal/paths/environment/instances.yml index 0dee9466..3147d77d 100644 --- a/internal/paths/environment/instances.yml +++ b/internal/paths/environment/instances.yml @@ -1,7 +1,7 @@ get: operationId: "getEnvironmentInstances" summary: List Environment Instances - description: Lists all Instances present in this Instance's Environment. + description: Lists all instances present in this instance's environment. tags: - Environments - Instances @@ -10,7 +10,7 @@ get: default: $ref: ../../../components/responses/errors/DefaultError.yml 200: - description: Returns a list of Instances. + description: Returns a list of instances. content: application/json: schema: diff --git a/internal/paths/environment/scopedVariables.yml b/internal/paths/environment/scoped-variables.yml similarity index 100% rename from internal/paths/environment/scopedVariables.yml rename to internal/paths/environment/scoped-variables.yml diff --git a/internal/paths/environment/services.yml b/internal/paths/environment/services.yml index 048296b8..8d1bb8f4 100644 --- a/internal/paths/environment/services.yml +++ b/internal/paths/environment/services.yml @@ -28,5 +28,7 @@ get: $ref: ../../../components/schemas/containers/ServiceContainer.yml scheduler: $ref: ../../../components/schemas/containers/ServiceContainer.yml + gateway: + $ref: ../../../components/schemas/containers/ServiceContainer.yml additionalProperties: $ref: ../../../components/schemas/containers/ServiceContainer.yml diff --git a/internal/paths/environment/virtual-machines.yml b/internal/paths/environment/virtual-machines.yml new file mode 100644 index 00000000..52a42d10 --- /dev/null +++ b/internal/paths/environment/virtual-machines.yml @@ -0,0 +1,24 @@ +get: + operationId: "getEnvironmentVirtualMachines" + summary: Get Environment Virtual Machines + description: | + Returns a list of virtual machines that are in the same environment as this instance. + tags: + - Environments + parameters: [] + responses: + default: + $ref: ../../../components/responses/errors/DefaultError.yml + 200: + description: Returns a list of virtual machines. + content: + application/json: + schema: + type: object + required: + - data + properties: + data: + type: array + items: + $ref: ../../../components/schemas/vms/VirtualMachine.yml diff --git a/internal/paths/monitoring/events.yml b/internal/paths/monitoring/events.yml new file mode 100644 index 00000000..af2f0a20 --- /dev/null +++ b/internal/paths/monitoring/events.yml @@ -0,0 +1,32 @@ +post: + operationId: "postEvent" + summary: Post Event + description: | + Post a custom event to Cycle's monitoring system. + tags: + - Monitoring + parameters: [] + requestBody: + required: true + content: + application/json: + schema: + type: array + items: + $ref: ../../components/monitoring/Event.yml + responses: + default: + $ref: ../../../components/responses/errors/DefaultError.yml + 200: + description: Returns true on success. + content: + application/json: + schema: + type: object + required: + - data + properties: + data: + type: boolean + enum: + - true diff --git a/internal/paths/monitoring/metrics.yml b/internal/paths/monitoring/metrics.yml index e2ac99ad..f258d20c 100644 --- a/internal/paths/monitoring/metrics.yml +++ b/internal/paths/monitoring/metrics.yml @@ -18,7 +18,7 @@ post: default: $ref: ../../../components/responses/errors/DefaultError.yml 200: - description: Returns true on success + description: Returns true on success. content: application/json: schema: diff --git a/internal/paths/object-cache/object-cache.yml b/internal/paths/object-cache/object-cache.yml new file mode 100644 index 00000000..17175012 --- /dev/null +++ b/internal/paths/object-cache/object-cache.yml @@ -0,0 +1,68 @@ +get: + operationId: "getObjectCache" + summary: Get Object Cache + description: | + Returns an object saved to the internal object cache. + tags: + - Object Cache + parameters: + - name: scope + in: query + required: true + description: Specify the object scope. + schema: + type: string + enum: + - global + - environment + - container + - instance + - name: key + in: query + required: true + description: Specify the object key. + schema: + type: string + responses: + default: + $ref: ../../../components/responses/errors/DefaultError.yml + 200: + description: Returns a saved object cache item. + content: + application/json: + schema: + type: object + required: + - data + properties: + data: + $ref: ../../components/object-cache/ObjectCacheSave.yml + +post: + operationId: "postObjectCache" + summary: Post Object Cache + description: | + Save an item to the internal API object cache. + tags: + - Object Cache + parameters: [] + requestBody: + required: true + content: + application/json: + schema: + $ref: ../../components/object-cache/ObjectCacheSave.yml + responses: + default: + $ref: ../../../components/responses/errors/DefaultError.yml + 200: + description: Returns true on success. + content: + application/json: + schema: + type: object + required: + - data + properties: + data: + type: "null" diff --git a/internal/paths/server/imageDownload.yml b/internal/paths/server/image-download.yml similarity index 100% rename from internal/paths/server/imageDownload.yml rename to internal/paths/server/image-download.yml diff --git a/internal/paths/server/instanceTelemetry.yml b/internal/paths/server/instance-telemetry.yml similarity index 100% rename from internal/paths/server/instanceTelemetry.yml rename to internal/paths/server/instance-telemetry.yml diff --git a/internal/paths/virtual-machine/domains.yml b/internal/paths/virtual-machine/domains.yml new file mode 100644 index 00000000..4f71f977 --- /dev/null +++ b/internal/paths/virtual-machine/domains.yml @@ -0,0 +1,38 @@ +get: + operationId: "getVirtualMachineDomains" + summary: Get Virtual Machine Domains + description: | + Returns the domains associated with the specified virtual machine. + tags: + - Virtual Machines + parameters: + - name: virtual-machine-id + in: query + required: true + description: Specify which virtual machine to fetch domains for. + schema: + type: string + responses: + default: + $ref: ../../../components/responses/errors/DefaultError.yml + 200: + description: Returns a list of virtual machine domains. + content: + application/json: + schema: + type: object + required: + - data + properties: + data: + type: array + items: + type: object + required: + - fqdn + properties: + fqdn: + type: string + record: + anyOf: + - $ref: ../../../components/schemas/dns/records/Record.yml \ No newline at end of file diff --git a/internal/paths/virtual-machine/virtual-machine.yml b/internal/paths/virtual-machine/virtual-machine.yml new file mode 100644 index 00000000..5524b3ea --- /dev/null +++ b/internal/paths/virtual-machine/virtual-machine.yml @@ -0,0 +1,28 @@ +get: + operationId: "getVirtualMachine" + summary: Get Virtual Machine + description: | + Returns a specified virtual machine. + tags: + - Virtual Machines + parameters: + - name: virtual-machine-id + in: query + required: true + description: Specify which virtual machine to fetch. + schema: + type: string + responses: + default: + $ref: ../../../components/responses/errors/DefaultError.yml + 200: + description: Returns a virtual machine. + content: + application/json: + schema: + type: object + required: + - data + properties: + data: + $ref: ../../../components/schemas/vms/VirtualMachine.yml