diff --git a/awx_collection/plugins/modules/export.py b/awx_collection/plugins/modules/export.py index 1080b4889bda..537a8e2fe95c 100644 --- a/awx_collection/plugins/modules/export.py +++ b/awx_collection/plugins/modules/export.py @@ -86,11 +86,6 @@ - workflow names, IDs, or named URLs to export type: list elements: str - applications: - description: - - OAuth2 application names, IDs, or named URLs to export - type: list - elements: str schedules: description: - schedule names, IDs, or named URLs to export diff --git a/awxkit/awxkit/api/pages/__init__.py b/awxkit/awxkit/api/pages/__init__.py index 7fbdbcdb0d95..0ede3ee2fe03 100644 --- a/awxkit/awxkit/api/pages/__init__.py +++ b/awxkit/awxkit/api/pages/__init__.py @@ -4,13 +4,11 @@ from .bulk import * # NOQA from .access_list import * # NOQA from .api import * # NOQA -from .authtoken import * # NOQA from .roles import * # NOQA from .organizations import * # NOQA from .notifications import * # NOQA from .notification_templates import * # NOQA from .users import * # NOQA -from .applications import * # NOQA from .teams import * # NOQA from .credentials import * # NOQA from .unified_jobs import * # NOQA diff --git a/awxkit/awxkit/api/pages/api.py b/awxkit/awxkit/api/pages/api.py index 2283f10c96ed..7c91e38e9645 100644 --- a/awxkit/awxkit/api/pages/api.py +++ b/awxkit/awxkit/api/pages/api.py @@ -25,7 +25,6 @@ 'job_templates', 'workflow_job_templates', 'execution_environments', - 'applications', 'schedules', ] diff --git a/awxkit/awxkit/api/pages/applications.py b/awxkit/awxkit/api/pages/applications.py deleted file mode 100644 index 3c9e4a8d766e..000000000000 --- a/awxkit/awxkit/api/pages/applications.py +++ /dev/null @@ -1,82 +0,0 @@ -from awxkit.utils import random_title, update_payload, filter_by_class, PseudoNamespace -from awxkit.api.resources import resources -from awxkit.api.pages import Organization -from awxkit.api.mixins import HasCreate, DSAdapter - -from . import page -from . import base - - -class OAuth2Application(HasCreate, base.Base): - dependencies = [Organization] - NATURAL_KEY = ('organization', 'name') - - def payload(self, **kwargs): - payload = PseudoNamespace( - name=kwargs.get('name') or 'OAuth2Application - {}'.format(random_title()), - description=kwargs.get('description') or random_title(10), - client_type=kwargs.get('client_type', 'public'), - authorization_grant_type=kwargs.get('authorization_grant_type', 'password'), - ) - if kwargs.get('organization'): - payload.organization = kwargs['organization'].id - - optional_fields = ('redirect_uris', 'skip_authorization') - update_payload(payload, optional_fields, kwargs) - return payload - - def create_payload(self, organization=Organization, **kwargs): - self.create_and_update_dependencies(*filter_by_class((organization, Organization))) - organization = self.ds.organization if organization else None - payload = self.payload(organization=organization, **kwargs) - payload.ds = DSAdapter(self.__class__.__name__, self._dependency_store) - return payload - - def create(self, organization=Organization, **kwargs): - payload = self.create_payload(organization=organization, **kwargs) - return self.update_identity(OAuth2Applications(self.connection).post(payload)) - - -page.register_page((resources.application, (resources.applications, 'post')), OAuth2Application) - - -class OAuth2Applications(page.PageList, OAuth2Application): - pass - - -page.register_page(resources.applications, OAuth2Applications) - - -class OAuth2AccessToken(HasCreate, base.Base): - optional_dependencies = [OAuth2Application] - - def payload(self, **kwargs): - payload = PseudoNamespace(description=kwargs.get('description') or random_title(10), scope=kwargs.get('scope', 'write')) - - if kwargs.get('oauth_2_application'): - payload.application = kwargs['oauth_2_application'].id - - optional_fields = ('expires',) - update_payload(payload, optional_fields, kwargs) - return payload - - def create_payload(self, oauth_2_application=None, **kwargs): - self.create_and_update_dependencies(*filter_by_class((oauth_2_application, OAuth2Application))) - oauth_2_application = self.ds.oauth_2_application if oauth_2_application else None - payload = self.payload(oauth_2_application=oauth_2_application, **kwargs) - payload.ds = DSAdapter(self.__class__.__name__, self._dependency_store) - return payload - - def create(self, oauth_2_application=None, **kwargs): - payload = self.create_payload(oauth_2_application=oauth_2_application, **kwargs) - return self.update_identity(OAuth2AccessTokens(self.connection).post(payload)) - - -page.register_page((resources.token, (resources.tokens, 'post')), OAuth2AccessToken) - - -class OAuth2AccessTokens(page.PageList, OAuth2AccessToken): - pass - - -page.register_page(resources.tokens, OAuth2AccessTokens) diff --git a/awxkit/awxkit/api/pages/authtoken.py b/awxkit/awxkit/api/pages/authtoken.py deleted file mode 100644 index 36ec0b954625..000000000000 --- a/awxkit/awxkit/api/pages/authtoken.py +++ /dev/null @@ -1,10 +0,0 @@ -from awxkit.api.resources import resources -from . import base -from . import page - - -class AuthToken(base.Base): - pass - - -page.register_page(resources.authtoken, AuthToken) diff --git a/awxkit/awxkit/api/resources.py b/awxkit/awxkit/api/resources.py index 57bf845f865c..9c872e6ab614 100644 --- a/awxkit/awxkit/api/resources.py +++ b/awxkit/awxkit/api/resources.py @@ -12,10 +12,7 @@ class Resources(object): _ad_hoc_related_cancel = r'ad_hoc_commands/\d+/cancel/' _ad_hoc_relaunch = r'ad_hoc_commands/\d+/relaunch/' _ansible_facts = r'hosts/\d+/ansible_facts/' - _application = r'applications/\d+/' - _applications = 'applications/' _auth = 'auth/' - _authtoken = 'authtoken/' _bulk = 'bulk/' _bulk_job_launch = 'bulk/job_launch/' _config = 'config/' @@ -233,8 +230,6 @@ class Resources(object): _team_permissions = r'teams/\d+/permissions/' _team_users = r'teams/\d+/users/' _teams = 'teams/' - _token = r'tokens/\d+/' - _tokens = 'tokens/' _unified_job_template = r'unified_job_templates/\d+/' _unified_job_templates = 'unified_job_templates/' _unified_jobs = 'unified_jobs/'