metal-stack-api 0.0.6__py3-none-any.whl → 0.0.8__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- buf/validate/validate_pb2.py +65 -65
- buf/validate/validate_pb2.pyi +4 -8
- {metal_stack_api-0.0.6.dist-info → metal_stack_api-0.0.8.dist-info}/METADATA +1 -1
- {metal_stack_api-0.0.6.dist-info → metal_stack_api-0.0.8.dist-info}/RECORD +19 -10
- metalstack/api/v2/{methods_connecpy.py → method_connecpy.py} +30 -30
- metalstack/api/v2/{methods_pb2.py → method_pb2.py} +19 -19
- metalstack/api/v2/{methods_pb2_grpc.py → method_pb2_grpc.py} +13 -13
- metalstack/api/v2/switch_pb2.py +124 -0
- metalstack/api/v2/switch_pb2.pyi +133 -0
- metalstack/api/v2/switch_pb2_grpc.py +4 -0
- metalstack/client/__init__.py +0 -0
- metalstack/client/client.py +144 -0
- metalstack/infra/v2/switch_connecpy.py +102 -0
- metalstack/infra/v2/switch_pb2.py +45 -0
- metalstack/infra/v2/switch_pb2.pyi +20 -0
- metalstack/infra/v2/switch_pb2_grpc.py +81 -0
- {metal_stack_api-0.0.6.dist-info → metal_stack_api-0.0.8.dist-info}/WHEEL +0 -0
- {metal_stack_api-0.0.6.dist-info → metal_stack_api-0.0.8.dist-info}/top_level.txt +0 -0
- /metalstack/api/v2/{methods_pb2.pyi → method_pb2.pyi} +0 -0
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import datetime
|
|
2
|
+
|
|
3
|
+
from buf.validate import validate_pb2 as _validate_pb2
|
|
4
|
+
from google.protobuf import duration_pb2 as _duration_pb2
|
|
5
|
+
from metalstack.api.v2 import common_pb2 as _common_pb2
|
|
6
|
+
from google.protobuf.internal import containers as _containers
|
|
7
|
+
from google.protobuf.internal import enum_type_wrapper as _enum_type_wrapper
|
|
8
|
+
from google.protobuf import descriptor as _descriptor
|
|
9
|
+
from google.protobuf import message as _message
|
|
10
|
+
from collections.abc import Iterable as _Iterable, Mapping as _Mapping
|
|
11
|
+
from typing import ClassVar as _ClassVar, Optional as _Optional, Union as _Union
|
|
12
|
+
|
|
13
|
+
DESCRIPTOR: _descriptor.FileDescriptor
|
|
14
|
+
|
|
15
|
+
class BGPState(int, metaclass=_enum_type_wrapper.EnumTypeWrapper):
|
|
16
|
+
__slots__ = ()
|
|
17
|
+
BGP_STATE_UNSPECIFIED: _ClassVar[BGPState]
|
|
18
|
+
BGP_STATE_IDLE: _ClassVar[BGPState]
|
|
19
|
+
BGP_STATE_CONNECT: _ClassVar[BGPState]
|
|
20
|
+
BGP_STATE_ACTIVE: _ClassVar[BGPState]
|
|
21
|
+
BGP_STATE_OPEN_SENT: _ClassVar[BGPState]
|
|
22
|
+
BGP_STATE_OPEN_CONFIRM: _ClassVar[BGPState]
|
|
23
|
+
BGP_STATE_ESTABLISHED: _ClassVar[BGPState]
|
|
24
|
+
|
|
25
|
+
class SwitchReplaceMode(int, metaclass=_enum_type_wrapper.EnumTypeWrapper):
|
|
26
|
+
__slots__ = ()
|
|
27
|
+
SWITCH_REPLACE_MODE_UNSPECIFIED: _ClassVar[SwitchReplaceMode]
|
|
28
|
+
SWITCH_REPLACE_MODE_REPLACE: _ClassVar[SwitchReplaceMode]
|
|
29
|
+
SWITCH_REPLACE_MODE_OPERATIONAL: _ClassVar[SwitchReplaceMode]
|
|
30
|
+
|
|
31
|
+
class SwitchOSVendor(int, metaclass=_enum_type_wrapper.EnumTypeWrapper):
|
|
32
|
+
__slots__ = ()
|
|
33
|
+
SWITCH_OS_VENDOR_UNSPECIFIED: _ClassVar[SwitchOSVendor]
|
|
34
|
+
SWITCH_OS_VENDOR_CUMULUS: _ClassVar[SwitchOSVendor]
|
|
35
|
+
SWITCH_OS_VENDOR_SONIC: _ClassVar[SwitchOSVendor]
|
|
36
|
+
|
|
37
|
+
class SwitchPortStatus(int, metaclass=_enum_type_wrapper.EnumTypeWrapper):
|
|
38
|
+
__slots__ = ()
|
|
39
|
+
SWITCH_PORT_STATUS_UNSPECIFIED: _ClassVar[SwitchPortStatus]
|
|
40
|
+
SWITCH_PORT_STATUS_UP: _ClassVar[SwitchPortStatus]
|
|
41
|
+
SWITCH_PORT_STATUS_DOWN: _ClassVar[SwitchPortStatus]
|
|
42
|
+
BGP_STATE_UNSPECIFIED: BGPState
|
|
43
|
+
BGP_STATE_IDLE: BGPState
|
|
44
|
+
BGP_STATE_CONNECT: BGPState
|
|
45
|
+
BGP_STATE_ACTIVE: BGPState
|
|
46
|
+
BGP_STATE_OPEN_SENT: BGPState
|
|
47
|
+
BGP_STATE_OPEN_CONFIRM: BGPState
|
|
48
|
+
BGP_STATE_ESTABLISHED: BGPState
|
|
49
|
+
SWITCH_REPLACE_MODE_UNSPECIFIED: SwitchReplaceMode
|
|
50
|
+
SWITCH_REPLACE_MODE_REPLACE: SwitchReplaceMode
|
|
51
|
+
SWITCH_REPLACE_MODE_OPERATIONAL: SwitchReplaceMode
|
|
52
|
+
SWITCH_OS_VENDOR_UNSPECIFIED: SwitchOSVendor
|
|
53
|
+
SWITCH_OS_VENDOR_CUMULUS: SwitchOSVendor
|
|
54
|
+
SWITCH_OS_VENDOR_SONIC: SwitchOSVendor
|
|
55
|
+
SWITCH_PORT_STATUS_UNSPECIFIED: SwitchPortStatus
|
|
56
|
+
SWITCH_PORT_STATUS_UP: SwitchPortStatus
|
|
57
|
+
SWITCH_PORT_STATUS_DOWN: SwitchPortStatus
|
|
58
|
+
|
|
59
|
+
class Switch(_message.Message):
|
|
60
|
+
__slots__ = ("id", "description", "rack_id", "partition", "replace_mode", "management_ip", "management_user", "console_command", "switch_nics")
|
|
61
|
+
ID_FIELD_NUMBER: _ClassVar[int]
|
|
62
|
+
DESCRIPTION_FIELD_NUMBER: _ClassVar[int]
|
|
63
|
+
RACK_ID_FIELD_NUMBER: _ClassVar[int]
|
|
64
|
+
PARTITION_FIELD_NUMBER: _ClassVar[int]
|
|
65
|
+
REPLACE_MODE_FIELD_NUMBER: _ClassVar[int]
|
|
66
|
+
MANAGEMENT_IP_FIELD_NUMBER: _ClassVar[int]
|
|
67
|
+
MANAGEMENT_USER_FIELD_NUMBER: _ClassVar[int]
|
|
68
|
+
CONSOLE_COMMAND_FIELD_NUMBER: _ClassVar[int]
|
|
69
|
+
SWITCH_NICS_FIELD_NUMBER: _ClassVar[int]
|
|
70
|
+
id: str
|
|
71
|
+
description: str
|
|
72
|
+
rack_id: str
|
|
73
|
+
partition: str
|
|
74
|
+
replace_mode: SwitchReplaceMode
|
|
75
|
+
management_ip: str
|
|
76
|
+
management_user: str
|
|
77
|
+
console_command: str
|
|
78
|
+
switch_nics: _containers.RepeatedCompositeFieldContainer[SwitchNic]
|
|
79
|
+
def __init__(self, id: _Optional[str] = ..., description: _Optional[str] = ..., rack_id: _Optional[str] = ..., partition: _Optional[str] = ..., replace_mode: _Optional[_Union[SwitchReplaceMode, str]] = ..., management_ip: _Optional[str] = ..., management_user: _Optional[str] = ..., console_command: _Optional[str] = ..., switch_nics: _Optional[_Iterable[_Union[SwitchNic, _Mapping]]] = ...) -> None: ...
|
|
80
|
+
|
|
81
|
+
class SwitchOS(_message.Message):
|
|
82
|
+
__slots__ = ("vendor", "version", "metal_core_version")
|
|
83
|
+
VENDOR_FIELD_NUMBER: _ClassVar[int]
|
|
84
|
+
VERSION_FIELD_NUMBER: _ClassVar[int]
|
|
85
|
+
METAL_CORE_VERSION_FIELD_NUMBER: _ClassVar[int]
|
|
86
|
+
vendor: SwitchOSVendor
|
|
87
|
+
version: str
|
|
88
|
+
metal_core_version: str
|
|
89
|
+
def __init__(self, vendor: _Optional[_Union[SwitchOSVendor, str]] = ..., version: _Optional[str] = ..., metal_core_version: _Optional[str] = ...) -> None: ...
|
|
90
|
+
|
|
91
|
+
class SwitchNic(_message.Message):
|
|
92
|
+
__slots__ = ("name", "identifier", "mac_address", "vrf", "actual", "bgp_filter", "bgp_port_state")
|
|
93
|
+
NAME_FIELD_NUMBER: _ClassVar[int]
|
|
94
|
+
IDENTIFIER_FIELD_NUMBER: _ClassVar[int]
|
|
95
|
+
MAC_ADDRESS_FIELD_NUMBER: _ClassVar[int]
|
|
96
|
+
VRF_FIELD_NUMBER: _ClassVar[int]
|
|
97
|
+
ACTUAL_FIELD_NUMBER: _ClassVar[int]
|
|
98
|
+
BGP_FILTER_FIELD_NUMBER: _ClassVar[int]
|
|
99
|
+
BGP_PORT_STATE_FIELD_NUMBER: _ClassVar[int]
|
|
100
|
+
name: str
|
|
101
|
+
identifier: str
|
|
102
|
+
mac_address: str
|
|
103
|
+
vrf: str
|
|
104
|
+
actual: SwitchPortStatus
|
|
105
|
+
bgp_filter: BGPFilter
|
|
106
|
+
bgp_port_state: SwitchBGPPortState
|
|
107
|
+
def __init__(self, name: _Optional[str] = ..., identifier: _Optional[str] = ..., mac_address: _Optional[str] = ..., vrf: _Optional[str] = ..., actual: _Optional[_Union[SwitchPortStatus, str]] = ..., bgp_filter: _Optional[_Union[BGPFilter, _Mapping]] = ..., bgp_port_state: _Optional[_Union[SwitchBGPPortState, _Mapping]] = ...) -> None: ...
|
|
108
|
+
|
|
109
|
+
class BGPFilter(_message.Message):
|
|
110
|
+
__slots__ = ("cidrs", "vnis")
|
|
111
|
+
CIDRS_FIELD_NUMBER: _ClassVar[int]
|
|
112
|
+
VNIS_FIELD_NUMBER: _ClassVar[int]
|
|
113
|
+
cidrs: _containers.RepeatedScalarFieldContainer[str]
|
|
114
|
+
vnis: _containers.RepeatedScalarFieldContainer[str]
|
|
115
|
+
def __init__(self, cidrs: _Optional[_Iterable[str]] = ..., vnis: _Optional[_Iterable[str]] = ...) -> None: ...
|
|
116
|
+
|
|
117
|
+
class SwitchBGPPortState(_message.Message):
|
|
118
|
+
__slots__ = ("neighbor", "peer_group", "vrf_name", "bgp_state", "bgp_timer_up_established", "sent_prefix_counter", "accepted_prefix_counter")
|
|
119
|
+
NEIGHBOR_FIELD_NUMBER: _ClassVar[int]
|
|
120
|
+
PEER_GROUP_FIELD_NUMBER: _ClassVar[int]
|
|
121
|
+
VRF_NAME_FIELD_NUMBER: _ClassVar[int]
|
|
122
|
+
BGP_STATE_FIELD_NUMBER: _ClassVar[int]
|
|
123
|
+
BGP_TIMER_UP_ESTABLISHED_FIELD_NUMBER: _ClassVar[int]
|
|
124
|
+
SENT_PREFIX_COUNTER_FIELD_NUMBER: _ClassVar[int]
|
|
125
|
+
ACCEPTED_PREFIX_COUNTER_FIELD_NUMBER: _ClassVar[int]
|
|
126
|
+
neighbor: str
|
|
127
|
+
peer_group: str
|
|
128
|
+
vrf_name: str
|
|
129
|
+
bgp_state: BGPState
|
|
130
|
+
bgp_timer_up_established: _duration_pb2.Duration
|
|
131
|
+
sent_prefix_counter: int
|
|
132
|
+
accepted_prefix_counter: int
|
|
133
|
+
def __init__(self, neighbor: _Optional[str] = ..., peer_group: _Optional[str] = ..., vrf_name: _Optional[str] = ..., bgp_state: _Optional[_Union[BGPState, str]] = ..., bgp_timer_up_established: _Optional[_Union[datetime.timedelta, _duration_pb2.Duration, _Mapping]] = ..., sent_prefix_counter: _Optional[int] = ..., accepted_prefix_counter: _Optional[int] = ...) -> None: ...
|
|
File without changes
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
# Code generated by generate.go. DO NOT EDIT.
|
|
2
|
+
|
|
3
|
+
import httpx
|
|
4
|
+
|
|
5
|
+
import metalstack.admin.v2.filesystem_connecpy as admin_filesystem_connecpy
|
|
6
|
+
import metalstack.admin.v2.image_connecpy as admin_image_connecpy
|
|
7
|
+
import metalstack.admin.v2.ip_connecpy as admin_ip_connecpy
|
|
8
|
+
import metalstack.admin.v2.network_connecpy as admin_network_connecpy
|
|
9
|
+
import metalstack.admin.v2.partition_connecpy as admin_partition_connecpy
|
|
10
|
+
import metalstack.admin.v2.size_connecpy as admin_size_connecpy
|
|
11
|
+
import metalstack.admin.v2.tenant_connecpy as admin_tenant_connecpy
|
|
12
|
+
import metalstack.admin.v2.token_connecpy as admin_token_connecpy
|
|
13
|
+
|
|
14
|
+
import metalstack.api.v2.filesystem_connecpy as api_filesystem_connecpy
|
|
15
|
+
import metalstack.api.v2.health_connecpy as api_health_connecpy
|
|
16
|
+
import metalstack.api.v2.image_connecpy as api_image_connecpy
|
|
17
|
+
import metalstack.api.v2.ip_connecpy as api_ip_connecpy
|
|
18
|
+
import metalstack.api.v2.method_connecpy as api_method_connecpy
|
|
19
|
+
import metalstack.api.v2.network_connecpy as api_network_connecpy
|
|
20
|
+
import metalstack.api.v2.partition_connecpy as api_partition_connecpy
|
|
21
|
+
import metalstack.api.v2.project_connecpy as api_project_connecpy
|
|
22
|
+
import metalstack.api.v2.size_connecpy as api_size_connecpy
|
|
23
|
+
import metalstack.api.v2.tenant_connecpy as api_tenant_connecpy
|
|
24
|
+
import metalstack.api.v2.token_connecpy as api_token_connecpy
|
|
25
|
+
import metalstack.api.v2.user_connecpy as api_user_connecpy
|
|
26
|
+
import metalstack.api.v2.version_connecpy as api_version_connecpy
|
|
27
|
+
|
|
28
|
+
import metalstack.infra.v2.bmc_connecpy as infra_bmc_connecpy
|
|
29
|
+
import metalstack.infra.v2.switch_connecpy as infra_switch_connecpy
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
class Client:
|
|
34
|
+
def __init__(self, baseurl: str, token: str, timeout: int = 10):
|
|
35
|
+
self._baseurl = baseurl
|
|
36
|
+
|
|
37
|
+
headers = {}
|
|
38
|
+
if token:
|
|
39
|
+
headers["Authorization"] = "Bearer " + token
|
|
40
|
+
|
|
41
|
+
self._session = httpx.Client(headers=headers, timeout=timeout)
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
def adminv2(self):
|
|
45
|
+
return self._Adminv2(baseurl=self._baseurl, session=self._session)
|
|
46
|
+
|
|
47
|
+
def apiv2(self):
|
|
48
|
+
return self._Apiv2(baseurl=self._baseurl, session=self._session)
|
|
49
|
+
|
|
50
|
+
def infrav2(self):
|
|
51
|
+
return self._Infrav2(baseurl=self._baseurl, session=self._session)
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
class _Adminv2:
|
|
56
|
+
def __init__(self, baseurl: str, session=None):
|
|
57
|
+
self._baseurl = baseurl
|
|
58
|
+
self._session = session
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
def filesystem(self):
|
|
62
|
+
return admin_filesystem_connecpy.FilesystemServiceClient(address=self._baseurl, session=self._session)
|
|
63
|
+
|
|
64
|
+
def image(self):
|
|
65
|
+
return admin_image_connecpy.ImageServiceClient(address=self._baseurl, session=self._session)
|
|
66
|
+
|
|
67
|
+
def ip(self):
|
|
68
|
+
return admin_ip_connecpy.IPServiceClient(address=self._baseurl, session=self._session)
|
|
69
|
+
|
|
70
|
+
def network(self):
|
|
71
|
+
return admin_network_connecpy.NetworkServiceClient(address=self._baseurl, session=self._session)
|
|
72
|
+
|
|
73
|
+
def partition(self):
|
|
74
|
+
return admin_partition_connecpy.PartitionServiceClient(address=self._baseurl, session=self._session)
|
|
75
|
+
|
|
76
|
+
def size(self):
|
|
77
|
+
return admin_size_connecpy.SizeServiceClient(address=self._baseurl, session=self._session)
|
|
78
|
+
|
|
79
|
+
def tenant(self):
|
|
80
|
+
return admin_tenant_connecpy.TenantServiceClient(address=self._baseurl, session=self._session)
|
|
81
|
+
|
|
82
|
+
def token(self):
|
|
83
|
+
return admin_token_connecpy.TokenServiceClient(address=self._baseurl, session=self._session)
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
class _Apiv2:
|
|
87
|
+
def __init__(self, baseurl: str, session=None):
|
|
88
|
+
self._baseurl = baseurl
|
|
89
|
+
self._session = session
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
def filesystem(self):
|
|
93
|
+
return api_filesystem_connecpy.FilesystemServiceClient(address=self._baseurl, session=self._session)
|
|
94
|
+
|
|
95
|
+
def health(self):
|
|
96
|
+
return api_health_connecpy.HealthServiceClient(address=self._baseurl, session=self._session)
|
|
97
|
+
|
|
98
|
+
def image(self):
|
|
99
|
+
return api_image_connecpy.ImageServiceClient(address=self._baseurl, session=self._session)
|
|
100
|
+
|
|
101
|
+
def ip(self):
|
|
102
|
+
return api_ip_connecpy.IPServiceClient(address=self._baseurl, session=self._session)
|
|
103
|
+
|
|
104
|
+
def method(self):
|
|
105
|
+
return api_method_connecpy.MethodServiceClient(address=self._baseurl, session=self._session)
|
|
106
|
+
|
|
107
|
+
def network(self):
|
|
108
|
+
return api_network_connecpy.NetworkServiceClient(address=self._baseurl, session=self._session)
|
|
109
|
+
|
|
110
|
+
def partition(self):
|
|
111
|
+
return api_partition_connecpy.PartitionServiceClient(address=self._baseurl, session=self._session)
|
|
112
|
+
|
|
113
|
+
def project(self):
|
|
114
|
+
return api_project_connecpy.ProjectServiceClient(address=self._baseurl, session=self._session)
|
|
115
|
+
|
|
116
|
+
def size(self):
|
|
117
|
+
return api_size_connecpy.SizeServiceClient(address=self._baseurl, session=self._session)
|
|
118
|
+
|
|
119
|
+
def tenant(self):
|
|
120
|
+
return api_tenant_connecpy.TenantServiceClient(address=self._baseurl, session=self._session)
|
|
121
|
+
|
|
122
|
+
def token(self):
|
|
123
|
+
return api_token_connecpy.TokenServiceClient(address=self._baseurl, session=self._session)
|
|
124
|
+
|
|
125
|
+
def user(self):
|
|
126
|
+
return api_user_connecpy.UserServiceClient(address=self._baseurl, session=self._session)
|
|
127
|
+
|
|
128
|
+
def version(self):
|
|
129
|
+
return api_version_connecpy.VersionServiceClient(address=self._baseurl, session=self._session)
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
class _Infrav2:
|
|
133
|
+
def __init__(self, baseurl: str, session=None):
|
|
134
|
+
self._baseurl = baseurl
|
|
135
|
+
self._session = session
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
def bmc(self):
|
|
139
|
+
return infra_bmc_connecpy.BMCServiceClient(address=self._baseurl, session=self._session)
|
|
140
|
+
|
|
141
|
+
def switch(self):
|
|
142
|
+
return infra_switch_connecpy.SwitchServiceClient(address=self._baseurl, session=self._session)
|
|
143
|
+
|
|
144
|
+
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
# Generated by https://github.com/i2y/connecpy/protoc-gen-connecpy. DO NOT EDIT!
|
|
3
|
+
# source: metalstack/infra/v2/switch.proto
|
|
4
|
+
|
|
5
|
+
from typing import Optional, Protocol, Union
|
|
6
|
+
|
|
7
|
+
import httpx
|
|
8
|
+
|
|
9
|
+
from connecpy.async_client import AsyncConnecpyClient
|
|
10
|
+
from connecpy.base import Endpoint
|
|
11
|
+
from connecpy.server import ConnecpyServer
|
|
12
|
+
from connecpy.client import ConnecpyClient
|
|
13
|
+
from connecpy.context import ClientContext, ServiceContext
|
|
14
|
+
import metalstack.infra.v2.switch_pb2 as metalstack_dot_infra_dot_v2_dot_switch__pb2
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class SwitchService(Protocol):
|
|
18
|
+
async def Register(self, req: metalstack_dot_infra_dot_v2_dot_switch__pb2.SwitchServiceRegisterRequest, ctx: ServiceContext) -> metalstack_dot_infra_dot_v2_dot_switch__pb2.SwitchServiceRegisterResponse: ...
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
class SwitchServiceServer(ConnecpyServer):
|
|
22
|
+
def __init__(self, *, service: SwitchService, server_path_prefix=""):
|
|
23
|
+
super().__init__()
|
|
24
|
+
self._prefix = f"{server_path_prefix}/metalstack.infra.v2.SwitchService"
|
|
25
|
+
self._endpoints = {
|
|
26
|
+
"Register": Endpoint[metalstack_dot_infra_dot_v2_dot_switch__pb2.SwitchServiceRegisterRequest, metalstack_dot_infra_dot_v2_dot_switch__pb2.SwitchServiceRegisterResponse](
|
|
27
|
+
service_name="SwitchService",
|
|
28
|
+
name="Register",
|
|
29
|
+
function=getattr(service, "Register"),
|
|
30
|
+
input=metalstack_dot_infra_dot_v2_dot_switch__pb2.SwitchServiceRegisterRequest,
|
|
31
|
+
output=metalstack_dot_infra_dot_v2_dot_switch__pb2.SwitchServiceRegisterResponse,
|
|
32
|
+
allowed_methods=("POST",),
|
|
33
|
+
),
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
def serviceName(self):
|
|
37
|
+
return "metalstack.infra.v2.SwitchService"
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
class SwitchServiceSync(Protocol):
|
|
41
|
+
def Register(self, req: metalstack_dot_infra_dot_v2_dot_switch__pb2.SwitchServiceRegisterRequest, ctx: ServiceContext) -> metalstack_dot_infra_dot_v2_dot_switch__pb2.SwitchServiceRegisterResponse: ...
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
class SwitchServiceServerSync(ConnecpyServer):
|
|
45
|
+
def __init__(self, *, service: SwitchServiceSync, server_path_prefix=""):
|
|
46
|
+
super().__init__()
|
|
47
|
+
self._prefix = f"{server_path_prefix}/metalstack.infra.v2.SwitchService"
|
|
48
|
+
self._endpoints = {
|
|
49
|
+
"Register": Endpoint[metalstack_dot_infra_dot_v2_dot_switch__pb2.SwitchServiceRegisterRequest, metalstack_dot_infra_dot_v2_dot_switch__pb2.SwitchServiceRegisterResponse](
|
|
50
|
+
service_name="SwitchService",
|
|
51
|
+
name="Register",
|
|
52
|
+
function=getattr(service, "Register"),
|
|
53
|
+
input=metalstack_dot_infra_dot_v2_dot_switch__pb2.SwitchServiceRegisterRequest,
|
|
54
|
+
output=metalstack_dot_infra_dot_v2_dot_switch__pb2.SwitchServiceRegisterResponse,
|
|
55
|
+
allowed_methods=("POST",),
|
|
56
|
+
),
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
def serviceName(self):
|
|
60
|
+
return "metalstack.infra.v2.SwitchService"
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
class SwitchServiceClient(ConnecpyClient):
|
|
64
|
+
def Register(
|
|
65
|
+
self,
|
|
66
|
+
request: metalstack_dot_infra_dot_v2_dot_switch__pb2.SwitchServiceRegisterRequest,
|
|
67
|
+
*,
|
|
68
|
+
ctx: Optional[ClientContext] = None,
|
|
69
|
+
server_path_prefix: str = "",
|
|
70
|
+
**kwargs,
|
|
71
|
+
) -> metalstack_dot_infra_dot_v2_dot_switch__pb2.SwitchServiceRegisterResponse:
|
|
72
|
+
method = "POST"
|
|
73
|
+
return self._make_request(
|
|
74
|
+
url=f"{server_path_prefix}/metalstack.infra.v2.SwitchService/Register",
|
|
75
|
+
ctx=ctx,
|
|
76
|
+
request=request,
|
|
77
|
+
response_class=metalstack_dot_infra_dot_v2_dot_switch__pb2.SwitchServiceRegisterResponse,
|
|
78
|
+
method=method,
|
|
79
|
+
**kwargs,
|
|
80
|
+
)
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
class AsyncSwitchServiceClient(AsyncConnecpyClient):
|
|
84
|
+
async def Register(
|
|
85
|
+
self,
|
|
86
|
+
request: metalstack_dot_infra_dot_v2_dot_switch__pb2.SwitchServiceRegisterRequest,
|
|
87
|
+
*,
|
|
88
|
+
ctx: Optional[ClientContext] = None,
|
|
89
|
+
server_path_prefix: str = "",
|
|
90
|
+
session: Union[httpx.AsyncClient, None] = None,
|
|
91
|
+
**kwargs,
|
|
92
|
+
) -> metalstack_dot_infra_dot_v2_dot_switch__pb2.SwitchServiceRegisterResponse:
|
|
93
|
+
method = "POST"
|
|
94
|
+
return await self._make_request(
|
|
95
|
+
url=f"{server_path_prefix}/metalstack.infra.v2.SwitchService/Register",
|
|
96
|
+
ctx=ctx,
|
|
97
|
+
request=request,
|
|
98
|
+
response_class=metalstack_dot_infra_dot_v2_dot_switch__pb2.SwitchServiceRegisterResponse,
|
|
99
|
+
method=method,
|
|
100
|
+
session=session,
|
|
101
|
+
**kwargs,
|
|
102
|
+
)
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
|
3
|
+
# NO CHECKED-IN PROTOBUF GENCODE
|
|
4
|
+
# source: metalstack/infra/v2/switch.proto
|
|
5
|
+
# Protobuf Python Version: 6.31.1
|
|
6
|
+
"""Generated protocol buffer code."""
|
|
7
|
+
from google.protobuf import descriptor as _descriptor
|
|
8
|
+
from google.protobuf import descriptor_pool as _descriptor_pool
|
|
9
|
+
from google.protobuf import runtime_version as _runtime_version
|
|
10
|
+
from google.protobuf import symbol_database as _symbol_database
|
|
11
|
+
from google.protobuf.internal import builder as _builder
|
|
12
|
+
_runtime_version.ValidateProtobufRuntimeVersion(
|
|
13
|
+
_runtime_version.Domain.PUBLIC,
|
|
14
|
+
6,
|
|
15
|
+
31,
|
|
16
|
+
1,
|
|
17
|
+
'',
|
|
18
|
+
'metalstack/infra/v2/switch.proto'
|
|
19
|
+
)
|
|
20
|
+
# @@protoc_insertion_point(imports)
|
|
21
|
+
|
|
22
|
+
_sym_db = _symbol_database.Default()
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
from metalstack.api.v2 import common_pb2 as metalstack_dot_api_dot_v2_dot_common__pb2
|
|
26
|
+
from metalstack.api.v2 import switch_pb2 as metalstack_dot_api_dot_v2_dot_switch__pb2
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n metalstack/infra/v2/switch.proto\x12\x13metalstack.infra.v2\x1a\x1emetalstack/api/v2/common.proto\x1a\x1emetalstack/api/v2/switch.proto\"Q\n\x1cSwitchServiceRegisterRequest\x12\x31\n\x06switch\x18\x01 \x01(\x0b\x32\x19.metalstack.api.v2.SwitchR\x06switch\"R\n\x1dSwitchServiceRegisterResponse\x12\x31\n\x06switch\x18\x01 \x01(\x0b\x32\x19.metalstack.api.v2.SwitchR\x06switch2\x8e\x01\n\rSwitchService\x12}\n\x08Register\x12\x31.metalstack.infra.v2.SwitchServiceRegisterRequest\x1a\x32.metalstack.infra.v2.SwitchServiceRegisterResponse\"\n\xe0\xf3\x18\x02\xea\xf3\x18\x02\x01\x02\x42\xcf\x01\n\x17\x63om.metalstack.infra.v2B\x0bSwitchProtoP\x01Z9github.com/metal-stack/api/go/metalstack/infra/v2;infrav2\xa2\x02\x03MIX\xaa\x02\x13Metalstack.Infra.V2\xca\x02\x13Metalstack\\Infra\\V2\xe2\x02\x1fMetalstack\\Infra\\V2\\GPBMetadata\xea\x02\x15Metalstack::Infra::V2b\x06proto3')
|
|
30
|
+
|
|
31
|
+
_globals = globals()
|
|
32
|
+
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
|
|
33
|
+
_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'metalstack.infra.v2.switch_pb2', _globals)
|
|
34
|
+
if not _descriptor._USE_C_DESCRIPTORS:
|
|
35
|
+
_globals['DESCRIPTOR']._loaded_options = None
|
|
36
|
+
_globals['DESCRIPTOR']._serialized_options = b'\n\027com.metalstack.infra.v2B\013SwitchProtoP\001Z9github.com/metal-stack/api/go/metalstack/infra/v2;infrav2\242\002\003MIX\252\002\023Metalstack.Infra.V2\312\002\023Metalstack\\Infra\\V2\342\002\037Metalstack\\Infra\\V2\\GPBMetadata\352\002\025Metalstack::Infra::V2'
|
|
37
|
+
_globals['_SWITCHSERVICE'].methods_by_name['Register']._loaded_options = None
|
|
38
|
+
_globals['_SWITCHSERVICE'].methods_by_name['Register']._serialized_options = b'\340\363\030\002\352\363\030\002\001\002'
|
|
39
|
+
_globals['_SWITCHSERVICEREGISTERREQUEST']._serialized_start=121
|
|
40
|
+
_globals['_SWITCHSERVICEREGISTERREQUEST']._serialized_end=202
|
|
41
|
+
_globals['_SWITCHSERVICEREGISTERRESPONSE']._serialized_start=204
|
|
42
|
+
_globals['_SWITCHSERVICEREGISTERRESPONSE']._serialized_end=286
|
|
43
|
+
_globals['_SWITCHSERVICE']._serialized_start=289
|
|
44
|
+
_globals['_SWITCHSERVICE']._serialized_end=431
|
|
45
|
+
# @@protoc_insertion_point(module_scope)
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
from metalstack.api.v2 import common_pb2 as _common_pb2
|
|
2
|
+
from metalstack.api.v2 import switch_pb2 as _switch_pb2
|
|
3
|
+
from google.protobuf import descriptor as _descriptor
|
|
4
|
+
from google.protobuf import message as _message
|
|
5
|
+
from collections.abc import Mapping as _Mapping
|
|
6
|
+
from typing import ClassVar as _ClassVar, Optional as _Optional, Union as _Union
|
|
7
|
+
|
|
8
|
+
DESCRIPTOR: _descriptor.FileDescriptor
|
|
9
|
+
|
|
10
|
+
class SwitchServiceRegisterRequest(_message.Message):
|
|
11
|
+
__slots__ = ("switch",)
|
|
12
|
+
SWITCH_FIELD_NUMBER: _ClassVar[int]
|
|
13
|
+
switch: _switch_pb2.Switch
|
|
14
|
+
def __init__(self, switch: _Optional[_Union[_switch_pb2.Switch, _Mapping]] = ...) -> None: ...
|
|
15
|
+
|
|
16
|
+
class SwitchServiceRegisterResponse(_message.Message):
|
|
17
|
+
__slots__ = ("switch",)
|
|
18
|
+
SWITCH_FIELD_NUMBER: _ClassVar[int]
|
|
19
|
+
switch: _switch_pb2.Switch
|
|
20
|
+
def __init__(self, switch: _Optional[_Union[_switch_pb2.Switch, _Mapping]] = ...) -> None: ...
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
|
|
2
|
+
"""Client and server classes corresponding to protobuf-defined services."""
|
|
3
|
+
import grpc
|
|
4
|
+
|
|
5
|
+
from metalstack.infra.v2 import switch_pb2 as metalstack_dot_infra_dot_v2_dot_switch__pb2
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class SwitchServiceStub(object):
|
|
9
|
+
"""SwitchService serves switch related functions
|
|
10
|
+
"""
|
|
11
|
+
|
|
12
|
+
def __init__(self, channel):
|
|
13
|
+
"""Constructor.
|
|
14
|
+
|
|
15
|
+
Args:
|
|
16
|
+
channel: A grpc.Channel.
|
|
17
|
+
"""
|
|
18
|
+
self.Register = channel.unary_unary(
|
|
19
|
+
'/metalstack.infra.v2.SwitchService/Register',
|
|
20
|
+
request_serializer=metalstack_dot_infra_dot_v2_dot_switch__pb2.SwitchServiceRegisterRequest.SerializeToString,
|
|
21
|
+
response_deserializer=metalstack_dot_infra_dot_v2_dot_switch__pb2.SwitchServiceRegisterResponse.FromString,
|
|
22
|
+
_registered_method=True)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
class SwitchServiceServicer(object):
|
|
26
|
+
"""SwitchService serves switch related functions
|
|
27
|
+
"""
|
|
28
|
+
|
|
29
|
+
def Register(self, request, context):
|
|
30
|
+
"""Register a switch
|
|
31
|
+
"""
|
|
32
|
+
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
|
|
33
|
+
context.set_details('Method not implemented!')
|
|
34
|
+
raise NotImplementedError('Method not implemented!')
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
def add_SwitchServiceServicer_to_server(servicer, server):
|
|
38
|
+
rpc_method_handlers = {
|
|
39
|
+
'Register': grpc.unary_unary_rpc_method_handler(
|
|
40
|
+
servicer.Register,
|
|
41
|
+
request_deserializer=metalstack_dot_infra_dot_v2_dot_switch__pb2.SwitchServiceRegisterRequest.FromString,
|
|
42
|
+
response_serializer=metalstack_dot_infra_dot_v2_dot_switch__pb2.SwitchServiceRegisterResponse.SerializeToString,
|
|
43
|
+
),
|
|
44
|
+
}
|
|
45
|
+
generic_handler = grpc.method_handlers_generic_handler(
|
|
46
|
+
'metalstack.infra.v2.SwitchService', rpc_method_handlers)
|
|
47
|
+
server.add_generic_rpc_handlers((generic_handler,))
|
|
48
|
+
server.add_registered_method_handlers('metalstack.infra.v2.SwitchService', rpc_method_handlers)
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
# This class is part of an EXPERIMENTAL API.
|
|
52
|
+
class SwitchService(object):
|
|
53
|
+
"""SwitchService serves switch related functions
|
|
54
|
+
"""
|
|
55
|
+
|
|
56
|
+
@staticmethod
|
|
57
|
+
def Register(request,
|
|
58
|
+
target,
|
|
59
|
+
options=(),
|
|
60
|
+
channel_credentials=None,
|
|
61
|
+
call_credentials=None,
|
|
62
|
+
insecure=False,
|
|
63
|
+
compression=None,
|
|
64
|
+
wait_for_ready=None,
|
|
65
|
+
timeout=None,
|
|
66
|
+
metadata=None):
|
|
67
|
+
return grpc.experimental.unary_unary(
|
|
68
|
+
request,
|
|
69
|
+
target,
|
|
70
|
+
'/metalstack.infra.v2.SwitchService/Register',
|
|
71
|
+
metalstack_dot_infra_dot_v2_dot_switch__pb2.SwitchServiceRegisterRequest.SerializeToString,
|
|
72
|
+
metalstack_dot_infra_dot_v2_dot_switch__pb2.SwitchServiceRegisterResponse.FromString,
|
|
73
|
+
options,
|
|
74
|
+
channel_credentials,
|
|
75
|
+
insecure,
|
|
76
|
+
call_credentials,
|
|
77
|
+
compression,
|
|
78
|
+
wait_for_ready,
|
|
79
|
+
timeout,
|
|
80
|
+
metadata,
|
|
81
|
+
_registered_method=True)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|