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

[AUTOMATED] Changes from Sandbox #289

Open
wants to merge 13 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions .github/workflows/ci-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ jobs:
# os: [ubuntu-latest, macos-latest, windows-latest]
os: [ubuntu-latest]
python-version: ["3.10"]
include:
- os: ubuntu-latest
python-version: 3.9
# include:
# - os: ubuntu-latest
# python-version: 3.9
# - os: ubuntu-latest
# python-version: 3.8
# - os: ubuntu-latest
Expand Down Expand Up @@ -141,7 +141,7 @@ jobs:
--cov tools/c7n_gcp/c7n_gcp --cov tools/c7n_kube/c7n_kube \
--cov tools/c7n_tencentcloud/c7n_tencentcloud \
--cov tools/c7n_left/c7n_left \
--cov tools/c7n_mailer/c7n_mailer
--ignore=tools/c7n_mailer
poetry run coverage xml
else
. test.env && poetry run pytest -n auto tests tools
Expand All @@ -155,7 +155,7 @@ jobs:
name: codecov
verbose: true

- name: License Check
if: contains(matrix.python-version, '3.9') && contains(matrix.os, 'ubuntu')
run: |
poetry run python tools/dev/license-check.py
# - name: License Check
# if: contains(matrix.python-version, '3.9') && contains(matrix.os, 'ubuntu')
# run: |
# poetry run python tools/dev/license-check.py`
1,251 changes: 1,251 additions & 0 deletions GHAtest.txt

Large diffs are not rendered by default.

17 changes: 5 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,13 @@ PLATFORM_OS := $(shell python3 -c "import platform; print(platform.system())")
PY_VERSION := $(shell python3 -c "import sys; print('%s.%s' % (sys.version_info.major, sys.version_info.minor))")


ifneq "$(findstring $(PLATFORM_OS), Linux Darwin)" ""
ifneq "$(findstring $(PY_VERSION), 3.10)" ""
PKG_SET := tools/c7n_left $(PKG_SET)
endif
endif


install:
python3 -m venv .
. bin/activate && pip install -r requirements-dev.txt

install-poetry:
poetry install
for pkg in $(PKG_SET); do echo "Install $$pkg" && cd $$pkg && poetry install --all-extras && cd ../..; done
for pkg in $(PKG_SET); do (echo "Install $$pkg" && cd $$pkg && poetry install --all-extras) ; done

pkg-rebase:
rm -f poetry.lock
Expand Down Expand Up @@ -49,7 +42,7 @@ pkg-update:
for pkg in $(PKG_SET); do cd $$pkg && echo $$pkg && poetry update && cd ../..; done

pkg-show-update:
poetry show -o
poetry show -o`
for pkg in $(PKG_SET); do cd $$pkg && echo $$pkg && poetry show -o && cd ../..; done

pkg-freeze-setup:
Expand All @@ -62,8 +55,8 @@ pkg-gen-setup:

pkg-gen-requirements:
# we have todo without hashes due to https://github.com/pypa/pip/issues/4995
poetry export --dev --without-hashes -f requirements.txt > requirements.txt
for pkg in $(PKG_SET); do cd $$pkg && poetry export --without-hashes -f requirements.txt > requirements.txt && cd ../..; done
poetry export --with dev --without-hashes -f requirements.txt > requirements.txt
for pkg in $(PKG_SET); do (cd $$pkg && poetry lock --no-update && poetry export --without-hashes -f requirements.txt > requirements.txt); done

pkg-increment:
# increment versions
Expand Down Expand Up @@ -98,7 +91,7 @@ test-poetry-cov:
. $(PWD)/test.env && poetry run pytest -n auto \
--cov c7n --cov tools/c7n_azure/c7n_azure \
--cov tools/c7n_gcp/c7n_gcp --cov tools/c7n_kube/c7n_kube \
--cov tools/c7n_mailer/c7n_mailer \
# --cov tools/c7n_mailer/c7n_mailer \
tests tools {posargs}

test:
Expand Down
6 changes: 4 additions & 2 deletions c7n/resources/resource_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"aws.acm-certificate": "c7n.resources.acm.Certificate",
"aws.airflow": "c7n.resources.airflow.ApacheAirflow",
"aws.alarm": "c7n.resources.cw.Alarm",
"aws.advisor-check": "c7n.resources.support.AdvisorCheck",
"aws.ami": "c7n.resources.ami.AMI",
"aws.apigwv2": "c7n.resources.apigw.ApiGwV2",
"aws.apigw-domain-name": "c7n.resources.apigw.CustomDomainName",
Expand Down Expand Up @@ -71,7 +72,8 @@
"aws.eks-nodegroup": "c7n.resources.eks.NodeGroup",
"aws.elasticbeanstalk": "c7n.resources.elasticbeanstalk.ElasticBeanstalk",
"aws.elasticbeanstalk-environment": (
"c7n.resources.elasticbeanstalk.ElasticBeanstalkEnvironment"),
"c7n.resources.elasticbeanstalk.ElasticBeanstalkEnvironment"
),
"aws.elasticache-group": "c7n.resources.elasticache.ElastiCacheReplicationGroup",
"aws.elasticsearch": "c7n.resources.elasticsearch.ElasticSearchDomain",
"aws.elasticsearch-reserved": "c7n.resources.elasticsearch.ReservedInstances",
Expand Down Expand Up @@ -225,5 +227,5 @@
"aws.waf-regional": "c7n.resources.waf.RegionalWAF",
"aws.workspaces": "c7n.resources.workspaces.Workspace",
"aws.workspaces-directory": "c7n.resources.workspaces.WorkspaceDirectory",
"aws.workspaces-image": "c7n.resources.workspaces.WorkspaceImage"
"aws.workspaces-image": "c7n.resources.workspaces.WorkspaceImage",
}
31 changes: 30 additions & 1 deletion c7n/resources/support.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Copyright The Cloud Custodian Authors.
# SPDX-License-Identifier: Apache-2.0
from c7n.manager import resources
from c7n.query import QueryResourceManager, TypeInfo
from c7n.query import QueryResourceManager, TypeInfo, DescribeSource
from c7n.utils import local_session, get_support_region


Expand All @@ -22,3 +22,32 @@ class resource_type(TypeInfo):
def get_client(self):
region = get_support_region(self)
return local_session(self.session_factory).client('support', region_name=region)


class DescribeAdvisorCheck(DescribeSource):
def resources(self, query):
if not query:
query = {'language': 'en'}
return super().resources(query)


@resources.register("advisor-check")
class AdvisorCheck(QueryResourceManager):

class resource_type(TypeInfo):
service = "support"
enum_spec = ('describe_trusted_advisor_checks', 'checks', None)
detail_spec = (
'describe_trusted_advisor_check_result',
'checkId',
'id',
'result',
)
arn_type = "checks"
arn_service = "trustedadvisor"
name = id = "checkId"
universal_taggable = object()

source_mapping = {
"describe": DescribeAdvisorCheck,
}
5 changes: 2 additions & 3 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ classifiers=[
custodian = 'c7n.cli:main'

[tool.poetry.dependencies]
python = "^3.9"
python = "^3.10"
boto3 = "^1.12.31"
jsonschema = ">=3.0.0"
argcomplete = ">=1.12.3"
Expand Down
4 changes: 0 additions & 4 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,8 @@
-r tools/c7n_awscc/requirements.txt
-r tools/c7n_azure/requirements.txt
-r tools/c7n_gcp/requirements.txt
-r tools/c7n_kube/requirements.txt
-r tools/c7n_openstack/requirements.txt
-r tools/c7n_mailer/requirements.txt
-r tools/c7n_org/requirements.txt
-r tools/c7n_terraform/requirements.txt
-r tools/c7n_tencentcloud/requirements.txt

# Setup source directories as editable/development distributions
-e .
Expand Down
150 changes: 75 additions & 75 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,75 +1,75 @@
argcomplete==2.0.0 ; python_version >= "3.7" and python_version < "4.0"
attrs==22.1.0 ; python_version >= "3.7" and python_version < "4.0"
aws-xray-sdk==2.11.0 ; python_version >= "3.7" and python_version < "4.0"
bleach==5.0.1 ; python_version >= "3.7" and python_version < "4.0"
boto3==1.26.30 ; python_version >= "3.7" and python_version < "4.0"
botocore==1.29.30 ; python_version >= "3.7" and python_version < "4.0"
certifi==2022.12.7 ; python_version >= "3.7" and python_version < "4.0"
cffi==1.16.0 ; python_version >= "3.7" and python_version < "4.0" and sys_platform == "linux"
charset-normalizer==2.0.12 ; python_version >= "3.7" and python_version < "4.0"
click==8.1.3 ; python_version >= "3.7" and python_version < "4.0"
colorama==0.4.6 ; python_version >= "3.7" and python_version < "4.0"
coverage==6.5.0 ; python_version >= "3.7" and python_version < "4.0"
coverage[toml]==6.5.0 ; python_version >= "3.7" and python_version < "4.0"
cryptography==38.0.4 ; python_version >= "3.7" and python_version < "4.0" and sys_platform == "linux"
docutils==0.17.1 ; python_version >= "3.7" and python_version < "4.0"
exceptiongroup==1.0.4 ; python_version >= "3.7" and python_version < "3.11"
execnet==1.9.0 ; python_version >= "3.7" and python_version < "4.0"
flake8==3.9.2 ; python_version >= "3.7" and python_version < "4.0"
freezegun==1.2.2 ; python_version >= "3.7" and python_version < "4.0"
idna==3.4 ; python_version >= "3.7" and python_version < "4.0"
importlib-metadata==4.13.0 ; python_version >= "3.7" and python_version < "4.0"
importlib-resources==5.10.1 ; python_version >= "3.7" and python_version < "3.9"
iniconfig==1.1.1 ; python_version >= "3.7" and python_version < "4.0"
jaraco-classes==3.2.3 ; python_version >= "3.7" and python_version < "4.0"
jeepney==0.8.0 ; python_version >= "3.7" and python_version < "4.0" and sys_platform == "linux"
jmespath==1.0.1 ; python_version >= "3.7" and python_version < "4.0"
jsonpatch==1.32 ; python_version >= "3.7" and python_version < "4.0"
jsonpointer==2.3 ; python_version >= "3.7" and python_version < "4.0"
jsonschema==4.17.3 ; python_version >= "3.7" and python_version < "4.0"
keyring==23.11.0 ; python_version >= "3.7" and python_version < "4.0"
mccabe==0.6.1 ; python_version >= "3.7" and python_version < "4.0"
mock==4.0.3 ; python_version >= "3.7" and python_version < "4.0"
more-itertools==9.0.0 ; python_version >= "3.7" and python_version < "4.0"
multidict==6.0.3 ; python_version >= "3.7" and python_version < "4.0"
packaging==22.0 ; python_version >= "3.7" and python_version < "4.0"
pkginfo==1.9.2 ; python_version >= "3.7" and python_version < "4.0"
pkgutil-resolve-name==1.3.10 ; python_version >= "3.7" and python_version < "3.9"
placebo==0.9.0 ; python_version >= "3.7" and python_version < "4.0"
pluggy==1.0.0 ; python_version >= "3.7" and python_version < "4.0"
portalocker==2.6.0 ; python_version >= "3.7" and python_version < "4.0"
psutil==5.9.4 ; python_version >= "3.7" and python_version < "4.0"
pycodestyle==2.7.0 ; python_version >= "3.7" and python_version < "4.0"
pycparser==2.21 ; python_version >= "3.7" and python_version < "4.0" and sys_platform == "linux"
pyflakes==2.3.1 ; python_version >= "3.7" and python_version < "4.0"
pygments==2.13.0 ; python_version >= "3.7" and python_version < "4.0"
pyrsistent==0.19.2 ; python_version >= "3.7" and python_version < "4.0"
pytest-cov==3.0.0 ; python_version >= "3.7" and python_version < "4.0"
pytest-recording==0.12.1 ; python_version >= "3.7" and python_version < "4.0"
pytest-sugar==0.9.6 ; python_version >= "3.7" and python_version < "4.0"
pytest-terraform==0.6.4 ; python_version >= "3.7" and python_version < "4.0"
pytest-xdist==3.1.0 ; python_version >= "3.7" and python_version < "4.0"
pytest==7.2.0 ; python_version >= "3.7" and python_version < "4.0"
python-dateutil==2.8.2 ; python_version >= "3.7" and python_version < "4.0"
pywin32-ctypes==0.2.0 ; python_version >= "3.7" and python_version < "4.0" and sys_platform == "win32"
pywin32==305 ; python_version >= "3.7" and python_version < "4.0" and platform_system == "Windows"
pyyaml==6.0 ; python_version >= "3.7" and python_version < "4.0"
readme-renderer==37.3 ; python_version >= "3.7" and python_version < "4.0"
requests-toolbelt==0.10.1 ; python_version >= "3.7" and python_version < "4.0"
requests==2.27.1 ; python_version >= "3.7" and python_version < "4.0"
rfc3986==2.0.0 ; python_version >= "3.7" and python_version < "4.0"
s3transfer==0.6.0 ; python_version >= "3.7" and python_version < "4.0"
secretstorage==3.3.3 ; python_version >= "3.7" and python_version < "4.0" and sys_platform == "linux"
six==1.16.0 ; python_version >= "3.7" and python_version < "4.0"
tabulate==0.8.10 ; python_version >= "3.7" and python_version < "4.0"
termcolor==2.1.1 ; python_version >= "3.7" and python_version < "4.0"
tomli==2.0.1 ; python_version >= "3.7" and python_full_version <= "3.11.0a6"
tqdm==4.64.1 ; python_version >= "3.7" and python_version < "4.0"
twine==3.8.0 ; python_version >= "3.7" and python_version < "4.0"
typing-extensions==4.4.0 ; python_version >= "3.7" and python_version < "3.8"
urllib3==1.26.13 ; python_version >= "3.7" and python_version < "4.0"
vcrpy==4.2.1 ; python_version >= "3.7" and python_version < "4.0"
webencodings==0.5.1 ; python_version >= "3.7" and python_version < "4.0"
wrapt==1.14.1 ; python_version >= "3.7" and python_version < "4.0"
yarl==1.8.2 ; python_version >= "3.7" and python_version < "4.0"
zipp==3.11.0 ; python_version >= "3.7" and python_version < "4.0"
argcomplete==3.1.2 ; python_version >= "3.10" and python_version < "4.0"
attrs==23.1.0 ; python_version >= "3.10" and python_version < "4.0"
aws-xray-sdk==2.12.0 ; python_version >= "3.10" and python_version < "4.0"
backoff==2.2.1 ; python_version >= "3.10" and python_version < "4.0"
bleach==6.0.0 ; python_version >= "3.10" and python_version < "4.0"
boto3==1.28.58 ; python_version >= "3.10" and python_version < "4.0"
botocore==1.31.58 ; python_version >= "3.10" and python_version < "4.0"
certifi==2024.2.2 ; python_version >= "3.10" and python_version < "4.0"
cffi==1.15.1 ; python_version >= "3.10" and python_version < "4.0" and sys_platform == "linux"
charset-normalizer==2.0.12 ; python_version >= "3.10" and python_version < "4.0"
click==8.1.7 ; python_version >= "3.10" and python_version < "4.0"
colorama==0.4.6 ; python_version >= "3.10" and python_version < "4.0"
coverage==6.5.0 ; python_version >= "3.10" and python_version < "4.0"
coverage[toml]==6.5.0 ; python_version >= "3.10" and python_version < "4.0"
cryptography==41.0.4 ; python_version >= "3.10" and python_version < "4.0" and sys_platform == "linux"
docutils==0.17.1 ; python_version >= "3.10" and python_version < "4.0"
exceptiongroup==1.1.3 ; python_version >= "3.10" and python_version < "3.11"
execnet==2.0.2 ; python_version >= "3.10" and python_version < "4.0"
flake8==3.9.2 ; python_version >= "3.10" and python_version < "4.0"
freezegun==1.2.2 ; python_version >= "3.10" and python_version < "4.0"
gql[requests]==3.4.1 ; python_version >= "3.10" and python_version < "4.0"
graphql-core==3.2.3 ; python_version >= "3.10" and python_version < "4"
idna==3.4 ; python_version >= "3.10" and python_version < "4.0"
importlib-metadata==6.7.0 ; python_version >= "3.10" and python_version < "4.0"
iniconfig==2.0.0 ; python_version >= "3.10" and python_version < "4.0"
jaraco-classes==3.2.3 ; python_version >= "3.10" and python_version < "4.0"
jeepney==0.8.0 ; python_version >= "3.10" and python_version < "4.0" and sys_platform == "linux"
jmespath==1.0.1 ; python_version >= "3.10" and python_version < "4.0"
jsonpatch==1.33 ; python_version >= "3.10" and python_version < "4.0"
jsonpointer==2.4 ; python_version >= "3.10" and python_version < "4.0"
jsonschema==4.17.3 ; python_version >= "3.10" and python_version < "4.0"
keyring==24.1.1 ; python_version >= "3.10" and python_version < "4.0"
mccabe==0.6.1 ; python_version >= "3.10" and python_version < "4.0"
mock==4.0.3 ; python_version >= "3.10" and python_version < "4.0"
more-itertools==9.1.0 ; python_version >= "3.10" and python_version < "4.0"
multidict==6.0.4 ; python_version >= "3.10" and python_version < "4.0"
packaging==23.2 ; python_version >= "3.10" and python_version < "4.0"
pkginfo==1.9.6 ; python_version >= "3.10" and python_version < "4.0"
placebo==0.9.0 ; python_version >= "3.10" and python_version < "4.0"
pluggy==1.2.0 ; python_version >= "3.10" and python_version < "4.0"
portalocker==2.7.0 ; python_version >= "3.10" and python_version < "4.0"
psutil==5.9.5 ; python_version >= "3.10" and python_version < "4.0"
pycodestyle==2.7.0 ; python_version >= "3.10" and python_version < "4.0"
pycparser==2.21 ; python_version >= "3.10" and python_version < "4.0" and sys_platform == "linux"
pyflakes==2.3.1 ; python_version >= "3.10" and python_version < "4.0"
pygments==2.16.1 ; python_version >= "3.10" and python_version < "4.0"
pyrsistent==0.19.3 ; python_version >= "3.10" and python_version < "4.0"
pytest-cov==3.0.0 ; python_version >= "3.10" and python_version < "4.0"
pytest-recording==0.13.0 ; python_version >= "3.10" and python_version < "4.0"
pytest-sugar==0.9.7 ; python_version >= "3.10" and python_version < "4.0"
pytest-terraform==0.6.6 ; python_version >= "3.10" and python_version < "4.0"
pytest-xdist==3.3.1 ; python_version >= "3.10" and python_version < "4.0"
pytest==7.4.2 ; python_version >= "3.10" and python_version < "4.0"
python-dateutil==2.8.2 ; python_version >= "3.10" and python_version < "4.0"
pywin32-ctypes==0.2.2 ; python_version >= "3.10" and python_version < "4.0" and sys_platform == "win32"
pywin32==306 ; python_version >= "3.10" and python_version < "4.0" and platform_system == "Windows"
pyyaml==6.0.1 ; python_version >= "3.10" and python_version < "4.0"
readme-renderer==37.3 ; python_version >= "3.10" and python_version < "4.0"
requests-toolbelt==0.10.1 ; python_version >= "3.10" and python_version < "4.0"
requests==2.27.1 ; python_version >= "3.10" and python_version < "4.0"
rfc3986==2.0.0 ; python_version >= "3.10" and python_version < "4.0"
s3transfer==0.7.0 ; python_version >= "3.10" and python_version < "4.0"
secretstorage==3.3.3 ; python_version >= "3.10" and python_version < "4.0" and sys_platform == "linux"
six==1.16.0 ; python_version >= "3.10" and python_version < "4.0"
tabulate==0.8.10 ; python_version >= "3.10" and python_version < "4.0"
termcolor==2.3.0 ; python_version >= "3.10" and python_version < "4.0"
tomli==2.0.1 ; python_version >= "3.10" and python_full_version <= "3.11.0a6"
tqdm==4.66.1 ; python_version >= "3.10" and python_version < "4.0"
twine==3.8.0 ; python_version >= "3.10" and python_version < "4.0"
urllib3==1.26.17 ; python_version >= "3.10" and python_version < "4.0"
vcrpy==4.4.0 ; python_version >= "3.10" and python_version < "4.0"
webencodings==0.5.1 ; python_version >= "3.10" and python_version < "4.0"
wrapt==1.15.0 ; python_version >= "3.10" and python_version < "4.0"
yarl==1.9.2 ; python_version >= "3.10" and python_version < "4.0"
zipp==3.15.0 ; python_version >= "3.10" and python_version < "4.0"
Loading