Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/confluent/azext_confluent/azext_metadata.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"azext.isExperimental": true,
"azext.minCliCoreVersion": "2.17.0"
}
"azext.minCliCoreVersion": "2.15.0"
}
6 changes: 5 additions & 1 deletion src/confluent/azext_confluent/generated/_client_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,12 @@ def cf_confluent_cl(cli_ctx, *_):


def cf_marketplace_agreement(cli_ctx, *_):
return cf_confluent_cl(cli_ctx).marketplace_agreement
return cf_confluent_cl(cli_ctx).marketplace_agreements


def cf_organization(cli_ctx, *_):
return cf_confluent_cl(cli_ctx).organization


def cf_validation(cli_ctx, *_):
return cf_confluent_cl(cli_ctx).validations
49 changes: 43 additions & 6 deletions src/confluent/azext_confluent/generated/_help.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,11 @@
long-summary: |
Usage: --offer-detail publisher-id=XX id=XX plan-id=XX plan-name=XX term-unit=XX status=XX

publisher-id: Publisher Id
id: Offer Id
plan-id: Offer Plan Id
plan-name: Offer Plan Name
term-unit: Offer Plan Term unit
publisher-id: Required. Publisher Id
id: Required. Offer Id
plan-id: Required. Offer Plan Id
plan-name: Required. Offer Plan Name
term-unit: Required. Offer Plan Term unit
status: SaaS Offer Status
- name: --user-detail
short-summary: "Subscriber detail"
Expand All @@ -75,7 +75,7 @@

first-name: First name
last-name: Last name
email-address: Email address
email-address: Required. Email address
examples:
- name: Organization_Create
text: |-
Expand Down Expand Up @@ -115,3 +115,40 @@
text: |-
az confluent organization wait --name "myOrganization" --resource-group "myResourceGroup" --deleted
"""

helps['confluent validation'] = """
type: group
short-summary: Manage validation with confluent
"""

helps['confluent validation validate-organization'] = """
type: command
short-summary: "Organization Validate proxy resource."
parameters:
- name: --offer-detail
short-summary: "Confluent offer detail"
long-summary: |
Usage: --offer-detail publisher-id=XX id=XX plan-id=XX plan-name=XX term-unit=XX status=XX

publisher-id: Required. Publisher Id
id: Required. Offer Id
plan-id: Required. Offer Plan Id
plan-name: Required. Offer Plan Name
term-unit: Required. Offer Plan Term unit
status: SaaS Offer Status
- name: --user-detail
short-summary: "Subscriber detail"
long-summary: |
Usage: --user-detail first-name=XX last-name=XX email-address=XX

first-name: First name
last-name: Last name
email-address: Required. Email address
examples:
- name: Validations_ValidateOrganizations
text: |-
az confluent validation validate-organization --location "West US" --offer-detail id="string" \
plan-id="string" plan-name="string" publisher-id="string" term-unit="string" --user-detail \
email-address="[email protected]" first-name="string" last-name="string" --tags Environment="Dev" --organization-name \
"myOrganization" --resource-group "myResourceGroup"
"""
9 changes: 9 additions & 0 deletions src/confluent/azext_confluent/generated/_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,12 @@ def load_arguments(self, _):
c.argument('resource_group_name', resource_group_name_type)
c.argument('organization_name', options_list=['--name', '-n', '--organization-name'], type=str,
help='Organization resource name', id_part='name')

with self.argument_context('confluent validation validate-organization') as c:
c.argument('resource_group_name', resource_group_name_type)
c.argument('organization_name', type=str, help='Organization resource name', id_part='name')
c.argument('tags', tags_type)
c.argument('location', arg_type=get_location_type(self.cli_ctx), required=False,
validator=get_default_location_from_resource_group)
c.argument('offer_detail', action=AddOfferDetail, nargs='+', help='Confluent offer detail')
c.argument('user_detail', action=AddUserDetail, nargs='+', help='Subscriber detail')
6 changes: 6 additions & 0 deletions src/confluent/azext_confluent/generated/action.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ def get_action(self, values, option_string): # pylint: disable=no-self-use
d['term_unit'] = v[0]
elif kl == 'status':
d['status'] = v[0]
else:
raise CLIError('Unsupported Key {} is provided for parameter offer_detail. All possible keys are: '
'publisher-id, id, plan-id, plan-name, term-unit, status'.format(k))
return d


Expand All @@ -69,4 +72,7 @@ def get_action(self, values, option_string): # pylint: disable=no-self-use
d['last_name'] = v[0]
elif kl == 'email-address':
d['email_address'] = v[0]
else:
raise CLIError('Unsupported Key {} is provided for parameter user_detail. All possible keys are: '
'first-name, last-name, email-address'.format(k))
return d
20 changes: 15 additions & 5 deletions src/confluent/azext_confluent/generated/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,23 +17,33 @@ def load_command_table(self, _):

from azext_confluent.generated._client_factory import cf_marketplace_agreement
confluent_marketplace_agreement = CliCommandType(
operations_tmpl='azext_confluent.vendored_sdks.confluent.operations._marketplace_agreement_operations#Marketpla'
'ceAgreementOperations.{}',
operations_tmpl='azext_confluent.vendored_sdks.confluent.operations._marketplace_agreements_operations#Marketpl'
'aceAgreementsOperations.{}',
client_factory=cf_marketplace_agreement)
with self.command_group('confluent terms', confluent_marketplace_agreement,
client_factory=cf_marketplace_agreement, is_experimental=True) as g:
client_factory=cf_marketplace_agreement) as g:
g.custom_command('list', 'confluent_terms_list')

from azext_confluent.generated._client_factory import cf_organization
confluent_organization = CliCommandType(
operations_tmpl='azext_confluent.vendored_sdks.confluent.operations._organization_operations#OrganizationOperat'
'ions.{}',
client_factory=cf_organization)
with self.command_group('confluent organization', confluent_organization, client_factory=cf_organization,
is_experimental=True) as g:
with self.command_group('confluent organization', confluent_organization, client_factory=cf_organization) as g:
g.custom_command('list', 'confluent_organization_list')
g.custom_show_command('show', 'confluent_organization_show')
g.custom_command('create', 'confluent_organization_create', supports_no_wait=True)
g.custom_command('update', 'confluent_organization_update')
g.custom_command('delete', 'confluent_organization_delete', supports_no_wait=True, confirmation=True)
g.custom_wait_command('wait', 'confluent_organization_show')

from azext_confluent.generated._client_factory import cf_validation
confluent_validation = CliCommandType(
operations_tmpl='azext_confluent.vendored_sdks.confluent.operations._validations_operations#ValidationsOperatio'
'ns.{}',
client_factory=cf_validation)
with self.command_group('confluent validation', confluent_validation, client_factory=cf_validation) as g:
g.custom_command('validate-organization', 'confluent_validation_validate_organization')

with self.command_group('confluent', is_experimental=True):
pass
32 changes: 26 additions & 6 deletions src/confluent/azext_confluent/generated/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,24 +38,27 @@ def confluent_organization_create(client,
offer_detail=None,
user_detail=None,
no_wait=False):
body = {}
body['tags'] = tags
body['location'] = location
body['offer_detail'] = offer_detail
body['user_detail'] = user_detail
return sdk_no_wait(no_wait,
client.begin_create,
resource_group_name=resource_group_name,
organization_name=organization_name,
tags=tags,
location=location,
provisioning_state=None,
offer_detail=offer_detail,
user_detail=user_detail)
body=body)


def confluent_organization_update(client,
resource_group_name,
organization_name,
tags=None):
body = {}
body['tags'] = tags
return client.update(resource_group_name=resource_group_name,
organization_name=organization_name,
tags=tags)
body=body)


def confluent_organization_delete(client,
Expand All @@ -66,3 +69,20 @@ def confluent_organization_delete(client,
client.begin_delete,
resource_group_name=resource_group_name,
organization_name=organization_name)


def confluent_validation_validate_organization(client,
resource_group_name,
organization_name,
offer_detail,
user_detail,
tags=None,
location=None):
body = {}
body['tags'] = tags
body['location'] = location
body['offer_detail'] = offer_detail
body['user_detail'] = user_detail
return client.validate_organization(resource_group_name=resource_group_name,
organization_name=organization_name,
body=body)
8 changes: 5 additions & 3 deletions src/confluent/azext_confluent/tests/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
def try_manual(func):
def import_manual_function(origin_func):
from importlib import import_module
decorated_path = inspect.getfile(origin_func)
module_path = __path__[0]
decorated_path = inspect.getfile(origin_func).lower()
module_path = __path__[0].lower()
if not decorated_path.startswith(module_path):
raise Exception("Decorator can only be used in submodules!")
manual_path = os.path.join(
Expand All @@ -46,7 +46,6 @@ def import_manual_function(origin_func):
def get_func_to_call():
func_to_call = func
try:
func_to_call = import_manual_function(func)
func_to_call = import_manual_function(func)
logger.info("Found manual override for %s(...)", func.__name__)
except (ImportError, AttributeError):
Expand All @@ -66,6 +65,9 @@ def wrapper(*args, **kwargs):
ret = func_to_call(*args, **kwargs)
except (AssertionError, AzureError, CliTestError, CliExecutionError, SystemExit,
JMESPathCheckAssertionError) as e:
use_exception_cache = os.getenv("TEST_EXCEPTION_CACHE")
if use_exception_cache is None or use_exception_cache.lower() != "true":
raise
test_map[func.__name__]["end_dt"] = dt.datetime.utcnow()
test_map[func.__name__]["result"] = FAILED
test_map[func.__name__]["error_message"] = str(e).replace("\r\n", " ").replace("\n", " ")[:500]
Expand Down
42 changes: 42 additions & 0 deletions src/confluent/azext_confluent/tests/latest/example_steps.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,23 @@ def step_organization_create(test, rg, checks=None): # pylint: disable=unused-a
checks=[])


def step_organization_create(test, rg, checks=None):
if checks is None:
checks = []
test.cmd('az confluent organization create '
'--location "West US" '
'--offer-detail id="string" plan-id="string" plan-name="string" publisher-id="string" term-unit="string" '
'--user-detail email-address="[email protected]" first-name="string" last-name="string" '
'--tags Environment="Dev" '
'--name "{myOrganization}" '
'--resource-group "{rg}"',
checks=[])
test.cmd('az confluent organization wait --created '
'--name "{myOrganization}" '
'--resource-group "{rg}"',
checks=checks)


# EXAMPLE: /Organization/get/Organization_Get
@try_manual
def step_organization_show(test, rg, checks=None): # pylint: disable=unused-argument
Expand All @@ -62,6 +79,16 @@ def step_organization_list(test, rg, checks=None): # pylint: disable=unused-arg
checks=checks)


# EXAMPLE: /Organization/get/Organization_ListBySubscription
@try_manual
def step_organization_list2(test, rg, checks=None):
if checks is None:
checks = []
test.cmd('az confluent organization list '
'-g ""',
checks=checks)


# EXAMPLE: /Organization/patch/Confluent_Update
@try_manual
def step_organization_update(test, rg, checks=None): # pylint: disable=unused-argument
Expand All @@ -74,6 +101,21 @@ def step_organization_update(test, rg, checks=None): # pylint: disable=unused-a
checks=checks)


# EXAMPLE: /Validations/post/Validations_ValidateOrganizations
@try_manual
def step_validation_validate_organization(test, rg, checks=None):
if checks is None:
checks = []
test.cmd('az confluent validation validate-organization '
'--location "West US" '
'--offer-detail id="string" plan-id="string" plan-name="string" publisher-id="string" term-unit="string" '
'--user-detail email-address="[email protected]" first-name="string" last-name="string" '
'--tags Environment="Dev" '
'--organization-name "{myOrganization}" '
'--resource-group "{rg}"',
checks=checks)


# EXAMPLE: /Organization/delete/Confluent_Delete
@try_manual
def step_organization_delete(test, rg, checks=None): # pylint: disable=unused-argument
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@
from .example_steps import step_organization_create
from .example_steps import step_organization_show
from .example_steps import step_organization_list
from .example_steps import step_organization_list
from .example_steps import step_organization_list2
from .example_steps import step_organization_update
from .example_steps import step_validation_validate_organization
from .example_steps import step_organization_delete
from .. import (
try_manual,
Expand Down Expand Up @@ -69,6 +70,9 @@ def call_scenario(test, rg):
step_organization_list(test, "", checks=[
test.greater_than('length(@)', 0),
])
step_organization_list2(test, rg, checks=[
test.check('length(@)', 1),
])
step_organization_update(test, rg, checks=[
test.check("location", "eastus2euap", case_sensitive=False),
test.check("userDetail.emailAddress", "[email protected]", case_sensitive=False),
Expand All @@ -77,6 +81,7 @@ def call_scenario(test, rg):
test.check("name", "{myOrganization}", case_sensitive=False),
test.check("tags.client", "dev-client", case_sensitive=False),
])
step_validation_validate_organization(test, rg, checks=[])
step_organization_delete(test, rg, checks=[])
cleanup_scenario(test, rg)

Expand All @@ -85,13 +90,15 @@ def call_scenario(test, rg):
@try_manual
class ConfluentScenarioTest(ScenarioTest):

@ResourceGroupPreparer(name_prefix='clitestconfluent_myResourceGroup'[:7], key='rg', parameter_name='rg')
def test_confluent_Scenario(self, rg):

def __init__(self, *args, **kwargs):
super(ConfluentScenarioTest, self).__init__(*args, **kwargs)
self.kwargs.update({
'myOrganization': 'myOrganization',
})


@ResourceGroupPreparer(name_prefix='clitestconfluent_myResourceGroup'[:7], key='rg', parameter_name='rg')
def test_confluent_Scenario(self, rg):
call_scenario(self, rg)
calc_coverage(__file__)
raise_if()

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
# --------------------------------------------------------------------------

from ._confluent_management_client import ConfluentManagementClient
from ._version import VERSION

__version__ = VERSION
__all__ = ['ConfluentManagementClient']

try:
Expand Down
Loading