
                         V    d Z ddlmZ ddlmZ ddlmZ dZdZd Z	d Z
 G d	 d
e      Zy)z2Utilities for Package Rollouts ResourceBundle API.    )
list_pager)util)waiterpageSizez1configdelivery.projects.locations.resourceBundlesc                     d|  d| S )N	projects//locations/ )projectlocations     Glib/googlecloudsdk/api_lib/container/fleet/packages/resource_bundles.py_ParentPathr      s    WI[
	33    c                     d|  d| d| S )Nr   r	   z/resourceBundles/r
   )r   r   names      r   _FullyQualifiedPathr      s    WI[
2CD6	JJr   c                   D    e Zd ZdZd	dZd
dZddZddZd Z	 	 	 ddZ	y)ResourceBundlesClientzCClient for ResourceBundles 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 Nr   )xs    r   <lambda>z0ResourceBundlesClient.__init__.<locals>.<lambda>,   s    r   )operation_serviceget_name_func)r   DEFAULT_API_VERSION_api_versionGetClientInstanceclientGetMessagesModulemessages"projects_locations_resourceBundles_servicer   CloudOperationPollerNoResourcesprojects_locations_operationsresource_bundle_waiter)selfapi_versionr    r"   s       r   __init__zResourceBundlesClient.__init__%   s    #?t'?'?DED2243D3DEDKC 6 6t{{ CDMKKBBDM"("H"H++CC&#Dr   c                     | j                   j                  t        ||            }t        j                  | j
                  |d||t              S )a  List ResourceBundles from Package Rollouts API.

    Args:
      project: GCP project id.
      location: Valid GCP location (e.g. us-central1).
      limit: int or None, the total number of results to return.
      page_size: int, the number of entries in each batch (affects requests
        made, but not the yielded results).

    Returns:
      Generator of matching devices.
    )parentresourceBundles)field
batch_sizelimitbatch_size_attribute)r"   9ConfigdeliveryProjectsLocationsResourceBundlesListRequestr   r   YieldFromListr$   "_LIST_REQUEST_BATCH_SIZE_ATTRIBUTE)r(   r   r   r0   	page_sizelist_requests         r   ListzResourceBundlesClient.List/   sV     	OOw1 	P 	
 
 ##? r   c                 &   t        |||      }| j                  j                  ||d      }| j                  j                  |t	        ||      |      }t        j                  | j                  | j                  j                  |      d|       }|S )a(  Create ResourceBundle for Package Rollouts API.

    Args:
      project: GCP project id.
      location: Valid GCP location (e.g. us-central1).
      name: Name of the ResourceBundle.
      description: Description of the ResourceBundle.

    Returns:
      Created ResourceBundle resource.
    Nr   descriptionlabels)resourceBundler,   resourceBundleIdzCreating ResourceBundle )
r   r"   ResourceBundle;ConfigdeliveryProjectsLocationsResourceBundlesCreateRequestr   r   WaitForr'   r$   Create)	r(   r   r   r   r:   fully_qualified_pathresource_bundlecreate_requestresults	            r   rA   zResourceBundlesClient.CreateJ   s     /w$Gmm22!{4 3 O ]]^^&7H- _ N
 ^^##^,
"4&)F
 Mr   c                     t        |||      }| j                  j                  ||      }t        j                  | j
                  | j                  j                  |      d|       S )a  Delete a ResourceBundle resource.

    Args:
      project: GCP project id.
      location: Valid GCP location (e.g., us-central1).
      name: Name of the ResourceBundle.
      force: Nested resource deletion flag.

    Returns:
      Empty Response Message.
    )r   forcezDeleting ResourceBundle )r   r"   ;ConfigdeliveryProjectsLocationsResourceBundlesDeleteRequestr   r@   r'   r$   Delete)r(   r   r   r   rG   rB   
delete_reqs          r   rI   zResourceBundlesClient.Deletef   sj     /w$GZZ! [ J >>##Z(
"4&) r   c                     t        |||      }| j                  j                  |      }| j                  j	                  |      S )zDescribe a ResourceBundle resource.

    Args:
      project: GCP project id.
      location: Valid GCP location (e.g., us-central1).
      name: Name of the ResourceBundle.

    Returns:
      Requested ResourceBundle resource.
    r   )r   r"   8ConfigdeliveryProjectsLocationsResourceBundlesGetRequestr$   Get)r(   r   r   r   rB   describe_reqs         r   DescribezResourceBundlesClient.Describe|   sJ     /w$GNN% 	O 	
 
 ==\**r   c                    t        |||      }| j                  j                  |||      }| j                  j                  |||      }	t	        j
                  | j                  | j                  j                  |	      d|       S )a  Update ResourceBundle for Package Rollouts API.

    Args:
      project: GCP project id.
      location: Valid GCP location (e.g. us-central1).
      name: Name of the ResourceBundle.
      description: Description of the ResourceBundle.
      labels: Kubernetes labels to apply to your ResourceBundle.
      update_mask: Fields to be updated.

    Returns:
      Updated ResourceBundle resource.
    r9   )r<   r   
updateMaskzUpdating ResourceBundle )	r   r"   r>   :ConfigdeliveryProjectsLocationsResourceBundlesPatchRequestr   r@   r'   r$   Patch)
r(   r   r   r   r:   r;   update_maskrB   rC   update_requests
             r   UpdatezResourceBundlesClient.Update   s    , /w$Gmm22!{6 3 O ]]]]&! ^ N
 >>##N+
"4&) r   )NN)Nd   r   )F)NNN)
__name__
__module____qualname____doc__r*   r7   rA   rI   rO   rV   r
   r   r   r   r   "   s.    K68,+0 #r   r   N)r[   apitools.base.pyr   /googlecloudsdk.api_lib.container.fleet.packagesr   googlecloudsdk.api_lib.utilr   r4   RESOURCE_BUNDLE_COLLECTIONr   r   objectr   r
   r   r   <module>ra      s8    9 ' @ .%/ "P 4KPF Pr   