예제 #1
0
def _create_a_consumer_key_and_secret(username,
                                      password,
                                      mfa_secret,
                                      token,
                                      zonename,
                                      org,
                                      profile,
                                      name,
                                      developer,
                                      consumer_key=None,
                                      consumer_secret=None,
                                      key_length=32,
                                      secret_length=32,
                                      key_suffix=None,
                                      key_delimiter='-',
                                      products=[],
                                      **kwargs):
    return (Apps(gen_auth(username, password, mfa_secret, token, zonename),
                 org, name).create_a_consumer_key_and_secret(
                     developer,
                     consumer_key=consumer_key,
                     consumer_secret=consumer_secret,
                     key_length=key_length,
                     secret_length=secret_length,
                     key_suffix=key_suffix,
                     key_delimiter=key_delimiter,
                     products=products,
                 ).text)
예제 #2
0
 def download_apps(self):
     for developer, apps in self.snapshot_data.apps.items():
         for app in apps:
             try:
                 write_file(
                     Apps(self.auth, self.org_name, app)
                     .get_developer_app_details(developer)
                     .text,
                     Backups.generate_download_path(
                         self.org_path, subpaths=['apps', developer, f'{app}.json']
                     ),
                     fs_write=self.fs_write,
                 )
             except HTTPError as e:
                 Backups.log_error(e, append_msg=' for Developer App ({app})')
             self._Backups__progress_callback(desc='Developer Apps')
예제 #3
0
 def download_apps(self):
     for developer, apps in self.snapshot_data.apps.items():
         for app in apps:
             try:
                 write_file(
                     Apps(self.auth, self.org_name, app)
                     .get_developer_app_details(developer)
                     .text,
                     self._gen_download_path(subpaths=['apps', developer, f'{app}.json']),
                     fs_write=self.fs_write,
                 )
             except HTTPError as e:
                 console.echo(
                     f'Ignoring {type(e).__name__} {e.response.status_code} error for Developer App ({app})'
                 )
             self._progress_callback(desc='Developer Apps')
     return self.snapshot_data.apps
예제 #4
0
 def download_apps_snapshot(self, expand=False, count=1000, startkey=""):
     self.snapshot_data.apps = Apps(self.auth, self.org_name, None).list_apps_for_all_developers(
         Developers(self.auth, self.org_name, None).list_developers(
             prefix=None, expand=expand, count=count, startkey=startkey, format='dict'
         ),
         prefix=self.prefix,
         format='dict',
     )
     self.snapshot_data.apps = {k: v for k, v in self.snapshot_data.apps.items() if v}
     for app, details in self.snapshot_data.apps.items():
         write_file(
             details,
             self._gen_download_path(is_snapshot=True, subpaths=['apps', f'{app}.json']),
             fs_write=self.fs_write,
             indent=2,
         )
     return self.snapshot_data.apps
예제 #5
0
def _create_empty_developer_app(username,
                                password,
                                mfa_secret,
                                token,
                                zonename,
                                org,
                                profile,
                                name,
                                developer,
                                display_name="",
                                callback_url="",
                                **kwargs):
    return (Apps(gen_auth(username, password, mfa_secret, token, zonename),
                 org, name).create_empty_developer_app(
                     developer,
                     display_name=display_name,
                     callback_url=callback_url).text)
예제 #6
0
def _list_developer_apps(username,
                         password,
                         mfa_secret,
                         token,
                         zonename,
                         org,
                         profile,
                         developer,
                         prefix=None,
                         expand=False,
                         count=1000,
                         startkey="",
                         **kwargs):
    return Apps(gen_auth(username, password, mfa_secret, token, zonename), org,
                None).list_developer_apps(developer,
                                          prefix=prefix,
                                          expand=expand,
                                          count=count,
                                          startkey=startkey)
예제 #7
0
 def download_apps_snapshot(self, expand=False, count=1000, startkey=""):
     self.snapshot_data.apps = Apps(self.auth, self.org_name, None).list_apps_for_all_developers(
         Developers(self.auth, self.org_name, None).list_developers(
             prefix=None, expand=expand, count=count, startkey=startkey, format='dict'
         ),
         prefix=self.prefix,
         format='dict',
     )
     self.snapshot_data.apps = {k: v for k, v in self.snapshot_data.apps.items() if v}
     for app, details in self.snapshot_data.apps.items():
         data = {
             'snapshot': details,
             'target_path': self._gen_snapshot_path(subpaths=['apps', f'{app}.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.apps
예제 #8
0
def _get_developer_app_details(username, password, mfa_secret, token, zonename,
                               org, profile, name, developer, **kwargs):
    return (Apps(gen_auth(username, password, mfa_secret, token, zonename),
                 org, name).get_developer_app_details(developer).text)
예제 #9
0
def _delete_developer_app(username, password, mfa_secret, token, zonename, org,
                          profile, name, developer, **kwargs):
    return (Apps(gen_auth(username, password, mfa_secret, token, zonename),
                 org, name).delete_developer_app(developer).text)
예제 #10
0
def _restore_app(username, password, mfa_secret, token, zonename, org, profile,
                 file, **kwargs):
    return (Apps(gen_auth(username, password, mfa_secret, token, zonename),
                 org, None).restore_app(file).text)
예제 #11
0
def _create_developer_app(username, password, mfa_secret, token, zonename, org,
                          profile, name, developer, body, **kwargs):
    return (Apps(gen_auth(username, password, mfa_secret, token, zonename),
                 org, None).create_developer_app(developer, body).text)