Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor core/environment&stack module - part 2 #1169

Merged

Conversation

SofiaSazonova
Copy link
Contributor

Feature or Bugfix

  • Refactoring

Detail

  • All queries moved from resolvers and services to *_repositories
  • Stack renamed to StackRepository

Relates

Security

Please answer the questions below briefly where applicable, or write N/A. Based on
OWASP 10.

  • Does this PR introduce or modify any input fields or queries - this includes
    fetching data from storage outside the application (e.g. a database, an S3 bucket)?
    • Is the input sanitized?
    • What precautions are you taking before deserializing the data you consume?
    • Is injection prevented by parametrizing queries?
    • Have you ensured no eval or similar functions are used?
  • Does this PR introduce any functionality or component that requires authorization?
    • How have you ensured it respects the existing AuthN/AuthZ mechanisms?
    • Are you logging failed auth attempts?
  • Are you using or adding any cryptographic features?
    • Do you use a standard proven implementations?
    • Are the used keys controlled by the customer? Where are they stored?
  • Are you introducing any new policies/roles/users?
    • Have you used the least-privilege principle? How?

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

Sofia Sazonova added 2 commits April 12, 2024 13:02
@SofiaSazonova SofiaSazonova marked this pull request as ready for review April 12, 2024 12:56
@@ -63,7 +63,7 @@ def update_stack_output(session, stack):
aws = SessionHelper.remote_session(stack.accountid, stack.region)
cfn = aws.resource('cloudformation', region_name=stack.region)
try:
stack_outputs = cfn.Stack(f'{stack.name}').outputs
stack_outputs = cfn.StackRepository(f'{stack.name}').outputs
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not referring to the data.all Stack class but to the aws resource cfn.Stack!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, the naming was confusing...

@@ -26,11 +26,12 @@ from aws_cdk import (
)
from dataall.base.cdkproxy.stacks import stack


Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is also not refering to the StackRepository but to aws_cdk.Stack.

The whole block should be:


from aws_cdk import (
    aws_s3 as s3,
    aws_sqs as sqs,
    core,
    Stack
)


@stack(stack="mypredefinedstack")
class MyPredefinedStack(Stack):
    def __init__(self, scope, id, **kwargs):
        super().__init__(scope, id, **kwargs)
        # constructs goes here

@@ -435,8 +435,8 @@ def _deploy_dataset_stack(dataset: Dataset):
stack_helper.deploy_stack(dataset.environmentUri)

@staticmethod
def _create_dataset_stack(session, dataset: Dataset) -> Stack:
return Stack.create_stack(
def _create_dataset_stack(session, dataset: Dataset) -> StackRepository:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function should return a Stack model from dataall/core/stacks/db/stack_models.py

Copy link
Contributor

@dlpzx dlpzx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are some tiny bugs, but overall looks good

@noah-paige
Copy link
Contributor

Tested changes locally and created an environment - all functionality working as expected

Think just need to fix the Stack type hint (in the comment above)

Copy link
Contributor

@dlpzx dlpzx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good! Ready to merge

@SofiaSazonova SofiaSazonova merged commit 721bd4b into data-dot-all:main Apr 15, 2024
9 checks passed
@SofiaSazonova SofiaSazonova deleted the refactoring-env-stack-part2 branch October 3, 2024 13:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants