示例#1
0
    def delete(self):
        stub = target_pool_pb2_grpc.ComputeBetaTargetPoolServiceStub(channel.Channel())
        request = target_pool_pb2.DeleteComputeBetaTargetPoolRequest()
        request.service_account_file = self.service_account_file
        if Primitive.to_proto(self.backup_pool):
            request.resource.backup_pool = Primitive.to_proto(self.backup_pool)

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

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

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

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

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

        if TargetPoolSessionAffinityEnum.to_proto(self.session_affinity):
            request.resource.session_affinity = TargetPoolSessionAffinityEnum.to_proto(
                self.session_affinity
            )

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

        response = stub.DeleteComputeBetaTargetPool(request)
示例#2
0
    def list(self, project, region, service_account_file=""):
        stub = target_pool_pb2_grpc.ComputeBetaTargetPoolServiceStub(channel.Channel())
        request = target_pool_pb2.ListComputeBetaTargetPoolRequest()
        request.service_account_file = service_account_file
        request.Project = project

        request.Region = region

        return stub.ListComputeBetaTargetPool(request).items
示例#3
0
    def delete(self, project, region, name, service_account_file=""):
        stub = target_pool_pb2_grpc.ComputeBetaTargetPoolServiceStub(channel.Channel())
        request = target_pool_pb2.DeleteComputeBetaTargetPoolRequest()
        request.service_account_file = service_account_file
        request.Project = project

        request.Region = region

        request.Name = name

        response = stub.DeleteComputeBetaTargetPool(request)