Beispiel #1
0
    def list(self, project, region, service_account_file=""):
        stub = router_peer_pb2_grpc.ComputeRouterPeerServiceStub(
            channel.Channel())
        request = router_peer_pb2.ListComputeRouterPeerRequest()
        request.service_account_file = service_account_file
        request.Project = project

        request.Region = region

        return stub.ListComputeRouterPeer(request).items
Beispiel #2
0
    def delete(self, project, region, router, name, service_account_file=""):
        stub = router_peer_pb2_grpc.ComputeRouterPeerServiceStub(
            channel.Channel())
        request = router_peer_pb2.DeleteComputeRouterPeerRequest()
        request.service_account_file = service_account_file
        request.Project = project

        request.Region = region

        request.Router = router

        request.Name = name

        response = stub.DeleteComputeRouterPeer(request)
    def delete(self):
        stub = router_peer_pb2_grpc.ComputeRouterPeerServiceStub(
            channel.Channel())
        request = router_peer_pb2.DeleteComputeRouterPeerRequest()
        request.service_account_file = self.service_account_file
        if Primitive.to_proto(self.router):
            request.resource.router = Primitive.to_proto(self.router)

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

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

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

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

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

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

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

        if Primitive.to_proto(self.advertised_groups):
            request.resource.advertised_groups.extend(
                Primitive.to_proto(self.advertised_groups))
        if RouterPeerAdvertisedIPRangesArray.to_proto(
                self.advertised_ip_ranges):
            request.resource.advertised_ip_ranges.extend(
                RouterPeerAdvertisedIPRangesArray.to_proto(
                    self.advertised_ip_ranges))
        if Primitive.to_proto(self.region):
            request.resource.region = Primitive.to_proto(self.region)

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

        response = stub.DeleteComputeRouterPeer(request)
Beispiel #4
0
    def apply(self):
        stub = router_peer_pb2_grpc.ComputeRouterPeerServiceStub(
            channel.Channel())
        request = router_peer_pb2.ApplyComputeRouterPeerRequest()
        if Primitive.to_proto(self.router):
            request.resource.router = Primitive.to_proto(self.router)

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

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

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

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

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

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

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

        if Primitive.to_proto(self.advertised_groups):
            request.resource.advertised_groups.extend(
                Primitive.to_proto(self.advertised_groups))
        if RouterPeerAdvertisedIPRangesArray.to_proto(
                self.advertised_ip_ranges):
            request.resource.advertised_ip_ranges.extend(
                RouterPeerAdvertisedIPRangesArray.to_proto(
                    self.advertised_ip_ranges))
        if Primitive.to_proto(self.region):
            request.resource.region = Primitive.to_proto(self.region)

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

        request.service_account_file = self.service_account_file

        response = stub.ApplyComputeRouterPeer(request)
        self.creation_timestamp = Primitive.from_proto(
            response.creation_timestamp)
        self.router = Primitive.from_proto(response.router)
        self.name = Primitive.from_proto(response.name)
        self.interface_name = Primitive.from_proto(response.interface_name)
        self.ip_address = Primitive.from_proto(response.ip_address)
        self.peer_ip_address = Primitive.from_proto(response.peer_ip_address)
        self.peer_asn = Primitive.from_proto(response.peer_asn)
        self.advertised_route_priority = Primitive.from_proto(
            response.advertised_route_priority)
        self.advertise_mode = Primitive.from_proto(response.advertise_mode)
        self.management_type = Primitive.from_proto(response.management_type)
        self.advertised_groups = Primitive.from_proto(
            response.advertised_groups)
        self.advertised_ip_ranges = RouterPeerAdvertisedIPRangesArray.from_proto(
            response.advertised_ip_ranges)
        self.region = Primitive.from_proto(response.region)
        self.project = Primitive.from_proto(response.project)