-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[EventGrid] Add commands for partner and event-subscription customer …
…facing features (#23162) * Bump Event Grid package version to latest preview * Add nested event subscriptions for Event Grid topics * Add nested event subscriptions for Event Grid domains and domain topics * Add verified partner commands * Add all new factories and command groups * Implement all commands * Add more documentation * Change parameter names * Fix pylint and flake8 issues * Findings from design review * Resolve linter issues * test update * Fix linter errors for update parameters * Implement and record tests * Multiple fixes and record tests. fixes include, add missing parameters to channel create, fix resource name parameter for partner channel commands, add tests for partner destination and fix tests for secured webhook scenarios, add try/finally to ensure proper cleanup, remove preview tags for ga'ed featured, add deprecation info for publisher_info and optional partner registration, and others * remve secrets * cleanup: fix style and linter error * cleanup * fix param lengths * fix help * rerecord network test1 * rerecord network test2 * rerecord network test3 * fix help Co-authored-by: Brandon Neff <[email protected]> Co-authored-by: Ashraf Hamad <[email protected]>
- Loading branch information
1 parent
a931eff
commit 2463aa8
Showing
32 changed files
with
19,874 additions
and
4,108 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1,136 changes: 1,028 additions & 108 deletions
1,136
src/azure-cli/azure/cli/command_modules/eventgrid/_help.py
Large diffs are not rendered by default.
Oops, something went wrong.
264 changes: 238 additions & 26 deletions
264
src/azure-cli/azure/cli/command_modules/eventgrid/_params.py
Large diffs are not rendered by default.
Oops, something went wrong.
55 changes: 55 additions & 0 deletions
55
src/azure-cli/azure/cli/command_modules/eventgrid/authorized_partner.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
# -------------------------------------------------------------------------------------------- | ||
# Copyright (c) Microsoft Corporation. All rights reserved. | ||
# Licensed under the MIT License. See License.txt in the project root for license information. | ||
# -------------------------------------------------------------------------------------------- | ||
|
||
import argparse | ||
from knack.util import CLIError | ||
from dateutil.parser import parse # pylint: disable=import-error,relative-import | ||
from azure.mgmt.eventgrid.models import ( | ||
Partner | ||
) | ||
|
||
PARTNER_NAME = "partner-name" | ||
PARTNER_ID = "partner-registration-immutable-id" | ||
EXPIRATION_TIME = "expiration-time" | ||
|
||
|
||
# pylint: disable=protected-access | ||
# pylint: disable=too-few-public-methods | ||
class AddAuthorizedPartner(argparse._AppendAction): | ||
def __call__(self, parser, namespace, values, option_string=None): | ||
valuesLen = len(values) | ||
usage_error_msg = ("usage error: --authorized-partner [partner-name=<name>] " | ||
"[partner-registration-immutable-id=<id>] [expiration-time=<timestamp>]") | ||
if valuesLen < 1 or valuesLen > 3: | ||
raise CLIError(usage_error_msg) | ||
|
||
partner_name = None | ||
partner_id = None | ||
expiration_time = None | ||
for item in values: | ||
try: | ||
key, value = item.split('=', 1) | ||
if key.lower() == PARTNER_NAME: | ||
partner_name = value | ||
elif key.lower() == PARTNER_ID: | ||
partner_id = value | ||
elif key.lower() == EXPIRATION_TIME: | ||
expiration_time = value | ||
else: | ||
raise ValueError() | ||
except ValueError: | ||
raise CLIError(usage_error_msg) | ||
|
||
if expiration_time is not None: | ||
expiration_time = parse(expiration_time) | ||
|
||
partner_info = Partner( | ||
partner_registration_immutable_id=partner_id, | ||
partner_name=partner_name, | ||
authorization_expiration_time_in_utc=expiration_time) | ||
|
||
if namespace.authorized_partner is None: | ||
namespace.authorized_partner = [] | ||
namespace.authorized_partner.append(partner_info) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.