def _create_a_cache_in_an_environment( username, password, mfa_secret, token, zonename, org, profile, name, environment, body, **kwargs ): return ( Caches(gen_auth(username, password, mfa_secret, token, zonename), org, name) .create_a_cache_in_an_environment(environment, body) .text )
def _get_information_about_a_cache( username, password, mfa_secret, token, zonename, org, profile, name, environment, **kwargs ): return ( Caches(gen_auth(username, password, mfa_secret, token, zonename), org, name) .get_information_about_a_cache(environment) .text )
def _clear_all_cache_entries( username, password, mfa_secret, token, zonename, org, profile, name, environment, **kwargs ): return ( Caches(gen_auth(username, password, mfa_secret, token, zonename), org, name) .clear_all_cache_entries(environment) .text )
def _delete_a_cache( username, password, mfa_secret, token, zonename, org, profile, name, environment, **kwargs ): return ( Caches(gen_auth(username, password, mfa_secret, token, zonename), org, name) .delete_a_cache(environment) .text )
def _func(cache): cache_file = str(Path(self._caches_dir) / cache) if not force: path_exists(os.path.relpath(cache_file)) resp = (Caches( self._auth, self._org_name, cache).get_information_about_a_cache(environment).text) console.echo(resp, expc_verbosity=1) with open(cache_file, 'w') as f: f.write(resp)
def download_caches_snapshot(self): for environment in self.environments: self.snapshot_data.caches[environment] = Caches( self.auth, self.org_name, None ).list_caches_in_an_environment(environment, prefix=self.prefix, format='dict') write_file( self.snapshot_data.caches[environment], Backups.generate_download_path( self.org_path, is_snapshot=True, subpaths=['caches', environment, 'caches.json'] ), fs_write=self.fs_write, indent=2, )
def _list_caches_in_an_environment( username, password, mfa_secret, token, zonename, org, profile, environment, prefix=None, **kwargs ): return Caches( gen_auth(username, password, mfa_secret, token, zonename), org, None ).list_caches_in_an_environment(environment, prefix=prefix)
def download_caches(self): for environment in self.environments: for cache in self.snapshot_data.caches[environment]: try: write_file( Caches(self.auth, self.org_name, cache) .get_information_about_a_cache(environment) .text, Backups.generate_download_path( self.org_path, subpaths=['caches', environment, f'{cache}.json'] ), fs_write=self.fs_write, ) except HTTPError as e: Backups.log_error(e, append_msg=' for Cache ({cache})') self._Backups__progress_callback(desc='Caches')
def download_caches(self): for environment in self.environments: for cache in self.snapshot_data.caches[environment]: try: write_file( Caches(self.auth, self.org_name, cache) .get_information_about_a_cache(environment) .text, self._gen_download_path(subpaths=['caches', environment, f'{cache}.json']), fs_write=self.fs_write, ) except HTTPError as e: console.echo( f'Ignoring {type(e).__name__} {e.response.status_code} error for Cache ({cache})' ) self._progress_callback(desc='Caches') return self.snapshot_data.caches
def download_caches_snapshot(self): for environment in self.environments: try: self.snapshot_data.caches[environment] = Caches( self.auth, self.org_name, None ).list_caches_in_an_environment(environment, prefix=self.prefix, format='dict') except HTTPError: self.snapshot_data.caches[environment] = [] write_file( self.snapshot_data.caches[environment], self._gen_download_path( is_snapshot=True, subpaths=['caches', environment, 'caches.json'] ), fs_write=self.fs_write, indent=2, ) return self.snapshot_data.caches
def download_caches_snapshot(self): for environment in self.environments: try: self.snapshot_data.caches[environment] = Caches( self.auth, self.org_name, None ).list_caches_in_an_environment(environment, prefix=self.prefix, format='dict') except HTTPError: self.snapshot_data.caches[environment] = [] data = { 'snapshot': self.snapshot_data.caches[environment], 'target_path': self._gen_snapshot_path( subpaths=['caches', environment, 'caches.json'] ), 'fs_write': self.fs_write, 'indent': 2, } write_file( data['snapshot'], data['target_path'], fs_write=data['fs_write'], indent=data['indent'], ) return self.snapshot_data.caches
def _push_cache( username, password, mfa_secret, token, zonename, org, profile, environment, file, **kwargs ): return Caches(gen_auth(username, password, mfa_secret, token, zonename), org, None).push_cache( environment, file )