
    i"                         d dl mZmZ d dlmZ d dlmZ d dlmZ d dl	m
Z
 d dlmZmZ d dlmZ d dlZd d	lmZ  G d
 d      Zy)    )OpenApiConfigurationConfig)	ApiClient)API_VERSION)OAuthApi)TokenRequest)OptionalDict)get_user_agentN)deepcopyc            
           e Zd ZdZ	 	 	 ddee   dee   deeeef      fdZed        Z	ed        Z
ed	        Zed
        Zy)Admina  
    A class for accessing the Pinecone Admin API.

    A prerequisite for using this class is to have a `service account <https://docs.pinecone.io/guides/organizations/manage-service-accounts>`_. To create a service
    account, visit the `Pinecone web console <https://app.pinecone.io>`_ and navigate to
    the ``Access > Service Accounts`` section.

    After creating a service account, you will be provided with a client ID and secret.
    These values can be passed to the Admin constructor or set the ``PINECONE_CLIENT_ID``
    and ``PINECONE_CLIENT_SECRET`` environment variables.


    :param client_id: The client ID for the Pinecone API. To obtain a client ID and secret,
        you must create a service account via the Pinecone web console. This value can be
        passed using keyword arguments or set the ``PINECONE_CLIENT_ID`` environment variable.
    :type client_id: Optional[str]
    :param client_secret: The client secret for the Pinecone API. To obtain a client ID
        and secret, you must create a service account via the Pinecone web console. This value
        can be passed using keyword arguments or set the ``PINECONE_CLIENT_SECRET`` environment
        variable.
    :type client_secret: Optional[str]
    :param additional_headers: Additional headers to use for the Pinecone API. This is a
        dictionary of key-value pairs. This is primarily used for internal testing
        purposes.
    :type additional_headers: Optional[Dict[str, str]]
    N	client_idclient_secretadditional_headersc                 
   ||| _         n4t        j                  j                  dd      }|t	        d      || _         ||| _        n4t        j                  j                  dd      }|t	        d      || _        |i }t        d      }t        |      }|j                  d	t               |j                         D ]  \  }}	|j                  ||	        t        t                     |_        t        |      }
t        | j                   | j
                  d
d      }|
j!                  |      }|j"                  | _        t'        |      }d|_        ddi|_        d| j$                  i|_        t        |      | _        | j.                  j                  d	t               |j                         D ]!  \  }}	| j.                  j                  ||	       # t        t                     | j.                  _        d| _        d| _        y)a  
        Initialize the ``Admin`` class.

        :param client_id: The client ID for the Pinecone API. To obtain a client ID and secret,
          you must create a service account via the Pinecone web console. This value can be
          passed using keyword arguments or set the ``PINECONE_CLIENT_ID`` environment variable.
        :type client_id: Optional[str]
        :param client_secret: The client secret for the Pinecone API. To obtain a client ID
          and secret, you must create a service account via the Pinecone web console. This value
          can be passed using keyword arguments or set the ``PINECONE_CLIENT_SECRET`` environment
          variable.
        :type client_secret: Optional[str]
        :param additional_headers: Additional headers to use for the Pinecone API. This is a
          dictionary of key-value pairs. This is primarily used for internal testing
          purposes.
        :type additional_headers: Optional[Dict[str, str]]
        NPINECONE_CLIENT_IDzqclient_id is not set. Pass client_id to the Admin constructor or set the PINECONE_CLIENT_ID environment variable.PINECONE_CLIENT_SECRETz}client_secret is not set. Pass client_secret to the Admin constructor or set the PINECONE_CLIENT_SECRET environment variable.zhttps://login.pinecone.io)host)configurationzX-Pinecone-Api-Versionclient_credentialszhttps://api.pinecone.io/)r   r   
grant_typeaudiencezhttps://api.pinecone.io
BearerAuthBearer)
_client_idosenvironget
ValueError_client_secretr   r   set_default_headerr   itemsr   r   
user_agentr   r   	get_tokenaccess_token_tokenr   r   api_key_prefixapi_key_child_api_client_project_api_key)selfr   r   r   env_client_idenv_client_secret_oauth_api_config_oauth_api_clientkeyvalue
_oauth_apitoken_requesttoken_response_child_api_configs                 f/var/www/catia.catastroantioquia-mas.com/valormas/lib/python3.12/site-packages/pinecone/admin/admin.py__init__zAdmin.__init__(   s   0  'DOJJNN+?FM$  H  ,DO$"/D "

/G N (  T  #4D%!#06QR%4EF,,-E{S,224 	=JC00e<	='5fh'?$/0
$oo--+/	
 $--m<$11$%67!:,8(+C(%14;;$?!!*9J!K112JKX,224 	BJC""55c5A	B,:68,D)     c                 l    | j                   ddlm}  || j                        | _         | j                   S )a5  A namespace for project-related operations

        Alias for :func:`projects`.

        To learn about all project-related operations, see :func:`pinecone.admin.resources.ProjectResource`.

        Examples
        --------

        .. code-block:: python
            :caption: Creating a project

            from pinecone import Admin

            # Using environment variables to pass PINECONE_CLIENT_ID and PINECONE_CLIENT_SECRET
            admin = Admin()

            # Create a project with no quota for pod indexes
            admin.project.create(
                name="my-project"
                max_pods=0
            )

        .. code-block:: python
            :caption: Listing all projects

            from pinecone import Admin

            admin = Admin()
            admin.projects.list()

        .. code-block:: python
            :caption: Deleting a project

            from pinecone import Admin

            admin = Admin()
            project = admin.project.get(name="my-project")
            admin.project.delete(project_id=project.id)
        r   )ProjectResource)r+   pinecone.admin.resourcesr<   r*   )r-   r<   s     r8   projectzAdmin.projectx   s.    T == @+D,B,BCDM}}r:   c                     | j                   S )zAlias for :func:`project`)r>   r-   s    r8   projectszAdmin.projects        ||r:   c                 l    | j                   ddlm}  || j                        | _         | j                   S )aF  A namespace for api key-related operations

        Alias for :func:`api_keys`.

        To learn about all api key-related operations, see :func:`pinecone.admin.resources.ApiKeyResource`.

        Examples
        --------

        .. code-block:: python
            :caption: Creating an API key

            from pinecone import Admin

            admin = Admin()

            project = admin.project.get(name="my-project")

            admin.api_key.create(
                name="my-api-key",
                project_id=project.id,
                description="my-api-key-description",
                roles=["ProjectEditor"]
            )

        .. code-block:: python
            :caption: Listing all API keys for a project

            from pinecone import Admin

            admin = Admin()
            project = admin.project.get(name="my-project")
            admin.api_key.list(project_id=project.id)

        .. code-block:: python
            :caption: Deleting an API key

            from pinecone import Admin

            admin = Admin()
            project = admin.project.get(name="my-project")

            # List api keys for the project
            keys_list = admin.api_key.list(project_id=project.id)

            # Delete the first api key in the list
            admin.api_key.delete(api_key_id=keys_list[0].id)

        r   )ApiKeyResource)r,   r=   rD   r*   )r-   rD   s     r8   r)   zAdmin.api_key   s.    f == ?*4+A+ABDM}}r:   c                     | j                   S )zAlias for :func:`api_key`)r)   r@   s    r8   api_keyszAdmin.api_keys   rB   r:   )NNN)__name__
__module____qualname____doc__r	   strr
   r9   propertyr>   rA   r)   rF    r:   r8   r   r      s    : $('+7;	NC=N  }N %T#s(^4	N` - -^   6 6p  r:   r   )pinecone.configr   r   pinecone.openapi_supportr   pinecone.core.openapi.oauthr    pinecone.core.openapi.oauth.apisr   "pinecone.core.openapi.oauth.modelsr   typingr	   r
   pinecone.utilsr   r   copyr   r   rM   r:   r8   <module>rV      s,    8 . 3 5 ; ! ) 	 ] ]r:   