예제 #1
0
    def __init__(self, xml):
        StorageResourceDefinition.__init__(self, xml)

        self.blob_name = self.get_option_value(xml, 'name', str)

        self.copy_option(xml, 'blobType', str)
        if self.blob_type not in ['BlockBlob', 'PageBlob']:
            raise Exception(
                'BLOB type must be either "PageBlob" or "BlockBlob"')

        self.copy_option(xml, 'filePath', str, optional=True)
        self.copy_option(xml, 'copyFromBlob', str, optional=True)
        if self.file_path and self.copy_from_blob:
            raise Exception(
                'Must specify either filePath or copyFromBlob, but not both')
        if not self.file_path and not self.copy_from_blob:
            raise Exception('Must specify either filePath or copyFromBlob')

        self.copy_option(xml, 'container', 'resource')
        self.copy_option(xml, 'storage', 'resource', optional=True)
        self.copy_option(xml, 'contentEncoding', str, optional=True)
        self.copy_option(xml, 'contentLanguage', str, optional=True)
        self.copy_option(xml, 'contentType', str, optional=True)
        self.copy_option(xml, 'contentLength', int, optional=True)
        self.copy_option(xml, 'cacheControl', str, optional=True)
        self.copy_option(xml, 'contentDisposition', str, optional=True)
        self.copy_metadata(xml)
예제 #2
0
    def __init__(self, xml):
        StorageResourceDefinition.__init__(self, xml)

        self.file_name = self.get_option_value(xml, 'name', str)

        self.copy_option(xml, 'filePath', str)

        self.copy_option(xml, 'share', 'resource', optional=True)
        self.copy_option(xml, 'directoryPath', str, optional=True)
        self.copy_option(xml, 'directory', 'resource', optional=True)
        if not (self.share or self.directory):
            raise Exception(
                "{0}: must specify at least directory or share".format(
                    self.file_name))
        if self.directory_path and not self.share:
            raise Exception(
                "{0}: if you specify directoryPath, you must also specify share"
                .format(self.file_name))
        if self.directory_path and self.directory:
            raise Exception(
                "{0}: can't specify directory and directoryPath at once".
                format(self.file_name))

        self.copy_option(xml, 'storage', 'resource', optional=True)

        self.copy_option(xml, 'contentEncoding', str, optional=True)
        self.copy_option(xml, 'contentLanguage', str, optional=True)
        self.copy_option(xml, 'contentType', str, optional=True)
        self.copy_option(xml, 'contentLength', int, optional=True)
        self.copy_option(xml, 'cacheControl', str, optional=True)
        self.copy_option(xml, 'contentDisposition', str, optional=True)
        self.copy_metadata(xml)
예제 #3
0
파일: azure_blob.py 프로젝트: NixOS/nixops
    def __init__(self, xml):
        StorageResourceDefinition.__init__(self, xml)

        self.blob_name = self.get_option_value(xml, "name", str)

        self.copy_option(xml, "blobType", str)
        if self.blob_type not in ["BlockBlob", "PageBlob"]:
            raise Exception('BLOB type must be either "PageBlob" or "BlockBlob"')

        self.copy_option(xml, "filePath", str, optional=True)
        self.copy_option(xml, "copyFromBlob", str, optional=True)
        if self.file_path and self.copy_from_blob:
            raise Exception("Must specify either filePath or copyFromBlob, but not both")
        if not self.file_path and not self.copy_from_blob:
            raise Exception("Must specify either filePath or copyFromBlob")

        self.copy_option(xml, "container", "resource")
        self.copy_option(xml, "storage", "resource", optional=True)
        self.copy_option(xml, "contentEncoding", str, optional=True)
        self.copy_option(xml, "contentLanguage", str, optional=True)
        self.copy_option(xml, "contentType", str, optional=True)
        self.copy_option(xml, "contentLength", int, optional=True)
        self.copy_option(xml, "cacheControl", str, optional=True)
        self.copy_option(xml, "contentDisposition", str, optional=True)
        self.copy_metadata(xml)
예제 #4
0
    def __init__(self, xml):
        StorageResourceDefinition.__init__(self, xml)

        self.queue_name = self.get_option_value(xml, 'name', str)
        self.copy_option(xml, 'storage', 'resource')
        self.copy_metadata(xml)
        self.copy_signed_identifiers(xml.find("attrs/attr[@name='acl']"))
예제 #5
0
파일: azure_file.py 프로젝트: NixOS/nixops
    def __init__(self, xml):
        StorageResourceDefinition.__init__(self, xml)

        self.file_name = self.get_option_value(xml, "name", str)

        self.copy_option(xml, "filePath", str)

        self.copy_option(xml, "share", "resource", optional=True)
        self.copy_option(xml, "directoryPath", str, optional=True)
        self.copy_option(xml, "directory", "resource", optional=True)
        if not (self.share or self.directory):
            raise Exception("{0}: must specify at least directory or share".format(self.file_name))
        if self.directory_path and not self.share:
            raise Exception("{0}: if you specify directoryPath, you must also specify share".format(self.file_name))
        if self.directory_path and self.directory:
            raise Exception("{0}: can't specify directory and directoryPath at once".format(self.file_name))

        self.copy_option(xml, "storage", "resource", optional=True)

        self.copy_option(xml, "contentEncoding", str, optional=True)
        self.copy_option(xml, "contentLanguage", str, optional=True)
        self.copy_option(xml, "contentType", str, optional=True)
        self.copy_option(xml, "contentLength", int, optional=True)
        self.copy_option(xml, "cacheControl", str, optional=True)
        self.copy_option(xml, "contentDisposition", str, optional=True)
        self.copy_metadata(xml)
예제 #6
0
    def __init__(self, xml):
        StorageResourceDefinition.__init__(self, xml)

        self.table_name = self.get_option_value(xml, 'name', str)
        if any(c == '-' for c in self.table_name):
            raise Exception("{0}: table name must not contain dashes".format(
                self.table_name))
        self.copy_option(xml, 'storage', 'resource')
        self.copy_signed_identifiers(xml.find("attrs/attr[@name='acl']"))
예제 #7
0
    def __init__(self, xml):
        StorageResourceDefinition.__init__(self, xml)

        self.table_name = self.get_option_value(xml, 'name', str)
        if any(c == '-' for c in self.table_name):
            raise Exception("{0}: table name must not contain dashes"
                            .format(self.table_name))
        self.copy_option(xml, 'storage', 'resource')
        self.copy_signed_identifiers(xml.find("attrs/attr[@name='acl']"))
예제 #8
0
    def __init__(self, xml):
        StorageResourceDefinition.__init__(self, xml)

        self.container_name = self.get_option_value(xml, 'name', str)
        if any(c.isupper() for c in self.container_name):
            raise Exception("{0}: BLOB container name must not contain uppercase letters"
                            .format(self.container_name))
        acl_xml = xml.find("attrs/attr[@name='acl']")
        self.copy_option(acl_xml, 'blobPublicAccess', str, optional = True)
        self.copy_signed_identifiers(acl_xml)
        self.copy_option(xml, 'storage', 'resource')
        self.copy_metadata(xml)
예제 #9
0
    def __init__(self, xml):
        StorageResourceDefinition.__init__(self, xml)

        self.container_name = self.get_option_value(xml, 'name', str)
        if any(c.isupper() for c in self.container_name):
            raise Exception(
                "{0}: BLOB container name must not contain uppercase letters".
                format(self.container_name))
        acl_xml = xml.find("attrs/attr[@name='acl']")
        self.copy_option(acl_xml, 'blobPublicAccess', str, optional=True)
        self.copy_signed_identifiers(acl_xml)
        self.copy_option(xml, 'storage', 'resource')
        self.copy_metadata(xml)
예제 #10
0
    def __init__(self, xml):
        StorageResourceDefinition.__init__(self, xml)

        self.directory_name = self.get_option_value(xml, 'name', str)

        self.copy_option(xml, 'parentDirectoryPath', str, optional = True)
        self.copy_option(xml, 'parentDirectory', 'resource', optional = True)
        self.copy_option(xml, 'share', 'resource', optional = True)
        self.copy_option(xml, 'storage', 'resource', optional = True)
        if not(self.share or self.parent_directory):
            raise Exception("{0}: must specify at least parentDirectory or share"
                            .format(self.directory_name))
        if self.parent_directory_path and not self.share:
            raise Exception("{0}: if you specify parentDirectoryPath, you must also specify share"
                            .format(self.directory_name))
        if self.parent_directory_path and self.parent_directory:
            raise Exception("{0}: can't specify parentDirectory and parentDirectoryPath at once"
                            .format(self.directory_name))
예제 #11
0
    def __init__(self, xml):
        StorageResourceDefinition.__init__(self, xml)

        self.directory_name = self.get_option_value(xml, 'name', str)

        self.copy_option(xml, 'parentDirectoryPath', str, optional=True)
        self.copy_option(xml, 'parentDirectory', 'resource', optional=True)
        self.copy_option(xml, 'share', 'resource', optional=True)
        self.copy_option(xml, 'storage', 'resource', optional=True)
        if not (self.share or self.parent_directory):
            raise Exception(
                "{0}: must specify at least parentDirectory or share".format(
                    self.directory_name))
        if self.parent_directory_path and not self.share:
            raise Exception(
                "{0}: if you specify parentDirectoryPath, you must also specify share"
                .format(self.directory_name))
        if self.parent_directory_path and self.parent_directory:
            raise Exception(
                "{0}: can't specify parentDirectory and parentDirectoryPath at once"
                .format(self.directory_name))
예제 #12
0
    def __init__(self, xml):
        StorageResourceDefinition.__init__(self, xml)

        self.share_name = self.get_option_value(xml, 'name', str)
        self.copy_option(xml, 'storage', 'resource')
        self.copy_metadata(xml)
예제 #13
0
    def __init__(self, xml):
        StorageResourceDefinition.__init__(self, xml)

        self.share_name = self.get_option_value(xml, 'name', str)
        self.copy_option(xml, 'storage', 'resource')
        self.copy_metadata(xml)