Skip to content

Commit 337a9a1

Browse files
authored
Merge pull request #95 from pinecone-io/863989
Update Code
2 parents e1cef58 + ec0a7f9 commit 337a9a1

File tree

7 files changed

+179
-150
lines changed

7 files changed

+179
-150
lines changed

pinecone/core/client/api/index_operations_api.py

Lines changed: 137 additions & 137 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,143 @@ def __init__(self, api_client=None):
4545
api_client = ApiClient()
4646
self.api_client = api_client
4747

48+
def __configure_index(
49+
self,
50+
index_name,
51+
**kwargs
52+
):
53+
"""configure_index # noqa: E501
54+
55+
Configure index to change pod type and number of replicas. # noqa: E501
56+
This method makes a synchronous HTTP request by default. To make an
57+
asynchronous HTTP request, please pass async_req=True
58+
59+
>>> thread = api.configure_index(index_name, async_req=True)
60+
>>> result = thread.get()
61+
62+
Args:
63+
index_name (str): The name of the index
64+
65+
Keyword Args:
66+
patch_request (PatchRequest): The desired configuration changes for the index.. [optional]
67+
_return_http_data_only (bool): response data without head status
68+
code and headers. Default is True.
69+
_preload_content (bool): if False, the urllib3.HTTPResponse object
70+
will be returned without reading/decoding response data.
71+
Default is True.
72+
_request_timeout (int/float/tuple): timeout setting for this request. If
73+
one number provided, it will be total request timeout. It can also
74+
be a pair (tuple) of (connection, read) timeouts.
75+
Default is None.
76+
_check_input_type (bool): specifies if type checking
77+
should be done one the data sent to the server.
78+
Default is True.
79+
_check_return_type (bool): specifies if type checking
80+
should be done one the data received from the server.
81+
Default is True.
82+
_host_index (int/None): specifies the index of the server
83+
that we want to use.
84+
Default is read from the configuration.
85+
async_req (bool): execute request asynchronously
86+
87+
Returns:
88+
str
89+
If the method is called asynchronously, returns the request
90+
thread.
91+
"""
92+
kwargs['async_req'] = kwargs.get(
93+
'async_req', False
94+
)
95+
kwargs['_return_http_data_only'] = kwargs.get(
96+
'_return_http_data_only', True
97+
)
98+
kwargs['_preload_content'] = kwargs.get(
99+
'_preload_content', True
100+
)
101+
kwargs['_request_timeout'] = kwargs.get(
102+
'_request_timeout', None
103+
)
104+
kwargs['_check_input_type'] = kwargs.get(
105+
'_check_input_type', True
106+
)
107+
kwargs['_check_return_type'] = kwargs.get(
108+
'_check_return_type', True
109+
)
110+
kwargs['_host_index'] = kwargs.get('_host_index')
111+
kwargs['index_name'] = \
112+
index_name
113+
return self.call_with_http_info(**kwargs)
114+
115+
self.configure_index = _Endpoint(
116+
settings={
117+
'response_type': (str,),
118+
'auth': [
119+
'ApiKeyAuth'
120+
],
121+
'endpoint_path': '/databases/{indexName}',
122+
'operation_id': 'configure_index',
123+
'http_method': 'PATCH',
124+
'servers': [
125+
{
126+
'url': "https://controller.{environment}.pinecone.io",
127+
'description': "No description provided",
128+
'variables': {
129+
'environment': {
130+
'description': "No description provided",
131+
'default_value': "unknown",
132+
}
133+
}
134+
},
135+
]
136+
},
137+
params_map={
138+
'all': [
139+
'index_name',
140+
'patch_request',
141+
],
142+
'required': [
143+
'index_name',
144+
],
145+
'nullable': [
146+
],
147+
'enum': [
148+
],
149+
'validation': [
150+
]
151+
},
152+
root_map={
153+
'validations': {
154+
},
155+
'allowed_values': {
156+
},
157+
'openapi_types': {
158+
'index_name':
159+
(str,),
160+
'patch_request':
161+
(PatchRequest,),
162+
},
163+
'attribute_map': {
164+
'index_name': 'indexName',
165+
},
166+
'location_map': {
167+
'index_name': 'path',
168+
'patch_request': 'body',
169+
},
170+
'collection_format_map': {
171+
}
172+
},
173+
headers_map={
174+
'accept': [
175+
'text/plain'
176+
],
177+
'content_type': [
178+
'application/json'
179+
]
180+
},
181+
api_client=api_client,
182+
callable=__configure_index
183+
)
184+
48185
def __create_collection(
49186
self,
50187
**kwargs
@@ -1050,140 +1187,3 @@ def __list_indexes(
10501187
api_client=api_client,
10511188
callable=__list_indexes
10521189
)
1053-
1054-
def __scale_index(
1055-
self,
1056-
index_name,
1057-
**kwargs
1058-
):
1059-
"""scale_index # noqa: E501
1060-
1061-
This operation increases or decreases the number of replicas in an index. # noqa: E501
1062-
This method makes a synchronous HTTP request by default. To make an
1063-
asynchronous HTTP request, please pass async_req=True
1064-
1065-
>>> thread = api.scale_index(index_name, async_req=True)
1066-
>>> result = thread.get()
1067-
1068-
Args:
1069-
index_name (str): The name of the index
1070-
1071-
Keyword Args:
1072-
patch_request (PatchRequest): The number of replicas. [optional]
1073-
_return_http_data_only (bool): response data without head status
1074-
code and headers. Default is True.
1075-
_preload_content (bool): if False, the urllib3.HTTPResponse object
1076-
will be returned without reading/decoding response data.
1077-
Default is True.
1078-
_request_timeout (int/float/tuple): timeout setting for this request. If
1079-
one number provided, it will be total request timeout. It can also
1080-
be a pair (tuple) of (connection, read) timeouts.
1081-
Default is None.
1082-
_check_input_type (bool): specifies if type checking
1083-
should be done one the data sent to the server.
1084-
Default is True.
1085-
_check_return_type (bool): specifies if type checking
1086-
should be done one the data received from the server.
1087-
Default is True.
1088-
_host_index (int/None): specifies the index of the server
1089-
that we want to use.
1090-
Default is read from the configuration.
1091-
async_req (bool): execute request asynchronously
1092-
1093-
Returns:
1094-
str
1095-
If the method is called asynchronously, returns the request
1096-
thread.
1097-
"""
1098-
kwargs['async_req'] = kwargs.get(
1099-
'async_req', False
1100-
)
1101-
kwargs['_return_http_data_only'] = kwargs.get(
1102-
'_return_http_data_only', True
1103-
)
1104-
kwargs['_preload_content'] = kwargs.get(
1105-
'_preload_content', True
1106-
)
1107-
kwargs['_request_timeout'] = kwargs.get(
1108-
'_request_timeout', None
1109-
)
1110-
kwargs['_check_input_type'] = kwargs.get(
1111-
'_check_input_type', True
1112-
)
1113-
kwargs['_check_return_type'] = kwargs.get(
1114-
'_check_return_type', True
1115-
)
1116-
kwargs['_host_index'] = kwargs.get('_host_index')
1117-
kwargs['index_name'] = \
1118-
index_name
1119-
return self.call_with_http_info(**kwargs)
1120-
1121-
self.scale_index = _Endpoint(
1122-
settings={
1123-
'response_type': (str,),
1124-
'auth': [
1125-
'ApiKeyAuth'
1126-
],
1127-
'endpoint_path': '/databases/{indexName}',
1128-
'operation_id': 'scale_index',
1129-
'http_method': 'PATCH',
1130-
'servers': [
1131-
{
1132-
'url': "https://controller.{environment}.pinecone.io",
1133-
'description': "No description provided",
1134-
'variables': {
1135-
'environment': {
1136-
'description': "No description provided",
1137-
'default_value': "unknown",
1138-
}
1139-
}
1140-
},
1141-
]
1142-
},
1143-
params_map={
1144-
'all': [
1145-
'index_name',
1146-
'patch_request',
1147-
],
1148-
'required': [
1149-
'index_name',
1150-
],
1151-
'nullable': [
1152-
],
1153-
'enum': [
1154-
],
1155-
'validation': [
1156-
]
1157-
},
1158-
root_map={
1159-
'validations': {
1160-
},
1161-
'allowed_values': {
1162-
},
1163-
'openapi_types': {
1164-
'index_name':
1165-
(str,),
1166-
'patch_request':
1167-
(PatchRequest,),
1168-
},
1169-
'attribute_map': {
1170-
'index_name': 'indexName',
1171-
},
1172-
'location_map': {
1173-
'index_name': 'path',
1174-
'patch_request': 'body',
1175-
},
1176-
'collection_format_map': {
1177-
}
1178-
},
1179-
headers_map={
1180-
'accept': [
1181-
'text/plain'
1182-
],
1183-
'content_type': [
1184-
'application/json'
1185-
]
1186-
},
1187-
api_client=api_client,
1188-
callable=__scale_index
1189-
)

pinecone/core/client/api_client.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -767,10 +767,10 @@ def __call__(self, *args, **kwargs):
767767
Example:
768768
769769
api_instance = IndexOperationsApi()
770-
api_instance.create_collection # this is an instance of the class Endpoint
771-
api_instance.create_collection() # this invokes api_instance.create_collection.__call__()
770+
api_instance.configure_index # this is an instance of the class Endpoint
771+
api_instance.configure_index() # this invokes api_instance.configure_index.__call__()
772772
which then invokes the callable functions stored in that endpoint at
773-
api_instance.create_collection.callable or self.callable in this class
773+
api_instance.configure_index.callable or self.callable in this class
774774
775775
"""
776776
return self.callable(self, *args, **kwargs)

pinecone/core/client/model/create_collection_request.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44

55
"""
66
Pinecone API
7+
78
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501
9+
810
The version of the OpenAPI document: version not set
911
1012
Generated by: https://openapi-generator.tech
@@ -36,7 +38,9 @@
3638
class CreateCollectionRequest(ModelNormal):
3739
"""NOTE: This class is auto generated by OpenAPI Generator.
3840
Ref: https://openapi-generator.tech
41+
3942
Do not edit the class manually.
43+
4044
Attributes:
4145
allowed_values (dict): The key is the tuple path to the attribute
4246
and the for var_name this is (var_name,). The value is a dict
@@ -76,6 +80,7 @@ def openapi_types():
7680
"""
7781
This must be a method because a model may have properties that are
7882
of type self, this must run after the class is loaded
83+
7984
Returns
8085
openapi_types (dict): The key is attribute name
8186
and the value is attribute type.
@@ -104,9 +109,11 @@ def discriminator():
104109
@convert_js_args_to_python_args
105110
def _from_openapi_data(cls, name, source, *args, **kwargs): # noqa: E501
106111
"""CreateCollectionRequest - a model defined in OpenAPI
112+
107113
Args:
108114
name (str): The name of the collection to be created.
109115
source (str): The name of the source index to be used as the source for the collection.
116+
110117
Keyword Args:
111118
_check_type (bool): if True, values for parameters in openapi_types
112119
will be type checked and a TypeError will be
@@ -189,9 +196,11 @@ def _from_openapi_data(cls, name, source, *args, **kwargs): # noqa: E501
189196
@convert_js_args_to_python_args
190197
def __init__(self, name, source, *args, **kwargs): # noqa: E501
191198
"""CreateCollectionRequest - a model defined in OpenAPI
199+
192200
Args:
193201
name (str): The name of the collection to be created.
194202
source (str): The name of the source index to be used as the source for the collection.
203+
195204
Keyword Args:
196205
_check_type (bool): if True, values for parameters in openapi_types
197206
will be type checked and a TypeError will be
@@ -260,4 +269,4 @@ def __init__(self, name, source, *args, **kwargs): # noqa: E501
260269
setattr(self, var_name, var_value)
261270
if var_name in self.read_only_vars:
262271
raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate "
263-
f"class with read only attributes.")
272+
f"class with read only attributes.")

pinecone/core/client/model/create_request.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ def _from_openapi_data(cls, name, dimension, *args, **kwargs): # noqa: E501
129129
"""CreateRequest - a model defined in OpenAPI
130130
131131
Args:
132-
name (str): The name of the index to be created. The maximum length is 50 characters.
132+
name (str): The name of the index to be created. The maximum length is 45 characters.
133133
dimension (int): The dimensions of the vectors to be inserted in the index
134134
135135
Keyword Args:
@@ -225,7 +225,7 @@ def __init__(self, name, dimension, *args, **kwargs): # noqa: E501
225225
"""CreateRequest - a model defined in OpenAPI
226226
227227
Args:
228-
name (str): The name of the index to be created. The maximum length is 50 characters.
228+
name (str): The name of the index to be created. The maximum length is 45 characters.
229229
dimension (int): The dimensions of the vectors to be inserted in the index
230230
231231
Keyword Args:

0 commit comments

Comments
 (0)