コード例 #1
0
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
    )
コード例 #2
0
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
    )
コード例 #3
0
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
    )
コード例 #4
0
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
    )
コード例 #5
0
 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)
コード例 #6
0
ファイル: backups.py プロジェクト: darumatic/apigee-cli
 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,
         )
コード例 #7
0
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)
コード例 #8
0
ファイル: backups.py プロジェクト: darumatic/apigee-cli
 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')
コード例 #9
0
 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
コード例 #10
0
 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
コード例 #11
0
 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
コード例 #12
0
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
    )