[go: nahoru, domu]

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 filter and sort_by attributes to run_v2.List*Request. #12821

Open
1 task done
newtonapple opened this issue Jun 23, 2024 · 1 comment
Open
1 task done

Add filter and sort_by attributes to run_v2.List*Request. #12821

newtonapple opened this issue Jun 23, 2024 · 1 comment
Labels
triage me I really want to be triaged. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.

Comments

@newtonapple
Copy link
newtonapple commented Jun 23, 2024

Determine this is the right repository

  • I determined this is the correct repository in which to report this feature request.

Summary of the feature request

Most Google collection listing APIs have the filter and the sort-by options. For example, gcloud run services list accepts both the --filter and --sort-by options:

gcloud run services list --filter="metadata.labels.org:google" --sort-by="~metadata.name"

It would be nice for the have the filter and sort_by attributes be available on run_v2.List*Request classes, e.g. google.cloud.run_v2.types.ListServicesRequest, so that features (filter & sort) available in the gcloud CLI can also be done programmatically using the Google Cloud Python Client.

Here is the full list of classes that should have the filter and sort_by attributes added:

  • run_v2.ListExecutionsRequest
  • run_v2.ListJobsRequest
  • run_v2.ListRevisionsRequest
  • run_v2.ListServicesRequest
  • run_v2.ListTasksRequest

Desired code experience

Example API changes to the google.cloud.run_v2.types.ListServicesRequest class

from google.cloud import run_v2

def sample_list_services():
    client = run_v2.ServicesClient()
    request = run_v2.ListServicesRequest(
        parent=f"projects/my-project/locations/us-east1",
        page_size=10,
        filter="metadata.labels.env:prod*", # new
        sort_by="~metadata.name",           # new
    )
    page_result = client.list_services(request=request)

    for response in page_result:
        print(response)

Expected results

Return a list of services with their labels matching the env:prod* pattern & sorted by their service names in descending order.

API client name and version

No response

@newtonapple newtonapple added triage me I really want to be triaged. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design. labels Jun 23, 2024
@nghiapham1026
Copy link

We're working on this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
triage me I really want to be triaged. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.
Projects
None yet
Development

No branches or pull requests

2 participants