-
Notifications
You must be signed in to change notification settings - Fork 169
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
WIP - implement managed identity flags on cluster create
- Loading branch information
Showing
3 changed files
with
72 additions
and
17 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# Copyright (c) Microsoft Corporation. | ||
# Licensed under the Apache License 2.0. | ||
|
||
import argparse | ||
|
||
from azext_aro.vendored_sdks.azure.mgmt.redhatopenshift.v2024_08_12_preview.models import PlatformWorkloadIdentity | ||
from azure.cli.core.azclierror import CLIError | ||
|
||
|
||
class AROPlatformWorkloadIdentityAddAction(argparse._AppendAction): | ||
|
||
def __call__(self, parser, namespace, values, option_string=None): | ||
try: | ||
if len(values) != 2: | ||
msg = '%s requires 2 values in format: `OPERATOR_NAME RESOURCE_ID`' | ||
raise argparse.ArgumentError( | ||
self, msg % (option_string)) | ||
|
||
operator_name, resource_id = values | ||
parsed = PlatformWorkloadIdentity( | ||
operator_name=operator_name, | ||
resource_id=resource_id | ||
) | ||
|
||
super(AROPlatformWorkloadIdentityAddAction, self).__call__( | ||
parser, namespace, parsed, option_string) | ||
|
||
except ValueError: | ||
raise CLIError('usage error: {} NAME ID'.format(option_string)) |
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
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