From cfe01fb64348361b068b771b7bf189c65b849d5a Mon Sep 17 00:00:00 2001 From: Stephen Liedig Date: Thu, 26 Jun 2025 08:59:23 +0800 Subject: [PATCH 1/8] feat: add command to list the parameters in parameters store --- unicorn_shared/Makefile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/unicorn_shared/Makefile b/unicorn_shared/Makefile index ffc3833..53074ee 100644 --- a/unicorn_shared/Makefile +++ b/unicorn_shared/Makefile @@ -32,3 +32,6 @@ delete-images: ## Deletes all shared images stacks --stack-name "uni-prop-$$env-images"; \ fi; \ done + +list-parameters: ## Lists all parameters in the Unicorn Properties namespace + aws ssm get-parameters-by-path --path "/uni-prop" --recursive --with-decryption --query 'Parameters[*].[Name,Value,Type]' --output table \ No newline at end of file From 4683f3eeea4c81d0264d90763f240472746bfe46 Mon Sep 17 00:00:00 2001 From: Stephen Liedig Date: Thu, 26 Jun 2025 13:51:12 +0800 Subject: [PATCH 2/8] refactor: renamed UnicornPropertiesNamespace to UnicornApprovalsNamespace in shared namespace definition --- unicorn_shared/uni-prop-namespaces.yaml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/unicorn_shared/uni-prop-namespaces.yaml b/unicorn_shared/uni-prop-namespaces.yaml index 55602fb..3045c2b 100644 --- a/unicorn_shared/uni-prop-namespaces.yaml +++ b/unicorn_shared/uni-prop-namespaces.yaml @@ -14,12 +14,12 @@ Resources: Name: !Sub /uni-prop/UnicornContractsNamespace Value: "unicorn.contracts" - UnicornPropertiesNamespaceParam: + UnicornApprovalsNamespaceParam: Type: AWS::SSM::Parameter Properties: Type: String - Name: !Sub /uni-prop/UnicornPropertiesNamespace - Value: "unicorn.properties" + Name: !Sub /uni-prop/UnicornApprovalsNamespace + Value: "unicorn.approvals" UnicornWebNamespaceParam: Type: AWS::SSM::Parameter @@ -37,7 +37,7 @@ Outputs: UnicornPropertiesNamespace: Description: Unicorn Properties namespace parameter - Value: !Ref UnicornPropertiesNamespaceParam + Value: !Ref UnicornApprovalsNamespaceParam UnicornWebNamespace: Description: Unicorn Web namespace parameter @@ -49,7 +49,7 @@ Outputs: UnicornPropertiesNamespaceValue: Description: Unicorn Properties namespace parameter value - Value: !GetAtt UnicornPropertiesNamespaceParam.Value + Value: !GetAtt UnicornApprovalsNamespaceParam.Value UnicornWebNamespaceValue: Description: Unicorn Web namespace parameter value From 08b7878c8d726ddb261e270a0385d5511ac511bf Mon Sep 17 00:00:00 2001 From: Stephen Liedig Date: Thu, 26 Jun 2025 13:52:46 +0800 Subject: [PATCH 3/8] refactor: updated resolve:ssm references for UnicornPropertiesNamespace to UnicornApprovalsNamespace across multiple templates --- unicorn_contracts/template.yaml | 2 +- .../integration/subscriber-policies.yaml | 2 +- unicorn_properties/template.yaml | 22 +++++++++---------- unicorn_web/integration/subscriptions.yaml | 2 +- unicorn_web/template.yaml | 4 ++-- 5 files changed, 16 insertions(+), 16 deletions(-) diff --git a/unicorn_contracts/template.yaml b/unicorn_contracts/template.yaml index 33b2b88..e6262d1 100644 --- a/unicorn_contracts/template.yaml +++ b/unicorn_contracts/template.yaml @@ -293,7 +293,7 @@ Resources: - !Ref AWS::AccountId source: - "{{resolve:ssm:/uni-prop/UnicornContractsNamespace}}" - - "{{resolve:ssm:/uni-prop/UnicornPropertiesNamespace}}" + - "{{resolve:ssm:/uni-prop/UnicornApprovalsNamespace}}" - "{{resolve:ssm:/uni-prop/UnicornWebNamespace}}" State: ENABLED #You may want to disable this rule in production Targets: diff --git a/unicorn_properties/integration/subscriber-policies.yaml b/unicorn_properties/integration/subscriber-policies.yaml index 265c6d4..4cdf924 100644 --- a/unicorn_properties/integration/subscriber-policies.yaml +++ b/unicorn_properties/integration/subscriber-policies.yaml @@ -46,6 +46,6 @@ Resources: "events:creatorAccount": "${aws:PrincipalAccount}" StringEquals: "events:source": - - "{{resolve:ssm:/uni-prop/UnicornPropertiesNamespace}}" + - "{{resolve:ssm:/uni-prop/UnicornApprovalsNamespace}}" "Null": "events:source": "false" diff --git a/unicorn_properties/template.yaml b/unicorn_properties/template.yaml index ab5b2a3..51c1136 100644 --- a/unicorn_properties/template.yaml +++ b/unicorn_properties/template.yaml @@ -54,19 +54,19 @@ Globals: Variables: CONTRACT_STATUS_TABLE: !Ref ContractStatusTable EVENT_BUS: !Ref UnicornPropertiesEventBus - SERVICE_NAMESPACE: "{{resolve:ssm:/uni-prop/UnicornPropertiesNamespace}}" + SERVICE_NAMESPACE: "{{resolve:ssm:/uni-prop/UnicornApprovalsNamespace}}" POWERTOOLS_LOGGER_CASE: PascalCase - POWERTOOLS_SERVICE_NAME: "{{resolve:ssm:/uni-prop/UnicornPropertiesNamespace}}" + POWERTOOLS_SERVICE_NAME: "{{resolve:ssm:/uni-prop/UnicornApprovalsNamespace}}" POWERTOOLS_TRACE_DISABLED: "false" # Explicitly disables tracing, default POWERTOOLS_LOGGER_LOG_EVENT: !If [IsProd, "false", "true"] # Logs incoming event, default POWERTOOLS_LOGGER_SAMPLE_RATE: !If [IsProd, "0.1", "0"] # Debug log sampling percentage, default - POWERTOOLS_METRICS_NAMESPACE: "{{resolve:ssm:/uni-prop/UnicornPropertiesNamespace}}" + POWERTOOLS_METRICS_NAMESPACE: "{{resolve:ssm:/uni-prop/UnicornApprovalsNamespace}}" POWERTOOLS_LOG_LEVEL: INFO # Log level for Logger (INFO, DEBUG, etc.), default LOG_LEVEL: INFO # Log level for Logger Tags: stage: !Ref Stage project: !FindInMap [Constants, ProjectName, Value] - namespace: "{{resolve:ssm:/uni-prop/UnicornPropertiesNamespace}}" + namespace: "{{resolve:ssm:/uni-prop/UnicornApprovalsNamespace}}" Resources: #### SSM PARAMETERS @@ -261,7 +261,7 @@ Resources: TableName: !Ref ContractStatusTable ImageUploadBucketName: !Sub "{{resolve:ssm:/uni-prop/${Stage}/ImagesBucket}}" EventBusName: !GetAtt UnicornPropertiesEventBus.Name - ServiceName: "{{resolve:ssm:/uni-prop/UnicornPropertiesNamespace}}" + ServiceName: "{{resolve:ssm:/uni-prop/UnicornApprovalsNamespace}}" # Store ApprovalStateMachineLogGroup workflow execution logs ApprovalStateMachineLogGroup: @@ -285,7 +285,7 @@ Resources: - Key: project Value: !FindInMap [Constants, ProjectName, Value] - Key: namespace - Value: "{{resolve:ssm:/uni-prop/UnicornPropertiesNamespace}}" + Value: "{{resolve:ssm:/uni-prop/UnicornApprovalsNamespace}}" - Key: stage Value: !Ref Stage @@ -301,7 +301,7 @@ Resources: - Key: project Value: !FindInMap [Constants, ProjectName, Value] - Key: namespace - Value: "{{resolve:ssm:/uni-prop/UnicornPropertiesNamespace}}" + Value: "{{resolve:ssm:/uni-prop/UnicornApprovalsNamespace}}" - Key: stage Value: !Ref Stage @@ -324,7 +324,7 @@ Resources: - Key: project Value: !FindInMap [Constants, ProjectName, Value] - Key: namespace - Value: "{{resolve:ssm:/uni-prop/UnicornPropertiesNamespace}}" + Value: "{{resolve:ssm:/uni-prop/UnicornApprovalsNamespace}}" - Key: stage Value: !Ref Stage @@ -355,7 +355,7 @@ Resources: Condition: StringEquals: events:source: - - "{{resolve:ssm:/uni-prop/UnicornPropertiesNamespace}}" + - "{{resolve:ssm:/uni-prop/UnicornApprovalsNamespace}}" # Catchall rule used for development purposes. Logs all events matching any of the services to CloudWatch Logs UnicornPropertiesCatchAllRule: @@ -371,7 +371,7 @@ Resources: - !Ref AWS::AccountId source: - "{{resolve:ssm:/uni-prop/UnicornContractsNamespace}}" - - "{{resolve:ssm:/uni-prop/UnicornPropertiesNamespace}}" + - "{{resolve:ssm:/uni-prop/UnicornApprovalsNamespace}}" - "{{resolve:ssm:/uni-prop/UnicornWebNamespace}}" State: ENABLED #You may want to disable this rule in production Targets: @@ -387,7 +387,7 @@ Resources: LogGroupName: !Sub - "/aws/events/${Stage}/${NS}-catchall" - Stage: !Ref Stage - NS: "{{resolve:ssm:/uni-prop/UnicornPropertiesNamespace}}" + NS: "{{resolve:ssm:/uni-prop/UnicornApprovalsNamespace}}" RetentionInDays: !FindInMap [LogsRetentionPeriodMap, !Ref Stage, Days] # Permissions to allow EventBridge to send logs to CloudWatch diff --git a/unicorn_web/integration/subscriptions.yaml b/unicorn_web/integration/subscriptions.yaml index b8f6cd7..adf2484 100644 --- a/unicorn_web/integration/subscriptions.yaml +++ b/unicorn_web/integration/subscriptions.yaml @@ -23,7 +23,7 @@ Resources: Fn::Sub: "{{resolve:ssm:/uni-prop/${Stage}/UnicornPropertiesEventBusArn}}" EventPattern: source: - - "{{resolve:ssm:/uni-prop/UnicornPropertiesNamespace}}" + - "{{resolve:ssm:/uni-prop/UnicornApprovalsNamespace}}" detail-type: - PublicationEvaluationCompleted State: ENABLED diff --git a/unicorn_web/template.yaml b/unicorn_web/template.yaml index 9e2211a..130366f 100644 --- a/unicorn_web/template.yaml +++ b/unicorn_web/template.yaml @@ -157,7 +157,7 @@ Resources: EventBusName: !Ref UnicornWebEventBus Pattern: source: - - "{{resolve:ssm:/uni-prop/UnicornPropertiesNamespace}}" + - "{{resolve:ssm:/uni-prop/UnicornApprovalsNamespace}}" detail-type: - PublicationEvaluationCompleted @@ -362,7 +362,7 @@ Resources: - !Ref AWS::AccountId source: - "{{resolve:ssm:/uni-prop/UnicornContractsNamespace}}" - - "{{resolve:ssm:/uni-prop/UnicornPropertiesNamespace}}" + - "{{resolve:ssm:/uni-prop/UnicornApprovalsNamespace}}" - "{{resolve:ssm:/uni-prop/UnicornWebNamespace}}" State: ENABLED #You may want to disable this rule in production Targets: From 6026ae857a3324d33102dbf049e18ad6b487a2c3 Mon Sep 17 00:00:00 2001 From: Stephen Liedig Date: Mon, 7 Jul 2025 07:41:26 +0800 Subject: [PATCH 4/8] refactor: rename unicorn properties to unicorn approvals --- .../.gitignore | 0 .../Makefile | 0 .../README.md | 0 .../__init__.py | 0 .../PublicationEvaluationCompleted.json | 0 .../integration/event-schemas.yaml | 4 +- .../integration/subscriber-policies.yaml | 4 +- .../integration/subscriptions.yaml | 8 ++-- .../pyproject.toml | 0 .../pytest.ini | 0 .../ruff.toml | 0 .../samconfig.toml | 4 +- .../src/README.md | 0 .../src/__init__.py | 0 .../src/properties_service/__init__.py | 0 .../contract_status_changed_event_handler.py | 0 .../src/properties_service/exceptions.py | 0 .../properties_approval_sync_function.py | 0 .../wait_for_contract_approval_function.py | 0 .../contractstatuschanged/AWSEvent.py | 0 .../ContractStatusChanged.py | 0 .../contractstatuschanged/__init__.py | 0 .../contractstatuschanged/marshaller.py | 0 .../publicationapprovalrequested/AWSEvent.py | 0 .../PublicationApprovalRequested.py | 0 .../publicationapprovalrequested/__init__.py | 0 .../marshaller.py | 0 .../state_machine/property_approval.asl.yaml | 0 .../template.yaml | 38 +++++++++---------- .../tests/__init__.py | 0 .../tests/unit/__init__.py | 0 .../tests/unit/conftest.py | 0 .../contract_status_changed_draft.json | 0 .../ddb_stream_events/sfn_check_exists.json | 0 .../ddb_stream_events/sfn_wait_approval.json | 0 .../status_approved_waiting_for_approval.json | 0 .../status_approved_with_no_workflow.json | 0 .../eventbridge/contract_status_changed.json | 0 ...tus_changed_event_contract_1_approved.json | 0 ...status_changed_event_contract_1_draft.json | 0 ...tus_changed_event_contract_2_approved.json | 0 ...status_changed_event_contract_2_draft.json | 0 .../publication_approval_requested_event.json | 0 ...ion_approval_requested_event_all_good.json | 0 ...ested_event_inappropriate_description.json | 0 ..._requested_event_inappropriate_images.json | 0 ...requested_event_non_existing_contract.json | 0 ...proval_requested_event_pause_workflow.json | 0 ...ublication_evaluation_completed_event.json | 0 ...put_event_property_approval_requested.json | 0 ..._integrity_validator_function_success.json | 0 .../lambda/contract_status_checker.json | 0 .../wait_for_contract_approval_function.json | 0 .../tests/unit/helper.py | 0 ...t_contract_status_changed_event_handler.py | 0 .../test_properties_approval_sync_function.py | 0 ...est_wait_for_contract_approval_function.py | 0 .../uv.lock | 0 58 files changed, 29 insertions(+), 29 deletions(-) rename {unicorn_properties => unicorn_approvals}/.gitignore (100%) rename {unicorn_properties => unicorn_approvals}/Makefile (100%) rename {unicorn_properties => unicorn_approvals}/README.md (100%) rename {unicorn_properties => unicorn_approvals}/__init__.py (100%) rename {unicorn_properties => unicorn_approvals}/integration/PublicationEvaluationCompleted.json (100%) rename {unicorn_properties => unicorn_approvals}/integration/event-schemas.yaml (95%) rename {unicorn_properties => unicorn_approvals}/integration/subscriber-policies.yaml (93%) rename {unicorn_properties => unicorn_approvals}/integration/subscriptions.yaml (92%) rename {unicorn_properties => unicorn_approvals}/pyproject.toml (100%) rename {unicorn_properties => unicorn_approvals}/pytest.ini (100%) rename {unicorn_properties => unicorn_approvals}/ruff.toml (100%) rename {unicorn_properties => unicorn_approvals}/samconfig.toml (87%) rename {unicorn_properties => unicorn_approvals}/src/README.md (100%) rename {unicorn_properties => unicorn_approvals}/src/__init__.py (100%) rename {unicorn_properties => unicorn_approvals}/src/properties_service/__init__.py (100%) rename {unicorn_properties => unicorn_approvals}/src/properties_service/contract_status_changed_event_handler.py (100%) rename {unicorn_properties => unicorn_approvals}/src/properties_service/exceptions.py (100%) rename {unicorn_properties => unicorn_approvals}/src/properties_service/properties_approval_sync_function.py (100%) rename {unicorn_properties => unicorn_approvals}/src/properties_service/wait_for_contract_approval_function.py (100%) rename {unicorn_properties => unicorn_approvals}/src/schema/unicorn_contracts/contractstatuschanged/AWSEvent.py (100%) rename {unicorn_properties => unicorn_approvals}/src/schema/unicorn_contracts/contractstatuschanged/ContractStatusChanged.py (100%) rename {unicorn_properties => unicorn_approvals}/src/schema/unicorn_contracts/contractstatuschanged/__init__.py (100%) rename {unicorn_properties => unicorn_approvals}/src/schema/unicorn_contracts/contractstatuschanged/marshaller.py (100%) rename {unicorn_properties => unicorn_approvals}/src/schema/unicorn_web/publicationapprovalrequested/AWSEvent.py (100%) rename {unicorn_properties => unicorn_approvals}/src/schema/unicorn_web/publicationapprovalrequested/PublicationApprovalRequested.py (100%) rename {unicorn_properties => unicorn_approvals}/src/schema/unicorn_web/publicationapprovalrequested/__init__.py (100%) rename {unicorn_properties => unicorn_approvals}/src/schema/unicorn_web/publicationapprovalrequested/marshaller.py (100%) rename {unicorn_properties => unicorn_approvals}/state_machine/property_approval.asl.yaml (100%) rename {unicorn_properties => unicorn_approvals}/template.yaml (94%) rename {unicorn_properties => unicorn_approvals}/tests/__init__.py (100%) rename {unicorn_properties => unicorn_approvals}/tests/unit/__init__.py (100%) rename {unicorn_properties => unicorn_approvals}/tests/unit/conftest.py (100%) rename {unicorn_properties => unicorn_approvals}/tests/unit/events/ddb_stream_events/contract_status_changed_draft.json (100%) rename {unicorn_properties => unicorn_approvals}/tests/unit/events/ddb_stream_events/sfn_check_exists.json (100%) rename {unicorn_properties => unicorn_approvals}/tests/unit/events/ddb_stream_events/sfn_wait_approval.json (100%) rename {unicorn_properties => unicorn_approvals}/tests/unit/events/ddb_stream_events/status_approved_waiting_for_approval.json (100%) rename {unicorn_properties => unicorn_approvals}/tests/unit/events/ddb_stream_events/status_approved_with_no_workflow.json (100%) rename {unicorn_properties => unicorn_approvals}/tests/unit/events/eventbridge/contract_status_changed.json (100%) rename {unicorn_properties => unicorn_approvals}/tests/unit/events/eventbridge/contract_status_changed_event_contract_1_approved.json (100%) rename {unicorn_properties => unicorn_approvals}/tests/unit/events/eventbridge/contract_status_changed_event_contract_1_draft.json (100%) rename {unicorn_properties => unicorn_approvals}/tests/unit/events/eventbridge/contract_status_changed_event_contract_2_approved.json (100%) rename {unicorn_properties => unicorn_approvals}/tests/unit/events/eventbridge/contract_status_changed_event_contract_2_draft.json (100%) rename {unicorn_properties => unicorn_approvals}/tests/unit/events/eventbridge/publication_approval_requested_event.json (100%) rename {unicorn_properties => unicorn_approvals}/tests/unit/events/eventbridge/publication_approval_requested_event_all_good.json (100%) rename {unicorn_properties => unicorn_approvals}/tests/unit/events/eventbridge/publication_approval_requested_event_inappropriate_description.json (100%) rename {unicorn_properties => unicorn_approvals}/tests/unit/events/eventbridge/publication_approval_requested_event_inappropriate_images.json (100%) rename {unicorn_properties => unicorn_approvals}/tests/unit/events/eventbridge/publication_approval_requested_event_non_existing_contract.json (100%) rename {unicorn_properties => unicorn_approvals}/tests/unit/events/eventbridge/publication_approval_requested_event_pause_workflow.json (100%) rename {unicorn_properties => unicorn_approvals}/tests/unit/events/eventbridge/publication_evaluation_completed_event.json (100%) rename {unicorn_properties => unicorn_approvals}/tests/unit/events/eventbridge/put_event_property_approval_requested.json (100%) rename {unicorn_properties => unicorn_approvals}/tests/unit/events/lambda/content_integrity_validator_function_success.json (100%) rename {unicorn_properties => unicorn_approvals}/tests/unit/events/lambda/contract_status_checker.json (100%) rename {unicorn_properties => unicorn_approvals}/tests/unit/events/lambda/wait_for_contract_approval_function.json (100%) rename {unicorn_properties => unicorn_approvals}/tests/unit/helper.py (100%) rename {unicorn_properties => unicorn_approvals}/tests/unit/test_contract_status_changed_event_handler.py (100%) rename {unicorn_properties => unicorn_approvals}/tests/unit/test_properties_approval_sync_function.py (100%) rename {unicorn_properties => unicorn_approvals}/tests/unit/test_wait_for_contract_approval_function.py (100%) rename {unicorn_properties => unicorn_approvals}/uv.lock (100%) diff --git a/unicorn_properties/.gitignore b/unicorn_approvals/.gitignore similarity index 100% rename from unicorn_properties/.gitignore rename to unicorn_approvals/.gitignore diff --git a/unicorn_properties/Makefile b/unicorn_approvals/Makefile similarity index 100% rename from unicorn_properties/Makefile rename to unicorn_approvals/Makefile diff --git a/unicorn_properties/README.md b/unicorn_approvals/README.md similarity index 100% rename from unicorn_properties/README.md rename to unicorn_approvals/README.md diff --git a/unicorn_properties/__init__.py b/unicorn_approvals/__init__.py similarity index 100% rename from unicorn_properties/__init__.py rename to unicorn_approvals/__init__.py diff --git a/unicorn_properties/integration/PublicationEvaluationCompleted.json b/unicorn_approvals/integration/PublicationEvaluationCompleted.json similarity index 100% rename from unicorn_properties/integration/PublicationEvaluationCompleted.json rename to unicorn_approvals/integration/PublicationEvaluationCompleted.json diff --git a/unicorn_properties/integration/event-schemas.yaml b/unicorn_approvals/integration/event-schemas.yaml similarity index 95% rename from unicorn_properties/integration/event-schemas.yaml rename to unicorn_approvals/integration/event-schemas.yaml index adde88d..2a05fff 100644 --- a/unicorn_properties/integration/event-schemas.yaml +++ b/unicorn_approvals/integration/event-schemas.yaml @@ -18,7 +18,7 @@ Resources: Properties: Description: 'Event schemas for Unicorn Properties' RegistryName: - Fn::Sub: "{{resolve:ssm:/uni-prop/UnicornPropertiesNamespace}}-${Stage}" + Fn::Sub: "{{resolve:ssm:/uni-prop/UnicornApprovalsNamespace}}-${Stage}" EventRegistryPolicy: Type: AWS::EventSchemas::RegistryPolicy @@ -52,7 +52,7 @@ Resources: RegistryName: Fn::GetAtt: EventRegistry.RegistryName SchemaName: - Fn::Sub: '{{resolve:ssm:/uni-prop/UnicornPropertiesNamespace}}@PublicationEvaluationCompleted' + Fn::Sub: '{{resolve:ssm:/uni-prop/UnicornApprovalsNamespace}}@PublicationEvaluationCompleted' Description: 'The schema for when a property evaluation is completed' Content: Fn::Sub: | diff --git a/unicorn_properties/integration/subscriber-policies.yaml b/unicorn_approvals/integration/subscriber-policies.yaml similarity index 93% rename from unicorn_properties/integration/subscriber-policies.yaml rename to unicorn_approvals/integration/subscriber-policies.yaml index 4cdf924..d41211b 100644 --- a/unicorn_properties/integration/subscriber-policies.yaml +++ b/unicorn_approvals/integration/subscriber-policies.yaml @@ -20,7 +20,7 @@ Resources: Type: AWS::Events::EventBusPolicy Properties: EventBusName: - Fn::Sub: "{{resolve:ssm:/uni-prop/${Stage}/UnicornPropertiesEventBus}}" + Fn::Sub: "{{resolve:ssm:/uni-prop/${Stage}/UnicornApprovalsEventBus}}" StatementId: Fn::Sub: "OnlyRulesForPropertiesServiceEvents-${Stage}" Statement: @@ -40,7 +40,7 @@ Resources: - Fn::Sub: - arn:${AWS::Partition}:events:${AWS::Region}:${AWS::AccountId}:rule/${eventBusName}/* - eventBusName: - Fn::Sub: "{{resolve:ssm:/uni-prop/${Stage}/UnicornPropertiesEventBus}}" + Fn::Sub: "{{resolve:ssm:/uni-prop/${Stage}/UnicornApprovalsEventBus}}" Condition: StringEqualsIfExists: "events:creatorAccount": "${aws:PrincipalAccount}" diff --git a/unicorn_properties/integration/subscriptions.yaml b/unicorn_approvals/integration/subscriptions.yaml similarity index 92% rename from unicorn_properties/integration/subscriptions.yaml rename to unicorn_approvals/integration/subscriptions.yaml index b908185..5929ffd 100644 --- a/unicorn_properties/integration/subscriptions.yaml +++ b/unicorn_approvals/integration/subscriptions.yaml @@ -32,7 +32,7 @@ Resources: Targets: - Id: SendEventTo Arn: - Fn::Sub: "{{resolve:ssm:/uni-prop/${Stage}/UnicornPropertiesEventBusArn}}" + Fn::Sub: "{{resolve:ssm:/uni-prop/${Stage}/UnicornApprovalsEventBusArn}}" RoleArn: Fn::GetAtt: [ UnicornPropertiesSubscriptionRole, Arn ] @@ -55,13 +55,13 @@ Resources: Targets: - Id: SendEventTo Arn: - Fn::Sub: "{{resolve:ssm:/uni-prop/${Stage}/UnicornPropertiesEventBusArn}}" + Fn::Sub: "{{resolve:ssm:/uni-prop/${Stage}/UnicornApprovalsEventBusArn}}" RoleArn: Fn::GetAtt: [ UnicornPropertiesSubscriptionRole, Arn ] # This IAM role allows EventBridge to assume the permissions necessary to send events - # from the publishing event bus, to the subscribing event bus (UnicornPropertiesEventBusArn) + # from the publishing event bus, to the subscribing event bus (UnicornApprovalsEventBusArn) UnicornPropertiesSubscriptionRole: Type: AWS::IAM::Role DeletionPolicy: Delete @@ -81,7 +81,7 @@ Resources: - Effect: Allow Action: events:PutEvents Resource: - Fn::Sub: "{{resolve:ssm:/uni-prop/${Stage}/UnicornPropertiesEventBusArn}}" + Fn::Sub: "{{resolve:ssm:/uni-prop/${Stage}/UnicornApprovalsEventBusArn}}" Outputs: ContractStatusChangedSubscription: diff --git a/unicorn_properties/pyproject.toml b/unicorn_approvals/pyproject.toml similarity index 100% rename from unicorn_properties/pyproject.toml rename to unicorn_approvals/pyproject.toml diff --git a/unicorn_properties/pytest.ini b/unicorn_approvals/pytest.ini similarity index 100% rename from unicorn_properties/pytest.ini rename to unicorn_approvals/pytest.ini diff --git a/unicorn_properties/ruff.toml b/unicorn_approvals/ruff.toml similarity index 100% rename from unicorn_properties/ruff.toml rename to unicorn_approvals/ruff.toml diff --git a/unicorn_properties/samconfig.toml b/unicorn_approvals/samconfig.toml similarity index 87% rename from unicorn_properties/samconfig.toml rename to unicorn_approvals/samconfig.toml index 80abe0b..e8b9e83 100644 --- a/unicorn_properties/samconfig.toml +++ b/unicorn_approvals/samconfig.toml @@ -1,8 +1,8 @@ version = 0.1 [default.global.parameters] -stack_name = "uni-prop-local-properties" -s3_prefix = "uni-prop-local-properties" +stack_name = "uni-prop-local-approvals" +s3_prefix = "uni-prop-local-approvals" resolve_s3 = true resolve_image_repositories = true diff --git a/unicorn_properties/src/README.md b/unicorn_approvals/src/README.md similarity index 100% rename from unicorn_properties/src/README.md rename to unicorn_approvals/src/README.md diff --git a/unicorn_properties/src/__init__.py b/unicorn_approvals/src/__init__.py similarity index 100% rename from unicorn_properties/src/__init__.py rename to unicorn_approvals/src/__init__.py diff --git a/unicorn_properties/src/properties_service/__init__.py b/unicorn_approvals/src/properties_service/__init__.py similarity index 100% rename from unicorn_properties/src/properties_service/__init__.py rename to unicorn_approvals/src/properties_service/__init__.py diff --git a/unicorn_properties/src/properties_service/contract_status_changed_event_handler.py b/unicorn_approvals/src/properties_service/contract_status_changed_event_handler.py similarity index 100% rename from unicorn_properties/src/properties_service/contract_status_changed_event_handler.py rename to unicorn_approvals/src/properties_service/contract_status_changed_event_handler.py diff --git a/unicorn_properties/src/properties_service/exceptions.py b/unicorn_approvals/src/properties_service/exceptions.py similarity index 100% rename from unicorn_properties/src/properties_service/exceptions.py rename to unicorn_approvals/src/properties_service/exceptions.py diff --git a/unicorn_properties/src/properties_service/properties_approval_sync_function.py b/unicorn_approvals/src/properties_service/properties_approval_sync_function.py similarity index 100% rename from unicorn_properties/src/properties_service/properties_approval_sync_function.py rename to unicorn_approvals/src/properties_service/properties_approval_sync_function.py diff --git a/unicorn_properties/src/properties_service/wait_for_contract_approval_function.py b/unicorn_approvals/src/properties_service/wait_for_contract_approval_function.py similarity index 100% rename from unicorn_properties/src/properties_service/wait_for_contract_approval_function.py rename to unicorn_approvals/src/properties_service/wait_for_contract_approval_function.py diff --git a/unicorn_properties/src/schema/unicorn_contracts/contractstatuschanged/AWSEvent.py b/unicorn_approvals/src/schema/unicorn_contracts/contractstatuschanged/AWSEvent.py similarity index 100% rename from unicorn_properties/src/schema/unicorn_contracts/contractstatuschanged/AWSEvent.py rename to unicorn_approvals/src/schema/unicorn_contracts/contractstatuschanged/AWSEvent.py diff --git a/unicorn_properties/src/schema/unicorn_contracts/contractstatuschanged/ContractStatusChanged.py b/unicorn_approvals/src/schema/unicorn_contracts/contractstatuschanged/ContractStatusChanged.py similarity index 100% rename from unicorn_properties/src/schema/unicorn_contracts/contractstatuschanged/ContractStatusChanged.py rename to unicorn_approvals/src/schema/unicorn_contracts/contractstatuschanged/ContractStatusChanged.py diff --git a/unicorn_properties/src/schema/unicorn_contracts/contractstatuschanged/__init__.py b/unicorn_approvals/src/schema/unicorn_contracts/contractstatuschanged/__init__.py similarity index 100% rename from unicorn_properties/src/schema/unicorn_contracts/contractstatuschanged/__init__.py rename to unicorn_approvals/src/schema/unicorn_contracts/contractstatuschanged/__init__.py diff --git a/unicorn_properties/src/schema/unicorn_contracts/contractstatuschanged/marshaller.py b/unicorn_approvals/src/schema/unicorn_contracts/contractstatuschanged/marshaller.py similarity index 100% rename from unicorn_properties/src/schema/unicorn_contracts/contractstatuschanged/marshaller.py rename to unicorn_approvals/src/schema/unicorn_contracts/contractstatuschanged/marshaller.py diff --git a/unicorn_properties/src/schema/unicorn_web/publicationapprovalrequested/AWSEvent.py b/unicorn_approvals/src/schema/unicorn_web/publicationapprovalrequested/AWSEvent.py similarity index 100% rename from unicorn_properties/src/schema/unicorn_web/publicationapprovalrequested/AWSEvent.py rename to unicorn_approvals/src/schema/unicorn_web/publicationapprovalrequested/AWSEvent.py diff --git a/unicorn_properties/src/schema/unicorn_web/publicationapprovalrequested/PublicationApprovalRequested.py b/unicorn_approvals/src/schema/unicorn_web/publicationapprovalrequested/PublicationApprovalRequested.py similarity index 100% rename from unicorn_properties/src/schema/unicorn_web/publicationapprovalrequested/PublicationApprovalRequested.py rename to unicorn_approvals/src/schema/unicorn_web/publicationapprovalrequested/PublicationApprovalRequested.py diff --git a/unicorn_properties/src/schema/unicorn_web/publicationapprovalrequested/__init__.py b/unicorn_approvals/src/schema/unicorn_web/publicationapprovalrequested/__init__.py similarity index 100% rename from unicorn_properties/src/schema/unicorn_web/publicationapprovalrequested/__init__.py rename to unicorn_approvals/src/schema/unicorn_web/publicationapprovalrequested/__init__.py diff --git a/unicorn_properties/src/schema/unicorn_web/publicationapprovalrequested/marshaller.py b/unicorn_approvals/src/schema/unicorn_web/publicationapprovalrequested/marshaller.py similarity index 100% rename from unicorn_properties/src/schema/unicorn_web/publicationapprovalrequested/marshaller.py rename to unicorn_approvals/src/schema/unicorn_web/publicationapprovalrequested/marshaller.py diff --git a/unicorn_properties/state_machine/property_approval.asl.yaml b/unicorn_approvals/state_machine/property_approval.asl.yaml similarity index 100% rename from unicorn_properties/state_machine/property_approval.asl.yaml rename to unicorn_approvals/state_machine/property_approval.asl.yaml diff --git a/unicorn_properties/template.yaml b/unicorn_approvals/template.yaml similarity index 94% rename from unicorn_properties/template.yaml rename to unicorn_approvals/template.yaml index 51c1136..1b49300 100644 --- a/unicorn_properties/template.yaml +++ b/unicorn_approvals/template.yaml @@ -53,7 +53,7 @@ Globals: Environment: Variables: CONTRACT_STATUS_TABLE: !Ref ContractStatusTable - EVENT_BUS: !Ref UnicornPropertiesEventBus + EVENT_BUS: !Ref UnicornApprovalsEventBus SERVICE_NAMESPACE: "{{resolve:ssm:/uni-prop/UnicornApprovalsNamespace}}" POWERTOOLS_LOGGER_CASE: PascalCase POWERTOOLS_SERVICE_NAME: "{{resolve:ssm:/uni-prop/UnicornApprovalsNamespace}}" @@ -71,23 +71,23 @@ Globals: Resources: #### SSM PARAMETERS # Services share their event bus name and arn - UnicornPropertiesEventBusNameParam: + UnicornApprovalsEventBusNameParam: Type: AWS::SSM::Parameter DeletionPolicy: Delete UpdateReplacePolicy: Delete Properties: Type: String - Name: !Sub /uni-prop/${Stage}/UnicornPropertiesEventBus - Value: !GetAtt UnicornPropertiesEventBus.Name + Name: !Sub /uni-prop/${Stage}/UnicornApprovalsEventBus + Value: !GetAtt UnicornApprovalsEventBus.Name - UnicornPropertiesEventBusArnParam: + UnicornApprovalsEventBusArnParam: Type: AWS::SSM::Parameter DeletionPolicy: Delete UpdateReplacePolicy: Delete Properties: Type: String - Name: !Sub /uni-prop/${Stage}/UnicornPropertiesEventBusArn - Value: !GetAtt UnicornPropertiesEventBus.Arn + Name: !Sub /uni-prop/${Stage}/UnicornApprovalsEventBusArn + Value: !GetAtt UnicornApprovalsEventBus.Arn #### LAMBDA FUNCTIONS # Listens to ContractStatusChanged events from EventBridge @@ -106,7 +106,7 @@ Resources: Type: EventBridgeRule Properties: RuleName: unicorn.properties-ContractStatusChanged - EventBusName: !GetAtt UnicornPropertiesEventBus.Name + EventBusName: !GetAtt UnicornApprovalsEventBus.Name Pattern: source: - "{{resolve:ssm:/uni-prop/UnicornContractsNamespace}}" @@ -219,7 +219,7 @@ Resources: - S3ReadPolicy: BucketName: !Sub "{{resolve:ssm:/uni-prop/${Stage}/ImagesBucket}}" - EventBridgePutEventsPolicy: - EventBusName: !GetAtt UnicornPropertiesEventBus.Name + EventBusName: !GetAtt UnicornApprovalsEventBus.Name - Statement: - Effect: Allow Action: @@ -244,7 +244,7 @@ Resources: Type: EventBridgeRule Properties: RuleName: unicorn.properties-PublicationApprovalRequested - EventBusName: !GetAtt UnicornPropertiesEventBus.Name + EventBusName: !GetAtt UnicornApprovalsEventBus.Name Pattern: source: - "{{resolve:ssm:/uni-prop/UnicornWebNamespace}}" @@ -260,7 +260,7 @@ Resources: WaitForContractApprovalArn: !GetAtt WaitForContractApprovalFunction.Arn TableName: !Ref ContractStatusTable ImageUploadBucketName: !Sub "{{resolve:ssm:/uni-prop/${Stage}/ImagesBucket}}" - EventBusName: !GetAtt UnicornPropertiesEventBus.Name + EventBusName: !GetAtt UnicornApprovalsEventBus.Name ServiceName: "{{resolve:ssm:/uni-prop/UnicornApprovalsNamespace}}" # Store ApprovalStateMachineLogGroup workflow execution logs @@ -330,20 +330,20 @@ Resources: #### EVENT BUS # Event bus for Unicorn Properties Service, used to publish and consume events - UnicornPropertiesEventBus: + UnicornApprovalsEventBus: Type: AWS::Events::EventBus DeletionPolicy: Delete UpdateReplacePolicy: Delete Properties: Name: !Sub UnicornPropertiesBus-${Stage} - # Event bus policy to restrict who can publish events (should only be services from UnicornPropertiesNamespace) + # Event bus policy to restrict who can publish events (should only be services from UnicornApprovalsNamespace) UnicornPropertiesEventsBusPublishPolicy: Type: AWS::Events::EventBusPolicy DeletionPolicy: Delete UpdateReplacePolicy: Delete Properties: - EventBusName: !Ref UnicornPropertiesEventBus + EventBusName: !Ref UnicornApprovalsEventBus StatementId: !Sub OnlyPropertiesServiceCanPublishToEventBus-${Stage} Statement: Effect: Allow @@ -351,7 +351,7 @@ Resources: AWS: - !Sub "arn:${AWS::Partition}:iam::${AWS::AccountId}:root" Action: events:PutEvents - Resource: !GetAtt UnicornPropertiesEventBus.Arn + Resource: !GetAtt UnicornApprovalsEventBus.Arn Condition: StringEquals: events:source: @@ -365,7 +365,7 @@ Resources: Properties: Name: properties.catchall Description: Catchall rule used for development purposes. - EventBusName: !Ref UnicornPropertiesEventBus + EventBusName: !Ref UnicornApprovalsEventBus EventPattern: account: - !Ref AWS::AccountId @@ -436,7 +436,7 @@ Resources: UpdateReplacePolicy: Delete DeletionPolicy: Delete DependsOn: - - UnicornPropertiesEventBusNameParam + - UnicornApprovalsEventBusNameParam Properties: Location: "integration/subscriber-policies.yaml" Parameters: @@ -448,7 +448,7 @@ Resources: UpdateReplacePolicy: Delete DeletionPolicy: Delete DependsOn: - - UnicornPropertiesEventBusArnParam + - UnicornApprovalsEventBusArnParam Properties: Location: "integration/subscriptions.yaml" Parameters: @@ -484,7 +484,7 @@ Outputs: #### EVENT BRIDGE OUTPUTS UnicornPropertiesEventBusName: - Value: !GetAtt UnicornPropertiesEventBus.Name + Value: !GetAtt UnicornApprovalsEventBus.Name #### CLOUDWATCH LOGS OUTPUTS UnicornPropertiesCatchAllLogGroupArn: diff --git a/unicorn_properties/tests/__init__.py b/unicorn_approvals/tests/__init__.py similarity index 100% rename from unicorn_properties/tests/__init__.py rename to unicorn_approvals/tests/__init__.py diff --git a/unicorn_properties/tests/unit/__init__.py b/unicorn_approvals/tests/unit/__init__.py similarity index 100% rename from unicorn_properties/tests/unit/__init__.py rename to unicorn_approvals/tests/unit/__init__.py diff --git a/unicorn_properties/tests/unit/conftest.py b/unicorn_approvals/tests/unit/conftest.py similarity index 100% rename from unicorn_properties/tests/unit/conftest.py rename to unicorn_approvals/tests/unit/conftest.py diff --git a/unicorn_properties/tests/unit/events/ddb_stream_events/contract_status_changed_draft.json b/unicorn_approvals/tests/unit/events/ddb_stream_events/contract_status_changed_draft.json similarity index 100% rename from unicorn_properties/tests/unit/events/ddb_stream_events/contract_status_changed_draft.json rename to unicorn_approvals/tests/unit/events/ddb_stream_events/contract_status_changed_draft.json diff --git a/unicorn_properties/tests/unit/events/ddb_stream_events/sfn_check_exists.json b/unicorn_approvals/tests/unit/events/ddb_stream_events/sfn_check_exists.json similarity index 100% rename from unicorn_properties/tests/unit/events/ddb_stream_events/sfn_check_exists.json rename to unicorn_approvals/tests/unit/events/ddb_stream_events/sfn_check_exists.json diff --git a/unicorn_properties/tests/unit/events/ddb_stream_events/sfn_wait_approval.json b/unicorn_approvals/tests/unit/events/ddb_stream_events/sfn_wait_approval.json similarity index 100% rename from unicorn_properties/tests/unit/events/ddb_stream_events/sfn_wait_approval.json rename to unicorn_approvals/tests/unit/events/ddb_stream_events/sfn_wait_approval.json diff --git a/unicorn_properties/tests/unit/events/ddb_stream_events/status_approved_waiting_for_approval.json b/unicorn_approvals/tests/unit/events/ddb_stream_events/status_approved_waiting_for_approval.json similarity index 100% rename from unicorn_properties/tests/unit/events/ddb_stream_events/status_approved_waiting_for_approval.json rename to unicorn_approvals/tests/unit/events/ddb_stream_events/status_approved_waiting_for_approval.json diff --git a/unicorn_properties/tests/unit/events/ddb_stream_events/status_approved_with_no_workflow.json b/unicorn_approvals/tests/unit/events/ddb_stream_events/status_approved_with_no_workflow.json similarity index 100% rename from unicorn_properties/tests/unit/events/ddb_stream_events/status_approved_with_no_workflow.json rename to unicorn_approvals/tests/unit/events/ddb_stream_events/status_approved_with_no_workflow.json diff --git a/unicorn_properties/tests/unit/events/eventbridge/contract_status_changed.json b/unicorn_approvals/tests/unit/events/eventbridge/contract_status_changed.json similarity index 100% rename from unicorn_properties/tests/unit/events/eventbridge/contract_status_changed.json rename to unicorn_approvals/tests/unit/events/eventbridge/contract_status_changed.json diff --git a/unicorn_properties/tests/unit/events/eventbridge/contract_status_changed_event_contract_1_approved.json b/unicorn_approvals/tests/unit/events/eventbridge/contract_status_changed_event_contract_1_approved.json similarity index 100% rename from unicorn_properties/tests/unit/events/eventbridge/contract_status_changed_event_contract_1_approved.json rename to unicorn_approvals/tests/unit/events/eventbridge/contract_status_changed_event_contract_1_approved.json diff --git a/unicorn_properties/tests/unit/events/eventbridge/contract_status_changed_event_contract_1_draft.json b/unicorn_approvals/tests/unit/events/eventbridge/contract_status_changed_event_contract_1_draft.json similarity index 100% rename from unicorn_properties/tests/unit/events/eventbridge/contract_status_changed_event_contract_1_draft.json rename to unicorn_approvals/tests/unit/events/eventbridge/contract_status_changed_event_contract_1_draft.json diff --git a/unicorn_properties/tests/unit/events/eventbridge/contract_status_changed_event_contract_2_approved.json b/unicorn_approvals/tests/unit/events/eventbridge/contract_status_changed_event_contract_2_approved.json similarity index 100% rename from unicorn_properties/tests/unit/events/eventbridge/contract_status_changed_event_contract_2_approved.json rename to unicorn_approvals/tests/unit/events/eventbridge/contract_status_changed_event_contract_2_approved.json diff --git a/unicorn_properties/tests/unit/events/eventbridge/contract_status_changed_event_contract_2_draft.json b/unicorn_approvals/tests/unit/events/eventbridge/contract_status_changed_event_contract_2_draft.json similarity index 100% rename from unicorn_properties/tests/unit/events/eventbridge/contract_status_changed_event_contract_2_draft.json rename to unicorn_approvals/tests/unit/events/eventbridge/contract_status_changed_event_contract_2_draft.json diff --git a/unicorn_properties/tests/unit/events/eventbridge/publication_approval_requested_event.json b/unicorn_approvals/tests/unit/events/eventbridge/publication_approval_requested_event.json similarity index 100% rename from unicorn_properties/tests/unit/events/eventbridge/publication_approval_requested_event.json rename to unicorn_approvals/tests/unit/events/eventbridge/publication_approval_requested_event.json diff --git a/unicorn_properties/tests/unit/events/eventbridge/publication_approval_requested_event_all_good.json b/unicorn_approvals/tests/unit/events/eventbridge/publication_approval_requested_event_all_good.json similarity index 100% rename from unicorn_properties/tests/unit/events/eventbridge/publication_approval_requested_event_all_good.json rename to unicorn_approvals/tests/unit/events/eventbridge/publication_approval_requested_event_all_good.json diff --git a/unicorn_properties/tests/unit/events/eventbridge/publication_approval_requested_event_inappropriate_description.json b/unicorn_approvals/tests/unit/events/eventbridge/publication_approval_requested_event_inappropriate_description.json similarity index 100% rename from unicorn_properties/tests/unit/events/eventbridge/publication_approval_requested_event_inappropriate_description.json rename to unicorn_approvals/tests/unit/events/eventbridge/publication_approval_requested_event_inappropriate_description.json diff --git a/unicorn_properties/tests/unit/events/eventbridge/publication_approval_requested_event_inappropriate_images.json b/unicorn_approvals/tests/unit/events/eventbridge/publication_approval_requested_event_inappropriate_images.json similarity index 100% rename from unicorn_properties/tests/unit/events/eventbridge/publication_approval_requested_event_inappropriate_images.json rename to unicorn_approvals/tests/unit/events/eventbridge/publication_approval_requested_event_inappropriate_images.json diff --git a/unicorn_properties/tests/unit/events/eventbridge/publication_approval_requested_event_non_existing_contract.json b/unicorn_approvals/tests/unit/events/eventbridge/publication_approval_requested_event_non_existing_contract.json similarity index 100% rename from unicorn_properties/tests/unit/events/eventbridge/publication_approval_requested_event_non_existing_contract.json rename to unicorn_approvals/tests/unit/events/eventbridge/publication_approval_requested_event_non_existing_contract.json diff --git a/unicorn_properties/tests/unit/events/eventbridge/publication_approval_requested_event_pause_workflow.json b/unicorn_approvals/tests/unit/events/eventbridge/publication_approval_requested_event_pause_workflow.json similarity index 100% rename from unicorn_properties/tests/unit/events/eventbridge/publication_approval_requested_event_pause_workflow.json rename to unicorn_approvals/tests/unit/events/eventbridge/publication_approval_requested_event_pause_workflow.json diff --git a/unicorn_properties/tests/unit/events/eventbridge/publication_evaluation_completed_event.json b/unicorn_approvals/tests/unit/events/eventbridge/publication_evaluation_completed_event.json similarity index 100% rename from unicorn_properties/tests/unit/events/eventbridge/publication_evaluation_completed_event.json rename to unicorn_approvals/tests/unit/events/eventbridge/publication_evaluation_completed_event.json diff --git a/unicorn_properties/tests/unit/events/eventbridge/put_event_property_approval_requested.json b/unicorn_approvals/tests/unit/events/eventbridge/put_event_property_approval_requested.json similarity index 100% rename from unicorn_properties/tests/unit/events/eventbridge/put_event_property_approval_requested.json rename to unicorn_approvals/tests/unit/events/eventbridge/put_event_property_approval_requested.json diff --git a/unicorn_properties/tests/unit/events/lambda/content_integrity_validator_function_success.json b/unicorn_approvals/tests/unit/events/lambda/content_integrity_validator_function_success.json similarity index 100% rename from unicorn_properties/tests/unit/events/lambda/content_integrity_validator_function_success.json rename to unicorn_approvals/tests/unit/events/lambda/content_integrity_validator_function_success.json diff --git a/unicorn_properties/tests/unit/events/lambda/contract_status_checker.json b/unicorn_approvals/tests/unit/events/lambda/contract_status_checker.json similarity index 100% rename from unicorn_properties/tests/unit/events/lambda/contract_status_checker.json rename to unicorn_approvals/tests/unit/events/lambda/contract_status_checker.json diff --git a/unicorn_properties/tests/unit/events/lambda/wait_for_contract_approval_function.json b/unicorn_approvals/tests/unit/events/lambda/wait_for_contract_approval_function.json similarity index 100% rename from unicorn_properties/tests/unit/events/lambda/wait_for_contract_approval_function.json rename to unicorn_approvals/tests/unit/events/lambda/wait_for_contract_approval_function.json diff --git a/unicorn_properties/tests/unit/helper.py b/unicorn_approvals/tests/unit/helper.py similarity index 100% rename from unicorn_properties/tests/unit/helper.py rename to unicorn_approvals/tests/unit/helper.py diff --git a/unicorn_properties/tests/unit/test_contract_status_changed_event_handler.py b/unicorn_approvals/tests/unit/test_contract_status_changed_event_handler.py similarity index 100% rename from unicorn_properties/tests/unit/test_contract_status_changed_event_handler.py rename to unicorn_approvals/tests/unit/test_contract_status_changed_event_handler.py diff --git a/unicorn_properties/tests/unit/test_properties_approval_sync_function.py b/unicorn_approvals/tests/unit/test_properties_approval_sync_function.py similarity index 100% rename from unicorn_properties/tests/unit/test_properties_approval_sync_function.py rename to unicorn_approvals/tests/unit/test_properties_approval_sync_function.py diff --git a/unicorn_properties/tests/unit/test_wait_for_contract_approval_function.py b/unicorn_approvals/tests/unit/test_wait_for_contract_approval_function.py similarity index 100% rename from unicorn_properties/tests/unit/test_wait_for_contract_approval_function.py rename to unicorn_approvals/tests/unit/test_wait_for_contract_approval_function.py diff --git a/unicorn_properties/uv.lock b/unicorn_approvals/uv.lock similarity index 100% rename from unicorn_properties/uv.lock rename to unicorn_approvals/uv.lock From 25289c73546f217b7ecde5457916761787fa6be8 Mon Sep 17 00:00:00 2001 From: Stephen Liedig Date: Mon, 7 Jul 2025 07:41:54 +0800 Subject: [PATCH 5/8] refactor: update event bus references from UnicornProperties to UnicornApprovals in subscriptions.yaml --- unicorn_shared/uni-prop-namespaces.yaml | 2 +- unicorn_web/integration/subscriptions.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/unicorn_shared/uni-prop-namespaces.yaml b/unicorn_shared/uni-prop-namespaces.yaml index 3045c2b..7df02f4 100644 --- a/unicorn_shared/uni-prop-namespaces.yaml +++ b/unicorn_shared/uni-prop-namespaces.yaml @@ -35,7 +35,7 @@ Outputs: Description: Unicorn Contracts namespace parameter Value: !Ref UnicornContractsNamespaceParam - UnicornPropertiesNamespace: + UnicornApprovalsNamespace: Description: Unicorn Properties namespace parameter Value: !Ref UnicornApprovalsNamespaceParam diff --git a/unicorn_web/integration/subscriptions.yaml b/unicorn_web/integration/subscriptions.yaml index adf2484..874c409 100644 --- a/unicorn_web/integration/subscriptions.yaml +++ b/unicorn_web/integration/subscriptions.yaml @@ -20,7 +20,7 @@ Resources: Name: unicorn.web-PublicationEvaluationCompleted Description: PublicationEvaluationCompleted subscription EventBusName: - Fn::Sub: "{{resolve:ssm:/uni-prop/${Stage}/UnicornPropertiesEventBusArn}}" + Fn::Sub: "{{resolve:ssm:/uni-prop/${Stage}/UnicornApprovalsEventBusArn}}" EventPattern: source: - "{{resolve:ssm:/uni-prop/UnicornApprovalsNamespace}}" From 1e66d49b9e5ec87a8769440a633f977c3c31f9f0 Mon Sep 17 00:00:00 2001 From: Stephen Liedig Date: Mon, 7 Jul 2025 08:09:46 +0800 Subject: [PATCH 6/8] refactor: update references from UnicornProperties to UnicornApprovals in dependabot configuration and unit test workflows --- .github/dependabot.yml | 2 +- .github/workflows/services_unit_tests.yml | 8 ++++---- .../publication_approved_event_handler.py | 2 +- .../publicationevaluationcompleted/AWSEvent.py | 2 +- .../publicationevaluationcompleted/__init__.py | 6 +++--- .../publicationevaluationcompleted/marshaller.py | 4 ++-- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 8a2d4b1..437c7ac 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -8,7 +8,7 @@ updates: - package-ecosystem: "pip" # See documentation for possible values directories: - "unicorn_contracts" # Location of package manifests - - "unicorn_properties" + - "unicorn_approvals" - "unicorn_web" schedule: interval: "weekly" diff --git a/.github/workflows/services_unit_tests.yml b/.github/workflows/services_unit_tests.yml index 4696e81..493e8f6 100644 --- a/.github/workflows/services_unit_tests.yml +++ b/.github/workflows/services_unit_tests.yml @@ -3,13 +3,13 @@ on: branches: [develop, main] paths: - 'unicorn_contracts/**' - - 'unicorn_properties/**' + - 'unicorn_approvals/**' - 'unicorn_web/**' pull_request: branches: [develop, main] paths: - 'unicorn_contracts/**' - - 'unicorn_properties/**' + - 'unicorn_approvals/**' - 'unicorn_web/**' jobs: @@ -18,10 +18,10 @@ jobs: with: service_directory: unicorn_contracts - unicorn_properties: + unicorn_approvals: uses: ./.github/workflows/reusable_unit_tests.yml with: - service_directory: unicorn_properties + service_directory: unicorn_approvals unicorn_web: uses: ./.github/workflows/reusable_unit_tests.yml diff --git a/unicorn_web/src/approvals_service/publication_approved_event_handler.py b/unicorn_web/src/approvals_service/publication_approved_event_handler.py index e555d74..6e90227 100644 --- a/unicorn_web/src/approvals_service/publication_approved_event_handler.py +++ b/unicorn_web/src/approvals_service/publication_approved_event_handler.py @@ -11,7 +11,7 @@ from aws_lambda_powertools.metrics import Metrics, MetricUnit from aws_lambda_powertools.event_handler.exceptions import InternalServerError -from schema.unicorn_properties.publicationevaluationcompleted import ( +from schema.unicorn_approvals.publicationevaluationcompleted import ( AWSEvent, Marshaller, PublicationEvaluationCompleted, diff --git a/unicorn_web/src/schema/unicorn_properties/publicationevaluationcompleted/AWSEvent.py b/unicorn_web/src/schema/unicorn_properties/publicationevaluationcompleted/AWSEvent.py index b2fc54a..2cab608 100644 --- a/unicorn_web/src/schema/unicorn_properties/publicationevaluationcompleted/AWSEvent.py +++ b/unicorn_web/src/schema/unicorn_properties/publicationevaluationcompleted/AWSEvent.py @@ -4,7 +4,7 @@ import six from enum import Enum -from schema.unicorn_properties.publicationevaluationcompleted.PublicationEvaluationCompleted import ( +from schema.unicorn_approvals.publicationevaluationcompleted.PublicationEvaluationCompleted import ( PublicationEvaluationCompleted, ) # noqa: F401,E501 diff --git a/unicorn_web/src/schema/unicorn_properties/publicationevaluationcompleted/__init__.py b/unicorn_web/src/schema/unicorn_properties/publicationevaluationcompleted/__init__.py index 9e73411..93bdbe6 100644 --- a/unicorn_web/src/schema/unicorn_properties/publicationevaluationcompleted/__init__.py +++ b/unicorn_web/src/schema/unicorn_properties/publicationevaluationcompleted/__init__.py @@ -2,8 +2,8 @@ from __future__ import absolute_import -from schema.unicorn_properties.publicationevaluationcompleted.marshaller import Marshaller -from schema.unicorn_properties.publicationevaluationcompleted.AWSEvent import AWSEvent -from schema.unicorn_properties.publicationevaluationcompleted.PublicationEvaluationCompleted import ( +from schema.unicorn_approvals.publicationevaluationcompleted.marshaller import Marshaller +from schema.unicorn_approvals.publicationevaluationcompleted.AWSEvent import AWSEvent +from schema.unicorn_approvals.publicationevaluationcompleted.PublicationEvaluationCompleted import ( PublicationEvaluationCompleted, ) diff --git a/unicorn_web/src/schema/unicorn_properties/publicationevaluationcompleted/marshaller.py b/unicorn_web/src/schema/unicorn_properties/publicationevaluationcompleted/marshaller.py index 9a42d94..0181a81 100644 --- a/unicorn_web/src/schema/unicorn_properties/publicationevaluationcompleted/marshaller.py +++ b/unicorn_web/src/schema/unicorn_properties/publicationevaluationcompleted/marshaller.py @@ -1,7 +1,7 @@ import datetime import re import six -import schema.unicorn_properties.publicationevaluationcompleted +import schema.unicorn_approvals.publicationevaluationcompleted class Marshaller: @@ -59,7 +59,7 @@ def unmarshall(cls, data, typeName): if typeName in cls.NATIVE_TYPES_MAPPING: typeName = cls.NATIVE_TYPES_MAPPING[typeName] else: - typeName = getattr(schema.unicorn_properties.publicationevaluationcompleted, typeName) + typeName = getattr(schema.unicorn_approvals.publicationevaluationcompleted, typeName) if typeName in cls.PRIMITIVE_TYPES: return cls.__unmarshall_primitive(data, typeName) From 0fbdd59e116ead747117098737f802833cc8e6c8 Mon Sep 17 00:00:00 2001 From: Stephen Liedig Date: Mon, 7 Jul 2025 08:39:54 +0800 Subject: [PATCH 7/8] chore: upgrade actions/upload-artifact from v3 to v4 in GitHub workflow --- .github/workflows/record_pr.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/record_pr.yml b/.github/workflows/record_pr.yml index 44f445a..70cbe15 100644 --- a/.github/workflows/record_pr.yml +++ b/.github/workflows/record_pr.yml @@ -16,7 +16,7 @@ jobs: script: | const script = require('.github/scripts/save_pr_details.js') await script({github, context, core}) - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 with: name: pr path: pr.txt From 2f100ee006b4947d73819dba5ecdf77946d3c65a Mon Sep 17 00:00:00 2001 From: Marco Buss Date: Mon, 7 Jul 2025 16:53:57 +0200 Subject: [PATCH 8/8] fixed small issues --- .../src/approvals_service/publication_approved_event_handler.py | 1 - .../publicationevaluationcompleted/AWSEvent.py | 0 .../PublicationEvaluationCompleted.py | 0 .../publicationevaluationcompleted/__init__.py | 0 .../publicationevaluationcompleted/marshaller.py | 0 .../eventbridge/put_event_publication_evaluation_completed.json | 2 +- 6 files changed, 1 insertion(+), 2 deletions(-) rename unicorn_web/src/schema/{unicorn_properties => unicorn_approvals}/publicationevaluationcompleted/AWSEvent.py (100%) rename unicorn_web/src/schema/{unicorn_properties => unicorn_approvals}/publicationevaluationcompleted/PublicationEvaluationCompleted.py (100%) rename unicorn_web/src/schema/{unicorn_properties => unicorn_approvals}/publicationevaluationcompleted/__init__.py (100%) rename unicorn_web/src/schema/{unicorn_properties => unicorn_approvals}/publicationevaluationcompleted/marshaller.py (100%) diff --git a/unicorn_web/src/approvals_service/publication_approved_event_handler.py b/unicorn_web/src/approvals_service/publication_approved_event_handler.py index 6e90227..2c252bb 100644 --- a/unicorn_web/src/approvals_service/publication_approved_event_handler.py +++ b/unicorn_web/src/approvals_service/publication_approved_event_handler.py @@ -17,7 +17,6 @@ PublicationEvaluationCompleted, ) - # Initialise Environment variables if (SERVICE_NAMESPACE := os.environ.get("SERVICE_NAMESPACE")) is None: raise InternalServerError("SERVICE_NAMESPACE environment variable is undefined") diff --git a/unicorn_web/src/schema/unicorn_properties/publicationevaluationcompleted/AWSEvent.py b/unicorn_web/src/schema/unicorn_approvals/publicationevaluationcompleted/AWSEvent.py similarity index 100% rename from unicorn_web/src/schema/unicorn_properties/publicationevaluationcompleted/AWSEvent.py rename to unicorn_web/src/schema/unicorn_approvals/publicationevaluationcompleted/AWSEvent.py diff --git a/unicorn_web/src/schema/unicorn_properties/publicationevaluationcompleted/PublicationEvaluationCompleted.py b/unicorn_web/src/schema/unicorn_approvals/publicationevaluationcompleted/PublicationEvaluationCompleted.py similarity index 100% rename from unicorn_web/src/schema/unicorn_properties/publicationevaluationcompleted/PublicationEvaluationCompleted.py rename to unicorn_web/src/schema/unicorn_approvals/publicationevaluationcompleted/PublicationEvaluationCompleted.py diff --git a/unicorn_web/src/schema/unicorn_properties/publicationevaluationcompleted/__init__.py b/unicorn_web/src/schema/unicorn_approvals/publicationevaluationcompleted/__init__.py similarity index 100% rename from unicorn_web/src/schema/unicorn_properties/publicationevaluationcompleted/__init__.py rename to unicorn_web/src/schema/unicorn_approvals/publicationevaluationcompleted/__init__.py diff --git a/unicorn_web/src/schema/unicorn_properties/publicationevaluationcompleted/marshaller.py b/unicorn_web/src/schema/unicorn_approvals/publicationevaluationcompleted/marshaller.py similarity index 100% rename from unicorn_web/src/schema/unicorn_properties/publicationevaluationcompleted/marshaller.py rename to unicorn_web/src/schema/unicorn_approvals/publicationevaluationcompleted/marshaller.py diff --git a/unicorn_web/tests/events/eventbridge/put_event_publication_evaluation_completed.json b/unicorn_web/tests/events/eventbridge/put_event_publication_evaluation_completed.json index 6b715f6..25e8b56 100644 --- a/unicorn_web/tests/events/eventbridge/put_event_publication_evaluation_completed.json +++ b/unicorn_web/tests/events/eventbridge/put_event_publication_evaluation_completed.json @@ -1,6 +1,6 @@ [ { - "Source": "unicorn.properties", + "Source": "unicorn.approvals", "Detail": "{\"property_id\":\"usa/anytown/main-street/111\",\"evaluation_result\": \"APPROVED\"}", "DetailType": "PublicationEvaluationCompleted", "EventBusName": "UnicornWebBus-local"