
                             S r SSKJr  SSKJr  SSKJr  SSKJr  SSKJr  SSK	J
r  SSKJr  SS	KJr  SS
Kr " S S\R                   5      rg
)z"Command for setting usage buckets.    )absolute_import)division)unicode_literals)base_classes)base)
exceptions)
properties)	resourcesNc                   .    \ rS rSrSr\S 5       rS rSrg)SetUsageBucket   a  Set usage reporting bucket for a project.

  *{command}* configures usage reporting for projects.

Setting usage reporting will cause a log of usage per resource to be
written to a specified Google Cloud Storage bucket daily.

For example, to write daily logs of the form usage_gce_YYYYMMDD.csv
to the bucket `my-bucket`, run:

  $ gcloud compute project-info set-usage-bucket --bucket=gs://my-bucket

To disable this feature, issue the command:

  $ gcloud compute project-info set-usage-bucket --no-bucket
c                     U R                  SS9nUR                  SSSS9  UR                  SSS	9  U R                  S
SS	9  g )NT)requiredz--no-bucket
store_truez6Unsets the bucket. This disables usage report storage.)actionhelpz--bucketa)          Name of an existing Google Cloud Storage bucket where the usage
        report object should be stored. This can either be the bucket name by
        itself, such as `my-bucket`, or the bucket name with `gs://`
        or `https://storage.googleapis.com/` in front of it, such as
        `gs://my-bucket`. The Google Service Account for
        performing usage reporting is granted write access to this bucket.
        The user running this command must be an owner of the bucket.

        To clear the usage bucket, use `--no-bucket`.
        )r   z--prefixa          Optional prefix for the name of the usage report object stored in
        the bucket. If not supplied, then this defaults to ``usage''. The
        report is stored as a CSV file named PREFIX_gce_YYYYMMDD.csv where
        YYYYMMDD is the day of the usage according to Pacific Time. The prefix
        should conform to Google Cloud Storage object naming conventions.
        This flag must not be provided when clearing the usage bucket.
        )add_mutually_exclusive_groupadd_argument)parserbucket_groups     4lib/surface/compute/project_info/set_usage_bucket.pyArgsSetUsageBucket.Args/   sk    666ELlE  G 
     	    c                    [         R                  " U R                  5       5      nUR                  nUR                  (       d'  UR
                  (       a  [        R                  " S5      eS nUR                  (       a=  [        R                  " [        R                  R                  UR                  5      5      nUR                  R                  [        R                   R"                  R$                  R'                  5       UR                  R)                  UUR
                  S9S9nUR+                  UR,                  R.                  SU4/5      $ )Nz?[--prefix] cannot be specified when unsetting the usage bucket.)
bucketNamereportNamePrefix)projectusageExportLocationSetUsageExportBucket)r   ComputeApiHolderReleaseTrackclientbucketprefixcompute_exceptionsArgumentErrorsix	text_typer
   REGISTRYParsemessages*ComputeProjectsSetUsageExportBucketRequestr	   VALUEScorer   	GetOrFailUsageExportLocationMakeRequestsapitools_clientprojects)selfargsholderr#   
bucket_urirequests         r   RunSetUsageBucket.RunN   s
   **4+<+<+>?F]]F;;4;;,,
KM M J{{==!3!3!9!9$++!FGjooHH!!&&..88:"OO??!![[ @ 
 I G !7!7!@!@!7!B  C D Dr    N)	__name__
__module____qualname____firstlineno____doc__staticmethodr   r:   __static_attributes__r<   r   r   r   r      s!    "  <Dr   r   )rA   
__future__r   r   r   googlecloudsdk.api_lib.computer   googlecloudsdk.callioper   "googlecloudsdk.command_lib.computer   r&   googlecloudsdk.corer	   r
   r(   SilentCommandr   r<   r   r   <module>rJ      s;    ) &  ' 7 ( O * ) 
FDT'' FDr   