def apply(self):
        stub = ssl_certificate_pb2_grpc.ComputeBetaSslCertificateServiceStub(
            channel.Channel())
        request = ssl_certificate_pb2.ApplyComputeBetaSslCertificateRequest()
        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 SslCertificateSelfManaged.to_proto(self.self_managed):
            request.resource.self_managed.CopyFrom(
                SslCertificateSelfManaged.to_proto(self.self_managed))
        else:
            request.resource.ClearField("self_managed")
        if SslCertificateTypeEnum.to_proto(self.type):
            request.resource.type = SslCertificateTypeEnum.to_proto(self.type)

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

        request.service_account_file = self.service_account_file

        response = stub.ApplyComputeBetaSslCertificate(request)
        self.id = Primitive.from_proto(response.id)
        self.name = Primitive.from_proto(response.name)
        self.description = Primitive.from_proto(response.description)
        self.self_link = Primitive.from_proto(response.self_link)
        self.self_managed = SslCertificateSelfManaged.from_proto(
            response.self_managed)
        self.type = SslCertificateTypeEnum.from_proto(response.type)
        self.subject_alternative_names = Primitive.from_proto(
            response.subject_alternative_names)
        self.expire_time = Primitive.from_proto(response.expire_time)
        self.project = Primitive.from_proto(response.project)
Пример #2
0
    def delete(self):
        stub = ssl_certificate_pb2_grpc.ComputeBetaSslCertificateServiceStub(
            channel.Channel())
        request = ssl_certificate_pb2.DeleteComputeBetaSslCertificateRequest()
        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 SslCertificateSelfManaged.to_proto(self.self_managed):
            request.resource.self_managed.CopyFrom(
                SslCertificateSelfManaged.to_proto(self.self_managed))
        else:
            request.resource.ClearField("self_managed")
        if SslCertificateTypeEnum.to_proto(self.type):
            request.resource.type = SslCertificateTypeEnum.to_proto(self.type)

        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.DeleteComputeBetaSslCertificate(request)
    def list(self, project, service_account_file=""):
        stub = ssl_certificate_pb2_grpc.ComputeBetaSslCertificateServiceStub(
            channel.Channel())
        request = ssl_certificate_pb2.ListComputeBetaSslCertificateRequest()
        request.service_account_file = service_account_file
        request.Project = project

        return stub.ListComputeBetaSslCertificate(request).items
    def delete(self, project, name, service_account_file=""):
        stub = ssl_certificate_pb2_grpc.ComputeBetaSslCertificateServiceStub(
            channel.Channel())
        request = ssl_certificate_pb2.DeleteComputeBetaSslCertificateRequest()
        request.service_account_file = service_account_file
        request.Project = project

        request.Name = name

        response = stub.DeleteComputeBetaSslCertificate(request)