コード例 #1
0
    def apply(self):
        stub = database_pb2_grpc.SqlBetaDatabaseServiceStub(channel.Channel())
        request = database_pb2.ApplySqlBetaDatabaseRequest()
        if Primitive.to_proto(self.charset):
            request.resource.charset = Primitive.to_proto(self.charset)

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

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

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

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

        request.service_account_file = self.service_account_file

        response = stub.ApplySqlBetaDatabase(request)
        self.charset = Primitive.from_proto(response.charset)
        self.collation = Primitive.from_proto(response.collation)
        self.instance = Primitive.from_proto(response.instance)
        self.name = Primitive.from_proto(response.name)
        self.project = Primitive.from_proto(response.project)
        self.self_link = Primitive.from_proto(response.self_link)
コード例 #2
0
    def list(self, project, instance, service_account_file=""):
        stub = database_pb2_grpc.SqlBetaDatabaseServiceStub(channel.Channel())
        request = database_pb2.ListSqlBetaDatabaseRequest()
        request.service_account_file = service_account_file
        request.Project = project

        request.Instance = instance

        return stub.ListSqlBetaDatabase(request).items
コード例 #3
0
    def delete(self, project, instance, name, service_account_file=""):
        stub = database_pb2_grpc.SqlBetaDatabaseServiceStub(channel.Channel())
        request = database_pb2.DeleteSqlBetaDatabaseRequest()
        request.service_account_file = service_account_file
        request.Project = project

        request.Instance = instance

        request.Name = name

        response = stub.DeleteSqlBetaDatabase(request)
    def delete(self):
        stub = database_pb2_grpc.SqlBetaDatabaseServiceStub(channel.Channel())
        request = database_pb2.DeleteSqlBetaDatabaseRequest()
        request.service_account_file = self.service_account_file
        if Primitive.to_proto(self.charset):
            request.resource.charset = Primitive.to_proto(self.charset)

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

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

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

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

        response = stub.DeleteSqlBetaDatabase(request)