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

azure - org - subscription filter on quotaID #7161

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 9 additions & 1 deletion tools/c7n_org/scripts/azuresubs.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,15 @@
['Enabled', 'Warned', 'PastDue', 'Disabled', 'Deleted']),
default=('Enabled',),
help="File to store the generated config (default stdout)")
@click.option(
'-q', '--quota_id',
default="",
help="Filter based on spectic quotaID property e.g., EnterpriseAgreement")
@click.option(
'--name',
default=NAME_TEMPLATE,
help="Name template for subscriptions in the config, defaults to %s" % NAME_TEMPLATE)
def main(output, state, name):
def main(output, state, quota_id, name):
"""
Generate a c7n-org subscriptions config file
"""
Expand All @@ -33,6 +37,10 @@ def main(output, state, name):
for sub in subs:
if state and sub['state'] not in state:
continue
if quota_id:
sub_policies = sub['subscriptionPolicies']
if quota_id not in sub_policies['quotaId']:
continue
sub_info = {
'subscription_id': sub['subscriptionId'],
'name': sub['displayName']
Expand Down