diff --git a/src/deadline/client/api/__init__.py b/src/deadline/client/api/__init__.py
index 3da55f67..8ba9ff6b 100644
--- a/src/deadline/client/api/__init__.py
+++ b/src/deadline/client/api/__init__.py
@@ -7,12 +7,12 @@
"wait_for_create_job_to_complete",
"get_boto3_session",
"get_boto3_client",
- "AwsCredentialsStatus",
- "AwsCredentialsType",
+ "AwsAuthenticationStatus",
+ "AwsCredentialsSource",
"TelemetryClient",
- "check_credentials_status",
+ "check_authentication_status",
"check_deadline_api_available",
- "get_credentials_type",
+ "get_credentials_source",
"list_farms",
"list_queues",
"list_jobs",
@@ -34,13 +34,13 @@
from ._loginout import login, logout
from ._session import (
- AwsCredentialsStatus,
- AwsCredentialsType,
+ AwsAuthenticationStatus,
+ AwsCredentialsSource,
get_queue_user_boto3_session,
- check_credentials_status,
+ check_authentication_status,
get_boto3_client,
get_boto3_session,
- get_credentials_type,
+ get_credentials_source,
get_studio_id,
get_user_and_identity_store_id,
)
diff --git a/src/deadline/client/api/_loginout.py b/src/deadline/client/api/_loginout.py
index 2fe2cb9b..7db360dd 100644
--- a/src/deadline/client/api/_loginout.py
+++ b/src/deadline/client/api/_loginout.py
@@ -14,10 +14,10 @@
from ._session import (
invalidate_boto3_session_cache,
- get_credentials_type,
- check_credentials_status,
- AwsCredentialsType,
- AwsCredentialsStatus,
+ get_credentials_source,
+ check_authentication_status,
+ AwsCredentialsSource,
+ AwsAuthenticationStatus,
)
from ..config import get_setting
from ..exceptions import DeadlineOperationError
@@ -57,12 +57,14 @@ def _login_deadline_cloud_monitor(
f"Could not find Deadline Cloud Monitor at {deadline_cloud_monitor_path}. Please ensure Deadline Cloud Monitor is installed correctly and setup the {profile_name} profile again."
)
if on_pending_authorization:
- on_pending_authorization(credential_type=AwsCredentialsType.DEADLINE_CLOUD_MONITOR_LOGIN)
+ on_pending_authorization(
+ credentials_source=AwsCredentialsSource.DEADLINE_CLOUD_MONITOR_LOGIN
+ )
# And wait for the user to complete login
while True:
# Deadline Cloud Monitor is a GUI app that will keep on running
# So we sit here and test that profile for validity until it works
- if check_credentials_status(config) == AwsCredentialsStatus.AUTHENTICATED:
+ if check_authentication_status(config) == AwsAuthenticationStatus.AUTHENTICATED:
return f"Deadline Cloud Monitor Profile: {profile_name}"
if on_cancellation_check:
# Check if the UI has signaled a cancel
@@ -92,14 +94,14 @@ def login(
Args:
on_pending_authorization (Callable): A callback that receives method-specific information to continue login.
- All methods: 'credential_type' parameter of type AwsCredentialsType
+ All methods: 'credentials_source' parameter of type AwsCredentialsSource
For Deadline Cloud Monitor: No additional parameters
on_cancellation_check (Callable): A callback that allows the operation to cancel before login completes
config (ConfigParser, optional): The Amazon Deadline Cloud configuration
object to use instead of the config file.
"""
- credentials_type = get_credentials_type(config)
- if credentials_type == AwsCredentialsType.DEADLINE_CLOUD_MONITOR_LOGIN:
+ credentials_source = get_credentials_source(config)
+ if credentials_source == AwsCredentialsSource.DEADLINE_CLOUD_MONITOR_LOGIN:
return _login_deadline_cloud_monitor(
on_pending_authorization, on_cancellation_check, config
)
@@ -116,8 +118,8 @@ def logout(config: Optional[ConfigParser] = None) -> str:
config (ConfigParser, optional): The Amazon Deadline Cloud configuration
object to use instead of the config file.
"""
- credentials_type = get_credentials_type(config)
- if credentials_type == AwsCredentialsType.DEADLINE_CLOUD_MONITOR_LOGIN:
+ credentials_source = get_credentials_source(config)
+ if credentials_source == AwsCredentialsSource.DEADLINE_CLOUD_MONITOR_LOGIN:
# Deadline Cloud Monitor writes the absolute path to itself to the config file
deadline_cloud_monitor_path = get_setting("deadline-cloud-monitor.path", config=config)
profile_name = get_setting("defaults.aws_profile_name", config=config)
diff --git a/src/deadline/client/api/_session.py b/src/deadline/client/api/_session.py
index 6850560f..a06f5f9c 100644
--- a/src/deadline/client/api/_session.py
+++ b/src/deadline/client/api/_session.py
@@ -33,13 +33,13 @@
__cached_queue_id_for_queue_session = None
-class AwsCredentialsType(Enum):
+class AwsCredentialsSource(Enum):
NOT_VALID = 0
HOST_PROVIDED = 2
DEADLINE_CLOUD_MONITOR_LOGIN = 3
-class AwsCredentialsStatus(Enum):
+class AwsAuthenticationStatus(Enum):
CONFIGURATION_ERROR = 1
AUTHENTICATED = 2
NEEDS_LOGIN = 3
@@ -131,7 +131,7 @@ def get_boto3_client(service_name: str, config: Optional[ConfigParser] = None) -
return session.client(service_name)
-def get_credentials_type(config: Optional[ConfigParser] = None) -> AwsCredentialsType:
+def get_credentials_source(config: Optional[ConfigParser] = None) -> AwsCredentialsSource:
"""
Returns DEADLINE_CLOUD_MONITOR_LOGIN if Deadline Cloud Monitor wrote the credentials, HOST_PROVIDED otherwise.
@@ -143,12 +143,12 @@ def get_credentials_type(config: Optional[ConfigParser] = None) -> AwsCredential
session = get_boto3_session(config=config)
profile_config = session._session.get_scoped_config()
except ProfileNotFound:
- return AwsCredentialsType.NOT_VALID
+ return AwsCredentialsSource.NOT_VALID
if "studio_id" in profile_config or "monitor_id" in profile_config:
# Deadline Cloud Monitor Desktop adds some Deadline Cloud-specific keys here which we can use to know that this came from the app
- return AwsCredentialsType.DEADLINE_CLOUD_MONITOR_LOGIN
+ return AwsCredentialsSource.DEADLINE_CLOUD_MONITOR_LOGIN
else:
- return AwsCredentialsType.HOST_PROVIDED
+ return AwsCredentialsSource.HOST_PROVIDED
def get_user_and_identity_store_id(
@@ -283,7 +283,7 @@ def _modified_logging_level(logger, level):
logger.setLevel(old_level)
-def check_credentials_status(config: Optional[ConfigParser] = None) -> AwsCredentialsStatus:
+def check_authentication_status(config: Optional[ConfigParser] = None) -> AwsAuthenticationStatus:
"""
Checks the status of the provided session, by
calling the sts::GetCallerIdentity API.
@@ -292,7 +292,7 @@ def check_credentials_status(config: Optional[ConfigParser] = None) -> AwsCreden
config (ConfigParser, optional): The Amazon Deadline Cloud configuration
object to use instead of the config file.
- Returns AwsCredentialsStatus enum value:
+ Returns AwsAuthenticationStatus enum value:
- CONFIGURATION_ERROR if there is an unexpected error accessing credentials
- AUTHENTICATED if they are fine
- NEEDS_LOGIN if a Deadline Cloud Monitor login is required.
@@ -301,14 +301,14 @@ def check_credentials_status(config: Optional[ConfigParser] = None) -> AwsCreden
with _modified_logging_level(logging.getLogger("botocore.credentials"), logging.ERROR):
try:
get_boto3_session(config=config).client("sts").get_caller_identity()
- return AwsCredentialsStatus.AUTHENTICATED
+ return AwsAuthenticationStatus.AUTHENTICATED
except Exception:
# We assume that the presence of a Deadline Cloud Monitor profile
# means we will know everything necessary to start it and login.
- if get_credentials_type(config) == AwsCredentialsType.DEADLINE_CLOUD_MONITOR_LOGIN:
- return AwsCredentialsStatus.NEEDS_LOGIN
- return AwsCredentialsStatus.CONFIGURATION_ERROR
+ if get_credentials_source(config) == AwsCredentialsSource.DEADLINE_CLOUD_MONITOR_LOGIN:
+ return AwsAuthenticationStatus.NEEDS_LOGIN
+ return AwsAuthenticationStatus.CONFIGURATION_ERROR
class DeadlineClient:
diff --git a/src/deadline/client/cli/_deadline_cli.py b/src/deadline/client/cli/_deadline_cli.py
index 7a72797c..eafb1099 100644
--- a/src/deadline/client/cli/_deadline_cli.py
+++ b/src/deadline/client/cli/_deadline_cli.py
@@ -14,7 +14,7 @@
from ._common import _PROMPT_WHEN_COMPLETE
from ._groups.bundle_group import cli_bundle
from ._groups.config_group import cli_config
-from ._groups.creds_group import cli_creds
+from ._groups.auth_group import cli_auth
from ._groups.farm_group import cli_farm
from ._groups.fleet_group import cli_fleet
from ._groups.handle_web_url_command import cli_handle_web_url
@@ -69,7 +69,7 @@ def main(ctx: click.Context, log_level: str):
main.add_command(cli_bundle)
main.add_command(cli_config)
-main.add_command(cli_creds)
+main.add_command(cli_auth)
main.add_command(cli_farm)
main.add_command(cli_fleet)
main.add_command(cli_handle_web_url)
diff --git a/src/deadline/client/cli/_groups/creds_group.py b/src/deadline/client/cli/_groups/auth_group.py
similarity index 68%
rename from src/deadline/client/cli/_groups/creds_group.py
rename to src/deadline/client/cli/_groups/auth_group.py
index 6ef0774d..8c9bd63d 100644
--- a/src/deadline/client/cli/_groups/creds_group.py
+++ b/src/deadline/client/cli/_groups/auth_group.py
@@ -1,7 +1,7 @@
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
"""
-All the `deadline creds` commands:
+All the `deadline auth` commands:
* login
* logout
* status
@@ -11,14 +11,14 @@
import logging
from ... import api
-from ...api._session import _modified_logging_level, AwsCredentialsType
+from ...api._session import _modified_logging_level, AwsCredentialsSource
from ...config import config_file, get_setting
from .._common import _apply_cli_options_to_config, _handle_error
JSON_FIELD_PROFILE_NAME = "profile_name"
-JSON_FIELD_CRED_STATUS = "status"
-JSON_FIELD_CRED_TYPE = "type"
-JSON_FIELD_CRED_API_AVAILABLE = "api_availability"
+JSON_FIELD_AUTH_STATUS = "status"
+JSON_FIELD_CREDS_SOURCE = "source"
+JSON_FIELD_AUTH_API_AVAILABLE = "api_availability"
def _cli_on_pending_authorization(**kwargs):
@@ -26,21 +26,21 @@ def _cli_on_pending_authorization(**kwargs):
Callback for `login`, to tell the user that Deadline Cloud Monitor is opening
"""
- if kwargs["credential_type"] == AwsCredentialsType.DEADLINE_CLOUD_MONITOR_LOGIN:
+ if kwargs["credentials_source"] == AwsCredentialsSource.DEADLINE_CLOUD_MONITOR_LOGIN:
click.echo("Opening Deadline Cloud Monitor. Please login and then return here.")
-@click.group(name="creds")
+@click.group(name="auth")
@_handle_error
-def cli_creds():
+def cli_auth():
"""
- Commands to work with Amazon Deadline Cloud credentials.
+ Commands to handle Amazon Deadline Cloud authentication.
"""
-@cli_creds.command(name="login")
+@cli_auth.command(name="login")
@_handle_error
-def creds_login():
+def auth_login():
"""
Logs in to the Amazon Deadline Cloud configured AWS profile.
@@ -58,9 +58,9 @@ def creds_login():
click.echo(f"\nSuccessfully logged in: {message}\n")
-@cli_creds.command(name="logout")
+@cli_auth.command(name="logout")
@_handle_error
-def creds_logout():
+def auth_logout():
"""
Logs out of the Deadline Cloud Monitor configured AWS profile.
"""
@@ -69,7 +69,7 @@ def creds_logout():
click.echo("Successfully logged out of all Deadline Cloud Monitor AWS profiles")
-@cli_creds.command(name="status")
+@cli_auth.command(name="status")
@click.option("--profile", help="The AWS profile to use.")
@click.option(
"--output",
@@ -84,21 +84,21 @@ def creds_logout():
"parsed/consumed by custom scripts.",
)
@_handle_error
-def creds_status(output, **args):
- """EXPERIMENTAL - Gets the status of the credentials for the given AWS profile"""
+def auth_status(output, **args):
+ """EXPERIMENTAL - Gets the authentication status for the given AWS profile"""
# Get a temporary config object with the standard options handled
config = _apply_cli_options_to_config(**args)
profile_name = get_setting("defaults.aws_profile_name", config=config)
is_json_format = True if output == "json" else False
with _modified_logging_level(logging.getLogger("deadline.client.api"), logging.CRITICAL):
- # always returns enum in AwsCredentialsType
- creds_type = api.get_credentials_type(config=config)
- creds_type_result = creds_type.name
+ # always returns enum in AwsCredentialsSource
+ creds_source = api.get_credentials_source(config=config)
+ creds_source_result = creds_source.name
- # always returns enum in AwsCredentialsStatus
- creds_status = api.check_credentials_status(config=config)
- creds_status_results = creds_status.name
+ # always returns enum in AwsAuthenticationStatus
+ auth_status = api.check_authentication_status(config=config)
+ auth_status_results = auth_status.name
# always returns True/False
api_availability_result = api.check_deadline_api_available(config=config)
@@ -106,14 +106,14 @@ def creds_status(output, **args):
if not is_json_format:
width = 17
click.echo(f"{'Profile Name:': >{width}} {profile_name}")
- click.echo(f"{'Type:': >{width}} {creds_type_result}")
- click.echo(f"{'Status:': >{width}} {creds_status_results}")
+ click.echo(f"{'Source:': >{width}} {creds_source_result}")
+ click.echo(f"{'Status:': >{width}} {auth_status_results}")
click.echo(f"{'API Availability:': >{width}} {api_availability_result}")
else:
json_output = {
JSON_FIELD_PROFILE_NAME: profile_name,
- JSON_FIELD_CRED_TYPE: creds_type_result,
- JSON_FIELD_CRED_STATUS: creds_status_results,
- JSON_FIELD_CRED_API_AVAILABLE: api_availability_result,
+ JSON_FIELD_CREDS_SOURCE: creds_source_result,
+ JSON_FIELD_AUTH_STATUS: auth_status_results,
+ JSON_FIELD_AUTH_API_AVAILABLE: api_availability_result,
}
click.echo(json.dumps(json_output, ensure_ascii=True))
diff --git a/src/deadline/client/ui/deadline_credentials_status.py b/src/deadline/client/ui/deadline_authentication_status.py
similarity index 71%
rename from src/deadline/client/ui/deadline_credentials_status.py
rename to src/deadline/client/ui/deadline_authentication_status.py
index 889394af..d794c0c1 100644
--- a/src/deadline/client/ui/deadline_credentials_status.py
+++ b/src/deadline/client/ui/deadline_authentication_status.py
@@ -2,13 +2,13 @@
"""
Provides an object that can be used to track current status of Amazon Deadline Cloud
-credentials.
+authentication.
The object emits the following Qt Signals:
aws_creds_changed: The AWS credentials in ~/.aws changed.
deadline_config_changed: The Amazon Deadline Cloud configuration in ~/.deadline changed.
- creds_type_changed: triggered when credential type changes
- creds_status_changed: triggered when credential status changes
+ creds_source_changed: triggered when credential source changes
+ auth_status_changed: triggered when authentication status changes
api_availability_changed: triggered when api availability changes
The status includes three parts:
@@ -33,16 +33,16 @@
logger = getLogger(__name__)
-_deadline_credential_status = None
+_deadline_authentication_status = None
-class DeadlineCredentialsStatus(QObject):
+class DeadlineAuthenticationStatus(QObject):
"""
Holds status information about Amazon Deadline Cloud credentials.
Currently status values are available as properties:
- status.creds_type: result of api.get_credentials_type()
- status.creds_status: result of api.check_credentials_status()
+ status.creds_source: result of api.get_credentials_source()
+ status.auth_status: result of api.check_authentication_status()
status.api_availability: result of api.check_deadline_api_available()
To initialize the status of a non-default Amazon Deadline Cloud configuration, pass in
@@ -54,25 +54,25 @@ class DeadlineCredentialsStatus(QObject):
# This signal is sent when the Amazon Deadline Cloud configuration changes
deadline_config_changed = Signal()
- # This signal is sent when an AWS credential type changes
- creds_type_changed = Signal()
- # This signal is sent when an AWS credential status changes
- creds_status_changed = Signal()
+ # This signal is sent when an AWS authentication type changes
+ creds_source_changed = Signal()
+ # This signal is sent when an AWS authentication status changes
+ auth_status_changed = Signal()
# This signal is sent when AWS Deadline Cloud API availability changes
api_availability_changed = Signal()
@staticmethod
def getInstance():
- global _deadline_credential_status
- if _deadline_credential_status is None:
- _deadline_credential_status = DeadlineCredentialsStatus()
- return _deadline_credential_status
+ global _deadline_authentication_status
+ if _deadline_authentication_status is None:
+ _deadline_authentication_status = DeadlineAuthenticationStatus()
+ return _deadline_authentication_status
def __init__(self, parent=None) -> None:
- super(DeadlineCredentialsStatus, self).__init__(parent)
+ super(DeadlineAuthenticationStatus, self).__init__(parent)
- self.__creds_type: Optional[api.AwsCredentialsType] = None
- self.__creds_status: Optional[api.AwsCredentialsStatus] = None
+ self.__creds_source: Optional[api.AwsCredentialsSource] = None
+ self.__auth_status: Optional[api.AwsAuthenticationStatus] = None
self.__api_availability: Optional[bool] = None
# Load the default config
@@ -104,25 +104,25 @@ def __init__(self, parent=None) -> None:
def set_config(self, config: Optional[ConfigParser]) -> None:
"""
- Changes the Amazon Deadline Cloud configuration object used to display credentials
+ Changes the Amazon Deadline Cloud configuration object used to display authentication
status.
Args:
config (ConfigParser): The Amazon Deadline Cloud configuration to use.
"""
- # Refresh the status if any setting that impacts credentials was changed
+ # Refresh the status if any setting that impacts authentication was changed
if self.config:
- creds_config_changed = False
+ auth_config_changed = False
for setting_name in [
"defaults.aws_profile_name",
]:
if config_file.get_setting(setting_name, self.config) != config_file.get_setting(
setting_name, config
):
- creds_config_changed = True
+ auth_config_changed = True
else:
- creds_config_changed = True
+ auth_config_changed = True
# Make a copy of the config object
self.config = ConfigParser()
@@ -131,16 +131,16 @@ def set_config(self, config: Optional[ConfigParser]) -> None:
else:
self.config.read_dict(config_file.read_config())
- if creds_config_changed:
+ if auth_config_changed:
self.refresh_status()
@property
- def creds_type(self) -> Optional[api.AwsCredentialsType]:
- return self.__creds_type
+ def creds_source(self) -> Optional[api.AwsCredentialsSource]:
+ return self.__creds_source
@property
- def creds_status(self) -> Optional[api.AwsCredentialsStatus]:
- return self.__creds_status
+ def auth_status(self) -> Optional[api.AwsAuthenticationStatus]:
+ return self.__auth_status
@property
def api_availability(self) -> Optional[bool]:
@@ -150,14 +150,14 @@ def files_changed(self, changed_path) -> None:
# Force the cached boto3 session to refresh, since we don't check the creds
# file
if changed_path in self.aws_creds_paths:
- logger.info(f"Path {changed_path} changed, refreshing credential status")
+ logger.info(f"Path {changed_path} changed, refreshing authentication status")
# Send it to another thread to avoid blocking the Qt event loop
self.session_thread = threading.Thread(
target=self._get_session, kwargs={"changed_path": changed_path}
)
self.session_thread.start()
else:
- logger.info(f"Path {changed_path} changed, does not affect credential status")
+ logger.info(f"Path {changed_path} changed, does not affect authentication status")
def _get_session(self, changed_path):
api.get_boto3_session(force_refresh=True)
@@ -168,21 +168,21 @@ def _get_session(self, changed_path):
elif changed_path in self.deadline_config_paths:
self.deadline_config_changed.emit()
- def _refresh_creds_type(self) -> None:
- self.__creds_type = None
- self.creds_type_changed.emit()
- self.__creds_type = api.get_credentials_type(config=self.config)
- self.creds_type_changed.emit()
+ def _refresh_creds_source(self) -> None:
+ self.__creds_source = None
+ self.creds_source_changed.emit()
+ self.__creds_source = api.get_credentials_source(config=self.config)
+ self.creds_source_changed.emit()
- def _refresh_creds_status(self) -> None:
- self.__creds_status = None
- self.creds_status_changed.emit()
+ def _refresh_auth_status(self) -> None:
+ self.__auth_status = None
+ self.auth_status_changed.emit()
try:
- self.__creds_status = api.check_credentials_status(config=self.config)
+ self.__auth_status = api.check_authentication_status(config=self.config)
except BaseException as e:
logger.exception(e)
- self.__creds_status = api.AwsCredentialsStatus.CONFIGURATION_ERROR
- self.creds_status_changed.emit()
+ self.__auth_status = api.AwsAuthenticationStatus.CONFIGURATION_ERROR
+ self.auth_status_changed.emit()
def _refresh_api_availability(self) -> None:
self.__api_availability = None
@@ -198,9 +198,9 @@ def refresh_status(self) -> None:
"""
Initiates an asynchronous status refresh.
"""
- self.__creds_type_thread = threading.Thread(target=self._refresh_creds_type)
- self.__creds_type_thread.start()
- self.__creds_status_thread = threading.Thread(target=self._refresh_creds_status)
- self.__creds_status_thread.start()
+ self.__creds_source_thread = threading.Thread(target=self._refresh_creds_source)
+ self.__creds_source_thread.start()
+ self.__auth_status_thread = threading.Thread(target=self._refresh_auth_status)
+ self.__auth_status_thread.start()
self.__api_availability_thread = threading.Thread(target=self._refresh_api_availability)
self.__api_availability_thread.start()
diff --git a/src/deadline/client/ui/dialogs/deadline_config_dialog.py b/src/deadline/client/ui/dialogs/deadline_config_dialog.py
index d1b6bacd..0984b8d5 100644
--- a/src/deadline/client/ui/dialogs/deadline_config_dialog.py
+++ b/src/deadline/client/ui/dialogs/deadline_config_dialog.py
@@ -40,11 +40,11 @@
)
from ... import api
-from ..deadline_credentials_status import DeadlineCredentialsStatus
+from ..deadline_authentication_status import DeadlineAuthenticationStatus
from ...config import config_file, get_setting_default, str2bool
from .. import CancelationFlag, block_signals
from ..widgets import DirectoryPickerWidget
-from ..widgets.deadline_credentials_status_widget import DeadlineCredentialsStatusWidget
+from ..widgets.deadline_authentication_status_widget import DeadlineAuthenticationStatusWidget
from .deadline_login_dialog import DeadlineLoginDialog
logger = getLogger(__name__)
@@ -78,7 +78,7 @@ def __init__(self, parent=None) -> None:
)
self.setWindowTitle("Amazon Deadline Cloud Workstation Configuration")
- self.deadline_credentials_status = DeadlineCredentialsStatus.getInstance()
+ self.deadline_authentication_status = DeadlineAuthenticationStatus.getInstance()
self._build_ui()
def _build_ui(self):
@@ -90,11 +90,11 @@ def _build_ui(self):
self.layout.addItem(QSpacerItem(0, 0, QSizePolicy.Minimum, QSizePolicy.Expanding))
- self.creds_status_box = DeadlineCredentialsStatusWidget(self)
- self.layout.addWidget(self.creds_status_box)
- self.deadline_credentials_status.deadline_config_changed.connect(self.config_box.refresh)
- self.deadline_credentials_status.api_availability_changed.connect(
- self.on_creds_status_update
+ self.auth_status_box = DeadlineAuthenticationStatusWidget(self)
+ self.layout.addWidget(self.auth_status_box)
+ self.deadline_authentication_status.deadline_config_changed.connect(self.config_box.refresh)
+ self.deadline_authentication_status.api_availability_changed.connect(
+ self.on_auth_status_update
)
# We only use a Close button, not OK/Cancel, because we live update the settings.
@@ -125,12 +125,12 @@ def accept(self):
def on_login(self):
DeadlineLoginDialog.login(parent=self, config=self.config_box.config)
- self.deadline_credentials_status.refresh_status()
+ self.deadline_authentication_status.refresh_status()
self.config_box.refresh()
def on_logout(self):
api.logout(config=self.config_box.config)
- self.deadline_credentials_status.refresh_status()
+ self.deadline_authentication_status.refresh_status()
self.config_box.refresh()
def on_button_box_clicked(self, button):
@@ -140,14 +140,14 @@ def on_button_box_clicked(self, button):
def on_refresh(self):
# Enable the "Apply" button only if there are changes
self.button_box.button(QDialogButtonBox.Apply).setEnabled(bool(self.config_box.changes))
- # Update the creds status with the refreshed config
- self.deadline_credentials_status.set_config(self.config_box.config)
+ # Update the auth status with the refreshed config
+ self.deadline_authentication_status.set_config(self.config_box.config)
- def on_creds_status_update(self):
+ def on_auth_status_update(self):
# If the Amazon Deadline Cloud API is authorized successfully for the AWS profile
# in the config dialog, refresh the farm/queue lists
- if self.deadline_credentials_status.api_availability and config_file.get_setting(
- "defaults.aws_profile_name", self.deadline_credentials_status.config
+ if self.deadline_authentication_status.api_availability and config_file.get_setting(
+ "defaults.aws_profile_name", self.deadline_authentication_status.config
) == config_file.get_setting("defaults.aws_profile_name", self.config_box.config):
self.config_box.refresh_lists()
diff --git a/src/deadline/client/ui/dialogs/deadline_login_dialog.py b/src/deadline/client/ui/dialogs/deadline_login_dialog.py
index 787022ee..b1023e43 100644
--- a/src/deadline/client/ui/dialogs/deadline_login_dialog.py
+++ b/src/deadline/client/ui/dialogs/deadline_login_dialog.py
@@ -24,7 +24,7 @@
)
from ... import api
-from ...api._session import AwsCredentialsType
+from ...api._session import AwsCredentialsSource
class DeadlineLoginDialog(QMessageBox):
@@ -105,7 +105,10 @@ def _login_background_thread(self):
try:
def on_pending_authorization(**kwargs):
- if kwargs["credential_type"] == AwsCredentialsType.DEADLINE_CLOUD_MONITOR_LOGIN:
+ if (
+ kwargs["credentials_source"]
+ == AwsCredentialsSource.DEADLINE_CLOUD_MONITOR_LOGIN
+ ):
self.login_thread_message.emit(
"Opening Deadline Cloud Monitor. Please login before returning here."
)
diff --git a/src/deadline/client/ui/dialogs/submit_job_to_deadline_dialog.py b/src/deadline/client/ui/dialogs/submit_job_to_deadline_dialog.py
index 520af57c..abc1ace8 100644
--- a/src/deadline/client/ui/dialogs/submit_job_to_deadline_dialog.py
+++ b/src/deadline/client/ui/dialogs/submit_job_to_deadline_dialog.py
@@ -28,14 +28,14 @@
from deadline.job_attachments.upload import S3AssetManager
from ... import api
-from ..deadline_credentials_status import DeadlineCredentialsStatus
+from ..deadline_authentication_status import DeadlineAuthenticationStatus
from .. import block_signals
from ...config import get_setting
from ...config.config_file import str2bool
from ...exceptions import UserInitiatedCancel
from ...job_bundle import create_job_history_bundle_dir
from ...job_bundle.submission import AssetReferences
-from ..widgets.deadline_credentials_status_widget import DeadlineCredentialsStatusWidget
+from ..widgets.deadline_authentication_status_widget import DeadlineAuthenticationStatusWidget
from ..widgets.job_attachments_tab import JobAttachmentsWidget
from ..widgets.shared_job_settings_tab import SharedJobSettingsWidget
from ..widgets.host_requirements_tab import HostRequirementsWidget
@@ -45,7 +45,7 @@
logger = logging.getLogger(__name__)
# initialize early so once the UI opens, things are already initialized
-DeadlineCredentialsStatus.getInstance()
+DeadlineAuthenticationStatus.getInstance()
class SubmitJobToDeadlineDialog(QDialog):
@@ -94,7 +94,7 @@ def __init__(
self.job_settings_type = type(initial_job_settings)
self.on_create_job_bundle_callback = on_create_job_bundle_callback
self.create_job_response: Optional[Dict[str, Any]] = None
- self.deadline_credentials_status = DeadlineCredentialsStatus.getInstance()
+ self.deadline_authentication_status = DeadlineAuthenticationStatus.getInstance()
self.show_host_requirements_tab = show_host_requirements_tab
self._build_ui(
@@ -155,9 +155,9 @@ def _build_ui(
if self.show_host_requirements_tab:
self._build_host_requirements_tab()
- self.creds_status_box = DeadlineCredentialsStatusWidget(self)
- self.lyt.addWidget(self.creds_status_box)
- self.deadline_credentials_status.api_availability_changed.connect(
+ self.auth_status_box = DeadlineAuthenticationStatusWidget(self)
+ self.lyt.addWidget(self.auth_status_box)
+ self.deadline_authentication_status.api_availability_changed.connect(
self.refresh_deadline_settings
)
@@ -187,7 +187,7 @@ def _set_submit_button_state(self):
# Enable/disable the Submit button based on whether the
# Amazon Deadline Cloud API is accessible and the farm+queue are configured.
enable = (
- self.deadline_credentials_status.api_availability is True
+ self.deadline_authentication_status.api_availability is True
and get_setting("defaults.farm_id") != ""
and get_setting("defaults.queue_id") != ""
and self.shared_job_settings.is_queue_valid()
@@ -197,7 +197,7 @@ def _set_submit_button_state(self):
if not enable:
self.submit_button.setToolTip(
- "Cannot submit job to deadline cloud. Invalid credentials or queue parameters."
+ "Cannot submit job to deadline cloud. Nonvalid credentials or queue parameters."
)
else:
self.submit_button.setToolTip("")
@@ -206,18 +206,18 @@ def refresh_deadline_settings(self):
# Enable/disable the Login and Logout buttons based on whether
# the configured profile is for Deadline Cloud Monitor
self.login_button.setEnabled(
- self.deadline_credentials_status.creds_type
- == api.AwsCredentialsType.DEADLINE_CLOUD_MONITOR_LOGIN
+ self.deadline_authentication_status.creds_source
+ == api.AwsCredentialsSource.DEADLINE_CLOUD_MONITOR_LOGIN
)
self.logout_button.setEnabled(
- self.deadline_credentials_status.creds_type
- == api.AwsCredentialsType.DEADLINE_CLOUD_MONITOR_LOGIN
+ self.deadline_authentication_status.creds_source
+ == api.AwsCredentialsSource.DEADLINE_CLOUD_MONITOR_LOGIN
)
self._set_submit_button_state()
self.shared_job_settings.deadline_cloud_settings_box.refresh_setting_controls(
- self.deadline_credentials_status.api_availability is True
+ self.deadline_authentication_status.api_availability is True
)
# If necessary, this reloads the queue parameters
self.shared_job_settings.refresh_queue_parameters()
@@ -309,16 +309,16 @@ def on_job_template_parameter_changed(self, parameter: dict[str, Any]):
def on_login(self):
DeadlineLoginDialog.login(parent=self)
self.refresh_deadline_settings()
- # This widget watches the creds files, but that does
+ # This widget watches the auth files, but that does
# not always catch a change so force a refresh here.
- self.deadline_credentials_status.refresh_status()
+ self.deadline_authentication_status.refresh_status()
def on_logout(self):
api.logout()
self.refresh_deadline_settings()
- # This widget watches the creds files, but that does
+ # This widget watches the auth files, but that does
# not always catch a change so force a refresh here.
- self.deadline_credentials_status.refresh_status()
+ self.deadline_authentication_status.refresh_status()
def on_settings_button_clicked(self):
if DeadlineConfigDialog.configure_settings(parent=self):
diff --git a/src/deadline/client/ui/widgets/deadline_credentials_status_widget.py b/src/deadline/client/ui/widgets/deadline_authentication_status_widget.py
similarity index 54%
rename from src/deadline/client/ui/widgets/deadline_credentials_status_widget.py
rename to src/deadline/client/ui/widgets/deadline_authentication_status_widget.py
index bb33ec9e..66df4243 100644
--- a/src/deadline/client/ui/widgets/deadline_credentials_status_widget.py
+++ b/src/deadline/client/ui/widgets/deadline_authentication_status_widget.py
@@ -2,8 +2,8 @@
"""
Provides a widget to place in Amazon Deadline Cloud submitter dialogs, that shows
-the current status of Amazon Deadline Cloud credentials and API.
-The current stauts is handled by DeadlineCredentialstatus.
+the current status of Amazon Deadline Cloud authentication and API.
+The current status is handled by DeadlineAuthenticationStatus.
"""
from logging import getLogger
from typing import Optional
@@ -18,15 +18,15 @@
)
from ... import api
-from ..deadline_credentials_status import DeadlineCredentialsStatus
+from ..deadline_authentication_status import DeadlineAuthenticationStatus
logger = getLogger(__name__)
-class DeadlineCredentialsStatusWidget(QWidget):
+class DeadlineAuthenticationStatusWidget(QWidget):
"""
A Widget that displays status information about Amazon Deadline Cloud
- credentials from a DeadlineCredentialStatus object.
+ authentication from a DeadlineAuthenticationStatus object.
"""
def __init__(self, parent=None) -> None:
@@ -34,48 +34,50 @@ def __init__(self, parent=None) -> None:
layout = QHBoxLayout(self)
- self.creds_type_group = CredentialsStatusGroup(title="Credentials Type", parent=self)
- layout.addWidget(self.creds_type_group)
- self.creds_status_group = CredentialsStatusGroup(title="Credentials Status", parent=self)
- layout.addWidget(self.creds_status_group)
- self.deadline_authorized_group = CredentialsStatusGroup(
+ self.creds_source_group = AuthenticationStatusGroup(title="Credential Source", parent=self)
+ layout.addWidget(self.creds_source_group)
+ self.auth_status_group = AuthenticationStatusGroup(
+ title="Authentication Status", parent=self
+ )
+ layout.addWidget(self.auth_status_group)
+ self.deadline_authorized_group = AuthenticationStatusGroup(
title="Amazon Deadline Cloud API", parent=self
)
layout.addWidget(self.deadline_authorized_group)
- self._status = DeadlineCredentialsStatus.getInstance()
- self._status.creds_type_changed.connect(self._creds_type_changed)
- self._status.creds_status_changed.connect(self._creds_status_changed)
+ self._status = DeadlineAuthenticationStatus.getInstance()
+ self._status.creds_source_changed.connect(self._creds_source_changed)
+ self._status.auth_status_changed.connect(self._auth_status_changed)
self._status.api_availability_changed.connect(self._api_availability_changed)
# Update with current values
- self._creds_type_changed()
- self._creds_status_changed()
+ self._creds_source_changed()
+ self._auth_status_changed()
self._api_availability_changed()
- def _creds_type_changed(self) -> None:
- if self._status.creds_type is None:
+ def _creds_source_changed(self) -> None:
+ if self._status.creds_source is None:
color = "white"
text = "<Refreshing>"
- elif self._status.creds_type == api.AwsCredentialsType.NOT_VALID:
+ elif self._status.creds_source == api.AwsCredentialsSource.NOT_VALID:
color = "red"
- text = self._status.creds_type.name
+ text = self._status.creds_source.name
else:
color = "green"
- text = self._status.creds_type.name
- self.creds_type_group.label.setText(f"{text}")
+ text = self._status.creds_source.name
+ self.creds_source_group.label.setText(f"{text}")
- def _creds_status_changed(self) -> None:
- if self._status.creds_status is None:
+ def _auth_status_changed(self) -> None:
+ if self._status.auth_status is None:
color = "white"
text = "<Refreshing>"
- elif self._status.creds_status == api.AwsCredentialsStatus.AUTHENTICATED:
+ elif self._status.auth_status == api.AwsAuthenticationStatus.AUTHENTICATED:
color = "green"
- text = self._status.creds_status.name
+ text = self._status.auth_status.name
else:
color = "red"
- text = self._status.creds_status.name
- self.creds_status_group.label.setText(f"{text}")
+ text = self._status.auth_status.name
+ self.auth_status_group.label.setText(f"{text}")
def _api_availability_changed(self) -> None:
if self._status.api_availability is None:
@@ -90,9 +92,9 @@ def _api_availability_changed(self) -> None:
self.deadline_authorized_group.label.setText(f"{text}")
-class CredentialsStatusGroup(QGroupBox):
+class AuthenticationStatusGroup(QGroupBox):
"""
- UI element to group the status of credentials.
+ UI element to group the status of authentication.
"""
def __init__(self, *, title: str, parent: Optional[QWidget] = None):
diff --git a/test/unit/deadline_client/api/test_api_session.py b/test/unit/deadline_client/api/test_api_session.py
index a88c1dcf..a5e911da 100644
--- a/test/unit/deadline_client/api/test_api_session.py
+++ b/test/unit/deadline_client/api/test_api_session.py
@@ -71,19 +71,19 @@ def test_get_boto3_session_caching_behavior(fresh_deadline_config):
)
-def test_get_check_credentials_status_authenticated(fresh_deadline_config):
- """Confirm that check_credentials_status returns AUTHENTICATED"""
+def test_get_check_authentication_status_authenticated(fresh_deadline_config):
+ """Confirm that check_authentication_status returns AUTHENTICATED"""
with patch.object(api._session, "get_boto3_session") as session_mock, patch.object(
api, "get_boto3_session", new=session_mock
):
config.set_setting("defaults.aws_profile_name", "SomeRandomProfileName")
session_mock().client("sts").get_caller_identity.return_value = {}
- assert api.check_credentials_status() == api.AwsCredentialsStatus.AUTHENTICATED
+ assert api.check_authentication_status() == api.AwsAuthenticationStatus.AUTHENTICATED
-def test_get_check_credentials_status_configuration_error(fresh_deadline_config):
- """Confirm that check_credentials_status returns CONFIGURATION_ERROR"""
+def test_get_check_authentication_status_configuration_error(fresh_deadline_config):
+ """Confirm that check_authentication_status returns CONFIGURATION_ERROR"""
with patch.object(api._session, "get_boto3_session") as session_mock, patch.object(
api, "get_boto3_session", new=session_mock
):
@@ -92,7 +92,7 @@ def test_get_check_credentials_status_configuration_error(fresh_deadline_config)
"some uncaught exception"
)
- assert api.check_credentials_status() == api.AwsCredentialsStatus.CONFIGURATION_ERROR
+ assert api.check_authentication_status() == api.AwsAuthenticationStatus.CONFIGURATION_ERROR
def test_get_queue_user_boto3_session_cache(fresh_deadline_config):
diff --git a/test/unit/deadline_client/cli/test_cli.py b/test/unit/deadline_client/cli/test_cli.py
index aaa18e83..4dceaac9 100644
--- a/test/unit/deadline_client/cli/test_cli.py
+++ b/test/unit/deadline_client/cli/test_cli.py
@@ -40,7 +40,7 @@ def test_cli_unfamiliar_exception(fresh_deadline_config):
login_mock.side_effect = Exception("An unexpected exception")
runner = CliRunner()
- result = runner.invoke(main, ["creds", "login"])
+ result = runner.invoke(main, ["auth", "login"])
assert "encountered the following exception" in result.output
assert "An unexpected exception" in result.output
diff --git a/test/unit/deadline_client/cli/test_cli_creds.py b/test/unit/deadline_client/cli/test_cli_auth.py
similarity index 89%
rename from test/unit/deadline_client/cli/test_cli_creds.py
rename to test/unit/deadline_client/cli/test_cli_auth.py
index e04047d0..c743412b 100644
--- a/test/unit/deadline_client/cli/test_cli_creds.py
+++ b/test/unit/deadline_client/cli/test_cli_auth.py
@@ -1,7 +1,7 @@
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
"""
-Tests for the CLI creds commands.
+Tests for the CLI auth commands.
"""
import json
import subprocess
@@ -41,7 +41,7 @@ def test_cli_deadline_cloud_monitor_login_and_logout(fresh_deadline_config):
check_output_mock.return_value = bytes("Successfully logged out", "utf8")
runner = CliRunner()
- result = runner.invoke(main, ["creds", "login"])
+ result = runner.invoke(main, ["auth", "login"])
assert result.exit_code == 0, result.output
@@ -62,7 +62,7 @@ def test_cli_deadline_cloud_monitor_login_and_logout(fresh_deadline_config):
# Now lets logout
runner = CliRunner()
- result = runner.invoke(main, ["creds", "logout"])
+ result = runner.invoke(main, ["auth", "logout"])
check_output_mock.assert_called_once_with(
["/bin/DeadlineCloudMonitor", "logout", "--profile", "sandbox-us-west-2"]
@@ -74,7 +74,7 @@ def test_cli_deadline_cloud_monitor_login_and_logout(fresh_deadline_config):
assert api._session.__cached_boto3_session is None
-def test_cli_creds_status(fresh_deadline_config):
+def test_cli_auth_status(fresh_deadline_config):
"""
Confirm that the CLI status command prints out as expected
"""
@@ -90,17 +90,17 @@ def test_cli_creds_status(fresh_deadline_config):
# WHEN
runner = CliRunner()
- result = runner.invoke(main, ["creds", "status"])
+ result = runner.invoke(main, ["auth", "status"])
# THEN
assert result.exit_code == 0
assert "Profile Name: " in result.output
- assert "Type: " in result.output
+ assert "Source: " in result.output
assert "Status: " in result.output
assert "API Availability: " in result.output
-def test_cli_creds_status_json(fresh_deadline_config):
+def test_cli_auth_status_json(fresh_deadline_config):
"""
Confirm that the CLI status command gives valid json back
"""
@@ -108,7 +108,7 @@ def test_cli_creds_status_json(fresh_deadline_config):
profile_name = "sandbox-us-west-2"
expected = {
"profile_name": profile_name,
- "type": "DEADLINE_CLOUD_MONITOR_LOGIN",
+ "source": "DEADLINE_CLOUD_MONITOR_LOGIN",
"status": "AUTHENTICATED",
"api_availability": False,
}
@@ -130,7 +130,7 @@ def test_cli_creds_status_json(fresh_deadline_config):
# WHEN
runner = CliRunner()
- result = runner.invoke(main, ["creds", "status", "--output", "json"])
+ result = runner.invoke(main, ["auth", "status", "--output", "json"])
actual = json.loads(result.output)
# THEN