diff --git a/Makefile b/Makefile new file mode 100644 index 00000000..1592ea16 --- /dev/null +++ b/Makefile @@ -0,0 +1,9 @@ +.PHONY: gen-diode-sdk-go gen-diode-sdk-python + +gen-diode-sdk-go: + @cd diode-proto/ && buf format -w && buf generate --template buf.gen.go.yaml + +gen-diode-sdk-python: + @cd diode-proto/ && buf format -w && buf generate --template buf.gen.py.yaml --include-imports + @find diode-sdk-python/netboxlabs/diode/sdk \( -name '*.py' -o -name '*.pyi' \) \ + -exec sed -i '' 's/^from diode.v1/from netboxlabs.diode.sdk.diode.v1/; s/^from validate/from netboxlabs.diode.sdk.validate/' {} \; diff --git a/diode-proto/buf.gen.yaml b/diode-proto/buf.gen.go.yaml similarity index 71% rename from diode-proto/buf.gen.yaml rename to diode-proto/buf.gen.go.yaml index be809531..68901474 100644 --- a/diode-proto/buf.gen.yaml +++ b/diode-proto/buf.gen.go.yaml @@ -9,10 +9,6 @@ plugins: - plugin: buf.build/bufbuild/validate-go:v1.0.4 out: ../diode-sdk-go/ opt: module=github.com/netboxlabs/diode/diode-sdk-go - - plugin: buf.build/protocolbuffers/python:v25.1 - out: ../diode-sdk-python/netboxlabs/diode/sdk/ - - plugin: buf.build/grpc/python:v1.60.0 - out: ../diode-sdk-python/netboxlabs/diode/sdk/ - plugin: buf.build/community/pseudomuto-doc:v1.5.1 out: ../docs/ opt: diff --git a/diode-proto/buf.gen.py.yaml b/diode-proto/buf.gen.py.yaml new file mode 100644 index 00000000..69bb4bef --- /dev/null +++ b/diode-proto/buf.gen.py.yaml @@ -0,0 +1,8 @@ +version: v1 +plugins: + - plugin: buf.build/protocolbuffers/python:v26.1 + out: ../diode-sdk-python/netboxlabs/diode/sdk/ + - plugin: buf.build/protocolbuffers/pyi:v26.1 + out: ../diode-sdk-python/netboxlabs/diode/sdk/ + - plugin: buf.build/grpc/python:v1.62.1 + out: ../diode-sdk-python/netboxlabs/diode/sdk/ diff --git a/diode-sdk-python/README.md b/diode-sdk-python/README.md index 6c9c62f8..58e5b3c3 100644 --- a/diode-sdk-python/README.md +++ b/diode-sdk-python/README.md @@ -12,3 +12,40 @@ pip install netboxlabs-diode-sdk ruff netboxlabs/ black netboxlabs/ ``` + +## Usage + +### Environment variables + +* `DIODE_API_KEY` - API key for the Diode service +* `DIODE_SDK_LOG_LEVEL` - Log level for the SDK (default: `INFO`) + +### Example + +```python + +from netboxlabs.diode.sdk import DiodeClient +from netboxlabs.diode.sdk.diode.v1.device_type_pb2 import DeviceType +from netboxlabs.diode.sdk.diode.v1.distributor_pb2 import IngestEntity +from netboxlabs.diode.sdk.diode.v1.manufacturer_pb2 import Manufacturer +from netboxlabs.diode.sdk.diode.v1.site_pb2 import Site + + +def main(): + with DiodeClient(target="localhost:8081", app_name="my-test-app", app_version="0.0.1") as client: + entities = [ + IngestEntity(site=Site(name="Site 1")), + IngestEntity( + device_type=DeviceType( + model="ISR4321", + manufacturer=Manufacturer(name="Cisco"), + ) + ), + ] + + resp = client.ingest(entities=entities) + print(f"Response: {resp}") + +if __name__ == "__main__": + main() +``` diff --git a/diode-sdk-python/netboxlabs/diode/sdk/__init__.py b/diode-sdk-python/netboxlabs/diode/sdk/__init__.py index 61db2996..c499df8f 100644 --- a/diode-sdk-python/netboxlabs/diode/sdk/__init__.py +++ b/diode-sdk-python/netboxlabs/diode/sdk/__init__.py @@ -2,6 +2,6 @@ # Copyright 2024 NetBox Labs Inc """NetBox Labs, Diode - SDK.""" -from netboxlabs.diode.sdk.client_config import ClientConfiguration +from netboxlabs.diode.sdk.client import DiodeClient -assert ClientConfiguration +assert DiodeClient diff --git a/diode-sdk-python/netboxlabs/diode/sdk/client.py b/diode-sdk-python/netboxlabs/diode/sdk/client.py new file mode 100644 index 00000000..c9954500 --- /dev/null +++ b/diode-sdk-python/netboxlabs/diode/sdk/client.py @@ -0,0 +1,120 @@ +#!/usr/bin/env python +# Copyright 2024 NetBox Labs Inc +"""NetBox Labs, Diode - SDK - Client.""" + +import logging +import os +import uuid +from typing import Iterable, Optional + +import grpc + +from netboxlabs.diode.sdk.diode.v1 import distributor_pb2, distributor_pb2_grpc +from netboxlabs.diode.sdk.exceptions import DiodeClientError, DiodeConfigError + +_DIODE_API_KEY_ENVVAR_NAME = "DIODE_API_KEY" +_DIODE_SDK_LOG_LEVEL_ENVVAR_NAME = "DIODE_SDK_LOG_LEVEL" +_DEFAULT_STREAM = "latest" +_LOGGER = logging.getLogger(__name__) + + +class DiodeClient: + """Diode Client.""" + + _name = "diode-sdk-python" + _version = "0.0.1" + _app_name = None + _app_version = None + _channel = None + _stub = None + + def __init__( + self, + target: str, + app_name: str, + app_version: str, + api_key: Optional[str] = None, + ): + """Initiate a new client.""" + log_level = os.getenv(_DIODE_SDK_LOG_LEVEL_ENVVAR_NAME, "INFO").upper() + logging.basicConfig(level=log_level) + + # TODO: validate target + self._target = target + + self._app_name = app_name + self._app_version = app_version + + if api_key is None: + api_key = os.getenv(_DIODE_API_KEY_ENVVAR_NAME) + if api_key is None: + raise DiodeConfigError("API key is required") + + self._auth_metadata = (("diode-api-key", api_key),) + # TODO: add support for secure channel (TLS verify flag and cert) + self._channel = grpc.insecure_channel(target) + self._stub = distributor_pb2_grpc.DistributorServiceStub(self._channel) + # TODO: obtain meta data about the environment; Python version, CPU arch, OS + + @property + def name(self) -> str: + """Retrieve the name.""" + return self._name + + @property + def version(self) -> str: + """Retrieve the version.""" + return self._version + + @property + def target(self) -> str: + """Retrieve the target.""" + return self._target + + @property + def app_name(self) -> str: + """Retrieve the app name.""" + return self._app_name + + @property + def app_version(self) -> str: + """Retrieve the app version.""" + return self._app_version + + @property + def channel(self) -> grpc.Channel: + """Retrieve the channel.""" + return self._channel + + def __enter__(self): + """Enters the runtime context related to the channel object.""" + return self + + def __exit__(self, exc_type, exc_value, exc_traceback): + """Exits the runtime context related to the channel object.""" + self.close() + + def close(self): + """Close the channel.""" + self._channel.close() + + def ingest( + self, + entities: Iterable[distributor_pb2.IngestEntity], + stream: Optional[str] = _DEFAULT_STREAM, + ) -> distributor_pb2.PushResponse: + """Push a message.""" + try: + request = distributor_pb2.PushRequest( + stream=stream, + id=str(uuid.uuid4()), + data=entities, + sdk_name=self.name, + sdk_version=self.version, + producer_app_name=self.app_name, + producer_app_version=self.app_version, + ) + + return self._stub.Push(request, metadata=self._auth_metadata) + except grpc.RpcError as err: + raise DiodeClientError(err) from err diff --git a/diode-sdk-python/netboxlabs/diode/sdk/client_config.py b/diode-sdk-python/netboxlabs/diode/sdk/client_config.py deleted file mode 100644 index fb0b6eff..00000000 --- a/diode-sdk-python/netboxlabs/diode/sdk/client_config.py +++ /dev/null @@ -1,27 +0,0 @@ -#!/usr/bin/env python -# Copyright 2024 NetBox Labs Inc -"""NetBox Labs, Diode - Client configuration.""" - - -class ClientConfiguration: - """Diode client configuration.""" - - _name = None - _version = None - - def __init__(self, name: str, version: str): - """Initiate a new client configuration.""" - self._name = name - self._version = version - # TODO: ensure version is a valid semver - # TODO: obtain meta data about the environment; Python version, CPU arch, OS - - @property - def name(self) -> str: - """Retrieve the name.""" - return self._name - - @property - def version(self) -> str: - """Retrieve the version.""" - return self._version diff --git a/diode-sdk-python/netboxlabs/diode/sdk/diode/__init__.py b/diode-sdk-python/netboxlabs/diode/sdk/diode/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/diode-sdk-python/netboxlabs/diode/sdk/diode/v1/__init__.py b/diode-sdk-python/netboxlabs/diode/sdk/diode/v1/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/diode-sdk-python/netboxlabs/diode/sdk/diode/v1/device_pb2.py b/diode-sdk-python/netboxlabs/diode/sdk/diode/v1/device_pb2.py index 074224f2..99fda92d 100644 --- a/diode-sdk-python/netboxlabs/diode/sdk/diode/v1/device_pb2.py +++ b/diode-sdk-python/netboxlabs/diode/sdk/diode/v1/device_pb2.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: diode/v1/device.proto -# Protobuf Python Version: 4.25.1 +# Protobuf Python Version: 5.26.1 """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor_pool as _descriptor_pool @@ -12,11 +12,11 @@ _sym_db = _symbol_database.Default() -from diode.v1 import device_type_pb2 as diode_dot_v1_dot_device__type__pb2 -from diode.v1 import platform_pb2 as diode_dot_v1_dot_platform__pb2 -from diode.v1 import role_pb2 as diode_dot_v1_dot_role__pb2 -from diode.v1 import site_pb2 as diode_dot_v1_dot_site__pb2 -from validate import validate_pb2 as validate_dot_validate__pb2 +from netboxlabs.diode.sdk.diode.v1 import device_type_pb2 as diode_dot_v1_dot_device__type__pb2 +from netboxlabs.diode.sdk.diode.v1 import platform_pb2 as diode_dot_v1_dot_platform__pb2 +from netboxlabs.diode.sdk.diode.v1 import role_pb2 as diode_dot_v1_dot_role__pb2 +from netboxlabs.diode.sdk.diode.v1 import site_pb2 as diode_dot_v1_dot_site__pb2 +from netboxlabs.diode.sdk.validate import validate_pb2 as validate_dot_validate__pb2 DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x15\x64iode/v1/device.proto\x12\x08\x64iode.v1\x1a\x1a\x64iode/v1/device_type.proto\x1a\x17\x64iode/v1/platform.proto\x1a\x13\x64iode/v1/role.proto\x1a\x13\x64iode/v1/site.proto\x1a\x17validate/validate.proto\"\xcf\x02\n\x06\x44\x65vice\x12\x1b\n\x04name\x18\x01 \x01(\tB\x07\xfa\x42\x04r\x02\x18@R\x04name\x12+\n\x0b\x64\x65vice_fqdn\x18\x02 \x01(\tB\n\xfa\x42\x07r\x05\x10\x01\x18\xff\x01R\ndeviceFqdn\x12\x35\n\x0b\x64\x65vice_type\x18\x03 \x01(\x0b\x32\x14.diode.v1.DeviceTypeR\ndeviceType\x12\"\n\x04role\x18\x04 \x01(\x0b\x32\x0e.diode.v1.RoleR\x04role\x12.\n\x08platform\x18\x05 \x01(\x0b\x32\x12.diode.v1.PlatformR\x08platform\x12\x1f\n\x06serial\x18\x06 \x01(\tB\x07\xfa\x42\x04r\x02\x18\x32R\x06serial\x12\"\n\x04site\x18\x07 \x01(\x0b\x32\x0e.diode.v1.SiteR\x04site\x12+\n\x0bvc_position\x18\x08 \x01(\x05\x42\n\xfa\x42\x07\x1a\x05\x18\xff\x01(\x00R\nvcPositionB;Z9github.com/netboxlabs/diode/diode-sdk-go/diode/v1/diodepbb\x06proto3') @@ -24,16 +24,16 @@ _globals = globals() _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals) _builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'diode.v1.device_pb2', _globals) -if _descriptor._USE_C_DESCRIPTORS == False: - _globals['DESCRIPTOR']._options = None +if not _descriptor._USE_C_DESCRIPTORS: + _globals['DESCRIPTOR']._loaded_options = None _globals['DESCRIPTOR']._serialized_options = b'Z9github.com/netboxlabs/diode/diode-sdk-go/diode/v1/diodepb' - _globals['_DEVICE'].fields_by_name['name']._options = None + _globals['_DEVICE'].fields_by_name['name']._loaded_options = None _globals['_DEVICE'].fields_by_name['name']._serialized_options = b'\372B\004r\002\030@' - _globals['_DEVICE'].fields_by_name['device_fqdn']._options = None + _globals['_DEVICE'].fields_by_name['device_fqdn']._loaded_options = None _globals['_DEVICE'].fields_by_name['device_fqdn']._serialized_options = b'\372B\007r\005\020\001\030\377\001' - _globals['_DEVICE'].fields_by_name['serial']._options = None + _globals['_DEVICE'].fields_by_name['serial']._loaded_options = None _globals['_DEVICE'].fields_by_name['serial']._serialized_options = b'\372B\004r\002\0302' - _globals['_DEVICE'].fields_by_name['vc_position']._options = None + _globals['_DEVICE'].fields_by_name['vc_position']._loaded_options = None _globals['_DEVICE'].fields_by_name['vc_position']._serialized_options = b'\372B\007\032\005\030\377\001(\000' _globals['_DEVICE']._serialized_start=156 _globals['_DEVICE']._serialized_end=491 diff --git a/diode-sdk-python/netboxlabs/diode/sdk/diode/v1/device_pb2.pyi b/diode-sdk-python/netboxlabs/diode/sdk/diode/v1/device_pb2.pyi new file mode 100644 index 00000000..e5e9317b --- /dev/null +++ b/diode-sdk-python/netboxlabs/diode/sdk/diode/v1/device_pb2.pyi @@ -0,0 +1,30 @@ +from netboxlabs.diode.sdk.diode.v1 import device_type_pb2 as _device_type_pb2 +from netboxlabs.diode.sdk.diode.v1 import platform_pb2 as _platform_pb2 +from netboxlabs.diode.sdk.diode.v1 import role_pb2 as _role_pb2 +from netboxlabs.diode.sdk.diode.v1 import site_pb2 as _site_pb2 +from netboxlabs.diode.sdk.validate import validate_pb2 as _validate_pb2 +from google.protobuf import descriptor as _descriptor +from google.protobuf import message as _message +from typing import ClassVar as _ClassVar, Mapping as _Mapping, Optional as _Optional, Union as _Union + +DESCRIPTOR: _descriptor.FileDescriptor + +class Device(_message.Message): + __slots__ = ("name", "device_fqdn", "device_type", "role", "platform", "serial", "site", "vc_position") + NAME_FIELD_NUMBER: _ClassVar[int] + DEVICE_FQDN_FIELD_NUMBER: _ClassVar[int] + DEVICE_TYPE_FIELD_NUMBER: _ClassVar[int] + ROLE_FIELD_NUMBER: _ClassVar[int] + PLATFORM_FIELD_NUMBER: _ClassVar[int] + SERIAL_FIELD_NUMBER: _ClassVar[int] + SITE_FIELD_NUMBER: _ClassVar[int] + VC_POSITION_FIELD_NUMBER: _ClassVar[int] + name: str + device_fqdn: str + device_type: _device_type_pb2.DeviceType + role: _role_pb2.Role + platform: _platform_pb2.Platform + serial: str + site: _site_pb2.Site + vc_position: int + def __init__(self, name: _Optional[str] = ..., device_fqdn: _Optional[str] = ..., device_type: _Optional[_Union[_device_type_pb2.DeviceType, _Mapping]] = ..., role: _Optional[_Union[_role_pb2.Role, _Mapping]] = ..., platform: _Optional[_Union[_platform_pb2.Platform, _Mapping]] = ..., serial: _Optional[str] = ..., site: _Optional[_Union[_site_pb2.Site, _Mapping]] = ..., vc_position: _Optional[int] = ...) -> None: ... diff --git a/diode-sdk-python/netboxlabs/diode/sdk/diode/v1/device_role_pb2.py b/diode-sdk-python/netboxlabs/diode/sdk/diode/v1/device_role_pb2.py deleted file mode 100644 index bf4cacf4..00000000 --- a/diode-sdk-python/netboxlabs/diode/sdk/diode/v1/device_role_pb2.py +++ /dev/null @@ -1,32 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: diode/v1/device_role.proto -# Protobuf Python Version: 4.25.1 -"""Generated protocol buffer code.""" -from google.protobuf import descriptor as _descriptor -from google.protobuf import descriptor_pool as _descriptor_pool -from google.protobuf import symbol_database as _symbol_database -from google.protobuf.internal import builder as _builder -# @@protoc_insertion_point(imports) - -_sym_db = _symbol_database.Default() - - -from validate import validate_pb2 as validate_dot_validate__pb2 - - -DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x1a\x64iode/v1/device_role.proto\x12\x08\x64iode.v1\x1a\x17validate/validate.proto\"u\n\nDeviceRole\x12\x1d\n\x04name\x18\x01 \x01(\tB\t\xfa\x42\x06r\x04\x10\x01\x18\x64R\x04name\x12/\n\x04slug\x18\x02 \x01(\tB\x1b\xfa\x42\x18r\x16\x10\x01\x18\x64\x32\x10^[-a-zA-Z0-9_]+$R\x04slug\x12\x17\n\x07vm_role\x18\x03 \x01(\x08R\x06vmRoleB;Z9github.com/netboxlabs/diode/diode-sdk-go/diode/v1/diodepbb\x06proto3') - -_globals = globals() -_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals) -_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'diode.v1.device_role_pb2', _globals) -if _descriptor._USE_C_DESCRIPTORS == False: - _globals['DESCRIPTOR']._options = None - _globals['DESCRIPTOR']._serialized_options = b'Z9github.com/netboxlabs/diode/diode-sdk-go/diode/v1/diodepb' - _globals['_DEVICEROLE'].fields_by_name['name']._options = None - _globals['_DEVICEROLE'].fields_by_name['name']._serialized_options = b'\372B\006r\004\020\001\030d' - _globals['_DEVICEROLE'].fields_by_name['slug']._options = None - _globals['_DEVICEROLE'].fields_by_name['slug']._serialized_options = b'\372B\030r\026\020\001\030d2\020^[-a-zA-Z0-9_]+$' - _globals['_DEVICEROLE']._serialized_start=65 - _globals['_DEVICEROLE']._serialized_end=182 -# @@protoc_insertion_point(module_scope) diff --git a/diode-sdk-python/netboxlabs/diode/sdk/diode/v1/device_type_pb2.py b/diode-sdk-python/netboxlabs/diode/sdk/diode/v1/device_type_pb2.py index ea8e359a..bec1f0c2 100644 --- a/diode-sdk-python/netboxlabs/diode/sdk/diode/v1/device_type_pb2.py +++ b/diode-sdk-python/netboxlabs/diode/sdk/diode/v1/device_type_pb2.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: diode/v1/device_type.proto -# Protobuf Python Version: 4.25.1 +# Protobuf Python Version: 5.26.1 """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor_pool as _descriptor_pool @@ -12,8 +12,8 @@ _sym_db = _symbol_database.Default() -from diode.v1 import manufacturer_pb2 as diode_dot_v1_dot_manufacturer__pb2 -from validate import validate_pb2 as validate_dot_validate__pb2 +from netboxlabs.diode.sdk.diode.v1 import manufacturer_pb2 as diode_dot_v1_dot_manufacturer__pb2 +from netboxlabs.diode.sdk.validate import validate_pb2 as validate_dot_validate__pb2 DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x1a\x64iode/v1/device_type.proto\x12\x08\x64iode.v1\x1a\x1b\x64iode/v1/manufacturer.proto\x1a\x17validate/validate.proto\"\x9a\x01\n\nDeviceType\x12:\n\x0cmanufacturer\x18\x01 \x01(\x0b\x32\x16.diode.v1.ManufacturerR\x0cmanufacturer\x12\x1f\n\x05model\x18\x02 \x01(\tB\t\xfa\x42\x06r\x04\x10\x01\x18\x64R\x05model\x12/\n\x04slug\x18\x03 \x01(\tB\x1b\xfa\x42\x18r\x16\x10\x01\x18\x64\x32\x10^[-a-zA-Z0-9_]+$R\x04slugB;Z9github.com/netboxlabs/diode/diode-sdk-go/diode/v1/diodepbb\x06proto3') @@ -21,12 +21,12 @@ _globals = globals() _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals) _builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'diode.v1.device_type_pb2', _globals) -if _descriptor._USE_C_DESCRIPTORS == False: - _globals['DESCRIPTOR']._options = None +if not _descriptor._USE_C_DESCRIPTORS: + _globals['DESCRIPTOR']._loaded_options = None _globals['DESCRIPTOR']._serialized_options = b'Z9github.com/netboxlabs/diode/diode-sdk-go/diode/v1/diodepb' - _globals['_DEVICETYPE'].fields_by_name['model']._options = None + _globals['_DEVICETYPE'].fields_by_name['model']._loaded_options = None _globals['_DEVICETYPE'].fields_by_name['model']._serialized_options = b'\372B\006r\004\020\001\030d' - _globals['_DEVICETYPE'].fields_by_name['slug']._options = None + _globals['_DEVICETYPE'].fields_by_name['slug']._loaded_options = None _globals['_DEVICETYPE'].fields_by_name['slug']._serialized_options = b'\372B\030r\026\020\001\030d2\020^[-a-zA-Z0-9_]+$' _globals['_DEVICETYPE']._serialized_start=95 _globals['_DEVICETYPE']._serialized_end=249 diff --git a/diode-sdk-python/netboxlabs/diode/sdk/diode/v1/device_type_pb2.pyi b/diode-sdk-python/netboxlabs/diode/sdk/diode/v1/device_type_pb2.pyi new file mode 100644 index 00000000..c66be7eb --- /dev/null +++ b/diode-sdk-python/netboxlabs/diode/sdk/diode/v1/device_type_pb2.pyi @@ -0,0 +1,17 @@ +from netboxlabs.diode.sdk.diode.v1 import manufacturer_pb2 as _manufacturer_pb2 +from netboxlabs.diode.sdk.validate import validate_pb2 as _validate_pb2 +from google.protobuf import descriptor as _descriptor +from google.protobuf import message as _message +from typing import ClassVar as _ClassVar, Mapping as _Mapping, Optional as _Optional, Union as _Union + +DESCRIPTOR: _descriptor.FileDescriptor + +class DeviceType(_message.Message): + __slots__ = ("manufacturer", "model", "slug") + MANUFACTURER_FIELD_NUMBER: _ClassVar[int] + MODEL_FIELD_NUMBER: _ClassVar[int] + SLUG_FIELD_NUMBER: _ClassVar[int] + manufacturer: _manufacturer_pb2.Manufacturer + model: str + slug: str + def __init__(self, manufacturer: _Optional[_Union[_manufacturer_pb2.Manufacturer, _Mapping]] = ..., model: _Optional[str] = ..., slug: _Optional[str] = ...) -> None: ... diff --git a/diode-sdk-python/netboxlabs/diode/sdk/diode/v1/distributor_pb2.py b/diode-sdk-python/netboxlabs/diode/sdk/diode/v1/distributor_pb2.py index 224ee014..6b951a84 100644 --- a/diode-sdk-python/netboxlabs/diode/sdk/diode/v1/distributor_pb2.py +++ b/diode-sdk-python/netboxlabs/diode/sdk/diode/v1/distributor_pb2.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: diode/v1/distributor.proto -# Protobuf Python Version: 4.25.1 +# Protobuf Python Version: 5.26.1 """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor_pool as _descriptor_pool @@ -12,15 +12,15 @@ _sym_db = _symbol_database.Default() -from diode.v1 import device_pb2 as diode_dot_v1_dot_device__pb2 -from diode.v1 import device_type_pb2 as diode_dot_v1_dot_device__type__pb2 -from diode.v1 import interface_pb2 as diode_dot_v1_dot_interface__pb2 -from diode.v1 import manufacturer_pb2 as diode_dot_v1_dot_manufacturer__pb2 -from diode.v1 import platform_pb2 as diode_dot_v1_dot_platform__pb2 -from diode.v1 import role_pb2 as diode_dot_v1_dot_role__pb2 -from diode.v1 import site_pb2 as diode_dot_v1_dot_site__pb2 +from netboxlabs.diode.sdk.diode.v1 import device_pb2 as diode_dot_v1_dot_device__pb2 +from netboxlabs.diode.sdk.diode.v1 import device_type_pb2 as diode_dot_v1_dot_device__type__pb2 +from netboxlabs.diode.sdk.diode.v1 import interface_pb2 as diode_dot_v1_dot_interface__pb2 +from netboxlabs.diode.sdk.diode.v1 import manufacturer_pb2 as diode_dot_v1_dot_manufacturer__pb2 +from netboxlabs.diode.sdk.diode.v1 import platform_pb2 as diode_dot_v1_dot_platform__pb2 +from netboxlabs.diode.sdk.diode.v1 import role_pb2 as diode_dot_v1_dot_role__pb2 +from netboxlabs.diode.sdk.diode.v1 import site_pb2 as diode_dot_v1_dot_site__pb2 from google.protobuf import timestamp_pb2 as google_dot_protobuf_dot_timestamp__pb2 -from validate import validate_pb2 as validate_dot_validate__pb2 +from netboxlabs.diode.sdk.validate import validate_pb2 as validate_dot_validate__pb2 DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x1a\x64iode/v1/distributor.proto\x12\x08\x64iode.v1\x1a\x15\x64iode/v1/device.proto\x1a\x1a\x64iode/v1/device_type.proto\x1a\x18\x64iode/v1/interface.proto\x1a\x1b\x64iode/v1/manufacturer.proto\x1a\x17\x64iode/v1/platform.proto\x1a\x13\x64iode/v1/role.proto\x1a\x13\x64iode/v1/site.proto\x1a\x1fgoogle/protobuf/timestamp.proto\x1a\x17validate/validate.proto\"\xbf\x03\n\x0cIngestEntity\x12$\n\x04site\x18\x01 \x01(\x0b\x32\x0e.diode.v1.SiteH\x00R\x04site\x12\x30\n\x08platform\x18\x02 \x01(\x0b\x32\x12.diode.v1.PlatformH\x00R\x08platform\x12<\n\x0cmanufacturer\x18\x03 \x01(\x0b\x32\x16.diode.v1.ManufacturerH\x00R\x0cmanufacturer\x12*\n\x06\x64\x65vice\x18\x04 \x01(\x0b\x32\x10.diode.v1.DeviceH\x00R\x06\x64\x65vice\x12\x31\n\x0b\x64\x65vice_role\x18\x05 \x01(\x0b\x32\x0e.diode.v1.RoleH\x00R\ndeviceRole\x12\x37\n\x0b\x64\x65vice_type\x18\x06 \x01(\x0b\x32\x14.diode.v1.DeviceTypeH\x00R\ndeviceType\x12\x33\n\tinterface\x18\x07 \x01(\x0b\x32\x13.diode.v1.InterfaceH\x00R\tinterface\x12\x44\n\ttimestamp\x18\x08 \x01(\x0b\x32\x1a.google.protobuf.TimestampB\n\xfa\x42\x07\xb2\x01\x04\x08\x01\x38\x01R\ttimestampB\x06\n\x04\x64\x61ta\"\xe0\x02\n\x0bPushRequest\x12\"\n\x06stream\x18\x01 \x01(\tB\n\xfa\x42\x07r\x05\x10\x01\x18\xff\x01R\x06stream\x12\x37\n\x04\x64\x61ta\x18\x02 \x03(\x0b\x32\x16.diode.v1.IngestEntityB\x0b\xfa\x42\x08\x92\x01\x05\x08\x01\x10\xe8\x07R\x04\x64\x61ta\x12\x18\n\x02id\x18\x03 \x01(\tB\x08\xfa\x42\x05r\x03\xb0\x01\x01R\x02id\x12\x36\n\x11producer_app_name\x18\x04 \x01(\tB\n\xfa\x42\x07r\x05\x10\x01\x18\xff\x01R\x0fproducerAppName\x12<\n\x14producer_app_version\x18\x05 \x01(\tB\n\xfa\x42\x07r\x05\x10\x01\x18\xff\x01R\x12producerAppVersion\x12%\n\x08sdk_name\x18\x06 \x01(\tB\n\xfa\x42\x07r\x05\x10\x01\x18\xff\x01R\x07sdkName\x12=\n\x0bsdk_version\x18\x07 \x01(\tB\x1c\xfa\x42\x19r\x17\x32\x15^(\\d)+\\.(\\d)+\\.(\\d)+$R\nsdkVersion\"&\n\x0cPushResponse\x12\x16\n\x06\x65rrors\x18\x01 \x03(\tR\x06\x65rrors2M\n\x12\x44istributorService\x12\x37\n\x04Push\x12\x15.diode.v1.PushRequest\x1a\x16.diode.v1.PushResponse\"\x00\x42;Z9github.com/netboxlabs/diode/diode-sdk-go/diode/v1/diodepbb\x06proto3') @@ -28,24 +28,24 @@ _globals = globals() _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals) _builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'diode.v1.distributor_pb2', _globals) -if _descriptor._USE_C_DESCRIPTORS == False: - _globals['DESCRIPTOR']._options = None +if not _descriptor._USE_C_DESCRIPTORS: + _globals['DESCRIPTOR']._loaded_options = None _globals['DESCRIPTOR']._serialized_options = b'Z9github.com/netboxlabs/diode/diode-sdk-go/diode/v1/diodepb' - _globals['_INGESTENTITY'].fields_by_name['timestamp']._options = None + _globals['_INGESTENTITY'].fields_by_name['timestamp']._loaded_options = None _globals['_INGESTENTITY'].fields_by_name['timestamp']._serialized_options = b'\372B\007\262\001\004\010\0018\001' - _globals['_PUSHREQUEST'].fields_by_name['stream']._options = None + _globals['_PUSHREQUEST'].fields_by_name['stream']._loaded_options = None _globals['_PUSHREQUEST'].fields_by_name['stream']._serialized_options = b'\372B\007r\005\020\001\030\377\001' - _globals['_PUSHREQUEST'].fields_by_name['data']._options = None + _globals['_PUSHREQUEST'].fields_by_name['data']._loaded_options = None _globals['_PUSHREQUEST'].fields_by_name['data']._serialized_options = b'\372B\010\222\001\005\010\001\020\350\007' - _globals['_PUSHREQUEST'].fields_by_name['id']._options = None + _globals['_PUSHREQUEST'].fields_by_name['id']._loaded_options = None _globals['_PUSHREQUEST'].fields_by_name['id']._serialized_options = b'\372B\005r\003\260\001\001' - _globals['_PUSHREQUEST'].fields_by_name['producer_app_name']._options = None + _globals['_PUSHREQUEST'].fields_by_name['producer_app_name']._loaded_options = None _globals['_PUSHREQUEST'].fields_by_name['producer_app_name']._serialized_options = b'\372B\007r\005\020\001\030\377\001' - _globals['_PUSHREQUEST'].fields_by_name['producer_app_version']._options = None + _globals['_PUSHREQUEST'].fields_by_name['producer_app_version']._loaded_options = None _globals['_PUSHREQUEST'].fields_by_name['producer_app_version']._serialized_options = b'\372B\007r\005\020\001\030\377\001' - _globals['_PUSHREQUEST'].fields_by_name['sdk_name']._options = None + _globals['_PUSHREQUEST'].fields_by_name['sdk_name']._loaded_options = None _globals['_PUSHREQUEST'].fields_by_name['sdk_name']._serialized_options = b'\372B\007r\005\020\001\030\377\001' - _globals['_PUSHREQUEST'].fields_by_name['sdk_version']._options = None + _globals['_PUSHREQUEST'].fields_by_name['sdk_version']._loaded_options = None _globals['_PUSHREQUEST'].fields_by_name['sdk_version']._serialized_options = b'\372B\031r\0272\025^(\\d)+\\.(\\d)+\\.(\\d)+$' _globals['_INGESTENTITY']._serialized_start=272 _globals['_INGESTENTITY']._serialized_end=719 diff --git a/diode-sdk-python/netboxlabs/diode/sdk/diode/v1/distributor_pb2.pyi b/diode-sdk-python/netboxlabs/diode/sdk/diode/v1/distributor_pb2.pyi new file mode 100644 index 00000000..ab7495ea --- /dev/null +++ b/diode-sdk-python/netboxlabs/diode/sdk/diode/v1/distributor_pb2.pyi @@ -0,0 +1,59 @@ +from netboxlabs.diode.sdk.diode.v1 import device_pb2 as _device_pb2 +from netboxlabs.diode.sdk.diode.v1 import device_type_pb2 as _device_type_pb2 +from netboxlabs.diode.sdk.diode.v1 import interface_pb2 as _interface_pb2 +from netboxlabs.diode.sdk.diode.v1 import manufacturer_pb2 as _manufacturer_pb2 +from netboxlabs.diode.sdk.diode.v1 import platform_pb2 as _platform_pb2 +from netboxlabs.diode.sdk.diode.v1 import role_pb2 as _role_pb2 +from netboxlabs.diode.sdk.diode.v1 import site_pb2 as _site_pb2 +from google.protobuf import timestamp_pb2 as _timestamp_pb2 +from netboxlabs.diode.sdk.validate import validate_pb2 as _validate_pb2 +from google.protobuf.internal import containers as _containers +from google.protobuf import descriptor as _descriptor +from google.protobuf import message as _message +from typing import ClassVar as _ClassVar, Iterable as _Iterable, Mapping as _Mapping, Optional as _Optional, Union as _Union + +DESCRIPTOR: _descriptor.FileDescriptor + +class IngestEntity(_message.Message): + __slots__ = ("site", "platform", "manufacturer", "device", "device_role", "device_type", "interface", "timestamp") + SITE_FIELD_NUMBER: _ClassVar[int] + PLATFORM_FIELD_NUMBER: _ClassVar[int] + MANUFACTURER_FIELD_NUMBER: _ClassVar[int] + DEVICE_FIELD_NUMBER: _ClassVar[int] + DEVICE_ROLE_FIELD_NUMBER: _ClassVar[int] + DEVICE_TYPE_FIELD_NUMBER: _ClassVar[int] + INTERFACE_FIELD_NUMBER: _ClassVar[int] + TIMESTAMP_FIELD_NUMBER: _ClassVar[int] + site: _site_pb2.Site + platform: _platform_pb2.Platform + manufacturer: _manufacturer_pb2.Manufacturer + device: _device_pb2.Device + device_role: _role_pb2.Role + device_type: _device_type_pb2.DeviceType + interface: _interface_pb2.Interface + timestamp: _timestamp_pb2.Timestamp + def __init__(self, site: _Optional[_Union[_site_pb2.Site, _Mapping]] = ..., platform: _Optional[_Union[_platform_pb2.Platform, _Mapping]] = ..., manufacturer: _Optional[_Union[_manufacturer_pb2.Manufacturer, _Mapping]] = ..., device: _Optional[_Union[_device_pb2.Device, _Mapping]] = ..., device_role: _Optional[_Union[_role_pb2.Role, _Mapping]] = ..., device_type: _Optional[_Union[_device_type_pb2.DeviceType, _Mapping]] = ..., interface: _Optional[_Union[_interface_pb2.Interface, _Mapping]] = ..., timestamp: _Optional[_Union[_timestamp_pb2.Timestamp, _Mapping]] = ...) -> None: ... + +class PushRequest(_message.Message): + __slots__ = ("stream", "data", "id", "producer_app_name", "producer_app_version", "sdk_name", "sdk_version") + STREAM_FIELD_NUMBER: _ClassVar[int] + DATA_FIELD_NUMBER: _ClassVar[int] + ID_FIELD_NUMBER: _ClassVar[int] + PRODUCER_APP_NAME_FIELD_NUMBER: _ClassVar[int] + PRODUCER_APP_VERSION_FIELD_NUMBER: _ClassVar[int] + SDK_NAME_FIELD_NUMBER: _ClassVar[int] + SDK_VERSION_FIELD_NUMBER: _ClassVar[int] + stream: str + data: _containers.RepeatedCompositeFieldContainer[IngestEntity] + id: str + producer_app_name: str + producer_app_version: str + sdk_name: str + sdk_version: str + def __init__(self, stream: _Optional[str] = ..., data: _Optional[_Iterable[_Union[IngestEntity, _Mapping]]] = ..., id: _Optional[str] = ..., producer_app_name: _Optional[str] = ..., producer_app_version: _Optional[str] = ..., sdk_name: _Optional[str] = ..., sdk_version: _Optional[str] = ...) -> None: ... + +class PushResponse(_message.Message): + __slots__ = ("errors",) + ERRORS_FIELD_NUMBER: _ClassVar[int] + errors: _containers.RepeatedScalarFieldContainer[str] + def __init__(self, errors: _Optional[_Iterable[str]] = ...) -> None: ... diff --git a/diode-sdk-python/netboxlabs/diode/sdk/diode/v1/distributor_pb2_grpc.py b/diode-sdk-python/netboxlabs/diode/sdk/diode/v1/distributor_pb2_grpc.py index b559e2bc..4d39a145 100644 --- a/diode-sdk-python/netboxlabs/diode/sdk/diode/v1/distributor_pb2_grpc.py +++ b/diode-sdk-python/netboxlabs/diode/sdk/diode/v1/distributor_pb2_grpc.py @@ -2,7 +2,7 @@ """Client and server classes corresponding to protobuf-defined services.""" import grpc -from diode.v1 import distributor_pb2 as diode_dot_v1_dot_distributor__pb2 +from netboxlabs.diode.sdk.diode.v1 import distributor_pb2 as diode_dot_v1_dot_distributor__pb2 class DistributorServiceStub(object): diff --git a/diode-sdk-python/netboxlabs/diode/sdk/diode/v1/interface_pb2.py b/diode-sdk-python/netboxlabs/diode/sdk/diode/v1/interface_pb2.py index 0372594b..0b38e18c 100644 --- a/diode-sdk-python/netboxlabs/diode/sdk/diode/v1/interface_pb2.py +++ b/diode-sdk-python/netboxlabs/diode/sdk/diode/v1/interface_pb2.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: diode/v1/interface.proto -# Protobuf Python Version: 4.25.1 +# Protobuf Python Version: 5.26.1 """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor_pool as _descriptor_pool @@ -13,7 +13,7 @@ from google.protobuf import any_pb2 as google_dot_protobuf_dot_any__pb2 -from validate import validate_pb2 as validate_dot_validate__pb2 +from netboxlabs.diode.sdk.validate import validate_pb2 as validate_dot_validate__pb2 DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x18\x64iode/v1/interface.proto\x12\x08\x64iode.v1\x1a\x19google/protobuf/any.proto\x1a\x17validate/validate.proto\"\xd6\x0e\n\tInterface\x12\x36\n\x06\x64\x65vice\x18\x01 \x01(\x0b\x32\x14.google.protobuf.AnyB\x08\xfa\x42\x05\xa2\x01\x02\x08\x01R\x06\x64\x65vice\x12\x1d\n\x04name\x18\x02 \x01(\tB\t\xfa\x42\x06r\x04\x10\x01\x18@R\x04name\x12\xfa\x0c\n\x04type\x18\x03 \x01(\tB\xe5\x0c\xfa\x42\xe1\x0cr\xde\x0cR\x07virtualR\x06\x62ridgeR\x03lagR\n100base-fxR\x0b\x31\x30\x30\x62\x61se-lfxR\n100base-txR\n100base-t1R\n1000base-tR\x0f\x31\x30\x30\x30\x62\x61se-x-gbicR\x0e\x31\x30\x30\x30\x62\x61se-x-sfpR\n2.5gbase-tR\x08\x35gbase-tR\t10gbase-tR\x0b\x31\x30gbase-cx4R\x0e\x31\x30gbase-x-sfppR\r10gbase-x-xfpR\x10\x31\x30gbase-x-xenpakR\x0c\x31\x30gbase-x-x2R\x0f\x32\x35gbase-x-sfp28R\x0f\x35\x30gbase-x-sfp56R\x0f\x34\x30gbase-x-qsfppR\x0f\x35\x30gbase-x-sfp28R\x0e\x31\x30\x30gbase-x-cfpR\x0f\x31\x30\x30gbase-x-cfp2R\x0f\x31\x30\x30gbase-x-cfp4R\x0e\x31\x30\x30gbase-x-cxpR\x0f\x31\x30\x30gbase-x-cpakR\x0f\x31\x30\x30gbase-x-dsfpR\x10\x31\x30\x30gbase-x-sfpddR\x11\x31\x30\x30gbase-x-qsfp28R\x11\x31\x30\x30gbase-x-qsfpddR\x0f\x32\x30\x30gbase-x-cfp2R\x11\x32\x30\x30gbase-x-qsfp56R\x11\x32\x30\x30gbase-x-qsfpddR\x0f\x34\x30\x30gbase-x-cfp2R\x12\x34\x30\x30gbase-x-qsfp112R\x11\x34\x30\x30gbase-x-qsfpddR\x0f\x34\x30\x30gbase-x-osfpR\x13\x34\x30\x30gbase-x-osfp-rhsR\x0f\x34\x30\x30gbase-x-cdfpR\x0f\x34\x30\x30gbase-x-cfp8R\x11\x38\x30\x30gbase-x-qsfpddR\x0f\x38\x30\x30gbase-x-osfpR\x0b\x31\x30\x30\x30\x62\x61se-kxR\n10gbase-krR\x0b\x31\x30gbase-kx4R\n25gbase-krR\x0b\x34\x30gbase-kr4R\n50gbase-krR\x0c\x31\x30\x30gbase-kp4R\x0c\x31\x30\x30gbase-kr2R\x0c\x31\x30\x30gbase-kr4R\x0bieee802.11aR\x0bieee802.11gR\x0bieee802.11nR\x0cieee802.11acR\x0cieee802.11adR\x0cieee802.11axR\x0cieee802.11ayR\x0cieee802.15.1R\x0eother-wirelessR\x03gsmR\x04\x63\x64maR\x03lteR\tsonet-oc3R\nsonet-oc12R\nsonet-oc48R\x0bsonet-oc192R\x0bsonet-oc768R\x0csonet-oc1920R\x0csonet-oc3840R\x08\x31gfc-sfpR\x08\x32gfc-sfpR\x08\x34gfc-sfpR\t8gfc-sfppR\n16gfc-sfppR\x0b\x33\x32gfc-sfp28R\x0b\x36\x34gfc-qsfppR\r128gfc-qsfp28R\x0einfiniband-sdrR\x0einfiniband-ddrR\x0einfiniband-qdrR\x10infiniband-fdr10R\x0einfiniband-fdrR\x0einfiniband-edrR\x0einfiniband-hdrR\x0einfiniband-ndrR\x0einfiniband-xdrR\x02t1R\x02\x65\x31R\x02t3R\x02\x65\x33R\x04xdslR\x06\x64ocsisR\x04gponR\x06xg-ponR\x07xgs-ponR\x07ng-pon2R\x04\x65ponR\x08\x31\x30g-eponR\x0f\x63isco-stackwiseR\x14\x63isco-stackwise-plusR\x0f\x63isco-flexstackR\x14\x63isco-flexstack-plusR\x12\x63isco-stackwise-80R\x13\x63isco-stackwise-160R\x13\x63isco-stackwise-320R\x13\x63isco-stackwise-480R\x12\x63isco-stackwise-1tR\x0bjuniper-vcpR\x13\x65xtreme-summitstackR\x17\x65xtreme-summitstack-128R\x17\x65xtreme-summitstack-256R\x17\x65xtreme-summitstack-512R\x05otherR\x04type\x12\x18\n\x07\x65nabled\x18\x04 \x01(\x08R\x07\x65nabled\x12\x1d\n\x03mtu\x18\x05 \x01(\x05\x42\x0b\xfa\x42\x08\x1a\x06\x18\x80\x80\x04(\x01R\x03mtu\x12\x1f\n\x0bmac_address\x18\x06 \x01(\tR\nmacAddress\x12\x1b\n\tmgmt_only\x18\x07 \x01(\x08R\x08mgmtOnlyB;Z9github.com/netboxlabs/diode/diode-sdk-go/diode/v1/diodepbb\x06proto3') @@ -21,16 +21,16 @@ _globals = globals() _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals) _builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'diode.v1.interface_pb2', _globals) -if _descriptor._USE_C_DESCRIPTORS == False: - _globals['DESCRIPTOR']._options = None +if not _descriptor._USE_C_DESCRIPTORS: + _globals['DESCRIPTOR']._loaded_options = None _globals['DESCRIPTOR']._serialized_options = b'Z9github.com/netboxlabs/diode/diode-sdk-go/diode/v1/diodepb' - _globals['_INTERFACE'].fields_by_name['device']._options = None + _globals['_INTERFACE'].fields_by_name['device']._loaded_options = None _globals['_INTERFACE'].fields_by_name['device']._serialized_options = b'\372B\005\242\001\002\010\001' - _globals['_INTERFACE'].fields_by_name['name']._options = None + _globals['_INTERFACE'].fields_by_name['name']._loaded_options = None _globals['_INTERFACE'].fields_by_name['name']._serialized_options = b'\372B\006r\004\020\001\030@' - _globals['_INTERFACE'].fields_by_name['type']._options = None + _globals['_INTERFACE'].fields_by_name['type']._loaded_options = None _globals['_INTERFACE'].fields_by_name['type']._serialized_options = b'\372B\341\014r\336\014R\007virtualR\006bridgeR\003lagR\n100base-fxR\013100base-lfxR\n100base-txR\n100base-t1R\n1000base-tR\0171000base-x-gbicR\0161000base-x-sfpR\n2.5gbase-tR\0105gbase-tR\t10gbase-tR\01310gbase-cx4R\01610gbase-x-sfppR\r10gbase-x-xfpR\02010gbase-x-xenpakR\01410gbase-x-x2R\01725gbase-x-sfp28R\01750gbase-x-sfp56R\01740gbase-x-qsfppR\01750gbase-x-sfp28R\016100gbase-x-cfpR\017100gbase-x-cfp2R\017100gbase-x-cfp4R\016100gbase-x-cxpR\017100gbase-x-cpakR\017100gbase-x-dsfpR\020100gbase-x-sfpddR\021100gbase-x-qsfp28R\021100gbase-x-qsfpddR\017200gbase-x-cfp2R\021200gbase-x-qsfp56R\021200gbase-x-qsfpddR\017400gbase-x-cfp2R\022400gbase-x-qsfp112R\021400gbase-x-qsfpddR\017400gbase-x-osfpR\023400gbase-x-osfp-rhsR\017400gbase-x-cdfpR\017400gbase-x-cfp8R\021800gbase-x-qsfpddR\017800gbase-x-osfpR\0131000base-kxR\n10gbase-krR\01310gbase-kx4R\n25gbase-krR\01340gbase-kr4R\n50gbase-krR\014100gbase-kp4R\014100gbase-kr2R\014100gbase-kr4R\013ieee802.11aR\013ieee802.11gR\013ieee802.11nR\014ieee802.11acR\014ieee802.11adR\014ieee802.11axR\014ieee802.11ayR\014ieee802.15.1R\016other-wirelessR\003gsmR\004cdmaR\003lteR\tsonet-oc3R\nsonet-oc12R\nsonet-oc48R\013sonet-oc192R\013sonet-oc768R\014sonet-oc1920R\014sonet-oc3840R\0101gfc-sfpR\0102gfc-sfpR\0104gfc-sfpR\t8gfc-sfppR\n16gfc-sfppR\01332gfc-sfp28R\01364gfc-qsfppR\r128gfc-qsfp28R\016infiniband-sdrR\016infiniband-ddrR\016infiniband-qdrR\020infiniband-fdr10R\016infiniband-fdrR\016infiniband-edrR\016infiniband-hdrR\016infiniband-ndrR\016infiniband-xdrR\002t1R\002e1R\002t3R\002e3R\004xdslR\006docsisR\004gponR\006xg-ponR\007xgs-ponR\007ng-pon2R\004eponR\01010g-eponR\017cisco-stackwiseR\024cisco-stackwise-plusR\017cisco-flexstackR\024cisco-flexstack-plusR\022cisco-stackwise-80R\023cisco-stackwise-160R\023cisco-stackwise-320R\023cisco-stackwise-480R\022cisco-stackwise-1tR\013juniper-vcpR\023extreme-summitstackR\027extreme-summitstack-128R\027extreme-summitstack-256R\027extreme-summitstack-512R\005other' - _globals['_INTERFACE'].fields_by_name['mtu']._options = None + _globals['_INTERFACE'].fields_by_name['mtu']._loaded_options = None _globals['_INTERFACE'].fields_by_name['mtu']._serialized_options = b'\372B\010\032\006\030\200\200\004(\001' _globals['_INTERFACE']._serialized_start=91 _globals['_INTERFACE']._serialized_end=1969 diff --git a/diode-sdk-python/netboxlabs/diode/sdk/diode/v1/interface_pb2.pyi b/diode-sdk-python/netboxlabs/diode/sdk/diode/v1/interface_pb2.pyi new file mode 100644 index 00000000..b7cf0084 --- /dev/null +++ b/diode-sdk-python/netboxlabs/diode/sdk/diode/v1/interface_pb2.pyi @@ -0,0 +1,25 @@ +from google.protobuf import any_pb2 as _any_pb2 +from netboxlabs.diode.sdk.validate import validate_pb2 as _validate_pb2 +from google.protobuf import descriptor as _descriptor +from google.protobuf import message as _message +from typing import ClassVar as _ClassVar, Mapping as _Mapping, Optional as _Optional, Union as _Union + +DESCRIPTOR: _descriptor.FileDescriptor + +class Interface(_message.Message): + __slots__ = ("device", "name", "type", "enabled", "mtu", "mac_address", "mgmt_only") + DEVICE_FIELD_NUMBER: _ClassVar[int] + NAME_FIELD_NUMBER: _ClassVar[int] + TYPE_FIELD_NUMBER: _ClassVar[int] + ENABLED_FIELD_NUMBER: _ClassVar[int] + MTU_FIELD_NUMBER: _ClassVar[int] + MAC_ADDRESS_FIELD_NUMBER: _ClassVar[int] + MGMT_ONLY_FIELD_NUMBER: _ClassVar[int] + device: _any_pb2.Any + name: str + type: str + enabled: bool + mtu: int + mac_address: str + mgmt_only: bool + def __init__(self, device: _Optional[_Union[_any_pb2.Any, _Mapping]] = ..., name: _Optional[str] = ..., type: _Optional[str] = ..., enabled: bool = ..., mtu: _Optional[int] = ..., mac_address: _Optional[str] = ..., mgmt_only: bool = ...) -> None: ... diff --git a/diode-sdk-python/netboxlabs/diode/sdk/diode/v1/manufacturer_pb2.py b/diode-sdk-python/netboxlabs/diode/sdk/diode/v1/manufacturer_pb2.py index 894fbbff..3d10f98c 100644 --- a/diode-sdk-python/netboxlabs/diode/sdk/diode/v1/manufacturer_pb2.py +++ b/diode-sdk-python/netboxlabs/diode/sdk/diode/v1/manufacturer_pb2.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: diode/v1/manufacturer.proto -# Protobuf Python Version: 4.25.1 +# Protobuf Python Version: 5.26.1 """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor_pool as _descriptor_pool @@ -12,7 +12,7 @@ _sym_db = _symbol_database.Default() -from validate import validate_pb2 as validate_dot_validate__pb2 +from netboxlabs.diode.sdk.validate import validate_pb2 as validate_dot_validate__pb2 DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x1b\x64iode/v1/manufacturer.proto\x12\x08\x64iode.v1\x1a\x17validate/validate.proto\"^\n\x0cManufacturer\x12\x1d\n\x04name\x18\x01 \x01(\tB\t\xfa\x42\x06r\x04\x10\x01\x18\x64R\x04name\x12/\n\x04slug\x18\x02 \x01(\tB\x1b\xfa\x42\x18r\x16\x10\x01\x18\x64\x32\x10^[-a-zA-Z0-9_]+$R\x04slugB;Z9github.com/netboxlabs/diode/diode-sdk-go/diode/v1/diodepbb\x06proto3') @@ -20,12 +20,12 @@ _globals = globals() _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals) _builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'diode.v1.manufacturer_pb2', _globals) -if _descriptor._USE_C_DESCRIPTORS == False: - _globals['DESCRIPTOR']._options = None +if not _descriptor._USE_C_DESCRIPTORS: + _globals['DESCRIPTOR']._loaded_options = None _globals['DESCRIPTOR']._serialized_options = b'Z9github.com/netboxlabs/diode/diode-sdk-go/diode/v1/diodepb' - _globals['_MANUFACTURER'].fields_by_name['name']._options = None + _globals['_MANUFACTURER'].fields_by_name['name']._loaded_options = None _globals['_MANUFACTURER'].fields_by_name['name']._serialized_options = b'\372B\006r\004\020\001\030d' - _globals['_MANUFACTURER'].fields_by_name['slug']._options = None + _globals['_MANUFACTURER'].fields_by_name['slug']._loaded_options = None _globals['_MANUFACTURER'].fields_by_name['slug']._serialized_options = b'\372B\030r\026\020\001\030d2\020^[-a-zA-Z0-9_]+$' _globals['_MANUFACTURER']._serialized_start=66 _globals['_MANUFACTURER']._serialized_end=160 diff --git a/diode-sdk-python/netboxlabs/diode/sdk/diode/v1/manufacturer_pb2.pyi b/diode-sdk-python/netboxlabs/diode/sdk/diode/v1/manufacturer_pb2.pyi new file mode 100644 index 00000000..85a8fa88 --- /dev/null +++ b/diode-sdk-python/netboxlabs/diode/sdk/diode/v1/manufacturer_pb2.pyi @@ -0,0 +1,14 @@ +from netboxlabs.diode.sdk.validate import validate_pb2 as _validate_pb2 +from google.protobuf import descriptor as _descriptor +from google.protobuf import message as _message +from typing import ClassVar as _ClassVar, Optional as _Optional + +DESCRIPTOR: _descriptor.FileDescriptor + +class Manufacturer(_message.Message): + __slots__ = ("name", "slug") + NAME_FIELD_NUMBER: _ClassVar[int] + SLUG_FIELD_NUMBER: _ClassVar[int] + name: str + slug: str + def __init__(self, name: _Optional[str] = ..., slug: _Optional[str] = ...) -> None: ... diff --git a/diode-sdk-python/netboxlabs/diode/sdk/diode/v1/platform_pb2.py b/diode-sdk-python/netboxlabs/diode/sdk/diode/v1/platform_pb2.py index 0851f7b6..d2e9f21b 100644 --- a/diode-sdk-python/netboxlabs/diode/sdk/diode/v1/platform_pb2.py +++ b/diode-sdk-python/netboxlabs/diode/sdk/diode/v1/platform_pb2.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: diode/v1/platform.proto -# Protobuf Python Version: 4.25.1 +# Protobuf Python Version: 5.26.1 """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor_pool as _descriptor_pool @@ -12,7 +12,7 @@ _sym_db = _symbol_database.Default() -from validate import validate_pb2 as validate_dot_validate__pb2 +from netboxlabs.diode.sdk.validate import validate_pb2 as validate_dot_validate__pb2 DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x17\x64iode/v1/platform.proto\x12\x08\x64iode.v1\x1a\x17validate/validate.proto\"B\n\x08Platform\x12\x17\n\x02id\x18\x01 \x01(\x04\x42\x07\xfa\x42\x04\x32\x02(\x01R\x02id\x12\x1d\n\x04name\x18\x02 \x01(\tB\t\xfa\x42\x06r\x04\x10\x01\x18\x64R\x04nameB;Z9github.com/netboxlabs/diode/diode-sdk-go/diode/v1/diodepbb\x06proto3') @@ -20,12 +20,12 @@ _globals = globals() _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals) _builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'diode.v1.platform_pb2', _globals) -if _descriptor._USE_C_DESCRIPTORS == False: - _globals['DESCRIPTOR']._options = None +if not _descriptor._USE_C_DESCRIPTORS: + _globals['DESCRIPTOR']._loaded_options = None _globals['DESCRIPTOR']._serialized_options = b'Z9github.com/netboxlabs/diode/diode-sdk-go/diode/v1/diodepb' - _globals['_PLATFORM'].fields_by_name['id']._options = None + _globals['_PLATFORM'].fields_by_name['id']._loaded_options = None _globals['_PLATFORM'].fields_by_name['id']._serialized_options = b'\372B\0042\002(\001' - _globals['_PLATFORM'].fields_by_name['name']._options = None + _globals['_PLATFORM'].fields_by_name['name']._loaded_options = None _globals['_PLATFORM'].fields_by_name['name']._serialized_options = b'\372B\006r\004\020\001\030d' _globals['_PLATFORM']._serialized_start=62 _globals['_PLATFORM']._serialized_end=128 diff --git a/diode-sdk-python/netboxlabs/diode/sdk/diode/v1/platform_pb2.pyi b/diode-sdk-python/netboxlabs/diode/sdk/diode/v1/platform_pb2.pyi new file mode 100644 index 00000000..ea1137e8 --- /dev/null +++ b/diode-sdk-python/netboxlabs/diode/sdk/diode/v1/platform_pb2.pyi @@ -0,0 +1,14 @@ +from netboxlabs.diode.sdk.validate import validate_pb2 as _validate_pb2 +from google.protobuf import descriptor as _descriptor +from google.protobuf import message as _message +from typing import ClassVar as _ClassVar, Optional as _Optional + +DESCRIPTOR: _descriptor.FileDescriptor + +class Platform(_message.Message): + __slots__ = ("id", "name") + ID_FIELD_NUMBER: _ClassVar[int] + NAME_FIELD_NUMBER: _ClassVar[int] + id: int + name: str + def __init__(self, id: _Optional[int] = ..., name: _Optional[str] = ...) -> None: ... diff --git a/diode-sdk-python/netboxlabs/diode/sdk/diode/v1/role_pb2.py b/diode-sdk-python/netboxlabs/diode/sdk/diode/v1/role_pb2.py index 36f072f8..5e0fc579 100644 --- a/diode-sdk-python/netboxlabs/diode/sdk/diode/v1/role_pb2.py +++ b/diode-sdk-python/netboxlabs/diode/sdk/diode/v1/role_pb2.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: diode/v1/role.proto -# Protobuf Python Version: 4.25.1 +# Protobuf Python Version: 5.26.1 """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor_pool as _descriptor_pool @@ -12,7 +12,7 @@ _sym_db = _symbol_database.Default() -from validate import validate_pb2 as validate_dot_validate__pb2 +from netboxlabs.diode.sdk.validate import validate_pb2 as validate_dot_validate__pb2 DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x13\x64iode/v1/role.proto\x12\x08\x64iode.v1\x1a\x17validate/validate.proto\"o\n\x04Role\x12\x1d\n\x04name\x18\x01 \x01(\tB\t\xfa\x42\x06r\x04\x10\x01\x18\x64R\x04name\x12/\n\x04slug\x18\x02 \x01(\tB\x1b\xfa\x42\x18r\x16\x10\x01\x18\x64\x32\x10^[-a-zA-Z0-9_]+$R\x04slug\x12\x17\n\x07vm_role\x18\x03 \x01(\x08R\x06vmRoleB;Z9github.com/netboxlabs/diode/diode-sdk-go/diode/v1/diodepbb\x06proto3') @@ -20,12 +20,12 @@ _globals = globals() _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals) _builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'diode.v1.role_pb2', _globals) -if _descriptor._USE_C_DESCRIPTORS == False: - _globals['DESCRIPTOR']._options = None +if not _descriptor._USE_C_DESCRIPTORS: + _globals['DESCRIPTOR']._loaded_options = None _globals['DESCRIPTOR']._serialized_options = b'Z9github.com/netboxlabs/diode/diode-sdk-go/diode/v1/diodepb' - _globals['_ROLE'].fields_by_name['name']._options = None + _globals['_ROLE'].fields_by_name['name']._loaded_options = None _globals['_ROLE'].fields_by_name['name']._serialized_options = b'\372B\006r\004\020\001\030d' - _globals['_ROLE'].fields_by_name['slug']._options = None + _globals['_ROLE'].fields_by_name['slug']._loaded_options = None _globals['_ROLE'].fields_by_name['slug']._serialized_options = b'\372B\030r\026\020\001\030d2\020^[-a-zA-Z0-9_]+$' _globals['_ROLE']._serialized_start=58 _globals['_ROLE']._serialized_end=169 diff --git a/diode-sdk-python/netboxlabs/diode/sdk/diode/v1/role_pb2.pyi b/diode-sdk-python/netboxlabs/diode/sdk/diode/v1/role_pb2.pyi new file mode 100644 index 00000000..c7cecc14 --- /dev/null +++ b/diode-sdk-python/netboxlabs/diode/sdk/diode/v1/role_pb2.pyi @@ -0,0 +1,16 @@ +from netboxlabs.diode.sdk.validate import validate_pb2 as _validate_pb2 +from google.protobuf import descriptor as _descriptor +from google.protobuf import message as _message +from typing import ClassVar as _ClassVar, Optional as _Optional + +DESCRIPTOR: _descriptor.FileDescriptor + +class Role(_message.Message): + __slots__ = ("name", "slug", "vm_role") + NAME_FIELD_NUMBER: _ClassVar[int] + SLUG_FIELD_NUMBER: _ClassVar[int] + VM_ROLE_FIELD_NUMBER: _ClassVar[int] + name: str + slug: str + vm_role: bool + def __init__(self, name: _Optional[str] = ..., slug: _Optional[str] = ..., vm_role: bool = ...) -> None: ... diff --git a/diode-sdk-python/netboxlabs/diode/sdk/diode/v1/site_pb2.py b/diode-sdk-python/netboxlabs/diode/sdk/diode/v1/site_pb2.py index 2ca93447..82fb09d3 100644 --- a/diode-sdk-python/netboxlabs/diode/sdk/diode/v1/site_pb2.py +++ b/diode-sdk-python/netboxlabs/diode/sdk/diode/v1/site_pb2.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: diode/v1/site.proto -# Protobuf Python Version: 4.25.1 +# Protobuf Python Version: 5.26.1 """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor_pool as _descriptor_pool @@ -12,7 +12,7 @@ _sym_db = _symbol_database.Default() -from validate import validate_pb2 as validate_dot_validate__pb2 +from netboxlabs.diode.sdk.validate import validate_pb2 as validate_dot_validate__pb2 DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x13\x64iode/v1/site.proto\x12\x08\x64iode.v1\x1a\x17validate/validate.proto\"V\n\x04Site\x12\x1d\n\x04name\x18\x01 \x01(\tB\t\xfa\x42\x06r\x04\x10\x01\x18\x64R\x04name\x12/\n\x04slug\x18\x02 \x01(\tB\x1b\xfa\x42\x18r\x16\x10\x01\x18\x64\x32\x10^[-a-zA-Z0-9_]+$R\x04slugB;Z9github.com/netboxlabs/diode/diode-sdk-go/diode/v1/diodepbb\x06proto3') @@ -20,12 +20,12 @@ _globals = globals() _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals) _builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'diode.v1.site_pb2', _globals) -if _descriptor._USE_C_DESCRIPTORS == False: - _globals['DESCRIPTOR']._options = None +if not _descriptor._USE_C_DESCRIPTORS: + _globals['DESCRIPTOR']._loaded_options = None _globals['DESCRIPTOR']._serialized_options = b'Z9github.com/netboxlabs/diode/diode-sdk-go/diode/v1/diodepb' - _globals['_SITE'].fields_by_name['name']._options = None + _globals['_SITE'].fields_by_name['name']._loaded_options = None _globals['_SITE'].fields_by_name['name']._serialized_options = b'\372B\006r\004\020\001\030d' - _globals['_SITE'].fields_by_name['slug']._options = None + _globals['_SITE'].fields_by_name['slug']._loaded_options = None _globals['_SITE'].fields_by_name['slug']._serialized_options = b'\372B\030r\026\020\001\030d2\020^[-a-zA-Z0-9_]+$' _globals['_SITE']._serialized_start=58 _globals['_SITE']._serialized_end=144 diff --git a/diode-sdk-python/netboxlabs/diode/sdk/diode/v1/site_pb2.pyi b/diode-sdk-python/netboxlabs/diode/sdk/diode/v1/site_pb2.pyi new file mode 100644 index 00000000..4f983c8d --- /dev/null +++ b/diode-sdk-python/netboxlabs/diode/sdk/diode/v1/site_pb2.pyi @@ -0,0 +1,14 @@ +from netboxlabs.diode.sdk.validate import validate_pb2 as _validate_pb2 +from google.protobuf import descriptor as _descriptor +from google.protobuf import message as _message +from typing import ClassVar as _ClassVar, Optional as _Optional + +DESCRIPTOR: _descriptor.FileDescriptor + +class Site(_message.Message): + __slots__ = ("name", "slug") + NAME_FIELD_NUMBER: _ClassVar[int] + SLUG_FIELD_NUMBER: _ClassVar[int] + name: str + slug: str + def __init__(self, name: _Optional[str] = ..., slug: _Optional[str] = ...) -> None: ... diff --git a/diode-sdk-python/netboxlabs/diode/sdk/exceptions.py b/diode-sdk-python/netboxlabs/diode/sdk/exceptions.py new file mode 100644 index 00000000..a831f1c9 --- /dev/null +++ b/diode-sdk-python/netboxlabs/diode/sdk/exceptions.py @@ -0,0 +1,47 @@ +#!/usr/bin/env python +# Copyright 2024 NetBox Labs Inc +"""NetBox Labs, Diode - SDK - Exceptions.""" + +import grpc +from google.protobuf.json_format import MessageToDict +from grpc import RpcError +from grpc_status import rpc_status + + +class BaseError(Exception): + """Base error class for Diode SDK.""" + + pass + + +class DiodeConfigError(BaseError): + """Diode Config Error.""" + + pass + + +class DiodeClientError(RpcError): + """Diode Client Error.""" + + _status_code = None + _details = None + _grpc_status = None + + def __init__(self, err: RpcError): + """Initialize DiodeClientError.""" + self._status_code = err.code() + self._details = err.details() + + @property + def status_code(self): + """Return status code.""" + return self._status_code + + @property + def details(self): + """Return error details.""" + return self._details + + def __repr__(self): + """Return string representation.""" + return f"" diff --git a/diode-sdk-python/netboxlabs/diode/sdk/validate/__init__.py b/diode-sdk-python/netboxlabs/diode/sdk/validate/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/diode-sdk-python/netboxlabs/diode/sdk/validate/validate_pb2.py b/diode-sdk-python/netboxlabs/diode/sdk/validate/validate_pb2.py new file mode 100644 index 00000000..cb59def8 --- /dev/null +++ b/diode-sdk-python/netboxlabs/diode/sdk/validate/validate_pb2.py @@ -0,0 +1,76 @@ +# -*- coding: utf-8 -*- +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: validate/validate.proto +# Protobuf Python Version: 5.26.1 +"""Generated protocol buffer code.""" +from google.protobuf import descriptor as _descriptor +from google.protobuf import descriptor_pool as _descriptor_pool +from google.protobuf import symbol_database as _symbol_database +from google.protobuf.internal import builder as _builder +# @@protoc_insertion_point(imports) + +_sym_db = _symbol_database.Default() + + +from google.protobuf import descriptor_pb2 as google_dot_protobuf_dot_descriptor__pb2 +from google.protobuf import duration_pb2 as google_dot_protobuf_dot_duration__pb2 +from google.protobuf import timestamp_pb2 as google_dot_protobuf_dot_timestamp__pb2 + + +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x17validate/validate.proto\x12\x08validate\x1a google/protobuf/descriptor.proto\x1a\x1egoogle/protobuf/duration.proto\x1a\x1fgoogle/protobuf/timestamp.proto\"\xc8\x08\n\nFieldRules\x12\x30\n\x07message\x18\x11 \x01(\x0b\x32\x16.validate.MessageRulesR\x07message\x12,\n\x05\x66loat\x18\x01 \x01(\x0b\x32\x14.validate.FloatRulesH\x00R\x05\x66loat\x12/\n\x06\x64ouble\x18\x02 \x01(\x0b\x32\x15.validate.DoubleRulesH\x00R\x06\x64ouble\x12,\n\x05int32\x18\x03 \x01(\x0b\x32\x14.validate.Int32RulesH\x00R\x05int32\x12,\n\x05int64\x18\x04 \x01(\x0b\x32\x14.validate.Int64RulesH\x00R\x05int64\x12/\n\x06uint32\x18\x05 \x01(\x0b\x32\x15.validate.UInt32RulesH\x00R\x06uint32\x12/\n\x06uint64\x18\x06 \x01(\x0b\x32\x15.validate.UInt64RulesH\x00R\x06uint64\x12/\n\x06sint32\x18\x07 \x01(\x0b\x32\x15.validate.SInt32RulesH\x00R\x06sint32\x12/\n\x06sint64\x18\x08 \x01(\x0b\x32\x15.validate.SInt64RulesH\x00R\x06sint64\x12\x32\n\x07\x66ixed32\x18\t \x01(\x0b\x32\x16.validate.Fixed32RulesH\x00R\x07\x66ixed32\x12\x32\n\x07\x66ixed64\x18\n \x01(\x0b\x32\x16.validate.Fixed64RulesH\x00R\x07\x66ixed64\x12\x35\n\x08sfixed32\x18\x0b \x01(\x0b\x32\x17.validate.SFixed32RulesH\x00R\x08sfixed32\x12\x35\n\x08sfixed64\x18\x0c \x01(\x0b\x32\x17.validate.SFixed64RulesH\x00R\x08sfixed64\x12)\n\x04\x62ool\x18\r \x01(\x0b\x32\x13.validate.BoolRulesH\x00R\x04\x62ool\x12/\n\x06string\x18\x0e \x01(\x0b\x32\x15.validate.StringRulesH\x00R\x06string\x12,\n\x05\x62ytes\x18\x0f \x01(\x0b\x32\x14.validate.BytesRulesH\x00R\x05\x62ytes\x12)\n\x04\x65num\x18\x10 \x01(\x0b\x32\x13.validate.EnumRulesH\x00R\x04\x65num\x12\x35\n\x08repeated\x18\x12 \x01(\x0b\x32\x17.validate.RepeatedRulesH\x00R\x08repeated\x12&\n\x03map\x18\x13 \x01(\x0b\x32\x12.validate.MapRulesH\x00R\x03map\x12&\n\x03\x61ny\x18\x14 \x01(\x0b\x32\x12.validate.AnyRulesH\x00R\x03\x61ny\x12\x35\n\x08\x64uration\x18\x15 \x01(\x0b\x32\x17.validate.DurationRulesH\x00R\x08\x64uration\x12\x38\n\ttimestamp\x18\x16 \x01(\x0b\x32\x18.validate.TimestampRulesH\x00R\ttimestampB\x06\n\x04type\"\xb0\x01\n\nFloatRules\x12\x14\n\x05\x63onst\x18\x01 \x01(\x02R\x05\x63onst\x12\x0e\n\x02lt\x18\x02 \x01(\x02R\x02lt\x12\x10\n\x03lte\x18\x03 \x01(\x02R\x03lte\x12\x0e\n\x02gt\x18\x04 \x01(\x02R\x02gt\x12\x10\n\x03gte\x18\x05 \x01(\x02R\x03gte\x12\x0e\n\x02in\x18\x06 \x03(\x02R\x02in\x12\x15\n\x06not_in\x18\x07 \x03(\x02R\x05notIn\x12!\n\x0cignore_empty\x18\x08 \x01(\x08R\x0bignoreEmpty\"\xb1\x01\n\x0b\x44oubleRules\x12\x14\n\x05\x63onst\x18\x01 \x01(\x01R\x05\x63onst\x12\x0e\n\x02lt\x18\x02 \x01(\x01R\x02lt\x12\x10\n\x03lte\x18\x03 \x01(\x01R\x03lte\x12\x0e\n\x02gt\x18\x04 \x01(\x01R\x02gt\x12\x10\n\x03gte\x18\x05 \x01(\x01R\x03gte\x12\x0e\n\x02in\x18\x06 \x03(\x01R\x02in\x12\x15\n\x06not_in\x18\x07 \x03(\x01R\x05notIn\x12!\n\x0cignore_empty\x18\x08 \x01(\x08R\x0bignoreEmpty\"\xb0\x01\n\nInt32Rules\x12\x14\n\x05\x63onst\x18\x01 \x01(\x05R\x05\x63onst\x12\x0e\n\x02lt\x18\x02 \x01(\x05R\x02lt\x12\x10\n\x03lte\x18\x03 \x01(\x05R\x03lte\x12\x0e\n\x02gt\x18\x04 \x01(\x05R\x02gt\x12\x10\n\x03gte\x18\x05 \x01(\x05R\x03gte\x12\x0e\n\x02in\x18\x06 \x03(\x05R\x02in\x12\x15\n\x06not_in\x18\x07 \x03(\x05R\x05notIn\x12!\n\x0cignore_empty\x18\x08 \x01(\x08R\x0bignoreEmpty\"\xb0\x01\n\nInt64Rules\x12\x14\n\x05\x63onst\x18\x01 \x01(\x03R\x05\x63onst\x12\x0e\n\x02lt\x18\x02 \x01(\x03R\x02lt\x12\x10\n\x03lte\x18\x03 \x01(\x03R\x03lte\x12\x0e\n\x02gt\x18\x04 \x01(\x03R\x02gt\x12\x10\n\x03gte\x18\x05 \x01(\x03R\x03gte\x12\x0e\n\x02in\x18\x06 \x03(\x03R\x02in\x12\x15\n\x06not_in\x18\x07 \x03(\x03R\x05notIn\x12!\n\x0cignore_empty\x18\x08 \x01(\x08R\x0bignoreEmpty\"\xb1\x01\n\x0bUInt32Rules\x12\x14\n\x05\x63onst\x18\x01 \x01(\rR\x05\x63onst\x12\x0e\n\x02lt\x18\x02 \x01(\rR\x02lt\x12\x10\n\x03lte\x18\x03 \x01(\rR\x03lte\x12\x0e\n\x02gt\x18\x04 \x01(\rR\x02gt\x12\x10\n\x03gte\x18\x05 \x01(\rR\x03gte\x12\x0e\n\x02in\x18\x06 \x03(\rR\x02in\x12\x15\n\x06not_in\x18\x07 \x03(\rR\x05notIn\x12!\n\x0cignore_empty\x18\x08 \x01(\x08R\x0bignoreEmpty\"\xb1\x01\n\x0bUInt64Rules\x12\x14\n\x05\x63onst\x18\x01 \x01(\x04R\x05\x63onst\x12\x0e\n\x02lt\x18\x02 \x01(\x04R\x02lt\x12\x10\n\x03lte\x18\x03 \x01(\x04R\x03lte\x12\x0e\n\x02gt\x18\x04 \x01(\x04R\x02gt\x12\x10\n\x03gte\x18\x05 \x01(\x04R\x03gte\x12\x0e\n\x02in\x18\x06 \x03(\x04R\x02in\x12\x15\n\x06not_in\x18\x07 \x03(\x04R\x05notIn\x12!\n\x0cignore_empty\x18\x08 \x01(\x08R\x0bignoreEmpty\"\xb1\x01\n\x0bSInt32Rules\x12\x14\n\x05\x63onst\x18\x01 \x01(\x11R\x05\x63onst\x12\x0e\n\x02lt\x18\x02 \x01(\x11R\x02lt\x12\x10\n\x03lte\x18\x03 \x01(\x11R\x03lte\x12\x0e\n\x02gt\x18\x04 \x01(\x11R\x02gt\x12\x10\n\x03gte\x18\x05 \x01(\x11R\x03gte\x12\x0e\n\x02in\x18\x06 \x03(\x11R\x02in\x12\x15\n\x06not_in\x18\x07 \x03(\x11R\x05notIn\x12!\n\x0cignore_empty\x18\x08 \x01(\x08R\x0bignoreEmpty\"\xb1\x01\n\x0bSInt64Rules\x12\x14\n\x05\x63onst\x18\x01 \x01(\x12R\x05\x63onst\x12\x0e\n\x02lt\x18\x02 \x01(\x12R\x02lt\x12\x10\n\x03lte\x18\x03 \x01(\x12R\x03lte\x12\x0e\n\x02gt\x18\x04 \x01(\x12R\x02gt\x12\x10\n\x03gte\x18\x05 \x01(\x12R\x03gte\x12\x0e\n\x02in\x18\x06 \x03(\x12R\x02in\x12\x15\n\x06not_in\x18\x07 \x03(\x12R\x05notIn\x12!\n\x0cignore_empty\x18\x08 \x01(\x08R\x0bignoreEmpty\"\xb2\x01\n\x0c\x46ixed32Rules\x12\x14\n\x05\x63onst\x18\x01 \x01(\x07R\x05\x63onst\x12\x0e\n\x02lt\x18\x02 \x01(\x07R\x02lt\x12\x10\n\x03lte\x18\x03 \x01(\x07R\x03lte\x12\x0e\n\x02gt\x18\x04 \x01(\x07R\x02gt\x12\x10\n\x03gte\x18\x05 \x01(\x07R\x03gte\x12\x0e\n\x02in\x18\x06 \x03(\x07R\x02in\x12\x15\n\x06not_in\x18\x07 \x03(\x07R\x05notIn\x12!\n\x0cignore_empty\x18\x08 \x01(\x08R\x0bignoreEmpty\"\xb2\x01\n\x0c\x46ixed64Rules\x12\x14\n\x05\x63onst\x18\x01 \x01(\x06R\x05\x63onst\x12\x0e\n\x02lt\x18\x02 \x01(\x06R\x02lt\x12\x10\n\x03lte\x18\x03 \x01(\x06R\x03lte\x12\x0e\n\x02gt\x18\x04 \x01(\x06R\x02gt\x12\x10\n\x03gte\x18\x05 \x01(\x06R\x03gte\x12\x0e\n\x02in\x18\x06 \x03(\x06R\x02in\x12\x15\n\x06not_in\x18\x07 \x03(\x06R\x05notIn\x12!\n\x0cignore_empty\x18\x08 \x01(\x08R\x0bignoreEmpty\"\xb3\x01\n\rSFixed32Rules\x12\x14\n\x05\x63onst\x18\x01 \x01(\x0fR\x05\x63onst\x12\x0e\n\x02lt\x18\x02 \x01(\x0fR\x02lt\x12\x10\n\x03lte\x18\x03 \x01(\x0fR\x03lte\x12\x0e\n\x02gt\x18\x04 \x01(\x0fR\x02gt\x12\x10\n\x03gte\x18\x05 \x01(\x0fR\x03gte\x12\x0e\n\x02in\x18\x06 \x03(\x0fR\x02in\x12\x15\n\x06not_in\x18\x07 \x03(\x0fR\x05notIn\x12!\n\x0cignore_empty\x18\x08 \x01(\x08R\x0bignoreEmpty\"\xb3\x01\n\rSFixed64Rules\x12\x14\n\x05\x63onst\x18\x01 \x01(\x10R\x05\x63onst\x12\x0e\n\x02lt\x18\x02 \x01(\x10R\x02lt\x12\x10\n\x03lte\x18\x03 \x01(\x10R\x03lte\x12\x0e\n\x02gt\x18\x04 \x01(\x10R\x02gt\x12\x10\n\x03gte\x18\x05 \x01(\x10R\x03gte\x12\x0e\n\x02in\x18\x06 \x03(\x10R\x02in\x12\x15\n\x06not_in\x18\x07 \x03(\x10R\x05notIn\x12!\n\x0cignore_empty\x18\x08 \x01(\x08R\x0bignoreEmpty\"!\n\tBoolRules\x12\x14\n\x05\x63onst\x18\x01 \x01(\x08R\x05\x63onst\"\xd4\x05\n\x0bStringRules\x12\x14\n\x05\x63onst\x18\x01 \x01(\tR\x05\x63onst\x12\x10\n\x03len\x18\x13 \x01(\x04R\x03len\x12\x17\n\x07min_len\x18\x02 \x01(\x04R\x06minLen\x12\x17\n\x07max_len\x18\x03 \x01(\x04R\x06maxLen\x12\x1b\n\tlen_bytes\x18\x14 \x01(\x04R\x08lenBytes\x12\x1b\n\tmin_bytes\x18\x04 \x01(\x04R\x08minBytes\x12\x1b\n\tmax_bytes\x18\x05 \x01(\x04R\x08maxBytes\x12\x18\n\x07pattern\x18\x06 \x01(\tR\x07pattern\x12\x16\n\x06prefix\x18\x07 \x01(\tR\x06prefix\x12\x16\n\x06suffix\x18\x08 \x01(\tR\x06suffix\x12\x1a\n\x08\x63ontains\x18\t \x01(\tR\x08\x63ontains\x12!\n\x0cnot_contains\x18\x17 \x01(\tR\x0bnotContains\x12\x0e\n\x02in\x18\n \x03(\tR\x02in\x12\x15\n\x06not_in\x18\x0b \x03(\tR\x05notIn\x12\x16\n\x05\x65mail\x18\x0c \x01(\x08H\x00R\x05\x65mail\x12\x1c\n\x08hostname\x18\r \x01(\x08H\x00R\x08hostname\x12\x10\n\x02ip\x18\x0e \x01(\x08H\x00R\x02ip\x12\x14\n\x04ipv4\x18\x0f \x01(\x08H\x00R\x04ipv4\x12\x14\n\x04ipv6\x18\x10 \x01(\x08H\x00R\x04ipv6\x12\x12\n\x03uri\x18\x11 \x01(\x08H\x00R\x03uri\x12\x19\n\x07uri_ref\x18\x12 \x01(\x08H\x00R\x06uriRef\x12\x1a\n\x07\x61\x64\x64ress\x18\x15 \x01(\x08H\x00R\x07\x61\x64\x64ress\x12\x14\n\x04uuid\x18\x16 \x01(\x08H\x00R\x04uuid\x12@\n\x10well_known_regex\x18\x18 \x01(\x0e\x32\x14.validate.KnownRegexH\x00R\x0ewellKnownRegex\x12\x1c\n\x06strict\x18\x19 \x01(\x08:\x04trueR\x06strict\x12!\n\x0cignore_empty\x18\x1a \x01(\x08R\x0bignoreEmptyB\x0c\n\nwell_known\"\xe2\x02\n\nBytesRules\x12\x14\n\x05\x63onst\x18\x01 \x01(\x0cR\x05\x63onst\x12\x10\n\x03len\x18\r \x01(\x04R\x03len\x12\x17\n\x07min_len\x18\x02 \x01(\x04R\x06minLen\x12\x17\n\x07max_len\x18\x03 \x01(\x04R\x06maxLen\x12\x18\n\x07pattern\x18\x04 \x01(\tR\x07pattern\x12\x16\n\x06prefix\x18\x05 \x01(\x0cR\x06prefix\x12\x16\n\x06suffix\x18\x06 \x01(\x0cR\x06suffix\x12\x1a\n\x08\x63ontains\x18\x07 \x01(\x0cR\x08\x63ontains\x12\x0e\n\x02in\x18\x08 \x03(\x0cR\x02in\x12\x15\n\x06not_in\x18\t \x03(\x0cR\x05notIn\x12\x10\n\x02ip\x18\n \x01(\x08H\x00R\x02ip\x12\x14\n\x04ipv4\x18\x0b \x01(\x08H\x00R\x04ipv4\x12\x14\n\x04ipv6\x18\x0c \x01(\x08H\x00R\x04ipv6\x12!\n\x0cignore_empty\x18\x0e \x01(\x08R\x0bignoreEmptyB\x0c\n\nwell_known\"k\n\tEnumRules\x12\x14\n\x05\x63onst\x18\x01 \x01(\x05R\x05\x63onst\x12!\n\x0c\x64\x65\x66ined_only\x18\x02 \x01(\x08R\x0b\x64\x65\x66inedOnly\x12\x0e\n\x02in\x18\x03 \x03(\x05R\x02in\x12\x15\n\x06not_in\x18\x04 \x03(\x05R\x05notIn\">\n\x0cMessageRules\x12\x12\n\x04skip\x18\x01 \x01(\x08R\x04skip\x12\x1a\n\x08required\x18\x02 \x01(\x08R\x08required\"\xb0\x01\n\rRepeatedRules\x12\x1b\n\tmin_items\x18\x01 \x01(\x04R\x08minItems\x12\x1b\n\tmax_items\x18\x02 \x01(\x04R\x08maxItems\x12\x16\n\x06unique\x18\x03 \x01(\x08R\x06unique\x12*\n\x05items\x18\x04 \x01(\x0b\x32\x14.validate.FieldRulesR\x05items\x12!\n\x0cignore_empty\x18\x05 \x01(\x08R\x0bignoreEmpty\"\xdc\x01\n\x08MapRules\x12\x1b\n\tmin_pairs\x18\x01 \x01(\x04R\x08minPairs\x12\x1b\n\tmax_pairs\x18\x02 \x01(\x04R\x08maxPairs\x12\x1b\n\tno_sparse\x18\x03 \x01(\x08R\x08noSparse\x12(\n\x04keys\x18\x04 \x01(\x0b\x32\x14.validate.FieldRulesR\x04keys\x12,\n\x06values\x18\x05 \x01(\x0b\x32\x14.validate.FieldRulesR\x06values\x12!\n\x0cignore_empty\x18\x06 \x01(\x08R\x0bignoreEmpty\"M\n\x08\x41nyRules\x12\x1a\n\x08required\x18\x01 \x01(\x08R\x08required\x12\x0e\n\x02in\x18\x02 \x03(\tR\x02in\x12\x15\n\x06not_in\x18\x03 \x03(\tR\x05notIn\"\xe9\x02\n\rDurationRules\x12\x1a\n\x08required\x18\x01 \x01(\x08R\x08required\x12/\n\x05\x63onst\x18\x02 \x01(\x0b\x32\x19.google.protobuf.DurationR\x05\x63onst\x12)\n\x02lt\x18\x03 \x01(\x0b\x32\x19.google.protobuf.DurationR\x02lt\x12+\n\x03lte\x18\x04 \x01(\x0b\x32\x19.google.protobuf.DurationR\x03lte\x12)\n\x02gt\x18\x05 \x01(\x0b\x32\x19.google.protobuf.DurationR\x02gt\x12+\n\x03gte\x18\x06 \x01(\x0b\x32\x19.google.protobuf.DurationR\x03gte\x12)\n\x02in\x18\x07 \x03(\x0b\x32\x19.google.protobuf.DurationR\x02in\x12\x30\n\x06not_in\x18\x08 \x03(\x0b\x32\x19.google.protobuf.DurationR\x05notIn\"\xf3\x02\n\x0eTimestampRules\x12\x1a\n\x08required\x18\x01 \x01(\x08R\x08required\x12\x30\n\x05\x63onst\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.TimestampR\x05\x63onst\x12*\n\x02lt\x18\x03 \x01(\x0b\x32\x1a.google.protobuf.TimestampR\x02lt\x12,\n\x03lte\x18\x04 \x01(\x0b\x32\x1a.google.protobuf.TimestampR\x03lte\x12*\n\x02gt\x18\x05 \x01(\x0b\x32\x1a.google.protobuf.TimestampR\x02gt\x12,\n\x03gte\x18\x06 \x01(\x0b\x32\x1a.google.protobuf.TimestampR\x03gte\x12\x15\n\x06lt_now\x18\x07 \x01(\x08R\x05ltNow\x12\x15\n\x06gt_now\x18\x08 \x01(\x08R\x05gtNow\x12\x31\n\x06within\x18\t \x01(\x0b\x32\x19.google.protobuf.DurationR\x06within*F\n\nKnownRegex\x12\x0b\n\x07UNKNOWN\x10\x00\x12\x14\n\x10HTTP_HEADER_NAME\x10\x01\x12\x15\n\x11HTTP_HEADER_VALUE\x10\x02:<\n\x08\x64isabled\x12\x1f.google.protobuf.MessageOptions\x18\xaf\x08 \x01(\x08R\x08\x64isabled::\n\x07ignored\x12\x1f.google.protobuf.MessageOptions\x18\xb0\x08 \x01(\x08R\x07ignored::\n\x08required\x12\x1d.google.protobuf.OneofOptions\x18\xaf\x08 \x01(\x08R\x08required:J\n\x05rules\x12\x1d.google.protobuf.FieldOptions\x18\xaf\x08 \x01(\x0b\x32\x14.validate.FieldRulesR\x05rulesBP\n\x1aio.envoyproxy.pgv.validateZ2github.com/envoyproxy/protoc-gen-validate/validate') + +_globals = globals() +_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals) +_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'validate.validate_pb2', _globals) +if not _descriptor._USE_C_DESCRIPTORS: + _globals['DESCRIPTOR']._loaded_options = None + _globals['DESCRIPTOR']._serialized_options = b'\n\032io.envoyproxy.pgv.validateZ2github.com/envoyproxy/protoc-gen-validate/validate' + _globals['_KNOWNREGEX']._serialized_start=5909 + _globals['_KNOWNREGEX']._serialized_end=5979 + _globals['_FIELDRULES']._serialized_start=137 + _globals['_FIELDRULES']._serialized_end=1233 + _globals['_FLOATRULES']._serialized_start=1236 + _globals['_FLOATRULES']._serialized_end=1412 + _globals['_DOUBLERULES']._serialized_start=1415 + _globals['_DOUBLERULES']._serialized_end=1592 + _globals['_INT32RULES']._serialized_start=1595 + _globals['_INT32RULES']._serialized_end=1771 + _globals['_INT64RULES']._serialized_start=1774 + _globals['_INT64RULES']._serialized_end=1950 + _globals['_UINT32RULES']._serialized_start=1953 + _globals['_UINT32RULES']._serialized_end=2130 + _globals['_UINT64RULES']._serialized_start=2133 + _globals['_UINT64RULES']._serialized_end=2310 + _globals['_SINT32RULES']._serialized_start=2313 + _globals['_SINT32RULES']._serialized_end=2490 + _globals['_SINT64RULES']._serialized_start=2493 + _globals['_SINT64RULES']._serialized_end=2670 + _globals['_FIXED32RULES']._serialized_start=2673 + _globals['_FIXED32RULES']._serialized_end=2851 + _globals['_FIXED64RULES']._serialized_start=2854 + _globals['_FIXED64RULES']._serialized_end=3032 + _globals['_SFIXED32RULES']._serialized_start=3035 + _globals['_SFIXED32RULES']._serialized_end=3214 + _globals['_SFIXED64RULES']._serialized_start=3217 + _globals['_SFIXED64RULES']._serialized_end=3396 + _globals['_BOOLRULES']._serialized_start=3398 + _globals['_BOOLRULES']._serialized_end=3431 + _globals['_STRINGRULES']._serialized_start=3434 + _globals['_STRINGRULES']._serialized_end=4158 + _globals['_BYTESRULES']._serialized_start=4161 + _globals['_BYTESRULES']._serialized_end=4515 + _globals['_ENUMRULES']._serialized_start=4517 + _globals['_ENUMRULES']._serialized_end=4624 + _globals['_MESSAGERULES']._serialized_start=4626 + _globals['_MESSAGERULES']._serialized_end=4688 + _globals['_REPEATEDRULES']._serialized_start=4691 + _globals['_REPEATEDRULES']._serialized_end=4867 + _globals['_MAPRULES']._serialized_start=4870 + _globals['_MAPRULES']._serialized_end=5090 + _globals['_ANYRULES']._serialized_start=5092 + _globals['_ANYRULES']._serialized_end=5169 + _globals['_DURATIONRULES']._serialized_start=5172 + _globals['_DURATIONRULES']._serialized_end=5533 + _globals['_TIMESTAMPRULES']._serialized_start=5536 + _globals['_TIMESTAMPRULES']._serialized_end=5907 +# @@protoc_insertion_point(module_scope) diff --git a/diode-sdk-python/netboxlabs/diode/sdk/validate/validate_pb2.pyi b/diode-sdk-python/netboxlabs/diode/sdk/validate/validate_pb2.pyi new file mode 100644 index 00000000..2286693c --- /dev/null +++ b/diode-sdk-python/netboxlabs/diode/sdk/validate/validate_pb2.pyi @@ -0,0 +1,494 @@ +from google.protobuf import descriptor_pb2 as _descriptor_pb2 +from google.protobuf import duration_pb2 as _duration_pb2 +from google.protobuf import timestamp_pb2 as _timestamp_pb2 +from google.protobuf.internal import containers as _containers +from google.protobuf.internal import enum_type_wrapper as _enum_type_wrapper +from google.protobuf import descriptor as _descriptor +from google.protobuf import message as _message +from typing import ClassVar as _ClassVar, Iterable as _Iterable, Mapping as _Mapping, Optional as _Optional, Union as _Union + +DESCRIPTOR: _descriptor.FileDescriptor + +class KnownRegex(int, metaclass=_enum_type_wrapper.EnumTypeWrapper): + __slots__ = () + UNKNOWN: _ClassVar[KnownRegex] + HTTP_HEADER_NAME: _ClassVar[KnownRegex] + HTTP_HEADER_VALUE: _ClassVar[KnownRegex] +UNKNOWN: KnownRegex +HTTP_HEADER_NAME: KnownRegex +HTTP_HEADER_VALUE: KnownRegex +DISABLED_FIELD_NUMBER: _ClassVar[int] +disabled: _descriptor.FieldDescriptor +IGNORED_FIELD_NUMBER: _ClassVar[int] +ignored: _descriptor.FieldDescriptor +REQUIRED_FIELD_NUMBER: _ClassVar[int] +required: _descriptor.FieldDescriptor +RULES_FIELD_NUMBER: _ClassVar[int] +rules: _descriptor.FieldDescriptor + +class FieldRules(_message.Message): + __slots__ = ("message", "float", "double", "int32", "int64", "uint32", "uint64", "sint32", "sint64", "fixed32", "fixed64", "sfixed32", "sfixed64", "bool", "string", "bytes", "enum", "repeated", "map", "any", "duration", "timestamp") + MESSAGE_FIELD_NUMBER: _ClassVar[int] + FLOAT_FIELD_NUMBER: _ClassVar[int] + DOUBLE_FIELD_NUMBER: _ClassVar[int] + INT32_FIELD_NUMBER: _ClassVar[int] + INT64_FIELD_NUMBER: _ClassVar[int] + UINT32_FIELD_NUMBER: _ClassVar[int] + UINT64_FIELD_NUMBER: _ClassVar[int] + SINT32_FIELD_NUMBER: _ClassVar[int] + SINT64_FIELD_NUMBER: _ClassVar[int] + FIXED32_FIELD_NUMBER: _ClassVar[int] + FIXED64_FIELD_NUMBER: _ClassVar[int] + SFIXED32_FIELD_NUMBER: _ClassVar[int] + SFIXED64_FIELD_NUMBER: _ClassVar[int] + BOOL_FIELD_NUMBER: _ClassVar[int] + STRING_FIELD_NUMBER: _ClassVar[int] + BYTES_FIELD_NUMBER: _ClassVar[int] + ENUM_FIELD_NUMBER: _ClassVar[int] + REPEATED_FIELD_NUMBER: _ClassVar[int] + MAP_FIELD_NUMBER: _ClassVar[int] + ANY_FIELD_NUMBER: _ClassVar[int] + DURATION_FIELD_NUMBER: _ClassVar[int] + TIMESTAMP_FIELD_NUMBER: _ClassVar[int] + message: MessageRules + float: FloatRules + double: DoubleRules + int32: Int32Rules + int64: Int64Rules + uint32: UInt32Rules + uint64: UInt64Rules + sint32: SInt32Rules + sint64: SInt64Rules + fixed32: Fixed32Rules + fixed64: Fixed64Rules + sfixed32: SFixed32Rules + sfixed64: SFixed64Rules + bool: BoolRules + string: StringRules + bytes: BytesRules + enum: EnumRules + repeated: RepeatedRules + map: MapRules + any: AnyRules + duration: DurationRules + timestamp: TimestampRules + def __init__(self, message: _Optional[_Union[MessageRules, _Mapping]] = ..., float: _Optional[_Union[FloatRules, _Mapping]] = ..., double: _Optional[_Union[DoubleRules, _Mapping]] = ..., int32: _Optional[_Union[Int32Rules, _Mapping]] = ..., int64: _Optional[_Union[Int64Rules, _Mapping]] = ..., uint32: _Optional[_Union[UInt32Rules, _Mapping]] = ..., uint64: _Optional[_Union[UInt64Rules, _Mapping]] = ..., sint32: _Optional[_Union[SInt32Rules, _Mapping]] = ..., sint64: _Optional[_Union[SInt64Rules, _Mapping]] = ..., fixed32: _Optional[_Union[Fixed32Rules, _Mapping]] = ..., fixed64: _Optional[_Union[Fixed64Rules, _Mapping]] = ..., sfixed32: _Optional[_Union[SFixed32Rules, _Mapping]] = ..., sfixed64: _Optional[_Union[SFixed64Rules, _Mapping]] = ..., bool: _Optional[_Union[BoolRules, _Mapping]] = ..., string: _Optional[_Union[StringRules, _Mapping]] = ..., bytes: _Optional[_Union[BytesRules, _Mapping]] = ..., enum: _Optional[_Union[EnumRules, _Mapping]] = ..., repeated: _Optional[_Union[RepeatedRules, _Mapping]] = ..., map: _Optional[_Union[MapRules, _Mapping]] = ..., any: _Optional[_Union[AnyRules, _Mapping]] = ..., duration: _Optional[_Union[DurationRules, _Mapping]] = ..., timestamp: _Optional[_Union[TimestampRules, _Mapping]] = ...) -> None: ... + +class FloatRules(_message.Message): + __slots__ = ("const", "lt", "lte", "gt", "gte", "not_in", "ignore_empty") + CONST_FIELD_NUMBER: _ClassVar[int] + LT_FIELD_NUMBER: _ClassVar[int] + LTE_FIELD_NUMBER: _ClassVar[int] + GT_FIELD_NUMBER: _ClassVar[int] + GTE_FIELD_NUMBER: _ClassVar[int] + IN_FIELD_NUMBER: _ClassVar[int] + NOT_IN_FIELD_NUMBER: _ClassVar[int] + IGNORE_EMPTY_FIELD_NUMBER: _ClassVar[int] + const: float + lt: float + lte: float + gt: float + gte: float + not_in: _containers.RepeatedScalarFieldContainer[float] + ignore_empty: bool + def __init__(self, const: _Optional[float] = ..., lt: _Optional[float] = ..., lte: _Optional[float] = ..., gt: _Optional[float] = ..., gte: _Optional[float] = ..., not_in: _Optional[_Iterable[float]] = ..., ignore_empty: bool = ..., **kwargs) -> None: ... + +class DoubleRules(_message.Message): + __slots__ = ("const", "lt", "lte", "gt", "gte", "not_in", "ignore_empty") + CONST_FIELD_NUMBER: _ClassVar[int] + LT_FIELD_NUMBER: _ClassVar[int] + LTE_FIELD_NUMBER: _ClassVar[int] + GT_FIELD_NUMBER: _ClassVar[int] + GTE_FIELD_NUMBER: _ClassVar[int] + IN_FIELD_NUMBER: _ClassVar[int] + NOT_IN_FIELD_NUMBER: _ClassVar[int] + IGNORE_EMPTY_FIELD_NUMBER: _ClassVar[int] + const: float + lt: float + lte: float + gt: float + gte: float + not_in: _containers.RepeatedScalarFieldContainer[float] + ignore_empty: bool + def __init__(self, const: _Optional[float] = ..., lt: _Optional[float] = ..., lte: _Optional[float] = ..., gt: _Optional[float] = ..., gte: _Optional[float] = ..., not_in: _Optional[_Iterable[float]] = ..., ignore_empty: bool = ..., **kwargs) -> None: ... + +class Int32Rules(_message.Message): + __slots__ = ("const", "lt", "lte", "gt", "gte", "not_in", "ignore_empty") + CONST_FIELD_NUMBER: _ClassVar[int] + LT_FIELD_NUMBER: _ClassVar[int] + LTE_FIELD_NUMBER: _ClassVar[int] + GT_FIELD_NUMBER: _ClassVar[int] + GTE_FIELD_NUMBER: _ClassVar[int] + IN_FIELD_NUMBER: _ClassVar[int] + NOT_IN_FIELD_NUMBER: _ClassVar[int] + IGNORE_EMPTY_FIELD_NUMBER: _ClassVar[int] + const: int + lt: int + lte: int + gt: int + gte: int + not_in: _containers.RepeatedScalarFieldContainer[int] + ignore_empty: bool + def __init__(self, const: _Optional[int] = ..., lt: _Optional[int] = ..., lte: _Optional[int] = ..., gt: _Optional[int] = ..., gte: _Optional[int] = ..., not_in: _Optional[_Iterable[int]] = ..., ignore_empty: bool = ..., **kwargs) -> None: ... + +class Int64Rules(_message.Message): + __slots__ = ("const", "lt", "lte", "gt", "gte", "not_in", "ignore_empty") + CONST_FIELD_NUMBER: _ClassVar[int] + LT_FIELD_NUMBER: _ClassVar[int] + LTE_FIELD_NUMBER: _ClassVar[int] + GT_FIELD_NUMBER: _ClassVar[int] + GTE_FIELD_NUMBER: _ClassVar[int] + IN_FIELD_NUMBER: _ClassVar[int] + NOT_IN_FIELD_NUMBER: _ClassVar[int] + IGNORE_EMPTY_FIELD_NUMBER: _ClassVar[int] + const: int + lt: int + lte: int + gt: int + gte: int + not_in: _containers.RepeatedScalarFieldContainer[int] + ignore_empty: bool + def __init__(self, const: _Optional[int] = ..., lt: _Optional[int] = ..., lte: _Optional[int] = ..., gt: _Optional[int] = ..., gte: _Optional[int] = ..., not_in: _Optional[_Iterable[int]] = ..., ignore_empty: bool = ..., **kwargs) -> None: ... + +class UInt32Rules(_message.Message): + __slots__ = ("const", "lt", "lte", "gt", "gte", "not_in", "ignore_empty") + CONST_FIELD_NUMBER: _ClassVar[int] + LT_FIELD_NUMBER: _ClassVar[int] + LTE_FIELD_NUMBER: _ClassVar[int] + GT_FIELD_NUMBER: _ClassVar[int] + GTE_FIELD_NUMBER: _ClassVar[int] + IN_FIELD_NUMBER: _ClassVar[int] + NOT_IN_FIELD_NUMBER: _ClassVar[int] + IGNORE_EMPTY_FIELD_NUMBER: _ClassVar[int] + const: int + lt: int + lte: int + gt: int + gte: int + not_in: _containers.RepeatedScalarFieldContainer[int] + ignore_empty: bool + def __init__(self, const: _Optional[int] = ..., lt: _Optional[int] = ..., lte: _Optional[int] = ..., gt: _Optional[int] = ..., gte: _Optional[int] = ..., not_in: _Optional[_Iterable[int]] = ..., ignore_empty: bool = ..., **kwargs) -> None: ... + +class UInt64Rules(_message.Message): + __slots__ = ("const", "lt", "lte", "gt", "gte", "not_in", "ignore_empty") + CONST_FIELD_NUMBER: _ClassVar[int] + LT_FIELD_NUMBER: _ClassVar[int] + LTE_FIELD_NUMBER: _ClassVar[int] + GT_FIELD_NUMBER: _ClassVar[int] + GTE_FIELD_NUMBER: _ClassVar[int] + IN_FIELD_NUMBER: _ClassVar[int] + NOT_IN_FIELD_NUMBER: _ClassVar[int] + IGNORE_EMPTY_FIELD_NUMBER: _ClassVar[int] + const: int + lt: int + lte: int + gt: int + gte: int + not_in: _containers.RepeatedScalarFieldContainer[int] + ignore_empty: bool + def __init__(self, const: _Optional[int] = ..., lt: _Optional[int] = ..., lte: _Optional[int] = ..., gt: _Optional[int] = ..., gte: _Optional[int] = ..., not_in: _Optional[_Iterable[int]] = ..., ignore_empty: bool = ..., **kwargs) -> None: ... + +class SInt32Rules(_message.Message): + __slots__ = ("const", "lt", "lte", "gt", "gte", "not_in", "ignore_empty") + CONST_FIELD_NUMBER: _ClassVar[int] + LT_FIELD_NUMBER: _ClassVar[int] + LTE_FIELD_NUMBER: _ClassVar[int] + GT_FIELD_NUMBER: _ClassVar[int] + GTE_FIELD_NUMBER: _ClassVar[int] + IN_FIELD_NUMBER: _ClassVar[int] + NOT_IN_FIELD_NUMBER: _ClassVar[int] + IGNORE_EMPTY_FIELD_NUMBER: _ClassVar[int] + const: int + lt: int + lte: int + gt: int + gte: int + not_in: _containers.RepeatedScalarFieldContainer[int] + ignore_empty: bool + def __init__(self, const: _Optional[int] = ..., lt: _Optional[int] = ..., lte: _Optional[int] = ..., gt: _Optional[int] = ..., gte: _Optional[int] = ..., not_in: _Optional[_Iterable[int]] = ..., ignore_empty: bool = ..., **kwargs) -> None: ... + +class SInt64Rules(_message.Message): + __slots__ = ("const", "lt", "lte", "gt", "gte", "not_in", "ignore_empty") + CONST_FIELD_NUMBER: _ClassVar[int] + LT_FIELD_NUMBER: _ClassVar[int] + LTE_FIELD_NUMBER: _ClassVar[int] + GT_FIELD_NUMBER: _ClassVar[int] + GTE_FIELD_NUMBER: _ClassVar[int] + IN_FIELD_NUMBER: _ClassVar[int] + NOT_IN_FIELD_NUMBER: _ClassVar[int] + IGNORE_EMPTY_FIELD_NUMBER: _ClassVar[int] + const: int + lt: int + lte: int + gt: int + gte: int + not_in: _containers.RepeatedScalarFieldContainer[int] + ignore_empty: bool + def __init__(self, const: _Optional[int] = ..., lt: _Optional[int] = ..., lte: _Optional[int] = ..., gt: _Optional[int] = ..., gte: _Optional[int] = ..., not_in: _Optional[_Iterable[int]] = ..., ignore_empty: bool = ..., **kwargs) -> None: ... + +class Fixed32Rules(_message.Message): + __slots__ = ("const", "lt", "lte", "gt", "gte", "not_in", "ignore_empty") + CONST_FIELD_NUMBER: _ClassVar[int] + LT_FIELD_NUMBER: _ClassVar[int] + LTE_FIELD_NUMBER: _ClassVar[int] + GT_FIELD_NUMBER: _ClassVar[int] + GTE_FIELD_NUMBER: _ClassVar[int] + IN_FIELD_NUMBER: _ClassVar[int] + NOT_IN_FIELD_NUMBER: _ClassVar[int] + IGNORE_EMPTY_FIELD_NUMBER: _ClassVar[int] + const: int + lt: int + lte: int + gt: int + gte: int + not_in: _containers.RepeatedScalarFieldContainer[int] + ignore_empty: bool + def __init__(self, const: _Optional[int] = ..., lt: _Optional[int] = ..., lte: _Optional[int] = ..., gt: _Optional[int] = ..., gte: _Optional[int] = ..., not_in: _Optional[_Iterable[int]] = ..., ignore_empty: bool = ..., **kwargs) -> None: ... + +class Fixed64Rules(_message.Message): + __slots__ = ("const", "lt", "lte", "gt", "gte", "not_in", "ignore_empty") + CONST_FIELD_NUMBER: _ClassVar[int] + LT_FIELD_NUMBER: _ClassVar[int] + LTE_FIELD_NUMBER: _ClassVar[int] + GT_FIELD_NUMBER: _ClassVar[int] + GTE_FIELD_NUMBER: _ClassVar[int] + IN_FIELD_NUMBER: _ClassVar[int] + NOT_IN_FIELD_NUMBER: _ClassVar[int] + IGNORE_EMPTY_FIELD_NUMBER: _ClassVar[int] + const: int + lt: int + lte: int + gt: int + gte: int + not_in: _containers.RepeatedScalarFieldContainer[int] + ignore_empty: bool + def __init__(self, const: _Optional[int] = ..., lt: _Optional[int] = ..., lte: _Optional[int] = ..., gt: _Optional[int] = ..., gte: _Optional[int] = ..., not_in: _Optional[_Iterable[int]] = ..., ignore_empty: bool = ..., **kwargs) -> None: ... + +class SFixed32Rules(_message.Message): + __slots__ = ("const", "lt", "lte", "gt", "gte", "not_in", "ignore_empty") + CONST_FIELD_NUMBER: _ClassVar[int] + LT_FIELD_NUMBER: _ClassVar[int] + LTE_FIELD_NUMBER: _ClassVar[int] + GT_FIELD_NUMBER: _ClassVar[int] + GTE_FIELD_NUMBER: _ClassVar[int] + IN_FIELD_NUMBER: _ClassVar[int] + NOT_IN_FIELD_NUMBER: _ClassVar[int] + IGNORE_EMPTY_FIELD_NUMBER: _ClassVar[int] + const: int + lt: int + lte: int + gt: int + gte: int + not_in: _containers.RepeatedScalarFieldContainer[int] + ignore_empty: bool + def __init__(self, const: _Optional[int] = ..., lt: _Optional[int] = ..., lte: _Optional[int] = ..., gt: _Optional[int] = ..., gte: _Optional[int] = ..., not_in: _Optional[_Iterable[int]] = ..., ignore_empty: bool = ..., **kwargs) -> None: ... + +class SFixed64Rules(_message.Message): + __slots__ = ("const", "lt", "lte", "gt", "gte", "not_in", "ignore_empty") + CONST_FIELD_NUMBER: _ClassVar[int] + LT_FIELD_NUMBER: _ClassVar[int] + LTE_FIELD_NUMBER: _ClassVar[int] + GT_FIELD_NUMBER: _ClassVar[int] + GTE_FIELD_NUMBER: _ClassVar[int] + IN_FIELD_NUMBER: _ClassVar[int] + NOT_IN_FIELD_NUMBER: _ClassVar[int] + IGNORE_EMPTY_FIELD_NUMBER: _ClassVar[int] + const: int + lt: int + lte: int + gt: int + gte: int + not_in: _containers.RepeatedScalarFieldContainer[int] + ignore_empty: bool + def __init__(self, const: _Optional[int] = ..., lt: _Optional[int] = ..., lte: _Optional[int] = ..., gt: _Optional[int] = ..., gte: _Optional[int] = ..., not_in: _Optional[_Iterable[int]] = ..., ignore_empty: bool = ..., **kwargs) -> None: ... + +class BoolRules(_message.Message): + __slots__ = ("const",) + CONST_FIELD_NUMBER: _ClassVar[int] + const: bool + def __init__(self, const: bool = ...) -> None: ... + +class StringRules(_message.Message): + __slots__ = ("const", "len", "min_len", "max_len", "len_bytes", "min_bytes", "max_bytes", "pattern", "prefix", "suffix", "contains", "not_contains", "not_in", "email", "hostname", "ip", "ipv4", "ipv6", "uri", "uri_ref", "address", "uuid", "well_known_regex", "strict", "ignore_empty") + CONST_FIELD_NUMBER: _ClassVar[int] + LEN_FIELD_NUMBER: _ClassVar[int] + MIN_LEN_FIELD_NUMBER: _ClassVar[int] + MAX_LEN_FIELD_NUMBER: _ClassVar[int] + LEN_BYTES_FIELD_NUMBER: _ClassVar[int] + MIN_BYTES_FIELD_NUMBER: _ClassVar[int] + MAX_BYTES_FIELD_NUMBER: _ClassVar[int] + PATTERN_FIELD_NUMBER: _ClassVar[int] + PREFIX_FIELD_NUMBER: _ClassVar[int] + SUFFIX_FIELD_NUMBER: _ClassVar[int] + CONTAINS_FIELD_NUMBER: _ClassVar[int] + NOT_CONTAINS_FIELD_NUMBER: _ClassVar[int] + IN_FIELD_NUMBER: _ClassVar[int] + NOT_IN_FIELD_NUMBER: _ClassVar[int] + EMAIL_FIELD_NUMBER: _ClassVar[int] + HOSTNAME_FIELD_NUMBER: _ClassVar[int] + IP_FIELD_NUMBER: _ClassVar[int] + IPV4_FIELD_NUMBER: _ClassVar[int] + IPV6_FIELD_NUMBER: _ClassVar[int] + URI_FIELD_NUMBER: _ClassVar[int] + URI_REF_FIELD_NUMBER: _ClassVar[int] + ADDRESS_FIELD_NUMBER: _ClassVar[int] + UUID_FIELD_NUMBER: _ClassVar[int] + WELL_KNOWN_REGEX_FIELD_NUMBER: _ClassVar[int] + STRICT_FIELD_NUMBER: _ClassVar[int] + IGNORE_EMPTY_FIELD_NUMBER: _ClassVar[int] + const: str + len: int + min_len: int + max_len: int + len_bytes: int + min_bytes: int + max_bytes: int + pattern: str + prefix: str + suffix: str + contains: str + not_contains: str + not_in: _containers.RepeatedScalarFieldContainer[str] + email: bool + hostname: bool + ip: bool + ipv4: bool + ipv6: bool + uri: bool + uri_ref: bool + address: bool + uuid: bool + well_known_regex: KnownRegex + strict: bool + ignore_empty: bool + def __init__(self, const: _Optional[str] = ..., len: _Optional[int] = ..., min_len: _Optional[int] = ..., max_len: _Optional[int] = ..., len_bytes: _Optional[int] = ..., min_bytes: _Optional[int] = ..., max_bytes: _Optional[int] = ..., pattern: _Optional[str] = ..., prefix: _Optional[str] = ..., suffix: _Optional[str] = ..., contains: _Optional[str] = ..., not_contains: _Optional[str] = ..., not_in: _Optional[_Iterable[str]] = ..., email: bool = ..., hostname: bool = ..., ip: bool = ..., ipv4: bool = ..., ipv6: bool = ..., uri: bool = ..., uri_ref: bool = ..., address: bool = ..., uuid: bool = ..., well_known_regex: _Optional[_Union[KnownRegex, str]] = ..., strict: bool = ..., ignore_empty: bool = ..., **kwargs) -> None: ... + +class BytesRules(_message.Message): + __slots__ = ("const", "len", "min_len", "max_len", "pattern", "prefix", "suffix", "contains", "not_in", "ip", "ipv4", "ipv6", "ignore_empty") + CONST_FIELD_NUMBER: _ClassVar[int] + LEN_FIELD_NUMBER: _ClassVar[int] + MIN_LEN_FIELD_NUMBER: _ClassVar[int] + MAX_LEN_FIELD_NUMBER: _ClassVar[int] + PATTERN_FIELD_NUMBER: _ClassVar[int] + PREFIX_FIELD_NUMBER: _ClassVar[int] + SUFFIX_FIELD_NUMBER: _ClassVar[int] + CONTAINS_FIELD_NUMBER: _ClassVar[int] + IN_FIELD_NUMBER: _ClassVar[int] + NOT_IN_FIELD_NUMBER: _ClassVar[int] + IP_FIELD_NUMBER: _ClassVar[int] + IPV4_FIELD_NUMBER: _ClassVar[int] + IPV6_FIELD_NUMBER: _ClassVar[int] + IGNORE_EMPTY_FIELD_NUMBER: _ClassVar[int] + const: bytes + len: int + min_len: int + max_len: int + pattern: str + prefix: bytes + suffix: bytes + contains: bytes + not_in: _containers.RepeatedScalarFieldContainer[bytes] + ip: bool + ipv4: bool + ipv6: bool + ignore_empty: bool + def __init__(self, const: _Optional[bytes] = ..., len: _Optional[int] = ..., min_len: _Optional[int] = ..., max_len: _Optional[int] = ..., pattern: _Optional[str] = ..., prefix: _Optional[bytes] = ..., suffix: _Optional[bytes] = ..., contains: _Optional[bytes] = ..., not_in: _Optional[_Iterable[bytes]] = ..., ip: bool = ..., ipv4: bool = ..., ipv6: bool = ..., ignore_empty: bool = ..., **kwargs) -> None: ... + +class EnumRules(_message.Message): + __slots__ = ("const", "defined_only", "not_in") + CONST_FIELD_NUMBER: _ClassVar[int] + DEFINED_ONLY_FIELD_NUMBER: _ClassVar[int] + IN_FIELD_NUMBER: _ClassVar[int] + NOT_IN_FIELD_NUMBER: _ClassVar[int] + const: int + defined_only: bool + not_in: _containers.RepeatedScalarFieldContainer[int] + def __init__(self, const: _Optional[int] = ..., defined_only: bool = ..., not_in: _Optional[_Iterable[int]] = ..., **kwargs) -> None: ... + +class MessageRules(_message.Message): + __slots__ = ("skip", "required") + SKIP_FIELD_NUMBER: _ClassVar[int] + REQUIRED_FIELD_NUMBER: _ClassVar[int] + skip: bool + required: bool + def __init__(self, skip: bool = ..., required: bool = ...) -> None: ... + +class RepeatedRules(_message.Message): + __slots__ = ("min_items", "max_items", "unique", "items", "ignore_empty") + MIN_ITEMS_FIELD_NUMBER: _ClassVar[int] + MAX_ITEMS_FIELD_NUMBER: _ClassVar[int] + UNIQUE_FIELD_NUMBER: _ClassVar[int] + ITEMS_FIELD_NUMBER: _ClassVar[int] + IGNORE_EMPTY_FIELD_NUMBER: _ClassVar[int] + min_items: int + max_items: int + unique: bool + items: FieldRules + ignore_empty: bool + def __init__(self, min_items: _Optional[int] = ..., max_items: _Optional[int] = ..., unique: bool = ..., items: _Optional[_Union[FieldRules, _Mapping]] = ..., ignore_empty: bool = ...) -> None: ... + +class MapRules(_message.Message): + __slots__ = ("min_pairs", "max_pairs", "no_sparse", "keys", "values", "ignore_empty") + MIN_PAIRS_FIELD_NUMBER: _ClassVar[int] + MAX_PAIRS_FIELD_NUMBER: _ClassVar[int] + NO_SPARSE_FIELD_NUMBER: _ClassVar[int] + KEYS_FIELD_NUMBER: _ClassVar[int] + VALUES_FIELD_NUMBER: _ClassVar[int] + IGNORE_EMPTY_FIELD_NUMBER: _ClassVar[int] + min_pairs: int + max_pairs: int + no_sparse: bool + keys: FieldRules + values: FieldRules + ignore_empty: bool + def __init__(self, min_pairs: _Optional[int] = ..., max_pairs: _Optional[int] = ..., no_sparse: bool = ..., keys: _Optional[_Union[FieldRules, _Mapping]] = ..., values: _Optional[_Union[FieldRules, _Mapping]] = ..., ignore_empty: bool = ...) -> None: ... + +class AnyRules(_message.Message): + __slots__ = ("required", "not_in") + REQUIRED_FIELD_NUMBER: _ClassVar[int] + IN_FIELD_NUMBER: _ClassVar[int] + NOT_IN_FIELD_NUMBER: _ClassVar[int] + required: bool + not_in: _containers.RepeatedScalarFieldContainer[str] + def __init__(self, required: bool = ..., not_in: _Optional[_Iterable[str]] = ..., **kwargs) -> None: ... + +class DurationRules(_message.Message): + __slots__ = ("required", "const", "lt", "lte", "gt", "gte", "not_in") + REQUIRED_FIELD_NUMBER: _ClassVar[int] + CONST_FIELD_NUMBER: _ClassVar[int] + LT_FIELD_NUMBER: _ClassVar[int] + LTE_FIELD_NUMBER: _ClassVar[int] + GT_FIELD_NUMBER: _ClassVar[int] + GTE_FIELD_NUMBER: _ClassVar[int] + IN_FIELD_NUMBER: _ClassVar[int] + NOT_IN_FIELD_NUMBER: _ClassVar[int] + required: bool + const: _duration_pb2.Duration + lt: _duration_pb2.Duration + lte: _duration_pb2.Duration + gt: _duration_pb2.Duration + gte: _duration_pb2.Duration + not_in: _containers.RepeatedCompositeFieldContainer[_duration_pb2.Duration] + def __init__(self, required: bool = ..., const: _Optional[_Union[_duration_pb2.Duration, _Mapping]] = ..., lt: _Optional[_Union[_duration_pb2.Duration, _Mapping]] = ..., lte: _Optional[_Union[_duration_pb2.Duration, _Mapping]] = ..., gt: _Optional[_Union[_duration_pb2.Duration, _Mapping]] = ..., gte: _Optional[_Union[_duration_pb2.Duration, _Mapping]] = ..., not_in: _Optional[_Iterable[_Union[_duration_pb2.Duration, _Mapping]]] = ..., **kwargs) -> None: ... + +class TimestampRules(_message.Message): + __slots__ = ("required", "const", "lt", "lte", "gt", "gte", "lt_now", "gt_now", "within") + REQUIRED_FIELD_NUMBER: _ClassVar[int] + CONST_FIELD_NUMBER: _ClassVar[int] + LT_FIELD_NUMBER: _ClassVar[int] + LTE_FIELD_NUMBER: _ClassVar[int] + GT_FIELD_NUMBER: _ClassVar[int] + GTE_FIELD_NUMBER: _ClassVar[int] + LT_NOW_FIELD_NUMBER: _ClassVar[int] + GT_NOW_FIELD_NUMBER: _ClassVar[int] + WITHIN_FIELD_NUMBER: _ClassVar[int] + required: bool + const: _timestamp_pb2.Timestamp + lt: _timestamp_pb2.Timestamp + lte: _timestamp_pb2.Timestamp + gt: _timestamp_pb2.Timestamp + gte: _timestamp_pb2.Timestamp + lt_now: bool + gt_now: bool + within: _duration_pb2.Duration + def __init__(self, required: bool = ..., const: _Optional[_Union[_timestamp_pb2.Timestamp, _Mapping]] = ..., lt: _Optional[_Union[_timestamp_pb2.Timestamp, _Mapping]] = ..., lte: _Optional[_Union[_timestamp_pb2.Timestamp, _Mapping]] = ..., gt: _Optional[_Union[_timestamp_pb2.Timestamp, _Mapping]] = ..., gte: _Optional[_Union[_timestamp_pb2.Timestamp, _Mapping]] = ..., lt_now: bool = ..., gt_now: bool = ..., within: _Optional[_Union[_duration_pb2.Duration, _Mapping]] = ...) -> None: ... diff --git a/diode-sdk-python/netboxlabs/diode/sdk/diode/v1/device_role_pb2_grpc.py b/diode-sdk-python/netboxlabs/diode/sdk/validate/validate_pb2_grpc.py similarity index 100% rename from diode-sdk-python/netboxlabs/diode/sdk/diode/v1/device_role_pb2_grpc.py rename to diode-sdk-python/netboxlabs/diode/sdk/validate/validate_pb2_grpc.py diff --git a/diode-sdk-python/pyproject.toml b/diode-sdk-python/pyproject.toml index 86b2af7d..501007b8 100644 --- a/diode-sdk-python/pyproject.toml +++ b/diode-sdk-python/pyproject.toml @@ -25,7 +25,9 @@ classifiers = [ # Optional 'Programming Language :: Python :: 3.11', ] -dependencies = [ # Optional +dependencies = [ + "grpcio==1.62.1", + "grpcio-status==1.62.1", ] [project.optional-dependencies] # Optional @@ -38,7 +40,12 @@ test = ["coverage", "pytest", "pytest-cov"] [project.scripts] # Optional [tool.setuptools] -packages = ["netboxlabs.diode.sdk"] +packages = [ + "netboxlabs.diode.sdk", + "netboxlabs.diode.sdk.diode", + "netboxlabs.diode.sdk.diode.v1", + "netboxlabs.diode.sdk.validate", +] [build-system] requires = ["setuptools>=43.0.0", "wheel"] @@ -47,6 +54,10 @@ build-backend = "setuptools.build_meta" [tool.ruff] line-length = 140 +exclude = [ + "netboxlabs/diode/sdk/diode/*", + "netboxlabs/diode/sdk/validate/*", +] [tool.ruff.format] quote-style = "double" diff --git a/diode-sdk-python/tests/test_client.py b/diode-sdk-python/tests/test_client.py new file mode 100644 index 00000000..b949548f --- /dev/null +++ b/diode-sdk-python/tests/test_client.py @@ -0,0 +1,34 @@ +#!/usr/bin/env python +# Copyright 2024 NetBox Labs Inc +"""NetBox Labs - Tests.""" + +import grpc +import pytest + +from netboxlabs.diode.sdk import DiodeClient +from netboxlabs.diode.sdk.exceptions import DiodeClientError, DiodeConfigError + + +def test_init(): + """Ensure we can initiate a client configuration.""" + config = DiodeClient(target="localhost:8081", app_name="my-producer", app_version="0.0.1", api_key="abcde") + assert config.target == "localhost:8081" + assert config.name == "diode-sdk-python" + assert config.version == "0.0.1" + assert config.app_name == "my-producer" + assert config.app_version == "0.0.1" + + +def test_config_error(): + """Ensure we can raise a config error.""" + with pytest.raises(DiodeConfigError) as err: + DiodeClient(target="localhost:8081", app_name="my-producer", app_version="0.0.1") + assert str(err.value) == "API key is required" + + +def test_client_error(): + """Ensure we can raise a client error.""" + with pytest.raises(DiodeClientError) as err: + client = DiodeClient(target="invalid:8081", app_name="my-producer", app_version="0.0.1", api_key="abcde") + client.ingest(entities=[]) + assert err.value.status_code == grpc.StatusCode.UNAVAILABLE diff --git a/diode-sdk-python/tests/test_client_config.py b/diode-sdk-python/tests/test_client_config.py deleted file mode 100644 index 128beb85..00000000 --- a/diode-sdk-python/tests/test_client_config.py +++ /dev/null @@ -1,12 +0,0 @@ -#!/usr/bin/env python -# Copyright 2024 NetBox Labs Inc -"""NetBox Labs - Tests.""" - -from netboxlabs.diode.sdk import ClientConfiguration - - -def test_init(): - """Ensure we can initiate a client configuration.""" - config = ClientConfiguration(name="my-producer", version="0.0.1") - assert config.name == "my-producer" - assert config.version == "0.0.1"