Example #1
0
    def apply(self):
        stub = vpn_gateway_pb2_grpc.ComputeBetaVpnGatewayServiceStub(channel.Channel())
        request = vpn_gateway_pb2.ApplyComputeBetaVpnGatewayRequest()
        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.region):
            request.resource.region = Primitive.to_proto(self.region)

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

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

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

        request.service_account_file = self.service_account_file

        response = stub.ApplyComputeBetaVpnGateway(request)
        self.id = Primitive.from_proto(response.id)
        self.name = Primitive.from_proto(response.name)
        self.description = Primitive.from_proto(response.description)
        self.region = Primitive.from_proto(response.region)
        self.network = Primitive.from_proto(response.network)
        self.self_link = Primitive.from_proto(response.self_link)
        self.project = Primitive.from_proto(response.project)
        self.labels = Primitive.from_proto(response.labels)
        self.vpn_interface = VpnGatewayVpnInterfaceArray.from_proto(
            response.vpn_interface
        )
Example #2
0
    def list(self, project, region, service_account_file=""):
        stub = vpn_gateway_pb2_grpc.ComputeBetaVpnGatewayServiceStub(channel.Channel())
        request = vpn_gateway_pb2.ListComputeBetaVpnGatewayRequest()
        request.service_account_file = service_account_file
        request.Project = project

        request.Region = region

        return stub.ListComputeBetaVpnGateway(request).items
Example #3
0
    def delete(self, project, region, name, service_account_file=""):
        stub = vpn_gateway_pb2_grpc.ComputeBetaVpnGatewayServiceStub(
            channel.Channel())
        request = vpn_gateway_pb2.DeleteComputeBetaVpnGatewayRequest()
        request.service_account_file = service_account_file
        request.Project = project

        request.Region = region

        request.Name = name

        response = stub.DeleteComputeBetaVpnGateway(request)
Example #4
0
    def delete(self):
        stub = vpn_gateway_pb2_grpc.ComputeBetaVpnGatewayServiceStub(channel.Channel())
        request = vpn_gateway_pb2.DeleteComputeBetaVpnGatewayRequest()
        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.region):
            request.resource.region = Primitive.to_proto(self.region)

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

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

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

        response = stub.DeleteComputeBetaVpnGateway(request)