def List(location_refs, page_size, limit=sys.maxsize):
  """Lists Composer Operations across all locations.

  Uses a hardcoded list of locations, as there is way to dynamically
  discover the list of supported locations. Support for new locations
  will be aligned with Cloud SDK releases.

  Args:
    location_refs: [core.resources.Resource], a list of resource reference to
        locations in which to list operations.
    page_size: An integer specifying the maximum number of resources to be
      returned in a single list call.
    limit: An integer specifying the maximum number of operations to list.
        None if all available operations should be returned.

  Returns:
    list: a generator over Operations within the locations in `location_refs`.
  """
  return api_util.AggregateListResults(
      api_util.GetMessagesModule()
      .ComposerProjectsLocationsOperationsListRequest,
      GetService(),
      location_refs,
      'operations',
      page_size,
      limit=limit,
      location_attribute='name')
Exemple #2
0
def List(location_refs,
         page_size,
         limit=None,
         release_track=base.ReleaseTrack.GA):
    """Lists Composer Environments across all locations.

  Uses a hardcoded list of locations, as there is no way to dynamically
  discover the list of supported locations. Support for new locations
  will be aligned with Cloud SDK releases.

  Args:
    location_refs: [core.resources.Resource], a list of resource reference to
        locations in which to list environments.
    page_size: An integer specifying the maximum number of resources to be
      returned in a single list call.
    limit: An integer specifying the maximum number of environments to list.
        None if all available environments should be returned.
    release_track: base.ReleaseTrack, the release track of command. Will dictate
        which Composer client library will be used.

  Returns:
    list: a generator over Environments in the locations in `location_refs`
  """
    return api_util.AggregateListResults(
        api_util.GetMessagesModule(release_track=release_track).
        ComposerProjectsLocationsEnvironmentsListRequest,
        GetService(release_track=release_track),
        location_refs,
        'environments',
        page_size,
        limit=limit)
Exemple #3
0
  def List(self, project_location_ref):
    """Retrieves list of supported images version from the Image Version API."""
    # TODO(b/122741565): Add support for paging
    request = self.messages.ComposerProjectsLocationsImageVersionsListRequest
    locations = [project_location_ref]

    return api_util.AggregateListResults(request, self.GetClient(), locations,
                                         LIST_FIELD_NAME, PAGE_SIZE)