
                         4   d Z ddlmZ ddlmZ ddlmZ ddlmZ dZ	dZ
ej                  j                  dej                  j                  d	ej                  j                  d
iZddZej                  j                  fdZej                  j                  fdZy)z)Utilities for Cloud Quotas API QuotaInfo.    )
list_pager)message_util)apis)base
   z%s/locations/global/services/%sv1alphav1betav1c                 \    t         j                  |       }t        j                  d||      S )Ncloudquotas)no_http)VERSION_MAPgetr   GetClientInstance)release_trackr   api_versions      /lib/googlecloudsdk/api_lib/quotas/quota_info.py_GetClientInstancer   !   s%    .+			{G	LL    c                    t        j                  | ||      }t        |      }|j                  }t        ||fz  d|z  z   }	| r-|j                  |	      }
|j                  j                  |
      S |r-|j                  |	      }
|j                  j                  |
      S |r-|j                  |	      }
|j                  j                  |
      S y)aX  Retrieve the QuotaInfo of a quota for a project, folder or organization.

  Args:
    project: str, The project ID.
    folder: str, The folder ID.
    organization: str, The organization ID.
    service: str, The service name.
    quota_id: str, The quota ID.
    release_track: str, The release track.

  Returns:
    The request QuotaInfo
  z/quotaInfos/%s)nameN)r   CreateConsumerr   MESSAGES_MODULE#_CONSUMER_LOCATION_SERVICE_RESOURCE8CloudquotasProjectsLocationsServicesQuotaInfosGetRequest&projects_locations_services_quotaInfosGet7CloudquotasFoldersLocationsServicesQuotaInfosGetRequest%folders_locations_services_quotaInfos=CloudquotasOrganizationsLocationsServicesQuotaInfosGetRequest+organizations_locations_services_quotaInfos)projectfolderorganizationservicequota_idr   consumerclientmessagesr   requests              r   GetQuotaInfor+   &   s    * ((&,G(m,&##()Xw,??8#$ 
 OO P G 88<<WEENN O G 77;;GDDNN 	O 	
 
 ==AA'JJ r   c                 ~   t        j                  | j                  | j                  | j                        }t        |      }|j                  }t        || j                  fz  }| j                  rh|j                  || j                        }t        j                  |j                  |d| j                  | j                  nt        d| j                        S | j                  rh|j!                  || j                        }t        j                  |j"                  |d| j                  | j                  nt        d| j                        S | j                  rh|j%                  || j                        }t        j                  |j&                  |d| j                  | j                  nt        d| j                        S y)zLists info for all quotas for a given project, folder or organization.

  Args:
    args: argparse.Namespace, The arguments that this command was invoked with.
    release_track: str, The release track.

  Returns:
    List of QuotaInfo
  )parentpageSizer.   N
quotaInfos)batch_size_attribute
batch_sizefieldlimit)r   r   r"   r#   r$   r   r   r   r%   9CloudquotasProjectsLocationsServicesQuotaInfosListRequest	page_sizer   YieldFromListr   	PAGE_SIZEr3   8CloudquotasFoldersLocationsServicesQuotaInfosListRequestr   >CloudquotasOrganizationsLocationsServicesQuotaInfosListRequestr!   )argsr   r'   r(   r)   r-   r*   s          r   ListQuotaInfor;   X   s    ((
llDKK!2!2( m,&##(.(DLL1II&	\\JJ^^ 	K 	
  ##55'%)^^%?4>>Yjj  
[[OO P G ##44'%)^^%?4>>Yjj  
OO^^ 	P 	
  ##::'%)^^%?4>>Yjj  r   N)F)__doc__apitools.base.pyr   googlecloudsdk.api_lib.quotasr   googlecloudsdk.api_lib.utilr   googlecloudsdk.callioper   r7   r   ReleaseTrackALPHABETAGAr   r   r+   r;    r   r   <module>rF      s    0 ' 6 , (	&G # 	YH$M ##&&/Kd '+&7&7&:&: =r   