Skip to content

Commit

Permalink
Merge pull request #40 from akamai/34-url-based-policies-creation-doe…
Browse files Browse the repository at this point in the history
…snt-carry-the-optional-settings-attribute

carry over url policy settings attribute, remove connector
  • Loading branch information
bitonio authored Apr 16, 2024
2 parents b8ebc81 + 417e7de commit 825c4b7
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 7 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.6.5
0.6.6
3 changes: 3 additions & 0 deletions bin/akamai-eaa
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,9 @@ if __name__ == "__main__":
elif config.action == "apps":
con_moniker = EAAItem(config.connector_id)
c.list_apps(con_moniker, perf=perf)
elif config.action in ("delete", "rm"):
con_moniker = EAAItem(config.connector_id)
c.remove(con_moniker)
elif config.action == "allowlist":
c.allow_list()
else:
Expand Down
8 changes: 5 additions & 3 deletions bin/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,11 @@ def __init__(self, config_values, configuration, flags=None):
# subparsers.required = False
swap_parser = subsub.add_parser("swap", help="Swap connector with another one")
swap_parser.add_argument(dest="new_connector_id", help='New connector ID')
swap_parser.add_argument('--dryrun', dest="dryrun", action="store_true", default=False,
help='Dry run mode')
swap_parser.add_argument('--dryrun', dest="dryrun", action="store_true", default=False, help='Dry run mode')

remove_parser = subsub.add_parser("remove", aliases=["rm"], help="Unregister a connector")
remove_parser.add_argument('--force', dest="force", action="store_true", default=False, help='Forcibly remove the connector from apps')

allowlist_parser = subsub.add_parser("allowlist",
help="Dump EAA Cloud Endpoint for Firewall/Proxy/Network Security equipement")
allowlist_parser.add_argument('--skip-header', dest="skip_header", action="store_true", default=False,
Expand All @@ -175,7 +178,6 @@ def __init__(self, config_values, configuration, flags=None):
allowlist_parser.add_argument('--since-time', dest="since_time", default=None,
help='Only print endpoints updated after a specific date (RFC3339)')


subparsers.add_parser('idp', aliases=["i"], help='Manage EAA Identity Providers')

info_parser = subparsers.add_parser('info', help='Display tenant info (cloud zone)')
Expand Down
2 changes: 1 addition & 1 deletion cli.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"commands": [
{
"name": "eaa",
"version": "0.6.5",
"version": "0.6.6",
"description": "Akamai CLI for Enterprise Application Access (EAA)"
}
]
Expand Down
2 changes: 2 additions & 0 deletions libeaa/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,8 @@ def create_urlbasedpolicies(self, app_moniker, app_config):
"name": upp_rule.get("name"),
"url": upp_rule.get("url")
}
if upp_rule.get("settings"):
upp_create_payload["settings"] = upp_rule.get("settings")
upp_create = self.post(upp_url, json=upp_create_payload)
upp_create_data = upp_create.json()
if upp_create_data.get('uuid_url'):
Expand Down
4 changes: 2 additions & 2 deletions libeaa/common.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2022 Akamai Technologies, Inc. All Rights Reserved
# Copyright 2024 Akamai Technologies, Inc. All Rights Reserved
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -17,7 +17,7 @@
"""

#: cli-eaa version [PEP 8]
__version__ = '0.6.5'
__version__ = '0.6.6'

import sys
from threading import Event
Expand Down
13 changes: 13 additions & 0 deletions libeaa/connector.py
Original file line number Diff line number Diff line change
Expand Up @@ -411,3 +411,16 @@ def swap(self, old_con_id, new_con_id, dryrun=False):
else:
cli.footer("Connector swapped in %s application(s)." % app_processed)
cli.footer("Updated application(s) is/are marked as ready to deploy")


def remove(self, connector_moniker: EAAItem):
"Delete an EAA connector."
r = self.delete(f'mgmt-pop/agents/{connector_moniker.uuid}')
if r.status_code == 204:
cli.print("Connector deleted successfully.")
return_code = 0
else:
cli.print_error(f"Can't delete connector {connector_moniker.uuid}, API returned HTTP/{r.status_code}.")
cli.print_error("Use: akamai eaa connector list")
return_code = 1
cli.exit(return_code)

0 comments on commit 825c4b7

Please sign in to comment.