Creates a backup of the specified instance, giving it the specified
        name along with an optional description.
492081
def create_backup(self, instance, name, description=None):
        
        body = {"backup": {
                "instance": utils.get_id(instance),
                "name": name,
                }}
        if description is not None:
            body["backup"]["description"] = description
        uri = "/backups"
        resp, resp_body = self.api.method_post(uri, body=body)
        mgr = self.api._backup_manager
        return CloudDatabaseBackup(mgr, body.get("backup"))
67913
def create_snapshot(self, name=None, description=None, force=False):
        
        name = name or ""
        description = description or ""
        # Note that passing in non-None values is required for the _create_body
        # method to distinguish between this and the request to create and
        # instance.
        return self.manager.create_snapshot(volume=self, name=name,
                    description=description, force=force)
903762
def create_instance(self, credentials, name, **kwargs):
        """"""
        op_name = create_instance(
            credentials, self.project, self.zone, name,
            machine_type=self.machine_type,
            disk_size_gb=self.disk_size_gb,
            **kwargs)
        
        return op_name
1165505
def clone(self, source_id, backup_id, size,
              volume_id=None, source_host=None):
        
        volume_id = volume_id or str(uuid.uuid4())
        return self.http_put('/volumes/%s' % volume_id,
                             params=self.unused({
                                 'source_host': source_host,
                                 'source_volume_id': source_id,
                                 'backup_id': backup_id,
                                 'size': size
                             }))
675923
def copy(self, name=None, description=None, meta=None):
        
        cls = self.__class__
        kwargs = self._rel(copy=True)
        kwargs.update(self._data(copy=True))
        if name is not None:
            kwargs['name'] = name
        if description is not None:
            kwargs['description'] = description
        if meta is not None:
            kwargs['meta'] = meta
        return cls(**kwargs)
474875
def create_instance(self, name, moduleName, settings):
        
        if name in self.insts:
            raise ValueError("There's already an instance named %s" %
                             name)
        if moduleName not in self.modules:
            raise ValueError("There's no module %s" % moduleName)
        md = self.modules[moduleName]
        deps = dict()
        for k, v in six.iteritems(md.deps):
            if k not in settings:
                settings[k] = self._get_or_create_a(v.type)
            if settings[k] is None:
                if not v.allow_null:
                    raise ValueError("`null' not allowed for %s" % k)
            elif settings[k] not in self.insts:
                raise ValueError("No such instance %s" % settings[k])
            else:
                settings[k] = self.insts[settings[k]].object
                deps[k] = settings[k]
        for k, v in six.iteritems(md.vsettings):
            if k not in settings:
                settings[k] = v.default
                if v.default is None:
                    self.l.warn('%s:%s not set' % (name, k))
        self.l.info('create_instance %-15s %s' % (name, md.implementedBy))
        cl = get_by_path(md.implementedBy)
        il = logging.getLogger(name)
        obj = cl(settings, il)
        self.register_instance(name, moduleName, obj, settings, deps)
        return obj
1307710
public static void copyInstanceResources( Instance instance, Map<String,byte[]> fileNameToFileContent )
	throws IOException {

		File dir = InstanceHelpers.findInstanceDirectoryOnAgent( instance );
		Utils.createDirectory( dir );

		if( fileNameToFileContent != null ) {
			for( Map.Entry<String,byte[]> entry : fileNameToFileContent.entrySet()) {

				File f = new File( dir, entry.getKey());
				Utils.createDirectory( f.getParentFile());

				ByteArrayInputStream in = new ByteArrayInputStream( entry.getValue());
				Utils.copyStream( in, f );
			}
		}
	}
473534
def _list_backups_for_instance(self, instance, marker=0, limit=20):
        
        uri = "/%s/%s/backups?limit=%d&marker=%d" % (self.uri_base,
                                                     utils.get_id(instance),
                                                     int(limit),
                                                     int(marker))
        resp, resp_body = self.api.method_get(uri)
        mgr = self.api._backup_manager
        return [CloudDatabaseBackup(mgr, backup)
                for backup in resp_body.get("backups")]
84394
def create(cls, name, config=None, kind="spark"):
        
        conn = Qubole.agent()
        return conn.post(cls.rest_entity_path,
                         data={'name': name, 'config': config, 'kind': kind})
519591
public Backup backup( Database dest, String destName, String srcName ) throws jsqlite.Exception {
        synchronized (this) {
            Backup b = new Backup();
            _backup(b, dest, destName, this, srcName);
            return b;
        }
    }
1316967
def new(self, name, *args, **kwargs):
        '''
        '''
        if name in self._instance_map:
            raise ValueError('Instance {0} is already initialized'
                             .format(name))

        instance = self._class_map[name](*args, **kwargs)
        self._instance_map[name] = instance
        return instance
977811
def create(self, *args, **kwargs):
        
        try:
            return super(CloudBlockStorageManager, self).create(*args,
                    **kwargs)
        except exc.BadRequest as e:
            msg = e.message
            if "Clones currently must be >= original volume size" in msg:
                raise exc.VolumeCloneTooSmall(msg)
            else:
                raise
1319724
def create_snapshot(self, volume, name=None, description=None, force=False):
        
        return self._snapshot_manager.create(volume=volume, name=name,
                description=description, force=force)
159130
def _save_new_backup(self, database):
        
        self.logger.info("Backing Up Database: %s", database['NAME'])
        # Get backup and name
        filename = self.connector.generate_filename(self.servername)
        outputfile = self.connector.create_dump()
        # Apply trans
        if self.compress:
            compressed_file, filename = utils.compress_file(outputfile, filename)
            outputfile = compressed_file
        if self.encrypt:
            encrypted_file, filename = utils.encrypt_file(outputfile, filename)
            outputfile = encrypted_file
        # Set file name
        filename = self.filename if self.filename else filename
        self.logger.debug("Backup size: %s", utils.handle_size(outputfile))
        # Store backup
        outputfile.seek(0)
        if self.path is None:
            self.write_to_storage(outputfile, filename)
        else:
            self.write_local_file(outputfile, self.path)
484948
def create(self, volume_id, backup_id=None, timestamp=None):
        
        backup_id = backup_id or str(uuid.uuid4())
        timestamp = timestamp or int(time())
        return self.http_put('/volumes/%s/backups/%s' % (volume_id, backup_id),
                             params={'timestamp': timestamp})
992182
def backup_file(filename, backup_ext):
    '''
    
    '''
    ext = backup_ext.strip(" .")
    if ext:
        backup_filename = ".".join([filename, ext])
        if not exists(backup_filename):
            shutil.copyfile(filename, backup_filename)
        else:
            if not filecmp.cmp(filename, backup_filename):
                raise DietException('Cannot make backup because a different'
                                    'file with that name already exists.')
        return backup_filename
    return None
802275
public function buildBackup(
		BackupEngineInterface $backupEngine,
		BackupFilesystemInterface $backupFilesystem,
		array $options = []
	) {
		return new Backup($backupEngine, $backupFilesystem, $options);
	}