Skip to content

Commit

Permalink
[0.8.0] Update SDK to Mesh namespace
Browse files Browse the repository at this point in the history
* Use new namespace

* Run tests

* iteration1 comments

* new lines

* Drop commands for legacy resources

* Add license header

* Comments

* Delete sbz

* Api version

* fix history
  • Loading branch information
mostafaez authored and belmaiastar committed Jul 10, 2018
1 parent 04d8630 commit 7ba0484
Show file tree
Hide file tree
Showing 64 changed files with 272 additions and 234 deletions.
8 changes: 8 additions & 0 deletions src/mesh/HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,24 @@
Release History
===============

0.8.0 (2018-07-09)
++++++++++++++++++

* Update SDK, use api-version (2018-07-01-preview).


0.7.0 (2018-06-26)
++++++++++++++++++

* Add statusDetails and unhealthyEvaluation


0.6.0 (2018-05-14)
++++++++++++++++++

* Change servicereplica and codepackage command name for CLI convenction


0.5.0 (2018-05-02)
++++++++++++++++++

Expand Down
32 changes: 16 additions & 16 deletions src/mesh/azext_mesh/_client_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,34 +4,34 @@
# --------------------------------------------------------------------------------------------


def _cf_sbz(cli_ctx, **_):
def _cf_mesh(cli_ctx, **_):
from azure.cli.core.commands.client_factory import get_mgmt_service_client
from .sbz.mgmt.seabreeze import SeaBreezeManagementClient
return get_mgmt_service_client(cli_ctx, SeaBreezeManagementClient)
from .servicefabricmesh.mgmt.servicefabricmesh import ServiceFabricMeshManagementClient
return get_mgmt_service_client(cli_ctx, ServiceFabricMeshManagementClient)


def cf_application(cli_ctx, _):
return _cf_sbz(cli_ctx).application
def cf_mesh_application(cli_ctx, _):
return _cf_mesh(cli_ctx).application


def cf_service(cli_ctx, _):
return _cf_sbz(cli_ctx).service
def cf_mesh_service(cli_ctx, _):
return _cf_mesh(cli_ctx).service


def cf_replica(cli_ctx, _):
return _cf_sbz(cli_ctx).replica
def cf_mesh_replica(cli_ctx, _):
return _cf_mesh(cli_ctx).replica


def cf_code_package(cli_ctx, _):
return _cf_sbz(cli_ctx).code_package
def cf_mesh_code_package(cli_ctx, _):
return _cf_mesh(cli_ctx).code_package


def cf_network(cli_ctx, _):
return _cf_sbz(cli_ctx).network
def cf_mesh_network(cli_ctx, _):
return _cf_mesh(cli_ctx).network


def cf_volume(cli_ctx, _):
return _cf_sbz(cli_ctx).volume
def cf_mesh_volume(cli_ctx, _):
return _cf_mesh(cli_ctx).volume


def _resource_client_factory(cli_ctx, **_):
Expand All @@ -40,5 +40,5 @@ def _resource_client_factory(cli_ctx, **_):
return get_mgmt_service_client(cli_ctx, ResourceType.MGMT_RESOURCE_RESOURCES)


def cf_deployments(cli_ctx, _):
def cf_mesh_deployments(cli_ctx, _):
return _resource_client_factory(cli_ctx).deployments
49 changes: 25 additions & 24 deletions src/mesh/azext_mesh/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@
from azure.cli.core.commands import CliCommandType

from azure.cli.command_modules.resource._validators import process_deployment_create_namespace
from ._client_factory import (cf_application, cf_service, cf_deployments,
cf_replica, cf_code_package, cf_network,
cf_volume)
from ._client_factory import (cf_mesh_deployments,
cf_mesh_application, cf_mesh_service,
cf_mesh_replica, cf_mesh_code_package, cf_mesh_network,
cf_mesh_volume)
from ._exception_handler import resource_exception_handler


Expand Down Expand Up @@ -102,29 +103,29 @@ def load_command_table(self, _):
exception_handler=resource_exception_handler
)

service_util = CliCommandType(
operations_tmpl='azext_mesh.sbz.mgmt.seabreeze.operations.service_operations#ServiceOperations.{}',
mesh_service_util = CliCommandType(
operations_tmpl='azext_mesh.servicefabricmesh.mgmt.servicefabricmesh.operations.service_operations#ServiceOperations.{}',
exception_handler=resource_exception_handler
)

replica_util = CliCommandType(
operations_tmpl='azext_mesh.sbz.mgmt.seabreeze.operations.replica_operations#ReplicaOperations.{}',
mesh_replica_util = CliCommandType(
operations_tmpl='azext_mesh.servicefabricmesh.mgmt.servicefabricmesh.operations.replica_operations#ReplicaOperations.{}',
exception_handler=resource_exception_handler
)

cp_util = CliCommandType(
operations_tmpl='azext_mesh.sbz.mgmt.seabreeze.operations.code_package_operations#CodePackageOperations.{}',
mesh_cp_util = CliCommandType(
operations_tmpl='azext_mesh.servicefabricmesh.mgmt.servicefabricmesh.operations.code_package_operations#CodePackageOperations.{}',
exception_handler=resource_exception_handler
)

network_util = CliCommandType(
operations_tmpl='azext_mesh.sbz.mgmt.seabreeze.operations.network_operations#NetworkOperations.{}',
mesh_network_util = CliCommandType(
operations_tmpl='azext_mesh.servicefabricmesh.mgmt.servicefabricmesh.operations.network_operations#NetworkOperations.{}',
exception_handler=resource_exception_handler
)

resource_deployment_sdk = CliCommandType(
operations_tmpl='azure.mgmt.resource.resources.operations.deployments_operations#DeploymentsOperations.{}',
client_factory=cf_deployments,
client_factory=cf_mesh_deployments,
resource_type=ResourceType.MGMT_RESOURCE_RESOURCES,
exception_handler=resource_exception_handler
)
Expand All @@ -133,30 +134,30 @@ def load_command_table(self, _):
g.custom_command('create', 'deploy_arm_template', supports_no_wait=True, validator=process_deployment_create_namespace)

with self.command_group('mesh app', cmd_util) as g:
g.custom_command('list', 'list_application', client_factory=cf_application, table_transformer=transform_application_list, exception_handler=resource_exception_handler)
g.custom_command('show', 'show_application', client_factory=cf_application, table_transformer=transform_application, exception_handler=resource_exception_handler)
g.custom_command('delete', 'delete_application', client_factory=cf_application, confirmation=True)
g.custom_command('list', 'list_application', client_factory=cf_mesh_application, table_transformer=transform_application_list, exception_handler=resource_exception_handler)
g.custom_command('show', 'show_application', client_factory=cf_mesh_application, table_transformer=transform_application, exception_handler=resource_exception_handler)
g.custom_command('delete', 'delete_application', client_factory=cf_mesh_application, confirmation=True)

with self.command_group('mesh service', service_util, client_factory=cf_service) as g:
with self.command_group('mesh service', mesh_service_util, client_factory=cf_mesh_service) as g:
g.command('list', 'list_by_application_name')
g.command('show', 'get')

with self.command_group('mesh service-replica', replica_util, client_factory=cf_replica) as g:
with self.command_group('mesh service-replica', mesh_replica_util, client_factory=cf_mesh_replica) as g:
g.command('list', 'list_by_service_name')
g.command('show', 'get')

with self.command_group('mesh code-package-log', cp_util, client_factory=cf_code_package) as g:
with self.command_group('mesh code-package-log', mesh_cp_util, client_factory=cf_mesh_code_package) as g:
g.command('get', 'get_container_log', transform=transform_log_output)

with self.command_group('mesh network', network_util, client_factory=cf_network) as g:
with self.command_group('mesh network', mesh_network_util, client_factory=cf_mesh_network) as g:
g.command('show', 'get', table_transformer=transform_network)
g.command('delete', 'delete', confirmation=True)

with self.command_group('mesh network', cmd_util) as g:
g.custom_command('list', 'list_networks', client_factory=cf_network, table_transformer=transform_network_list)
g.custom_command('list', 'list_networks', client_factory=cf_mesh_network, table_transformer=transform_network_list)

with self.command_group('mesh volume', cmd_util) as g:
g.custom_command('create', 'create_volume', client_factory=cf_volume, table_transformer=transform_volume_list)
g.custom_command('list', 'list_volumes', client_factory=cf_volume, table_transformer=transform_volume_list)
g.custom_command('show', 'show_volume', client_factory=cf_volume, exception_handler=resource_exception_handler, table_transformer=transform_volume)
g.custom_command('delete', 'delete_volume', client_factory=cf_volume, confirmation=True)
g.custom_command('create', 'create_volume', client_factory=cf_mesh_volume, table_transformer=transform_volume_list)
g.custom_command('list', 'list_volumes', client_factory=cf_mesh_volume, table_transformer=transform_volume_list)
g.custom_command('show', 'show_volume', client_factory=cf_mesh_volume, exception_handler=resource_exception_handler, table_transformer=transform_volume)
g.custom_command('delete', 'delete_volume', client_factory=cf_mesh_volume, confirmation=True)
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
# 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.
# --------------------------------------------------------------------------

# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------
__import__('pkg_resources').declare_namespace(__name__)
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
# 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.
# --------------------------------------------------------------------------

# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------
__import__('pkg_resources').declare_namespace(__name__)
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
# regenerated.
# --------------------------------------------------------------------------

from .sea_breeze_management_client import SeaBreezeManagementClient
from .service_fabric_mesh_management_client import ServiceFabricMeshManagementClient
from .version import VERSION

__all__ = ['SeaBreezeManagementClient']
__all__ = ['ServiceFabricMeshManagementClient']

__version__ = VERSION

Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,13 @@
from .operation_result_paged import OperationResultPaged
from .network_resource_description_paged import NetworkResourceDescriptionPaged
from .volume_resource_description_paged import VolumeResourceDescriptionPaged
from .sea_breeze_management_client_enums import (
from .service_fabric_mesh_management_client_enums import (
IngressQoSLevel,
HealthState,
ServiceResourceStatus,
ApplicationResourceStatus,
DiagnosticsSinkKind,
OperatingSystemTypes,
DiagnosticsSinkKind,
)

__all__ = [
Expand Down Expand Up @@ -113,6 +113,6 @@
'HealthState',
'ServiceResourceStatus',
'ApplicationResourceStatus',
'DiagnosticsSinkKind',
'OperatingSystemTypes',
'DiagnosticsSinkKind',
]
Original file line number Diff line number Diff line change
Expand Up @@ -23,25 +23,29 @@ class ApplicationProperties(Model):
:param debug_params: Internal use.
:type debug_params: str
:param services: describes the services in the application.
:type services: list[~azure.seabreeze.models.ServiceResourceDescription]
:type services:
list[~azure.mgmt.servicefabricmesh.models.ServiceResourceDescription]
:ivar health_state: Describes the health state of an application resource.
Possible values include: 'Invalid', 'Ok', 'Warning', 'Error', 'Unknown'
:vartype health_state: str or ~azure.seabreeze.models.HealthState
:vartype health_state: str or
~azure.mgmt.servicefabricmesh.models.HealthState
:ivar unhealthy_evaluation: When the application's health state is not
'Ok', this additional details from service fabric Health Manager for the
user to know why the application is marked unhealthy.
:vartype unhealthy_evaluation: str
:ivar status: Status of the application resource. Possible values include:
'Invalid', 'Ready', 'Upgrading', 'Creating', 'Deleting', 'Failed'
:vartype status: str or ~azure.seabreeze.models.ApplicationResourceStatus
:vartype status: str or
~azure.mgmt.servicefabricmesh.models.ApplicationResourceStatus
:ivar status_details: Gives additional information about the current
status of the application deployment.
:vartype status_details: str
:ivar service_names: Names of the services in the application.
:vartype service_names: list[str]
:param diagnostics: Describes the diagnostics definition and usage for an
application resource.
:type diagnostics: ~azure.seabreeze.models.DiagnosticsDescription
:type diagnostics:
~azure.mgmt.servicefabricmesh.models.DiagnosticsDescription
"""

_validation = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,25 +37,29 @@ class ApplicationResourceDescription(TrackedResource):
:param debug_params: Internal use.
:type debug_params: str
:param services: describes the services in the application.
:type services: list[~azure.seabreeze.models.ServiceResourceDescription]
:type services:
list[~azure.mgmt.servicefabricmesh.models.ServiceResourceDescription]
:ivar health_state: Describes the health state of an application resource.
Possible values include: 'Invalid', 'Ok', 'Warning', 'Error', 'Unknown'
:vartype health_state: str or ~azure.seabreeze.models.HealthState
:vartype health_state: str or
~azure.mgmt.servicefabricmesh.models.HealthState
:ivar unhealthy_evaluation: When the application's health state is not
'Ok', this additional details from service fabric Health Manager for the
user to know why the application is marked unhealthy.
:vartype unhealthy_evaluation: str
:ivar status: Status of the application resource. Possible values include:
'Invalid', 'Ready', 'Upgrading', 'Creating', 'Deleting', 'Failed'
:vartype status: str or ~azure.seabreeze.models.ApplicationResourceStatus
:vartype status: str or
~azure.mgmt.servicefabricmesh.models.ApplicationResourceStatus
:ivar status_details: Gives additional information about the current
status of the application deployment.
:vartype status_details: str
:ivar service_names: Names of the services in the application.
:vartype service_names: list[str]
:param diagnostics: Describes the diagnostics definition and usage for an
application resource.
:type diagnostics: ~azure.seabreeze.models.DiagnosticsDescription
:type diagnostics:
~azure.mgmt.servicefabricmesh.models.DiagnosticsDescription
"""

_validation = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

class ApplicationResourceDescriptionPaged(Paged):
"""
A paging container for iterating over a list of :class:`ApplicationResourceDescription <azure.seabreeze.models.ApplicationResourceDescription>` object
A paging container for iterating over a list of :class:`ApplicationResourceDescription <azure.mgmt.servicefabricmesh.models.ApplicationResourceDescription>` object
"""

_attribute_map = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,10 @@ class AzureInternalMonitoringPipelineSinkDescription(DiagnosticsSinkProperties):
:param name: Name of the sink. This value is referenced by
DiagnosticsReferenceDescription
:type name: str
:param kind: The kind of DiagnosticsSink. Possible values include:
'Invalid', 'AzureInternalMonitoringPipeline'
:type kind: str or ~azure.seabreeze.models.DiagnosticsSinkKind
:param description: A description of the sink.
:type description: str
:param kind: Constant filled by server.
:type kind: str
:param account_name: Azure Internal monitoring pipeline account.
:type account_name: str
:param namespace: Azure Internal monitoring pipeline account namespace.
Expand All @@ -37,21 +36,26 @@ class AzureInternalMonitoringPipelineSinkDescription(DiagnosticsSinkProperties):
:type auto_key_config_url: str
"""

_validation = {
'kind': {'required': True},
}

_attribute_map = {
'name': {'key': 'name', 'type': 'str'},
'kind': {'key': 'kind', 'type': 'str'},
'description': {'key': 'description', 'type': 'str'},
'kind': {'key': 'kind', 'type': 'str'},
'account_name': {'key': 'accountName', 'type': 'str'},
'namespace': {'key': 'namespace', 'type': 'str'},
'ma_config_url': {'key': 'maConfigUrl', 'type': 'str'},
'fluentd_config_url': {'key': 'fluentdConfigUrl', 'type': 'object'},
'auto_key_config_url': {'key': 'autoKeyConfigUrl', 'type': 'str'},
}

def __init__(self, name=None, kind=None, description=None, account_name=None, namespace=None, ma_config_url=None, fluentd_config_url=None, auto_key_config_url=None):
super(AzureInternalMonitoringPipelineSinkDescription, self).__init__(name=name, kind=kind, description=description)
def __init__(self, name=None, description=None, account_name=None, namespace=None, ma_config_url=None, fluentd_config_url=None, auto_key_config_url=None):
super(AzureInternalMonitoringPipelineSinkDescription, self).__init__(name=name, description=description)
self.account_name = account_name
self.namespace = namespace
self.ma_config_url = ma_config_url
self.fluentd_config_url = fluentd_config_url
self.auto_key_config_url = auto_key_config_url
self.kind = 'AzureInternalMonitoringPipeline'
Loading

0 comments on commit 7ba0484

Please sign in to comment.