Skip to content
Open
112 changes: 109 additions & 3 deletions .github/workflows/rc_api_sync.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,114 @@ jobs:
git checkout -b "${branch}"
fi

curl -Ls https://api.redislabs.com/v1/cloud-api-docs \
| jq '(.. | .example? | try select(test("^{"))) |= fromjson' > content/operate/rc/api/api-reference/openapi.json
curl -Ls https://api.redislabs.com/v1/cloud-api-docs/capi \
| jq '(.. | .example? | try select(test("^{"))) |= fromjson' > /tmp/rc-capi-openapi.json

curl -Ls https://api.redislabs.com/v1/cloud-api-docs/rdi \
| jq '(.. | .example? | try select(test("^{"))) |= fromjson' > /tmp/rc-rdi-openapi.json

jq -n --slurpfile capi /tmp/rc-capi-openapi.json --slurpfile rdi /tmp/rc-rdi-openapi.json '
def opkeys: ["get","put","post","delete","patch","options","head","trace"];
def normalize_rdi_paths:
with_entries(.key |= if startswith("/v1/") then . else "/v1" + . end);
def retag_rdi_paths:
with_entries(
.value |= with_entries(
if (.key as $k | opkeys | index($k)) then
.value |= (.tags = ["Subscriptions - Pro - Data Integration"])
else
.
end
)
);
def without_old_rdi_proxy_paths:
with_entries(
select(.key | test("^/v1/(data-integration-workspaces|subscriptions/\\{subscriptionId\\}/data-integration-workspace)(/\\*\\*)?$") | not)
);
def insert_rdi_tag($tags):
($tags | map(select(.name != "Data Integration" and .name != "Subscriptions - Pro - Data Integration"))) as $base
| ($base | map(.name) | index("Subscriptions - Pro - Connectivity")) as $idx
| {
name: "Subscriptions - Pro - Data Integration",
description: "All Pro subscription Data Integration operations.",
"x-order": "12",
"x-api-lifecycle": "preview"
} as $tag
| if $idx == null then $base + [$tag]
else $base[0:($idx + 1)] + [$tag] + $base[($idx + 1):]
end;
def enrich_rdi_workspace_docs:
.components.schemas.WorkspaceCreateRequest.description //= "Request to provision a data integration workspace for a Redis Cloud subscription."
| .components.schemas.WorkspaceCreateRequest.properties.cidr.description //= "CIDR block for the workspace deployment network."
| .components.schemas.WorkspacesResponse.description //= "Response containing data integration workspaces in the Redis Cloud account."
| .components.schemas.WorkspacesResponse.properties.workspaces.description //= "Data integration workspaces."
| .components.schemas.WorkspaceTasksResponse.description //= "Response containing asynchronous workspace tasks."
| .components.schemas.WorkspaceTasksResponse.properties.tasks.description //= "Workspace tasks."
| .components.schemas.WorkspaceTaskResponse.description //= "Asynchronous task created by a workspace operation."
| .components.schemas.WorkspaceTaskResponse.properties.taskId.description //= "Workspace task ID."
| .components.schemas.WorkspaceTaskResponse.properties.commandType.description //= "Workspace operation that created the task."
| .components.schemas.WorkspaceTaskResponse.properties.status.description //= "Current task status."
| .components.schemas.WorkspaceTaskResponse.properties.description.description //= "Human-readable task status or failure details."
| .components.schemas.WorkspaceTaskResponse.properties.timestamp.description //= "Time when the task status was recorded."
| .components.schemas.WorkspaceTaskResponse.properties.response.description //= "Task result payload. Completed workspace tasks can include the current workspace response."
| .components.schemas.WorkspaceTaskResponse.properties._links.description //= "Links to the task and affected workspace resource."
| .components.schemas.TaskLinks.description //= "Links related to a workspace task."
| .components.schemas.TaskLinks.properties.task.description //= "Link to the workspace task."
| .components.schemas.TaskLinks.properties.resource.description //= "Link to the affected workspace resource."
| .components.schemas.TaskLink.description //= "Hypermedia link."
| .components.schemas.TaskLink.properties.href.description //= "Link URL."
| .components.schemas.TaskLink.properties.type.description //= "Linked resource type."
| .components.schemas.WorkspaceResponse.description //= "Current data integration workspace state for a subscription."
| .components.schemas.WorkspaceResponse.properties.subscriptionId.description //= "Redis Cloud subscription ID."
| .components.schemas.WorkspaceResponse.properties.bdbId.description //= "Redis database ID associated with the workspace."
| .components.schemas.WorkspaceResponse.properties.rcpClusterId.description //= "RCP cluster ID that hosts workspace resources."
| .components.schemas.WorkspaceResponse.properties.region.description //= "Cloud provider region where the workspace is deployed."
| .components.schemas.WorkspaceResponse.properties.vpcId.description //= "VPC ID used by the workspace."
| .components.schemas.WorkspaceResponse.properties.createdAt.description //= "Time when the workspace record was created."
| .components.schemas.WorkspaceResponse.properties.infrastructure.description //= "Provisioned infrastructure state and connection details."
| .components.schemas.WorkspaceResponse.properties.capabilities.description //= "Workspace features available in the current state."
| .components.schemas.InfrastructureResponse.description //= "Provisioned infrastructure state for a data integration workspace."
| .components.schemas.InfrastructureResponse.properties.state.description //= "Workspace infrastructure state."
| .components.schemas.InfrastructureResponse.properties.cidr.description //= "CIDR block assigned to the workspace deployment network."
| .components.schemas.InfrastructureResponse.properties.timestamps.description //= "Infrastructure lifecycle timestamps."
| .components.schemas.InfrastructureResponse.properties.iam.description //= "IAM values used by workspace integrations."
| .components.schemas.InfrastructureResponse.properties.networking.description //= "Workspace networking outputs."
| .components.schemas.InfrastructureResponse.properties.monitoring.description //= "Workspace monitoring endpoints."
| .components.schemas.InfrastructureResponse.properties.error.description //= "Infrastructure error details when the workspace is in a failed state."
| .components.schemas.InfrastructureTimestamps.description //= "Workspace infrastructure lifecycle timestamps."
| .components.schemas.InfrastructureTimestamps.properties.startedAt.description //= "Time when infrastructure provisioning started."
| .components.schemas.InfrastructureTimestamps.properties.updatedAt.description //= "Time when infrastructure state was last updated."
| .components.schemas.InfrastructureIam.description //= "IAM values produced for workspace integrations."
| .components.schemas.InfrastructureIam.properties.privateLinkAllowedPrincipal.description //= "AWS principal allowed to connect to the workspace PrivateLink endpoint service."
| .components.schemas.InfrastructureIam.properties.secretsRoleArn.description //= "AWS IAM role ARN used to read workspace secrets."
| .components.schemas.NetworkingOutput.description //= "Workspace networking outputs."
| .components.schemas.NetworkingOutput.properties.egressIps.description //= "Outbound IP addresses used by workspace components."
| .components.schemas.NetworkingOutput.properties.availabilityZones.description //= "Availability zones used by workspace infrastructure."
| .components.schemas.MonitoringOutput.description //= "Workspace monitoring outputs."
| .components.schemas.MonitoringOutput.properties.metricsUrls.description //= "Metrics endpoint URLs for workspace components."
| .components.schemas.MetricsUrls.description //= "Metrics endpoint URLs for RDI workspace components."
| .components.schemas.MetricsUrls.properties.rdiOperatorUrl.description //= "Metrics endpoint URL for the RDI operator."
| .components.schemas.MetricsUrls.properties.rdiProcessorUrl.description //= "Metrics endpoint URL for the RDI processor."
| .components.schemas.MetricsUrls.properties.collectorSourceUrls.description //= "Metrics endpoint URLs for deployed collector sources, keyed by source name."
| .components.schemas.InfrastructureError.description //= "Infrastructure failure details."
| .components.schemas.InfrastructureError.properties.code.description //= "Machine-readable error code."
| .components.schemas.InfrastructureError.properties.message.description //= "Human-readable error message."
| .components.schemas.InfrastructureError.properties.timestamp.description //= "Time when the error was recorded."
| .components.schemas.InfrastructureError.properties.details.description //= "Additional structured error details."
| .components.schemas.Capabilities.description //= "Workspace capabilities available in the current state."
| .components.schemas.Capabilities.properties.validateSecrets.description //= "Whether the workspace can validate secret ARNs."
| .components.schemas.Capabilities.properties.validatePrivateLink.description //= "Whether the workspace can validate PrivateLink endpoint service names."
| .components.schemas.Capabilities.properties.readyForPipeline.description //= "Whether the workspace is ready to create and deploy RDI pipelines."
| .components.schemas.Capabilities.properties.createPrivateLink.description //= "Whether the workspace can create PrivateLink endpoints.";
Comment on lines +78 to +140

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is all of this stuff added here and is not part of the rdi json file in the first place?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The goal was that CAPI exposes functionality not just of the cloud database but all applications as well. So for example, the RDI API is accessible under the CAPI Pro subscriptions path, so on one side it makes sense to document the RDI API in the same place.

If you think we should separate the docs reference, we can also discuss that approach.

TBH I don't have a strong opinion.

($capi[0]) as $c
| ($rdi[0]) as $r
| $c
| .tags = insert_rdi_tag($c.tags)
| .paths = (($c.paths | without_old_rdi_proxy_paths) + ($r.paths | normalize_rdi_paths | retag_rdi_paths))
| .components.schemas = (($c.components.schemas // {}) + ($r.components.schemas // {}))
| .components.securitySchemes = (($c.components.securitySchemes // {}) + ($r.components.securitySchemes // {}))
| enrich_rdi_workspace_docs
' > content/operate/rc/api/api-reference/openapi.json

spec_is_different=$(git diff content/operate/rc/api/api-reference/openapi.json)

Expand All @@ -67,4 +173,4 @@ jobs:
--head "$branch" \
--base "main"
fi
fi
fi
1 change: 1 addition & 0 deletions content/operate/rc/api/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,5 @@ You can use the API to:

- Use the [Redis Cloud API]({{< relref "/operate/rc/api/get-started/use-rest-api.md" >}})
- [Full API Reference]({{< relref "/operate/rc/api/api-reference" >}})
- [Data Integration API Reference]({{< relref "/operate/rc/api/api-reference" >}}#tag/Subscriptions-Pro-Data-Integration)
- Secure [authentication and authorization]({{< relref "/operate/rc/api/get-started" >}})
Loading
Loading