Example #1
0
    def apply(self):
        stub = target_vpn_gateway_pb2_grpc.ComputeTargetVpnGatewayServiceStub(
            channel.Channel())
        request = target_vpn_gateway_pb2.ApplyComputeTargetVpnGatewayRequest()
        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)

        request.service_account_file = self.service_account_file

        response = stub.ApplyComputeTargetVpnGateway(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.tunnel = Primitive.from_proto(response.tunnel)
        self.status = TargetVpnGatewayStatusEnum.from_proto(response.status)
        self.self_link = Primitive.from_proto(response.self_link)
        self.forwarding_rule = Primitive.from_proto(response.forwarding_rule)
        self.project = Primitive.from_proto(response.project)
Example #2
0
    def list(self, project, region, service_account_file=""):
        stub = target_vpn_gateway_pb2_grpc.ComputeTargetVpnGatewayServiceStub(
            channel.Channel())
        request = target_vpn_gateway_pb2.ListComputeTargetVpnGatewayRequest()
        request.service_account_file = service_account_file
        request.Project = project

        request.Region = region

        return stub.ListComputeTargetVpnGateway(request).items
Example #3
0
    def delete(self, project, region, name, service_account_file=""):
        stub = target_vpn_gateway_pb2_grpc.ComputeTargetVpnGatewayServiceStub(
            channel.Channel())
        request = target_vpn_gateway_pb2.DeleteComputeTargetVpnGatewayRequest()
        request.service_account_file = service_account_file
        request.Project = project

        request.Region = region

        request.Name = name

        response = stub.DeleteComputeTargetVpnGateway(request)
    def delete(self):
        stub = target_vpn_gateway_pb2_grpc.ComputeTargetVpnGatewayServiceStub(
            channel.Channel())
        request = target_vpn_gateway_pb2.DeleteComputeTargetVpnGatewayRequest()
        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)

        response = stub.DeleteComputeTargetVpnGateway(request)