Skip to content

Commit 1745239

Browse files
author
SDKAuto
committed
CodeGen from PR 13166 in Azure/azure-rest-api-specs
Merge b353336f78b47a9a9d83765d68a6b9b87ea76f95 into 89f00c2
1 parent 0d16cef commit 1745239

27 files changed

+309
-341
lines changed
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
22
"azext.isExperimental": true,
3-
"azext.minCliCoreVersion": "2.17.0"
4-
}
3+
"azext.minCliCoreVersion": "2.15.0"
4+
}

src/confluent/azext_confluent/generated/_client_factory.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ def cf_confluent_cl(cli_ctx, *_):
1717

1818

1919
def cf_marketplace_agreement(cli_ctx, *_):
20-
return cf_confluent_cl(cli_ctx).marketplace_agreement
20+
return cf_confluent_cl(cli_ctx).marketplace_agreements
2121

2222

2323
def cf_organization(cli_ctx, *_):

src/confluent/azext_confluent/generated/action.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@ def get_action(self, values, option_string): # pylint: disable=no-self-use
4343
d['term_unit'] = v[0]
4444
elif kl == 'status':
4545
d['status'] = v[0]
46+
else:
47+
raise CLIError('Unsupported Key {} is provided for parameter offer_detail. All possible keys are: '
48+
'publisher-id, id, plan-id, plan-name, term-unit, status'.format(k))
4649
return d
4750

4851

@@ -69,4 +72,7 @@ def get_action(self, values, option_string): # pylint: disable=no-self-use
6972
d['last_name'] = v[0]
7073
elif kl == 'email-address':
7174
d['email_address'] = v[0]
75+
else:
76+
raise CLIError('Unsupported Key {} is provided for parameter user_detail. All possible keys are: '
77+
'first-name, last-name, email-address'.format(k))
7278
return d

src/confluent/azext_confluent/generated/commands.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,23 +17,25 @@ def load_command_table(self, _):
1717

1818
from azext_confluent.generated._client_factory import cf_marketplace_agreement
1919
confluent_marketplace_agreement = CliCommandType(
20-
operations_tmpl='azext_confluent.vendored_sdks.confluent.operations._marketplace_agreement_operations#Marketpla'
21-
'ceAgreementOperations.{}',
20+
operations_tmpl='azext_confluent.vendored_sdks.confluent.operations._marketplace_agreements_operations#Marketpl'
21+
'aceAgreementsOperations.{}',
2222
client_factory=cf_marketplace_agreement)
2323
with self.command_group('confluent terms', confluent_marketplace_agreement,
24-
client_factory=cf_marketplace_agreement, is_experimental=True) as g:
24+
client_factory=cf_marketplace_agreement) as g:
2525
g.custom_command('list', 'confluent_terms_list')
2626

2727
from azext_confluent.generated._client_factory import cf_organization
2828
confluent_organization = CliCommandType(
2929
operations_tmpl='azext_confluent.vendored_sdks.confluent.operations._organization_operations#OrganizationOperat'
3030
'ions.{}',
3131
client_factory=cf_organization)
32-
with self.command_group('confluent organization', confluent_organization, client_factory=cf_organization,
33-
is_experimental=True) as g:
32+
with self.command_group('confluent organization', confluent_organization, client_factory=cf_organization) as g:
3433
g.custom_command('list', 'confluent_organization_list')
3534
g.custom_show_command('show', 'confluent_organization_show')
3635
g.custom_command('create', 'confluent_organization_create', supports_no_wait=True)
3736
g.custom_command('update', 'confluent_organization_update')
3837
g.custom_command('delete', 'confluent_organization_delete', supports_no_wait=True, confirmation=True)
3938
g.custom_wait_command('wait', 'confluent_organization_show')
39+
40+
with self.command_group('confluent', is_experimental=True):
41+
pass

src/confluent/azext_confluent/generated/custom.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,24 +38,27 @@ def confluent_organization_create(client,
3838
offer_detail=None,
3939
user_detail=None,
4040
no_wait=False):
41+
body = {}
42+
body['tags'] = tags
43+
body['location'] = location
44+
body['offer_detail'] = offer_detail
45+
body['user_detail'] = user_detail
4146
return sdk_no_wait(no_wait,
4247
client.begin_create,
4348
resource_group_name=resource_group_name,
4449
organization_name=organization_name,
45-
tags=tags,
46-
location=location,
47-
provisioning_state=None,
48-
offer_detail=offer_detail,
49-
user_detail=user_detail)
50+
body=body)
5051

5152

5253
def confluent_organization_update(client,
5354
resource_group_name,
5455
organization_name,
5556
tags=None):
57+
body = {}
58+
body['tags'] = tags
5659
return client.update(resource_group_name=resource_group_name,
5760
organization_name=organization_name,
58-
tags=tags)
61+
body=body)
5962

6063

6164
def confluent_organization_delete(client,

src/confluent/azext_confluent/tests/__init__.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@
3131
def try_manual(func):
3232
def import_manual_function(origin_func):
3333
from importlib import import_module
34-
decorated_path = inspect.getfile(origin_func)
35-
module_path = __path__[0]
34+
decorated_path = inspect.getfile(origin_func).lower()
35+
module_path = __path__[0].lower()
3636
if not decorated_path.startswith(module_path):
3737
raise Exception("Decorator can only be used in submodules!")
3838
manual_path = os.path.join(
@@ -46,7 +46,6 @@ def import_manual_function(origin_func):
4646
def get_func_to_call():
4747
func_to_call = func
4848
try:
49-
func_to_call = import_manual_function(func)
5049
func_to_call = import_manual_function(func)
5150
logger.info("Found manual override for %s(...)", func.__name__)
5251
except (ImportError, AttributeError):
@@ -66,6 +65,9 @@ def wrapper(*args, **kwargs):
6665
ret = func_to_call(*args, **kwargs)
6766
except (AssertionError, AzureError, CliTestError, CliExecutionError, SystemExit,
6867
JMESPathCheckAssertionError) as e:
68+
use_exception_cache = os.getenv("TEST_EXCEPTION_CACHE")
69+
if use_exception_cache is None or use_exception_cache.lower() != "true":
70+
raise
6971
test_map[func.__name__]["end_dt"] = dt.datetime.utcnow()
7072
test_map[func.__name__]["result"] = FAILED
7173
test_map[func.__name__]["error_message"] = str(e).replace("\r\n", " ").replace("\n", " ")[:500]

src/confluent/azext_confluent/tests/latest/example_steps.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,23 @@ def step_organization_create(test, rg, checks=None): # pylint: disable=unused-a
4141
checks=[])
4242

4343

44+
def step_organization_create(test, rg, checks=None):
45+
if checks is None:
46+
checks = []
47+
test.cmd('az confluent organization create '
48+
'--location "West US" '
49+
'--offer-detail id="string" plan-id="string" plan-name="string" publisher-id="string" term-unit="string" '
50+
'--user-detail email-address="[email protected]" first-name="string" last-name="string" '
51+
'--tags Environment="Dev" '
52+
'--name "{myOrganization}" '
53+
'--resource-group "{rg}"',
54+
checks=[])
55+
test.cmd('az confluent organization wait --created '
56+
'--name "{myOrganization}" '
57+
'--resource-group "{rg}"',
58+
checks=checks)
59+
60+
4461
# EXAMPLE: /Organization/get/Organization_Get
4562
@try_manual
4663
def step_organization_show(test, rg, checks=None): # pylint: disable=unused-argument
@@ -62,6 +79,16 @@ def step_organization_list(test, rg, checks=None): # pylint: disable=unused-arg
6279
checks=checks)
6380

6481

82+
# EXAMPLE: /Organization/get/Organization_ListBySubscription
83+
@try_manual
84+
def step_organization_list2(test, rg, checks=None):
85+
if checks is None:
86+
checks = []
87+
test.cmd('az confluent organization list '
88+
'-g ""',
89+
checks=checks)
90+
91+
6592
# EXAMPLE: /Organization/patch/Confluent_Update
6693
@try_manual
6794
def step_organization_update(test, rg, checks=None): # pylint: disable=unused-argument

src/confluent/azext_confluent/tests/latest/test_confluent_scenario.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
from .example_steps import step_organization_create
1616
from .example_steps import step_organization_show
1717
from .example_steps import step_organization_list
18-
from .example_steps import step_organization_list
18+
from .example_steps import step_organization_list2
1919
from .example_steps import step_organization_update
2020
from .example_steps import step_organization_delete
2121
from .. import (
@@ -69,6 +69,9 @@ def call_scenario(test, rg):
6969
step_organization_list(test, "", checks=[
7070
test.greater_than('length(@)', 0),
7171
])
72+
step_organization_list2(test, rg, checks=[
73+
test.check('length(@)', 1),
74+
])
7275
step_organization_update(test, rg, checks=[
7376
test.check("location", "eastus2euap", case_sensitive=False),
7477
test.check("userDetail.emailAddress", "[email protected]", case_sensitive=False),
@@ -85,13 +88,15 @@ def call_scenario(test, rg):
8588
@try_manual
8689
class ConfluentScenarioTest(ScenarioTest):
8790

88-
@ResourceGroupPreparer(name_prefix='clitestconfluent_myResourceGroup'[:7], key='rg', parameter_name='rg')
89-
def test_confluent_Scenario(self, rg):
90-
91+
def __init__(self, *args, **kwargs):
92+
super(ConfluentScenarioTest, self).__init__(*args, **kwargs)
9193
self.kwargs.update({
9294
'myOrganization': 'myOrganization',
9395
})
9496

97+
98+
@ResourceGroupPreparer(name_prefix='clitestconfluent_myResourceGroup'[:7], key='rg', parameter_name='rg')
99+
def test_confluent_Scenario(self, rg):
95100
call_scenario(self, rg)
96101
calc_coverage(__file__)
97102
raise_if()

src/confluent/azext_confluent/tests/latest/test_confluent_scenario_coverage.md

Lines changed: 0 additions & 8 deletions
This file was deleted.

src/confluent/azext_confluent/vendored_sdks/confluent/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77
# --------------------------------------------------------------------------
88

99
from ._confluent_management_client import ConfluentManagementClient
10+
from ._version import VERSION
11+
12+
__version__ = VERSION
1013
__all__ = ['ConfluentManagementClient']
1114

1215
try:

0 commit comments

Comments
 (0)