
                         P    d Z ddlmZ ddlmZ dZdZd Zd Zd Z	 G d	 d
e
      Zy)z,Utilities for Package Rollouts Variants API.    )util)waiterpageSizezCconfigdelivery.projects.locations.resourceBundles.releases.variantsc                     d|  d| d| d| S )N	projects//locations//resourceBundles/
/releases/ )projectlocationparent_bundleparent_releases       ?lib/googlecloudsdk/api_lib/container/fleet/packages/variants.py_ParentPathr      s%    WI[
2CM?R\]k\l	mm    c           
      H    |j                  dd      }d|  d| d| d| d| 
S )N.-r   r   r	   r
   z
/variants/)replace)r   r   resource_bundlereleasevariantnames         r   _FullyQualifiedPathr      s?    	c	"$WI[
2COCTT^_c^ddnovnw	xxr   c                      t        | ||||      S N)r   )r   r   r   r   r   s        r   GetFullyQualifiedPathr   "   s    	x'7
 r   c                   "    e Zd ZdZddZ	 ddZy)VariantsClientz<Client for Variants in Config Delivery Package Rollouts API.Nc                 n   |xs t         j                  | _        |xs t        j                  | j                        | _        |xs t        j
                  | j                        | _        | j                  j                  | _        t        j                  | j                  j                  d       | _        y )Nc                     | j                   S r   )r   )xs    r   <lambda>z)VariantsClient.__init__.<locals>.<lambda>4   s    r   )operation_serviceget_name_func)r   DEFAULT_API_VERSION_api_versionGetClientInstanceclientGetMessagesModulemessages4projects_locations_resourceBundles_releases_variants_servicer   CloudOperationPollerNoResourcesprojects_locations_operationsvariant_waiter)selfapi_versionr*   r,   s       r   __init__zVariantsClient.__init__+   s    #?t'?'?DED2243D3DEDKC 6 6t{{ CDMHH 	M !@@++CC&Dr   c                 *   t        |||||      }| j                  j                  |d|      }| j                  j                  t	        ||||      ||      }	t        j                  | j                  | j                  j                  |	      d|       S )ab  Create Variant for a Release.

    Args:
      resource_bundle: Name of parent ResourceBundle.
      release: Name of parent Release.
      name: Name of the Variant.
      project: GCP Project ID.
      location: Valid GCP location (e.g., uc-central1)
      variant_resources: Resources of the Variant.

    Returns:
      Created Variant resource.
    N)r   labels	resources)parentr   	variantIdzCreating Variant )
r   r,   VariantKConfigdeliveryProjectsLocationsResourceBundlesReleasesVariantsCreateRequestr   r   WaitForr1   r.   Create)
r2   r   r   r   r   r   variant_resourcesfully_qualified_pathr   create_requests
             r   r=   zVariantsClient.Create7   s    , /?GT mm##!# $ G
 ]]nn7HowG o N
 >>^,
012 r   )NNr   )__name__
__module____qualname____doc__r4   r=   r   r   r   r    r    (   s    D
& 'r   r    N)rD   /googlecloudsdk.api_lib.container.fleet.packagesr   googlecloudsdk.api_lib.utilr   "_LIST_REQUEST_BATCH_SIZE_ATTRIBUTEVARIANT_COLLECTIONr   r   r   objectr    r   r   r   <module>rJ      s9    3 @ .%/ "Z ny
6V 6r   