Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add getClusters feature #55

Merged
merged 8 commits into from
Dec 19, 2024
Merged

Conversation

cambelem
Copy link
Contributor

Description

This feature introduces a new command to retrieve a list of Cluster attributes based on organization_id.

Key Features

  • Defaults Output: JSON format.
  • Added --first flag for the first cluster in the list
  • Added searchStr for getClusters

Usage Examples:

Input:
ocm-support get clusters [org_id]

Result:

[
  {
    "id": "1 ... a",
    "href": "/api/clusters_mgmt/v1/clusters/[cluster_id]",
    "name": "cluster-name1",
    "external_id": "1 ... c"
    "display_name": "cluster-name1",
    "subscription_id": "1 ... b",
    "state": "ready",
    "cloud_provider": "aws",
    "version": "4.16.0",
    "region_id": "us-east-1",
    "multi_az": true,
    "product_id": "rosa",
    "managed": true,
    "console_url": "https://console-openshift-console.apps.cluster-name1.com",
    "creation_timestamp": "2024-07-01T01:00:00.000000Z",
  },
...
]

Input:
ocm-support get clusters [org_id] --first

Result:

[
  {
    "id": "1 ... a",
    "href": "/api/clusters_mgmt/v1/clusters/[cluster_id]",
    "name": "cluster-name1",
    "external_id": "1 ... c"
    "display_name": "cluster-name1",
    "subscription_id": "1 ... b",
    "state": "ready",
    "cloud_provider": "aws",
    "version": "4.16.0",
    "region_id": "us-east-1",
    "multi_az": true,
    "product_id": "rosa",
    "managed": true,
    "console_url": "https://console-openshift-console.apps.cluster-name1.com",
    "creation_timestamp": "2024-07-01T01:00:00.000000Z",
  }
]

Input:
ocm-support get clusters [org_id] "region.id='us-east-1'"

Result:

[
  {
    "id": "1 ... a",
    "href": "/api/clusters_mgmt/v1/clusters/[cluster_id]",
    "name": "cluster-name1",
    "external_id": "1 ... c"
    "display_name": "cluster-name1",
    "subscription_id": "1 ... b",
    "state": "ready",
    "cloud_provider": "aws",
    "version": "4.16.0",
    "region_id": "us-east-1",
    "multi_az": true,
    "product_id": "rosa",
    "managed": true,
    "console_url": "https://console-openshift-console.apps.cluster-name1.com",
    "creation_timestamp": "2024-07-01T01:00:00.000000Z",
  },
...
]

@tirthct
Copy link
Collaborator

tirthct commented Dec 18, 2024

In addition to these file changes, we can also update the readme with a section about this command

@cristianoveiga
Copy link
Collaborator

LGTM

@cristianoveiga cristianoveiga merged commit db4a49b into openshift-online:main Dec 19, 2024
1 check passed
@cambelem cambelem deleted the getCluster branch December 19, 2024 15:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants