def delete(self):
        stub = connector_pb2_grpc.VpcaccessConnectorServiceStub(
            channel.Channel())
        request = connector_pb2.DeleteVpcaccessConnectorRequest()
        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.network):
            request.resource.network = Primitive.to_proto(self.network)

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

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

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

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

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

        response = stub.DeleteVpcaccessConnector(request)
    def list(self, project, location, service_account_file=""):
        stub = connector_pb2_grpc.VpcaccessConnectorServiceStub(
            channel.Channel())
        request = connector_pb2.ListVpcaccessConnectorRequest()
        request.service_account_file = service_account_file
        request.Project = project

        request.Location = location

        return stub.ListVpcaccessConnector(request).items
Пример #3
0
    def delete(self, project, location, name, service_account_file=""):
        stub = connector_pb2_grpc.VpcaccessConnectorServiceStub(
            channel.Channel())
        request = connector_pb2.DeleteVpcaccessConnectorRequest()
        request.service_account_file = service_account_file
        request.Project = project

        request.Location = location

        request.Name = name

        response = stub.DeleteVpcaccessConnector(request)
    def apply(self):
        stub = connector_pb2_grpc.VpcaccessConnectorServiceStub(
            channel.Channel())
        request = connector_pb2.ApplyVpcaccessConnectorRequest()
        if Primitive.to_proto(self.name):
            request.resource.name = Primitive.to_proto(self.name)

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

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

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

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

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

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

        request.service_account_file = self.service_account_file

        response = stub.ApplyVpcaccessConnector(request)
        self.name = Primitive.from_proto(response.name)
        self.network = Primitive.from_proto(response.network)
        self.ip_cidr_range = Primitive.from_proto(response.ip_cidr_range)
        self.min_throughput = Primitive.from_proto(response.min_throughput)
        self.max_throughput = Primitive.from_proto(response.max_throughput)
        self.project = Primitive.from_proto(response.project)
        self.location = Primitive.from_proto(response.location)
        self.state = ConnectorStateEnum.from_proto(response.state)
        self.self_link = Primitive.from_proto(response.self_link)