Integrating up through commit 90f050496

This commit is contained in:
alexpete
2021-04-07 14:03:29 -07:00
parent 8f2ed080a9
commit c2cbd430fe
2694 changed files with 285622 additions and 176874 deletions
-1
View File
@@ -34,7 +34,6 @@ ly_add_target(
ly_add_target(
NAME AWSClientAuth ${PAL_TRAIT_MONOLITHIC_DRIVEN_MODULE_TYPE}
NAMESPACE Gem
OUTPUT_NAME Gem.AWSClientAuth.c74f2756f5874c0d8d29646dfc9cb0ad.v0.1.0
FILES_CMAKE
awsclientauth_shared_files.cmake
INCLUDE_DIRECTORIES
@@ -152,7 +152,7 @@ namespace AWSClientAuth
//! @param userCode Unique code generated for user for the session.
//! @param verificationUrl Verification URL to enter user code in after signing in for the provider.
//! @param codeExpiresInSeconds Code expiry in seconds.
virtual void OnDeviceCodeGrantSignInSuccess(const AZStd::string& userCode, const AZStd::string& verificationUrl, const int codeExpiresInSeconds)
virtual void OnDeviceCodeGrantSignInSuccess(const AZStd::string& userCode, const AZStd::string& verificationUrl, int codeExpiresInSeconds)
{
AZ_UNUSED(userCode);
AZ_UNUSED(verificationUrl);
@@ -155,8 +155,8 @@ namespace AWSClientAuth
}
m_cognitoIdentityProviderClient =
std::make_shared<Aws::CognitoIdentityProvider::CognitoIdentityProviderClient>(clientConfiguration);
m_cognitoIdentityClient = std::make_shared<Aws::CognitoIdentity::CognitoIdentityClient>(clientConfiguration);
std::make_shared<Aws::CognitoIdentityProvider::CognitoIdentityProviderClient>(Aws::Auth::AWSCredentials(), clientConfiguration);
m_cognitoIdentityClient = std::make_shared<Aws::CognitoIdentity::CognitoIdentityClient>(Aws::Auth::AWSCredentials(), clientConfiguration);
}
std::shared_ptr<Aws::CognitoIdentityProvider::CognitoIdentityProviderClient> AWSClientAuthSystemComponent::GetCognitoIDPClient()
@@ -313,7 +313,7 @@ namespace AWSClientAuthUnitTest
: public Aws::CognitoIdentity::CognitoIdentityClient
{
public:
CognitoIdentityClientMock()
CognitoIdentityClientMock() : Aws::CognitoIdentity::CognitoIdentityClient(Aws::Auth::AWSCredentials())
{
ON_CALL(*this, GetId(testing::_)).WillByDefault(testing::Invoke(this, &CognitoIdentityClientMock::GetIdMock));
ON_CALL(*this, GetCredentialsForIdentity(testing::_)).WillByDefault(testing::Invoke(this, &CognitoIdentityClientMock::GetCredentialsForIdentityMock));
@@ -392,7 +392,7 @@ namespace AWSClientAuthUnitTest
MOCK_METHOD1(OnPasswordGrantMultiFactorSignInFail, void(const AZStd::string& error));
MOCK_METHOD1(OnPasswordGrantMultiFactorConfirmSignInSuccess, void(const AWSClientAuth::AuthenticationTokens& authenticationToken));
MOCK_METHOD1(OnPasswordGrantMultiFactorConfirmSignInFail, void(const AZStd::string& error));
MOCK_METHOD3(OnDeviceCodeGrantSignInSuccess, void(const AZStd::string& userCode, const AZStd::string& verificationUrl, const int codeExpiresInSeconds));
MOCK_METHOD3(OnDeviceCodeGrantSignInSuccess, void(const AZStd::string& userCode, const AZStd::string& verificationUrl, int codeExpiresInSeconds));
MOCK_METHOD1(OnDeviceCodeGrantSignInFail, void(const AZStd::string& error));
MOCK_METHOD1(OnDeviceCodeGrantConfirmSignInSuccess, void(const AWSClientAuth::AuthenticationTokens& authenticationToken));
MOCK_METHOD1(OnDeviceCodeGrantConfirmSignInFail, void(const AZStd::string& error));
@@ -28,6 +28,10 @@ namespace Aws
{
class HttpClient;
}
namespace Auth
{
class AWSCredentials;
}
}
@@ -118,7 +122,7 @@ namespace AWSCore
else
{
// If no explict credenitals are provided then AWS C++ SDK will perform standard search
return std::make_shared<ClientType>(GetClientConfiguration());
return std::make_shared<ClientType>(Aws::Auth::AWSCredentials(), GetClientConfiguration());
}
}
@@ -13,6 +13,7 @@
#include <AzCore/RTTI/BehaviorContext.h>
#include <AzCore/Serialization/EditContext.h>
#include <aws/core/auth/AWSCredentials.h>
#include <aws/dynamodb/DynamoDBClient.h>
#include <aws/dynamodb/model/GetItemRequest.h>
#include <aws/dynamodb/model/GetItemResult.h>
@@ -17,6 +17,7 @@
#include <aws/lambda/model/InvokeRequest.h>
#include <aws/lambda/model/InvokeResult.h>
#include <aws/core/utils/Outcome.h>
#include <aws/core/auth/AWSCredentials.h>
#include <aws/core/utils/memory/stl/AWSStringStream.h>
#include <Framework/AWSApiRequestJob.h>
@@ -15,6 +15,7 @@
#include <AzCore/Serialization/EditContext.h>
#include <AzFramework/StringFunc/StringFunc.h>
#include <aws/core/auth/AWSCredentials.h>
#include <aws/s3/S3Client.h>
#include <aws/s3/model/GetObjectRequest.h>
#include <aws/s3/model/HeadObjectRequest.h>
@@ -57,7 +57,7 @@ $ python resource_mapping_tool.py
Update `resource_mapping_tool.cmd` with your virtualenv full path.
* **VIRTUALENV_PATH**: Fill this variable with your virtualenv full path.
Then you can launch the resource mapping tool by running the batch script directly.
```
@@ -182,11 +182,10 @@ class ViewEditController(QObject):
notification_label_text.VIEW_EDIT_PAGE_SAVING_SUCCEED_MESSAGE.format(config_file))
def _search_complete_callback(self) -> None:
self._view_edit_page.set_notification_page_text(ViewEditPageConstants.NOTIFICATION_SELECT_CONFIG_FILE_TEXT)
self._reset_page()
def _start_search_config_files_async(self, config_directory: str) -> None:
self._view_edit_page.set_notification_page_text(ViewEditPageConstants.NOTIFICATION_LOADING_TEXT)
self._view_edit_page.set_notification_page_text(notification_label_text.NOTIFICATION_LOADING_MESSAGE)
self._view_edit_page.set_current_main_view_index(ViewEditPageConstants.NOTIFICATION_PAGE_INDEX)
self._config_file_json_source.clear()
self._table_view.reset_view()
@@ -233,12 +232,11 @@ class ViewEditController(QObject):
self._view_edit_page.save_changes_button.clicked.connect(self._save_changes)
self._view_edit_page.search_filter_input.returnPressed.connect(self._filter_based_on_search_text)
self._view_edit_page.cancel_button.clicked.connect(self._cancel)
self._view_edit_page.notification_prompt_create_new_button.clicked.connect(self._create_new_config_file)
self._view_edit_page.notification_prompt_rescan_button.clicked.connect(self._rescan_config_directory)
self._view_edit_page.create_new_button.clicked.connect(self._create_new_config_file)
self._view_edit_page.rescan_button.clicked.connect(self._rescan_config_directory)
def _setup_page_start_state(self) -> None:
configuration: Configuration = self._configuration_manager.configuration
self._view_edit_page.set_notification_page_text(ViewEditPageConstants.NOTIFICATION_SELECT_CONFIG_FILE_TEXT)
self._view_edit_page.set_current_main_view_index(ViewEditPageConstants.NOTIFICATION_PAGE_INDEX)
self._view_edit_page.set_config_files(configuration.config_files)
self._view_edit_page.set_config_location(configuration.config_directory)
@@ -12,6 +12,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
from __future__ import annotations
import logging
from PySide2.QtGui import QPixmap
from PySide2.QtWidgets import (QMainWindow, QStackedWidget, QWidget)
from model import (error_messages, view_size_constants)
@@ -42,6 +43,7 @@ class ViewManager(object):
def __init__(self) -> None:
if ViewManager.__instance is None:
self._main_window: QMainWindow = QMainWindow()
self._main_window.setWindowIcon(QPixmap(":/stylesheet/img/ly_application_icon.png"))
self._main_window.setWindowTitle("Resource Mapping")
self._main_window.setGeometry(0, 0,
view_size_constants.TOOL_APPLICATION_MAIN_WINDOW_WIDTH,
@@ -9,7 +9,31 @@ remove or modify any license notices. This file is distributed on an "AS IS" BAS
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
"""
NOTIFICATION_LOADING_MESSAGE: str = "Loading..."
VIEW_EDIT_PAGE_CONFIG_FILE_TEXT: str = "Config File"
VIEW_EDIT_PAGE_CONFIG_LOCATION_TEXT: str = "Config Location:"
VIEW_EDIT_PAGE_ADD_ROW_TEXT: str = "Add Row"
VIEW_EDIT_PAGE_DELETE_ROW_TEXT: str = "Delete Row"
VIEW_EDIT_PAGE_SAVE_CHANGES_TEXT: str = "Save Changes"
VIEW_EDIT_PAGE_CANCEL_TEXT: str = "Cancel"
VIEW_EDIT_PAGE_CREATE_NEW_TEXT: str = "Create New"
VIEW_EDIT_PAGE_RESCAN_TEXT: str = "Rescan"
VIEW_EDIT_PAGE_CONFIG_FILES_PLACEHOLDER_TEXT: str = "Found {} config files"
VIEW_EDIT_PAGE_SEARCH_PLACEHOLDER_TEXT: str = "Search by Key Name, Type, Name/ID, Account ID or Region"
VIEW_EDIT_PAGE_IMPORT_RESOURCES_PLACEHOLDER_TEXT: str = "Import Additional Resources"
VIEW_EDIT_PAGE_SELECT_CONFIG_FILE_MESSAGE: str = "Please select the Config file you would like to view and modify..."
VIEW_EDIT_PAGE_NO_CONFIG_FILE_FOUND_MESSAGE: str = \
"<p><b>Unable to locate a resource mapping config file.</b></p>"\
"<p>We can either make this file for you or you can rescan your directory.</p>"
VIEW_EDIT_PAGE_SAVING_SUCCEED_MESSAGE: str = "Config file {} is saved successfully."
IMPORT_RESOURCES_PAGE_BACK_TEXT: str = "Back"
IMPORT_RESOURCES_PAGE_AWS_SEARCH_TYPE_TEXT: str = "AWS Resource Type"
IMPORT_RESOURCES_PAGE_SEARCH_TEXT: str = " Search"
IMPORT_RESOURCES_PAGE_IMPORT_TEXT: str = "Import"
IMPORT_RESOURCES_PAGE_SEARCH_PLACEHOLDER_TEXT: str = "Search for resources by Type or Name/ID"
IMPORT_RESOURCES_PAGE_AWS_SEARCH_TYPE_PLACEHOLDER_TEXT: str = "Please select"
@@ -20,7 +20,7 @@ from model.resource_mapping_attributes import (ResourceMappingAttributes, Resour
logger = logging.getLogger(__name__)
_TABLE_HORIZONTAL_HEADER_NAMES: List[str] =\
["Key Name*", "Type*", "Name/ID*", "Account ID", "Region", "Status"]
["Key Name", "Type", "Name/ID", "Account ID", "Region", "Status"]
class ResourceTableConstants(object):
@@ -70,16 +70,6 @@ class ResourceTableModel(ResourceAbstractModel, QAbstractTableModel, metaclass=R
return resource.status.value
return ""
def _get_resource_attribute_tooltip(self, row: int, column: int) -> str:
if 0 <= row < len(self._resources):
resource: ResourceMappingAttributes = self._resources[row]
attribute: str = self._get_resource_str_type_attribute(resource, column)
if attribute:
return attribute
elif column == ResourceTableConstants.TABLE_STATE_COLUMN_INDEX:
return resource.status.descriptions_in_tooltip()
return ""
def _set_resource_attribute(self, row: int, column: int, value: str) -> None:
if 0 <= row < len(self._resources):
resource: ResourceMappingAttributes = self._resources[row]
@@ -113,11 +103,17 @@ class ResourceTableModel(ResourceAbstractModel, QAbstractTableModel, metaclass=R
"""QAbstractTableModel override"""
row: int = index.row()
column: int = index.column()
if role == Qt.DisplayRole or role == Qt.EditRole:
return self._get_resource_attribute(row, column)
if role == Qt.ToolTipRole:
return self._get_resource_attribute_tooltip(row, column)
if 0 <= row < len(self._resources):
resource: ResourceMappingAttributes = self._resources[row]
attribute: str = self._get_resource_str_type_attribute(resource, column)
if attribute:
if role == Qt.DisplayRole or role == Qt.EditRole or role == Qt.ToolTipRole:
return attribute
elif column == ResourceTableConstants.TABLE_STATE_COLUMN_INDEX:
if role == Qt.ToolTipRole:
return resource.status.descriptions_in_tooltip()
if role == Qt.DisplayRole:
return resource.status.value
def headerData(self, section: int, orientation: int, role: int = Qt.DisplayRole) -> object:
"""QAbstractTableModel override"""
@@ -13,54 +13,33 @@ TOOL_APPLICATION_MAIN_WINDOW_WIDTH: int = 920
TOOL_APPLICATION_MAIN_WINDOW_HEIGHT: int = 600
MAIN_PAGE_LAYOUT_MARGIN_LEFTRIGHT: int = 10
MAIN_PAGE_LAYOUT_MARGIN_TOPBOTTOM: int = 20
MAIN_PAGE_LAYOUT_MARGIN_TOPBOTTOM: int = 15
INTERACTION_COMPONENT_HEIGHT: int = 25
ICON_FRONT_SIZE: int = 12
"""view edit page related constants"""
VIEW_EDIT_PAGE_HEADER_FOOTER_AREA_HEIGHT: int = 75
VIEW_EDIT_PAGE_CENTER_AREA_HEIGHT: int = 450
VIEW_EDIT_PAGE_HEADER_AREA_HEIGHT: int = 65
VIEW_EDIT_PAGE_CENTER_AREA_HEIGHT: int = 500
VIEW_EDIT_PAGE_FOOTER_AREA_HEIGHT: int = 50
VIEW_EDIT_PAGE_WIDGET_SUBCOMPONENT_Y: int = 25
VIEW_EDIT_PAGE_MARGIN_TOPBOTTOM: int = 10
# header area
CONFIG_FILE_LABEL_X: int = 25
CONFIG_FILE_LABEL_WIDTH: int = 60
CONFIG_FILE_COMBOBOX_X: int = 95
CONFIG_FILE_COMBOBOX_WIDTH: int = 200
CONFIG_LOCATION_LABEL_X: int = 620
CONFIG_LOCATION_LABEL_WIDTH: int = 80
CONFIG_LOCATION_TEXT_X: int = 705
CONFIG_LOCATION_TEXT_WIDTH: int = 150
CONFIG_LOCATION_BUTTON_X: int = 860
CONFIG_FILE_LABEL_WIDTH: int = 70
CONFIG_FILE_COMBOBOX_WIDTH: int = 250
CONFIG_LOCATION_LABEL_WIDTH: int = 110
CONFIG_LOCATION_TEXT_WIDTH: int = 190
HEADER_AREA_SEPARATOR_WIDTH: int = 5
# center area
NOTIFICATION_PAGE_PROMPT_HEIGHT: int = 100
NOTIFICATION_PAGE_PROMPT_BUTTON_WIDTH: int = 75
TABLE_VIEW_PAGE_INTERACTION_AREA_HEIGHT: int = 40
ADD_ROW_BUTTON_X: int = 10
ADD_ROW_BUTTON_WIDTH: int = 75
ADD_ROW_BUTTON_WIDTH: int = 90
DELETE_ROW_BUTTON_WIDTH: int = 90
IMPORT_RESOURCES_COMBOBOX_WIDTH: int = 180
TABLE_VIEW_PAGE_SEARCH_FILTER_WIDGET_WIDTH: int = 370
DELETE_ROW_BUTTON_X: int = 90
DELETE_ROW_BUTTON_WIDTH: int = 75
IMPORT_RESOURCES_LABEL_X: int = 185
IMPORT_RESOURCES_LABEL_WIDTH: int = 40
IMPORT_RESOURCES_COMBOBOX_X: int = 225
IMPORT_RESOURCES_COMBOBOX_WIDTH: int = 150
TABLE_VIEW_PAGE_SEARCH_FILTER_WIDGET_X: int = 565
TABLE_VIEW_PAGE_SEARCH_FILTER_WIDGET_WIDTH: int = 300
TABLE_VIEW_PAGE_TABLE_VIEW_AREA_HEIGHT: int = 400
TABLE_VIEW_PAGE_TABLE_VIEW_AREA_HEIGHT: int = 450
RESOURCE_TABLE_HEADER_CELL_MAXIMUM: int = 450
RESOURCE_TABLE_HEADER_CELL_MINIMUM: int = 40
@@ -72,43 +51,31 @@ RESOURCE_TABLE_ACCOUNTID_COLUMN_WIDTH: int = 100
RESOURCE_TABLE_REGION_COLUMN_WIDTH: int = 100
# footer area
SAVE_CHANGES_BUTTON_X: int = 710
SAVE_CHANGES_BUTTON_WIDTH: int = 85
CANCEL_BUTTON_X: int = 800
CANCEL_BUTTON_WIDTH: int = 75
SAVE_CHANGES_BUTTON_WIDTH: int = 90
CREATE_NEW_BUTTON_WIDTH: int = 90
RESCAN_BUTTON_WIDTH: int = 90
CANCEL_BUTTON_WIDTH: int = 90
"""import resources page related constants"""
IMPORT_RESOURCES_PAGE_HEADER_AREA_HEIGHT: int = 55
IMPORT_RESOURCES_PAGE_SEARCH_AREA_HEIGHT: int = 55
IMPORT_RESOURCES_PAGE_VIEW_AREA_HEIGHT: int = 450
IMPORT_RESOURCES_PAGE_HEADER_AREA_HEIGHT: int = 65
IMPORT_RESOURCES_PAGE_SEARCH_AREA_HEIGHT: int = 50
IMPORT_RESOURCES_PAGE_VIEW_AREA_HEIGHT: int = 500
IMPORT_RESOURCES_PAGE_FOOTER_AREA_HEIGHT: int = 50
IMPORT_RESOURCES_PAGE_WIDGET_SUBCOMPONENT_Y: int = 15
IMPORT_RESOURCES_PAGE_MARGIN_TOPBOTTOM: int = 10
# back area
BACK_BUTTON_WIDTH: int = 100
TYPED_RESOURCES_LABEL_X: int = 10
TYPED_RESOURCES_LABEL_WIDTH: int = 100
TYPED_RESOURCES_COMBOBOX_X: int = 115
# search area
TYPED_RESOURCES_LABEL_WIDTH: int = 125
TYPED_RESOURCES_COMBOBOX_WIDTH: int = 150
SEARCH_BUTTON_WIDTH: int = 80
IMPORT_BUTTON_WIDTH: int = 80
TYPED_RESOURCES_SEARCH_BUTTON_X: int = 310
TYPED_RESOURCES_IMPORT_BUTTON_X: int = 395
CFN_STACKS_SEARCH_BUTTON_X: int = 10
CFN_STACKS_IMPORT_BUTTON_X: int = 95
IMPORT_RESOURCES_PAGE_SEARCH_FILTER_WIDGET_X: int = 565
SEARCH_BUTTON_WIDTH: int = 90
IMPORT_BUTTON_WIDTH: int = 90
IMPORT_RESOURCES_PAGE_SEARCH_FILTER_WIDGET_WIDTH: int = 300
IMPORT_RESOURCES_PAGE_TREE_VIEW_X: int = 50
IMPORT_RESOURCES_PAGE_TREE_VIEW_WIDTH: int = 800
IMPORT_RESOURCES_PAGE_TREE_VIEW_HEIGHT: int = 400
# tree view area
IMPORT_RESOURCES_PAGE_TREE_VIEW_HEIGHT: int = 450
RESOURCE_STACK_HEADER_CELL_MAXIMUM: int = 400
RESOURCE_STACK_HEADER_CELL_MINIMUM: int = 200
RESOURCE_STACK_HEADER_CELL_MAXIMUM: int = 500
RESOURCE_STACK_HEADER_CELL_MINIMUM: int = 300
@@ -19,9 +19,11 @@ from manager.configuration_manager import ConfigurationManager
from manager.controller_manager import ControllerManager
from manager.thread_manager import ThreadManager
from manager.view_manager import ViewManager
from style import azqtcomponents_resources
from utils import file_utils
# logging setup
logging.basicConfig(stream=sys.stdout, level=logging.INFO,
logging.basicConfig(filename="resource_mapping_tool.log", filemode='w', level=logging.INFO,
format='%(asctime)s,%(msecs)d %(name)s %(levelname)s %(message)s', datefmt='%H:%M:%S')
logging.getLogger('boto3').setLevel(logging.CRITICAL)
logging.getLogger('botocore').setLevel(logging.CRITICAL)
@@ -30,11 +32,19 @@ logging.getLogger('urllib3').setLevel(logging.CRITICAL)
logger = logging.getLogger(__name__)
if __name__ == "__main__":
import sys
QApplication.setAttribute(Qt.AA_EnableHighDpiScaling)
QApplication.setAttribute(Qt.AA_UseHighDpiPixmaps)
app: QApplication = QApplication(sys.argv)
try:
style_sheet_path: str = file_utils.join_path(file_utils.get_parent_directory_path(__file__),
'style/base_style_sheet.qss')
with open(style_sheet_path, "r") as in_file:
style_sheet: str = in_file.read()
app.setStyleSheet(style_sheet)
except FileNotFoundError:
logger.warning("Failed to load style sheet for resource mapping tool")
logger.info("Initializing configuration manager ...")
configuration_manager: ConfigurationManager = ConfigurationManager()
configuration_manager.setup()
@@ -0,0 +1,10 @@
"""
All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
its licensors.
For complete copyright and license terms please see the LICENSE at the root of this
distribution (the "License"). All use of this software is governed by the License,
or, if provided, by the license below or the license accompanying this file. Do not
remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
"""
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,370 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
*
{
background-color: transparent;
color: white;
font-family: "Open Sans";
font-size: 12px;
}
QMainWindow,
QDialog,
QDockWidget
{
color: #cccccc;
background-color: #444444;
}
QLineEdit,
QComboBox
{
background-color: #CCCCCC;
color: black;
font-family: "Open Sans";
border-radius: 2px;
border-width: 0px;
border-color: #e9e9e9;
font-size: 12px;
line-height: 16px;
}
QToolTip
{
color: black;
}
QFrame#SeparatorLine
{
color: #2d2d2d;
}
/* QComboBox */
QComboBox
{
height: 16px;
padding-left: 4px;
margin: 1px;
font-size: 12px;
background-color: #CCCCCC;
}
QComboBox:hover
{
margin: 0px;
border-width: 1px;
border-style: solid;
border-radius: 3px;
border-color: rgba(0, 0, 0, 50);
}
QComboBox:disabled
{
background-color: #666666;
color: #999999;
}
QComboBox::drop-down
{
border-width: 0;
}
QComboBox::down-arrow
{
width: 16px;
height: 16px;
margin-right: 4px;
image: url(":/stylesheet/img/UI20/combobox-arrow.svg");
}
/* Popup */
QComboBox QAbstractItemView
{
background-color: #222222;
padding: 0px;
outline: none; /* Disable focus rect */
show-decoration-selected: 1;
}
QComboBox QAbstractItemView::item
{
color: #FFFFFF;
}
QComboBox QAbstractItemView::item:selected
{
background-color: #444444;
}
QComboBox QAbstractItemView::item:disabled
{
color: #555555;
}
/* QPushButton */
QPushButton
{
border: 1px solid #3D000000;
border-radius: 4px;
color: #ffffff;
font-family: "Open Sans";
font-size: 12px;
}
QPushButton:hover,
QPushButton:pressed
{
color: #FFFFFF;
}
QPushButton:disabled
{
border: 1px solid #3D000000;
color: #999999;
}
QPushButton#Primary
{
background-color: qlineargradient(x1:0, y1:0, x2:1, y2:1, stop:0 #0095F2, stop:1 #0073BB);
}
QPushButton#Primary:hover
{
background-color: qlineargradient(x1:0, y1:0, x2:1, y2:1, stop:0 #44BAFF, stop:1 #4AB2F8);
border: 1px solid #00A1C9;
}
QPushButton#Primary:pressed
{
background-color: #0073BB;
border: 1px solid #00A1C9;
}
QPushButton#Primary:disabled
{
background-color: #7092A7;
}
QPushButton#Secondary
{
background-color: qlineargradient(x1:0, y1:0, x2:1, y2:1, stop:0 #777777, stop:1 #666666);
}
QPushButton#Secondary:hover
{
background-color: qlineargradient(x1:0, y1:0, x2:1, y2:1, stop:0 #888888, stop:1 #777777);
border: 1px solid #FFFFFF;
}
QPushButton#Secondary:pressed
{
background-color: #444444;
border: 1px solid #FFFFFF;
}
QPushButton#Secondary:disabled
{
background-color: #666666;
}
QPushButton:flat
{
border: none;
background-color: transparent;
}
/* QTableView & QTreeView */
QTableView
{
qproperty-showGrid: false;
}
QTableView,
QTreeView
{
alternate-background-color: rgb(77, 77, 77);
background-color: transparent;
selection-background-color: rgb(101, 101, 101);
selection-color: #ffffff;
show-decoration-selected: 1;
border: 1px solid #10ffffff;
}
QTableView QHeaderView::down-arrow,
QTreeView QHeaderView::down-arrow
{
width: 12px;
height: 12px;
margin-right: 4px;
image: url(":/stylesheet/img/indicator-arrow-down.svg");
}
QTableView QHeaderView::up-arrow,
QTreeView QHeaderView::up-arrow
{
margin-right: 4px;
image: url(":/stylesheet/img/indicator-arrow-up.svg");
}
QTableView::item,
QTreeView::item
{
height: 24px;
border: none;
margin: 4px;
}
QTableView::item:selected,
QTreeView::branch:selected,
QTreeView::item:selected
{
background: rgb(101, 101, 101);
}
QTableView::item:hover,
QTreeView::branch:hover,
QTreeView::item:hover
{
background: rgb(90, 90, 90);
}
QTableView QHeaderView::section,
QTreeView QHeaderView::section
{
height: 24px;
background: #2d2d2d;
border: none;
font-size: 13px;
font-style: normal;
padding-left: 7px;
}
QTableView QHeaderView::section::first,
QTreeView QHeaderView::section::first
{
border-right: 0.5px solid white;
}
QTableView QHeaderView::section::last,
QTreeView QHeaderView::section::last
{
border-left: 0.5px solid white;
}
QTableView QHeaderView::section::middle,
QTreeView QHeaderView::section::middle
{
border-right: 0.5px solid white;
border-left: 0.5px solid white;
}
QTreeView::indicator
{
margin: 0px;
width: 16px;
height: 16px;
margin-left: -3px;
}
QTreeView::branch:open:has-children
{
image: url(:/TreeView/open.svg);
padding: 10px 4px;
}
QTreeView::branch:closed:has-children
{
image: url(:/TreeView/closed.svg);
padding: 8px 6px;
}
/* QScrollBar */
QScrollBar
{
border: 2px solid rgba(50, 50, 50, 70%);
background: none;
margin: 0px;
}
QScrollBar:vertical
{
width: 8px;
}
QScrollBar:horizontal
{
height: 8px;
}
QScrollBar::handle
{
border: 0px solid #000000;
border-radius: 2px;
background-color: rgba(136, 136, 136, 64%);
}
QScrollBar::handle:vertical {
min-height: 32px;
}
QScrollBar::handle:horizontal {
min-width: 32px;
}
QScrollBar::add-line,
QScrollBar::sub-line
{
border: none;
background: none;
color: none;
}
QScrollBar::add-line:horizontal,
QScrollBar::sub-line:horizontal
{
width: 0px;
}
QScrollBar::add-line:vertical,
QScrollBar::sub-line:vertical
{
height: 0px;
}
/* scrollbar hovered */
QScrollBar:hover
{
border: 1px solid rgba(136, 136, 136, 64%);
background-color: rgba(255, 255, 255, 12%);
margin: 0px;
}
QScrollBar::handle:hover
{
border-radius: 3px;
background-color: #999999;
}
/* NotificationFrame */
QFrame#NotificationFrame
{
background-color: transparent;
border: 1px solid #E57829;
border-radius: 2px;
margin: 4px;
padding: 4px;
}
@@ -14,7 +14,7 @@ from unittest import TestCase
from unittest.mock import (call, MagicMock, patch)
from controller.view_edit_controller import ViewEditController
from model import constants
from model import (constants, notification_label_text)
from model.basic_resource_attributes import (BasicResourceAttributes, BasicResourceAttributesBuilder,)
from model.resource_mapping_attributes import (ResourceMappingAttributes, ResourceMappingAttributesStatus)
from view.view_edit_page import ViewEditPageConstants
@@ -77,8 +77,6 @@ class TestViewEditController(TestCase):
assert actual_resource.region == self._expected_resource.region
def test_setup_with_expected_state_and_behavior_connected(self) -> None:
self._mocked_view_edit_page.set_notification_page_text.assert_called_once_with(
ViewEditPageConstants.NOTIFICATION_SELECT_CONFIG_FILE_TEXT)
self._mocked_view_edit_page.set_current_main_view_index.assert_called_once_with(
ViewEditPageConstants.NOTIFICATION_PAGE_INDEX)
self._mocked_view_edit_page.set_config_files.assert_called_once_with(
@@ -102,9 +100,9 @@ class TestViewEditController(TestCase):
self._test_view_edit_controller._filter_based_on_search_text)
self._mocked_view_edit_page.cancel_button.clicked.connect.assert_called_once_with(
self._test_view_edit_controller._cancel)
self._mocked_view_edit_page.notification_prompt_create_new_button.clicked.connect.assert_called_once_with(
self._mocked_view_edit_page.create_new_button.clicked.connect.assert_called_once_with(
self._test_view_edit_controller._create_new_config_file)
self._mocked_view_edit_page.notification_prompt_rescan_button.clicked.connect.assert_called_once_with(
self._mocked_view_edit_page.rescan_button.clicked.connect.assert_called_once_with(
self._test_view_edit_controller._rescan_config_directory)
def test_page_config_file_combobox_nothing_happen_when_index_is_default_value(self) -> None:
@@ -278,7 +276,7 @@ class TestViewEditController(TestCase):
mocked_call_args[0]() # triggering config_location_button connected function
mock_file_dialog.getExistingDirectory.assert_called_once()
self._mocked_view_edit_page.set_notification_page_text.assert_called_with(
ViewEditPageConstants.NOTIFICATION_LOADING_TEXT)
notification_label_text.NOTIFICATION_LOADING_MESSAGE)
self._mocked_view_edit_page.set_current_main_view_index.assert_called_with(
ViewEditPageConstants.NOTIFICATION_PAGE_INDEX)
self._mocked_table_view.reset_view.assert_called_once()
@@ -305,8 +303,8 @@ class TestViewEditController(TestCase):
expected_new_config_directory, constants.RESOURCE_MAPPING_CONFIG_FILE_NAME_SUFFIX)
assert self._mocked_configuration_manager.configuration.config_files == []
self._mocked_view_edit_page.set_config_files.assert_called_with([])
self._mocked_view_edit_page.set_notification_page_text.assert_called_with(
ViewEditPageConstants.NOTIFICATION_SELECT_CONFIG_FILE_TEXT)
self._mocked_view_edit_page.set_notification_page_text.assert_called_once_with(
notification_label_text.NOTIFICATION_LOADING_MESSAGE)
@patch("controller.view_edit_controller.ThreadManager")
@patch("controller.view_edit_controller.QFileDialog")
@@ -327,8 +325,8 @@ class TestViewEditController(TestCase):
expected_new_config_directory, constants.RESOURCE_MAPPING_CONFIG_FILE_NAME_SUFFIX)
assert self._mocked_configuration_manager.configuration.config_files == []
self._mocked_view_edit_page.set_config_files.assert_called_with([])
self._mocked_view_edit_page.set_notification_page_text.assert_called_with(
ViewEditPageConstants.NOTIFICATION_SELECT_CONFIG_FILE_TEXT)
self._mocked_view_edit_page.set_notification_page_text.assert_called_once_with(
notification_label_text.NOTIFICATION_LOADING_MESSAGE)
@patch("controller.view_edit_controller.ThreadManager")
@patch("controller.view_edit_controller.QFileDialog")
@@ -350,8 +348,8 @@ class TestViewEditController(TestCase):
expected_new_config_directory, constants.RESOURCE_MAPPING_CONFIG_FILE_NAME_SUFFIX)
assert self._mocked_configuration_manager.configuration.config_files == expected_new_config_files
self._mocked_view_edit_page.set_config_files.assert_called_with(expected_new_config_files)
self._mocked_view_edit_page.set_notification_page_text.assert_called_with(
ViewEditPageConstants.NOTIFICATION_SELECT_CONFIG_FILE_TEXT)
self._mocked_view_edit_page.set_notification_page_text.assert_called_once_with(
notification_label_text.NOTIFICATION_LOADING_MESSAGE)
def test_page_add_row_button_expected_resource_gets_loaded_into_model(self) -> None:
mocked_call_args: call = self._mocked_view_edit_page.add_row_button.clicked.connect.call_args[0]
@@ -479,7 +477,7 @@ class TestViewEditController(TestCase):
expected_config_files: List[str] = ["dummyfile"]
mock_file_utils.find_files_with_suffix_under_directory.return_value = expected_config_files
mocked_call_args: call = \
self._mocked_view_edit_page.notification_prompt_create_new_button.clicked.connect.call_args[0]
self._mocked_view_edit_page.create_new_button.clicked.connect.call_args[0]
mocked_call_args[0]() # triggering create_new_button connected function
mock_file_utils.join_path.assert_called_once()
@@ -494,7 +492,7 @@ class TestViewEditController(TestCase):
expected_config_files: List[str] = ["dummyfile"]
mock_json_utils.create_empty_resource_mapping_file.side_effect = IOError("dummy IO error")
mocked_call_args: call = \
self._mocked_view_edit_page.notification_prompt_create_new_button.clicked.connect.call_args[0]
self._mocked_view_edit_page.create_new_button.clicked.connect.call_args[0]
mocked_call_args[0]() # triggering create_new_button connected function
mock_file_utils.join_path.assert_called_once()
@@ -507,7 +505,7 @@ class TestViewEditController(TestCase):
self, mock_file_utils: MagicMock) -> None:
mock_file_utils.find_files_with_suffix_under_directory.side_effect = FileNotFoundError("dummy error")
mocked_call_args: call = \
self._mocked_view_edit_page.notification_prompt_rescan_button.clicked.connect.call_args[0]
self._mocked_view_edit_page.rescan_button.clicked.connect.call_args[0]
mocked_call_args[0]() # triggering rescan_button connected function
mock_file_utils.find_files_with_suffix_under_directory.assert_called_once()
@@ -59,6 +59,13 @@ class TestFileUtils(TestCase):
self._mock_path.cwd.assert_called_once()
assert actual_path_name == TestFileUtils._expected_path_name
def test_get_parent_directory_path_return_expected_path_name(self) -> None:
self._mock_path.return_value.parent = TestFileUtils._expected_path_name
actual_path_name: str = file_utils.get_parent_directory_path("dummy")
self._mock_path.assert_called_once()
assert actual_path_name == TestFileUtils._expected_path_name
def test_find_files_with_suffix_under_directory_return_expected_file_name(self) -> None:
mocked_path: MagicMock = self._mock_path.return_value
mocked_matched_path: MagicMock = MagicMock()
@@ -28,6 +28,10 @@ def get_current_directory_path() -> str:
return str(pathlib.Path.cwd())
def get_parent_directory_path(file_path: str) -> str:
return pathlib.Path(file_path).parent
def find_files_with_suffix_under_directory(dir_path: str, suffix: str) -> List[str]:
results: List[str] = []
paths: List[pathlib.Path] = \
@@ -9,146 +9,54 @@ remove or modify any license notices. This file is distributed on an "AS IS" BAS
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
"""
from PySide2.QtCore import (QRect, QSize, Qt)
from PySide2.QtGui import QFont
from PySide2.QtGui import (QIcon, QPixmap)
from PySide2.QtWidgets import (QFrame, QHBoxLayout, QLabel, QLayout, QLineEdit, QPushButton,
QSizePolicy, QVBoxLayout, QWidget)
from model import view_size_constants
QSizePolicy, QWidget)
class SearchFilterWidget(object):
"""SearchFilterWidget is composed of search icon and search text input"""
def __init__(self, parent, placeholder_text: str, label_rect: QRect, input_width: int) -> None:
super().__init__()
class SearchFilterLineEdit(QLineEdit):
"""SearchFilterLineEdit is composed of search icon and search text input"""
def __init__(self, parent, placeholder_text: str) -> None:
super().__init__(parent)
# TODO: unicode set up for now, will replace with icon
self._search_filter_label: QLabel = QLabel(parent)
self._search_filter_label.setObjectName("SearchTextLabel")
self._search_filter_label.setText("🔎")
font: QFont = self._search_filter_label.font()
font.setPointSize(view_size_constants.ICON_FRONT_SIZE) # temp value, will remove once replace with icon
self._search_filter_label.setFont(font)
self._search_filter_label.setGeometry(label_rect)
# TODO: revise this front end to be user friendly
self._search_filter_input: QLineEdit = QLineEdit(parent)
self._search_filter_input.setObjectName("SearchTextInput")
self._search_filter_input.setPlaceholderText(placeholder_text)
self._search_filter_input.setGeometry(label_rect.x() + label_rect.width(),
label_rect.y(), input_width, label_rect.height())
self._search_filter_input.home(True)
self._search_filter_input.deselect()
@property
def search_filter_input(self) -> QLineEdit:
return self._search_filter_input
search_icon: QIcon = QIcon(":/stylesheet/img/search-dark.svg")
self.addAction(search_icon, QLineEdit.LeadingPosition)
self.setPlaceholderText(placeholder_text)
self.home(True)
self.deselect()
class NotificationFrame(QFrame):
def __init__(self, parent: QWidget, title: str = "",
icon_size: int = view_size_constants.ICON_FRONT_SIZE,
cancel_size: int = view_size_constants.INTERACTION_COMPONENT_HEIGHT) -> None:
"""NotificationFrame is composed of information icon, notification title and close icon"""
def __init__(self, parent: QWidget, pixmap: QPixmap, title: str, closeable: bool) -> None:
super().__init__(parent)
self.setObjectName("AzQtComponents--CardNotification")
self.setObjectName("NotificationFrame")
self.setSizePolicy(QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Maximum))
self.setFrameStyle(QFrame.StyledPanel | QFrame.Plain)
header_frame: QFrame = QFrame(self)
header_frame.setObjectName("HeaderFrame")
header_frame.setSizePolicy(QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Maximum))
icon_label: QLabel = QLabel(self)
icon_label.setPixmap(pixmap)
# TODO: unicode set up for now, will replace with icon
icon_label: QLabel = QLabel(header_frame)
icon_label.setObjectName("Icon")
icon_label.setText("🛈")
font: QFont = icon_label.font()
font.setPointSize(icon_size)
icon_label.setFont(font)
self._title_label: QLabel = QLabel(title, header_frame)
self._title_label: QLabel = QLabel(title, self)
self._title_label.setObjectName("Title")
self._title_label.setSizePolicy(QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed))
self._title_label.setSizePolicy(QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Preferred))
self._title_label.setWordWrap(True)
cancel_button: QPushButton = QPushButton("CancelButton", header_frame)
cancel_button.setText("🗙")
font: QFont = cancel_button.font()
font.setPointSize(icon_size)
cancel_button.setFont(font)
cancel_button.setMaximumSize(cancel_size, cancel_size)
cancel_button.clicked.connect(self.hide)
header_layout: QHBoxLayout = QHBoxLayout(header_frame)
header_layout: QHBoxLayout = QHBoxLayout(self)
header_layout.setSizeConstraint(QLayout.SetMinimumSize)
header_layout.setContentsMargins(0, 0, 0, 0)
header_layout.addWidget(icon_label)
header_layout.addWidget(self._title_label)
header_layout.addWidget(cancel_button)
header_frame.setLayout(header_layout)
if closeable:
cancel_button: QPushButton = QPushButton(self)
cancel_button.setIcon(QIcon(":/stylesheet/img/close.svg"))
cancel_button.setFlat(True)
cancel_button.clicked.connect(self.hide)
header_layout.addWidget(cancel_button)
self.setLayout(header_layout)
feature_layout: QVBoxLayout = QVBoxLayout(self)
feature_layout.setSizeConstraint(QLayout.SetMinimumSize)
feature_layout.setContentsMargins(0, 0, 0, 0)
feature_layout.addWidget(header_frame)
self.setVisible(False)
def hide(self) -> None:
self._title_label.setText("")
self.setVisible(False)
def set_text(self, text: str) -> None:
self._title_label.setText(text)
self.setVisible(True)
class NotificationPrompt(QWidget):
def __init__(self, parent: QWidget, prompt_rect: QRect, button_size: QSize) -> None:
super().__init__(parent)
self.setObjectName("NotificationPrompt")
self.setSizePolicy(QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding))
self.setGeometry(prompt_rect)
notification_prompt_label: QLabel = \
QLabel("Unable to locate a resource mapping config file. "
"We can either make this file for you or you can rescan your directory")
notification_prompt_label.setObjectName("NotificationPromptLabel")
notification_prompt_label.setSizePolicy(QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding))
notification_prompt_label.setWordWrap(True)
notification_prompt_label.setAlignment(Qt.AlignCenter)
notification_prompt_interactions: QWidget = QWidget(self)
notification_prompt_interactions.setObjectName("NotificationInteractions")
notification_prompt_interactions.setSizePolicy(QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding))
self._create_new_button: QPushButton = QPushButton("Create New", notification_prompt_interactions)
self._create_new_button.setObjectName("CreateNewButton")
self._create_new_button.setMaximumSize(button_size)
self._rescan_button: QPushButton = QPushButton("Rescan", notification_prompt_interactions)
self._rescan_button.setObjectName("RescanButton")
self._rescan_button.setMaximumSize(button_size)
notification_prompt_interactions_layout: QHBoxLayout = QHBoxLayout(notification_prompt_interactions)
notification_prompt_interactions_layout.addWidget(self._create_new_button)
notification_prompt_interactions_layout.addWidget(self._rescan_button)
notification_prompt_interactions.setLayout(notification_prompt_interactions_layout)
feature_layout: QVBoxLayout = QVBoxLayout(self)
feature_layout.addWidget(notification_prompt_label)
feature_layout.addWidget(notification_prompt_interactions)
self.setVisible(False)
@property
def create_new_button(self) -> QPushButton:
return self._create_new_button
@property
def rescan_button(self) -> QPushButton:
return self._rescan_button
def set_visible(self, enabled: bool) -> None:
self.setVisible(enabled)
@@ -1,43 +0,0 @@
"""
All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
its licensors.
For complete copyright and license terms please see the LICENSE at the root of this
distribution (the "License"). All use of this software is governed by the License,
or, if provided, by the license below or the license accompanying this file. Do not
remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
"""
from typing import List
from PySide2.QtCore import (QItemSelectionModel, QModelIndex, QRect, Qt)
from PySide2.QtWidgets import (QAbstractItemView, QComboBox, QCommandLinkButton, QHeaderView, QLabel, QLineEdit,
QPushButton, QSizePolicy, QStackedWidget, QTreeView, QVBoxLayout, QWidget)
from model import constants
from model.resource_proxy_model import ResourceProxyModel
from model.resource_tree_model import (ResourceTreeConstants, ResourceTreeModel, ResourceTreeNode)
from view.common_view_components import SearchFilterWidget
class ConfigurationPage(QWidget):
"""
Configuration page, which includes all related Qt widgets to interact for
searching and importing resources
"""
def __init__(self) -> None:
super().__init__()
self.setObjectName("configurationPage")
self._page_vertical_layout: QVBoxLayout = QVBoxLayout(self)
self._page_vertical_layout.setObjectName("pageVerticalLayout")
self._page_vertical_layout.setGeometry(QRect(10, 20, 900, 560))
self._notification_group: QWidget = QWidget(self)
self._notification_label: QLabel = QLabel(self._notification_group)
size_policy = QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred)
size_policy.setHeightForWidth(self._notification_label.sizePolicy().hasHeightForWidth())
self._notification_label.setObjectName("notificationLabel")
self._notification_label.setText("Please select the root folder of your resource mapping config files")
self._page_vertical_layout.addWidget(self._notification_group)
@@ -10,14 +10,16 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
"""
from typing import List
from PySide2.QtCore import (QItemSelectionModel, QModelIndex, QRect, Qt)
from PySide2.QtWidgets import (QAbstractItemView, QComboBox, QHeaderView, QLabel, QLineEdit,
QPushButton, QStackedWidget, QTreeView, QVBoxLayout, QWidget)
from PySide2.QtCore import (QItemSelectionModel, QModelIndex)
from PySide2.QtGui import (QFont, QIcon, QPixmap)
from PySide2.QtWidgets import (QAbstractItemView, QComboBox, QFrame, QHBoxLayout, QHeaderView, QLabel, QLayout,
QLineEdit, QPushButton, QSizePolicy, QSpacerItem, QStackedWidget, QTreeView,
QVBoxLayout, QWidget)
from model import (constants, notification_label_text, view_size_constants)
from model.resource_proxy_model import ResourceProxyModel
from model.resource_tree_model import (ResourceTreeConstants, ResourceTreeModel, ResourceTreeNode)
from view.common_view_components import (NotificationFrame, SearchFilterWidget)
from view.common_view_components import (NotificationFrame, SearchFilterLineEdit)
class ImportResourcesPageConstants(object):
@@ -88,7 +90,6 @@ class ImportResourcesPage(QWidget):
"""
def __init__(self) -> None:
super().__init__()
self.setObjectName("ImportResourcePage")
self.setGeometry(0, 0,
view_size_constants.TOOL_APPLICATION_MAIN_WINDOW_WIDTH,
view_size_constants.TOOL_APPLICATION_MAIN_WINDOW_HEIGHT)
@@ -96,17 +97,19 @@ class ImportResourcesPage(QWidget):
self._search_version: str = ""
page_vertical_layout: QVBoxLayout = QVBoxLayout(self)
page_vertical_layout.setObjectName("PageVerticalLayout")
page_vertical_layout.setSpacing(0)
page_vertical_layout.setContentsMargins(view_size_constants.MAIN_PAGE_LAYOUT_MARGIN_LEFTRIGHT,
view_size_constants.MAIN_PAGE_LAYOUT_MARGIN_TOPBOTTOM,
view_size_constants.MAIN_PAGE_LAYOUT_MARGIN_LEFTRIGHT,
view_size_constants.MAIN_PAGE_LAYOUT_MARGIN_TOPBOTTOM)
page_vertical_layout.setSizeConstraint(QLayout.SetMinimumSize)
page_vertical_layout.setMargin(0)
self._setup_header_area()
page_vertical_layout.addWidget(self._header_area)
header_area_separator: QFrame = QFrame(self)
header_area_separator.setObjectName("SeparatorLine")
header_area_separator.setFrameShape(QFrame.HLine)
header_area_separator.setLineWidth(view_size_constants.HEADER_AREA_SEPARATOR_WIDTH)
page_vertical_layout.addWidget(header_area_separator)
self._notification_frame: NotificationFrame = NotificationFrame(self)
self._notification_frame: NotificationFrame = \
NotificationFrame(self, QPixmap(":/stylesheet/img/logging/information.svg"), "", True)
page_vertical_layout.addWidget(self._notification_frame)
self._setup_search_area()
@@ -117,116 +120,158 @@ class ImportResourcesPage(QWidget):
def _setup_header_area(self) -> None:
self._header_area: QWidget = QWidget(self)
self._header_area.setObjectName("HeaderArea")
self._header_area.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Minimum)
self._header_area.setMinimumSize(view_size_constants.TOOL_APPLICATION_MAIN_WINDOW_WIDTH,
view_size_constants.IMPORT_RESOURCES_PAGE_HEADER_AREA_HEIGHT)
header_area_layout: QHBoxLayout = QHBoxLayout(self._header_area)
header_area_layout.setSizeConstraint(QLayout.SetMinimumSize)
header_area_layout.setContentsMargins(
view_size_constants.MAIN_PAGE_LAYOUT_MARGIN_LEFTRIGHT,
view_size_constants.MAIN_PAGE_LAYOUT_MARGIN_TOPBOTTOM + view_size_constants.IMPORT_RESOURCES_PAGE_MARGIN_TOPBOTTOM,
view_size_constants.MAIN_PAGE_LAYOUT_MARGIN_LEFTRIGHT,
view_size_constants.MAIN_PAGE_LAYOUT_MARGIN_TOPBOTTOM)
self._back_button: QPushButton = QPushButton(self._header_area)
self._back_button.setObjectName("BackButton")
self._back_button.setText("Back")
self._back_button.setGeometry(0, 0,
view_size_constants.BACK_BUTTON_WIDTH,
view_size_constants.INTERACTION_COMPONENT_HEIGHT)
self._back_button.setObjectName("Secondary")
self._back_button.setText(f" {notification_label_text.IMPORT_RESOURCES_PAGE_BACK_TEXT}")
self._back_button.setIcon(QIcon(":/Breadcrumb/img/UI20/Breadcrumb/arrow_left-default.svg"))
self._back_button.setFlat(True)
self._back_button.setMinimumSize(view_size_constants.BACK_BUTTON_WIDTH,
view_size_constants.INTERACTION_COMPONENT_HEIGHT)
header_area_layout.addWidget(self._back_button)
header_area_spacer: QSpacerItem = QSpacerItem(view_size_constants.TOOL_APPLICATION_MAIN_WINDOW_WIDTH,
view_size_constants.INTERACTION_COMPONENT_HEIGHT,
QSizePolicy.Expanding, QSizePolicy.Minimum)
header_area_layout.addItem(header_area_spacer)
def _setup_search_area(self) -> None:
self._search_area: QWidget = QWidget(self)
self._search_area.setObjectName("SearchArea")
self._search_area.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Minimum)
self._search_area.setMinimumSize(view_size_constants.TOOL_APPLICATION_MAIN_WINDOW_WIDTH,
view_size_constants.IMPORT_RESOURCES_PAGE_SEARCH_AREA_HEIGHT)
search_area_layout: QHBoxLayout = QHBoxLayout(self._search_area)
search_area_layout.setSizeConstraint(QLayout.SetMinimumSize)
search_area_layout.setContentsMargins(view_size_constants.MAIN_PAGE_LAYOUT_MARGIN_LEFTRIGHT,
view_size_constants.IMPORT_RESOURCES_PAGE_MARGIN_TOPBOTTOM,
view_size_constants.MAIN_PAGE_LAYOUT_MARGIN_LEFTRIGHT,
view_size_constants.IMPORT_RESOURCES_PAGE_MARGIN_TOPBOTTOM)
self._setup_typed_resources_search_group()
search_area_layout.addWidget(self._typed_resources_search_group)
self._setup_cfn_stacks_search_group()
search_area_layout.addWidget(self._cfn_stacks_search_group)
search_area_spacer: QSpacerItem = QSpacerItem(view_size_constants.TOOL_APPLICATION_MAIN_WINDOW_WIDTH,
view_size_constants.INTERACTION_COMPONENT_HEIGHT,
QSizePolicy.Expanding, QSizePolicy.Minimum)
search_area_layout.addItem(search_area_spacer)
self._search_filter_line_edit: SearchFilterLineEdit = SearchFilterLineEdit(
self._search_area, notification_label_text.IMPORT_RESOURCES_PAGE_SEARCH_PLACEHOLDER_TEXT)
self._search_filter_line_edit.setMinimumSize(
view_size_constants.IMPORT_RESOURCES_PAGE_SEARCH_FILTER_WIDGET_WIDTH,
view_size_constants.INTERACTION_COMPONENT_HEIGHT)
search_area_layout.addWidget(self._search_filter_line_edit)
def _setup_typed_resources_search_group(self) -> None:
self._typed_resources_search_group: QWidget = QWidget(self._search_area)
self._typed_resources_search_group.setObjectName("ResourceTypeSearchGroup")
typed_resources_search_group_layout: QHBoxLayout = QHBoxLayout(self._typed_resources_search_group)
typed_resources_search_group_layout.setSizeConstraint(QLayout.SetMinimumSize)
typed_resources_search_group_layout.setContentsMargins(0, 0, 0, 0)
typed_resources_label: QLabel = QLabel(self._typed_resources_search_group)
typed_resources_label.setObjectName("ResourceTypeLabel")
typed_resources_label.setText("AWS Resource Type")
typed_resources_label.setGeometry(view_size_constants.TYPED_RESOURCES_LABEL_X,
view_size_constants.IMPORT_RESOURCES_PAGE_WIDGET_SUBCOMPONENT_Y,
view_size_constants.TYPED_RESOURCES_LABEL_WIDTH,
view_size_constants.INTERACTION_COMPONENT_HEIGHT)
typed_resources_label.setText(notification_label_text.IMPORT_RESOURCES_PAGE_AWS_SEARCH_TYPE_TEXT)
typed_resources_label_font: QFont = QFont()
typed_resources_label_font.setBold(True)
typed_resources_label.setFont(typed_resources_label_font)
typed_resources_label.setMinimumSize(view_size_constants.TYPED_RESOURCES_LABEL_WIDTH,
view_size_constants.INTERACTION_COMPONENT_HEIGHT)
typed_resources_search_group_layout.addWidget(typed_resources_label)
self._typed_resources_combobox: QComboBox = QComboBox(self._typed_resources_search_group)
self._typed_resources_combobox.setObjectName("ResourceTypeCombobox")
self._typed_resources_combobox.setLineEdit(QLineEdit())
self._typed_resources_combobox.lineEdit().setPlaceholderText("Please select")
self._typed_resources_combobox.lineEdit().setPlaceholderText(
notification_label_text.IMPORT_RESOURCES_PAGE_AWS_SEARCH_TYPE_PLACEHOLDER_TEXT)
self._typed_resources_combobox.lineEdit().setReadOnly(True)
self._typed_resources_combobox.setGeometry(view_size_constants.TYPED_RESOURCES_COMBOBOX_X,
view_size_constants.IMPORT_RESOURCES_PAGE_WIDGET_SUBCOMPONENT_Y,
view_size_constants.TYPED_RESOURCES_COMBOBOX_WIDTH,
view_size_constants.INTERACTION_COMPONENT_HEIGHT)
self._typed_resources_combobox.setMinimumSize(view_size_constants.TYPED_RESOURCES_COMBOBOX_WIDTH,
view_size_constants.INTERACTION_COMPONENT_HEIGHT)
self._typed_resources_combobox.addItems(constants.AWS_RESOURCE_TYPES)
self._typed_resources_combobox.setCurrentIndex(-1)
typed_resources_search_group_layout.addWidget(self._typed_resources_combobox)
typed_resources_search_group_separator_label: QLabel = QLabel(self._typed_resources_search_group)
typed_resources_search_group_separator_label.setPixmap(QPixmap(":/stylesheet/img/separator.png"))
typed_resources_search_group_layout.addWidget(typed_resources_search_group_separator_label)
self._typed_resources_search_button: QPushButton = QPushButton(self._typed_resources_search_group)
self._typed_resources_search_button.setObjectName("ResourceTypeSearchButton")
self._typed_resources_search_button.setText("Search")
self._typed_resources_search_button.setGeometry(view_size_constants.TYPED_RESOURCES_SEARCH_BUTTON_X,
view_size_constants.IMPORT_RESOURCES_PAGE_WIDGET_SUBCOMPONENT_Y,
view_size_constants.SEARCH_BUTTON_WIDTH,
view_size_constants.INTERACTION_COMPONENT_HEIGHT)
self._typed_resources_search_button.setObjectName("Secondary")
self._typed_resources_search_button.setText(notification_label_text.IMPORT_RESOURCES_PAGE_SEARCH_TEXT)
self._typed_resources_search_button.setMinimumSize(view_size_constants.SEARCH_BUTTON_WIDTH,
view_size_constants.INTERACTION_COMPONENT_HEIGHT)
typed_resources_search_group_layout.addWidget(self._typed_resources_search_button)
self._typed_resources_import_button = QPushButton(self._typed_resources_search_group)
self._typed_resources_import_button.setObjectName("ResourceTypeImportButton")
self._typed_resources_import_button.setText("Import")
self._typed_resources_import_button.setGeometry(view_size_constants.TYPED_RESOURCES_IMPORT_BUTTON_X,
view_size_constants.IMPORT_RESOURCES_PAGE_WIDGET_SUBCOMPONENT_Y,
view_size_constants.IMPORT_BUTTON_WIDTH,
view_size_constants.INTERACTION_COMPONENT_HEIGHT)
self._typed_resources_import_button.setObjectName("Primary")
self._typed_resources_import_button.setText(notification_label_text.IMPORT_RESOURCES_PAGE_IMPORT_TEXT)
self._typed_resources_import_button.setMinimumSize(view_size_constants.IMPORT_BUTTON_WIDTH,
view_size_constants.INTERACTION_COMPONENT_HEIGHT)
typed_resources_search_group_layout.addWidget(self._typed_resources_import_button)
self._typed_resources_search_group.setVisible(False)
def _setup_cfn_stacks_search_group(self) -> None:
self._cfn_stacks_search_group: QWidget = QWidget(self._search_area)
self._cfn_stacks_search_group.setObjectName("CfnSearchGroup")
cfn_stacks_search_group_layout: QHBoxLayout = QHBoxLayout(self._cfn_stacks_search_group)
cfn_stacks_search_group_layout.setSizeConstraint(QLayout.SetMinimumSize)
cfn_stacks_search_group_layout.setContentsMargins(0, 0, 0, 0)
self._cfn_stacks_search_button: QPushButton = QPushButton(self._cfn_stacks_search_group)
self._cfn_stacks_search_button.setObjectName("CfnSearchButton")
self._cfn_stacks_search_button.setText("Search")
self._cfn_stacks_search_button.setGeometry(view_size_constants.CFN_STACKS_SEARCH_BUTTON_X,
view_size_constants.IMPORT_RESOURCES_PAGE_WIDGET_SUBCOMPONENT_Y,
view_size_constants.SEARCH_BUTTON_WIDTH,
view_size_constants.INTERACTION_COMPONENT_HEIGHT)
self._cfn_stacks_search_button.setObjectName("Secondary")
self._cfn_stacks_search_button.setText(notification_label_text.IMPORT_RESOURCES_PAGE_SEARCH_TEXT)
self._cfn_stacks_search_button.setMinimumSize(view_size_constants.SEARCH_BUTTON_WIDTH,
view_size_constants.INTERACTION_COMPONENT_HEIGHT)
cfn_stacks_search_group_layout.addWidget(self._cfn_stacks_search_button)
self._cfn_stacks_import_button: QPushButton = QPushButton(self._cfn_stacks_search_group)
self._cfn_stacks_import_button.setObjectName("CfnImportButton")
self._cfn_stacks_import_button.setText("Import")
self._cfn_stacks_import_button.setGeometry(view_size_constants.CFN_STACKS_IMPORT_BUTTON_X,
view_size_constants.IMPORT_RESOURCES_PAGE_WIDGET_SUBCOMPONENT_Y,
view_size_constants.IMPORT_BUTTON_WIDTH,
view_size_constants.INTERACTION_COMPONENT_HEIGHT)
self._cfn_stacks_import_button.setObjectName("Primary")
self._cfn_stacks_import_button.setText(notification_label_text.IMPORT_RESOURCES_PAGE_IMPORT_TEXT)
self._cfn_stacks_import_button.setMinimumSize(view_size_constants.IMPORT_BUTTON_WIDTH,
view_size_constants.INTERACTION_COMPONENT_HEIGHT)
cfn_stacks_search_group_layout.addWidget(self._cfn_stacks_import_button)
self._cfn_stacks_search_group.setVisible(False)
self._search_filter_widget: SearchFilterWidget = \
SearchFilterWidget(self._search_area, notification_label_text.IMPORT_RESOURCES_PAGE_SEARCH_PLACEHOLDER_TEXT,
QRect(view_size_constants.IMPORT_RESOURCES_PAGE_SEARCH_FILTER_WIDGET_X,
view_size_constants.IMPORT_RESOURCES_PAGE_WIDGET_SUBCOMPONENT_Y,
view_size_constants.INTERACTION_COMPONENT_HEIGHT,
view_size_constants.INTERACTION_COMPONENT_HEIGHT),
view_size_constants.IMPORT_RESOURCES_PAGE_SEARCH_FILTER_WIDGET_WIDTH)
def _setup_view_area(self) -> None:
self._stacked_pages: QStackedWidget = QStackedWidget(self)
self._stacked_pages.setObjectName("StackedPages")
self._stacked_pages.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
self._stacked_pages.setMaximumSize(view_size_constants.TOOL_APPLICATION_MAIN_WINDOW_WIDTH,
view_size_constants.IMPORT_RESOURCES_PAGE_VIEW_AREA_HEIGHT)
notification_page: QWidget = QWidget()
notification_page.setObjectName("NotificationPage")
notification_page_label = QLabel(notification_page)
notification_page_label.setObjectName("NotificationLabel")
notification_page_label.setText("Loading ...")
notification_page_label.setGeometry(0, 0,
view_size_constants.TOOL_APPLICATION_MAIN_WINDOW_WIDTH,
view_size_constants.INTERACTION_COMPONENT_HEIGHT)
notification_page_label.setAlignment(Qt.AlignCenter)
self._stacked_pages.addWidget(notification_page)
self._stacked_pages.setContentsMargins(view_size_constants.MAIN_PAGE_LAYOUT_MARGIN_LEFTRIGHT, 0,
view_size_constants.MAIN_PAGE_LAYOUT_MARGIN_LEFTRIGHT, 0)
notification_page_frame: QFrame = \
NotificationFrame(self, QPixmap(":/stylesheet/img/32x32/info.png"),
notification_label_text.NOTIFICATION_LOADING_MESSAGE, False)
notification_page_frame.setFixedSize(
(view_size_constants.TOOL_APPLICATION_MAIN_WINDOW_WIDTH
- 2 * view_size_constants.MAIN_PAGE_LAYOUT_MARGIN_LEFTRIGHT),
view_size_constants.INTERACTION_COMPONENT_HEIGHT)
notification_page_frame.setVisible(True)
self._stacked_pages.addWidget(notification_page_frame)
tree_view_page: QWidget = QWidget(self)
tree_view_vertical_layout: QVBoxLayout = QVBoxLayout(tree_view_page)
tree_view_vertical_layout.setSizeConstraint(QLayout.SetMinimumSize)
tree_view_vertical_layout.setContentsMargins(0, 0, 0, 0)
tree_view_page: QWidget = QWidget()
tree_view_page.setObjectName("TreeViewPage")
self._tree_view: ResourceTreeView = ResourceTreeView(True, tree_view_page)
self._tree_view.setObjectName("TreeView")
self._tree_view.setGeometry(view_size_constants.IMPORT_RESOURCES_PAGE_TREE_VIEW_X, 0,
view_size_constants.IMPORT_RESOURCES_PAGE_TREE_VIEW_WIDTH,
view_size_constants.IMPORT_RESOURCES_PAGE_TREE_VIEW_HEIGHT)
self._tree_view.setAlternatingRowColors(True)
self._tree_view.setMaximumSize(view_size_constants.TOOL_APPLICATION_MAIN_WINDOW_WIDTH,
view_size_constants.IMPORT_RESOURCES_PAGE_TREE_VIEW_HEIGHT)
self._tree_view.setSelectionMode(QAbstractItemView.ExtendedSelection)
self._tree_view.setSortingEnabled(True)
@@ -234,6 +279,12 @@ class ImportResourcesPage(QWidget):
header.setSectionResizeMode(ResourceTreeConstants.TREE_NAME_OR_ID_COLUMN_INDEX, QHeaderView.Stretch)
header.setMaximumSectionSize(view_size_constants.RESOURCE_STACK_HEADER_CELL_MAXIMUM)
header.setMinimumSectionSize(view_size_constants.RESOURCE_STACK_HEADER_CELL_MINIMUM)
tree_view_vertical_layout.addWidget(self._tree_view)
tree_view_spacer: QSpacerItem = QSpacerItem(view_size_constants.TOOL_APPLICATION_MAIN_WINDOW_WIDTH,
view_size_constants.IMPORT_RESOURCES_PAGE_FOOTER_AREA_HEIGHT,
QSizePolicy.Expanding, QSizePolicy.Fixed)
tree_view_vertical_layout.addItem(tree_view_spacer)
self._stacked_pages.addWidget(tree_view_page)
self._stacked_pages.setCurrentIndex(1)
@@ -268,7 +319,7 @@ class ImportResourcesPage(QWidget):
@property
def search_filter_input(self) -> QLineEdit:
return self._search_filter_widget.search_filter_input
return self._search_filter_line_edit
@property
def search_version(self) -> str:
@@ -294,7 +345,8 @@ class ImportResourcesPage(QWidget):
self._stacked_pages.setCurrentIndex(index)
def hide_notification_frame(self) -> None:
self._notification_frame.hide()
self._notification_frame.setVisible(False)
def set_notification_frame_text(self, text: str) -> None:
self._notification_frame.set_text(text)
self._notification_frame.setVisible(True)
@@ -9,35 +9,33 @@ remove or modify any license notices. This file is distributed on an "AS IS" BAS
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
"""
from typing import List
from PySide2.QtCore import (QAbstractItemModel, QModelIndex, QObject, QRect, QSize, Qt)
from PySide2.QtGui import (QFont, QFontMetrics)
from PySide2.QtWidgets import (QAbstractItemDelegate, QAbstractItemView, QComboBox, QHeaderView, QLabel, QLineEdit,
QPushButton, QStackedWidget, QStyledItemDelegate, QStyleOptionViewItem,
QTableView, QVBoxLayout, QWidget)
from typing import (Dict, List)
from PySide2.QtCore import (QAbstractItemModel, QModelIndex, QObject, Qt)
from PySide2.QtGui import (QIcon, QFont, QFontMetrics, QPainter, QPixmap)
from PySide2.QtWidgets import (QAbstractItemDelegate, QAbstractItemView, QComboBox, QFrame, QHeaderView, QHBoxLayout,
QLabel, QLayout, QLineEdit, QPushButton, QSizePolicy, QSpacerItem, QStackedWidget,
QStyledItemDelegate, QStyleOptionViewItem, QTableView, QVBoxLayout, QWidget)
from model import (constants, notification_label_text, view_size_constants)
from model.resource_mapping_attributes import ResourceMappingAttributesStatus
from model.resource_proxy_model import ResourceProxyModel
from model.resource_table_model import (ResourceTableConstants, ResourceTableModel)
from view.common_view_components import (NotificationFrame, NotificationPrompt, SearchFilterWidget)
from view.common_view_components import (NotificationFrame, SearchFilterLineEdit)
class ViewEditPageConstants(object):
NOTIFICATION_PAGE_INDEX = 0
TABLE_VIEW_PAGE_INDEX = 1
NOTIFICATION_LOADING_TEXT: str = "Loading..."
NOTIFICATION_SELECT_CONFIG_FILE_TEXT: str = "Please select the Config file you would like to view and modify..."
class ComboboxItemDelegate(QStyledItemDelegate):
"""
Custom item delegate to present individual item as a combobox while
editing
"""
def __init__(self, parent: QObject, combobox_values: List[str]) -> None:
def __init__(self, parent: QObject) -> None:
super(ComboboxItemDelegate, self).__init__(parent)
self._combobox_values: List[str] = combobox_values
self._combobox_values: List[str] = constants.AWS_RESOURCE_REGIONS
def createEditor(self, parent: QWidget, option: QStyleOptionViewItem, index: QModelIndex) -> QWidget:
"""QStyledItemDelegate override"""
@@ -67,6 +65,29 @@ class ComboboxItemDelegate(QStyledItemDelegate):
self.closeEditor.emit(editor, QAbstractItemDelegate.NoHint)
class ImageDelegate(QStyledItemDelegate):
"""
Image delegate to draw image in table cell
"""
def __init__(self, parent: QObject) -> None:
super(ImageDelegate, self).__init__(parent)
self._icons: Dict[str, QIcon] = \
{ResourceMappingAttributesStatus.SUCCESS_STATUS_VALUE: QIcon(":/stylesheet/img/table_success.png"),
ResourceMappingAttributesStatus.MODIFIED_STATUS_VALUE: QIcon(":/stylesheet/img/table_warning.png"),
ResourceMappingAttributesStatus.FAILURE_STATUS_VALUE: QIcon(":/stylesheet/img/table_error.png")}
def get_icon(self, index: QModelIndex) -> QIcon:
current_text: str = index.data()
if current_text in self._icons.keys():
return self._icons[current_text]
return None
def paint(self, painter: QPainter, option: QStyleOptionViewItem, index: QModelIndex):
icon: QIcon = self.get_icon(index)
if icon:
icon.paint(painter, option.rect, Qt.AlignCenter)
class ResourceTableView(QTableView):
"""
Custom QTableView, which maintains custom resource table model to show
@@ -79,7 +100,9 @@ class ResourceTableView(QTableView):
self.setModel(self._resource_proxy_model)
self.setItemDelegateForColumn(ResourceTableConstants.TABLE_REGION_COLUMN_INDEX,
ComboboxItemDelegate(self, constants.AWS_RESOURCE_REGIONS))
ComboboxItemDelegate(self))
self.setItemDelegateForColumn(ResourceTableConstants.TABLE_STATE_COLUMN_INDEX,
ImageDelegate(self))
@property
def resource_proxy_model(self) -> ResourceProxyModel:
@@ -103,23 +126,24 @@ class ViewEditPage(QWidget):
"""
def __init__(self) -> None:
super().__init__()
self.setObjectName("ViewEditPage")
self.setGeometry(0, 0,
view_size_constants.TOOL_APPLICATION_MAIN_WINDOW_WIDTH,
view_size_constants.TOOL_APPLICATION_MAIN_WINDOW_HEIGHT)
page_vertical_layout: QVBoxLayout = QVBoxLayout(self)
page_vertical_layout.setObjectName("PageVerticalLayout")
page_vertical_layout.setSpacing(0)
page_vertical_layout.setContentsMargins(view_size_constants.MAIN_PAGE_LAYOUT_MARGIN_LEFTRIGHT,
view_size_constants.MAIN_PAGE_LAYOUT_MARGIN_TOPBOTTOM,
view_size_constants.MAIN_PAGE_LAYOUT_MARGIN_LEFTRIGHT,
view_size_constants.MAIN_PAGE_LAYOUT_MARGIN_TOPBOTTOM)
page_vertical_layout.setSizeConstraint(QLayout.SetMinimumSize)
page_vertical_layout.setMargin(0)
self._setup_header_area()
page_vertical_layout.addWidget(self._header_area)
header_area_separator: QFrame = QFrame(self)
header_area_separator.setObjectName("SeparatorLine")
header_area_separator.setFrameShape(QFrame.HLine)
header_area_separator.setLineWidth(view_size_constants.HEADER_AREA_SEPARATOR_WIDTH)
page_vertical_layout.addWidget(header_area_separator)
self._notification_frame: NotificationFrame = NotificationFrame(self)
self._notification_frame: NotificationFrame = \
NotificationFrame(self, QPixmap(":/stylesheet/img/logging/information.svg"), "", True)
page_vertical_layout.addWidget(self._notification_frame)
self._setup_center_area()
@@ -130,151 +154,152 @@ class ViewEditPage(QWidget):
def _setup_header_area(self) -> None:
self._header_area: QWidget = QWidget(self)
self._header_area.setObjectName("HeaderArea")
self._header_area.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Minimum)
self._header_area.setMinimumSize(view_size_constants.TOOL_APPLICATION_MAIN_WINDOW_WIDTH,
view_size_constants.VIEW_EDIT_PAGE_HEADER_FOOTER_AREA_HEIGHT)
view_size_constants.VIEW_EDIT_PAGE_HEADER_AREA_HEIGHT)
header_area_layout: QHBoxLayout = QHBoxLayout(self._header_area)
header_area_layout.setSizeConstraint(QLayout.SetMinimumSize)
header_area_layout.setContentsMargins(
view_size_constants.MAIN_PAGE_LAYOUT_MARGIN_LEFTRIGHT,
view_size_constants.MAIN_PAGE_LAYOUT_MARGIN_TOPBOTTOM + view_size_constants.VIEW_EDIT_PAGE_MARGIN_TOPBOTTOM,
view_size_constants.MAIN_PAGE_LAYOUT_MARGIN_LEFTRIGHT,
view_size_constants.MAIN_PAGE_LAYOUT_MARGIN_TOPBOTTOM)
config_file_label: QLabel = QLabel(self._header_area)
config_file_label.setObjectName("ConfigFileLabel")
config_file_label.setText("Config File:")
config_file_label.setGeometry(view_size_constants.CONFIG_FILE_LABEL_X,
view_size_constants.VIEW_EDIT_PAGE_WIDGET_SUBCOMPONENT_Y,
view_size_constants.CONFIG_FILE_LABEL_WIDTH,
view_size_constants.INTERACTION_COMPONENT_HEIGHT)
config_file_label.setText(notification_label_text.VIEW_EDIT_PAGE_CONFIG_FILE_TEXT)
config_file_label_font: QFont = QFont()
config_file_label_font.setBold(True)
config_file_label.setFont(config_file_label_font)
config_file_label.setMinimumSize(view_size_constants.CONFIG_FILE_LABEL_WIDTH,
view_size_constants.INTERACTION_COMPONENT_HEIGHT)
header_area_layout.addWidget(config_file_label)
self._config_file_combobox: QComboBox = QComboBox(self._header_area)
self._config_file_combobox.setObjectName("ConfigFileCombobox")
self._config_file_combobox.setLineEdit(QLineEdit())
self._config_file_combobox.lineEdit().setPlaceholderText(f"Found 0 config file")
self._config_file_combobox.lineEdit().setPlaceholderText(
notification_label_text.VIEW_EDIT_PAGE_CONFIG_FILES_PLACEHOLDER_TEXT.format(0))
self._config_file_combobox.lineEdit().setReadOnly(True)
self._config_file_combobox.setGeometry(view_size_constants.CONFIG_FILE_COMBOBOX_X,
view_size_constants.VIEW_EDIT_PAGE_WIDGET_SUBCOMPONENT_Y,
view_size_constants.CONFIG_FILE_COMBOBOX_WIDTH,
view_size_constants.INTERACTION_COMPONENT_HEIGHT)
self._config_file_combobox.setMinimumSize(view_size_constants.CONFIG_FILE_COMBOBOX_WIDTH,
view_size_constants.INTERACTION_COMPONENT_HEIGHT)
self._config_file_combobox.setCurrentIndex(-1)
header_area_layout.addWidget(self._config_file_combobox)
header_area_spacer: QSpacerItem = QSpacerItem(view_size_constants.TOOL_APPLICATION_MAIN_WINDOW_WIDTH,
view_size_constants.INTERACTION_COMPONENT_HEIGHT,
QSizePolicy.Expanding, QSizePolicy.Minimum)
header_area_layout.addItem(header_area_spacer)
config_location_label: QLabel = QLabel(self._header_area)
config_location_label.setObjectName("ConfigLocationLabel")
config_location_label.setText("Config Location:")
config_location_label.setGeometry(view_size_constants.CONFIG_LOCATION_LABEL_X,
view_size_constants.VIEW_EDIT_PAGE_WIDGET_SUBCOMPONENT_Y,
view_size_constants.CONFIG_LOCATION_LABEL_WIDTH,
view_size_constants.INTERACTION_COMPONENT_HEIGHT)
config_location_label.setText(notification_label_text.VIEW_EDIT_PAGE_CONFIG_LOCATION_TEXT)
config_location_label_font: QFont = QFont()
config_location_label_font.setBold(True)
config_location_label.setFont(config_location_label_font)
config_location_label.setMinimumSize(view_size_constants.CONFIG_LOCATION_LABEL_WIDTH,
view_size_constants.INTERACTION_COMPONENT_HEIGHT)
header_area_layout.addWidget(config_location_label)
self._config_location_text: QLabel = QLabel(self._header_area)
self._config_location_text.setObjectName("ConfigLocationText")
self._config_location_text.setToolTip("None config directory given")
self._config_location_text.setGeometry(view_size_constants.CONFIG_LOCATION_TEXT_X,
view_size_constants.VIEW_EDIT_PAGE_WIDGET_SUBCOMPONENT_Y,
view_size_constants.CONFIG_LOCATION_TEXT_WIDTH,
view_size_constants.INTERACTION_COMPONENT_HEIGHT)
self._config_location_text.setMinimumSize(view_size_constants.CONFIG_LOCATION_TEXT_WIDTH,
view_size_constants.INTERACTION_COMPONENT_HEIGHT)
header_area_layout.addWidget(self._config_location_text)
# TODO: unicode set up for now, will replace with icon
self._config_location_button: QPushButton = QPushButton(self._header_area)
self._config_location_button.setObjectName("ConfigLocationButton")
self._config_location_button.setText("📂")
font: QFont = self._config_location_button.font()
font.setPointSize(view_size_constants.ICON_FRONT_SIZE)
self._config_location_button.setFont(font)
self._config_location_button.setGeometry(view_size_constants.CONFIG_LOCATION_BUTTON_X,
view_size_constants.VIEW_EDIT_PAGE_WIDGET_SUBCOMPONENT_Y,
view_size_constants.INTERACTION_COMPONENT_HEIGHT,
view_size_constants.INTERACTION_COMPONENT_HEIGHT)
self._config_location_button.setIcon(QIcon(":/Gallery/Folder.svg"))
self._config_location_button.setFlat(True)
self._config_location_button.setMinimumSize(view_size_constants.INTERACTION_COMPONENT_HEIGHT,
view_size_constants.INTERACTION_COMPONENT_HEIGHT)
header_area_layout.addWidget(self._config_location_button)
def _setup_center_area(self) -> None:
self._stacked_pages: QStackedWidget = QStackedWidget(self)
self._stacked_pages.setObjectName("StackedPages")
self._stacked_pages.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
self._stacked_pages.setMaximumSize(view_size_constants.TOOL_APPLICATION_MAIN_WINDOW_WIDTH,
view_size_constants.VIEW_EDIT_PAGE_CENTER_AREA_HEIGHT)
self._stacked_pages.setContentsMargins(view_size_constants.MAIN_PAGE_LAYOUT_MARGIN_LEFTRIGHT, 0,
view_size_constants.MAIN_PAGE_LAYOUT_MARGIN_LEFTRIGHT, 0)
self._setup_notification_page()
self._stacked_pages.addWidget(self._notification_page)
self._stacked_pages.addWidget(self._notification_page_frame)
self._setup_table_view_page()
self._stacked_pages.addWidget(self._table_view_page)
def _setup_notification_page(self) -> None:
self._notification_page: QWidget = QWidget()
self._notification_page.setObjectName("NotificationPage")
self._notification_page_label: QLabel = QLabel(self._notification_page)
self._notification_page_label.setObjectName("NotificationLabel")
self._notification_page_label.setText("Loading ...")
self._notification_page_label.setGeometry(0, 0,
view_size_constants.TOOL_APPLICATION_MAIN_WINDOW_WIDTH,
view_size_constants.INTERACTION_COMPONENT_HEIGHT)
self._notification_page_label.setAlignment(Qt.AlignCenter)
self._notification_page_prompt: QWidget = \
NotificationPrompt(self._notification_page,
QRect(0, 0,
view_size_constants.TOOL_APPLICATION_MAIN_WINDOW_WIDTH,
view_size_constants.NOTIFICATION_PAGE_PROMPT_HEIGHT),
QSize(view_size_constants.NOTIFICATION_PAGE_PROMPT_BUTTON_WIDTH,
view_size_constants.INTERACTION_COMPONENT_HEIGHT))
self._notification_page_frame: QFrame = \
NotificationFrame(self, QPixmap(":/stylesheet/img/32x32/info.png"),
notification_label_text.NOTIFICATION_LOADING_MESSAGE, False)
self._notification_page_frame.setFixedSize(
(view_size_constants.TOOL_APPLICATION_MAIN_WINDOW_WIDTH
- 2 * view_size_constants.MAIN_PAGE_LAYOUT_MARGIN_LEFTRIGHT),
view_size_constants.INTERACTION_COMPONENT_HEIGHT)
self._notification_page_frame.setVisible(True)
def _setup_table_view_page(self) -> None:
self._table_view_page: QWidget = QWidget()
self._table_view_page.setObjectName("TableViewPage")
self._table_view_page: QWidget = QWidget(self)
table_view_vertical_layout: QVBoxLayout = QVBoxLayout(self._table_view_page)
table_view_vertical_layout.setObjectName("TableViewVerticalLayout")
table_view_vertical_layout.setSpacing(0)
table_view_vertical_layout.setSizeConstraint(QLayout.SetMinimumSize)
table_view_vertical_layout.setContentsMargins(0, 0, 0, 0)
interaction_area: QWidget = QWidget(self._table_view_page)
interaction_area.setObjectName("InteractionArea")
interaction_area.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Minimum)
interaction_area.setMinimumSize(view_size_constants.TOOL_APPLICATION_MAIN_WINDOW_WIDTH,
view_size_constants.TABLE_VIEW_PAGE_INTERACTION_AREA_HEIGHT)
interaction_area_layout: QHBoxLayout = QHBoxLayout(interaction_area)
interaction_area_layout.setSizeConstraint(QLayout.SetMinimumSize)
interaction_area_layout.setContentsMargins(0, view_size_constants.VIEW_EDIT_PAGE_MARGIN_TOPBOTTOM,
0, view_size_constants.VIEW_EDIT_PAGE_MARGIN_TOPBOTTOM)
self._add_row_button: QPushButton = QPushButton(interaction_area)
self._add_row_button.setObjectName("AddRowButton")
self._add_row_button.setText("Add Row")
self._add_row_button.setGeometry(view_size_constants.ADD_ROW_BUTTON_X, 0,
view_size_constants.ADD_ROW_BUTTON_WIDTH,
view_size_constants.INTERACTION_COMPONENT_HEIGHT)
self._add_row_button.setObjectName("Primary")
self._add_row_button.setText(notification_label_text.VIEW_EDIT_PAGE_ADD_ROW_TEXT)
self._add_row_button.setMinimumSize(view_size_constants.ADD_ROW_BUTTON_WIDTH,
view_size_constants.INTERACTION_COMPONENT_HEIGHT)
interaction_area_layout.addWidget(self._add_row_button)
self._delete_row_button: QPushButton = QPushButton(interaction_area)
self._delete_row_button.setObjectName("DeleteRowButton")
self._delete_row_button.setText("Delete Row")
self._delete_row_button.setGeometry(view_size_constants.DELETE_ROW_BUTTON_X, 0,
view_size_constants.DELETE_ROW_BUTTON_WIDTH,
view_size_constants.INTERACTION_COMPONENT_HEIGHT)
self._delete_row_button.setObjectName("Primary")
self._delete_row_button.setText(notification_label_text.VIEW_EDIT_PAGE_DELETE_ROW_TEXT)
self._delete_row_button.setMinimumSize(view_size_constants.DELETE_ROW_BUTTON_WIDTH,
view_size_constants.INTERACTION_COMPONENT_HEIGHT)
interaction_area_layout.addWidget(self._delete_row_button)
self._import_resources_label: QLabel = QLabel(interaction_area)
self._import_resources_label.setObjectName("ImportResourcesLabel")
self._import_resources_label.setText("Import")
self._import_resources_label.setGeometry(view_size_constants.IMPORT_RESOURCES_LABEL_X, 0,
view_size_constants.IMPORT_RESOURCES_LABEL_WIDTH,
view_size_constants.INTERACTION_COMPONENT_HEIGHT)
interaction_area_separator_label: QLabel = QLabel(interaction_area)
interaction_area_separator_label.setPixmap(QPixmap(":/stylesheet/img/separator.png"))
interaction_area_layout.addWidget(interaction_area_separator_label)
self._import_resources_combobox: QComboBox = QComboBox(interaction_area)
self._import_resources_combobox.setObjectName("ImportResourcesCombobox")
self._import_resources_combobox.setLineEdit(QLineEdit())
self._import_resources_combobox.lineEdit().setPlaceholderText("Please Select")
self._import_resources_combobox.lineEdit().setPlaceholderText(
notification_label_text.VIEW_EDIT_PAGE_IMPORT_RESOURCES_PLACEHOLDER_TEXT)
self._import_resources_combobox.lineEdit().setReadOnly(True)
self._import_resources_combobox.setGeometry(view_size_constants.IMPORT_RESOURCES_COMBOBOX_X, 0,
view_size_constants.IMPORT_RESOURCES_COMBOBOX_WIDTH,
view_size_constants.INTERACTION_COMPONENT_HEIGHT)
self._import_resources_combobox.setMinimumSize(view_size_constants.IMPORT_RESOURCES_COMBOBOX_WIDTH,
view_size_constants.INTERACTION_COMPONENT_HEIGHT)
self._import_resources_combobox.addItem(constants.SEARCH_TYPED_RESOURCES_VERSION)
self._import_resources_combobox.addItem(constants.SEARCH_CFN_STACKS_VERSION)
self._import_resources_combobox.setCurrentIndex(-1)
interaction_area_layout.addWidget(self._import_resources_combobox)
self._search_filter_widget: SearchFilterWidget = \
SearchFilterWidget(interaction_area, notification_label_text.VIEW_EDIT_PAGE_SEARCH_PLACEHOLDER_TEXT,
QRect(view_size_constants.TABLE_VIEW_PAGE_SEARCH_FILTER_WIDGET_X, 0,
view_size_constants.INTERACTION_COMPONENT_HEIGHT,
view_size_constants.INTERACTION_COMPONENT_HEIGHT),
view_size_constants.TABLE_VIEW_PAGE_SEARCH_FILTER_WIDGET_WIDTH)
interaction_area_spacer: QSpacerItem = QSpacerItem(
view_size_constants.TOOL_APPLICATION_MAIN_WINDOW_WIDTH, view_size_constants.INTERACTION_COMPONENT_HEIGHT,
QSizePolicy.Expanding, QSizePolicy.Minimum)
interaction_area_layout.addItem(interaction_area_spacer)
self._search_filter_line_edit: SearchFilterLineEdit = \
SearchFilterLineEdit(interaction_area, notification_label_text.VIEW_EDIT_PAGE_SEARCH_PLACEHOLDER_TEXT)
self._search_filter_line_edit.setMinimumSize(view_size_constants.TABLE_VIEW_PAGE_SEARCH_FILTER_WIDGET_WIDTH,
view_size_constants.INTERACTION_COMPONENT_HEIGHT)
interaction_area_layout.addWidget(self._search_filter_line_edit)
table_view_vertical_layout.addWidget(interaction_area)
self._table_view: ResourceTableView = ResourceTableView(self._table_view_page)
self._table_view.setObjectName("TableView")
self._table_view.setAlternatingRowColors(True)
self._table_view.setMaximumSize(view_size_constants.TOOL_APPLICATION_MAIN_WINDOW_WIDTH,
view_size_constants.TABLE_VIEW_PAGE_TABLE_VIEW_AREA_HEIGHT)
self._table_view.setSelectionBehavior(QAbstractItemView.SelectRows)
self._table_view.setSortingEnabled(True)
self._table_view.verticalHeader().hide()
horizontal_header: QHeaderView = self._table_view.horizontalHeader()
horizontal_header.setSectionResizeMode(ResourceTableConstants.TABLE_STATE_COLUMN_INDEX,
@@ -296,25 +321,50 @@ class ViewEditPage(QWidget):
def _setup_footer_area(self) -> None:
self._footer_area: QWidget = QWidget(self)
self._footer_area.setObjectName("FooterArea")
self._footer_area.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Minimum)
self._footer_area.setMinimumSize(view_size_constants.TOOL_APPLICATION_MAIN_WINDOW_WIDTH,
view_size_constants.VIEW_EDIT_PAGE_HEADER_FOOTER_AREA_HEIGHT)
view_size_constants.VIEW_EDIT_PAGE_FOOTER_AREA_HEIGHT)
footer_area_layout: QHBoxLayout = QHBoxLayout(self._footer_area)
footer_area_layout.setSizeConstraint(QLayout.SetMinimumSize)
footer_area_layout.setContentsMargins(
view_size_constants.MAIN_PAGE_LAYOUT_MARGIN_LEFTRIGHT,
view_size_constants.MAIN_PAGE_LAYOUT_MARGIN_TOPBOTTOM,
view_size_constants.MAIN_PAGE_LAYOUT_MARGIN_LEFTRIGHT,
view_size_constants.MAIN_PAGE_LAYOUT_MARGIN_TOPBOTTOM)
footer_area_spacer: QSpacerItem = QSpacerItem(view_size_constants.TOOL_APPLICATION_MAIN_WINDOW_WIDTH,
view_size_constants.INTERACTION_COMPONENT_HEIGHT,
QSizePolicy.Expanding, QSizePolicy.Minimum)
footer_area_layout.addItem(footer_area_spacer)
self._save_changes_button: QPushButton = QPushButton(self._footer_area)
self._save_changes_button.setObjectName("SaveChangesButton")
self._save_changes_button.setText("Save Changes")
self._save_changes_button.setGeometry(view_size_constants.SAVE_CHANGES_BUTTON_X,
view_size_constants.VIEW_EDIT_PAGE_WIDGET_SUBCOMPONENT_Y,
view_size_constants.SAVE_CHANGES_BUTTON_WIDTH,
view_size_constants.INTERACTION_COMPONENT_HEIGHT)
self._save_changes_button.setObjectName("Primary")
self._save_changes_button.setText(notification_label_text.VIEW_EDIT_PAGE_SAVE_CHANGES_TEXT)
self._save_changes_button.setMinimumSize(view_size_constants.SAVE_CHANGES_BUTTON_WIDTH,
view_size_constants.INTERACTION_COMPONENT_HEIGHT)
footer_area_layout.addWidget(self._save_changes_button)
self._create_new_button: QPushButton = QPushButton(self._footer_area)
self._create_new_button.setObjectName("Primary")
self._create_new_button.setText(notification_label_text.VIEW_EDIT_PAGE_CREATE_NEW_TEXT)
self._create_new_button.setMinimumSize(view_size_constants.CREATE_NEW_BUTTON_WIDTH,
view_size_constants.INTERACTION_COMPONENT_HEIGHT)
footer_area_layout.addWidget(self._create_new_button)
self._rescan_button: QPushButton = QPushButton(self._footer_area)
self._rescan_button.setObjectName("Secondary")
self._rescan_button.setText(notification_label_text.VIEW_EDIT_PAGE_RESCAN_TEXT)
self._rescan_button.setMinimumSize(view_size_constants.RESCAN_BUTTON_WIDTH,
view_size_constants.INTERACTION_COMPONENT_HEIGHT)
footer_area_layout.addWidget(self._rescan_button)
self._cancel_button: QPushButton = QPushButton(self._footer_area)
self._cancel_button.setObjectName("CancelButton")
self._cancel_button.setText("Cancel")
self._cancel_button.setGeometry(view_size_constants.CANCEL_BUTTON_X,
view_size_constants.VIEW_EDIT_PAGE_WIDGET_SUBCOMPONENT_Y,
view_size_constants.CANCEL_BUTTON_WIDTH,
view_size_constants.INTERACTION_COMPONENT_HEIGHT)
self._cancel_button.setObjectName("Secondary")
self._cancel_button.setText(notification_label_text.VIEW_EDIT_PAGE_CANCEL_TEXT)
self._cancel_button.setMinimumSize(view_size_constants.CANCEL_BUTTON_WIDTH,
view_size_constants.INTERACTION_COMPONENT_HEIGHT)
footer_area_layout.addWidget(self._cancel_button)
@property
def add_row_button(self) -> QPushButton:
@@ -350,15 +400,15 @@ class ViewEditPage(QWidget):
@property
def search_filter_input(self) -> QLineEdit:
return self._search_filter_widget.search_filter_input
return self._search_filter_line_edit
@property
def notification_prompt_create_new_button(self) -> QPushButton:
return self._notification_page_prompt.create_new_button
def create_new_button(self) -> QPushButton:
return self._create_new_button
@property
def notification_prompt_rescan_button(self) -> QPushButton:
return self._notification_page_prompt.rescan_button
def rescan_button(self) -> QPushButton:
return self._rescan_button
def set_current_main_view_index(self, index: int) -> None:
"""Switch main view page based on given index"""
@@ -381,15 +431,18 @@ class ViewEditPage(QWidget):
self._config_file_combobox.setItemData(config_index, config_file, Qt.ToolTipRole)
config_index += 1
self._config_file_combobox.lineEdit().setPlaceholderText(f"Found {len(config_files)} config files")
self._config_file_combobox.lineEdit().setPlaceholderText(
notification_label_text.VIEW_EDIT_PAGE_CONFIG_FILES_PLACEHOLDER_TEXT.format(len(config_files)))
self._config_file_combobox.setCurrentIndex(-1)
if config_files:
self._notification_page_label.setVisible(True)
self._notification_page_prompt.set_visible(False)
self._notification_page_frame.set_text(notification_label_text.VIEW_EDIT_PAGE_SELECT_CONFIG_FILE_MESSAGE)
self._create_new_button.setVisible(False)
self._rescan_button.setVisible(False)
else:
self._notification_page_label.setVisible(False)
self._notification_page_prompt.set_visible(True)
self._notification_page_frame.set_text(notification_label_text.VIEW_EDIT_PAGE_NO_CONFIG_FILE_FOUND_MESSAGE)
self._create_new_button.setVisible(True)
self._rescan_button.setVisible(True)
self._config_file_combobox.blockSignals(False)
@@ -403,13 +456,14 @@ class ViewEditPage(QWidget):
self._config_location_text.setToolTip(config_location)
def set_notification_page_text(self, text: str) -> None:
self._notification_page_label.setText(text)
self._notification_page_frame.set_text(text)
def hide_notification_frame(self) -> None:
self._notification_frame.hide()
self._notification_frame.setVisible(False)
def set_notification_frame_text(self, text: str) -> None:
self._notification_frame.set_text(text)
self._notification_frame.setVisible(True)
def set_table_view_page_interactions_enabled(self, enabled: bool) -> None:
self._table_view_page.setEnabled(enabled)
+2 -2
View File
@@ -11,7 +11,7 @@ The `cdk.json` file tells the CDK Toolkit how to execute your app.
This project is set up like a standard Python project. The initialization
process also creates a virtualenv within this project, stored under the `.env`
directory. To create the virtualenv it assumes that there is a `python3`
(or `python` for Windows) executable in your path with access to the `venv`
(or `python` for Windows) (Python 3.7+) executable in your path with access to the `venv`
package. If for any reason the automatic creation of the virtualenv fails,
you can create the virtualenv manually.
@@ -21,7 +21,7 @@ the prerequisites for CDK development.
To manually create a virtualenv on MacOS and Linux:
```
$ python3 -m venv .env
$ python -m venv .env
```
Once the virtualenv is created, you can use the following step to activate your virtualenv.
+3
View File
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:2027a80fce90e2497b1bc675592d3d9e50b00ecdbb375608f79287dbc83fc427
size 37530
+1 -1
View File
@@ -1,5 +1,5 @@
{
"app": "python3 app.py",
"app": "python app.py",
"context": {
"@aws-cdk/core:enableStackNameDuplicates": "true",
"aws-cdk:enableDiffNoFail": "true",
+1 -1
View File
@@ -26,7 +26,7 @@ class CoreStack(core.Stack):
Defines common resource project and group(s) to use in project
"""
# Resource groups cannot start with 'AWS' or 'aws' so preprend this prefix
# Resource groups cannot start with 'AWS' or 'aws' so add this prefix
RESOURCE_GROUP_PREFIX = 'O3D'
def __init__(self, scope: core.Construct, id_: str, project_name: str, feature_name: str, **kwargs) -> None:
@@ -23,7 +23,7 @@ import boto3
from boto3.dynamodb.table import TableResource
from botocore.exceptions import ClientError
logging.basicConfig(stream=sys.stdout, format="%(asctime)s %(process)d %(levelname)s %(message)s")
logging.basicConfig(stream=sys.stdout, format="%(asctime)s %(process)d %(message)s")
logger = logging.getLogger()
logger.setLevel(logging.INFO)
-1
View File
@@ -29,7 +29,6 @@ ly_add_target(
ly_add_target(
NAME AWSMetrics ${PAL_TRAIT_MONOLITHIC_DRIVEN_MODULE_TYPE}
NAMESPACE Gem
OUTPUT_NAME Gem.AWSMetrics.cc6fc7a18fc047039a369a26100fcbbe.0.1.0
FILES_CMAKE
awsmetrics_shared_files.cmake
INCLUDE_DIRECTORIES
@@ -15,35 +15,35 @@
namespace AWSMetrics
{
//! Default metrics attribute keys
static constexpr char METRICS_ATTRIBUTE_KEY_CLIENT_ID[] = "application_id";
static constexpr char METRICS_ATTRIBUTE_KEY_EVENT_ID[] = "event_id";
static constexpr char METRICS_ATTRIBUTE_KEY_EVENT_NAME[] = "event_name";
static constexpr char METRICS_ATTRIBUTE_KEY_EVENT_TYPE[] = "event_type";
static constexpr char METRICS_ATTRIBUTE_KEY_EVENT_SOURCE[] = "event_source";
static constexpr char METRICS_ATTRIBUTE_KEY_EVENT_TIMESTAMP[] = "event_timestamp";
static constexpr char AwsMetricsAttributeKeyClientId[] = "application_id";
static constexpr char AwsMetricsAttributeKeyEventId[] = "event_id";
static constexpr char AwsMetricsAttributeKeyEventName[] = "event_name";
static constexpr char AwsMetricsAttributeKeyEventType[] = "event_type";
static constexpr char AwsMetricsAttributeKeyEventSource[] = "event_source";
static constexpr char AwsMetricsAttributeKeyEventTimestamp[] = "event_timestamp";
static constexpr char METRICS_ATTRIBUTE_KEY_EVENT_DATA[] = "event_data";
static constexpr char AwsMetricsAttributeKeyEventData[] = "event_data";
//! Service API request and response object keys
static constexpr char SUCCESS_RESPONSE_RECORD_KEY_ERROR_CODE[] = "error_code";
static constexpr char SUCCESS_RESPONSE_RECORD_KEY_RESULT[] = "result";
static constexpr char SUCCESS_RESPONSE_KEY_FAILED_RECORD_COUNT[] = "failed_record_count";
static constexpr char SUCCESS_RESPONSE_KEY_EVENTS[] = "events";
static constexpr char SUCCESS_RESPONSE_KEY_TOTAL[] = "total";
static constexpr char ERROR_KEY_MESSAGE[] = "message";
static constexpr char ERROR_KEY_TYPE[] = "type";
static constexpr char REQUEST_PARAMETER_KEY_EVENTS[] = "events";
static constexpr char AwsMetricsSuccessResponseRecordKeyErrorCode[] = "error_code";
static constexpr char AwsMetricsSuccessResponseRecordKeyResult[] = "result";
static constexpr char AwsMetricsSuccessResponseKeyFailedRecordCount[] = "failed_record_count";
static constexpr char AwsMetricsSuccessResponseKeyEvents[] = "events";
static constexpr char AwsMetricsSuccessResponseKeyTotal[] = "total";
static constexpr char AwsMetricsErrorKeyMessage[] = "message";
static constexpr char AwsMetricsErrorKeyType[] = "type";
static constexpr char AwsMetricsRequestParameterKeyEvents[] = "events";
static constexpr char SUCCESS_RESPONSE_RECORD_RESULT[] = "Ok";
static constexpr char AwsMetricsSuccessResponseRecordResult[] = "Ok";
//! Service API limits
//! https://docs.aws.amazon.com/apigateway/latest/developerguide/limits.html
static constexpr int MAX_REST_API_PAYLOAD_SIZE_IN_MB = 10;
//! https://docs.aws.amazon.com/firehose/latest/APIReference/API_PutRecordBatch.html
static constexpr int MAX_FIREHOSE_BATCHED_RECORDS_COUNT = 500;
static constexpr int AwsMetricsMaxRestApiPayloadSizeInMb = 10;
//! https://docs.aws.amazon.com/kinesis/latest/APIReference/API_PutRecords.html
static constexpr int AwsMetricsMaxKinesisBatchedRecordCount = 500;
//! Metrics event JSON schema
static constexpr const char METRICS_EVENT_JSON_SCHEMA[] =
static constexpr const char AwsMetricsEventJsonSchema[] =
R"({
"$schema": "http://json-schema.org/draft-04/schema",
"title": "AWSMetrics API Event Schema",
@@ -0,0 +1,33 @@
/*
* All or portions of this file Copyright(c) Amazon.com, Inc.or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*/
#pragma once
#include <AzCore/Module/Module.h>
namespace AWSMetrics
{
class AWSMetricsModule
: public AZ::Module
{
public:
AZ_RTTI(AWSMetricsModule, "{A36566F3-E144-4188-A7E0-BAB45BCEA55F}", AZ::Module);
AZ_CLASS_ALLOCATOR(AWSMetricsModule, AZ::SystemAllocator, 0);
AWSMetricsModule();
~AWSMetricsModule() override = default;
/**
* Add required SystemComponents to the SystemEntity.
*/
virtual AZ::ComponentTypeList GetRequiredSystemComponents() const override;
};
}
@@ -15,8 +15,8 @@
namespace AWSMetrics
{
constexpr char metricsDir[] = "@user@/AWSMetrics/";
constexpr char metricsFileName[] = "metrics.json";
constexpr char AwsMetricsLocalFileDir[] = "@user@/AWSMetrics/";
constexpr char AwsMetricsLocalFileName[] = "metrics.json";
//! ClientConfiguration is used to retrieve and store client settings from a local configuration JSON file.
class ClientConfiguration
@@ -32,7 +32,7 @@ namespace AWSMetrics
class MetricsManager
{
public:
static const unsigned int desiredMaxWorkers = 2;
static const unsigned int DesiredMaxWorkers = 2;
MetricsManager();
~MetricsManager();
@@ -71,8 +71,6 @@ namespace AWSMetrics
//! @return Whether the metrics queue is created successfully.
bool ReadFromJson(const AZStd::string& filePath);
bool ReadFromString(const AZStd::string& string);
private:
bool ReadFromJsonDocument(rapidjson::Document& doc);
@@ -9,36 +9,24 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*/
#include <AWSMetricsModule.h>
#include <AWSMetricsSystemComponent.h>
#include <AzCore/Module/Module.h>
namespace AWSMetrics
{
class AWSMetricsModule
: public AZ::Module
AWSMetricsModule::AWSMetricsModule()
: AZ::Module()
{
public:
AZ_RTTI(AWSMetricsModule, "{A36566F3-E144-4188-A7E0-BAB45BCEA55F}", AZ::Module);
// Push results of [MyComponent]::CreateDescriptor() into m_descriptors here.
m_descriptors.insert(m_descriptors.end(), {AWSMetricsSystemComponent::CreateDescriptor()});
}
AWSMetricsModule()
: AZ::Module()
{
// Push results of [MyComponent]::CreateDescriptor() into m_descriptors here.
m_descriptors.insert(m_descriptors.end(), {
AWSMetricsSystemComponent::CreateDescriptor()
});
}
/**
* Add required SystemComponents to the SystemEntity.
*/
AZ::ComponentTypeList GetRequiredSystemComponents() const
{
return AZ::ComponentTypeList{
azrtti_typeid<AWSMetricsSystemComponent>()
};
}
};
AZ::ComponentTypeList AWSMetricsModule::GetRequiredSystemComponents() const
{
return AZ::ComponentTypeList{azrtti_typeid<AWSMetricsSystemComponent>()};
}
}
// DO NOT MODIFY THIS LINE UNLESS YOU RENAME THE GEM
@@ -21,29 +21,29 @@ namespace AWSMetrics
{
bool MetricsEventSuccessResponseRecord::OnJsonKey(const char* key, AWSCore::JsonReader& reader)
{
if (strcmp(key, SUCCESS_RESPONSE_RECORD_KEY_ERROR_CODE) == 0) return reader.Accept(errorCode);
if (strcmp(key, AwsMetricsSuccessResponseRecordKeyErrorCode) == 0) return reader.Accept(errorCode);
if (strcmp(key, SUCCESS_RESPONSE_RECORD_KEY_RESULT) == 0) return reader.Accept(result);
if (strcmp(key, AwsMetricsSuccessResponseRecordKeyResult) == 0) return reader.Accept(result);
return reader.Ignore();
}
bool MetricsEventSuccessResponse::OnJsonKey(const char* key, AWSCore::JsonReader& reader)
{
if (strcmp(key, SUCCESS_RESPONSE_KEY_FAILED_RECORD_COUNT) == 0) return reader.Accept(failedRecordCount);
if (strcmp(key, AwsMetricsSuccessResponseKeyFailedRecordCount) == 0) return reader.Accept(failedRecordCount);
if (strcmp(key, SUCCESS_RESPONSE_KEY_EVENTS) == 0) return reader.Accept(events);
if (strcmp(key, AwsMetricsSuccessResponseKeyEvents) == 0) return reader.Accept(events);
if (strcmp(key, SUCCESS_RESPONSE_KEY_TOTAL) == 0) return reader.Accept(total);
if (strcmp(key, AwsMetricsSuccessResponseKeyTotal) == 0) return reader.Accept(total);
return reader.Ignore();
}
bool Error::OnJsonKey(const char* key, AWSCore::JsonReader& reader)
{
if (strcmp(key, ERROR_KEY_MESSAGE) == 0) return reader.Accept(message);
if (strcmp(key, AwsMetricsErrorKeyMessage) == 0) return reader.Accept(message);
if (strcmp(key, ERROR_KEY_TYPE) == 0) return reader.Accept(type);
if (strcmp(key, AwsMetricsErrorKeyType) == 0) return reader.Accept(type);
return reader.Ignore();
}
@@ -63,7 +63,7 @@ namespace AWSMetrics
ok = ok && writer.StartObject();
ok = ok && writer.Key(REQUEST_PARAMETER_KEY_EVENTS);
ok = ok && writer.Key(AwsMetricsRequestParameterKeyEvents);
ok = ok && data.SerializeToJson(writer);
ok = ok && writer.EndObject();
@@ -145,10 +145,10 @@ namespace AWSMetrics
const GlobalStatistics& stats = m_metricsManager->GetGlobalStatistics();
AZ_Printf("AWSMetrics", "Total number of metrics events sent to the backend: %u", stats.m_numEvents.load());
AZ_Printf("AWSMetrics", "Total number of metrics events sent to the backend successfully: %u", stats.m_numSuccesses.load());
AZ_Printf("AWSMetrics", "Total size of metrics events sent to the backend successfully: %u bytes", stats.m_sendSizeInBytes.load());
AZ_Printf("AWSMetrics", "Total number of metrics events failed to be processed by the backend: %u", stats.m_numErrors.load());
AZ_Printf("AWSMetrics", "Total number of metrics events sent to the backend/local file: %u", stats.m_numEvents.load());
AZ_Printf("AWSMetrics", "Total number of metrics events sent to the backend/local file successfully: %u", stats.m_numSuccesses.load());
AZ_Printf("AWSMetrics", "Total size of metrics events sent to the backend/local file successfully: %u bytes", stats.m_sendSizeInBytes.load());
AZ_Printf("AWSMetrics", "Total number of metrics events failed to be sent to the backend/local file: %u", stats.m_numErrors.load());
AZ_Printf("AWSMetrics", "Total number of metrics events which failed the JSON schema validation or reached the maximum number of retries : %u", stats.m_numDropped.load());
}
@@ -78,14 +78,14 @@ namespace AWSMetrics
}
char resolvedPath[AZ_MAX_PATH_LEN] = { 0 };
if (!fileIO->ResolvePath(metricsDir, resolvedPath, AZ_MAX_PATH_LEN))
if (!fileIO->ResolvePath(AwsMetricsLocalFileDir, resolvedPath, AZ_MAX_PATH_LEN))
{
AZ_Error("AWSMetrics", false, "Failed to resolve the metrics file directory");
return false;
}
m_metricsDir = resolvedPath;
if (!AzFramework::StringFunc::Path::Join(resolvedPath, metricsFileName, m_metricsFilePath))
if (!AzFramework::StringFunc::Path::Join(resolvedPath, AwsMetricsLocalFileName, m_metricsFilePath))
{
AZ_Error("AWSMetrics", false, "Failed to construct the metrics file path");
return false;
@@ -26,8 +26,8 @@ namespace AWSMetrics
AZStd::string IdentityProvider::GetEngineVersion()
{
static constexpr const char* ENGINE_CONFIG_FILE_PATH = "@root@/engine.json";
static constexpr const char* ENGINE_VERSION_JSON_KEY = "LumberyardVersion";
static constexpr const char* EngineConfigFilePath = "@root@/engine.json";
static constexpr const char* EngineVersionJsonKey = "LumberyardVersion";
AZ::IO::FileIOBase* fileIO = AZ::IO::FileIOBase::GetDirectInstance();
if (!fileIO)
@@ -37,7 +37,7 @@ namespace AWSMetrics
}
char resolvedPath[AZ_MAX_PATH_LEN] = { 0 };
if (!fileIO->ResolvePath(ENGINE_CONFIG_FILE_PATH, resolvedPath, AZ_MAX_PATH_LEN))
if (!fileIO->ResolvePath(EngineConfigFilePath, resolvedPath, AZ_MAX_PATH_LEN))
{
AZ_Error("AWSMetrics", false, "Failed to resolve the engine config file directory");
return "";
@@ -52,7 +52,7 @@ namespace AWSMetrics
}
rapidjson_ly::Document& jsonDoc = readOutcome.GetValue();
auto memberIt = jsonDoc.FindMember(ENGINE_VERSION_JSON_KEY);
auto memberIt = jsonDoc.FindMember(EngineVersionJsonKey);
if (memberIt != jsonDoc.MemberEnd())
{
return memberIt->value.GetString();
@@ -53,9 +53,9 @@ namespace AWSMetrics
{
static const AZStd::array<AZStd::string, 7> DefaultAttributeNames =
{
METRICS_ATTRIBUTE_KEY_CLIENT_ID, METRICS_ATTRIBUTE_KEY_EVENT_ID,
METRICS_ATTRIBUTE_KEY_EVENT_NAME, METRICS_ATTRIBUTE_KEY_EVENT_TYPE,
METRICS_ATTRIBUTE_KEY_EVENT_SOURCE, METRICS_ATTRIBUTE_KEY_EVENT_TIMESTAMP
AwsMetricsAttributeKeyClientId, AwsMetricsAttributeKeyEventId,
AwsMetricsAttributeKeyEventName, AwsMetricsAttributeKeyEventType,
AwsMetricsAttributeKeyEventSource, AwsMetricsAttributeKeyEventTimestamp
};
m_isDefault = AZStd::find(DefaultAttributeNames.begin(), DefaultAttributeNames.end(), name) != DefaultAttributeNames.end();
+3 -3
View File
@@ -92,7 +92,7 @@ namespace AWSMetrics
if (customAttributes.size() > 0)
{
// Wrap up the cutom event attributes in a separate event_data field
ok = ok && writer.Key(METRICS_ATTRIBUTE_KEY_EVENT_DATA);
ok = ok && writer.Key(AwsMetricsAttributeKeyEventData);
ok = ok && writer.StartObject();
for (const auto& attr : customAttributes)
{
@@ -117,7 +117,7 @@ namespace AWSMetrics
int attributeIndex = 0;
for (auto it = metricsObjVal.MemberBegin(); it != metricsObjVal.MemberEnd(); ++it, ++attributeIndex)
{
if (strcmp(it->name.GetString(), METRICS_ATTRIBUTE_KEY_EVENT_DATA) == 0)
if (strcmp(it->name.GetString(), AwsMetricsAttributeKeyEventData) == 0)
{
// The event_data field contains a flat json dictionary.
// Read the JSON value of this field to add all the custom metrics attributes.
@@ -161,7 +161,7 @@ namespace AWSMetrics
}
rapidjson::Document jsonSchemaDocument;
if (jsonSchemaDocument.Parse(METRICS_EVENT_JSON_SCHEMA).HasParseError())
if (jsonSchemaDocument.Parse(AwsMetricsEventJsonSchema).HasParseError())
{
AZ_Error("AWSMetrics", false, "Invalid metrics event json schema.");
return false;
@@ -41,19 +41,19 @@ namespace AWSMetrics
void MetricsEventBuilder::AddClientIdAttribute(const AZStd::string& clientId)
{
m_currentMetricsEvent.AddAttribute(MetricsAttribute(METRICS_ATTRIBUTE_KEY_CLIENT_ID, clientId));
m_currentMetricsEvent.AddAttribute(MetricsAttribute(AwsMetricsAttributeKeyClientId, clientId));
}
void MetricsEventBuilder::AddEventIdAttribute()
{
AZ::Uuid eventId = AZ::Uuid::Create();
m_currentMetricsEvent.AddAttribute(MetricsAttribute(METRICS_ATTRIBUTE_KEY_EVENT_ID, eventId.ToString<AZStd::string>()));
m_currentMetricsEvent.AddAttribute(MetricsAttribute(AwsMetricsAttributeKeyEventId, eventId.ToString<AZStd::string>()));
}
void MetricsEventBuilder::AddSourceAttribute(const AZStd::string& eventSourceOverride)
{
AZStd::string eventSource = eventSourceOverride.empty() ? DefaultMetricsSource : eventSourceOverride;
m_currentMetricsEvent.AddAttribute(MetricsAttribute(METRICS_ATTRIBUTE_KEY_EVENT_SOURCE, eventSource));
m_currentMetricsEvent.AddAttribute(MetricsAttribute(AwsMetricsAttributeKeyEventSource, eventSource));
}
void MetricsEventBuilder::AddTimestampAttribute()
@@ -64,7 +64,7 @@ namespace AWSMetrics
char buffer[50];
strftime(buffer, sizeof(buffer), "%FT%TZ", gmtime(&now));
m_currentMetricsEvent.AddAttribute(MetricsAttribute(METRICS_ATTRIBUTE_KEY_EVENT_TIMESTAMP, AZStd::string(buffer)));
m_currentMetricsEvent.AddAttribute(MetricsAttribute(AwsMetricsAttributeKeyEventTimestamp, AZStd::string(buffer)));
}
MetricsEventBuilder& MetricsEventBuilder::AddMetricsAttributes(const AZStd::vector<MetricsAttribute>& attributes)
@@ -84,7 +84,7 @@ namespace AWSMetrics
void MetricsManager::SetupJobContext()
{
// Avoid using the default job context since we will do blocking IO instead of CPU/memory intensive work
unsigned int numWorkerThreads = AZ::GetMin(desiredMaxWorkers, AZStd::thread::hardware_concurrency());
unsigned int numWorkerThreads = AZ::GetMin(DesiredMaxWorkers, AZStd::thread::hardware_concurrency());
AZ::JobManagerDesc jobDesc;
AZ::JobManagerThreadDesc threadDesc;
@@ -147,13 +147,13 @@ namespace AWSMetrics
else
{
// Constant used to convert size limit from MB to Bytes.
static constexpr int MB_TO_BYTES = 1000000;
static constexpr int MbToBytes = 1000000;
while (metricsQueue->GetNumMetrics() > 0)
{
// Break the metrics queue by the payload and records count limits. Make one or more service API requests to send all the buffered metrics.
MetricsQueue metricsEventsToProcess;
metricsQueue->PopBufferedEventsByServiceLimits(metricsEventsToProcess, MAX_REST_API_PAYLOAD_SIZE_IN_MB * MB_TO_BYTES, MAX_FIREHOSE_BATCHED_RECORDS_COUNT);
metricsQueue->PopBufferedEventsByServiceLimits(metricsEventsToProcess, AwsMetricsMaxRestApiPayloadSizeInMb * MbToBytes, AwsMetricsMaxKinesisBatchedRecordCount);
SendMetricsToServiceApiAsync(metricsEventsToProcess);
}
@@ -179,7 +179,7 @@ namespace AWSMetrics
for (int index = 0; index < numMetricsEventsInRequest; ++index)
{
ServiceAPI::MetricsEventSuccessResponseRecord responseRecord;
responseRecord.result = SUCCESS_RESPONSE_RECORD_RESULT;
responseRecord.result = AwsMetricsSuccessResponseRecordResult;
responseRecords.emplace_back(responseRecord);
}
@@ -244,7 +244,7 @@ namespace AWSMetrics
{
MetricsEvent metricsEvent = metricsEventsInRequest[index];
if (responseRecords.size() > 0 && responseRecords[index].result == SUCCESS_RESPONSE_RECORD_RESULT)
if (responseRecords.size() > 0 && responseRecords[index].result == AwsMetricsSuccessResponseRecordResult)
{
// The metrics event is sent to the backend successfully.
if (metricsEvent.GetNumFailures() == 0)
@@ -304,8 +304,6 @@ namespace AWSMetrics
AZ::Outcome<void, AZStd::string> MetricsManager::SendMetricsToFile(AZStd::shared_ptr<MetricsQueue> metricsQueue)
{
AZStd::string serializedPayload = metricsQueue->SerializeToJson();
AZStd::lock_guard<AZStd::mutex> lock(m_metricsFileMutex);
AZ::IO::FileIOBase* fileIO = AZ::IO::FileIOBase::GetDirectInstance();
@@ -330,7 +328,10 @@ namespace AWSMetrics
return AZ::Failure(AZStd::string{ "Failed to create metrics directory" });
}
existingMetricsEvents.ReadFromString(serializedPayload);
// Append a copy of the metrics queue in the request to the existing metrics events and keep the original submission order.
// Do not modify the metrics queue in the request directly for identifying the metrics events for retry on failure.
MetricsQueue metricsEventsInRequest = *metricsQueue;
existingMetricsEvents.AppendMetrics(metricsEventsInRequest);
AZStd::string serializedMetrics = existingMetricsEvents.SerializeToJson();
AZ::IO::HandleType fileHandle;
@@ -234,16 +234,4 @@ namespace AWSMetrics
return true;
}
bool MetricsQueue::ReadFromString(const AZStd::string& string)
{
auto result = AzFramework::FileFunc::ReadJsonFromString(string);
if (!result.IsSuccess() || !ReadFromJsonDocument(result.GetValue()))
{
AZ_Error("AWSMetrics", false, "The provided JSON string is invalid.");
return false;
}
return true;
}
}
@@ -51,8 +51,8 @@ namespace AWSMetrics
EXPECT_CALL(JsonReader, Accept(responseRecord.errorCode)).Times(1);
EXPECT_CALL(JsonReader, Ignore()).Times(1);
responseRecord.OnJsonKey(SUCCESS_RESPONSE_RECORD_KEY_RESULT, JsonReader);
responseRecord.OnJsonKey(SUCCESS_RESPONSE_RECORD_KEY_ERROR_CODE, JsonReader);
responseRecord.OnJsonKey(AwsMetricsSuccessResponseRecordKeyResult, JsonReader);
responseRecord.OnJsonKey(AwsMetricsSuccessResponseRecordKeyErrorCode, JsonReader);
responseRecord.OnJsonKey("other", JsonReader);
}
@@ -72,9 +72,9 @@ namespace AWSMetrics
EXPECT_CALL(JsonReader, Accept(::testing::An<AWSCore::JsonArrayHandler>())).Times(1);
EXPECT_CALL(JsonReader, Ignore()).Times(1);
response.OnJsonKey(SUCCESS_RESPONSE_KEY_FAILED_RECORD_COUNT, JsonReader);
response.OnJsonKey(SUCCESS_RESPONSE_KEY_TOTAL, JsonReader);
response.OnJsonKey(SUCCESS_RESPONSE_KEY_EVENTS, JsonReader);
response.OnJsonKey(AwsMetricsSuccessResponseKeyFailedRecordCount, JsonReader);
response.OnJsonKey(AwsMetricsSuccessResponseKeyTotal, JsonReader);
response.OnJsonKey(AwsMetricsSuccessResponseKeyEvents, JsonReader);
response.OnJsonKey("other", JsonReader);
}
@@ -88,8 +88,8 @@ namespace AWSMetrics
EXPECT_CALL(JsonReader, Accept(error.type)).Times(1);
EXPECT_CALL(JsonReader, Ignore()).Times(1);
error.OnJsonKey(ERROR_KEY_MESSAGE, JsonReader);
error.OnJsonKey(ERROR_KEY_TYPE, JsonReader);
error.OnJsonKey(AwsMetricsErrorKeyMessage, JsonReader);
error.OnJsonKey(AwsMetricsErrorKeyType, JsonReader);
error.OnJsonKey("other", JsonReader);
}
@@ -107,6 +107,6 @@ namespace AWSMetrics
AZStd::string bodyString;
std::istreambuf_iterator<AZStd::string::value_type> eos;
bodyString = AZStd::string{ std::istreambuf_iterator<AZStd::string::value_type>(*bodyContent), eos };
EXPECT_TRUE(bodyString.find(AZStd::string::format("{\"%s\":[{\"event_timestamp\":", REQUEST_PARAMETER_KEY_EVENTS)) != AZStd::string::npos);
EXPECT_TRUE(bodyString.find(AZStd::string::format("{\"%s\":[{\"event_timestamp\":", AwsMetricsRequestParameterKeyEvents)) != AZStd::string::npos);
}
}
@@ -21,21 +21,21 @@ namespace AWSMetrics
: public UnitTest::ScopedAllocatorSetupFixture
{
public:
const AZStd::string attrName = "name";
const AZStd::string strValue = "value";
const int intValue = 0;
const double doubleValue = 0.01;
const AZStd::string AttrName = "name";
const AZStd::string StrValue = "value";
const int IntValue = 0;
const double DoubleValue = 0.01;
};
TEST_F(MetricsAttributeTest, SetAttributeName_DefaultConstructor_Success)
{
MetricsAttribute attribute;
attribute.SetName(attrName.c_str());
attribute.SetName(AttrName.c_str());
ASSERT_EQ(attribute.GetName(), attrName);
ASSERT_EQ(attribute.GetName(), AttrName);
ASSERT_FALSE(attribute.IsDefault());
attribute.SetName(METRICS_ATTRIBUTE_KEY_EVENT_NAME);
attribute.SetName(AwsMetricsAttributeKeyEventName);
ASSERT_TRUE(attribute.IsDefault());
}
@@ -43,26 +43,26 @@ namespace AWSMetrics
{
MetricsAttribute attribute;
attribute.SetVal(strValue);
ASSERT_EQ(AZStd::get<AZStd::string>(attribute.GetVal()), strValue);
attribute.SetVal(StrValue);
ASSERT_EQ(AZStd::get<AZStd::string>(attribute.GetVal()), StrValue);
attribute.SetVal(intValue);
ASSERT_EQ(AZStd::get<int>(attribute.GetVal()), intValue);
attribute.SetVal(IntValue);
ASSERT_EQ(AZStd::get<int>(attribute.GetVal()), IntValue);
attribute.SetVal(doubleValue);
ASSERT_EQ(AZStd::get<double>(attribute.GetVal()), doubleValue);
attribute.SetVal(DoubleValue);
ASSERT_EQ(AZStd::get<double>(attribute.GetVal()), DoubleValue);
}
TEST_F(MetricsAttributeTest, GetSizeInBytes_SupportedAttributeTypes_Success)
{
MetricsAttribute strAttr(attrName, strValue);
ASSERT_EQ(strAttr.GetSizeInBytes(), sizeof(char) * (attrName.size() + strValue.size()));
MetricsAttribute strAttr(AttrName, StrValue);
ASSERT_EQ(strAttr.GetSizeInBytes(), sizeof(char) * (AttrName.size() + StrValue.size()));
MetricsAttribute intAttr(attrName, intValue);
ASSERT_EQ(intAttr.GetSizeInBytes(), sizeof(char) * attrName.size() + sizeof(int));
MetricsAttribute intAttr(AttrName, IntValue);
ASSERT_EQ(intAttr.GetSizeInBytes(), sizeof(char) * AttrName.size() + sizeof(int));
MetricsAttribute doubleAttr(attrName, doubleValue);
ASSERT_EQ(doubleAttr.GetSizeInBytes(), sizeof(char) * attrName.size() + sizeof(double));
MetricsAttribute doubleAttr(AttrName, DoubleValue);
ASSERT_EQ(doubleAttr.GetSizeInBytes(), sizeof(char) * AttrName.size() + sizeof(double));
}
TEST_F(MetricsAttributeTest, SerializeToJson_SupportedAttributeTypes_Success)
@@ -74,15 +74,15 @@ namespace AWSMetrics
AWSCore::JsonWriter doubleWriter{ jsonStream };
MetricsAttribute attribute;
attribute.SetName(attrName.c_str());
attribute.SetName(AttrName.c_str());
attribute.SetVal(strValue);
attribute.SetVal(StrValue);
ASSERT_TRUE(attribute.SerializeToJson(strWriter));
attribute.SetVal(intValue);
attribute.SetVal(IntValue);
ASSERT_TRUE(attribute.SerializeToJson(intWriter));
attribute.SetVal(doubleValue);
attribute.SetVal(DoubleValue);
ASSERT_TRUE(attribute.SerializeToJson(doubleWriter));
}
@@ -91,13 +91,13 @@ namespace AWSMetrics
MetricsAttribute attribute;
rapidjson::Value nameVal(rapidjson::kStringType);
nameVal.SetString(rapidjson::StringRef(attrName.c_str()));
nameVal.SetString(rapidjson::StringRef(AttrName.c_str()));
rapidjson::Value strVal(rapidjson::kStringType);
nameVal.SetString(rapidjson::StringRef(strValue.c_str()));
nameVal.SetString(rapidjson::StringRef(StrValue.c_str()));
rapidjson::Value intVal(rapidjson::kNumberType);
intVal.SetInt(intValue);
intVal.SetInt(IntValue);
rapidjson::Value doubleVal(rapidjson::kNumberType);
doubleVal.SetDouble(doubleValue);
doubleVal.SetDouble(DoubleValue);
ASSERT_TRUE(attribute.ReadFromJson(nameVal, strVal));
ASSERT_EQ(attribute.GetName(), nameVal.GetString());
@@ -115,7 +115,7 @@ namespace AWSMetrics
MetricsAttribute attribute;
rapidjson::Value nameVal(rapidjson::kStringType);
nameVal.SetString(rapidjson::StringRef(attrName.c_str()));
nameVal.SetString(rapidjson::StringRef(AttrName.c_str()));
rapidjson::Value arrayVal(rapidjson::kArrayType);
ASSERT_FALSE(attribute.ReadFromJson(nameVal, arrayVal));
@@ -21,11 +21,11 @@ namespace AWSMetrics
{
public:
//! Default attributes include client id, timestamp, event id and event source.
const int numDefaultMetrics = 4;
const int numProvidedMetrics = 10;
const AZStd::string attrName = "name";
const AZStd::string attrValue = "value";
const AZStd::string fakeClientId = "FakeClientId";
const int NumDefaultMetrics = 4;
const int NumProvidedMetrics = 10;
const AZStd::string AttrName = "name";
const AZStd::string AttrValue = "value";
const AZStd::string FakeClientId = "fakeClientId";
void SetUp() override
{
@@ -45,23 +45,23 @@ namespace AWSMetrics
TEST_F(MetricsEventBuilderTest, BuildMetricsEvent_DefaultAttributes_Success)
{
MetricsEvent metricsEvent = m_metricsEventBuilder->AddDefaultMetricsAttributes(fakeClientId).Build();
MetricsEvent metricsEvent = m_metricsEventBuilder->AddDefaultMetricsAttributes(FakeClientId).Build();
ASSERT_EQ(metricsEvent.GetNumAttributes(), numDefaultMetrics);
ASSERT_EQ(metricsEvent.GetNumAttributes(), NumDefaultMetrics);
}
TEST_F(MetricsEventBuilderTest, BuildMetricsEvent_ProvidedAttributes_Success)
{
AZStd::vector<MetricsAttribute> metricsAttributes;
for (int index = 0; index < numProvidedMetrics; ++index)
for (int index = 0; index < NumProvidedMetrics; ++index)
{
metricsAttributes.emplace_back(MetricsAttribute(AZStd::string::format("%s%i", attrName.c_str(), index), attrValue));
metricsAttributes.emplace_back(MetricsAttribute(AZStd::string::format("%s%i", AttrName.c_str(), index), AttrValue));
}
MetricsEvent metricsEvent = m_metricsEventBuilder->AddMetricsAttributes(metricsAttributes).Build();
// Timestamp attribute will be added during creation automatically.
ASSERT_EQ(metricsEvent.GetNumAttributes(), numProvidedMetrics + 1);
ASSERT_EQ(metricsEvent.GetNumAttributes(), NumProvidedMetrics + 1);
}
TEST_F(MetricsEventBuilderTest, BuildMetricsEvent_SetMetricsPriority_Success)
+23 -23
View File
@@ -21,31 +21,31 @@ namespace AWSMetrics
: public UnitTest::ScopedAllocatorSetupFixture
{
public:
static constexpr int NUM_TEST_METRICS = 10;
static const char* const ATTR_NAME;
static const char* const ATTR_VALUE;
static constexpr int NumTestMetrics = 10;
static const char* const AttrName;
static const char* const AttrValue;
AZStd::vector<MetricsAttribute> GetRequiredMetricsAttributes()
{
AZStd::vector<MetricsAttribute> result;
result.emplace_back(MetricsAttribute(METRICS_ATTRIBUTE_KEY_CLIENT_ID, "0.0.0.0-{00000000-0000-1000-A000-000000000000}"));
result.emplace_back(MetricsAttribute(METRICS_ATTRIBUTE_KEY_EVENT_ID, "{00000000-0000-1000-A000-000000000000}"));
result.emplace_back(MetricsAttribute(METRICS_ATTRIBUTE_KEY_EVENT_NAME, "test_event"));
result.emplace_back(MetricsAttribute(METRICS_ATTRIBUTE_KEY_EVENT_TIMESTAMP, "0000-00-00T00:00:00Z"));
result.emplace_back(MetricsAttribute(AwsMetricsAttributeKeyClientId, "0.0.0.0-{00000000-0000-1000-A000-000000000000}"));
result.emplace_back(MetricsAttribute(AwsMetricsAttributeKeyEventId, "{00000000-0000-1000-A000-000000000000}"));
result.emplace_back(MetricsAttribute(AwsMetricsAttributeKeyEventName, "test_event"));
result.emplace_back(MetricsAttribute(AwsMetricsAttributeKeyEventTimestamp, "0000-00-00T00:00:00Z"));
return AZStd::move(result);
}
};
const char* const MetricsEventTest::ATTR_NAME = "name";
const char* const MetricsEventTest::ATTR_VALUE = "value";
const char* const MetricsEventTest::AttrName = "name";
const char* const MetricsEventTest::AttrValue = "value";
TEST_F(MetricsEventTest, AddAttribute_SingleAttribute_Success)
{
MetricsEvent metrics;
int numAttributes = metrics.GetNumAttributes();
metrics.AddAttribute(MetricsAttribute(ATTR_NAME, ATTR_VALUE));
metrics.AddAttribute(MetricsAttribute(AttrName, AttrValue));
ASSERT_EQ(metrics.GetNumAttributes(), numAttributes + 1);
}
@@ -55,9 +55,9 @@ namespace AWSMetrics
MetricsEvent metrics;
int numAttributes = metrics.GetNumAttributes();
metrics.AddAttribute(MetricsAttribute(ATTR_NAME, ATTR_VALUE));
metrics.AddAttribute(MetricsAttribute(AttrName, AttrValue));
AZ_TEST_START_TRACE_SUPPRESSION;
metrics.AddAttribute(MetricsAttribute(ATTR_NAME, ATTR_VALUE));
metrics.AddAttribute(MetricsAttribute(AttrName, AttrValue));
AZ_TEST_STOP_TRACE_SUPPRESSION(1);
ASSERT_EQ(metrics.GetNumAttributes(), numAttributes + 1);
@@ -79,20 +79,20 @@ namespace AWSMetrics
{
MetricsEvent metrics;
AZStd::vector<MetricsAttribute> attributes;
for (int index = 0; index < NUM_TEST_METRICS; ++index)
for (int index = 0; index < NumTestMetrics; ++index)
{
attributes.emplace_back(MetricsAttribute(AZStd::string::format("%s%i", ATTR_NAME, index), ATTR_VALUE));
attributes.emplace_back(MetricsAttribute(AZStd::string::format("%s%i", AttrName, index), AttrValue));
}
metrics.AddAttributes(attributes);
ASSERT_EQ(metrics.GetNumAttributes(), NUM_TEST_METRICS);
ASSERT_EQ(metrics.GetNumAttributes(), NumTestMetrics);
}
TEST_F(MetricsEventTest, GetSizeInBytes_SingleAttribute_Success)
{
MetricsEvent metrics;
MetricsAttribute attribute(ATTR_NAME, ATTR_VALUE);
MetricsAttribute attribute(AttrName, AttrValue);
metrics.AddAttribute(attribute);
ASSERT_EQ(metrics.GetSizeInBytes(), attribute.GetSizeInBytes());
@@ -101,8 +101,8 @@ namespace AWSMetrics
TEST_F(MetricsEventTest, SerializeToJson_DefaultAndCustomAttributes_Success)
{
MetricsEvent metrics;
metrics.AddAttribute(MetricsAttribute(ATTR_NAME, ATTR_VALUE));
metrics.AddAttribute(MetricsAttribute(METRICS_ATTRIBUTE_KEY_EVENT_NAME, ATTR_VALUE));
metrics.AddAttribute(MetricsAttribute(AttrName, AttrValue));
metrics.AddAttribute(MetricsAttribute(AwsMetricsAttributeKeyEventName, AttrValue));
std::ostream stream(nullptr);
AWSCore::JsonOutputStream jsonStream{ stream };
@@ -117,11 +117,11 @@ namespace AWSMetrics
rapidjson::Document doc;
rapidjson::Value metricsObjVal(rapidjson::kObjectType);
metricsObjVal.AddMember(rapidjson::StringRef(METRICS_ATTRIBUTE_KEY_EVENT_NAME), rapidjson::StringRef(ATTR_VALUE), doc.GetAllocator());
metricsObjVal.AddMember(rapidjson::StringRef(AwsMetricsAttributeKeyEventName), rapidjson::StringRef(AttrValue), doc.GetAllocator());
rapidjson::Value customEventDataObjVal(rapidjson::kObjectType);
customEventDataObjVal.AddMember(rapidjson::StringRef(ATTR_NAME), rapidjson::StringRef(ATTR_VALUE), doc.GetAllocator());
metricsObjVal.AddMember(rapidjson::Value(METRICS_ATTRIBUTE_KEY_EVENT_DATA, doc.GetAllocator()).Move(),
customEventDataObjVal.AddMember(rapidjson::StringRef(AttrName), rapidjson::StringRef(AttrValue), doc.GetAllocator());
metricsObjVal.AddMember(rapidjson::Value(AwsMetricsAttributeKeyEventData, doc.GetAllocator()).Move(),
customEventDataObjVal.Move(), doc.GetAllocator());
ASSERT_TRUE(metrics.ReadFromJson(metricsObjVal));
@@ -146,10 +146,10 @@ namespace AWSMetrics
rapidjson::Document doc;
rapidjson::Value metricsObjVal(rapidjson::kObjectType);
metricsObjVal.AddMember(rapidjson::StringRef(METRICS_ATTRIBUTE_KEY_EVENT_NAME), rapidjson::StringRef(ATTR_VALUE), doc.GetAllocator());
metricsObjVal.AddMember(rapidjson::StringRef(AwsMetricsAttributeKeyEventName), rapidjson::StringRef(AttrValue), doc.GetAllocator());
rapidjson::Value customEventDataVal(rapidjson::kNumberType);
metricsObjVal.AddMember(rapidjson::Value(METRICS_ATTRIBUTE_KEY_EVENT_DATA, doc.GetAllocator()).Move(),
metricsObjVal.AddMember(rapidjson::Value(AwsMetricsAttributeKeyEventData, doc.GetAllocator()).Move(),
customEventDataVal.Move(), doc.GetAllocator());
AZ_TEST_START_TRACE_SUPPRESSION;
@@ -122,16 +122,16 @@ namespace AWSMetrics
{
public:
// Size for each test metrics event will be 180 bytes.
static constexpr int TEST_METRICS_EVENT_SIZE_IN_BYTES = 180;
static constexpr int MB_TO_BYTES = 1000000;
static constexpr int DEFAULT_FLUSH_PERIOD_IN_SECONDS = 1;
static constexpr int MAX_NUM_METRICS_EVENTS = 10;
static constexpr int TestMetricsEventSizeInBytes = 180;
static constexpr int MbToBytes = 1000000;
static constexpr int DefaultFlushPeriodInSeconds = 1;
static constexpr int MaxNumMetricsEvents = 10;
static constexpr int SLEEP_TIME_FOR_PROCESSING_IN_MS = 100;
static constexpr int SleepTimeForProcessingInMs = 100;
// Timeout for metrics events processing in milliseconds.
static constexpr int TIMEOUT_FOR_PROCESSING_IN_MS = DEFAULT_FLUSH_PERIOD_IN_SECONDS * MAX_NUM_METRICS_EVENTS * 1000;
static constexpr int TimeoutForProcessingInMs = DefaultFlushPeriodInSeconds * MaxNumMetricsEvents * 1000;
static const char* const ATTR_VALUE;
static const char* const AttrValue;
void SetUp() override
{
@@ -139,7 +139,7 @@ namespace AWSMetrics
AWSMetricsRequestBus::Handler::BusConnect();
m_metricsManager = AZStd::make_unique<MetricsManager>();
AZStd::string configFilePath = CreateClientConfigFile(true, (double) TEST_METRICS_EVENT_SIZE_IN_BYTES / MB_TO_BYTES * 2, DEFAULT_FLUSH_PERIOD_IN_SECONDS, 0);
AZStd::string configFilePath = CreateClientConfigFile(true, (double) TestMetricsEventSizeInBytes / MbToBytes * 2, DefaultFlushPeriodInSeconds, 0);
m_metricsManager->Init(configFilePath);
RemoveFile(m_metricsManager->GetMetricsFilePath());
@@ -213,10 +213,10 @@ namespace AWSMetrics
int processingTime = 0;
int numTotalRequests = 0;
while (processingTime < TIMEOUT_FOR_PROCESSING_IN_MS)
while (processingTime < TimeoutForProcessingInMs)
{
AZStd::this_thread::sleep_for(AZStd::chrono::milliseconds(SLEEP_TIME_FOR_PROCESSING_IN_MS));
processingTime += SLEEP_TIME_FOR_PROCESSING_IN_MS;
AZStd::this_thread::sleep_for(AZStd::chrono::milliseconds(SleepTimeForProcessingInMs));
processingTime += SleepTimeForProcessingInMs;
const GlobalStatistics& currentStats = m_metricsManager->GetGlobalStatistics();
currentNumProcessedEvents = currentStats.m_numEvents;
@@ -241,14 +241,14 @@ namespace AWSMetrics
AZ::IO::FileIOBase* m_fileIOMock;
};
const char* const MetricsManagerTest::ATTR_VALUE = "value";
const char* const MetricsManagerTest::AttrValue = "value";
TEST_F(MetricsManagerTest, SubmitMetrics_MaxFlushPeriod_SendToLocalFile)
{
m_metricsManager->StartMetrics();
AZStd::vector<MetricsAttribute> metricsAttributes;
metricsAttributes.emplace_back(AZStd::move(MetricsAttribute(METRICS_ATTRIBUTE_KEY_EVENT_NAME, ATTR_VALUE)));
metricsAttributes.emplace_back(AZStd::move(MetricsAttribute(AwsMetricsAttributeKeyEventName, AttrValue)));
bool result = false;
AWSMetricsRequestBus::BroadcastResult(result, &AWSMetricsRequests::SubmitMetrics, metricsAttributes, 0, "", true);
@@ -265,12 +265,12 @@ namespace AWSMetrics
TEST_F(MetricsManagerTest, SubmitMetrics_MaxQueueSize_SendToLocalFile)
{
// Reset the config file to change the max queue size and set a flush period larger than the timeout.
ResetClientConfig(true, 0.0, (TIMEOUT_FOR_PROCESSING_IN_MS + 1), 0);
ResetClientConfig(true, 0.0, (TimeoutForProcessingInMs + 1), 0);
m_metricsManager->StartMetrics();
AZStd::vector<MetricsAttribute> metricsAttributes;
metricsAttributes.emplace_back(AZStd::move(MetricsAttribute(METRICS_ATTRIBUTE_KEY_EVENT_NAME, ATTR_VALUE)));
metricsAttributes.emplace_back(AZStd::move(MetricsAttribute(AwsMetricsAttributeKeyEventName, AttrValue)));
bool result = false;
AWSMetricsRequestBus::BroadcastResult(result, &AWSMetricsRequests::SubmitMetrics, metricsAttributes, 0, "", true);
@@ -290,12 +290,12 @@ namespace AWSMetrics
AZStd::vector<AZStd::thread> producers;
for (int index = 0; index < MAX_NUM_METRICS_EVENTS; ++index)
for (int index = 0; index < MaxNumMetricsEvents; ++index)
{
producers.emplace_back(AZStd::thread([this, index]()
{
AZStd::vector<MetricsAttribute> metricsAttributes;
metricsAttributes.emplace_back(AZStd::move(MetricsAttribute(METRICS_ATTRIBUTE_KEY_EVENT_NAME, ATTR_VALUE)));
metricsAttributes.emplace_back(AZStd::move(MetricsAttribute(AwsMetricsAttributeKeyEventName, AttrValue)));
bool result = false;
// Submit metrics with or without buffer
@@ -311,12 +311,12 @@ namespace AWSMetrics
// Flush the metrics queue to send all the remaining buffered metrics
AWSMetricsRequestBus::Broadcast(&AWSMetricsRequests::FlushMetrics);
WaitForProcessing(MAX_NUM_METRICS_EVENTS);
WaitForProcessing(MaxNumMetricsEvents);
const GlobalStatistics& stats = m_metricsManager->GetGlobalStatistics();
EXPECT_EQ(stats.m_numEvents, MAX_NUM_METRICS_EVENTS);
EXPECT_EQ(stats.m_numSuccesses, MAX_NUM_METRICS_EVENTS);
EXPECT_EQ(stats.m_numEvents, MaxNumMetricsEvents);
EXPECT_EQ(stats.m_numSuccesses, MaxNumMetricsEvents);
EXPECT_EQ(stats.m_numErrors, 0);
EXPECT_EQ(stats.m_sendSizeInBytes, TEST_METRICS_EVENT_SIZE_IN_BYTES * MAX_NUM_METRICS_EVENTS);
EXPECT_EQ(stats.m_sendSizeInBytes, TestMetricsEventSizeInBytes * MaxNumMetricsEvents);
m_metricsManager->ShutdownMetrics();
}
@@ -342,7 +342,7 @@ namespace AWSMetrics
AZ::IO::FileIOBase::SetInstance(nullptr);
AZStd::vector<MetricsAttribute> metricsAttributes;
metricsAttributes.emplace_back(AZStd::move(MetricsAttribute(METRICS_ATTRIBUTE_KEY_EVENT_NAME, ATTR_VALUE)));
metricsAttributes.emplace_back(AZStd::move(MetricsAttribute(AwsMetricsAttributeKeyEventName, AttrValue)));
bool result = false;
AWSMetricsRequestBus::BroadcastResult(result, &AWSMetricsRequests::SubmitMetrics, metricsAttributes, 0, "", false);
@@ -355,20 +355,20 @@ namespace AWSMetrics
TEST_F(MetricsManagerTest, FlushMetrics_NonEmptyQueue_Success)
{
for (int index = 0; index < MAX_NUM_METRICS_EVENTS; ++index)
for (int index = 0; index < MaxNumMetricsEvents; ++index)
{
AZStd::vector<MetricsAttribute> metricsAttributes;
metricsAttributes.emplace_back(AZStd::move(MetricsAttribute(METRICS_ATTRIBUTE_KEY_EVENT_NAME, ATTR_VALUE)));
metricsAttributes.emplace_back(AZStd::move(MetricsAttribute(AwsMetricsAttributeKeyEventName, AttrValue)));
bool result = false;
AWSMetricsRequestBus::BroadcastResult(result, &AWSMetricsRequests::SubmitMetrics, metricsAttributes, 0, "", true);
ASSERT_TRUE(result);
}
ASSERT_EQ(m_metricsManager->GetNumBufferedMetrics(), MAX_NUM_METRICS_EVENTS);
ASSERT_EQ(m_metricsManager->GetNumBufferedMetrics(), MaxNumMetricsEvents);
AWSMetricsRequestBus::Broadcast(&AWSMetricsRequests::FlushMetrics);
WaitForProcessing(MAX_NUM_METRICS_EVENTS);
WaitForProcessing(MaxNumMetricsEvents);
ASSERT_EQ(m_notifications.m_numSuccessNotification, 1);
ASSERT_EQ(m_notifications.m_numFailureNotification, 0);
ASSERT_EQ(m_metricsManager->GetNumBufferedMetrics(), 0);
@@ -383,7 +383,7 @@ namespace AWSMetrics
m_metricsManager->UpdateOfflineRecordingStatus(true);
AZStd::vector<MetricsAttribute> metricsAttributes;
metricsAttributes.emplace_back(AZStd::move(MetricsAttribute(METRICS_ATTRIBUTE_KEY_EVENT_NAME, ATTR_VALUE)));
metricsAttributes.emplace_back(AZStd::move(MetricsAttribute(AwsMetricsAttributeKeyEventName, AttrValue)));
bool result = false;
AWSMetricsRequestBus::BroadcastResult(result, &AWSMetricsRequests::SubmitMetrics, metricsAttributes, 0, "", false);
@@ -404,12 +404,12 @@ namespace AWSMetrics
//! Wait for either timeout or the local metrics events are re-added to the buffer.
int processingTime = 0;
while (processingTime < TIMEOUT_FOR_PROCESSING_IN_MS && m_localFileIO->Exists(m_metricsManager->GetMetricsFilePath()))
while (processingTime < TimeoutForProcessingInMs && m_localFileIO->Exists(m_metricsManager->GetMetricsFilePath()))
{
AZStd::this_thread::sleep_for(AZStd::chrono::milliseconds(SLEEP_TIME_FOR_PROCESSING_IN_MS));
processingTime += SLEEP_TIME_FOR_PROCESSING_IN_MS;
AZStd::this_thread::sleep_for(AZStd::chrono::milliseconds(SleepTimeForProcessingInMs));
processingTime += SleepTimeForProcessingInMs;
}
ASSERT_EQ(m_metricsManager->GetNumBufferedMetrics(), 1);
ASSERT_FALSE(m_localFileIO->Exists(m_metricsManager->GetMetricsFilePath()));
@@ -419,15 +419,15 @@ namespace AWSMetrics
TEST_F(MetricsManagerTest, OnResponseReceived_WithResponseRecords_RetryFailedMetrics)
{
// Reset the config file to change the max queue size setting.
ResetClientConfig(false, (double)TEST_METRICS_EVENT_SIZE_IN_BYTES * (MAX_NUM_METRICS_EVENTS + 1) / MB_TO_BYTES,
DEFAULT_FLUSH_PERIOD_IN_SECONDS, 1);
ResetClientConfig(false, (double)TestMetricsEventSizeInBytes * (MaxNumMetricsEvents + 1) / MbToBytes,
DefaultFlushPeriodInSeconds, 1);
MetricsQueue metricsEvents;
ServiceAPI::MetricsEventSuccessResponsePropertyEvents responseRecords;
for (int index = 0; index < MAX_NUM_METRICS_EVENTS; ++index)
for (int index = 0; index < MaxNumMetricsEvents; ++index)
{
MetricsEvent newEvent;
newEvent.AddAttribute(MetricsAttribute(METRICS_ATTRIBUTE_KEY_EVENT_NAME, ATTR_VALUE));
newEvent.AddAttribute(MetricsAttribute(AwsMetricsAttributeKeyEventName, AttrValue));
metricsEvents.AddMetrics(newEvent);
@@ -446,28 +446,28 @@ namespace AWSMetrics
m_metricsManager->OnResponseReceived(metricsEvents, responseRecords);
const GlobalStatistics& stats = m_metricsManager->GetGlobalStatistics();
EXPECT_EQ(stats.m_numEvents, MAX_NUM_METRICS_EVENTS);
EXPECT_EQ(stats.m_numSuccesses, MAX_NUM_METRICS_EVENTS / 2);
EXPECT_EQ(stats.m_numErrors, MAX_NUM_METRICS_EVENTS / 2);
EXPECT_EQ(stats.m_numEvents, MaxNumMetricsEvents);
EXPECT_EQ(stats.m_numSuccesses, MaxNumMetricsEvents / 2);
EXPECT_EQ(stats.m_numErrors, MaxNumMetricsEvents / 2);
EXPECT_EQ(stats.m_numDropped, 0);
int metricsEventSize = sizeof(METRICS_ATTRIBUTE_KEY_EVENT_NAME) - 1 + strlen(ATTR_VALUE);
EXPECT_EQ(stats.m_sendSizeInBytes, metricsEventSize * MAX_NUM_METRICS_EVENTS / 2);
int metricsEventSize = sizeof(AwsMetricsAttributeKeyEventName) - 1 + strlen(AttrValue);
EXPECT_EQ(stats.m_sendSizeInBytes, metricsEventSize * MaxNumMetricsEvents / 2);
ASSERT_EQ(m_metricsManager->GetNumBufferedMetrics(), MAX_NUM_METRICS_EVENTS / 2);
ASSERT_EQ(m_metricsManager->GetNumBufferedMetrics(), MaxNumMetricsEvents / 2);
}
TEST_F(MetricsManagerTest, OnResponseReceived_NoResponseRecords_RetryAllMetrics)
{
// Reset the config file to change the max queue size setting.
ResetClientConfig(false, (double)TEST_METRICS_EVENT_SIZE_IN_BYTES * (MAX_NUM_METRICS_EVENTS + 1) / MB_TO_BYTES,
DEFAULT_FLUSH_PERIOD_IN_SECONDS, 1);
ResetClientConfig(false, (double)TestMetricsEventSizeInBytes * (MaxNumMetricsEvents + 1) / MbToBytes,
DefaultFlushPeriodInSeconds, 1);
MetricsQueue metricsEvents;
for (int index = 0; index < MAX_NUM_METRICS_EVENTS; ++index)
for (int index = 0; index < MaxNumMetricsEvents; ++index)
{
MetricsEvent newEvent;
newEvent.AddAttribute(MetricsAttribute(METRICS_ATTRIBUTE_KEY_EVENT_NAME, ATTR_VALUE));
newEvent.AddAttribute(MetricsAttribute(AwsMetricsAttributeKeyEventName, AttrValue));
metricsEvents.AddMetrics(newEvent);
}
@@ -475,22 +475,22 @@ namespace AWSMetrics
m_metricsManager->OnResponseReceived(metricsEvents);
const GlobalStatistics& stats = m_metricsManager->GetGlobalStatistics();
EXPECT_EQ(stats.m_numEvents, MAX_NUM_METRICS_EVENTS);
EXPECT_EQ(stats.m_numEvents, MaxNumMetricsEvents);
EXPECT_EQ(stats.m_numSuccesses, 0);
EXPECT_EQ(stats.m_sendSizeInBytes, 0);
EXPECT_EQ(stats.m_numDropped, 0);
ASSERT_EQ(m_metricsManager->GetNumBufferedMetrics(), MAX_NUM_METRICS_EVENTS);
ASSERT_EQ(m_metricsManager->GetNumBufferedMetrics(), MaxNumMetricsEvents);
}
TEST_F(MetricsManagerTest, OnResponseReceived_MaxNumRetires_DropMetrics)
{
// Reset the config file to change the max queue size setting.
ResetClientConfig(false, (double)TEST_METRICS_EVENT_SIZE_IN_BYTES * (MAX_NUM_METRICS_EVENTS + 1) / MB_TO_BYTES,
DEFAULT_FLUSH_PERIOD_IN_SECONDS, 1);
ResetClientConfig(false, (double)TestMetricsEventSizeInBytes * (MaxNumMetricsEvents + 1) / MbToBytes,
DefaultFlushPeriodInSeconds, 1);
MetricsQueue metricsEvents;
for (int index = 0; index < MAX_NUM_METRICS_EVENTS; ++index)
for (int index = 0; index < MaxNumMetricsEvents; ++index)
{
MetricsEvent newMetricsEvent;
@@ -510,7 +510,7 @@ namespace AWSMetrics
// have been retried for multiple times and we do not increase the total number of errors in this case.
EXPECT_EQ(stats.m_numErrors, 0);
EXPECT_EQ(stats.m_sendSizeInBytes, 0);
EXPECT_EQ(stats.m_numDropped, MAX_NUM_METRICS_EVENTS);
EXPECT_EQ(stats.m_numDropped, MaxNumMetricsEvents);
ASSERT_EQ(m_metricsManager->GetNumBufferedMetrics(), 0);
}
@@ -518,11 +518,11 @@ namespace AWSMetrics
TEST_F(MetricsManagerTest, PushMetricsForRetries_NoRetry_DropMetrics)
{
// Reset the config file to change the max queue size setting.
ResetClientConfig(false, (double)TEST_METRICS_EVENT_SIZE_IN_BYTES * (MAX_NUM_METRICS_EVENTS + 1) / MB_TO_BYTES,
DEFAULT_FLUSH_PERIOD_IN_SECONDS, 0);
ResetClientConfig(false, (double)TestMetricsEventSizeInBytes * (MaxNumMetricsEvents + 1) / MbToBytes,
DefaultFlushPeriodInSeconds, 0);
MetricsQueue metricsEvents;
for (int index = 0; index < MAX_NUM_METRICS_EVENTS; ++index)
for (int index = 0; index < MaxNumMetricsEvents; ++index)
{
metricsEvents.AddMetrics(MetricsEvent());
}
@@ -530,11 +530,11 @@ namespace AWSMetrics
m_metricsManager->OnResponseReceived(metricsEvents);
const GlobalStatistics& stats = m_metricsManager->GetGlobalStatistics();
EXPECT_EQ(stats.m_numEvents, MAX_NUM_METRICS_EVENTS);
EXPECT_EQ(stats.m_numEvents, MaxNumMetricsEvents);
EXPECT_EQ(stats.m_numSuccesses, 0);
EXPECT_EQ(stats.m_numErrors, MAX_NUM_METRICS_EVENTS);
EXPECT_EQ(stats.m_numErrors, MaxNumMetricsEvents);
EXPECT_EQ(stats.m_sendSizeInBytes, 0);
EXPECT_EQ(stats.m_numDropped, MAX_NUM_METRICS_EVENTS);
EXPECT_EQ(stats.m_numDropped, MaxNumMetricsEvents);
ASSERT_EQ(m_metricsManager->GetNumBufferedMetrics(), 0);
}
@@ -544,7 +544,7 @@ namespace AWSMetrics
{
public:
const double DEFAULT_MAX_QUEUE_SIZE_IN_MB = 0.0004;
const int DEFAULT_FLUSH_PERIOD_IN_SECONDS = 1;
const int DefaultFlushPeriodInSeconds = 1;
const int DEFAULT_MAX_NUM_RETRIES = 1;
void SetUp() override
@@ -559,18 +559,18 @@ namespace AWSMetrics
TEST_F(ClientConfigurationTest, ResetClientConfiguration_ValidConfigurationFile_Success)
{
AZStd::string configFilePath = CreateClientConfigFile(true, DEFAULT_MAX_QUEUE_SIZE_IN_MB, DEFAULT_FLUSH_PERIOD_IN_SECONDS, DEFAULT_MAX_NUM_RETRIES);
AZStd::string configFilePath = CreateClientConfigFile(true, DEFAULT_MAX_QUEUE_SIZE_IN_MB, DefaultFlushPeriodInSeconds, DEFAULT_MAX_NUM_RETRIES);
ASSERT_TRUE(m_clientConfiguration->ResetClientConfiguration(configFilePath));
ASSERT_TRUE(m_clientConfiguration->OfflineRecordingEnabled());
ASSERT_EQ(m_clientConfiguration->GetMaxQueueSizeInBytes(), DEFAULT_MAX_QUEUE_SIZE_IN_MB * 1000000);
ASSERT_EQ(m_clientConfiguration->GetQueueFlushPeriodInSeconds(), DEFAULT_FLUSH_PERIOD_IN_SECONDS);
ASSERT_EQ(m_clientConfiguration->GetQueueFlushPeriodInSeconds(), DefaultFlushPeriodInSeconds);
ASSERT_EQ(m_clientConfiguration->GetMaxNumRetries(), DEFAULT_MAX_NUM_RETRIES);
char resolvedPath[AZ_MAX_PATH_LEN] = { 0 };
ASSERT_TRUE(m_localFileIO->ResolvePath(metricsDir, resolvedPath, AZ_MAX_PATH_LEN));
ASSERT_TRUE(m_localFileIO->ResolvePath(AwsMetricsLocalFileDir, resolvedPath, AZ_MAX_PATH_LEN));
AZStd::string expectedMetricsFilePath;
ASSERT_TRUE(AzFramework::StringFunc::Path::Join(resolvedPath, metricsFileName, expectedMetricsFilePath));
ASSERT_TRUE(AzFramework::StringFunc::Path::Join(resolvedPath, AwsMetricsLocalFileName, expectedMetricsFilePath));
ASSERT_EQ(strcmp(m_clientConfiguration->GetMetricsFileDir(), resolvedPath), 0);
ASSERT_EQ(m_clientConfiguration->GetMetricsFileFullPath(), expectedMetricsFilePath);
+36 -61
View File
@@ -25,9 +25,9 @@ namespace AWSMetrics
: public AWSMetricsGemAllocatorFixture
{
public:
const int NUM_TEST_METRICS = 10;
const AZStd::string ATTR_NAME = "name";
const AZStd::string ATTR_VALUE = "value";
const int NumTestMetrics = 10;
const AZStd::string AttrName = "name";
const AZStd::string AttrValue = "value";
};
TEST_F(MetricsQueueTest, AddMetrics_SingleMetrics_Success)
@@ -46,14 +46,14 @@ namespace AWSMetrics
int numMetrics = queue.GetNumMetrics();
MetricsQueue anotherQueue;
for (int index = 0; index < NUM_TEST_METRICS; ++index)
for (int index = 0; index < NumTestMetrics; ++index)
{
anotherQueue.AddMetrics(MetricsEvent());
}
queue.AppendMetrics(anotherQueue);
ASSERT_EQ(queue.GetNumMetrics(), numMetrics + NUM_TEST_METRICS);
ASSERT_EQ(queue.GetNumMetrics(), numMetrics + NumTestMetrics);
}
TEST_F(MetricsQueueTest, AppendMetrics_NoneEmptyQueue_Success)
@@ -63,14 +63,14 @@ namespace AWSMetrics
int numMetrics = queue.GetNumMetrics();
MetricsQueue anotherQueue;
for (int index = 0; index < NUM_TEST_METRICS; ++index)
for (int index = 0; index < NumTestMetrics; ++index)
{
anotherQueue.AddMetrics(MetricsEvent());
}
queue.AppendMetrics(anotherQueue);
ASSERT_EQ(queue.GetNumMetrics(), numMetrics + NUM_TEST_METRICS);
ASSERT_EQ(queue.GetNumMetrics(), numMetrics + NumTestMetrics);
}
TEST_F(MetricsQueueTest, PushMetricsToFront_EmptyQueue_Success)
@@ -79,43 +79,43 @@ namespace AWSMetrics
int numMetrics = queue.GetNumMetrics();
MetricsQueue anotherQueue;
for (int index = 0; index < NUM_TEST_METRICS; ++index)
for (int index = 0; index < NumTestMetrics; ++index)
{
anotherQueue.AddMetrics(MetricsEvent());
}
queue.PushMetricsToFront(anotherQueue);
ASSERT_EQ(queue.GetNumMetrics(), numMetrics + NUM_TEST_METRICS);
ASSERT_EQ(queue.GetNumMetrics(), numMetrics + NumTestMetrics);
}
TEST_F(MetricsQueueTest, PushMetricsToFront_NoneEmptyQueue_Success)
{
MetricsQueue queue;
MetricsEvent metrics;
metrics.AddAttribute(MetricsAttribute(ATTR_NAME, ATTR_VALUE));
metrics.AddAttribute(MetricsAttribute(AttrName, AttrValue));
queue.AddMetrics(metrics);
int numMetrics = queue.GetNumMetrics();
MetricsQueue anotherQueue;
for (int index = 0; index < NUM_TEST_METRICS; ++index)
for (int index = 0; index < NumTestMetrics; ++index)
{
anotherQueue.AddMetrics(MetricsEvent());
}
queue.PushMetricsToFront(anotherQueue);
ASSERT_EQ(queue.GetNumMetrics(), numMetrics + NUM_TEST_METRICS);
ASSERT_EQ(queue[NUM_TEST_METRICS].GetNumAttributes(), 1);
ASSERT_EQ(queue.GetNumMetrics(), numMetrics + NumTestMetrics);
ASSERT_EQ(queue[NumTestMetrics].GetNumAttributes(), 1);
}
TEST_F(MetricsQueueTest, FilterMetricsByPriority_ReachMaxCapacity_FilterOutLowerPriorityMetrics)
{
MetricsQueue queue;
for (int index = 0; index < NUM_TEST_METRICS; ++index)
for (int index = 0; index < NumTestMetrics; ++index)
{
MetricsEvent metrics;
metrics.AddAttribute(MetricsAttribute(ATTR_NAME, ATTR_VALUE));
metrics.AddAttribute(MetricsAttribute(AttrName, AttrValue));
metrics.SetEventPriority(index % 2);
// Use the number of failures to check the order of metrics events later.
@@ -128,10 +128,10 @@ namespace AWSMetrics
queue.AddMetrics(metrics);
}
int maxCapacity = queue[0].GetSizeInBytes() * NUM_TEST_METRICS / 2;
int maxCapacity = queue[0].GetSizeInBytes() * NumTestMetrics / 2;
ASSERT_EQ(queue.FilterMetricsByPriority(maxCapacity), NUM_TEST_METRICS / 2);
ASSERT_EQ(queue.GetNumMetrics(), NUM_TEST_METRICS / 2);
ASSERT_EQ(queue.FilterMetricsByPriority(maxCapacity), NumTestMetrics / 2);
ASSERT_EQ(queue.GetNumMetrics(), NumTestMetrics / 2);
for (int index = 0; index < queue.GetNumMetrics(); ++index)
{
@@ -149,11 +149,11 @@ namespace AWSMetrics
TEST_F(MetricsQueueTest, ClearMetrics_NoneEmptyQueue_Success)
{
MetricsQueue queue;
for (int index = 0; index < NUM_TEST_METRICS; ++index)
for (int index = 0; index < NumTestMetrics; ++index)
{
queue.AddMetrics(MetricsEvent());
}
ASSERT_EQ(queue.GetNumMetrics(), NUM_TEST_METRICS);
ASSERT_EQ(queue.GetNumMetrics(), NumTestMetrics);
queue.ClearMetrics();
@@ -164,12 +164,12 @@ namespace AWSMetrics
{
MetricsQueue queue;
MetricsEvent metrics;
metrics.AddAttribute(MetricsAttribute(ATTR_NAME, ATTR_VALUE));
metrics.AddAttribute(MetricsAttribute(METRICS_ATTRIBUTE_KEY_EVENT_NAME, ATTR_VALUE));
metrics.AddAttribute(MetricsAttribute(AttrName, AttrValue));
metrics.AddAttribute(MetricsAttribute(AwsMetricsAttributeKeyEventName, AttrValue));
queue.AddMetrics(metrics);
AZStd::string serializedQueue = AZStd::string::format("[{\"%s\":\"%s\",\"%s\":{\"%s\":\"%s\"}}]",
METRICS_ATTRIBUTE_KEY_EVENT_NAME, ATTR_VALUE.c_str(), METRICS_ATTRIBUTE_KEY_EVENT_DATA, ATTR_NAME.c_str(), ATTR_VALUE.c_str());
AwsMetricsAttributeKeyEventName, AttrValue.c_str(), AwsMetricsAttributeKeyEventData, AttrName.c_str(), AttrValue.c_str());
ASSERT_EQ(queue.SerializeToJson(), serializedQueue);
}
@@ -177,8 +177,8 @@ namespace AWSMetrics
{
MetricsQueue queue;
MetricsEvent metrics;
metrics.AddAttribute(MetricsAttribute(ATTR_NAME, ATTR_VALUE));
metrics.AddAttribute(MetricsAttribute(METRICS_ATTRIBUTE_KEY_EVENT_NAME, ATTR_VALUE));
metrics.AddAttribute(MetricsAttribute(AttrName, AttrValue));
metrics.AddAttribute(MetricsAttribute(AwsMetricsAttributeKeyEventName, AttrValue));
queue.AddMetrics(metrics);
std::ostream stream(nullptr);
@@ -194,7 +194,7 @@ namespace AWSMetrics
AZStd::string testFilePath = GetDefaultTestFilePath();
AZStd::string serializedQueue = AZStd::string::format("[{\"%s\":\"%s\",\"%s\":{\"%s\":\"%s\"}}]",
METRICS_ATTRIBUTE_KEY_EVENT_NAME, ATTR_VALUE.c_str(), METRICS_ATTRIBUTE_KEY_EVENT_DATA, ATTR_NAME.c_str(), ATTR_VALUE.c_str());
AwsMetricsAttributeKeyEventName, AttrValue.c_str(), AwsMetricsAttributeKeyEventData, AttrName.c_str(), AttrValue.c_str());
ASSERT_TRUE(CreateFile(testFilePath, serializedQueue));
ASSERT_TRUE(queue.ReadFromJson(testFilePath));
@@ -220,7 +220,7 @@ namespace AWSMetrics
AZStd::string testFilePath = GetDefaultTestFilePath();
AZStd::string serializedQueue = AZStd::string::format("{\"%s\":\"%s\",\"%s\":{\"%s\":\"%s\"}}",
METRICS_ATTRIBUTE_KEY_EVENT_NAME, ATTR_VALUE.c_str(), METRICS_ATTRIBUTE_KEY_EVENT_DATA, ATTR_NAME.c_str(), ATTR_VALUE.c_str());
AwsMetricsAttributeKeyEventName, AttrValue.c_str(), AwsMetricsAttributeKeyEventData, AttrName.c_str(), AttrValue.c_str());
ASSERT_TRUE(CreateFile(testFilePath, serializedQueue));
AZ_TEST_START_TRACE_SUPPRESSION;
@@ -230,62 +230,37 @@ namespace AWSMetrics
ASSERT_TRUE(RemoveFile(testFilePath));
}
TEST_F(MetricsQueueTest, ReadFromString_DefaultandCustomMetricsAttributes_Success)
{
MetricsQueue queue;
AZStd::string serializedQueue = AZStd::string::format(
"[{\"%s\":\"%s\",\"%s\":{\"%s\":\"%s\"}}]", METRICS_ATTRIBUTE_KEY_EVENT_NAME, ATTR_VALUE.c_str(),
METRICS_ATTRIBUTE_KEY_EVENT_DATA, ATTR_NAME.c_str(), ATTR_VALUE.c_str());
ASSERT_TRUE(queue.ReadFromString(serializedQueue));
ASSERT_EQ(queue.GetNumMetrics(), 1);
}
TEST_F(MetricsQueueTest, ReadFromString_InvalidJsonFormat_Fail)
{
MetricsQueue queue;
AZStd::string serializedQueue = AZStd::string::format(
"{\"%s\":\"%s\",\"%s\":{\"%s\":\"%s\"}}", METRICS_ATTRIBUTE_KEY_EVENT_NAME, ATTR_VALUE.c_str(),
METRICS_ATTRIBUTE_KEY_EVENT_DATA, ATTR_NAME.c_str(), ATTR_VALUE.c_str());
AZ_TEST_START_TRACE_SUPPRESSION;
ASSERT_FALSE(queue.ReadFromString(serializedQueue));
AZ_TEST_STOP_TRACE_SUPPRESSION(1);
}
TEST_F(MetricsQueueTest, PopBufferedEventsByServiceLimits_QueueSizeExceedsLimits_BufferedEventsAddedToNewQueue)
{
MetricsEvent metrics;
metrics.AddAttribute(MetricsAttribute(ATTR_NAME, ATTR_VALUE));
metrics.AddAttribute(MetricsAttribute(AttrName, AttrValue));
int sizeOfEachMetrics = metrics.GetSizeInBytes();
MetricsQueue queue;
queue.AddMetrics(metrics);
for (int index = 0; index < NUM_TEST_METRICS - 1; ++index)
for (int index = 0; index < NumTestMetrics - 1; ++index)
{
MetricsEvent newMetrics;
newMetrics.AddAttribute(MetricsAttribute(ATTR_NAME, ATTR_VALUE));
newMetrics.AddAttribute(MetricsAttribute(AttrName, AttrValue));
queue.AddMetrics(newMetrics);
}
MetricsQueue anotherQueue;
// Payload size limit is hit.
queue.PopBufferedEventsByServiceLimits(anotherQueue, sizeOfEachMetrics, NUM_TEST_METRICS + 1);
queue.PopBufferedEventsByServiceLimits(anotherQueue, sizeOfEachMetrics, NumTestMetrics + 1);
ASSERT_EQ(queue.GetNumMetrics(), NUM_TEST_METRICS - 1);
ASSERT_EQ(queue.GetSizeInBytes(), sizeOfEachMetrics * (NUM_TEST_METRICS - 1));
ASSERT_EQ(queue.GetNumMetrics(), NumTestMetrics - 1);
ASSERT_EQ(queue.GetSizeInBytes(), sizeOfEachMetrics * (NumTestMetrics - 1));
ASSERT_EQ(anotherQueue.GetNumMetrics(), 1);
ASSERT_EQ(anotherQueue.GetSizeInBytes(), sizeOfEachMetrics);
// Records count limit is hit.
queue.PopBufferedEventsByServiceLimits(anotherQueue, sizeOfEachMetrics * NUM_TEST_METRICS, 1);
queue.PopBufferedEventsByServiceLimits(anotherQueue, sizeOfEachMetrics * NumTestMetrics, 1);
ASSERT_EQ(queue.GetNumMetrics(), NUM_TEST_METRICS - 2);
ASSERT_EQ(queue.GetSizeInBytes(), sizeOfEachMetrics * (NUM_TEST_METRICS - 2));
ASSERT_EQ(queue.GetNumMetrics(), NumTestMetrics - 2);
ASSERT_EQ(queue.GetSizeInBytes(), sizeOfEachMetrics * (NumTestMetrics - 2));
ASSERT_EQ(anotherQueue.GetNumMetrics(), 2);
ASSERT_EQ(anotherQueue.GetSizeInBytes(), sizeOfEachMetrics * 2);
}
+1 -1
View File
@@ -11,7 +11,7 @@
set(FILES
Include/Public/AWSMetricsBus.h
Include/Public/AWSMetricsConstant.h
Include/Private/AWSMetricsConstant.h
Include/Private/AWSMetricsServiceApi.h
Include/Private/AWSMetricsSystemComponent.h
Include/Private/ClientConfiguration.h
@@ -10,5 +10,6 @@
#
set(FILES
Include/Private/AWSMetricsModule.h
Source/AWSMetricsModule.cpp
)
@@ -113,8 +113,7 @@ class DataIngestion:
apigateway_role = iam.Role(
self._stack,
id="ApiGatewayRole",
role_name=f'{self._stack.stack_name}-ApiGatewayRole',
id=f'{self._stack.stack_name}-ApiGatewayRole',
assumed_by=iam.ServicePrincipal(
service="apigateway.amazonaws.com"
),
+1 -1
View File
@@ -8,4 +8,4 @@ aws-cdk.aws_kinesisanalytics>=1.91.0
aws-cdk.aws_kinesisfirehose>=1.91.0
aws-cdk.aws_s3>=1.91.0
aws-cdk.aws_glue>=1.91.0
aws-cdk.aws_athena>=1.91.0
aws-cdk.aws_athena>=1.91.0
@@ -1,22 +0,0 @@
{
"platform": {
"win_x64_vs2017": {
"includes": [
"win_x64/include"
],
"importlibpath": [
"win_x64/lib"
],
"sharedlibpath": [
"win_x64/bin"
],
"import": [
"ispc_texcomp.lib"
],
"shared": [
"ispc_texcomp.dll"
]
},
"win_x64_vs2019": "@win_x64_vs2017"
}
}
@@ -1,9 +0,0 @@
{
"name": "ispctexturecompressor",
"source": "@GEM@/External/ISPCTextureCompressor/1.0.0",
"description": "ISPC Texture Compressor",
"defines": [],
"lib_required": "True",
"shared_required": "True"
}
@@ -69,7 +69,6 @@ ly_add_target(
3rdParty::PVRTexTool
3rdParty::squish-ccr
3rdParty::tiff
3rdParty::ispctexcomp
3rdParty::ilmbase
Legacy::CryCommon
AZ::AzFramework
@@ -8,3 +8,12 @@
# remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#
# windows requires the 3rd Party ISPCTexComp library.
ly_associate_package(PACKAGE_NAME ISPCTexComp-2021.3-rev1-windows TARGETS ISPCTexComp PACKAGE_HASH 324fb051a549bc96571530e63c01e18a4c860db45317734d86276fe27a45f6dd)
set(LY_BUILD_DEPENDENCIES
PUBLIC
3rdParty::ISPCTexComp
)
@@ -784,7 +784,7 @@ namespace UnitTest
{
//source image
AZStd::string inputFile;
inputFile = "../SamplesProject/Objects/ParticleAssets/ShowRoom/showroom_pipe_blue_001_ddna.tif";
inputFile = "../AutomatedTesting/Objects/ParticleAssets/ShowRoom/showroom_pipe_blue_001_ddna.tif";
IImageObjectPtr srcImage(LoadImageFromFile(inputFile));
ImageToProcess imageToProcess(srcImage);
@@ -1006,7 +1006,7 @@ namespace UnitTest
TEST_F(ImageProcessingTest, DISABLED_TestLoadDdsImage)
{
IImageObjectPtr originImage, alphaImage;
AZStd::string inputFolder = "../SamplesProject/Cache/pc/engineassets/texturemsg/";
AZStd::string inputFolder = "../AutomatedTesting/Cache/pc/engineassets/texturemsg/";
AZStd::string inputFile;
inputFile = "E:/Javelin_NWLYDev/dev/Cache/Assets/pc/assets/textures/blend_maps/moss/jav_moss_ddn.dds";
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:e23d3e16fc73176ba58667b3752597890dc4c00560fd32d66aa1a5346334a32f
size 1546240
@@ -1,122 +0,0 @@
////////////////////////////////////////////////////////////////////////////////
// Copyright (c) 2016-2019, Intel Corporation
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to
// deal in the Software without restriction, including without limitation the
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
// sell copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
// IN THE SOFTWARE.
////////////////////////////////////////////////////////////////////////////////
#include <stdint.h>
struct rgba_surface
{
uint8_t* ptr;
int32_t width;
int32_t height;
int32_t stride; // in bytes
};
struct bc7_enc_settings
{
bool mode_selection[4];
int refineIterations[8];
bool skip_mode2;
int fastSkipTreshold_mode1;
int fastSkipTreshold_mode3;
int fastSkipTreshold_mode7;
int mode45_channel0;
int refineIterations_channel;
int channels;
};
struct bc6h_enc_settings
{
bool slow_mode;
bool fast_mode;
int refineIterations_1p;
int refineIterations_2p;
int fastSkipTreshold;
};
struct etc_enc_settings
{
int fastSkipTreshold;
};
struct astc_enc_settings
{
int block_width;
int block_height;
int channels;
int fastSkipTreshold;
int refineIterations;
};
// profiles for RGB data (alpha channel will be ignored)
extern "C" void GetProfile_ultrafast(bc7_enc_settings* settings);
extern "C" void GetProfile_veryfast(bc7_enc_settings* settings);
extern "C" void GetProfile_fast(bc7_enc_settings* settings);
extern "C" void GetProfile_basic(bc7_enc_settings* settings);
extern "C" void GetProfile_slow(bc7_enc_settings* settings);
// profiles for RGBA inputs
extern "C" void GetProfile_alpha_ultrafast(bc7_enc_settings* settings);
extern "C" void GetProfile_alpha_veryfast(bc7_enc_settings* settings);
extern "C" void GetProfile_alpha_fast(bc7_enc_settings* settings);
extern "C" void GetProfile_alpha_basic(bc7_enc_settings* settings);
extern "C" void GetProfile_alpha_slow(bc7_enc_settings* settings);
// profiles for BC6H (RGB HDR)
extern "C" void GetProfile_bc6h_veryfast(bc6h_enc_settings* settings);
extern "C" void GetProfile_bc6h_fast(bc6h_enc_settings* settings);
extern "C" void GetProfile_bc6h_basic(bc6h_enc_settings* settings);
extern "C" void GetProfile_bc6h_slow(bc6h_enc_settings* settings);
extern "C" void GetProfile_bc6h_veryslow(bc6h_enc_settings* settings);
// profiles for ETC
extern "C" void GetProfile_etc_slow(etc_enc_settings* settings);
// profiles for ASTC
extern "C" void GetProfile_astc_fast(astc_enc_settings* settings, int block_width, int block_height);
extern "C" void GetProfile_astc_alpha_fast(astc_enc_settings* settings, int block_width, int block_height);
extern "C" void GetProfile_astc_alpha_slow(astc_enc_settings* settings, int block_width, int block_height);
// helper function to replicate border pixels for the desired block sizes (bpp = 32 or 64)
extern "C" void ReplicateBorders(rgba_surface* dst_slice, const rgba_surface* src_tex, int x, int y, int bpp);
/*
Notes:
- input width and height need to be a multiple of block size
- LDR input is 32 bit/pixel (sRGB), HDR is 64 bit/pixel (half float)
- dst buffer must be allocated with enough space for the compressed texture:
- 8 bytes/block for BC1/ETC1,
- 16 bytes/block for BC3/BC6H/BC7/ASTC
- the blocks are stored in raster scan order (natural CPU texture layout)
- use the GetProfile_* functions to select various speed/quality tradeoffs
- the RGB profiles are slightly faster as they ignore the alpha channel
*/
extern "C" void CompressBlocksBC1(const rgba_surface* src, uint8_t* dst);
extern "C" void CompressBlocksBC3(const rgba_surface* src, uint8_t* dst);
extern "C" void CompressBlocksBC6H(const rgba_surface* src, uint8_t* dst, bc6h_enc_settings* settings);
extern "C" void CompressBlocksBC7(const rgba_surface* src, uint8_t* dst, bc7_enc_settings* settings);
extern "C" void CompressBlocksETC1(const rgba_surface* src, uint8_t* dst, etc_enc_settings* settings);
extern "C" void CompressBlocksASTC(const rgba_surface* src, uint8_t* dst, astc_enc_settings* settings);
@@ -1,111 +0,0 @@
//
// (Header automatically generated by the ispc compiler.)
// DO NOT EDIT THIS FILE.
//
#pragma once
#include <stdint.h>
#ifdef __cplusplus
namespace ispc { /* namespace */
#endif // __cplusplus
#ifndef __ISPC_ALIGN__
#if defined(__clang__) || !defined(_MSC_VER)
// Clang, GCC, ICC
#define __ISPC_ALIGN__(s) __attribute__((aligned(s)))
#define __ISPC_ALIGNED_STRUCT__(s) struct __ISPC_ALIGN__(s)
#else
// Visual Studio
#define __ISPC_ALIGN__(s) __declspec(align(s))
#define __ISPC_ALIGNED_STRUCT__(s) __ISPC_ALIGN__(s) struct
#endif
#endif
#ifndef __ISPC_STRUCT_rgba_surface__
#define __ISPC_STRUCT_rgba_surface__
struct rgba_surface {
uint8_t * ptr;
int32_t width;
int32_t height;
int32_t stride;
};
#endif
#ifndef __ISPC_STRUCT_astc_enc_context__
#define __ISPC_STRUCT_astc_enc_context__
struct astc_enc_context {
int32_t width;
int32_t height;
int32_t channels;
bool dual_plane;
int32_t partitions;
int32_t color_endpoint_pairs;
};
#endif
#ifndef __ISPC_STRUCT_astc_enc_settings__
#define __ISPC_STRUCT_astc_enc_settings__
struct astc_enc_settings {
int32_t block_width;
int32_t block_height;
int32_t channels;
int32_t fastSkipTreshold;
int32_t refineIterations;
};
#endif
#ifndef __ISPC_STRUCT_astc_block__
#define __ISPC_STRUCT_astc_block__
struct astc_block {
int32_t width;
int32_t height;
bool dual_plane;
int32_t weight_range;
uint8_t weights[64];
int32_t color_component_selector;
int32_t partitions;
int32_t partition_id;
int32_t color_endpoint_pairs;
int32_t channels;
int32_t color_endpoint_modes[4];
int32_t endpoint_range;
uint8_t endpoints[18];
};
#endif
///////////////////////////////////////////////////////////////////////////
// Functions exported from ispc code
///////////////////////////////////////////////////////////////////////////
#if defined(__cplusplus) && (! defined(__ISPC_NO_EXTERN_C) || !__ISPC_NO_EXTERN_C )
extern "C" {
#endif // __cplusplus
extern void astc_encode_ispc(struct rgba_surface * src, float * block_scores, uint8_t * dst, uint64_t * list, struct astc_enc_context * list_context, struct astc_enc_settings * settings);
extern void astc_rank_ispc(struct rgba_surface * src, int32_t xx, int32_t yy, uint32_t * mode_buffer, struct astc_enc_settings * settings);
extern int32_t get_programCount();
#if defined(__cplusplus) && (! defined(__ISPC_NO_EXTERN_C) || !__ISPC_NO_EXTERN_C )
} /* end extern C */
#endif // __cplusplus
#ifndef __ISPC_ALIGN__
#if defined(__clang__) || !defined(_MSC_VER)
// Clang, GCC, ICC
#define __ISPC_ALIGN__(s) __attribute__((aligned(s)))
#define __ISPC_ALIGNED_STRUCT__(s) struct __ISPC_ALIGN__(s)
#else
// Visual Studio
#define __ISPC_ALIGN__(s) __declspec(align(s))
#define __ISPC_ALIGNED_STRUCT__(s) __ISPC_ALIGN__(s) struct
#endif
#endif
#ifdef __cplusplus
} /* namespace */
#endif // __cplusplus
@@ -1,96 +0,0 @@
//
// (Header automatically generated by the ispc compiler.)
// DO NOT EDIT THIS FILE.
//
#pragma once
#include <stdint.h>
#ifdef __cplusplus
namespace ispc { /* namespace */
#endif // __cplusplus
#ifndef __ISPC_ALIGN__
#if defined(__clang__) || !defined(_MSC_VER)
// Clang, GCC, ICC
#define __ISPC_ALIGN__(s) __attribute__((aligned(s)))
#define __ISPC_ALIGNED_STRUCT__(s) struct __ISPC_ALIGN__(s)
#else
// Visual Studio
#define __ISPC_ALIGN__(s) __declspec(align(s))
#define __ISPC_ALIGNED_STRUCT__(s) __ISPC_ALIGN__(s) struct
#endif
#endif
#ifndef __ISPC_STRUCT_rgba_surface__
#define __ISPC_STRUCT_rgba_surface__
struct rgba_surface {
uint8_t * ptr;
int32_t width;
int32_t height;
int32_t stride;
};
#endif
#ifndef __ISPC_STRUCT_astc_enc_context__
#define __ISPC_STRUCT_astc_enc_context__
struct astc_enc_context {
int32_t width;
int32_t height;
int32_t channels;
bool dual_plane;
int32_t partitions;
int32_t color_endpoint_pairs;
};
#endif
#ifndef __ISPC_STRUCT_astc_enc_settings__
#define __ISPC_STRUCT_astc_enc_settings__
struct astc_enc_settings {
int32_t block_width;
int32_t block_height;
int32_t channels;
int32_t fastSkipTreshold;
int32_t refineIterations;
};
#endif
#ifndef __ISPC_STRUCT_astc_block__
#define __ISPC_STRUCT_astc_block__
struct astc_block {
int32_t width;
int32_t height;
bool dual_plane;
int32_t weight_range;
uint8_t weights[64];
int32_t color_component_selector;
int32_t partitions;
int32_t partition_id;
int32_t color_endpoint_pairs;
int32_t channels;
int32_t color_endpoint_modes[4];
int32_t endpoint_range;
uint8_t endpoints[18];
};
#endif
///////////////////////////////////////////////////////////////////////////
// Functions exported from ispc code
///////////////////////////////////////////////////////////////////////////
#if defined(__cplusplus) && (! defined(__ISPC_NO_EXTERN_C) || !__ISPC_NO_EXTERN_C )
extern "C" {
#endif // __cplusplus
extern void astc_encode_ispc(struct rgba_surface * src, float * block_scores, uint8_t * dst, uint64_t * list, struct astc_enc_context * list_context, struct astc_enc_settings * settings);
extern void astc_rank_ispc(struct rgba_surface * src, int32_t xx, int32_t yy, uint32_t * mode_buffer, struct astc_enc_settings * settings);
extern int32_t get_programCount();
#if defined(__cplusplus) && (! defined(__ISPC_NO_EXTERN_C) || !__ISPC_NO_EXTERN_C )
} /* end extern C */
#endif // __cplusplus
#ifdef __cplusplus
} /* namespace */
#endif // __cplusplus
@@ -1,96 +0,0 @@
//
// (Header automatically generated by the ispc compiler.)
// DO NOT EDIT THIS FILE.
//
#pragma once
#include <stdint.h>
#ifdef __cplusplus
namespace ispc { /* namespace */
#endif // __cplusplus
#ifndef __ISPC_ALIGN__
#if defined(__clang__) || !defined(_MSC_VER)
// Clang, GCC, ICC
#define __ISPC_ALIGN__(s) __attribute__((aligned(s)))
#define __ISPC_ALIGNED_STRUCT__(s) struct __ISPC_ALIGN__(s)
#else
// Visual Studio
#define __ISPC_ALIGN__(s) __declspec(align(s))
#define __ISPC_ALIGNED_STRUCT__(s) __ISPC_ALIGN__(s) struct
#endif
#endif
#ifndef __ISPC_STRUCT_rgba_surface__
#define __ISPC_STRUCT_rgba_surface__
struct rgba_surface {
uint8_t * ptr;
int32_t width;
int32_t height;
int32_t stride;
};
#endif
#ifndef __ISPC_STRUCT_astc_enc_context__
#define __ISPC_STRUCT_astc_enc_context__
struct astc_enc_context {
int32_t width;
int32_t height;
int32_t channels;
bool dual_plane;
int32_t partitions;
int32_t color_endpoint_pairs;
};
#endif
#ifndef __ISPC_STRUCT_astc_enc_settings__
#define __ISPC_STRUCT_astc_enc_settings__
struct astc_enc_settings {
int32_t block_width;
int32_t block_height;
int32_t channels;
int32_t fastSkipTreshold;
int32_t refineIterations;
};
#endif
#ifndef __ISPC_STRUCT_astc_block__
#define __ISPC_STRUCT_astc_block__
struct astc_block {
int32_t width;
int32_t height;
bool dual_plane;
int32_t weight_range;
uint8_t weights[64];
int32_t color_component_selector;
int32_t partitions;
int32_t partition_id;
int32_t color_endpoint_pairs;
int32_t channels;
int32_t color_endpoint_modes[4];
int32_t endpoint_range;
uint8_t endpoints[18];
};
#endif
///////////////////////////////////////////////////////////////////////////
// Functions exported from ispc code
///////////////////////////////////////////////////////////////////////////
#if defined(__cplusplus) && (! defined(__ISPC_NO_EXTERN_C) || !__ISPC_NO_EXTERN_C )
extern "C" {
#endif // __cplusplus
extern void astc_encode_ispc(struct rgba_surface * src, float * block_scores, uint8_t * dst, uint64_t * list, struct astc_enc_context * list_context, struct astc_enc_settings * settings);
extern void astc_rank_ispc(struct rgba_surface * src, int32_t xx, int32_t yy, uint32_t * mode_buffer, struct astc_enc_settings * settings);
extern int32_t get_programCount();
#if defined(__cplusplus) && (! defined(__ISPC_NO_EXTERN_C) || !__ISPC_NO_EXTERN_C )
} /* end extern C */
#endif // __cplusplus
#ifdef __cplusplus
} /* namespace */
#endif // __cplusplus
@@ -1,96 +0,0 @@
//
// (Header automatically generated by the ispc compiler.)
// DO NOT EDIT THIS FILE.
//
#pragma once
#include <stdint.h>
#ifdef __cplusplus
namespace ispc { /* namespace */
#endif // __cplusplus
#ifndef __ISPC_ALIGN__
#if defined(__clang__) || !defined(_MSC_VER)
// Clang, GCC, ICC
#define __ISPC_ALIGN__(s) __attribute__((aligned(s)))
#define __ISPC_ALIGNED_STRUCT__(s) struct __ISPC_ALIGN__(s)
#else
// Visual Studio
#define __ISPC_ALIGN__(s) __declspec(align(s))
#define __ISPC_ALIGNED_STRUCT__(s) __ISPC_ALIGN__(s) struct
#endif
#endif
#ifndef __ISPC_STRUCT_rgba_surface__
#define __ISPC_STRUCT_rgba_surface__
struct rgba_surface {
uint8_t * ptr;
int32_t width;
int32_t height;
int32_t stride;
};
#endif
#ifndef __ISPC_STRUCT_astc_enc_context__
#define __ISPC_STRUCT_astc_enc_context__
struct astc_enc_context {
int32_t width;
int32_t height;
int32_t channels;
bool dual_plane;
int32_t partitions;
int32_t color_endpoint_pairs;
};
#endif
#ifndef __ISPC_STRUCT_astc_enc_settings__
#define __ISPC_STRUCT_astc_enc_settings__
struct astc_enc_settings {
int32_t block_width;
int32_t block_height;
int32_t channels;
int32_t fastSkipTreshold;
int32_t refineIterations;
};
#endif
#ifndef __ISPC_STRUCT_astc_block__
#define __ISPC_STRUCT_astc_block__
struct astc_block {
int32_t width;
int32_t height;
bool dual_plane;
int32_t weight_range;
uint8_t weights[64];
int32_t color_component_selector;
int32_t partitions;
int32_t partition_id;
int32_t color_endpoint_pairs;
int32_t channels;
int32_t color_endpoint_modes[4];
int32_t endpoint_range;
uint8_t endpoints[18];
};
#endif
///////////////////////////////////////////////////////////////////////////
// Functions exported from ispc code
///////////////////////////////////////////////////////////////////////////
#if defined(__cplusplus) && (! defined(__ISPC_NO_EXTERN_C) || !__ISPC_NO_EXTERN_C )
extern "C" {
#endif // __cplusplus
extern void astc_encode_ispc(struct rgba_surface * src, float * block_scores, uint8_t * dst, uint64_t * list, struct astc_enc_context * list_context, struct astc_enc_settings * settings);
extern void astc_rank_ispc(struct rgba_surface * src, int32_t xx, int32_t yy, uint32_t * mode_buffer, struct astc_enc_settings * settings);
extern int32_t get_programCount();
#if defined(__cplusplus) && (! defined(__ISPC_NO_EXTERN_C) || !__ISPC_NO_EXTERN_C )
} /* end extern C */
#endif // __cplusplus
#ifdef __cplusplus
} /* namespace */
#endif // __cplusplus
@@ -1,96 +0,0 @@
//
// (Header automatically generated by the ispc compiler.)
// DO NOT EDIT THIS FILE.
//
#pragma once
#include <stdint.h>
#ifdef __cplusplus
namespace ispc { /* namespace */
#endif // __cplusplus
#ifndef __ISPC_ALIGN__
#if defined(__clang__) || !defined(_MSC_VER)
// Clang, GCC, ICC
#define __ISPC_ALIGN__(s) __attribute__((aligned(s)))
#define __ISPC_ALIGNED_STRUCT__(s) struct __ISPC_ALIGN__(s)
#else
// Visual Studio
#define __ISPC_ALIGN__(s) __declspec(align(s))
#define __ISPC_ALIGNED_STRUCT__(s) __ISPC_ALIGN__(s) struct
#endif
#endif
#ifndef __ISPC_STRUCT_rgba_surface__
#define __ISPC_STRUCT_rgba_surface__
struct rgba_surface {
uint8_t * ptr;
int32_t width;
int32_t height;
int32_t stride;
};
#endif
#ifndef __ISPC_STRUCT_astc_enc_context__
#define __ISPC_STRUCT_astc_enc_context__
struct astc_enc_context {
int32_t width;
int32_t height;
int32_t channels;
bool dual_plane;
int32_t partitions;
int32_t color_endpoint_pairs;
};
#endif
#ifndef __ISPC_STRUCT_astc_enc_settings__
#define __ISPC_STRUCT_astc_enc_settings__
struct astc_enc_settings {
int32_t block_width;
int32_t block_height;
int32_t channels;
int32_t fastSkipTreshold;
int32_t refineIterations;
};
#endif
#ifndef __ISPC_STRUCT_astc_block__
#define __ISPC_STRUCT_astc_block__
struct astc_block {
int32_t width;
int32_t height;
bool dual_plane;
int32_t weight_range;
uint8_t weights[64];
int32_t color_component_selector;
int32_t partitions;
int32_t partition_id;
int32_t color_endpoint_pairs;
int32_t channels;
int32_t color_endpoint_modes[4];
int32_t endpoint_range;
uint8_t endpoints[18];
};
#endif
///////////////////////////////////////////////////////////////////////////
// Functions exported from ispc code
///////////////////////////////////////////////////////////////////////////
#if defined(__cplusplus) && (! defined(__ISPC_NO_EXTERN_C) || !__ISPC_NO_EXTERN_C )
extern "C" {
#endif // __cplusplus
extern void astc_encode_ispc(struct rgba_surface * src, float * block_scores, uint8_t * dst, uint64_t * list, struct astc_enc_context * list_context, struct astc_enc_settings * settings);
extern void astc_rank_ispc(struct rgba_surface * src, int32_t xx, int32_t yy, uint32_t * mode_buffer, struct astc_enc_settings * settings);
extern int32_t get_programCount();
#if defined(__cplusplus) && (! defined(__ISPC_NO_EXTERN_C) || !__ISPC_NO_EXTERN_C )
} /* end extern C */
#endif // __cplusplus
#ifdef __cplusplus
} /* namespace */
#endif // __cplusplus
@@ -1,104 +0,0 @@
//
// (Header automatically generated by the ispc compiler.)
// DO NOT EDIT THIS FILE.
//
#pragma once
#include <stdint.h>
#ifdef __cplusplus
namespace ispc { /* namespace */
#endif // __cplusplus
#ifndef __ISPC_ALIGN__
#if defined(__clang__) || !defined(_MSC_VER)
// Clang, GCC, ICC
#define __ISPC_ALIGN__(s) __attribute__((aligned(s)))
#define __ISPC_ALIGNED_STRUCT__(s) struct __ISPC_ALIGN__(s)
#else
// Visual Studio
#define __ISPC_ALIGN__(s) __declspec(align(s))
#define __ISPC_ALIGNED_STRUCT__(s) __ISPC_ALIGN__(s) struct
#endif
#endif
#ifndef __ISPC_STRUCT_rgba_surface__
#define __ISPC_STRUCT_rgba_surface__
struct rgba_surface {
uint8_t * ptr;
int32_t width;
int32_t height;
int32_t stride;
};
#endif
#ifndef __ISPC_STRUCT_bc6h_enc_settings__
#define __ISPC_STRUCT_bc6h_enc_settings__
struct bc6h_enc_settings {
bool slow_mode;
bool fast_mode;
int32_t refineIterations_1p;
int32_t refineIterations_2p;
int32_t fastSkipTreshold;
};
#endif
#ifndef __ISPC_STRUCT_bc7_enc_settings__
#define __ISPC_STRUCT_bc7_enc_settings__
struct bc7_enc_settings {
bool mode_selection[4];
int32_t refineIterations[8];
bool skip_mode2;
int32_t fastSkipTreshold_mode1;
int32_t fastSkipTreshold_mode3;
int32_t fastSkipTreshold_mode7;
int32_t mode45_channel0;
int32_t refineIterations_channel;
int32_t channels;
};
#endif
#ifndef __ISPC_STRUCT_etc_enc_settings__
#define __ISPC_STRUCT_etc_enc_settings__
struct etc_enc_settings {
int32_t fastSkipTreshold;
};
#endif
///////////////////////////////////////////////////////////////////////////
// Functions exported from ispc code
///////////////////////////////////////////////////////////////////////////
#if defined(__cplusplus) && (! defined(__ISPC_NO_EXTERN_C) || !__ISPC_NO_EXTERN_C )
extern "C" {
#endif // __cplusplus
extern void CompressBlocksBC1_ispc(struct rgba_surface * src, uint8_t * dst);
extern void CompressBlocksBC3_ispc(struct rgba_surface * src, uint8_t * dst);
extern void CompressBlocksBC6H_ispc(struct rgba_surface * src, uint8_t * dst, struct bc6h_enc_settings * settings);
extern void CompressBlocksBC7_ispc(struct rgba_surface * src, uint8_t * dst, struct bc7_enc_settings * settings);
extern void CompressBlocksETC1_ispc(struct rgba_surface * src, uint8_t * dst, struct etc_enc_settings * settings);
#if defined(__cplusplus) && (! defined(__ISPC_NO_EXTERN_C) || !__ISPC_NO_EXTERN_C )
} /* end extern C */
#endif // __cplusplus
#ifndef __ISPC_ALIGN__
#if defined(__clang__) || !defined(_MSC_VER)
// Clang, GCC, ICC
#define __ISPC_ALIGN__(s) __attribute__((aligned(s)))
#define __ISPC_ALIGNED_STRUCT__(s) struct __ISPC_ALIGN__(s)
#else
// Visual Studio
#define __ISPC_ALIGN__(s) __declspec(align(s))
#define __ISPC_ALIGNED_STRUCT__(s) __ISPC_ALIGN__(s) struct
#endif
#endif
#ifdef __cplusplus
} /* namespace */
#endif // __cplusplus
@@ -1,89 +0,0 @@
//
// (Header automatically generated by the ispc compiler.)
// DO NOT EDIT THIS FILE.
//
#pragma once
#include <stdint.h>
#ifdef __cplusplus
namespace ispc { /* namespace */
#endif // __cplusplus
#ifndef __ISPC_ALIGN__
#if defined(__clang__) || !defined(_MSC_VER)
// Clang, GCC, ICC
#define __ISPC_ALIGN__(s) __attribute__((aligned(s)))
#define __ISPC_ALIGNED_STRUCT__(s) struct __ISPC_ALIGN__(s)
#else
// Visual Studio
#define __ISPC_ALIGN__(s) __declspec(align(s))
#define __ISPC_ALIGNED_STRUCT__(s) __ISPC_ALIGN__(s) struct
#endif
#endif
#ifndef __ISPC_STRUCT_rgba_surface__
#define __ISPC_STRUCT_rgba_surface__
struct rgba_surface {
uint8_t * ptr;
int32_t width;
int32_t height;
int32_t stride;
};
#endif
#ifndef __ISPC_STRUCT_bc6h_enc_settings__
#define __ISPC_STRUCT_bc6h_enc_settings__
struct bc6h_enc_settings {
bool slow_mode;
bool fast_mode;
int32_t refineIterations_1p;
int32_t refineIterations_2p;
int32_t fastSkipTreshold;
};
#endif
#ifndef __ISPC_STRUCT_bc7_enc_settings__
#define __ISPC_STRUCT_bc7_enc_settings__
struct bc7_enc_settings {
bool mode_selection[4];
int32_t refineIterations[8];
bool skip_mode2;
int32_t fastSkipTreshold_mode1;
int32_t fastSkipTreshold_mode3;
int32_t fastSkipTreshold_mode7;
int32_t mode45_channel0;
int32_t refineIterations_channel;
int32_t channels;
};
#endif
#ifndef __ISPC_STRUCT_etc_enc_settings__
#define __ISPC_STRUCT_etc_enc_settings__
struct etc_enc_settings {
int32_t fastSkipTreshold;
};
#endif
///////////////////////////////////////////////////////////////////////////
// Functions exported from ispc code
///////////////////////////////////////////////////////////////////////////
#if defined(__cplusplus) && (! defined(__ISPC_NO_EXTERN_C) || !__ISPC_NO_EXTERN_C )
extern "C" {
#endif // __cplusplus
extern void CompressBlocksBC1_ispc(struct rgba_surface * src, uint8_t * dst);
extern void CompressBlocksBC3_ispc(struct rgba_surface * src, uint8_t * dst);
extern void CompressBlocksBC6H_ispc(struct rgba_surface * src, uint8_t * dst, struct bc6h_enc_settings * settings);
extern void CompressBlocksBC7_ispc(struct rgba_surface * src, uint8_t * dst, struct bc7_enc_settings * settings);
extern void CompressBlocksETC1_ispc(struct rgba_surface * src, uint8_t * dst, struct etc_enc_settings * settings);
#if defined(__cplusplus) && (! defined(__ISPC_NO_EXTERN_C) || !__ISPC_NO_EXTERN_C )
} /* end extern C */
#endif // __cplusplus
#ifdef __cplusplus
} /* namespace */
#endif // __cplusplus
@@ -1,89 +0,0 @@
//
// (Header automatically generated by the ispc compiler.)
// DO NOT EDIT THIS FILE.
//
#pragma once
#include <stdint.h>
#ifdef __cplusplus
namespace ispc { /* namespace */
#endif // __cplusplus
#ifndef __ISPC_ALIGN__
#if defined(__clang__) || !defined(_MSC_VER)
// Clang, GCC, ICC
#define __ISPC_ALIGN__(s) __attribute__((aligned(s)))
#define __ISPC_ALIGNED_STRUCT__(s) struct __ISPC_ALIGN__(s)
#else
// Visual Studio
#define __ISPC_ALIGN__(s) __declspec(align(s))
#define __ISPC_ALIGNED_STRUCT__(s) __ISPC_ALIGN__(s) struct
#endif
#endif
#ifndef __ISPC_STRUCT_rgba_surface__
#define __ISPC_STRUCT_rgba_surface__
struct rgba_surface {
uint8_t * ptr;
int32_t width;
int32_t height;
int32_t stride;
};
#endif
#ifndef __ISPC_STRUCT_bc6h_enc_settings__
#define __ISPC_STRUCT_bc6h_enc_settings__
struct bc6h_enc_settings {
bool slow_mode;
bool fast_mode;
int32_t refineIterations_1p;
int32_t refineIterations_2p;
int32_t fastSkipTreshold;
};
#endif
#ifndef __ISPC_STRUCT_bc7_enc_settings__
#define __ISPC_STRUCT_bc7_enc_settings__
struct bc7_enc_settings {
bool mode_selection[4];
int32_t refineIterations[8];
bool skip_mode2;
int32_t fastSkipTreshold_mode1;
int32_t fastSkipTreshold_mode3;
int32_t fastSkipTreshold_mode7;
int32_t mode45_channel0;
int32_t refineIterations_channel;
int32_t channels;
};
#endif
#ifndef __ISPC_STRUCT_etc_enc_settings__
#define __ISPC_STRUCT_etc_enc_settings__
struct etc_enc_settings {
int32_t fastSkipTreshold;
};
#endif
///////////////////////////////////////////////////////////////////////////
// Functions exported from ispc code
///////////////////////////////////////////////////////////////////////////
#if defined(__cplusplus) && (! defined(__ISPC_NO_EXTERN_C) || !__ISPC_NO_EXTERN_C )
extern "C" {
#endif // __cplusplus
extern void CompressBlocksBC1_ispc(struct rgba_surface * src, uint8_t * dst);
extern void CompressBlocksBC3_ispc(struct rgba_surface * src, uint8_t * dst);
extern void CompressBlocksBC6H_ispc(struct rgba_surface * src, uint8_t * dst, struct bc6h_enc_settings * settings);
extern void CompressBlocksBC7_ispc(struct rgba_surface * src, uint8_t * dst, struct bc7_enc_settings * settings);
extern void CompressBlocksETC1_ispc(struct rgba_surface * src, uint8_t * dst, struct etc_enc_settings * settings);
#if defined(__cplusplus) && (! defined(__ISPC_NO_EXTERN_C) || !__ISPC_NO_EXTERN_C )
} /* end extern C */
#endif // __cplusplus
#ifdef __cplusplus
} /* namespace */
#endif // __cplusplus
@@ -1,89 +0,0 @@
//
// (Header automatically generated by the ispc compiler.)
// DO NOT EDIT THIS FILE.
//
#pragma once
#include <stdint.h>
#ifdef __cplusplus
namespace ispc { /* namespace */
#endif // __cplusplus
#ifndef __ISPC_ALIGN__
#if defined(__clang__) || !defined(_MSC_VER)
// Clang, GCC, ICC
#define __ISPC_ALIGN__(s) __attribute__((aligned(s)))
#define __ISPC_ALIGNED_STRUCT__(s) struct __ISPC_ALIGN__(s)
#else
// Visual Studio
#define __ISPC_ALIGN__(s) __declspec(align(s))
#define __ISPC_ALIGNED_STRUCT__(s) __ISPC_ALIGN__(s) struct
#endif
#endif
#ifndef __ISPC_STRUCT_rgba_surface__
#define __ISPC_STRUCT_rgba_surface__
struct rgba_surface {
uint8_t * ptr;
int32_t width;
int32_t height;
int32_t stride;
};
#endif
#ifndef __ISPC_STRUCT_bc6h_enc_settings__
#define __ISPC_STRUCT_bc6h_enc_settings__
struct bc6h_enc_settings {
bool slow_mode;
bool fast_mode;
int32_t refineIterations_1p;
int32_t refineIterations_2p;
int32_t fastSkipTreshold;
};
#endif
#ifndef __ISPC_STRUCT_bc7_enc_settings__
#define __ISPC_STRUCT_bc7_enc_settings__
struct bc7_enc_settings {
bool mode_selection[4];
int32_t refineIterations[8];
bool skip_mode2;
int32_t fastSkipTreshold_mode1;
int32_t fastSkipTreshold_mode3;
int32_t fastSkipTreshold_mode7;
int32_t mode45_channel0;
int32_t refineIterations_channel;
int32_t channels;
};
#endif
#ifndef __ISPC_STRUCT_etc_enc_settings__
#define __ISPC_STRUCT_etc_enc_settings__
struct etc_enc_settings {
int32_t fastSkipTreshold;
};
#endif
///////////////////////////////////////////////////////////////////////////
// Functions exported from ispc code
///////////////////////////////////////////////////////////////////////////
#if defined(__cplusplus) && (! defined(__ISPC_NO_EXTERN_C) || !__ISPC_NO_EXTERN_C )
extern "C" {
#endif // __cplusplus
extern void CompressBlocksBC1_ispc(struct rgba_surface * src, uint8_t * dst);
extern void CompressBlocksBC3_ispc(struct rgba_surface * src, uint8_t * dst);
extern void CompressBlocksBC6H_ispc(struct rgba_surface * src, uint8_t * dst, struct bc6h_enc_settings * settings);
extern void CompressBlocksBC7_ispc(struct rgba_surface * src, uint8_t * dst, struct bc7_enc_settings * settings);
extern void CompressBlocksETC1_ispc(struct rgba_surface * src, uint8_t * dst, struct etc_enc_settings * settings);
#if defined(__cplusplus) && (! defined(__ISPC_NO_EXTERN_C) || !__ISPC_NO_EXTERN_C )
} /* end extern C */
#endif // __cplusplus
#ifdef __cplusplus
} /* namespace */
#endif // __cplusplus
@@ -1,89 +0,0 @@
//
// (Header automatically generated by the ispc compiler.)
// DO NOT EDIT THIS FILE.
//
#pragma once
#include <stdint.h>
#ifdef __cplusplus
namespace ispc { /* namespace */
#endif // __cplusplus
#ifndef __ISPC_ALIGN__
#if defined(__clang__) || !defined(_MSC_VER)
// Clang, GCC, ICC
#define __ISPC_ALIGN__(s) __attribute__((aligned(s)))
#define __ISPC_ALIGNED_STRUCT__(s) struct __ISPC_ALIGN__(s)
#else
// Visual Studio
#define __ISPC_ALIGN__(s) __declspec(align(s))
#define __ISPC_ALIGNED_STRUCT__(s) __ISPC_ALIGN__(s) struct
#endif
#endif
#ifndef __ISPC_STRUCT_rgba_surface__
#define __ISPC_STRUCT_rgba_surface__
struct rgba_surface {
uint8_t * ptr;
int32_t width;
int32_t height;
int32_t stride;
};
#endif
#ifndef __ISPC_STRUCT_bc6h_enc_settings__
#define __ISPC_STRUCT_bc6h_enc_settings__
struct bc6h_enc_settings {
bool slow_mode;
bool fast_mode;
int32_t refineIterations_1p;
int32_t refineIterations_2p;
int32_t fastSkipTreshold;
};
#endif
#ifndef __ISPC_STRUCT_bc7_enc_settings__
#define __ISPC_STRUCT_bc7_enc_settings__
struct bc7_enc_settings {
bool mode_selection[4];
int32_t refineIterations[8];
bool skip_mode2;
int32_t fastSkipTreshold_mode1;
int32_t fastSkipTreshold_mode3;
int32_t fastSkipTreshold_mode7;
int32_t mode45_channel0;
int32_t refineIterations_channel;
int32_t channels;
};
#endif
#ifndef __ISPC_STRUCT_etc_enc_settings__
#define __ISPC_STRUCT_etc_enc_settings__
struct etc_enc_settings {
int32_t fastSkipTreshold;
};
#endif
///////////////////////////////////////////////////////////////////////////
// Functions exported from ispc code
///////////////////////////////////////////////////////////////////////////
#if defined(__cplusplus) && (! defined(__ISPC_NO_EXTERN_C) || !__ISPC_NO_EXTERN_C )
extern "C" {
#endif // __cplusplus
extern void CompressBlocksBC1_ispc(struct rgba_surface * src, uint8_t * dst);
extern void CompressBlocksBC3_ispc(struct rgba_surface * src, uint8_t * dst);
extern void CompressBlocksBC6H_ispc(struct rgba_surface * src, uint8_t * dst, struct bc6h_enc_settings * settings);
extern void CompressBlocksBC7_ispc(struct rgba_surface * src, uint8_t * dst, struct bc7_enc_settings * settings);
extern void CompressBlocksETC1_ispc(struct rgba_surface * src, uint8_t * dst, struct etc_enc_settings * settings);
#if defined(__cplusplus) && (! defined(__ISPC_NO_EXTERN_C) || !__ISPC_NO_EXTERN_C )
} /* end extern C */
#endif // __cplusplus
#ifdef __cplusplus
} /* namespace */
#endif // __cplusplus
File diff suppressed because it is too large Load Diff
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:3cfef8964d6723c26e4a6c4a4e46278a6e2a5bccefc3185750c824358e471dd2
size 7666
@@ -0,0 +1,16 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
/*
* The shader build pipeline has 2 preprocess stages. The first one happens
* after appending this header and pre-processing with mcpp ahead of azslc.
*/
@@ -0,0 +1,16 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
/*
* The shader build pipeline has 2 preprocess stages. The first one happens
* after appending this header and pre-processing with mcpp ahead of azslc.
*/
@@ -102,7 +102,7 @@ namespace AZ
// Register Shader Resource Group Layout Builder
AssetBuilderSDK::AssetBuilderDesc srgLayoutBuilderDescriptor;
srgLayoutBuilderDescriptor.m_name = "Shader Resource Group Layout Builder";
srgLayoutBuilderDescriptor.m_version = 50; // ATOM-14918 (probably don't need to bump this one but just playing it safe)
srgLayoutBuilderDescriptor.m_version = 51; // SPEC-6065
srgLayoutBuilderDescriptor.m_patterns.push_back(AssetBuilderSDK::AssetBuilderPattern("*.azsl", AssetBuilderSDK::AssetBuilderPattern::PatternType::Wildcard));
srgLayoutBuilderDescriptor.m_patterns.push_back(AssetBuilderSDK::AssetBuilderPattern("*.azsli", AssetBuilderSDK::AssetBuilderPattern::PatternType::Wildcard));
srgLayoutBuilderDescriptor.m_patterns.push_back(AssetBuilderSDK::AssetBuilderPattern(AZStd::string::format("*.%s", SrgLayoutBuilder::MergedPartialSrgsExtension), AssetBuilderSDK::AssetBuilderPattern::PatternType::Wildcard));
@@ -117,7 +117,7 @@ namespace AZ
// Register Shader Asset Builder
AssetBuilderSDK::AssetBuilderDesc shaderAssetBuilderDescriptor;
shaderAssetBuilderDescriptor.m_name = "Shader Asset Builder";
shaderAssetBuilderDescriptor.m_version = 95; // LKG Merge
shaderAssetBuilderDescriptor.m_version = 96; // SPEC-6065
// .shader file changes trigger rebuilds
shaderAssetBuilderDescriptor.m_patterns.push_back(AssetBuilderSDK::AssetBuilderPattern( AZStd::string::format("*.%s", RPI::ShaderSourceData::Extension), AssetBuilderSDK::AssetBuilderPattern::PatternType::Wildcard));
shaderAssetBuilderDescriptor.m_busId = azrtti_typeid<ShaderAssetBuilder>();
@@ -132,7 +132,7 @@ namespace AZ
shaderVariantAssetBuilderDescriptor.m_name = "Shader Variant Asset Builder";
// Both "Shader Variant Asset Builder" and "Shader Asset Builder" produce ShaderVariantAsset products. If you update
// ShaderVariantAsset you will need to update BOTH version numbers, not just "Shader Variant Asset Builder".
shaderVariantAssetBuilderDescriptor.m_version = 16; // LKG Merge
shaderVariantAssetBuilderDescriptor.m_version = 17; // SPEC-6065
shaderVariantAssetBuilderDescriptor.m_patterns.push_back(AssetBuilderSDK::AssetBuilderPattern(AZStd::string::format("*.%s", RPI::ShaderVariantListSourceData::Extension), AssetBuilderSDK::AssetBuilderPattern::PatternType::Wildcard));
shaderVariantAssetBuilderDescriptor.m_busId = azrtti_typeid<ShaderVariantAssetBuilder>();
shaderVariantAssetBuilderDescriptor.m_createJobFunction = AZStd::bind(&ShaderVariantAssetBuilder::CreateJobs, &m_shaderVariantAssetBuilder, AZStd::placeholders::_1, AZStd::placeholders::_2);
@@ -568,6 +568,26 @@ namespace AZ
Outcome<AzslSubProducts::Paths> ObtainBuildArtifactsFromAzslBuilder([[maybe_unused]] const char* builderName, const AZStd::string& sourceFullPath, RHI::APIType apiType, const AZStd::string& platform)
{
AzslSubProducts::Paths products;
// platform id from identifier
AzFramework::PlatformId platformId = AzFramework::PlatformId::PC;
if (platform == "pc")
{
platformId = AzFramework::PlatformId::PC;
}
else if (platform == "osx_gl")
{
platformId = AzFramework::PlatformId::OSX;
}
else if (platform == "es3")
{
platformId = AzFramework::PlatformId::ES3;
}
else if (platform == "ios")
{
platformId = AzFramework::PlatformId::IOS;
}
for (RPI::ShaderAssetSubId sub : AzslSubProducts::SubList)
{
uint32_t assetSubId = MakeAzslBuildProductSubId(sub, apiType);
@@ -582,25 +602,6 @@ namespace AZ
AZStd::string assetPath;
Data::AssetCatalogRequestBus::BroadcastResult(assetPath, &Data::AssetCatalogRequests::GetAssetPathById, assetId);
// platform id from identifier
AzFramework::PlatformId platformId = AzFramework::PlatformId::PC;
if (platform == "pc")
{
platformId = AzFramework::PlatformId::PC;
}
if (platform == "osx_gl")
{
platformId = AzFramework::PlatformId::OSX;
}
else if (platform == "es3")
{
platformId = AzFramework::PlatformId::ES3;
}
else if (platform == "ios")
{
platformId = AzFramework::PlatformId::IOS;
}
// get the root:
AZStd::string assetRoot = AzToolsFramework::PlatformAddressedAssetCatalog::GetAssetRootForPlatform(platformId);
// join
@@ -96,7 +96,7 @@ namespace AZ
//! This is meant to be used at this stage:
//!
//! .azsl source -> common header prepend -> preprocess -> azslc -> dxc -> cross
//! here
//! ^here^
AZStd::string DumpPreprocessedCode(
const char* BuilderName,
const AZStd::string& preprocessedCode,
@@ -109,7 +109,7 @@ namespace AZ
//! This is meant to be used at this stage:
//!
//! .azsl source -> common header prepend -> preprocess -> azslc -> dxc -> cross
//! here
//! ^here^
AZStd::string DumpAzslPrependedCode(
const char* BuilderName,
const AZStd::string& nonPreprocessedYetAzslSource,
@@ -162,6 +162,7 @@ namespace AZ
AZStd::string expectedHigherPrecedenceFileFullPath;
AzFramework::StringFunc::Path::Join(gameProjectPath, RPI::ShaderVariantTreeAsset::CommonSubFolder, expectedHigherPrecedenceFileFullPath, false /* handle directory overlap? */, false /* be case insensitive? */);
AzFramework::StringFunc::Path::Join(expectedHigherPrecedenceFileFullPath.c_str(), shaderProductFileRelativePath.c_str(), expectedHigherPrecedenceFileFullPath, false /* handle directory overlap? */, false /* be case insensitive? */);
AzFramework::StringFunc::Path::ReplaceExtension(expectedHigherPrecedenceFileFullPath, AZ::RPI::ShaderVariantAsset::Extension);
AzFramework::StringFunc::Path::Normalize(expectedHigherPrecedenceFileFullPath);
AZStd::string normalizedShaderVariantListFileFullPath = shaderVariantListFileFullPath;
@@ -469,6 +470,12 @@ namespace AZ
AZStd::string previousLoopApiName;
for (RHI::ShaderPlatformInterface* shaderPlatformInterface : platformInterfaces)
{
// Null backend is special and does not require any processing.
if (shaderPlatformInterface->GetAPIUniqueIndex() == static_cast<uint32_t>(AZ::RHI::APIIndex::Null))
{
continue;
}
if (shaderSourceDescriptor.IsRhiBackendDisabled(shaderPlatformInterface->GetAPIName()))
{
// Gracefully do nothing and continue with the next shaderPlatformInterface.
@@ -647,6 +654,12 @@ namespace AZ
// Generate shaders for each of those ShaderPlatformInterfaces.
for (RHI::ShaderPlatformInterface* shaderPlatformInterface : platformInterfaces)
{
// Null backend is special and does not require any processing.
if (shaderPlatformInterface->GetAPIUniqueIndex() == static_cast<uint32_t>(AZ::RHI::APIIndex::Null))
{
continue;
}
AZ_TraceContext("ShaderPlatformInterface", shaderPlatformInterface->GetAPIName().GetCStr());
if (shaderSourceDescriptor.IsRhiBackendDisabled(shaderPlatformInterface->GetAPIName()))
@@ -28,6 +28,14 @@ ly_add_target_files(
Builders/ShaderHeaders/Platform/Windows/Vulkan
)
ly_add_target_files(
TARGETS Atom_Asset_Shader.Builders
FILES
${CMAKE_CURRENT_SOURCE_DIR}/AZSL/Platform/Windows/Null/AzslcHeader.azsli
OUTPUT_SUBDIRECTORY
Builders/ShaderHeaders/Platform/Windows/Null
)
ly_add_target_files(
TARGETS Atom_Asset_Shader.Builders
FILES
@@ -37,6 +45,14 @@ ly_add_target_files(
Builders/ShaderHeaders/Platform/Mac/Metal
)
ly_add_target_files(
TARGETS Atom_Asset_Shader.Builders
FILES
${CMAKE_CURRENT_SOURCE_DIR}/AZSL/Platform/Mac/Null/AzslcHeader.azsli
OUTPUT_SUBDIRECTORY
Builders/ShaderHeaders/Platform/Mac/Null
)
ly_add_target_files(
TARGETS Atom_Asset_Shader.Builders
FILES
@@ -28,6 +28,14 @@ ly_add_target_files(
Builders/ShaderHeaders/Platform/Windows/Vulkan
)
ly_add_target_files(
TARGETS Atom_Asset_Shader.Builders
FILES
${CMAKE_CURRENT_SOURCE_DIR}/AZSL/Platform/Windows/Null/AzslcHeader.azsli
OUTPUT_SUBDIRECTORY
Builders/ShaderHeaders/Platform/Windows/Null
)
ly_add_target_files(
TARGETS Atom_Asset_Shader.Builders
FILES
@@ -37,6 +45,14 @@ ly_add_target_files(
Builders/ShaderHeaders/Platform/Mac/Metal
)
ly_add_target_files(
TARGETS Atom_Asset_Shader.Builders
FILES
${CMAKE_CURRENT_SOURCE_DIR}/AZSL/Platform/Mac/Null/AzslcHeader.azsli
OUTPUT_SUBDIRECTORY
Builders/ShaderHeaders/Platform/Mac/Null
)
ly_add_target_files(
TARGETS Atom_Asset_Shader.Builders
FILES
@@ -288,15 +288,12 @@ namespace AZ
bool BootstrapSystemComponent::EnsureDefaultRenderPipelineInstalledForScene(AZ::RPI::ScenePtr scene, AZ::RPI::ViewportContextPtr viewportContext)
{
// Create a render pipeline from the specified asset for the window context and add the pipeline to the scene
// Create a render pipeline from the specified asset for the window context and add the pipeline to the scene.
// When running with no Asset Processor (for example in release), CompileAssetSync will return AssetStatus_Unknown.
AzFramework::AssetSystem::AssetStatus status = AzFramework::AssetSystem::AssetStatus_Unknown;
AzFramework::AssetSystemRequestBus::BroadcastResult(
status, &AzFramework::AssetSystemRequestBus::Events::CompileAssetSync, m_defaultPipelineAssetPath);
AZ_Error("RPISystem", status == AzFramework::AssetSystem::AssetStatus_Compiled, "Could not compile the default render pipeline at '%s'", m_defaultPipelineAssetPath.c_str());
if (status != AzFramework::AssetSystem::AssetStatus_Compiled)
{
return false;
}
AZ_Assert(status == AzFramework::AssetSystem::AssetStatus_Compiled || status == AzFramework::AssetSystem::AssetStatus_Unknown, "Could not compile the default render pipeline at '%s'", m_defaultPipelineAssetPath.c_str());
Data::Asset<RPI::AnyAsset> pipelineAsset = RPI::AssetUtils::LoadAssetByProductPath<RPI::AnyAsset>(m_defaultPipelineAssetPath.c_str(), RPI::AssetUtils::TraceLevel::Error);
RPI::RenderPipelineDescriptor renderPipelineDescriptor = *RPI::GetDataFromAnyAsset<RPI::RenderPipelineDescriptor>(pipelineAsset);
@@ -30,6 +30,7 @@ namespace AZ
CameraModule()
{
m_descriptors.insert(m_descriptors.end(), {
CameraControllerComponent::CreateDescriptor(),
ArcBallControllerComponent::CreateDescriptor(),
CameraComponent::CreateDescriptor(),
NoClipControllerComponent::CreateDescriptor(),
@@ -52,6 +52,8 @@ namespace AZ
void NoClipControllerComponent::Reflect(AZ::ReflectContext* reflection)
{
NoClipControllerProperties::Reflect(reflection);
if (auto* serializeContext = azrtti_cast<AZ::SerializeContext*>(reflection))
{
serializeContext->Class<NoClipControllerComponent, CameraControllerComponent, AZ::Component>()
@@ -1,21 +0,0 @@
#
# All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
# its licensors.
#
# For complete copyright and license terms please see the LICENSE at the root of this
# distribution (the "License"). All use of this software is governed by the License,
# or, if provided, by the license below or the license accompanying this file. Do not
# remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#
set(LUX_CORE_LIBS ${BASE_PATH}/win64/lib/luxcore.lib)
set(LUX_CORE_RUNTIME_DEPENDENCIES
${BASE_PATH}/win64/dll/embree3.dll
${BASE_PATH}/win64/dll/luxcore.dll
${BASE_PATH}/win64/dll/OpenImageDenoise.dll
#${BASE_PATH}/win64/dll/OpenImageIO.dll ### ATOM-5988 This dll is 1.8 and currently conflicts with Windows version of full SDK of OpenImageIO 2.1
${BASE_PATH}/win64/dll/tbb.dll
${BASE_PATH}/win64/dll/tbbmalloc.dll
)
-9
View File
@@ -1,9 +0,0 @@
{
"name": "imgui_atom",
"source": "@GEM@/External/ImGui",
"description": "ImGui",
"defines": [],
"lib_required": "False",
"includes": [""]
}
-31
View File
@@ -1,31 +0,0 @@
{
"name": "lux_core",
"source": "@GEM@/External/LuxCore2.2",
"description": "LuxCore",
"includes": ["include"],
"defines": [],
"lib_required": "True",
"shared_required": "True",
"platform" : {
"win_x64_vs2017": {
"sharedlibpath": [
"win64/dll"
],
"importlibpath": [
"win64/lib"
],
"import": [
"luxcore.lib"
],
"shared": [
"embree3.dll",
"luxcore.dll",
"OpenImageDenoise.dll",
"OpenImageIO.dll",
"tbb.dll",
"tbbmalloc.dll"
]
},
"win_x64_vs2019": "@win_x64_vs2017"
}
}
@@ -3,8 +3,21 @@
"Version": 1,
"ClassName": "AZ::Render::LightingPreset",
"ClassData": {
"autoSelect": false,
"displayName": "Goegap",
"iblDiffuseImageAsset": {
"assetId": {
"guid": "{3FD09945-D0F2-55C8-B9AF-B2FD421FE3BE}",
"subId": 3000
},
"assetHint": "lightingpresets/highcontrast/goegap_4k_iblglobalcm_ibldiffuse.exr.streamingimage"
},
"iblSpecularImageAsset": {
"assetId": {
"guid": "{3FD09945-D0F2-55C8-B9AF-B2FD421FE3BE}",
"subId": 2000
},
"assetHint": "lightingpresets/highcontrast/goegap_4k_iblglobalcm_iblspecular.exr.streamingimage"
},
"skyboxImageAsset": {
"assetId": {
"guid": "{215E47FD-D181-5832-B1AB-91673ABF6399}",
@@ -12,43 +25,26 @@
},
"assetHint": "lightingpresets/highcontrast/goegap_4k_skyboxcm.exr.streamingimage"
},
"iblSpecularImageAsset": {
"alternateSkyboxImageAsset": {
"assetId": {
"guid": "{3FD09945-D0F2-55C8-B9AF-B2Fd421FE3BE}",
"subId": 2000
},
"assetHint": "lightingpresets/highcontrast/goegap_4k_iblglobalcm_iblspecular.exr.streamingimage"
},
"iblDiffuseImageAsset": {
"assetId": {
"guid": "{3FD09945-D0F2-55C8-B9AF-B2Fd421FE3BE}",
"guid": "{3FD09945-D0F2-55C8-B9AF-B2FD421FE3BE}",
"subId": 3000
},
"assetHint": "lightingpresets/highcontrast/goegap_4k_iblglobalcm_ibldiffuse.exr.streamingimage"
},
"iblExposure": 0.0,
"skyboxExposure": 0.0,
"shadowCatcherOpacity": 0.3499999940395355,
"lights": [
{
"direction": [
0.372,
0.572,
-0.728
],
"color": [
1.0,
1.0,
1.0,
1.0
0.3720000088214874,
0.5720000267028809,
-0.7279999852180481
],
"intensity": 15.0,
"shadowCascadeCount": 4,
"shadowRatioLogarithmUniform": 1.0,
"shadowFarClipDistance": 20.0,
"shadowmapSize": "Size2048",
"enableShadowDebugColoring": false
"shadowmapSize": "Size2048"
}
],
"shadowCatcherOpacity": 0.3499999940395355
]
}
}
@@ -1,54 +0,0 @@
{
"Type": "JsonSerialization",
"Version": 1,
"ClassName": "AZ::Render::LightingPreset",
"ClassData": {
"autoSelect": false,
"displayName": "Goegap (Alt)",
"skyboxImageAsset": {
"assetId": {
"guid": "{3FD09945-D0F2-55C8-B9AF-B2Fd421FE3BE}",
"subId": 3000
},
"assetHint": "lightingpresets/highcontrast/goegap_4k_iblglobalcm_ibldiffuse.exr.streamingimage"
},
"iblSpecularImageAsset": {
"assetId": {
"guid": "{3FD09945-D0F2-55C8-B9AF-B2Fd421FE3BE}",
"subId": 2000
},
"assetHint": "lightingpresets/highcontrast/goegap_4k_iblglobalcm_iblspecular.exr.streamingimage"
},
"iblDiffuseImageAsset": {
"assetId": {
"guid": "{3FD09945-D0F2-55C8-B9AF-B2Fd421FE3BE}",
"subId": 3000
},
"assetHint": "lightingpresets/highcontrast/goegap_4k_iblglobalcm_ibldiffuse.exr.streamingimage"
},
"iblExposure": 0.0,
"skyboxExposure": 0.0,
"lights": [
{
"direction": [
0.372,
0.572,
-0.728
],
"color": [
1.0,
1.0,
1.0,
1.0
],
"intensity": 15.0,
"shadowCascadeCount": 4,
"shadowRatioLogarithmUniform": 1.0,
"shadowFarClipDistance": 20.0,
"shadowmapSize": "Size2048",
"enableShadowDebugColoring": false
}
],
"shadowCatcherOpacity": 0.10000000149011612
}
}
@@ -3,14 +3,13 @@
"Version": 1,
"ClassName": "AZ::Render::LightingPreset",
"ClassData": {
"autoSelect": false,
"displayName": "Artist Workshop",
"skyboxImageAsset": {
"iblDiffuseImageAsset": {
"assetId": {
"guid": "{D2B747EE-85B8-5766-8AA0-CCB6AFF81BA2}",
"subId": 1000
"subId": 3000
},
"assetHint": "lightingpresets/lowcontrast/artist_workshop_4k_iblskyboxcm.exr.streamingimage"
"assetHint": "lightingpresets/lowcontrast/artist_workshop_4k_iblskyboxcm_ibldiffuse.exr.streamingimage"
},
"iblSpecularImageAsset": {
"assetId": {
@@ -19,15 +18,21 @@
},
"assetHint": "lightingpresets/lowcontrast/artist_workshop_4k_iblskyboxcm_iblspecular.exr.streamingimage"
},
"iblDiffuseImageAsset": {
"skyboxImageAsset": {
"assetId": {
"guid": "{D2B747EE-85B8-5766-8AA0-CCB6AFF81BA2}",
"subId": 1000
},
"assetHint": "lightingpresets/lowcontrast/artist_workshop_4k_iblskyboxcm.exr.streamingimage"
},
"alternateSkyboxImageAsset": {
"assetId": {
"guid": "{D2B747EE-85B8-5766-8AA0-CCB6AFF81BA2}",
"subId": 3000
},
"assetHint": "lightingpresets/lowcontrast/artist_workshop_4k_iblskyboxcm_ibldiffuse.exr.streamingimage"
},
"iblExposure": 0.0,
"skyboxExposure": 0.0,
"shadowCatcherOpacity": 0.3499999940395355,
"lights": [
{
"direction": [
@@ -35,20 +40,10 @@
1.0,
-0.20000000298023225
],
"color": [
1.0,
1.0,
1.0,
1.0
],
"intensity": 1.0,
"shadowCascadeCount": 4,
"shadowRatioLogarithmUniform": 1.0,
"shadowFarClipDistance": 20.0,
"shadowmapSize": "Size2048",
"enableShadowDebugColoring": false
"shadowmapSize": "Size2048"
}
],
"shadowCatcherOpacity": 0.3499999940395355
]
}
}
@@ -1,54 +0,0 @@
{
"Type": "JsonSerialization",
"Version": 1,
"ClassName": "AZ::Render::LightingPreset",
"ClassData": {
"autoSelect": false,
"displayName": "Artist Workshop (Alt)",
"skyboxImageAsset": {
"assetId": {
"guid": "{D2B747EE-85B8-5766-8AA0-CCB6AFF81BA2}",
"subId": 3000
},
"assetHint": "lightingpresets/lowcontrast/artist_workshop_4k_iblskyboxcm_ibldiffuse.exr.streamingimage"
},
"iblSpecularImageAsset": {
"assetId": {
"guid": "{D2B747EE-85B8-5766-8AA0-CCB6AFF81BA2}",
"subId": 2000
},
"assetHint": "lightingpresets/lowcontrast/artist_workshop_4k_iblskyboxcm_iblspecular.exr.streamingimage"
},
"iblDiffuseImageAsset": {
"assetId": {
"guid": "{D2B747EE-85B8-5766-8AA0-CCB6AFF81BA2}",
"subId": 3000
},
"assetHint": "lightingpresets/lowcontrast/artist_workshop_4k_iblskyboxcm_ibldiffuse.exr.streamingimage"
},
"iblExposure": 0.0,
"skyboxExposure": 0.0,
"lights": [
{
"direction": [
0.5,
1.0,
-0.20000000298023225
],
"color": [
1.0,
1.0,
1.0,
1.0
],
"intensity": 1.0,
"shadowCascadeCount": 4,
"shadowRatioLogarithmUniform": 1.0,
"shadowFarClipDistance": 20.0,
"shadowmapSize": "Size2048",
"enableShadowDebugColoring": false
}
],
"shadowCatcherOpacity": 0.10000000149011612
}
}
@@ -3,14 +3,13 @@
"Version": 1,
"ClassName": "AZ::Render::LightingPreset",
"ClassData": {
"autoSelect": false,
"displayName": "Blau River",
"skyboxImageAsset": {
"iblDiffuseImageAsset": {
"assetId": {
"guid": "{442FFD57-9ED2-51A5-B627-764AE2A2161F}",
"subId": 1000
"subId": 3000
},
"assetHint": "lightingpresets/lowcontrast/blau_river_4k_iblskyboxcm.exr.streamingimage"
"assetHint": "lightingpresets/lowcontrast/blau_river_4k_iblskyboxcm_ibldiffuse.exr.streamingimage"
},
"iblSpecularImageAsset": {
"assetId": {
@@ -19,15 +18,21 @@
},
"assetHint": "lightingpresets/lowcontrast/blau_river_4k_iblskyboxcm_iblspecular.exr.streamingimage"
},
"iblDiffuseImageAsset": {
"skyboxImageAsset": {
"assetId": {
"guid": "{442FFD57-9ED2-51A5-B627-764AE2A2161F}",
"subId": 1000
},
"assetHint": "lightingpresets/lowcontrast/blau_river_4k_iblskyboxcm.exr.streamingimage"
},
"alternateSkyboxImageAsset": {
"assetId": {
"guid": "{442FFD57-9ED2-51A5-B627-764AE2A2161F}",
"subId": 3000
},
"assetHint": "lightingpresets/lowcontrast/blau_river_4k_iblskyboxcm_ibldiffuse.exr.streamingimage"
},
"iblExposure": 0.0,
"skyboxExposure": 0.0,
"shadowCatcherOpacity": 0.3499999940395355,
"lights": [
{
"direction": [
@@ -35,20 +40,10 @@
0.4000000059604645,
-1.0
],
"color": [
1.0,
1.0,
1.0,
1.0
],
"intensity": 1.0,
"shadowCascadeCount": 4,
"shadowRatioLogarithmUniform": 1.0,
"shadowFarClipDistance": 20.0,
"shadowmapSize": "Size2048",
"enableShadowDebugColoring": false
"shadowmapSize": "Size2048"
}
],
"shadowCatcherOpacity": 0.3499999940395355
]
}
}
@@ -1,54 +0,0 @@
{
"Type": "JsonSerialization",
"Version": 1,
"ClassName": "AZ::Render::LightingPreset",
"ClassData": {
"autoSelect": false,
"displayName": "Blau River (Alt)",
"skyboxImageAsset": {
"assetId": {
"guid": "{442FFD57-9ED2-51A5-B627-764AE2A2161F}",
"subId": 3000
},
"assetHint": "lightingpresets/lowcontrast/blau_river_4k_iblskyboxcm_ibldiffuse.exr.streamingimage"
},
"iblSpecularImageAsset": {
"assetId": {
"guid": "{442FFD57-9ED2-51A5-B627-764AE2A2161F}",
"subId": 2000
},
"assetHint": "lightingpresets/lowcontrast/blau_river_4k_iblskyboxcm_iblspecular.exr.streamingimage"
},
"iblDiffuseImageAsset": {
"assetId": {
"guid": "{442FFD57-9ED2-51A5-B627-764AE2A2161F}",
"subId": 3000
},
"assetHint": "lightingpresets/lowcontrast/blau_river_4k_iblskyboxcm_ibldiffuse.exr.streamingimage"
},
"iblExposure": 0.0,
"skyboxExposure": 0.0,
"lights": [
{
"direction": [
0.4000000059604645,
0.4000000059604645,
-1.0
],
"color": [
1.0,
1.0,
1.0,
1.0
],
"intensity": 1.0,
"shadowCascadeCount": 4,
"shadowRatioLogarithmUniform": 1.0,
"shadowFarClipDistance": 20.0,
"shadowmapSize": "Size2048",
"enableShadowDebugColoring": false
}
],
"shadowCatcherOpacity": 0.15000000596046449
}
}
@@ -3,14 +3,13 @@
"Version": 1,
"ClassName": "AZ::Render::LightingPreset",
"ClassData": {
"autoSelect": false,
"displayName": "Blouberg Sunrise 1",
"skyboxImageAsset": {
"iblDiffuseImageAsset": {
"assetId": {
"guid": "{10853039-DC8A-558A-B27E-4433A6386731}",
"subId": 1000
"subId": 3000
},
"assetHint": "lightingpresets/lowcontrast/blouberg_sunrise_1_4k_iblskyboxcm.exr.streamingimage"
"assetHint": "lightingpresets/lowcontrast/blouberg_sunrise_1_4k_iblskyboxcm_ibldiffuse.exr.streamingimage"
},
"iblSpecularImageAsset": {
"assetId": {
@@ -19,15 +18,21 @@
},
"assetHint": "lightingpresets/lowcontrast/blouberg_sunrise_1_4k_iblskyboxcm_iblspecular.exr.streamingimage"
},
"iblDiffuseImageAsset": {
"skyboxImageAsset": {
"assetId": {
"guid": "{10853039-DC8A-558A-B27E-4433A6386731}",
"subId": 1000
},
"assetHint": "lightingpresets/lowcontrast/blouberg_sunrise_1_4k_iblskyboxcm.exr.streamingimage"
},
"alternateSkyboxImageAsset": {
"assetId": {
"guid": "{10853039-DC8A-558A-B27E-4433A6386731}",
"subId": 3000
},
"assetHint": "lightingpresets/lowcontrast/blouberg_sunrise_1_4k_iblskyboxcm_ibldiffuse.exr.streamingimage"
},
"iblExposure": 0.0,
"skyboxExposure": 0.0,
"shadowCatcherOpacity": 0.15000000596046449,
"lights": [
{
"direction": [
@@ -35,20 +40,10 @@
-0.699999988079071,
-0.25
],
"color": [
1.0,
1.0,
1.0,
1.0
],
"intensity": 1.0,
"shadowCascadeCount": 4,
"shadowRatioLogarithmUniform": 1.0,
"shadowFarClipDistance": 20.0,
"shadowmapSize": "Size2048",
"enableShadowDebugColoring": false
"shadowmapSize": "Size2048"
}
],
"shadowCatcherOpacity": 0.15000000596046449
]
}
}
@@ -1,54 +0,0 @@
{
"Type": "JsonSerialization",
"Version": 1,
"ClassName": "AZ::Render::LightingPreset",
"ClassData": {
"autoSelect": false,
"displayName": "Blouberg Sunrise 1 (Alt)",
"skyboxImageAsset": {
"assetId": {
"guid": "{10853039-DC8A-558A-B27E-4433A6386731}",
"subId": 3000
},
"assetHint": "lightingpresets/lowcontrast/blouberg_sunrise_1_4k_iblskyboxcm_ibldiffuse.exr.streamingimage"
},
"iblSpecularImageAsset": {
"assetId": {
"guid": "{10853039-DC8A-558A-B27E-4433A6386731}",
"subId": 2000
},
"assetHint": "lightingpresets/lowcontrast/blouberg_sunrise_1_4k_iblskyboxcm_iblspecular.exr.streamingimage"
},
"iblDiffuseImageAsset": {
"assetId": {
"guid": "{10853039-DC8A-558A-B27E-4433A6386731}",
"subId": 3000
},
"assetHint": "lightingpresets/lowcontrast/blouberg_sunrise_1_4k_iblskyboxcm_ibldiffuse.exr.streamingimage"
},
"iblExposure": 0.0,
"skyboxExposure": 0.0,
"lights": [
{
"direction": [
-0.25,
-0.699999988079071,
-0.25
],
"color": [
1.0,
1.0,
1.0,
1.0
],
"intensity": 1.0,
"shadowCascadeCount": 4,
"shadowRatioLogarithmUniform": 1.0,
"shadowFarClipDistance": 20.0,
"shadowmapSize": "Size2048",
"enableShadowDebugColoring": false
}
],
"shadowCatcherOpacity": 0.15000000596046449
}
}
@@ -3,14 +3,13 @@
"Version": 1,
"ClassName": "AZ::Render::LightingPreset",
"ClassData": {
"autoSelect": false,
"displayName": "Champagne Castle 1",
"skyboxImageAsset": {
"iblDiffuseImageAsset": {
"assetId": {
"guid": "{40D2CCBC-1372-59E5-BF36-D2EA46C10195}",
"subId": 1000
"subId": 3000
},
"assetHint": "lightingpresets/lowcontrast/champagne_castle_1_4k_iblskyboxcm.exr.streamingimage"
"assetHint": "lightingpresets/lowcontrast/champagne_castle_1_4k_iblskyboxcm_ibldiffuse.exr.streamingimage"
},
"iblSpecularImageAsset": {
"assetId": {
@@ -19,15 +18,21 @@
},
"assetHint": "lightingpresets/lowcontrast/champagne_castle_1_4k_iblskyboxcm_iblspecular.exr.streamingimage"
},
"iblDiffuseImageAsset": {
"skyboxImageAsset": {
"assetId": {
"guid": "{40D2CCBC-1372-59E5-BF36-D2EA46C10195}",
"subId": 1000
},
"assetHint": "lightingpresets/lowcontrast/champagne_castle_1_4k_iblskyboxcm.exr.streamingimage"
},
"alternateSkyboxImageAsset": {
"assetId": {
"guid": "{40D2CCBC-1372-59E5-BF36-D2EA46C10195}",
"subId": 3000
},
"assetHint": "lightingpresets/lowcontrast/champagne_castle_1_4k_iblskyboxcm_ibldiffuse.exr.streamingimage"
},
"iblExposure": 0.0,
"skyboxExposure": 0.0,
"shadowCatcherOpacity": 0.3499999940395355,
"lights": [
{
"direction": [
@@ -35,20 +40,10 @@
0.25,
-1.0
],
"color": [
1.0,
1.0,
1.0,
1.0
],
"intensity": 1.0,
"shadowCascadeCount": 4,
"shadowRatioLogarithmUniform": 1.0,
"shadowFarClipDistance": 20.0,
"shadowmapSize": "Size2048",
"enableShadowDebugColoring": false
"shadowmapSize": "Size2048"
}
],
"shadowCatcherOpacity": 0.3499999940395355
]
}
}
@@ -1,54 +0,0 @@
{
"Type": "JsonSerialization",
"Version": 1,
"ClassName": "AZ::Render::LightingPreset",
"ClassData": {
"autoSelect": false,
"displayName": "Champagne Castle 1 (Alt)",
"skyboxImageAsset": {
"assetId": {
"guid": "{40D2CCBC-1372-59E5-BF36-D2EA46C10195}",
"subId": 3000
},
"assetHint": "lightingpresets/lowcontrast/champagne_castle_1_4k_iblskyboxcm_ibldiffuse.exr.streamingimage"
},
"iblSpecularImageAsset": {
"assetId": {
"guid": "{40D2CCBC-1372-59E5-BF36-D2EA46C10195}",
"subId": 2000
},
"assetHint": "lightingpresets/lowcontrast/champagne_castle_1_4k_iblskyboxcm_iblspecular.exr.streamingimage"
},
"iblDiffuseImageAsset": {
"assetId": {
"guid": "{40D2CCBC-1372-59E5-BF36-D2EA46C10195}",
"subId": 3000
},
"assetHint": "lightingpresets/lowcontrast/champagne_castle_1_4k_iblskyboxcm_ibldiffuse.exr.streamingimage"
},
"iblExposure": 0.0,
"skyboxExposure": 0.0,
"lights": [
{
"direction": [
-0.10000000149011612,
0.25,
-1.0
],
"color": [
1.0,
1.0,
1.0,
1.0
],
"intensity": 1.0,
"shadowCascadeCount": 4,
"shadowRatioLogarithmUniform": 1.0,
"shadowFarClipDistance": 20.0,
"shadowmapSize": "Size2048",
"enableShadowDebugColoring": false
}
],
"shadowCatcherOpacity": 0.25
}
}

Some files were not shown because too many files have changed in this diff Show More