Exemplo n.º 1
0
    def list(self, project, service_account_file=""):
        stub = route_pb2_grpc.ComputeRouteServiceStub(channel.Channel())
        request = route_pb2.ListComputeRouteRequest()
        request.service_account_file = service_account_file
        request.Project = project

        return stub.ListComputeRoute(request).items
Exemplo n.º 2
0
    def delete(self, project, name, service_account_file=""):
        stub = route_pb2_grpc.ComputeRouteServiceStub(channel.Channel())
        request = route_pb2.DeleteComputeRouteRequest()
        request.service_account_file = service_account_file
        request.Project = project

        request.Name = name

        response = stub.DeleteComputeRoute(request)
    def delete(self):
        stub = route_pb2_grpc.ComputeRouteServiceStub(channel.Channel())
        request = route_pb2.DeleteComputeRouteRequest()
        request.service_account_file = self.service_account_file
        if Primitive.to_proto(self.name):
            request.resource.name = Primitive.to_proto(self.name)

        if Primitive.to_proto(self.description):
            request.resource.description = Primitive.to_proto(self.description)

        if Primitive.to_proto(self.network):
            request.resource.network = Primitive.to_proto(self.network)

        if Primitive.to_proto(self.tag):
            request.resource.tag.extend(Primitive.to_proto(self.tag))
        if Primitive.to_proto(self.dest_range):
            request.resource.dest_range = Primitive.to_proto(self.dest_range)

        if Primitive.to_proto(self.priority):
            request.resource.priority = Primitive.to_proto(self.priority)

        if Primitive.to_proto(self.next_hop_instance):
            request.resource.next_hop_instance = Primitive.to_proto(
                self.next_hop_instance
            )

        if Primitive.to_proto(self.next_hop_ip):
            request.resource.next_hop_ip = Primitive.to_proto(self.next_hop_ip)

        if Primitive.to_proto(self.next_hop_network):
            request.resource.next_hop_network = Primitive.to_proto(
                self.next_hop_network
            )

        if Primitive.to_proto(self.next_hop_gateway):
            request.resource.next_hop_gateway = Primitive.to_proto(
                self.next_hop_gateway
            )

        if Primitive.to_proto(self.next_hop_ilb):
            request.resource.next_hop_ilb = Primitive.to_proto(self.next_hop_ilb)

        if Primitive.to_proto(self.next_hop_vpn_tunnel):
            request.resource.next_hop_vpn_tunnel = Primitive.to_proto(
                self.next_hop_vpn_tunnel
            )

        if Primitive.to_proto(self.project):
            request.resource.project = Primitive.to_proto(self.project)

        response = stub.DeleteComputeRoute(request)
Exemplo n.º 4
0
    def apply(self):
        stub = route_pb2_grpc.ComputeRouteServiceStub(channel.Channel())
        request = route_pb2.ApplyComputeRouteRequest()
        if Primitive.to_proto(self.name):
            request.resource.name = Primitive.to_proto(self.name)

        if Primitive.to_proto(self.description):
            request.resource.description = Primitive.to_proto(self.description)

        if Primitive.to_proto(self.network):
            request.resource.network = Primitive.to_proto(self.network)

        if Primitive.to_proto(self.tag):
            request.resource.tag.extend(Primitive.to_proto(self.tag))
        if Primitive.to_proto(self.dest_range):
            request.resource.dest_range = Primitive.to_proto(self.dest_range)

        if Primitive.to_proto(self.priority):
            request.resource.priority = Primitive.to_proto(self.priority)

        if Primitive.to_proto(self.next_hop_instance):
            request.resource.next_hop_instance = Primitive.to_proto(
                self.next_hop_instance)

        if Primitive.to_proto(self.next_hop_ip):
            request.resource.next_hop_ip = Primitive.to_proto(self.next_hop_ip)

        if Primitive.to_proto(self.next_hop_network):
            request.resource.next_hop_network = Primitive.to_proto(
                self.next_hop_network)

        if Primitive.to_proto(self.next_hop_gateway):
            request.resource.next_hop_gateway = Primitive.to_proto(
                self.next_hop_gateway)

        if Primitive.to_proto(self.next_hop_ilb):
            request.resource.next_hop_ilb = Primitive.to_proto(
                self.next_hop_ilb)

        if Primitive.to_proto(self.next_hop_vpn_tunnel):
            request.resource.next_hop_vpn_tunnel = Primitive.to_proto(
                self.next_hop_vpn_tunnel)

        if Primitive.to_proto(self.project):
            request.resource.project = Primitive.to_proto(self.project)

        request.service_account_file = self.service_account_file

        response = stub.ApplyComputeRoute(request)
        self.id = Primitive.from_proto(response.id)
        self.name = Primitive.from_proto(response.name)
        self.description = Primitive.from_proto(response.description)
        self.network = Primitive.from_proto(response.network)
        self.tag = Primitive.from_proto(response.tag)
        self.dest_range = Primitive.from_proto(response.dest_range)
        self.priority = Primitive.from_proto(response.priority)
        self.next_hop_instance = Primitive.from_proto(
            response.next_hop_instance)
        self.next_hop_ip = Primitive.from_proto(response.next_hop_ip)
        self.next_hop_network = Primitive.from_proto(response.next_hop_network)
        self.next_hop_gateway = Primitive.from_proto(response.next_hop_gateway)
        self.next_hop_peering = Primitive.from_proto(response.next_hop_peering)
        self.next_hop_ilb = Primitive.from_proto(response.next_hop_ilb)
        self.warning = RouteWarningArray.from_proto(response.warning)
        self.next_hop_vpn_tunnel = Primitive.from_proto(
            response.next_hop_vpn_tunnel)
        self.self_link = Primitive.from_proto(response.self_link)
        self.project = Primitive.from_proto(response.project)