gsctl 0.29.0a20250114__py2.py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
Files changed (117) hide show
  1. graphscope/flex/rest/__init__.py +106 -0
  2. graphscope/flex/rest/api/__init__.py +12 -0
  3. graphscope/flex/rest/api/alert_api.py +2790 -0
  4. graphscope/flex/rest/api/data_source_api.py +1177 -0
  5. graphscope/flex/rest/api/deployment_api.py +1323 -0
  6. graphscope/flex/rest/api/graph_api.py +2813 -0
  7. graphscope/flex/rest/api/job_api.py +1408 -0
  8. graphscope/flex/rest/api/service_api.py +1316 -0
  9. graphscope/flex/rest/api/stored_procedure_api.py +1454 -0
  10. graphscope/flex/rest/api/utils_api.py +310 -0
  11. graphscope/flex/rest/api_client.py +789 -0
  12. graphscope/flex/rest/api_response.py +21 -0
  13. graphscope/flex/rest/configuration.py +451 -0
  14. graphscope/flex/rest/exceptions.py +200 -0
  15. graphscope/flex/rest/models/__init__.py +82 -0
  16. graphscope/flex/rest/models/base_edge_type.py +102 -0
  17. graphscope/flex/rest/models/base_edge_type_vertex_type_pair_relations_inner.py +108 -0
  18. graphscope/flex/rest/models/base_edge_type_vertex_type_pair_relations_inner_x_csr_params.py +98 -0
  19. graphscope/flex/rest/models/base_property_meta.py +105 -0
  20. graphscope/flex/rest/models/base_vertex_type.py +96 -0
  21. graphscope/flex/rest/models/base_vertex_type_x_csr_params.py +88 -0
  22. graphscope/flex/rest/models/column_mapping.py +94 -0
  23. graphscope/flex/rest/models/column_mapping_column.py +90 -0
  24. graphscope/flex/rest/models/create_alert_receiver_request.py +103 -0
  25. graphscope/flex/rest/models/create_alert_rule_request.py +112 -0
  26. graphscope/flex/rest/models/create_dataloading_job_response.py +88 -0
  27. graphscope/flex/rest/models/create_edge_type.py +114 -0
  28. graphscope/flex/rest/models/create_graph_request.py +106 -0
  29. graphscope/flex/rest/models/create_graph_response.py +88 -0
  30. graphscope/flex/rest/models/create_graph_schema_request.py +106 -0
  31. graphscope/flex/rest/models/create_property_meta.py +105 -0
  32. graphscope/flex/rest/models/create_stored_proc_request.py +101 -0
  33. graphscope/flex/rest/models/create_stored_proc_response.py +88 -0
  34. graphscope/flex/rest/models/create_vertex_type.py +108 -0
  35. graphscope/flex/rest/models/dataloading_job_config.py +136 -0
  36. graphscope/flex/rest/models/dataloading_job_config_edges_inner.py +92 -0
  37. graphscope/flex/rest/models/dataloading_job_config_loading_config.py +104 -0
  38. graphscope/flex/rest/models/dataloading_job_config_loading_config_format.py +90 -0
  39. graphscope/flex/rest/models/dataloading_job_config_vertices_inner.py +88 -0
  40. graphscope/flex/rest/models/dataloading_mr_job_config.py +88 -0
  41. graphscope/flex/rest/models/date_type.py +88 -0
  42. graphscope/flex/rest/models/edge_mapping.py +122 -0
  43. graphscope/flex/rest/models/edge_mapping_type_triplet.py +92 -0
  44. graphscope/flex/rest/models/error.py +90 -0
  45. graphscope/flex/rest/models/get_alert_message_response.py +123 -0
  46. graphscope/flex/rest/models/get_alert_receiver_response.py +107 -0
  47. graphscope/flex/rest/models/get_alert_rule_response.py +114 -0
  48. graphscope/flex/rest/models/get_edge_type.py +116 -0
  49. graphscope/flex/rest/models/get_graph_response.py +139 -0
  50. graphscope/flex/rest/models/get_graph_schema_response.py +106 -0
  51. graphscope/flex/rest/models/get_pod_log_response.py +88 -0
  52. graphscope/flex/rest/models/get_property_meta.py +107 -0
  53. graphscope/flex/rest/models/get_resource_usage_response.py +105 -0
  54. graphscope/flex/rest/models/get_storage_usage_response.py +88 -0
  55. graphscope/flex/rest/models/get_stored_proc_response.py +130 -0
  56. graphscope/flex/rest/models/get_vertex_type.py +110 -0
  57. graphscope/flex/rest/models/gs_data_type.py +152 -0
  58. graphscope/flex/rest/models/job_status.py +107 -0
  59. graphscope/flex/rest/models/long_text.py +93 -0
  60. graphscope/flex/rest/models/node_status.py +94 -0
  61. graphscope/flex/rest/models/parameter.py +96 -0
  62. graphscope/flex/rest/models/pod_status.py +108 -0
  63. graphscope/flex/rest/models/primitive_type.py +95 -0
  64. graphscope/flex/rest/models/resource_usage.py +92 -0
  65. graphscope/flex/rest/models/running_deployment_info.py +128 -0
  66. graphscope/flex/rest/models/running_deployment_status.py +124 -0
  67. graphscope/flex/rest/models/schema_mapping.py +106 -0
  68. graphscope/flex/rest/models/service_status.py +112 -0
  69. graphscope/flex/rest/models/service_status_sdk_endpoints.py +94 -0
  70. graphscope/flex/rest/models/start_service_request.py +88 -0
  71. graphscope/flex/rest/models/stored_procedure_meta.py +126 -0
  72. graphscope/flex/rest/models/string_type.py +92 -0
  73. graphscope/flex/rest/models/string_type_string.py +124 -0
  74. graphscope/flex/rest/models/temporal_type.py +92 -0
  75. graphscope/flex/rest/models/temporal_type_temporal.py +138 -0
  76. graphscope/flex/rest/models/time_stamp_type.py +88 -0
  77. graphscope/flex/rest/models/update_alert_message_status_request.py +97 -0
  78. graphscope/flex/rest/models/update_stored_proc_request.py +88 -0
  79. graphscope/flex/rest/models/upload_file_response.py +90 -0
  80. graphscope/flex/rest/models/vertex_mapping.py +100 -0
  81. graphscope/flex/rest/py.typed +0 -0
  82. graphscope/flex/rest/rest.py +258 -0
  83. graphscope/gsctl/V6D_VERSION +1 -0
  84. graphscope/gsctl/VERSION +1 -0
  85. graphscope/gsctl/__init__.py +22 -0
  86. graphscope/gsctl/commands/__init__.py +148 -0
  87. graphscope/gsctl/commands/common.py +200 -0
  88. graphscope/gsctl/commands/dev.py +448 -0
  89. graphscope/gsctl/commands/insight/__init__.py +17 -0
  90. graphscope/gsctl/commands/insight/glob.py +234 -0
  91. graphscope/gsctl/commands/insight/graph.py +205 -0
  92. graphscope/gsctl/commands/interactive/__init__.py +17 -0
  93. graphscope/gsctl/commands/interactive/glob.py +280 -0
  94. graphscope/gsctl/commands/interactive/graph.py +259 -0
  95. graphscope/gsctl/config.py +221 -0
  96. graphscope/gsctl/gsctl.py +51 -0
  97. graphscope/gsctl/impl/__init__.py +64 -0
  98. graphscope/gsctl/impl/alert.py +135 -0
  99. graphscope/gsctl/impl/common.py +53 -0
  100. graphscope/gsctl/impl/datasource.py +80 -0
  101. graphscope/gsctl/impl/deployment.py +62 -0
  102. graphscope/gsctl/impl/graph.py +150 -0
  103. graphscope/gsctl/impl/job.py +63 -0
  104. graphscope/gsctl/impl/service.py +62 -0
  105. graphscope/gsctl/impl/stored_procedure.py +92 -0
  106. graphscope/gsctl/impl/utils.py +38 -0
  107. graphscope/gsctl/scripts/install_deps.sh +969 -0
  108. graphscope/gsctl/tests/__init__.py +17 -0
  109. graphscope/gsctl/tests/test_graphscope_insight.py +401 -0
  110. graphscope/gsctl/tests/test_interactive.py +516 -0
  111. graphscope/gsctl/utils.py +337 -0
  112. graphscope/gsctl/version.py +31 -0
  113. gsctl-0.29.0a20250114.dist-info/METADATA +20 -0
  114. gsctl-0.29.0a20250114.dist-info/RECORD +117 -0
  115. gsctl-0.29.0a20250114.dist-info/WHEEL +6 -0
  116. gsctl-0.29.0a20250114.dist-info/entry_points.txt +3 -0
  117. gsctl-0.29.0a20250114.dist-info/top_level.txt +1 -0
@@ -0,0 +1,107 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ GraphScope FLEX HTTP SERVICE API
5
+
6
+ This is a specification for GraphScope FLEX HTTP service based on the OpenAPI 3.0 specification. You can find out more details about specification at [doc](https://swagger.io/specification/v3/).
7
+
8
+ The version of the OpenAPI document: 1.0.0
9
+ Contact: graphscope@alibaba-inc.com
10
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
11
+
12
+ Do not edit the class manually.
13
+ """ # noqa: E501
14
+
15
+
16
+ from __future__ import annotations
17
+ import pprint
18
+ import re # noqa: F401
19
+ import json
20
+
21
+ from pydantic import BaseModel, ConfigDict, StrictBool, StrictInt, StrictStr
22
+ from typing import Any, ClassVar, Dict, List, Optional
23
+ from graphscope.flex.rest.models.gs_data_type import GSDataType
24
+ from typing import Optional, Set
25
+ from typing_extensions import Self
26
+
27
+ class GetPropertyMeta(BaseModel):
28
+ """
29
+ GetPropertyMeta
30
+ """ # noqa: E501
31
+ property_name: StrictStr
32
+ property_type: GSDataType
33
+ nullable: Optional[StrictBool] = None
34
+ default_value: Optional[Any] = None
35
+ description: Optional[StrictStr] = None
36
+ property_id: StrictInt
37
+ __properties: ClassVar[List[str]] = ["property_name", "property_type", "nullable", "default_value", "description", "property_id"]
38
+
39
+ model_config = ConfigDict(
40
+ populate_by_name=True,
41
+ validate_assignment=True,
42
+ protected_namespaces=(),
43
+ )
44
+
45
+
46
+ def to_str(self) -> str:
47
+ """Returns the string representation of the model using alias"""
48
+ return pprint.pformat(self.model_dump(by_alias=True))
49
+
50
+ def to_json(self) -> str:
51
+ """Returns the JSON representation of the model using alias"""
52
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
53
+ return json.dumps(self.to_dict())
54
+
55
+ @classmethod
56
+ def from_json(cls, json_str: str) -> Optional[Self]:
57
+ """Create an instance of GetPropertyMeta from a JSON string"""
58
+ return cls.from_dict(json.loads(json_str))
59
+
60
+ def to_dict(self) -> Dict[str, Any]:
61
+ """Return the dictionary representation of the model using alias.
62
+
63
+ This has the following differences from calling pydantic's
64
+ `self.model_dump(by_alias=True)`:
65
+
66
+ * `None` is only added to the output dict for nullable fields that
67
+ were set at model initialization. Other fields with value `None`
68
+ are ignored.
69
+ """
70
+ excluded_fields: Set[str] = set([
71
+ ])
72
+
73
+ _dict = self.model_dump(
74
+ by_alias=True,
75
+ exclude=excluded_fields,
76
+ exclude_none=True,
77
+ )
78
+ # override the default output from pydantic by calling `to_dict()` of property_type
79
+ if self.property_type:
80
+ _dict['property_type'] = self.property_type.to_dict()
81
+ # set to None if default_value (nullable) is None
82
+ # and model_fields_set contains the field
83
+ if self.default_value is None and "default_value" in self.model_fields_set:
84
+ _dict['default_value'] = None
85
+
86
+ return _dict
87
+
88
+ @classmethod
89
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
90
+ """Create an instance of GetPropertyMeta from a dict"""
91
+ if obj is None:
92
+ return None
93
+
94
+ if not isinstance(obj, dict):
95
+ return cls.model_validate(obj)
96
+
97
+ _obj = cls.model_validate({
98
+ "property_name": obj.get("property_name"),
99
+ "property_type": GSDataType.from_dict(obj["property_type"]) if obj.get("property_type") is not None else None,
100
+ "nullable": obj.get("nullable"),
101
+ "default_value": obj.get("default_value"),
102
+ "description": obj.get("description"),
103
+ "property_id": obj.get("property_id")
104
+ })
105
+ return _obj
106
+
107
+
@@ -0,0 +1,105 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ GraphScope FLEX HTTP SERVICE API
5
+
6
+ This is a specification for GraphScope FLEX HTTP service based on the OpenAPI 3.0 specification. You can find out more details about specification at [doc](https://swagger.io/specification/v3/).
7
+
8
+ The version of the OpenAPI document: 1.0.0
9
+ Contact: graphscope@alibaba-inc.com
10
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
11
+
12
+ Do not edit the class manually.
13
+ """ # noqa: E501
14
+
15
+
16
+ from __future__ import annotations
17
+ import pprint
18
+ import re # noqa: F401
19
+ import json
20
+
21
+ from pydantic import BaseModel, ConfigDict
22
+ from typing import Any, ClassVar, Dict, List
23
+ from graphscope.flex.rest.models.resource_usage import ResourceUsage
24
+ from typing import Optional, Set
25
+ from typing_extensions import Self
26
+
27
+ class GetResourceUsageResponse(BaseModel):
28
+ """
29
+ GetResourceUsageResponse
30
+ """ # noqa: E501
31
+ cpu_usage: List[ResourceUsage]
32
+ memory_usage: List[ResourceUsage]
33
+ __properties: ClassVar[List[str]] = ["cpu_usage", "memory_usage"]
34
+
35
+ model_config = ConfigDict(
36
+ populate_by_name=True,
37
+ validate_assignment=True,
38
+ protected_namespaces=(),
39
+ )
40
+
41
+
42
+ def to_str(self) -> str:
43
+ """Returns the string representation of the model using alias"""
44
+ return pprint.pformat(self.model_dump(by_alias=True))
45
+
46
+ def to_json(self) -> str:
47
+ """Returns the JSON representation of the model using alias"""
48
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
49
+ return json.dumps(self.to_dict())
50
+
51
+ @classmethod
52
+ def from_json(cls, json_str: str) -> Optional[Self]:
53
+ """Create an instance of GetResourceUsageResponse from a JSON string"""
54
+ return cls.from_dict(json.loads(json_str))
55
+
56
+ def to_dict(self) -> Dict[str, Any]:
57
+ """Return the dictionary representation of the model using alias.
58
+
59
+ This has the following differences from calling pydantic's
60
+ `self.model_dump(by_alias=True)`:
61
+
62
+ * `None` is only added to the output dict for nullable fields that
63
+ were set at model initialization. Other fields with value `None`
64
+ are ignored.
65
+ """
66
+ excluded_fields: Set[str] = set([
67
+ ])
68
+
69
+ _dict = self.model_dump(
70
+ by_alias=True,
71
+ exclude=excluded_fields,
72
+ exclude_none=True,
73
+ )
74
+ # override the default output from pydantic by calling `to_dict()` of each item in cpu_usage (list)
75
+ _items = []
76
+ if self.cpu_usage:
77
+ for _item_cpu_usage in self.cpu_usage:
78
+ if _item_cpu_usage:
79
+ _items.append(_item_cpu_usage.to_dict())
80
+ _dict['cpu_usage'] = _items
81
+ # override the default output from pydantic by calling `to_dict()` of each item in memory_usage (list)
82
+ _items = []
83
+ if self.memory_usage:
84
+ for _item_memory_usage in self.memory_usage:
85
+ if _item_memory_usage:
86
+ _items.append(_item_memory_usage.to_dict())
87
+ _dict['memory_usage'] = _items
88
+ return _dict
89
+
90
+ @classmethod
91
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
92
+ """Create an instance of GetResourceUsageResponse from a dict"""
93
+ if obj is None:
94
+ return None
95
+
96
+ if not isinstance(obj, dict):
97
+ return cls.model_validate(obj)
98
+
99
+ _obj = cls.model_validate({
100
+ "cpu_usage": [ResourceUsage.from_dict(_item) for _item in obj["cpu_usage"]] if obj.get("cpu_usage") is not None else None,
101
+ "memory_usage": [ResourceUsage.from_dict(_item) for _item in obj["memory_usage"]] if obj.get("memory_usage") is not None else None
102
+ })
103
+ return _obj
104
+
105
+
@@ -0,0 +1,88 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ GraphScope FLEX HTTP SERVICE API
5
+
6
+ This is a specification for GraphScope FLEX HTTP service based on the OpenAPI 3.0 specification. You can find out more details about specification at [doc](https://swagger.io/specification/v3/).
7
+
8
+ The version of the OpenAPI document: 1.0.0
9
+ Contact: graphscope@alibaba-inc.com
10
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
11
+
12
+ Do not edit the class manually.
13
+ """ # noqa: E501
14
+
15
+
16
+ from __future__ import annotations
17
+ import pprint
18
+ import re # noqa: F401
19
+ import json
20
+
21
+ from pydantic import BaseModel, ConfigDict, StrictFloat, StrictInt
22
+ from typing import Any, ClassVar, Dict, List, Union
23
+ from typing import Optional, Set
24
+ from typing_extensions import Self
25
+
26
+ class GetStorageUsageResponse(BaseModel):
27
+ """
28
+ GetStorageUsageResponse
29
+ """ # noqa: E501
30
+ storage_usage: Dict[str, Union[StrictFloat, StrictInt]]
31
+ __properties: ClassVar[List[str]] = ["storage_usage"]
32
+
33
+ model_config = ConfigDict(
34
+ populate_by_name=True,
35
+ validate_assignment=True,
36
+ protected_namespaces=(),
37
+ )
38
+
39
+
40
+ def to_str(self) -> str:
41
+ """Returns the string representation of the model using alias"""
42
+ return pprint.pformat(self.model_dump(by_alias=True))
43
+
44
+ def to_json(self) -> str:
45
+ """Returns the JSON representation of the model using alias"""
46
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
47
+ return json.dumps(self.to_dict())
48
+
49
+ @classmethod
50
+ def from_json(cls, json_str: str) -> Optional[Self]:
51
+ """Create an instance of GetStorageUsageResponse from a JSON string"""
52
+ return cls.from_dict(json.loads(json_str))
53
+
54
+ def to_dict(self) -> Dict[str, Any]:
55
+ """Return the dictionary representation of the model using alias.
56
+
57
+ This has the following differences from calling pydantic's
58
+ `self.model_dump(by_alias=True)`:
59
+
60
+ * `None` is only added to the output dict for nullable fields that
61
+ were set at model initialization. Other fields with value `None`
62
+ are ignored.
63
+ """
64
+ excluded_fields: Set[str] = set([
65
+ ])
66
+
67
+ _dict = self.model_dump(
68
+ by_alias=True,
69
+ exclude=excluded_fields,
70
+ exclude_none=True,
71
+ )
72
+ return _dict
73
+
74
+ @classmethod
75
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
76
+ """Create an instance of GetStorageUsageResponse from a dict"""
77
+ if obj is None:
78
+ return None
79
+
80
+ if not isinstance(obj, dict):
81
+ return cls.model_validate(obj)
82
+
83
+ _obj = cls.model_validate({
84
+ "storage_usage": obj.get("storage_usage")
85
+ })
86
+ return _obj
87
+
88
+
@@ -0,0 +1,130 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ GraphScope FLEX HTTP SERVICE API
5
+
6
+ This is a specification for GraphScope FLEX HTTP service based on the OpenAPI 3.0 specification. You can find out more details about specification at [doc](https://swagger.io/specification/v3/).
7
+
8
+ The version of the OpenAPI document: 1.0.0
9
+ Contact: graphscope@alibaba-inc.com
10
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
11
+
12
+ Do not edit the class manually.
13
+ """ # noqa: E501
14
+
15
+
16
+ from __future__ import annotations
17
+ import pprint
18
+ import re # noqa: F401
19
+ import json
20
+
21
+ from pydantic import BaseModel, ConfigDict, StrictBool, StrictStr, field_validator
22
+ from typing import Any, ClassVar, Dict, List, Optional
23
+ from graphscope.flex.rest.models.parameter import Parameter
24
+ from typing import Optional, Set
25
+ from typing_extensions import Self
26
+
27
+ class GetStoredProcResponse(BaseModel):
28
+ """
29
+ GetStoredProcResponse
30
+ """ # noqa: E501
31
+ name: StrictStr
32
+ description: Optional[StrictStr] = None
33
+ type: StrictStr
34
+ query: StrictStr
35
+ id: StrictStr
36
+ library: StrictStr
37
+ params: List[Parameter]
38
+ returns: List[Parameter]
39
+ option: Optional[Dict[str, Any]] = None
40
+ bound_graph: StrictStr
41
+ runnable: StrictBool
42
+ __properties: ClassVar[List[str]] = ["name", "description", "type", "query", "id", "library", "params", "returns", "option", "bound_graph", "runnable"]
43
+
44
+ @field_validator('type')
45
+ def type_validate_enum(cls, value):
46
+ """Validates the enum"""
47
+ if value not in set(['cpp', 'cypher']):
48
+ raise ValueError("must be one of enum values ('cpp', 'cypher')")
49
+ return value
50
+
51
+ model_config = ConfigDict(
52
+ populate_by_name=True,
53
+ validate_assignment=True,
54
+ protected_namespaces=(),
55
+ )
56
+
57
+
58
+ def to_str(self) -> str:
59
+ """Returns the string representation of the model using alias"""
60
+ return pprint.pformat(self.model_dump(by_alias=True))
61
+
62
+ def to_json(self) -> str:
63
+ """Returns the JSON representation of the model using alias"""
64
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
65
+ return json.dumps(self.to_dict())
66
+
67
+ @classmethod
68
+ def from_json(cls, json_str: str) -> Optional[Self]:
69
+ """Create an instance of GetStoredProcResponse from a JSON string"""
70
+ return cls.from_dict(json.loads(json_str))
71
+
72
+ def to_dict(self) -> Dict[str, Any]:
73
+ """Return the dictionary representation of the model using alias.
74
+
75
+ This has the following differences from calling pydantic's
76
+ `self.model_dump(by_alias=True)`:
77
+
78
+ * `None` is only added to the output dict for nullable fields that
79
+ were set at model initialization. Other fields with value `None`
80
+ are ignored.
81
+ """
82
+ excluded_fields: Set[str] = set([
83
+ ])
84
+
85
+ _dict = self.model_dump(
86
+ by_alias=True,
87
+ exclude=excluded_fields,
88
+ exclude_none=True,
89
+ )
90
+ # override the default output from pydantic by calling `to_dict()` of each item in params (list)
91
+ _items = []
92
+ if self.params:
93
+ for _item_params in self.params:
94
+ if _item_params:
95
+ _items.append(_item_params.to_dict())
96
+ _dict['params'] = _items
97
+ # override the default output from pydantic by calling `to_dict()` of each item in returns (list)
98
+ _items = []
99
+ if self.returns:
100
+ for _item_returns in self.returns:
101
+ if _item_returns:
102
+ _items.append(_item_returns.to_dict())
103
+ _dict['returns'] = _items
104
+ return _dict
105
+
106
+ @classmethod
107
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
108
+ """Create an instance of GetStoredProcResponse from a dict"""
109
+ if obj is None:
110
+ return None
111
+
112
+ if not isinstance(obj, dict):
113
+ return cls.model_validate(obj)
114
+
115
+ _obj = cls.model_validate({
116
+ "name": obj.get("name"),
117
+ "description": obj.get("description"),
118
+ "type": obj.get("type"),
119
+ "query": obj.get("query"),
120
+ "id": obj.get("id"),
121
+ "library": obj.get("library"),
122
+ "params": [Parameter.from_dict(_item) for _item in obj["params"]] if obj.get("params") is not None else None,
123
+ "returns": [Parameter.from_dict(_item) for _item in obj["returns"]] if obj.get("returns") is not None else None,
124
+ "option": obj.get("option"),
125
+ "bound_graph": obj.get("bound_graph"),
126
+ "runnable": obj.get("runnable")
127
+ })
128
+ return _obj
129
+
130
+
@@ -0,0 +1,110 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ GraphScope FLEX HTTP SERVICE API
5
+
6
+ This is a specification for GraphScope FLEX HTTP service based on the OpenAPI 3.0 specification. You can find out more details about specification at [doc](https://swagger.io/specification/v3/).
7
+
8
+ The version of the OpenAPI document: 1.0.0
9
+ Contact: graphscope@alibaba-inc.com
10
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
11
+
12
+ Do not edit the class manually.
13
+ """ # noqa: E501
14
+
15
+
16
+ from __future__ import annotations
17
+ import pprint
18
+ import re # noqa: F401
19
+ import json
20
+
21
+ from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr
22
+ from typing import Any, ClassVar, Dict, List, Optional
23
+ from graphscope.flex.rest.models.base_vertex_type_x_csr_params import BaseVertexTypeXCsrParams
24
+ from graphscope.flex.rest.models.get_property_meta import GetPropertyMeta
25
+ from typing import Optional, Set
26
+ from typing_extensions import Self
27
+
28
+ class GetVertexType(BaseModel):
29
+ """
30
+ GetVertexType
31
+ """ # noqa: E501
32
+ type_name: StrictStr
33
+ primary_keys: List[StrictStr]
34
+ x_csr_params: Optional[BaseVertexTypeXCsrParams] = None
35
+ type_id: Optional[StrictInt] = None
36
+ properties: List[GetPropertyMeta]
37
+ description: Optional[StrictStr] = None
38
+ __properties: ClassVar[List[str]] = ["type_name", "primary_keys", "x_csr_params", "type_id", "properties", "description"]
39
+
40
+ model_config = ConfigDict(
41
+ populate_by_name=True,
42
+ validate_assignment=True,
43
+ protected_namespaces=(),
44
+ )
45
+
46
+
47
+ def to_str(self) -> str:
48
+ """Returns the string representation of the model using alias"""
49
+ return pprint.pformat(self.model_dump(by_alias=True))
50
+
51
+ def to_json(self) -> str:
52
+ """Returns the JSON representation of the model using alias"""
53
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
54
+ return json.dumps(self.to_dict())
55
+
56
+ @classmethod
57
+ def from_json(cls, json_str: str) -> Optional[Self]:
58
+ """Create an instance of GetVertexType from a JSON string"""
59
+ return cls.from_dict(json.loads(json_str))
60
+
61
+ def to_dict(self) -> Dict[str, Any]:
62
+ """Return the dictionary representation of the model using alias.
63
+
64
+ This has the following differences from calling pydantic's
65
+ `self.model_dump(by_alias=True)`:
66
+
67
+ * `None` is only added to the output dict for nullable fields that
68
+ were set at model initialization. Other fields with value `None`
69
+ are ignored.
70
+ """
71
+ excluded_fields: Set[str] = set([
72
+ ])
73
+
74
+ _dict = self.model_dump(
75
+ by_alias=True,
76
+ exclude=excluded_fields,
77
+ exclude_none=True,
78
+ )
79
+ # override the default output from pydantic by calling `to_dict()` of x_csr_params
80
+ if self.x_csr_params:
81
+ _dict['x_csr_params'] = self.x_csr_params.to_dict()
82
+ # override the default output from pydantic by calling `to_dict()` of each item in properties (list)
83
+ _items = []
84
+ if self.properties:
85
+ for _item_properties in self.properties:
86
+ if _item_properties:
87
+ _items.append(_item_properties.to_dict())
88
+ _dict['properties'] = _items
89
+ return _dict
90
+
91
+ @classmethod
92
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
93
+ """Create an instance of GetVertexType from a dict"""
94
+ if obj is None:
95
+ return None
96
+
97
+ if not isinstance(obj, dict):
98
+ return cls.model_validate(obj)
99
+
100
+ _obj = cls.model_validate({
101
+ "type_name": obj.get("type_name"),
102
+ "primary_keys": obj.get("primary_keys"),
103
+ "x_csr_params": BaseVertexTypeXCsrParams.from_dict(obj["x_csr_params"]) if obj.get("x_csr_params") is not None else None,
104
+ "type_id": obj.get("type_id"),
105
+ "properties": [GetPropertyMeta.from_dict(_item) for _item in obj["properties"]] if obj.get("properties") is not None else None,
106
+ "description": obj.get("description")
107
+ })
108
+ return _obj
109
+
110
+
@@ -0,0 +1,152 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ GraphScope FLEX HTTP SERVICE API
5
+
6
+ This is a specification for GraphScope FLEX HTTP service based on the OpenAPI 3.0 specification. You can find out more details about specification at [doc](https://swagger.io/specification/v3/).
7
+
8
+ The version of the OpenAPI document: 1.0.0
9
+ Contact: graphscope@alibaba-inc.com
10
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
11
+
12
+ Do not edit the class manually.
13
+ """ # noqa: E501
14
+
15
+
16
+ from __future__ import annotations
17
+ import json
18
+ import pprint
19
+ from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, field_validator
20
+ from typing import Any, List, Optional
21
+ from graphscope.flex.rest.models.primitive_type import PrimitiveType
22
+ from graphscope.flex.rest.models.string_type import StringType
23
+ from graphscope.flex.rest.models.temporal_type import TemporalType
24
+ from pydantic import StrictStr, Field
25
+ from typing import Union, List, Set, Optional, Dict
26
+ from typing_extensions import Literal, Self
27
+
28
+ GSDATATYPE_ONE_OF_SCHEMAS = ["PrimitiveType", "StringType", "TemporalType"]
29
+
30
+ class GSDataType(BaseModel):
31
+ """
32
+ GSDataType
33
+ """
34
+ # data type: PrimitiveType
35
+ oneof_schema_1_validator: Optional[PrimitiveType] = None
36
+ # data type: StringType
37
+ oneof_schema_2_validator: Optional[StringType] = None
38
+ # data type: TemporalType
39
+ oneof_schema_3_validator: Optional[TemporalType] = None
40
+ actual_instance: Optional[Union[PrimitiveType, StringType, TemporalType]] = None
41
+ one_of_schemas: Set[str] = { "PrimitiveType", "StringType", "TemporalType" }
42
+
43
+ model_config = ConfigDict(
44
+ validate_assignment=True,
45
+ protected_namespaces=(),
46
+ )
47
+
48
+
49
+ def __init__(self, *args, **kwargs) -> None:
50
+ if args:
51
+ if len(args) > 1:
52
+ raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`")
53
+ if kwargs:
54
+ raise ValueError("If a position argument is used, keyword arguments cannot be used.")
55
+ super().__init__(actual_instance=args[0])
56
+ else:
57
+ super().__init__(**kwargs)
58
+
59
+ @field_validator('actual_instance')
60
+ def actual_instance_must_validate_oneof(cls, v):
61
+ instance = GSDataType.model_construct()
62
+ error_messages = []
63
+ match = 0
64
+ # validate data type: PrimitiveType
65
+ if not isinstance(v, PrimitiveType):
66
+ error_messages.append(f"Error! Input type `{type(v)}` is not `PrimitiveType`")
67
+ else:
68
+ match += 1
69
+ # validate data type: StringType
70
+ if not isinstance(v, StringType):
71
+ error_messages.append(f"Error! Input type `{type(v)}` is not `StringType`")
72
+ else:
73
+ match += 1
74
+ # validate data type: TemporalType
75
+ if not isinstance(v, TemporalType):
76
+ error_messages.append(f"Error! Input type `{type(v)}` is not `TemporalType`")
77
+ else:
78
+ match += 1
79
+ if match > 1:
80
+ # more than 1 match
81
+ raise ValueError("Multiple matches found when setting `actual_instance` in GSDataType with oneOf schemas: PrimitiveType, StringType, TemporalType. Details: " + ", ".join(error_messages))
82
+ elif match == 0:
83
+ # no match
84
+ raise ValueError("No match found when setting `actual_instance` in GSDataType with oneOf schemas: PrimitiveType, StringType, TemporalType. Details: " + ", ".join(error_messages))
85
+ else:
86
+ return v
87
+
88
+ @classmethod
89
+ def from_dict(cls, obj: Union[str, Dict[str, Any]]) -> Self:
90
+ return cls.from_json(json.dumps(obj))
91
+
92
+ @classmethod
93
+ def from_json(cls, json_str: str) -> Self:
94
+ """Returns the object represented by the json string"""
95
+ instance = cls.model_construct()
96
+ error_messages = []
97
+ match = 0
98
+
99
+ # deserialize data into PrimitiveType
100
+ try:
101
+ instance.actual_instance = PrimitiveType.from_json(json_str)
102
+ match += 1
103
+ except (ValidationError, ValueError) as e:
104
+ error_messages.append(str(e))
105
+ # deserialize data into StringType
106
+ try:
107
+ instance.actual_instance = StringType.from_json(json_str)
108
+ match += 1
109
+ except (ValidationError, ValueError) as e:
110
+ error_messages.append(str(e))
111
+ # deserialize data into TemporalType
112
+ try:
113
+ instance.actual_instance = TemporalType.from_json(json_str)
114
+ match += 1
115
+ except (ValidationError, ValueError) as e:
116
+ error_messages.append(str(e))
117
+
118
+ if match > 1:
119
+ # more than 1 match
120
+ raise ValueError("Multiple matches found when deserializing the JSON string into GSDataType with oneOf schemas: PrimitiveType, StringType, TemporalType. Details: " + ", ".join(error_messages))
121
+ elif match == 0:
122
+ # no match
123
+ raise ValueError("No match found when deserializing the JSON string into GSDataType with oneOf schemas: PrimitiveType, StringType, TemporalType. Details: " + ", ".join(error_messages))
124
+ else:
125
+ return instance
126
+
127
+ def to_json(self) -> str:
128
+ """Returns the JSON representation of the actual instance"""
129
+ if self.actual_instance is None:
130
+ return "null"
131
+
132
+ if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json):
133
+ return self.actual_instance.to_json()
134
+ else:
135
+ return json.dumps(self.actual_instance)
136
+
137
+ def to_dict(self) -> Optional[Union[Dict[str, Any], PrimitiveType, StringType, TemporalType]]:
138
+ """Returns the dict representation of the actual instance"""
139
+ if self.actual_instance is None:
140
+ return None
141
+
142
+ if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict):
143
+ return self.actual_instance.to_dict()
144
+ else:
145
+ # primitive type
146
+ return self.actual_instance
147
+
148
+ def to_str(self) -> str:
149
+ """Returns the string representation of the actual instance"""
150
+ return pprint.pformat(self.model_dump())
151
+
152
+