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"
}
2 changes: 1 addition & 1 deletion src/confluent/azext_confluent/generated/_client_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ 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, *_):
Expand Down
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
12 changes: 7 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,25 @@ 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')

with self.command_group('confluent', is_experimental=True):
pass
15 changes: 9 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 Down
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
27 changes: 27 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 Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
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_organization_delete
from .. import (
Expand Down Expand Up @@ -69,6 +69,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 @@ -85,13 +88,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
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,14 @@
from azure.core.pipeline import policies
from azure.mgmt.core.policies import ARMHttpLoggingPolicy

from ._version import VERSION

if TYPE_CHECKING:
# pylint: disable=unused-import,ungrouped-imports
from typing import Any

from azure.core.credentials import TokenCredential

VERSION = "unknown"

class ConfluentManagementClientConfiguration(Configuration):
"""Configuration for ConfluentManagementClient.
Expand Down Expand Up @@ -47,9 +48,9 @@ def __init__(

self.credential = credential
self.subscription_id = subscription_id
self.api_version = "2020-03-01-preview"
self.api_version = "2020-03-01"
self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default'])
kwargs.setdefault('sdk_moniker', 'confluentmanagementclient/{}'.format(VERSION))
kwargs.setdefault('sdk_moniker', 'mgmt-confluent/{}'.format(VERSION))
self._configure(**kwargs)

def _configure(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,21 @@
from azure.core.credentials import TokenCredential

from ._configuration import ConfluentManagementClientConfiguration
from .operations import MarketplaceAgreementOperations
from .operations import OrganizationOperationOperations
from .operations import MarketplaceAgreementsOperations
from .operations import OrganizationOperationsOperations
from .operations import OrganizationOperations
from . import models


class ConfluentManagementClient(object):
"""ConfluentManagementClient.

:ivar marketplace_agreement: MarketplaceAgreementOperations operations
:vartype marketplace_agreement: confluent_management_client.operations.MarketplaceAgreementOperations
:ivar organization_operation: OrganizationOperationOperations operations
:vartype organization_operation: confluent_management_client.operations.OrganizationOperationOperations
:ivar marketplace_agreements: MarketplaceAgreementsOperations operations
:vartype marketplace_agreements: azure.mgmt.confluent.operations.MarketplaceAgreementsOperations
:ivar organization_operations: OrganizationOperationsOperations operations
:vartype organization_operations: azure.mgmt.confluent.operations.OrganizationOperationsOperations
:ivar organization: OrganizationOperations operations
:vartype organization: confluent_management_client.operations.OrganizationOperations
:vartype organization: azure.mgmt.confluent.operations.OrganizationOperations
:param credential: Credential needed for the client to connect to Azure.
:type credential: ~azure.core.credentials.TokenCredential
:param subscription_id: Microsoft Azure subscription id.
Expand All @@ -58,9 +58,9 @@ def __init__(
self._serialize = Serializer(client_models)
self._deserialize = Deserializer(client_models)

self.marketplace_agreement = MarketplaceAgreementOperations(
self.marketplace_agreements = MarketplaceAgreementsOperations(
self._client, self._config, self._serialize, self._deserialize)
self.organization_operation = OrganizationOperationOperations(
self.organization_operations = OrganizationOperationsOperations(
self._client, self._config, self._serialize, self._deserialize)
self.organization = OrganizationOperations(
self._client, self._config, self._serialize, self._deserialize)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------

VERSION = "1.0.0b1"
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@
from azure.core.pipeline import policies
from azure.mgmt.core.policies import ARMHttpLoggingPolicy

from .._version import VERSION

if TYPE_CHECKING:
# pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials_async import AsyncTokenCredential

VERSION = "unknown"

class ConfluentManagementClientConfiguration(Configuration):
"""Configuration for ConfluentManagementClient.
Expand Down Expand Up @@ -44,9 +45,9 @@ def __init__(

self.credential = credential
self.subscription_id = subscription_id
self.api_version = "2020-03-01-preview"
self.api_version = "2020-03-01"
self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default'])
kwargs.setdefault('sdk_moniker', 'confluentmanagementclient/{}'.format(VERSION))
kwargs.setdefault('sdk_moniker', 'mgmt-confluent/{}'.format(VERSION))
self._configure(**kwargs)

def _configure(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,21 @@
from azure.core.credentials_async import AsyncTokenCredential

from ._configuration import ConfluentManagementClientConfiguration
from .operations import MarketplaceAgreementOperations
from .operations import OrganizationOperationOperations
from .operations import MarketplaceAgreementsOperations
from .operations import OrganizationOperationsOperations
from .operations import OrganizationOperations
from .. import models


class ConfluentManagementClient(object):
"""ConfluentManagementClient.

:ivar marketplace_agreement: MarketplaceAgreementOperations operations
:vartype marketplace_agreement: confluent_management_client.aio.operations.MarketplaceAgreementOperations
:ivar organization_operation: OrganizationOperationOperations operations
:vartype organization_operation: confluent_management_client.aio.operations.OrganizationOperationOperations
:ivar marketplace_agreements: MarketplaceAgreementsOperations operations
:vartype marketplace_agreements: azure.mgmt.confluent.aio.operations.MarketplaceAgreementsOperations
:ivar organization_operations: OrganizationOperationsOperations operations
:vartype organization_operations: azure.mgmt.confluent.aio.operations.OrganizationOperationsOperations
:ivar organization: OrganizationOperations operations
:vartype organization: confluent_management_client.aio.operations.OrganizationOperations
:vartype organization: azure.mgmt.confluent.aio.operations.OrganizationOperations
:param credential: Credential needed for the client to connect to Azure.
:type credential: ~azure.core.credentials_async.AsyncTokenCredential
:param subscription_id: Microsoft Azure subscription id.
Expand All @@ -55,9 +55,9 @@ def __init__(
self._serialize = Serializer(client_models)
self._deserialize = Deserializer(client_models)

self.marketplace_agreement = MarketplaceAgreementOperations(
self.marketplace_agreements = MarketplaceAgreementsOperations(
self._client, self._config, self._serialize, self._deserialize)
self.organization_operation = OrganizationOperationOperations(
self.organization_operations = OrganizationOperationsOperations(
self._client, self._config, self._serialize, self._deserialize)
self.organization = OrganizationOperations(
self._client, self._config, self._serialize, self._deserialize)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------

from ._marketplace_agreement_operations import MarketplaceAgreementOperations
from ._organization_operation_operations import OrganizationOperationOperations
from ._marketplace_agreements_operations import MarketplaceAgreementsOperations
from ._organization_operations_operations import OrganizationOperationsOperations
from ._organization_operations import OrganizationOperations

__all__ = [
'MarketplaceAgreementOperations',
'OrganizationOperationOperations',
'MarketplaceAgreementsOperations',
'OrganizationOperationsOperations',
'OrganizationOperations',
]
Loading