コード例 #1
0
    def list(self, project, service_account_file=""):
        stub = managed_zone_pb2_grpc.DnsManagedZoneServiceStub(
            channel.Channel())
        request = managed_zone_pb2.ListDnsManagedZoneRequest()
        request.service_account_file = service_account_file
        request.Project = project

        return stub.ListDnsManagedZone(request).items
コード例 #2
0
    def delete(self, project, name, service_account_file=""):
        stub = managed_zone_pb2_grpc.DnsManagedZoneServiceStub(
            channel.Channel())
        request = managed_zone_pb2.DeleteDnsManagedZoneRequest()
        request.service_account_file = service_account_file
        request.Project = project

        request.Name = name

        response = stub.DeleteDnsManagedZone(request)
コード例 #3
0
    def hcl(self):
        stub = managed_zone_pb2_grpc.DnsManagedZoneServiceStub(
            channel.Channel())
        request = managed_zone_pb2.DnsManagedZoneAsHclRequest()
        if Primitive.to_proto(self.description):
            request.resource.description = Primitive.to_proto(self.description)

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

        if ManagedZoneDnssecConfig.to_proto(self.dnssec_config):
            request.resource.dnssec_config.CopyFrom(
                ManagedZoneDnssecConfig.to_proto(self.dnssec_config))
        else:
            request.resource.ClearField("dnssec_config")
        if Primitive.to_proto(self.name):
            request.resource.name = Primitive.to_proto(self.name)

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

        if ManagedZoneVisibilityEnum.to_proto(self.visibility):
            request.resource.visibility = ManagedZoneVisibilityEnum.to_proto(
                self.visibility)

        if ManagedZonePrivateVisibilityConfig.to_proto(
                self.private_visibility_config):
            request.resource.private_visibility_config.CopyFrom(
                ManagedZonePrivateVisibilityConfig.to_proto(
                    self.private_visibility_config))
        else:
            request.resource.ClearField("private_visibility_config")
        if ManagedZoneForwardingConfig.to_proto(self.forwarding_config):
            request.resource.forwarding_config.CopyFrom(
                ManagedZoneForwardingConfig.to_proto(self.forwarding_config))
        else:
            request.resource.ClearField("forwarding_config")
        if Primitive.to_proto(self.reverse_lookup):
            request.resource.reverse_lookup = Primitive.to_proto(
                self.reverse_lookup)

        if ManagedZonePeeringConfig.to_proto(self.peering_config):
            request.resource.peering_config.CopyFrom(
                ManagedZonePeeringConfig.to_proto(self.peering_config))
        else:
            request.resource.ClearField("peering_config")
        if Primitive.to_proto(self.project):
            request.resource.project = Primitive.to_proto(self.project)

        response = stub.DnsManagedZoneAsHcl(request)
        return response.hcl
コード例 #4
0
    def apply(self):
        stub = managed_zone_pb2_grpc.DnsManagedZoneServiceStub(
            channel.Channel())
        request = managed_zone_pb2.ApplyDnsManagedZoneRequest()
        if Primitive.to_proto(self.description):
            request.resource.description = Primitive.to_proto(self.description)

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

        if ManagedZoneDnssecConfig.to_proto(self.dnssec_config):
            request.resource.dnssec_config.CopyFrom(
                ManagedZoneDnssecConfig.to_proto(self.dnssec_config))
        else:
            request.resource.ClearField("dnssec_config")
        if Primitive.to_proto(self.name):
            request.resource.name = Primitive.to_proto(self.name)

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

        if ManagedZoneVisibilityEnum.to_proto(self.visibility):
            request.resource.visibility = ManagedZoneVisibilityEnum.to_proto(
                self.visibility)

        if ManagedZonePrivateVisibilityConfig.to_proto(
                self.private_visibility_config):
            request.resource.private_visibility_config.CopyFrom(
                ManagedZonePrivateVisibilityConfig.to_proto(
                    self.private_visibility_config))
        else:
            request.resource.ClearField("private_visibility_config")
        if ManagedZoneForwardingConfig.to_proto(self.forwarding_config):
            request.resource.forwarding_config.CopyFrom(
                ManagedZoneForwardingConfig.to_proto(self.forwarding_config))
        else:
            request.resource.ClearField("forwarding_config")
        if Primitive.to_proto(self.reverse_lookup):
            request.resource.reverse_lookup = Primitive.to_proto(
                self.reverse_lookup)

        if ManagedZonePeeringConfig.to_proto(self.peering_config):
            request.resource.peering_config.CopyFrom(
                ManagedZonePeeringConfig.to_proto(self.peering_config))
        else:
            request.resource.ClearField("peering_config")
        if Primitive.to_proto(self.project):
            request.resource.project = Primitive.to_proto(self.project)

        request.service_account_file = self.service_account_file

        response = stub.ApplyDnsManagedZone(request)
        self.description = Primitive.from_proto(response.description)
        self.dns_name = Primitive.from_proto(response.dns_name)
        self.dnssec_config = ManagedZoneDnssecConfig.from_proto(
            response.dnssec_config)
        self.name = Primitive.from_proto(response.name)
        self.name_servers = Primitive.from_proto(response.name_servers)
        self.labels = Primitive.from_proto(response.labels)
        self.visibility = ManagedZoneVisibilityEnum.from_proto(
            response.visibility)
        self.private_visibility_config = ManagedZonePrivateVisibilityConfig.from_proto(
            response.private_visibility_config)
        self.forwarding_config = ManagedZoneForwardingConfig.from_proto(
            response.forwarding_config)
        self.reverse_lookup = Primitive.from_proto(response.reverse_lookup)
        self.peering_config = ManagedZonePeeringConfig.from_proto(
            response.peering_config)
        self.project = Primitive.from_proto(response.project)