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

Init cmd #424

Open
wants to merge 44 commits into
base: release/0.3.0
Choose a base branch
from

Conversation

gaborschulz-aws
Copy link
Contributor

Description of changes:
New implementation of init command

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

cid/commands/init_cur.py Outdated Show resolved Hide resolved
cid/commands/init_cur.py Outdated Show resolved Hide resolved
except self.client.exceptions.AlreadyExistsException as ex:
logger.debug(ex, exc_info=True)
logger.info("Database %s cannot be created in %s: %s", name, catalog_id, ex)
raise CidError() from ex
Copy link
Collaborator

Choose a reason for hiding this comment

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

In other paces we use a logic of 'ensure' this means if we ask to create it will create or return exisitng. Simiarly with delete if the final state is achieved we do not need to raise a problem.

Please can you review if this fits?


for name, policy_file in custom_policies.items():
policy_document = pkg_resources.read_text('cid.builtin.core.data.iam', policy_file)
policy_document = inject_variables(source=policy_document, variables=self.variables)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Wgt we do not use a template as in other places?

Copy link
Collaborator

Choose a reason for hiding this comment

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

option 1 (new with Mako)

        template = Template(resource_string(
            package_or_requirement='cid.builtin.core',
            resource_name=template_file,
        ).decode('utf-8'))
        text = template.render(**params)

option 2 (leagcy with sandard lib )

from string import Template
....
      folder_permissions_tpl = Template(resource_string(
          package_or_requirement='cid.builtin.core',
          resource_name=f'data/permissions/folder_permissions.json',
      ).decode('utf-8'))
      columns_tpl = {
          'PrincipalArn': self.qs.get_principal_arn()
      }
      folder_permissions = json.loads(folder_permissions_tpl.safe_substitute(columns_tpl))

This looks more robust and future proof

gurajani and others added 21 commits April 12, 2023 09:50
Updated all tabs to include relative date range & as of date. Added new spend by calendar period visual to allow for quarterly analysis
* initial for cur-aggregation.yaml

* security recommendations for cur-aggregator

---------

Co-authored-by: Iakov Gan <[email protected]>
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.

None yet