
                         2    S r SSKJr  SSKJr  S rS rS rg)z$Utility functions for platform logs.    )util)	resourcesc                    [         R                  " U 5      n[         R                  " U 5      nU R                  S5      (       aF  [         R                  " U 5      n[
        R                  R                  UX#S.SS9nUR                  nSnO/[
        R                  R                  USU0SS9nUR                  nSnUR                  5       S	-   nXhU4$ )
aP  Returns the service client and config resource name.

Args:
  args: User input args.
  client: The API service client.

Returns:
  service: The service client for either project or repository level
    operations.
  config_name: The full resource name of the platform logs config.
  is_repository: True if the resource is a repository.

repository)
projectsIdlocationsIdz0artifactregistry.projects.locations.repositories)params
collectionTr   z#artifactregistry.projects.locationsFz/platformLogsConfig)r   
GetProjectGetLocationIsSpecifiedGetRepor   REGISTRYParseprojects_locations_repositoriesprojects_locationsRelativeName)	argsclientprojectlocationreporesource_refserviceis_repositoryconfig_names	            =lib/googlecloudsdk/command_lib/artifacts/platformlogs_util.py_GetClientAndResourceNamer      s     OOD!'d#(	l##<<D%%++%?E , L
 44GM%%++g&8 , L
 ''GM))+.CC+	}	,,    c                     [        X5      u  p4nU(       a  UR                  nOUR                  nU" US9nUR                  U5      $ )zGets the platform logs config.

Args:
  args: User input args.
  client: The API service client.
  messages: The API messages module.

Returns:
  The retrieved platform logs config.
)name)r   IArtifactregistryProjectsLocationsRepositoriesGetPlatformLogsConfigRequest=ArtifactregistryProjectsLocationsGetPlatformLogsConfigRequestGetPlatformLogsConfig)r   r   messagesr   r   r   request_messagerequests           r   r$   r$   :   sR     )B$(O%'ZZ 
 	NN  -'		&	&w	//r   c                     [        X5      u  pEnU(       a  UR                  nOUR                  nXSl        U" XSS9nUR	                  U5      $ )zUpdates the platform logs config.

Args:
  args: User input args.
  client: The API service client.
  messages: The API messages module.
  platform_logs_config: The platform logs config to update.

Returns:
  The updated platform logs config.
)r!   platformLogsConfig)r   LArtifactregistryProjectsLocationsRepositoriesUpdatePlatformLogsConfigRequest@ArtifactregistryProjectsLocationsUpdatePlatformLogsConfigRequestr!   UpdatePlatformLogsConfig)	r   r   r%   platform_logs_configr   r   r   r&   r'   s	            r   r,   r,   S   s]     )B$(O%']] 
 	QQ  *' 
	)	)'	22r   N)__doc__$googlecloudsdk.command_lib.artifactsr   googlecloudsdk.corer   r   r$   r,    r   r   <module>r2      s     + 5 )"-J023r   