Skip to content

Commit

Permalink
Fix VM nested cluster
Browse files Browse the repository at this point in the history
  • Loading branch information
leoparente committed Aug 30, 2024
1 parent 18e3faf commit 0b90efb
Show file tree
Hide file tree
Showing 8 changed files with 1,136 additions and 343 deletions.
8 changes: 4 additions & 4 deletions docs/entities.md
Original file line number Diff line number Diff line change
Expand Up @@ -882,7 +882,7 @@ def main():
entities = []

"""
Clsuter entity with only a name provided will attempt to create or update a cluster with
Cluster entity with only a name provided will attempt to create or update a cluster with
the given name and placeholders (i.e. "undefined") for other nested objects types
(e.g. ClusterGroup, ClusterType, Site) required by NetBox.
"""
Expand Down Expand Up @@ -919,7 +919,7 @@ def main():
tags=["tag 1", "tag 2"],
),
group = ClusterGroup(
name="Cluster Group",
name="Cluster Group A",
description="Cluster Group description",
tags=["tag 1", "tag 2"],
),
Expand Down Expand Up @@ -995,8 +995,8 @@ def main():

"""
VirtualMachine entity with only a name provided will attempt to create or update a name with
the given name and placeholders (i.e. "undefined") for other nested objects types (e.g. Site)
required by NetBox.
the given name and placeholders (i.e. "undefined") for other nested objects types (e.g. Site,
Role, Cluster, Platform, Device) required by NetBox.
"""

virtual_machine = VirtualMachine(name="VM A")
Expand Down
553 changes: 359 additions & 194 deletions netboxlabs/diode/sdk/diode/v1/ingester_pb2.py

Large diffs are not rendered by default.

355 changes: 326 additions & 29 deletions netboxlabs/diode/sdk/diode/v1/ingester_pb2.pyi

Large diffs are not rendered by default.

75 changes: 42 additions & 33 deletions netboxlabs/diode/sdk/diode/v1/ingester_pb2_grpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@


class IngesterServiceStub(object):
"""Ingestion API
"""
"""Ingestion API"""

def __init__(self, channel):
"""Constructor.
Expand All @@ -16,55 +15,65 @@ def __init__(self, channel):
channel: A grpc.Channel.
"""
self.Ingest = channel.unary_unary(
'/diode.v1.IngesterService/Ingest',
request_serializer=diode_dot_v1_dot_ingester__pb2.IngestRequest.SerializeToString,
response_deserializer=diode_dot_v1_dot_ingester__pb2.IngestResponse.FromString,
)
"/diode.v1.IngesterService/Ingest",
request_serializer=diode_dot_v1_dot_ingester__pb2.IngestRequest.SerializeToString,
response_deserializer=diode_dot_v1_dot_ingester__pb2.IngestResponse.FromString,
)


class IngesterServiceServicer(object):
"""Ingestion API
"""
"""Ingestion API"""

def Ingest(self, request, context):
"""Ingests data into the system
"""
"""Ingests data into the system"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
context.set_details("Method not implemented!")
raise NotImplementedError("Method not implemented!")


def add_IngesterServiceServicer_to_server(servicer, server):
rpc_method_handlers = {
'Ingest': grpc.unary_unary_rpc_method_handler(
servicer.Ingest,
request_deserializer=diode_dot_v1_dot_ingester__pb2.IngestRequest.FromString,
response_serializer=diode_dot_v1_dot_ingester__pb2.IngestResponse.SerializeToString,
),
"Ingest": grpc.unary_unary_rpc_method_handler(
servicer.Ingest,
request_deserializer=diode_dot_v1_dot_ingester__pb2.IngestRequest.FromString,
response_serializer=diode_dot_v1_dot_ingester__pb2.IngestResponse.SerializeToString,
),
}
generic_handler = grpc.method_handlers_generic_handler(
'diode.v1.IngesterService', rpc_method_handlers)
"diode.v1.IngesterService", rpc_method_handlers
)
server.add_generic_rpc_handlers((generic_handler,))


# This class is part of an EXPERIMENTAL API.
# This class is part of an EXPERIMENTAL API.
class IngesterService(object):
"""Ingestion API
"""
"""Ingestion API"""

@staticmethod
def Ingest(request,
def Ingest(
request,
target,
options=(),
channel_credentials=None,
call_credentials=None,
insecure=False,
compression=None,
wait_for_ready=None,
timeout=None,
metadata=None,
):
return grpc.experimental.unary_unary(
request,
target,
options=(),
channel_credentials=None,
call_credentials=None,
insecure=False,
compression=None,
wait_for_ready=None,
timeout=None,
metadata=None):
return grpc.experimental.unary_unary(request, target, '/diode.v1.IngesterService/Ingest',
"/diode.v1.IngesterService/Ingest",
diode_dot_v1_dot_ingester__pb2.IngestRequest.SerializeToString,
diode_dot_v1_dot_ingester__pb2.IngestResponse.FromString,
options, channel_credentials,
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
options,
channel_credentials,
insecure,
call_credentials,
compression,
wait_for_ready,
timeout,
metadata,
)
5 changes: 2 additions & 3 deletions netboxlabs/diode/sdk/ingester.py
Original file line number Diff line number Diff line change
Expand Up @@ -578,6 +578,7 @@ def __new__(
return VirtualMachinePb(
name=name,
status=status,
cluster=cluster,
site=site,
role=role,
device=device,
Expand Down Expand Up @@ -697,9 +698,7 @@ def __new__(
virtual_disk = convert_to_protobuf(
virtual_disk, VirtualDiskPb, name=virtual_disk
)
vminterface = convert_to_protobuf(
vminterface, VMInterfacePb, name=vminterface
)
vminterface = convert_to_protobuf(vminterface, VMInterfacePb, name=vminterface)
virtual_machine = convert_to_protobuf(
virtual_machine, VirtualMachinePb, name=virtual_machine
)
Expand Down
109 changes: 57 additions & 52 deletions netboxlabs/diode/sdk/validate/validate_pb2.py

Large diffs are not rendered by default.

Loading

0 comments on commit 0b90efb

Please sign in to comment.