diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index d8476d2e0d..f22c695084 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -31,3 +31,5 @@ /src/dev-spaces-preview/ @saurabsa /src/datamigration/ @temandr + +/src/mesh/ @linggengmsft diff --git a/src/index.json b/src/index.json index a1300480e1..fa0eff7807 100644 --- a/src/index.json +++ b/src/index.json @@ -917,6 +917,40 @@ "version": "0.1.3" } } + ], + "mesh": [ + { + "filename": "mesh-0.9.0-py2.py3-none-any.whl", + "sha256Digest": "fcfdaadd48b7ac5bb7248d07c0d8f20f2057faeed58b9e70634df3afb6ec84b5", + "downloadUrl": "https://meshcli.blob.core.windows.net/cli/mesh-0.9.0-py2.py3-none-any.whl", + "metadata": { + "azext.minCliCoreVersion": "2.0.30", + "azext.isPreview": true, + "extensions": { + "python.details": { + "contacts": [ + { + "email": "azpycli@microsoft.com", + "name": "Microsoft Corporation", + "role": "author" + } + ], + "document_names": { + "description": "DESCRIPTION.rst" + }, + "project_urls": { + "Home": "https://github.com/Azure/azure-cli" + } + } + }, + "generator": "bdist_wheel (0.30.0)", + "license": "MIT", + "metadata_version": "2.0", + "name": "mesh", + "summary": "Support for Microsoft Azure Service Fabric Mesh - Public Preview", + "version": "0.9.0" + } + } ] } } diff --git a/src/mesh/HISTORY.rst b/src/mesh/HISTORY.rst new file mode 100644 index 0000000000..29ca537bc3 --- /dev/null +++ b/src/mesh/HISTORY.rst @@ -0,0 +1,58 @@ +.. :changelog: + +Release History +=============== + + +0.9.0 (2018-07-16) +++++++++++++++++++ + +* Added diagnostic output to deployment create command. + + +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) +++++++++++++++++++ + +* Public Preview - Service Fabric Mesh + + +0.4.0 (2018-03-26) +++++++++++++++++++ + +* Private Preview 2 - Application Model + + +0.3.0 (2018-01-26) +++++++++++++++++++ + +* Support Tail parameter in log. + + +0.2.0 (2018-01-19) +++++++++++++++++++ + +* Support Azure CLI 2.0.24 and up. + + +0.1.1 (2017-11-17) +++++++++++++++++++ + +* Preview release. diff --git a/src/mesh/MANIFEST.in b/src/mesh/MANIFEST.in new file mode 100644 index 0000000000..bb37a2723d --- /dev/null +++ b/src/mesh/MANIFEST.in @@ -0,0 +1 @@ +include *.rst diff --git a/src/mesh/README.rst b/src/mesh/README.rst new file mode 100644 index 0000000000..fa202dcbc9 --- /dev/null +++ b/src/mesh/README.rst @@ -0,0 +1,49 @@ +Microsoft Azure CLI 'mesh' Command Module +============================================================== + +Commands to manage Azure Service Fabric Mesh resources +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +:: + + Group + az mesh: Manage Azure Service Fabric Mesh resources. + + Commands: + app create: Create an application. + app delete: Delete an application. + app list : List applications. + app show : Show the details of an application. + codepackage logs : Tail the log of a container. + +Commands to create an application +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +:: + + Command + az mesh app create: Create an Service Fabric Mesh application. + + Arguments + --resource-group -g [Required]: Name of resource group. You can configure the default group + using `az configure --defaults group=`. + --mode + --no-wait : Do not wait for the long-running operation to finish. + --parameters + --template-file : The full file path of creation template. + --template-uri : The full file path of creation template on a http or https link. + + Global Arguments + --debug : Increase logging verbosity to show all debug logs. + --help -h : Show this help message and exit. + --output -o : Output format. Allowed values: json, jsonc, table, tsv. + Default: json. + --query : JMESPath query string. See http://jmespath.org/ for more + information and examples. + --verbose : Increase logging verbosity. Use --debug for full debug logs. + + Examples + Create an application with a template file on the remote. + az mesh app create --resource-group mygroup --template-uri + https://seabreezequickstart.blob.core.windows.net/quickstart/application-quickstart.json + + Create an application with a template file on local disk. + az mesh app create --resource-group mygroup --template-file ./appTemplate.json diff --git a/src/mesh/azext_mesh/__init__.py b/src/mesh/azext_mesh/__init__.py new file mode 100644 index 0000000000..ceb305eebd --- /dev/null +++ b/src/mesh/azext_mesh/__init__.py @@ -0,0 +1,30 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- + +from azure.cli.core import AzCommandsLoader + +from ._help import helps # pylint: disable=unused-import + + +class SbzCommandsLoader(AzCommandsLoader): + + def __init__(self, cli_ctx=None): + from azure.cli.core.commands import CliCommandType + custom = CliCommandType(operations_tmpl='azext_mesh.custom#{}') + super(SbzCommandsLoader, self).__init__(cli_ctx=cli_ctx, + min_profile='2017-03-10-profile', + custom_command_type=custom) + + def load_command_table(self, args): + from .commands import load_command_table + load_command_table(self, args) + return self.command_table + + def load_arguments(self, command): + from ._params import load_arguments + load_arguments(self, command) + + +COMMAND_LOADER_CLS = SbzCommandsLoader diff --git a/src/mesh/azext_mesh/_client_factory.py b/src/mesh/azext_mesh/_client_factory.py new file mode 100644 index 0000000000..050b68027a --- /dev/null +++ b/src/mesh/azext_mesh/_client_factory.py @@ -0,0 +1,44 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- + + +def _cf_mesh(cli_ctx, **_): + from azure.cli.core.commands.client_factory import get_mgmt_service_client + from .servicefabricmesh.mgmt.servicefabricmesh import ServiceFabricMeshManagementClient + return get_mgmt_service_client(cli_ctx, ServiceFabricMeshManagementClient) + + +def cf_mesh_application(cli_ctx, _): + return _cf_mesh(cli_ctx).application + + +def cf_mesh_service(cli_ctx, _): + return _cf_mesh(cli_ctx).service + + +def cf_mesh_replica(cli_ctx, _): + return _cf_mesh(cli_ctx).replica + + +def cf_mesh_code_package(cli_ctx, _): + return _cf_mesh(cli_ctx).code_package + + +def cf_mesh_network(cli_ctx, _): + return _cf_mesh(cli_ctx).network + + +def cf_mesh_volume(cli_ctx, _): + return _cf_mesh(cli_ctx).volume + + +def _resource_client_factory(cli_ctx, **_): + from azure.cli.core.commands.client_factory import get_mgmt_service_client + from azure.cli.core.profiles import ResourceType + return get_mgmt_service_client(cli_ctx, ResourceType.MGMT_RESOURCE_RESOURCES) + + +def cf_mesh_deployments(cli_ctx, _): + return _resource_client_factory(cli_ctx).deployments diff --git a/src/mesh/azext_mesh/_exception_handler.py b/src/mesh/azext_mesh/_exception_handler.py new file mode 100644 index 0000000000..1e03a77ea2 --- /dev/null +++ b/src/mesh/azext_mesh/_exception_handler.py @@ -0,0 +1,13 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- + + +def resource_exception_handler(exception): + from knack.util import CLIError + + if exception.response.status_code == 404: + raise CLIError('Can\'t find the resource.') + else: + raise CLIError(exception.message) diff --git a/src/mesh/azext_mesh/_help.py b/src/mesh/azext_mesh/_help.py new file mode 100644 index 0000000000..8c941f94c3 --- /dev/null +++ b/src/mesh/azext_mesh/_help.py @@ -0,0 +1,126 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- + +from knack.help_files import helps + +helps['mesh'] = """ + type: group + short-summary: (PREVIEW) Manage Azure Service Fabric Mesh Resources. +""" + +helps['mesh deployment'] = """ + type: group + short-summary: Manage Service Fabric Mesh deployments. +""" + +helps['mesh deployment create'] = """ + type: command + short-summary: Create a Service Fabric Mesh application. + examples: + - name: Create a deployment with a template file on the remote. + text: az mesh deployment create --resource-group mygroup --template-uri https://seabreezequickstart.blob.core.windows.net/templates/quickstart/sbz_rp.linux.json + - name: Create a deployment with a template file on local disk. + text: az mesh deployment create --resource-group mygroup --template-file ./appTemplate.json +""" + +helps['mesh app'] = """ + type: group + short-summary: Manage Service Fabric Mesh applications. +""" + +helps['mesh app delete'] = """ + type: command + short-summary: Delete a Service Fabric Mesh application. +""" + +helps['mesh app list'] = """ + type: command + short-summary: List Service Fabric Mesh applications. +""" + +helps['mesh app show'] = """ + type: command + short-summary: Get the details of a Service Fabric Mesh application. +""" + +helps['mesh service'] = """ + type: group + short-summary: Manage Service Fabric Mesh services. +""" + +helps['mesh service show'] = """ + type: command + short-summary: Get the details of a service. +""" + +helps['mesh service-replica'] = """ + type: group + short-summary: Manage Service Fabric Mesh service replicas. +""" + +helps['mesh service-replica list'] = """ + type: command + short-summary: List the details of service replicas. +""" + +helps['mesh code-package-log'] = """ + type: group + short-summary: Examine the logs for a codepackage. +""" + +helps['mesh code-package-log get'] = """ + type: command + short-summary: Examine the logs for a codepackage. +""" + +helps['mesh network'] = """ + type: group + short-summary: Manage networks. +""" + +helps['mesh network delete'] = """ + type: command + short-summary: Delete a network. +""" + +helps['mesh network list'] = """ + type: command + short-summary: List networks. +""" + +helps['mesh network show'] = """ + type: command + short-summary: Get the details of a network. +""" + +helps['mesh volume'] = """ + type: group + short-summary: Manage volumes. +""" + +helps['mesh volume create'] = """ + type: command + short-summary: Create a volume. + examples: + - name: Create a volume with a template file on a remote URL. + text: az mesh volume create --location westus --name myvolume --resource-group mygroup --template-uri https://mystorage.blob.core.windows.net/templates/volumeDescription.json + - name: Create a volume with a template file on local disk. + text: az mesh volume create --location westus --name myvolume --resource-group mygroup --template-file ./volumeDescription.json +""" + +helps['mesh volume delete'] = """ + type: command + short-summary: Delete a volume. +""" + +helps['mesh volume list'] = """ + type: command + short-summary: List volumes. +""" + +helps['mesh volume show'] = """ + type: command + short-summary: Get the details of a volume. +""" diff --git a/src/mesh/azext_mesh/_params.py b/src/mesh/azext_mesh/_params.py new file mode 100644 index 0000000000..12afb8705a --- /dev/null +++ b/src/mesh/azext_mesh/_params.py @@ -0,0 +1,56 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- + +from knack.util import CLIError # pylint: disable=unused-import + +from azure.cli.core.commands.parameters import get_location_type, resource_group_name_type +from azure.cli.core.commands.validators import get_default_location_from_resource_group +import azure.cli.core.commands.arm # pylint: disable=unused-import + +# pylint: disable=line-too-long, import-error + + +def load_arguments(self, _): + from argcomplete.completers import FilesCompleter + + with self.argument_context('mesh') as c: + c.argument('resource_group_name', arg_type=resource_group_name_type) + c.argument('location', arg_type=get_location_type(self.cli_ctx)) + c.argument('application_name', options_list=('--app-name', '--application-name'), help="The name of the application", id_part='application_name') + + with self.argument_context('mesh app') as c: + c.argument('name', options_list=('--name', '-n'), help="The name of the application", id_part='name') + + with self.argument_context('mesh service') as c: + c.argument('service_name', options_list=('--name', '-n'), help="The name of the service", id_part='service_name') + + with self.argument_context('mesh servicereplica') as c: + c.argument('replica_name', options_list=('--name', '-n'), help="The name of the service replica", id_part='replica_name') + + with self.argument_context('mesh codepackage') as c: + c.argument('code_package_name', options_list=('--name', '-n'), help="The name of the code package", id_part='code_package_name') + + with self.argument_context('mesh deployment create') as c: + c.argument('deployment_name', options_list=('--name', '-n'), required=False, + help='The deployment name. Default to template file base name') + c.argument('location', arg_type=get_location_type(self.cli_ctx), validator=get_default_location_from_resource_group) + c.argument('template_file', options_list=['--template-file'], help="The full file path of creation template") + c.argument('template_uri', options_list=['--template-uri'], help="The full file path of creation template on a http or https link") + c.argument('parameters', action='append', nargs='+', completer=FilesCompleter()) + + with self.argument_context('mesh network') as c: + c.argument('resource_group_name', arg_type=resource_group_name_type) + c.argument('network_name', options_list=('--name', '-n'), help="The name of the network", id_part='network_name') + c.argument('location', arg_type=get_location_type(self.cli_ctx)) + + with self.argument_context('mesh volume') as c: + c.argument('resource_group_name', arg_type=resource_group_name_type) + c.argument('name', options_list=('--name', '-n'), help="The name of the volume", id_part='name') + c.argument('location', arg_type=get_location_type(self.cli_ctx)) + + with self.argument_context('mesh volume create') as c: + c.argument('location', arg_type=get_location_type(self.cli_ctx), validator=get_default_location_from_resource_group) + c.argument('template_file', options_list=['--template-file'], help="The full file path of creation template") + c.argument('template_uri', options_list=['--template-uri'], help="The full file path of creation template on a http or https link") diff --git a/src/mesh/azext_mesh/azext_metadata.json b/src/mesh/azext_mesh/azext_metadata.json new file mode 100644 index 0000000000..dff17ca051 --- /dev/null +++ b/src/mesh/azext_mesh/azext_metadata.json @@ -0,0 +1,4 @@ +{ + "azext.minCliCoreVersion": "2.0.30", + "azext.isPreview": true +} diff --git a/src/mesh/azext_mesh/commands.py b/src/mesh/azext_mesh/commands.py new file mode 100644 index 0000000000..c444ca737a --- /dev/null +++ b/src/mesh/azext_mesh/commands.py @@ -0,0 +1,163 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- + +# pylint: disable=line-too-long + +from __future__ import print_function +from collections import OrderedDict + +from azure.cli.core.profiles import ResourceType +from azure.cli.core.commands import CliCommandType + +from azure.cli.command_modules.resource._validators import process_deployment_create_namespace +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 + + +def transform_log_output(result): + """Print log. """ + print(result) + + +def transform_application(result): + """Transform an application to table output. """ + return OrderedDict([('Name', result['name']), + ('ResourceGroup', result['resourceGroup']), + ('ProvisioningState', result['provisioningState']), + ('Location', result['location'])]) + + +def transform_application_list(result): + """Transform an application list to table output. """ + return [transform_application(application) for application in result] + + +def transform_network(result): + """Transform a network to table output. """ + ingressConfig = result.get('ingressConfig') + if ingressConfig is not None: + return OrderedDict([('Name', result['name']), + ('Description', result['description']), + ('ProvisioningState', result['provisioningState']), + ('PublicIP', ingressConfig['publicIpAddress']), + ('AddressPrefix', result['addressPrefix'])]) + return OrderedDict([('Name', result['name']), + ('Description', result['description']), + ('ProvisioningState', result['provisioningState']), + ('AddressPrefix', result['addressPrefix'])]) + + +def transform_network_list(result): + """Transform a network list to table output. """ + return [transform_network(network) for network in result] + + +def format_cpu_memory(container_group): + """Format CPU and memory. """ + containers = container_group.get('containers') + if containers is not None and containers: + total_cpu = 0 + total_memory = 0 + for container in containers: + resources = container.get('resources') + if resources is not None: + resources_requests = resources.get('requests') + if resources_requests is not None: + total_cpu += resources_requests.get('cpu', 0) + total_memory += resources_requests.get('memoryInGb', 0) + return '{0} core/{1} gb'.format(total_cpu, total_memory) + return None + + +def format_ip_address(container_group): + """Format IP address. """ + ip_address = container_group.get('ipAddress') + if ip_address is not None: + ports = ','.join(str(p['port']) for p in ip_address['ports']) + return '{0}:{1}'.format(ip_address.get('ip'), ports) + return None + + +def transform_volume(result): + """Transform a volume to table output. """ + return OrderedDict([('Name', result['name']), + ('ResourceGroup', result['resourceGroup']), + ('Location', result['location']), + ('ProvisioningState', result.get('provisioningState')), + ('Provider', result.get('provider'))]) + + +def transform_volume_list(result): + """Transform a volume list to table output. """ + return [transform_volume(volume) for volume in result] + + +def load_command_table(self, _): + cmd_util = CliCommandType( + operations_tmpl='azext_mesh.custom#{}', + exception_handler=resource_exception_handler + ) + + mesh_service_util = CliCommandType( + operations_tmpl='azext_mesh.servicefabricmesh.mgmt.servicefabricmesh.operations.service_operations#ServiceOperations.{}', + exception_handler=resource_exception_handler + ) + + mesh_replica_util = CliCommandType( + operations_tmpl='azext_mesh.servicefabricmesh.mgmt.servicefabricmesh.operations.replica_operations#ReplicaOperations.{}', + exception_handler=resource_exception_handler + ) + + mesh_cp_util = CliCommandType( + operations_tmpl='azext_mesh.servicefabricmesh.mgmt.servicefabricmesh.operations.code_package_operations#CodePackageOperations.{}', + exception_handler=resource_exception_handler + ) + + 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_mesh_deployments, + resource_type=ResourceType.MGMT_RESOURCE_RESOURCES, + exception_handler=resource_exception_handler + ) + + with self.command_group('mesh deployment', resource_deployment_sdk) as g: + 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_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', 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', 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', 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', 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_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_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) diff --git a/src/mesh/azext_mesh/custom.py b/src/mesh/azext_mesh/custom.py new file mode 100644 index 0000000000..e8be7706a2 --- /dev/null +++ b/src/mesh/azext_mesh/custom.py @@ -0,0 +1,428 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- + +# pylint: disable=too-few-public-methods,too-many-arguments,no-self-use,too-many-locals,line-too-long,unused-argument + +from __future__ import print_function +from collections import OrderedDict +import json +import ssl +import sys +import os +from time import sleep + +from six.moves.urllib.request import urlopen # pylint: disable=import-error +from knack.log import get_logger +from knack.prompting import prompt, prompt_pass, prompt_t_f, prompt_choice_list, prompt_int, NoTTYException +from knack.util import CLIError + +from azure.cli.core.util import get_file_json, shell_safe_json_parse, sdk_no_wait +from azure.cli.core.commands.client_factory import get_mgmt_service_client +from azure.cli.core.profiles import ResourceType, get_sdk + +from azext_mesh._client_factory import cf_mesh_network, cf_mesh_application, cf_mesh_deployments +from azext_mesh.servicefabricmesh.mgmt.servicefabricmesh.models import ErrorModelException + +logger = get_logger(__name__) + + +def list_application(client, resource_group_name=None): + """List all applications. """ + if resource_group_name is None: + return client.list_by_subscription() + return client.list_by_resource_group(resource_group_name) + + +def show_application(client, resource_group_name, name): + """Show details of an application. """ + return client.get(resource_group_name, name) + + +def delete_application(client, resource_group_name, name, **kwargs): + """Delete an application. """ + return client.delete(resource_group_name, name) + + +def _ssl_context(): + if sys.version_info < (3, 4): + return ssl.SSLContext(ssl.PROTOCOL_TLSv1) + + return ssl.create_default_context() + + +def _urlretrieve(url): + req = urlopen(url, context=_ssl_context()) + return req.read() + + +def _process_parameters(template_param_defs, parameter_lists): + + def _try_parse_json_object(value): + try: + parsed = shell_safe_json_parse(value) + return parsed.get('parameters', parsed) + except CLIError: + return None + + def _try_load_file_object(value): + if os.path.isfile(value): + parsed = get_file_json(value, throw_on_empty=False) + return parsed.get('parameters', parsed) + return None + + def _try_parse_key_value_object(template_param_defs, parameters, value): + try: + key, value = value.split('=', 1) + except ValueError: + return False + + param = template_param_defs.get(key, None) + if param is None: + raise CLIError("unrecognized template parameter '{}'. Allowed parameters: {}" + .format(key, ', '.join(sorted(template_param_defs.keys())))) + + param_type = param.get('type', None) + if param_type: + param_type = param_type.lower() + if param_type in ['object', 'array']: + parameters[key] = {'value': shell_safe_json_parse(value)} + elif param_type in ['string', 'securestring']: + parameters[key] = {'value': value} + elif param_type == 'bool': + parameters[key] = {'value': value.lower() == 'true'} + elif param_type == 'int': + parameters[key] = {'value': int(value)} + else: + logger.warning("Unrecognized type '%s' for parameter '%s'. Interpretting as string.", param_type, key) + parameters[key] = {'value': value} + + return True + + parameters = {} + for params in parameter_lists or []: + for item in params: + param_obj = _try_load_file_object(item) or _try_parse_json_object(item) + if param_obj: + parameters.update(param_obj) + elif not _try_parse_key_value_object(template_param_defs, parameters, item): + raise CLIError('Unable to parse parameter: {}'.format(item)) + + return parameters + + +def _find_missing_parameters(parameters, template): + if template is None: + return {} + template_parameters = template.get('parameters', None) + if template_parameters is None: + return {} + + missing = OrderedDict() + for parameter_name in template_parameters: + parameter = template_parameters[parameter_name] + if 'defaultValue' in parameter: + continue + if parameters is not None and parameters.get(parameter_name, None) is not None: + continue + missing[parameter_name] = parameter + return missing + + +def _prompt_for_parameters(missing_parameters, fail_on_no_tty=True): # pylint: disable=too-many-statements + + prompt_list = missing_parameters.keys() if isinstance(missing_parameters, OrderedDict) \ + else sorted(missing_parameters) + result = OrderedDict() + no_tty = False + for param_name in prompt_list: + param = missing_parameters[param_name] + param_type = param.get('type', 'string') + description = 'Missing description' + metadata = param.get('metadata', None) + if metadata is not None: + description = metadata.get('description', description) + allowed_values = param.get('allowedValues', None) + + prompt_str = "Please provide {} value for '{}' (? for help): ".format(param_type, param_name) + while True: + if allowed_values is not None: + try: + ix = prompt_choice_list(prompt_str, allowed_values, help_string=description) + result[param_name] = allowed_values[ix] + except NoTTYException: + result[param_name] = None + no_tty = True + break + elif param_type == 'securestring': + try: + value = prompt_pass(prompt_str, help_string=description) + except NoTTYException: + value = None + no_tty = True + result[param_name] = value + break + elif param_type == 'int': + try: + int_value = prompt_int(prompt_str, help_string=description) + result[param_name] = int_value + except NoTTYException: + result[param_name] = 0 + no_tty = True + break + elif param_type == 'bool': + try: + value = prompt_t_f(prompt_str, help_string=description) + result[param_name] = value + except NoTTYException: + result[param_name] = False + no_tty = True + break + elif param_type in ['object', 'array']: + try: + value = prompt(prompt_str, help_string=description) + except NoTTYException: + value = '' + no_tty = True + + if value == '': + value = {} if param_type == 'object' else [] + else: + try: + value = shell_safe_json_parse(value) + except Exception as ex: # pylint: disable=broad-except + logger.error(ex) + continue + result[param_name] = value + break + else: + try: + result[param_name] = prompt(prompt_str, help_string=description) + except NoTTYException: + result[param_name] = None + no_tty = True + break + if no_tty and fail_on_no_tty: + raise NoTTYException + return result + + +def _get_missing_parameters(parameters, template, prompt_fn): + missing = _find_missing_parameters(parameters, template) + if missing: + prompt_parameters = prompt_fn(missing) + for param_name in prompt_parameters: + parameters[param_name] = { + "value": prompt_parameters[param_name] + } + return parameters + + +def _parse_network_ref(network_ref_name): + # assume format of /subscriptions/subscriptionID/resourcegroups/resourcegroupname/providers/Microsoft.ServiceFabricMesh/networks/networkname + resource_parts = network_ref_name.split('/') + return resource_parts[-1] + + +def _display_successful_application(cfn, resource_group_name, resource): + application_name = resource['name'] + services = resource['properties']['services'] + network_resource_information = None + network_name = None + + if services: + + for service in services: + if service['properties']['networkRefs']: + for network_ref in service['properties']['networkRefs']: + network_name = _parse_network_ref(network_ref['name']) + if network_name: + break + + if network_name: + try: + network_resource_information = cfn.get(resource_group_name, network_name) + except ErrorModelException: + logger.warning("{application} network resource {network_name} can not be found." + .format(application=application_name, network_name=network_name)) + + if network_resource_information and network_resource_information.ingress_config: + public_ip_address = network_resource_information.ingress_config.public_ip_address + logger.warning("application {application} has been deployed successfully on network {network} with public ip address {ip}" + .format(application=application_name, network=network_name, ip=public_ip_address)) + else: + logger.warning("application {application} has been deployed successfully".format(application=application_name)) + + +def _display_application_status(mesh_network_client, resource, resource_group_name, mesh_application_client): + + application_name = resource['name'] + try: + application_operation_information = mesh_application_client.get(resource_group_name, application_name) + application_status = application_operation_information.provisioning_state + if application_status in ['Succeeded']: + _display_successful_application(mesh_network_client, resource_group_name, resource) + elif application_status in ['Failed']: + status_details = application_operation_information.status_details + if status_details: + logger.warning("application {application} deployment failed with {status_details}" + .format(application=application_name, status_details=status_details)) + else: + logger.warning("application {application} deployment failed".format(application=application_name)) + else: + logger.warning("application {application} deployment not complete with status {status}" + .format(application=application_name, status=application_status)) + except ErrorModelException: + logger.warning("There was an error when getting application resource {0}." + .format(application_name)) + + +def _display_deployment_status(cli_ctx, operation_status, resource_group_name, deployment_name, template_obj): + mesh_deployment_client = cf_mesh_deployments(cli_ctx, '') + mesh_network_client = cf_mesh_network(cli_ctx, '') + + deployment_status = mesh_deployment_client.get(resource_group_name, deployment_name) + + if operation_status in ['Failed']: + logger.warning("Deployment failed") + logger.warning("deployment correlation ID: {deployment_correlation_id}" + .format(deployment_correlation_id=deployment_status.properties.correlation_id)) + + application_count = 0 + only_application_name = None + mesh_application_client = cf_mesh_application(cli_ctx, '') + for resource in template_obj: + if resource['type'] in ['Microsoft.ServiceFabricMesh/applications']: + _display_application_status(mesh_network_client, resource, resource_group_name, mesh_application_client) + only_application_name = resource['name'] + application_count += 1 + + if application_count is 1: + logger.warning( + "To recieve additional information run the following to get the status of the application deployment.") + logger.warning("az mesh app show --resource-group {resource_group_name} --name {application_name}" + .format(resource_group_name=resource_group_name, application_name=only_application_name)) + elif application_count > 1: + logger.warning( + "To recieve additional information run the following to get the status of the application's deployments") + logger.warning("az mesh app list --resource-group {resource_group_name}" + .format(resource_group_name=resource_group_name)) + + if 'error' in deployment_status.properties.additional_properties: + logger.warning("Deployment Errors: ") + for error in deployment_status.properties.additional_properties['error']['details']: + # load error message into object to parse + error_message = json.loads(error['message']) + if 'innerError' in error_message['error']: + del error_message['error']['innerError'] + logger.warning(json.dumps(error_message['error'], indent=4, sort_keys=True)) + + if operation_status in ['Running']: + logger.warning("The output should point to the potential issue. If the above cmd response does not have any errors listed, then it could just be that your image is taking long to download, rerun the above command again after 5 minutes.") + + +def _deploy_arm_template_core(cli_ctx, resource_group_name, # pylint: disable=too-many-arguments + template_file=None, template_uri=None, deployment_name=None, + parameters=None, mode=None, validate_only=False, + no_wait=False): + DeploymentProperties, TemplateLink = get_sdk(cli_ctx, ResourceType.MGMT_RESOURCE_RESOURCES, + 'DeploymentProperties', 'TemplateLink', mod='models') + template = None + template_link = None + template_obj = None + if template_uri: + template_link = TemplateLink(uri=template_uri) + template_obj = shell_safe_json_parse(_urlretrieve(template_uri).decode('utf-8'), preserve_order=True) + else: + template = get_file_json(template_file, preserve_order=True) + template_obj = template + + template_param_defs = template_obj.get('parameters', {}) + template_obj['resources'] = template_obj.get('resources', []) + parameters = _process_parameters(template_param_defs, parameters) or {} + parameters = _get_missing_parameters(parameters, template_obj, _prompt_for_parameters) + + template = json.loads(json.dumps(template)) + parameters = json.loads(json.dumps(parameters)) + + properties = DeploymentProperties(template=template, template_link=template_link, + parameters=parameters, mode=mode) + # workaround + properties.mode = 'incremental' + smc = get_mgmt_service_client(cli_ctx, ResourceType.MGMT_RESOURCE_RESOURCES) + + if validate_only: + return sdk_no_wait(no_wait, smc.deployments.validate, resource_group_name, deployment_name, properties) + + validation = smc.deployments.validate(resource_group_name, deployment_name, properties) + + if validation.error: + logger.warning("deployment template validation failed:") + logger.warning(validation.error) + else: + operation_status_poller = sdk_no_wait(no_wait, smc.deployments.create_or_update, resource_group_name, + deployment_name, properties) + if no_wait: + return operation_status_poller + + wait_time = 0 + timestep = 5 + while operation_status_poller.status() in ['Running', 'InProgress'] and wait_time < 600: + sleep(timestep) + wait_time += timestep + + parsed_template = smc.deployments.validate(resource_group_name, deployment_name, properties).properties.additional_properties['validatedResources'] + + return _display_deployment_status(cli_ctx, operation_status_poller.status(), resource_group_name, + deployment_name, parsed_template) + + +def deploy_arm_template(cmd, resource_group_name, + template_file=None, template_uri=None, deployment_name=None, + parameters=None, mode=None, no_wait=False): + logger.warning("Deploying . . .") + return _deploy_arm_template_core(cmd.cli_ctx, resource_group_name, template_file, template_uri, + deployment_name, parameters, mode, no_wait=no_wait) + + +def list_networks(client, resource_group_name=None): + """List all networks in a resource group. """ + if resource_group_name is None: + return client.list_by_subscription() + return client.list_by_resource_group(resource_group_name) + + +def create_volume(client, resource_group_name, + name, location, + template_file=None, template_uri=None): + """Create a volume. """ + volume_properties = None + + if template_uri: + volume_properties = shell_safe_json_parse(_urlretrieve(template_uri).decode('utf-8'), preserve_order=True) + elif template_file: + volume_properties = get_file_json(template_file, preserve_order=True) + volume_properties = json.loads(json.dumps(volume_properties)) + else: + raise CLIError('One of --template-file or --template-uri has to be specified') + + volume_properties['location'] = location + return client.create(resource_group_name, name, volume_properties) + + +def list_volumes(client, resource_group_name=None): + """List all volumes in a resource group. """ + if resource_group_name is None: + return client.list_by_subscription() + return client.list_by_resource_group(resource_group_name) + + +def show_volume(client, resource_group_name, name): + """Show details of a volume. """ + return client.get(resource_group_name, name) + + +def delete_volume(client, resource_group_name, name, **kwargs): + """Delete a volume. """ + return client.delete(resource_group_name, name) diff --git a/src/mesh/azext_mesh/servicefabricmesh/__init__.py b/src/mesh/azext_mesh/servicefabricmesh/__init__.py new file mode 100644 index 0000000000..67e4d0fd53 --- /dev/null +++ b/src/mesh/azext_mesh/servicefabricmesh/__init__.py @@ -0,0 +1,5 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +__import__('pkg_resources').declare_namespace(__name__) diff --git a/src/mesh/azext_mesh/servicefabricmesh/mgmt/__init__.py b/src/mesh/azext_mesh/servicefabricmesh/mgmt/__init__.py new file mode 100644 index 0000000000..67e4d0fd53 --- /dev/null +++ b/src/mesh/azext_mesh/servicefabricmesh/mgmt/__init__.py @@ -0,0 +1,5 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +__import__('pkg_resources').declare_namespace(__name__) diff --git a/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/__init__.py b/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/__init__.py new file mode 100644 index 0000000000..5f8ad00a7d --- /dev/null +++ b/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/__init__.py @@ -0,0 +1,17 @@ +# 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. +# -------------------------------------------------------------------------- + +from .service_fabric_mesh_management_client import ServiceFabricMeshManagementClient +from .version import VERSION + +__all__ = ['ServiceFabricMeshManagementClient'] + +__version__ = VERSION diff --git a/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/models/__init__.py b/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/models/__init__.py new file mode 100644 index 0000000000..f024e2d7e4 --- /dev/null +++ b/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/models/__init__.py @@ -0,0 +1,118 @@ +# 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. +# -------------------------------------------------------------------------- + +from .resource import Resource +from .proxy_resource import ProxyResource +from .managed_proxy_resource import ManagedProxyResource +from .tracked_resource import TrackedResource +from .provisioned_resource_properties import ProvisionedResourceProperties +from .layer4_ingress_config import Layer4IngressConfig +from .ingress_config import IngressConfig +from .network_resource_description import NetworkResourceDescription +from .network_properties import NetworkProperties +from .volume_provider_parameters_azure_file import VolumeProviderParametersAzureFile +from .volume_resource_description import VolumeResourceDescription +from .volume_properties import VolumeProperties +from .service_resource_description import ServiceResourceDescription +from .diagnostics_sink_properties import DiagnosticsSinkProperties +from .diagnostics_description import DiagnosticsDescription +from .application_resource_description import ApplicationResourceDescription +from .application_properties import ApplicationProperties +from .container_state import ContainerState +from .container_event import ContainerEvent +from .container_instance_view import ContainerInstanceView +from .container_label import ContainerLabel +from .container_logs import ContainerLogs +from .image_registry_credential import ImageRegistryCredential +from .resource_limits import ResourceLimits +from .resource_requests import ResourceRequests +from .resource_requirements import ResourceRequirements +from .available_operation_display import AvailableOperationDisplay +from .operation_result import OperationResult +from .error_model import ErrorModel, ErrorModelException +from .environment_variable import EnvironmentVariable +from .setting import Setting +from .endpoint_properties import EndpointProperties +from .container_volume import ContainerVolume +from .diagnostics_ref import DiagnosticsRef +from .container_code_package_properties import ContainerCodePackageProperties +from .service_replica_description import ServiceReplicaDescription +from .network_ref import NetworkRef +from .service_replica_properties import ServiceReplicaProperties +from .azure_internal_monitoring_pipeline_sink_description import AzureInternalMonitoringPipelineSinkDescription +from .application_resource_description_paged import ApplicationResourceDescriptionPaged +from .service_resource_description_paged import ServiceResourceDescriptionPaged +from .service_replica_description_paged import ServiceReplicaDescriptionPaged +from .operation_result_paged import OperationResultPaged +from .network_resource_description_paged import NetworkResourceDescriptionPaged +from .volume_resource_description_paged import VolumeResourceDescriptionPaged +from .service_fabric_mesh_management_client_enums import ( + IngressQoSLevel, + HealthState, + ServiceResourceStatus, + ApplicationResourceStatus, + OperatingSystemTypes, + DiagnosticsSinkKind, +) + +__all__ = [ + 'Resource', + 'ProxyResource', + 'ManagedProxyResource', + 'TrackedResource', + 'ProvisionedResourceProperties', + 'Layer4IngressConfig', + 'IngressConfig', + 'NetworkResourceDescription', + 'NetworkProperties', + 'VolumeProviderParametersAzureFile', + 'VolumeResourceDescription', + 'VolumeProperties', + 'ServiceResourceDescription', + 'DiagnosticsSinkProperties', + 'DiagnosticsDescription', + 'ApplicationResourceDescription', + 'ApplicationProperties', + 'ContainerState', + 'ContainerEvent', + 'ContainerInstanceView', + 'ContainerLabel', + 'ContainerLogs', + 'ImageRegistryCredential', + 'ResourceLimits', + 'ResourceRequests', + 'ResourceRequirements', + 'AvailableOperationDisplay', + 'OperationResult', + 'ErrorModel', 'ErrorModelException', + 'EnvironmentVariable', + 'Setting', + 'EndpointProperties', + 'ContainerVolume', + 'DiagnosticsRef', + 'ContainerCodePackageProperties', + 'ServiceReplicaDescription', + 'NetworkRef', + 'ServiceReplicaProperties', + 'AzureInternalMonitoringPipelineSinkDescription', + 'ApplicationResourceDescriptionPaged', + 'ServiceResourceDescriptionPaged', + 'ServiceReplicaDescriptionPaged', + 'OperationResultPaged', + 'NetworkResourceDescriptionPaged', + 'VolumeResourceDescriptionPaged', + 'IngressQoSLevel', + 'HealthState', + 'ServiceResourceStatus', + 'ApplicationResourceStatus', + 'OperatingSystemTypes', + 'DiagnosticsSinkKind', +] diff --git a/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/models/application_properties.py b/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/models/application_properties.py new file mode 100644 index 0000000000..717004c16a --- /dev/null +++ b/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/models/application_properties.py @@ -0,0 +1,81 @@ +# 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. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class ApplicationProperties(Model): + """This type describes properties of an application resource. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :param description: User readable description of the application. + :type description: str + :param debug_params: Internal use. + :type debug_params: str + :param services: describes the services in the application. + :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.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.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.mgmt.servicefabricmesh.models.DiagnosticsDescription + """ + + _validation = { + 'health_state': {'readonly': True}, + 'unhealthy_evaluation': {'readonly': True}, + 'status': {'readonly': True}, + 'status_details': {'readonly': True}, + 'service_names': {'readonly': True}, + } + + _attribute_map = { + 'description': {'key': 'description', 'type': 'str'}, + 'debug_params': {'key': 'debugParams', 'type': 'str'}, + 'services': {'key': 'services', 'type': '[ServiceResourceDescription]'}, + 'health_state': {'key': 'healthState', 'type': 'str'}, + 'unhealthy_evaluation': {'key': 'unhealthyEvaluation', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'str'}, + 'status_details': {'key': 'statusDetails', 'type': 'str'}, + 'service_names': {'key': 'serviceNames', 'type': '[str]'}, + 'diagnostics': {'key': 'diagnostics', 'type': 'DiagnosticsDescription'}, + } + + def __init__(self, description=None, debug_params=None, services=None, diagnostics=None): + super(ApplicationProperties, self).__init__() + self.description = description + self.debug_params = debug_params + self.services = services + self.health_state = None + self.unhealthy_evaluation = None + self.status = None + self.status_details = None + self.service_names = None + self.diagnostics = diagnostics diff --git a/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/models/application_resource_description.py b/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/models/application_resource_description.py new file mode 100644 index 0000000000..1a5913b9f5 --- /dev/null +++ b/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/models/application_resource_description.py @@ -0,0 +1,106 @@ +# 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. +# -------------------------------------------------------------------------- + +from .tracked_resource import TrackedResource + + +class ApplicationResourceDescription(TrackedResource): + """This type describes an application resource. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Fully qualified identifier for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + :vartype id: str + :ivar name: The name of the resource + :vartype name: str + :ivar type: The type of the resource. Ex- + Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + :vartype type: str + :param location: The geo-location where the resource lives + :type location: str + :param tags: Resource tags. + :type tags: dict[str, str] + :ivar provisioning_state: State of the resource. + :vartype provisioning_state: str + :param description: User readable description of the application. + :type description: str + :param debug_params: Internal use. + :type debug_params: str + :param services: describes the services in the application. + :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.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.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.mgmt.servicefabricmesh.models.DiagnosticsDescription + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'health_state': {'readonly': True}, + 'unhealthy_evaluation': {'readonly': True}, + 'status': {'readonly': True}, + 'status_details': {'readonly': True}, + 'service_names': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'debug_params': {'key': 'properties.debugParams', 'type': 'str'}, + 'services': {'key': 'properties.services', 'type': '[ServiceResourceDescription]'}, + 'health_state': {'key': 'properties.healthState', 'type': 'str'}, + 'unhealthy_evaluation': {'key': 'properties.unhealthyEvaluation', 'type': 'str'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + 'status_details': {'key': 'properties.statusDetails', 'type': 'str'}, + 'service_names': {'key': 'properties.serviceNames', 'type': '[str]'}, + 'diagnostics': {'key': 'properties.diagnostics', 'type': 'DiagnosticsDescription'}, + } + + def __init__(self, location=None, tags=None, description=None, debug_params=None, services=None, diagnostics=None): + super(ApplicationResourceDescription, self).__init__(location=location, tags=tags) + self.provisioning_state = None + self.description = description + self.debug_params = debug_params + self.services = services + self.health_state = None + self.unhealthy_evaluation = None + self.status = None + self.status_details = None + self.service_names = None + self.diagnostics = diagnostics diff --git a/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/models/application_resource_description_paged.py b/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/models/application_resource_description_paged.py new file mode 100644 index 0000000000..cef270543b --- /dev/null +++ b/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/models/application_resource_description_paged.py @@ -0,0 +1,27 @@ +# 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. +# -------------------------------------------------------------------------- + +from msrest.paging import Paged + + +class ApplicationResourceDescriptionPaged(Paged): + """ + A paging container for iterating over a list of :class:`ApplicationResourceDescription ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[ApplicationResourceDescription]'} + } + + def __init__(self, *args, **kwargs): + + super(ApplicationResourceDescriptionPaged, self).__init__(*args, **kwargs) diff --git a/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/models/available_operation_display.py b/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/models/available_operation_display.py new file mode 100644 index 0000000000..b40322dbb3 --- /dev/null +++ b/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/models/available_operation_display.py @@ -0,0 +1,40 @@ +# 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. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class AvailableOperationDisplay(Model): + """An operation available at the listed Azure resource provider. + + :param provider: Name of the operation provider. + :type provider: str + :param resource: Name of the resource on which the operation is available. + :type resource: str + :param operation: Name of the available operation. + :type operation: str + :param description: Description of the available operation. + :type description: str + """ + + _attribute_map = { + 'provider': {'key': 'provider', 'type': 'str'}, + 'resource': {'key': 'resource', 'type': 'str'}, + 'operation': {'key': 'operation', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + } + + def __init__(self, provider=None, resource=None, operation=None, description=None): + super(AvailableOperationDisplay, self).__init__() + self.provider = provider + self.resource = resource + self.operation = operation + self.description = description diff --git a/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/models/azure_internal_monitoring_pipeline_sink_description.py b/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/models/azure_internal_monitoring_pipeline_sink_description.py new file mode 100644 index 0000000000..f547f0507b --- /dev/null +++ b/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/models/azure_internal_monitoring_pipeline_sink_description.py @@ -0,0 +1,61 @@ +# 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. +# -------------------------------------------------------------------------- + +from .diagnostics_sink_properties import DiagnosticsSinkProperties + + +class AzureInternalMonitoringPipelineSinkDescription(DiagnosticsSinkProperties): + """Diagnostics settings for Geneva. + + :param name: Name of the sink. This value is referenced by + DiagnosticsReferenceDescription + :type name: str + :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. + :type namespace: str + :param ma_config_url: Azure Internal monitoring agent configuration. + :type ma_config_url: str + :param fluentd_config_url: Azure Internal monitoring agent fluentd + configuration. + :type fluentd_config_url: object + :param auto_key_config_url: Azure Internal monitoring pipeline autokey + associated with the certificate. + :type auto_key_config_url: str + """ + + _validation = { + 'kind': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', '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, 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' diff --git a/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/models/container_code_package_properties.py b/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/models/container_code_package_properties.py new file mode 100644 index 0000000000..ad957c397b --- /dev/null +++ b/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/models/container_code_package_properties.py @@ -0,0 +1,97 @@ +# 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. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class ContainerCodePackageProperties(Model): + """Describes a container and its runtime properties. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :param name: The name of the code package. + :type name: str + :param image: The Container image to use. + :type image: str + :param image_registry_credential: Image registry credential. + :type image_registry_credential: + ~azure.mgmt.servicefabricmesh.models.ImageRegistryCredential + :param entrypoint: Override for the default entry point in the container. + :type entrypoint: str + :param commands: Command array to execute within the container in exec + form. + :type commands: list[str] + :param environment_variables: The environment variables to set in this + container + :type environment_variables: + list[~azure.mgmt.servicefabricmesh.models.EnvironmentVariable] + :param settings: The settings to set in this container. The setting file + path can be fetched from environment variable "Fabric_SettingPath". The + path for Windows container is "C:\\\\secrets". The path for Linux + container is "/var/secrets". + :type settings: list[~azure.mgmt.servicefabricmesh.models.Setting] + :param labels: The labels to set in this container. + :type labels: list[~azure.mgmt.servicefabricmesh.models.ContainerLabel] + :param endpoints: The endpoints exposed by this container. + :type endpoints: + list[~azure.mgmt.servicefabricmesh.models.EndpointProperties] + :param resources: This type describes the resource requirements for a + container or a service. + :type resources: ~azure.mgmt.servicefabricmesh.models.ResourceRequirements + :param volume_refs: The volumes to be attached to the container. + :type volume_refs: + list[~azure.mgmt.servicefabricmesh.models.ContainerVolume] + :ivar instance_view: Runtime information of a container instance. + :vartype instance_view: + ~azure.mgmt.servicefabricmesh.models.ContainerInstanceView + :param diagnostics: Reference to sinks in DiagnosticsDescription. + :type diagnostics: ~azure.mgmt.servicefabricmesh.models.DiagnosticsRef + """ + + _validation = { + 'name': {'required': True}, + 'image': {'required': True}, + 'resources': {'required': True}, + 'instance_view': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'image': {'key': 'image', 'type': 'str'}, + 'image_registry_credential': {'key': 'imageRegistryCredential', 'type': 'ImageRegistryCredential'}, + 'entrypoint': {'key': 'entrypoint', 'type': 'str'}, + 'commands': {'key': 'commands', 'type': '[str]'}, + 'environment_variables': {'key': 'environmentVariables', 'type': '[EnvironmentVariable]'}, + 'settings': {'key': 'settings', 'type': '[Setting]'}, + 'labels': {'key': 'labels', 'type': '[ContainerLabel]'}, + 'endpoints': {'key': 'endpoints', 'type': '[EndpointProperties]'}, + 'resources': {'key': 'resources', 'type': 'ResourceRequirements'}, + 'volume_refs': {'key': 'volumeRefs', 'type': '[ContainerVolume]'}, + 'instance_view': {'key': 'instanceView', 'type': 'ContainerInstanceView'}, + 'diagnostics': {'key': 'diagnostics', 'type': 'DiagnosticsRef'}, + } + + def __init__(self, name, image, resources, image_registry_credential=None, entrypoint=None, commands=None, environment_variables=None, settings=None, labels=None, endpoints=None, volume_refs=None, diagnostics=None): + super(ContainerCodePackageProperties, self).__init__() + self.name = name + self.image = image + self.image_registry_credential = image_registry_credential + self.entrypoint = entrypoint + self.commands = commands + self.environment_variables = environment_variables + self.settings = settings + self.labels = labels + self.endpoints = endpoints + self.resources = resources + self.volume_refs = volume_refs + self.instance_view = None + self.diagnostics = diagnostics diff --git a/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/models/container_event.py b/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/models/container_event.py new file mode 100644 index 0000000000..59d4f6ddf8 --- /dev/null +++ b/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/models/container_event.py @@ -0,0 +1,48 @@ +# 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. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class ContainerEvent(Model): + """A container event. + + :param name: The name of the container event. + :type name: str + :param count: The count of the event. + :type count: int + :param first_timestamp: Date/time of the first event. + :type first_timestamp: str + :param last_timestamp: Date/time of the last event. + :type last_timestamp: str + :param message: The event message + :type message: str + :param type: The event type. + :type type: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'count': {'key': 'count', 'type': 'int'}, + 'first_timestamp': {'key': 'firstTimestamp', 'type': 'str'}, + 'last_timestamp': {'key': 'lastTimestamp', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__(self, name=None, count=None, first_timestamp=None, last_timestamp=None, message=None, type=None): + super(ContainerEvent, self).__init__() + self.name = name + self.count = count + self.first_timestamp = first_timestamp + self.last_timestamp = last_timestamp + self.message = message + self.type = type diff --git a/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/models/container_instance_view.py b/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/models/container_instance_view.py new file mode 100644 index 0000000000..330dc725c7 --- /dev/null +++ b/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/models/container_instance_view.py @@ -0,0 +1,41 @@ +# 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. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class ContainerInstanceView(Model): + """Runtime information of a container instance. + + :param restart_count: The number of times the container has been + restarted. + :type restart_count: int + :param current_state: Current container instance state. + :type current_state: ~azure.mgmt.servicefabricmesh.models.ContainerState + :param previous_state: Previous container instance state. + :type previous_state: ~azure.mgmt.servicefabricmesh.models.ContainerState + :param events: The events of this container instance. + :type events: list[~azure.mgmt.servicefabricmesh.models.ContainerEvent] + """ + + _attribute_map = { + 'restart_count': {'key': 'restartCount', 'type': 'int'}, + 'current_state': {'key': 'currentState', 'type': 'ContainerState'}, + 'previous_state': {'key': 'previousState', 'type': 'ContainerState'}, + 'events': {'key': 'events', 'type': '[ContainerEvent]'}, + } + + def __init__(self, restart_count=None, current_state=None, previous_state=None, events=None): + super(ContainerInstanceView, self).__init__() + self.restart_count = restart_count + self.current_state = current_state + self.previous_state = previous_state + self.events = events diff --git a/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/models/container_label.py b/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/models/container_label.py new file mode 100644 index 0000000000..f781203e75 --- /dev/null +++ b/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/models/container_label.py @@ -0,0 +1,37 @@ +# 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. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class ContainerLabel(Model): + """Describes a container label. + + :param name: The name of the container label. + :type name: str + :param value: The value of the container label. + :type value: str + """ + + _validation = { + 'name': {'required': True}, + 'value': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'value': {'key': 'value', 'type': 'str'}, + } + + def __init__(self, name, value): + super(ContainerLabel, self).__init__() + self.name = name + self.value = value diff --git a/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/models/container_logs.py b/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/models/container_logs.py new file mode 100644 index 0000000000..6580e54545 --- /dev/null +++ b/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/models/container_logs.py @@ -0,0 +1,28 @@ +# 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. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class ContainerLogs(Model): + """The logs of the container. + + :param content: content of the log. + :type content: str + """ + + _attribute_map = { + 'content': {'key': 'content', 'type': 'str'}, + } + + def __init__(self, content=None): + super(ContainerLogs, self).__init__() + self.content = content diff --git a/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/models/container_state.py b/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/models/container_state.py new file mode 100644 index 0000000000..f9ff85e93a --- /dev/null +++ b/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/models/container_state.py @@ -0,0 +1,44 @@ +# 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. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class ContainerState(Model): + """The container state. + + :param state: The state of this container + :type state: str + :param start_time: Date/time when the container state started. + :type start_time: datetime + :param exit_code: The container exit code. + :type exit_code: str + :param finish_time: Date/time when the container state finished. + :type finish_time: datetime + :param detail_status: Human-readable status of this state. + :type detail_status: str + """ + + _attribute_map = { + 'state': {'key': 'state', 'type': 'str'}, + 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, + 'exit_code': {'key': 'exitCode', 'type': 'str'}, + 'finish_time': {'key': 'finishTime', 'type': 'iso-8601'}, + 'detail_status': {'key': 'detailStatus', 'type': 'str'}, + } + + def __init__(self, state=None, start_time=None, exit_code=None, finish_time=None, detail_status=None): + super(ContainerState, self).__init__() + self.state = state + self.start_time = start_time + self.exit_code = exit_code + self.finish_time = finish_time + self.detail_status = detail_status diff --git a/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/models/container_volume.py b/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/models/container_volume.py new file mode 100644 index 0000000000..e94e437f0b --- /dev/null +++ b/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/models/container_volume.py @@ -0,0 +1,43 @@ +# 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. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class ContainerVolume(Model): + """Describes how a volume is attached to a container. + + :param name: Name of the volume. + :type name: str + :param read_only: The flag indicating whether the volume is read only. + Default is 'false'. + :type read_only: bool + :param destination_path: The path within the container at which the volume + should be mounted. Only valid path characters are allowed. + :type destination_path: str + """ + + _validation = { + 'name': {'required': True}, + 'destination_path': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'read_only': {'key': 'readOnly', 'type': 'bool'}, + 'destination_path': {'key': 'destinationPath', 'type': 'str'}, + } + + def __init__(self, name, destination_path, read_only=None): + super(ContainerVolume, self).__init__() + self.name = name + self.read_only = read_only + self.destination_path = destination_path diff --git a/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/models/diagnostics_description.py b/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/models/diagnostics_description.py new file mode 100644 index 0000000000..d939868d5e --- /dev/null +++ b/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/models/diagnostics_description.py @@ -0,0 +1,38 @@ +# 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. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class DiagnosticsDescription(Model): + """Describes the diagnostics options available. + + :param sinks: List of supported sinks that can be referenced. + :type sinks: + list[~azure.mgmt.servicefabricmesh.models.DiagnosticsSinkProperties] + :param enabled: Status of whether or not sinks are enabled. + :type enabled: bool + :param default_sink_refs: The sinks to be used if diagnostics is enabled. + Sink choices can be overridden at the service and code package level. + :type default_sink_refs: str + """ + + _attribute_map = { + 'sinks': {'key': 'sinks', 'type': '[DiagnosticsSinkProperties]'}, + 'enabled': {'key': 'enabled', 'type': 'bool'}, + 'default_sink_refs': {'key': 'defaultSinkRefs', 'type': 'str'}, + } + + def __init__(self, sinks=None, enabled=None, default_sink_refs=None): + super(DiagnosticsDescription, self).__init__() + self.sinks = sinks + self.enabled = enabled + self.default_sink_refs = default_sink_refs diff --git a/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/models/diagnostics_ref.py b/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/models/diagnostics_ref.py new file mode 100644 index 0000000000..463ed35b91 --- /dev/null +++ b/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/models/diagnostics_ref.py @@ -0,0 +1,33 @@ +# 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. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class DiagnosticsRef(Model): + """Reference to sinks in DiagnosticsDescription. + + :param enabled: Status of whether or not sinks are enabled. + :type enabled: bool + :param sink_refs: List of sinks to be used if enabled. References the list + of sinks in DiagnosticsDescription. + :type sink_refs: list[str] + """ + + _attribute_map = { + 'enabled': {'key': 'enabled', 'type': 'bool'}, + 'sink_refs': {'key': 'sinkRefs', 'type': '[str]'}, + } + + def __init__(self, enabled=None, sink_refs=None): + super(DiagnosticsRef, self).__init__() + self.enabled = enabled + self.sink_refs = sink_refs diff --git a/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/models/diagnostics_sink_properties.py b/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/models/diagnostics_sink_properties.py new file mode 100644 index 0000000000..fbc4ad3845 --- /dev/null +++ b/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/models/diagnostics_sink_properties.py @@ -0,0 +1,48 @@ +# 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. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class DiagnosticsSinkProperties(Model): + """Properties of a DiagnosticsSink. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: AzureInternalMonitoringPipelineSinkDescription + + :param name: Name of the sink. This value is referenced by + DiagnosticsReferenceDescription + :type name: str + :param description: A description of the sink. + :type description: str + :param kind: Constant filled by server. + :type kind: str + """ + + _validation = { + 'kind': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'kind': {'key': 'kind', 'type': 'str'}, + } + + _subtype_map = { + 'kind': {'AzureInternalMonitoringPipeline': 'AzureInternalMonitoringPipelineSinkDescription'} + } + + def __init__(self, name=None, description=None): + super(DiagnosticsSinkProperties, self).__init__() + self.name = name + self.description = description + self.kind = None diff --git a/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/models/endpoint_properties.py b/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/models/endpoint_properties.py new file mode 100644 index 0000000000..0148c543e8 --- /dev/null +++ b/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/models/endpoint_properties.py @@ -0,0 +1,36 @@ +# 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. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class EndpointProperties(Model): + """Describes a container endpoint. + + :param name: The name of the endpoint. + :type name: str + :param port: Port used by the container. + :type port: int + """ + + _validation = { + 'name': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'port': {'key': 'port', 'type': 'int'}, + } + + def __init__(self, name, port=None): + super(EndpointProperties, self).__init__() + self.name = name + self.port = port diff --git a/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/models/environment_variable.py b/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/models/environment_variable.py new file mode 100644 index 0000000000..fe9c1134a4 --- /dev/null +++ b/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/models/environment_variable.py @@ -0,0 +1,32 @@ +# 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. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class EnvironmentVariable(Model): + """Describes an environment variable for the container. + + :param name: The name of the environment variable. + :type name: str + :param value: The value of the environment variable. + :type value: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'value': {'key': 'value', 'type': 'str'}, + } + + def __init__(self, name=None, value=None): + super(EnvironmentVariable, self).__init__() + self.name = name + self.value = value diff --git a/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/models/error_model.py b/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/models/error_model.py new file mode 100644 index 0000000000..4ffa6da655 --- /dev/null +++ b/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/models/error_model.py @@ -0,0 +1,45 @@ +# 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. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model +from msrest.exceptions import HttpOperationError + + +class ErrorModel(Model): + """The error details. + + :param code: The error code. + :type code: str + :param message: The error message. + :type message: str + """ + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__(self, code=None, message=None): + super(ErrorModel, self).__init__() + self.code = code + self.message = message + + +class ErrorModelException(HttpOperationError): + """Server responsed with exception of type: 'ErrorModel'. + + :param deserialize: A deserializer + :param response: Server response to be deserialized. + """ + + def __init__(self, deserialize, response, *args): + + super(ErrorModelException, self).__init__(deserialize, response, 'ErrorModel', *args) diff --git a/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/models/image_registry_credential.py b/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/models/image_registry_credential.py new file mode 100644 index 0000000000..2c9e4e0814 --- /dev/null +++ b/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/models/image_registry_credential.py @@ -0,0 +1,42 @@ +# 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. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class ImageRegistryCredential(Model): + """Image registry credential. + + :param server: Docker image registry server, without protocol such as + `http` and `https`. + :type server: str + :param username: The username for the private registry. + :type username: str + :param password: The password for the private registry. + :type password: str + """ + + _validation = { + 'server': {'required': True}, + 'username': {'required': True}, + } + + _attribute_map = { + 'server': {'key': 'server', 'type': 'str'}, + 'username': {'key': 'username', 'type': 'str'}, + 'password': {'key': 'password', 'type': 'str'}, + } + + def __init__(self, server, username, password=None): + super(ImageRegistryCredential, self).__init__() + self.server = server + self.username = username + self.password = password diff --git a/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/models/ingress_config.py b/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/models/ingress_config.py new file mode 100644 index 0000000000..504c7f1396 --- /dev/null +++ b/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/models/ingress_config.py @@ -0,0 +1,47 @@ +# 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. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class IngressConfig(Model): + """Describes public connectivity configuration for the network. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :param qos_level: The QoS tier for ingress. Possible values include: + 'Bronze' + :type qos_level: str or + ~azure.mgmt.servicefabricmesh.models.IngressQoSLevel + :param layer4: Configuration for layer4 public connectivity for this + network. + :type layer4: + list[~azure.mgmt.servicefabricmesh.models.Layer4IngressConfig] + :ivar public_ip_address: The public IP address for reaching this network. + :vartype public_ip_address: str + """ + + _validation = { + 'public_ip_address': {'readonly': True}, + } + + _attribute_map = { + 'qos_level': {'key': 'qosLevel', 'type': 'str'}, + 'layer4': {'key': 'layer4', 'type': '[Layer4IngressConfig]'}, + 'public_ip_address': {'key': 'publicIPAddress', 'type': 'str'}, + } + + def __init__(self, qos_level=None, layer4=None): + super(IngressConfig, self).__init__() + self.qos_level = qos_level + self.layer4 = layer4 + self.public_ip_address = None diff --git a/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/models/layer4_ingress_config.py b/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/models/layer4_ingress_config.py new file mode 100644 index 0000000000..61f1ef022a --- /dev/null +++ b/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/models/layer4_ingress_config.py @@ -0,0 +1,48 @@ +# 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. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class Layer4IngressConfig(Model): + """Describes the layer4 configuration for public connectivity for this + network. + + :param name: Layer4 ingress config name. + :type name: str + :param public_port: Specifies the public port at which the service + endpoint below needs to be exposed. + :type public_port: int + :param application_name: The application name which contains the service + to be exposed. + :type application_name: str + :param service_name: The service whose endpoint needs to be exposed at the + public port. + :type service_name: str + :param endpoint_name: The service endpoint that needs to be exposed. + :type endpoint_name: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'public_port': {'key': 'publicPort', 'type': 'int'}, + 'application_name': {'key': 'applicationName', 'type': 'str'}, + 'service_name': {'key': 'serviceName', 'type': 'str'}, + 'endpoint_name': {'key': 'endpointName', 'type': 'str'}, + } + + def __init__(self, name=None, public_port=None, application_name=None, service_name=None, endpoint_name=None): + super(Layer4IngressConfig, self).__init__() + self.name = name + self.public_port = public_port + self.application_name = application_name + self.service_name = service_name + self.endpoint_name = endpoint_name diff --git a/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/models/managed_proxy_resource.py b/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/models/managed_proxy_resource.py new file mode 100644 index 0000000000..02ae09e50e --- /dev/null +++ b/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/models/managed_proxy_resource.py @@ -0,0 +1,49 @@ +# 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. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class ManagedProxyResource(Model): + """The resource model definition for Azure Resource Manager proxy resource. It + will have everything other than required location and tags. This proxy + resource is explicitly created or updated by including it in the parent + resource. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Fully qualified identifier for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + :vartype id: str + :param name: The name of the resource + :type name: str + :ivar type: The type of the resource. Ex- + Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + :vartype type: str + """ + + _validation = { + 'id': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__(self, name=None): + super(ManagedProxyResource, self).__init__() + self.id = None + self.name = name + self.type = None diff --git a/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/models/network_properties.py b/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/models/network_properties.py new file mode 100644 index 0000000000..c64de5007f --- /dev/null +++ b/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/models/network_properties.py @@ -0,0 +1,41 @@ +# 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. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class NetworkProperties(Model): + """Describes a network. + + :param description: User readable description of the network. + :type description: str + :param address_prefix: the address prefix for this network. + :type address_prefix: str + :param ingress_config: Configuration for public connectivity for this + network. + :type ingress_config: ~azure.mgmt.servicefabricmesh.models.IngressConfig + """ + + _validation = { + 'address_prefix': {'required': True}, + } + + _attribute_map = { + 'description': {'key': 'description', 'type': 'str'}, + 'address_prefix': {'key': 'addressPrefix', 'type': 'str'}, + 'ingress_config': {'key': 'ingressConfig', 'type': 'IngressConfig'}, + } + + def __init__(self, address_prefix, description=None, ingress_config=None): + super(NetworkProperties, self).__init__() + self.description = description + self.address_prefix = address_prefix + self.ingress_config = ingress_config diff --git a/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/models/network_ref.py b/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/models/network_ref.py new file mode 100644 index 0000000000..64e19be238 --- /dev/null +++ b/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/models/network_ref.py @@ -0,0 +1,28 @@ +# 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. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class NetworkRef(Model): + """Describes a network reference in a service. + + :param name: Name of the network. + :type name: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__(self, name=None): + super(NetworkRef, self).__init__() + self.name = name diff --git a/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/models/network_resource_description.py b/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/models/network_resource_description.py new file mode 100644 index 0000000000..20b0f40641 --- /dev/null +++ b/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/models/network_resource_description.py @@ -0,0 +1,69 @@ +# 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. +# -------------------------------------------------------------------------- + +from .tracked_resource import TrackedResource + + +class NetworkResourceDescription(TrackedResource): + """This type describes a network resource. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Fully qualified identifier for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + :vartype id: str + :ivar name: The name of the resource + :vartype name: str + :ivar type: The type of the resource. Ex- + Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + :vartype type: str + :param location: The geo-location where the resource lives + :type location: str + :param tags: Resource tags. + :type tags: dict[str, str] + :ivar provisioning_state: State of the resource. + :vartype provisioning_state: str + :param description: User readable description of the network. + :type description: str + :param address_prefix: the address prefix for this network. + :type address_prefix: str + :param ingress_config: Configuration for public connectivity for this + network. + :type ingress_config: ~azure.mgmt.servicefabricmesh.models.IngressConfig + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'address_prefix': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'address_prefix': {'key': 'properties.addressPrefix', 'type': 'str'}, + 'ingress_config': {'key': 'properties.ingressConfig', 'type': 'IngressConfig'}, + } + + def __init__(self, address_prefix, location=None, tags=None, description=None, ingress_config=None): + super(NetworkResourceDescription, self).__init__(location=location, tags=tags) + self.provisioning_state = None + self.description = description + self.address_prefix = address_prefix + self.ingress_config = ingress_config diff --git a/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/models/network_resource_description_paged.py b/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/models/network_resource_description_paged.py new file mode 100644 index 0000000000..a6206dbec0 --- /dev/null +++ b/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/models/network_resource_description_paged.py @@ -0,0 +1,27 @@ +# 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. +# -------------------------------------------------------------------------- + +from msrest.paging import Paged + + +class NetworkResourceDescriptionPaged(Paged): + """ + A paging container for iterating over a list of :class:`NetworkResourceDescription ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[NetworkResourceDescription]'} + } + + def __init__(self, *args, **kwargs): + + super(NetworkResourceDescriptionPaged, self).__init__(*args, **kwargs) diff --git a/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/models/operation_result.py b/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/models/operation_result.py new file mode 100644 index 0000000000..e3094ad449 --- /dev/null +++ b/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/models/operation_result.py @@ -0,0 +1,41 @@ +# 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. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class OperationResult(Model): + """List of operations available at the listed Azure resource provider. + + :param name: The name of the operation. + :type name: str + :param display: The object that represents the operation. + :type display: + ~azure.mgmt.servicefabricmesh.models.AvailableOperationDisplay + :param origin: Origin result + :type origin: str + :param next_link: The URL to use for getting the next set of results. + :type next_link: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display': {'key': 'display', 'type': 'AvailableOperationDisplay'}, + 'origin': {'key': 'origin', 'type': 'str'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__(self, name=None, display=None, origin=None, next_link=None): + super(OperationResult, self).__init__() + self.name = name + self.display = display + self.origin = origin + self.next_link = next_link diff --git a/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/models/operation_result_paged.py b/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/models/operation_result_paged.py new file mode 100644 index 0000000000..b95761b52f --- /dev/null +++ b/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/models/operation_result_paged.py @@ -0,0 +1,27 @@ +# 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. +# -------------------------------------------------------------------------- + +from msrest.paging import Paged + + +class OperationResultPaged(Paged): + """ + A paging container for iterating over a list of :class:`OperationResult ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[OperationResult]'} + } + + def __init__(self, *args, **kwargs): + + super(OperationResultPaged, self).__init__(*args, **kwargs) diff --git a/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/models/provisioned_resource_properties.py b/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/models/provisioned_resource_properties.py new file mode 100644 index 0000000000..27f7efc1b8 --- /dev/null +++ b/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/models/provisioned_resource_properties.py @@ -0,0 +1,35 @@ +# 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. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class ProvisionedResourceProperties(Model): + """Describes common properties of a provisioned resource. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar provisioning_state: State of the resource. + :vartype provisioning_state: str + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + } + + def __init__(self): + super(ProvisionedResourceProperties, self).__init__() + self.provisioning_state = None diff --git a/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/models/proxy_resource.py b/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/models/proxy_resource.py new file mode 100644 index 0000000000..e6f6a6c5b4 --- /dev/null +++ b/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/models/proxy_resource.py @@ -0,0 +1,41 @@ +# 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. +# -------------------------------------------------------------------------- + +from .resource import Resource + + +class ProxyResource(Resource): + """The resource model definition for Azure Resource Manager proxy resource. It + will have everything other than required location and tags. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Fully qualified identifier for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + :vartype id: str + :ivar name: The name of the resource + :vartype name: str + :ivar type: The type of the resource. Ex- + Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + :vartype type: str + :param location: The geo-location where the resource lives + :type location: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + def __init__(self, location=None): + super(ProxyResource, self).__init__(location=location) diff --git a/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/models/resource.py b/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/models/resource.py new file mode 100644 index 0000000000..10e024eae1 --- /dev/null +++ b/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/models/resource.py @@ -0,0 +1,51 @@ +# 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. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class Resource(Model): + """The resource model definition for Azure Resource Manager resource. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Fully qualified identifier for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + :vartype id: str + :ivar name: The name of the resource + :vartype name: str + :ivar type: The type of the resource. Ex- + Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + :vartype type: str + :param location: The geo-location where the resource lives + :type location: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + } + + def __init__(self, location=None): + super(Resource, self).__init__() + self.id = None + self.name = None + self.type = None + self.location = location diff --git a/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/models/resource_limits.py b/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/models/resource_limits.py new file mode 100644 index 0000000000..309d4c99af --- /dev/null +++ b/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/models/resource_limits.py @@ -0,0 +1,35 @@ +# 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. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class ResourceLimits(Model): + """This type describes the resource limits for a given container. It describes + the most amount of resources a container is allowed to use before being + restarted. + + :param memory_in_gb: The memory limit in GB. + :type memory_in_gb: float + :param cpu: CPU limits in cores. At present, only full cores are + supported. + :type cpu: float + """ + + _attribute_map = { + 'memory_in_gb': {'key': 'memoryInGB', 'type': 'float'}, + 'cpu': {'key': 'cpu', 'type': 'float'}, + } + + def __init__(self, memory_in_gb=None, cpu=None): + super(ResourceLimits, self).__init__() + self.memory_in_gb = memory_in_gb + self.cpu = cpu diff --git a/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/models/resource_requests.py b/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/models/resource_requests.py new file mode 100644 index 0000000000..59cc46f5d4 --- /dev/null +++ b/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/models/resource_requests.py @@ -0,0 +1,43 @@ +# 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. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class ResourceRequests(Model): + """This type describes the requested resources for a given container. It + describes the least amount of resources required for the container. A + container can consume more than requested resources up to the specified + limits before being restarted. Currently, the requested resources are + treated as limits. + . + + :param memory_in_gb: The memory request in GB for this container. + :type memory_in_gb: float + :param cpu: Requested number of CPU cores. At present, only full cores are + supported. + :type cpu: float + """ + + _validation = { + 'memory_in_gb': {'required': True}, + 'cpu': {'required': True}, + } + + _attribute_map = { + 'memory_in_gb': {'key': 'memoryInGB', 'type': 'float'}, + 'cpu': {'key': 'cpu', 'type': 'float'}, + } + + def __init__(self, memory_in_gb, cpu): + super(ResourceRequests, self).__init__() + self.memory_in_gb = memory_in_gb + self.cpu = cpu diff --git a/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/models/resource_requirements.py b/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/models/resource_requirements.py new file mode 100644 index 0000000000..46c05ea344 --- /dev/null +++ b/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/models/resource_requirements.py @@ -0,0 +1,37 @@ +# 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. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class ResourceRequirements(Model): + """This type describes the resource requirements for a container or a service. + + :param requests: Describes the requested resources for a given container. + :type requests: ~azure.mgmt.servicefabricmesh.models.ResourceRequests + :param limits: Describes the maximum limits on the resources for a given + container. + :type limits: ~azure.mgmt.servicefabricmesh.models.ResourceLimits + """ + + _validation = { + 'requests': {'required': True}, + } + + _attribute_map = { + 'requests': {'key': 'requests', 'type': 'ResourceRequests'}, + 'limits': {'key': 'limits', 'type': 'ResourceLimits'}, + } + + def __init__(self, requests, limits=None): + super(ResourceRequirements, self).__init__() + self.requests = requests + self.limits = limits diff --git a/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/models/service_fabric_mesh_management_client_enums.py b/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/models/service_fabric_mesh_management_client_enums.py new file mode 100644 index 0000000000..84fd28ce66 --- /dev/null +++ b/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/models/service_fabric_mesh_management_client_enums.py @@ -0,0 +1,58 @@ +# 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. +# -------------------------------------------------------------------------- + +from enum import Enum + + +class IngressQoSLevel(Enum): + + bronze = "Bronze" + + +class HealthState(Enum): + + invalid = "Invalid" + ok = "Ok" + warning = "Warning" + error = "Error" + unknown = "Unknown" + + +class ServiceResourceStatus(Enum): + + unknown = "Unknown" + active = "Active" + upgrading = "Upgrading" + deleting = "Deleting" + creating = "Creating" + failed = "Failed" + + +class ApplicationResourceStatus(Enum): + + invalid = "Invalid" + ready = "Ready" + upgrading = "Upgrading" + creating = "Creating" + deleting = "Deleting" + failed = "Failed" + + +class OperatingSystemTypes(Enum): + + linux = "Linux" + windows = "Windows" + + +class DiagnosticsSinkKind(Enum): + + invalid = "Invalid" + azure_internal_monitoring_pipeline = "AzureInternalMonitoringPipeline" diff --git a/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/models/service_replica_description.py b/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/models/service_replica_description.py new file mode 100644 index 0000000000..ffecefbf28 --- /dev/null +++ b/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/models/service_replica_description.py @@ -0,0 +1,52 @@ +# 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. +# -------------------------------------------------------------------------- + +from .service_replica_properties import ServiceReplicaProperties + + +class ServiceReplicaDescription(ServiceReplicaProperties): + """This type describes a replica of a service resource. + + :param os_type: The Operating system type required by the code in service. + . Possible values include: 'Linux', 'Windows' + :type os_type: str or + ~azure.mgmt.servicefabricmesh.models.OperatingSystemTypes + :param code_packages: Describes the set of code packages that forms the + service. A code package describes the container and the properties for + running it. All the code packages are started together on the same host + and share the same context (network, process etc.). + :type code_packages: + list[~azure.mgmt.servicefabricmesh.models.ContainerCodePackageProperties] + :param network_refs: The names of the private networks that this service + needs to be part of. + :type network_refs: list[~azure.mgmt.servicefabricmesh.models.NetworkRef] + :param diagnostics: Reference to sinks in DiagnosticsDescription. + :type diagnostics: ~azure.mgmt.servicefabricmesh.models.DiagnosticsRef + :param replica_name: Name of the replica. + :type replica_name: str + """ + + _validation = { + 'os_type': {'required': True}, + 'code_packages': {'required': True}, + } + + _attribute_map = { + 'os_type': {'key': 'osType', 'type': 'str'}, + 'code_packages': {'key': 'codePackages', 'type': '[ContainerCodePackageProperties]'}, + 'network_refs': {'key': 'networkRefs', 'type': '[NetworkRef]'}, + 'diagnostics': {'key': 'diagnostics', 'type': 'DiagnosticsRef'}, + 'replica_name': {'key': 'replicaName', 'type': 'str'}, + } + + def __init__(self, os_type, code_packages, network_refs=None, diagnostics=None, replica_name=None): + super(ServiceReplicaDescription, self).__init__(os_type=os_type, code_packages=code_packages, network_refs=network_refs, diagnostics=diagnostics) + self.replica_name = replica_name diff --git a/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/models/service_replica_description_paged.py b/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/models/service_replica_description_paged.py new file mode 100644 index 0000000000..21e8c05cea --- /dev/null +++ b/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/models/service_replica_description_paged.py @@ -0,0 +1,27 @@ +# 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. +# -------------------------------------------------------------------------- + +from msrest.paging import Paged + + +class ServiceReplicaDescriptionPaged(Paged): + """ + A paging container for iterating over a list of :class:`ServiceReplicaDescription ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[ServiceReplicaDescription]'} + } + + def __init__(self, *args, **kwargs): + + super(ServiceReplicaDescriptionPaged, self).__init__(*args, **kwargs) diff --git a/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/models/service_replica_properties.py b/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/models/service_replica_properties.py new file mode 100644 index 0000000000..8ed63729e5 --- /dev/null +++ b/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/models/service_replica_properties.py @@ -0,0 +1,52 @@ +# 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. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class ServiceReplicaProperties(Model): + """Describes the properties of a service replica. + + :param os_type: The Operating system type required by the code in service. + . Possible values include: 'Linux', 'Windows' + :type os_type: str or + ~azure.mgmt.servicefabricmesh.models.OperatingSystemTypes + :param code_packages: Describes the set of code packages that forms the + service. A code package describes the container and the properties for + running it. All the code packages are started together on the same host + and share the same context (network, process etc.). + :type code_packages: + list[~azure.mgmt.servicefabricmesh.models.ContainerCodePackageProperties] + :param network_refs: The names of the private networks that this service + needs to be part of. + :type network_refs: list[~azure.mgmt.servicefabricmesh.models.NetworkRef] + :param diagnostics: Reference to sinks in DiagnosticsDescription. + :type diagnostics: ~azure.mgmt.servicefabricmesh.models.DiagnosticsRef + """ + + _validation = { + 'os_type': {'required': True}, + 'code_packages': {'required': True}, + } + + _attribute_map = { + 'os_type': {'key': 'osType', 'type': 'str'}, + 'code_packages': {'key': 'codePackages', 'type': '[ContainerCodePackageProperties]'}, + 'network_refs': {'key': 'networkRefs', 'type': '[NetworkRef]'}, + 'diagnostics': {'key': 'diagnostics', 'type': 'DiagnosticsRef'}, + } + + def __init__(self, os_type, code_packages, network_refs=None, diagnostics=None): + super(ServiceReplicaProperties, self).__init__() + self.os_type = os_type + self.code_packages = code_packages + self.network_refs = network_refs + self.diagnostics = diagnostics diff --git a/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/models/service_resource_description.py b/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/models/service_resource_description.py new file mode 100644 index 0000000000..73eb00e043 --- /dev/null +++ b/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/models/service_resource_description.py @@ -0,0 +1,92 @@ +# 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. +# -------------------------------------------------------------------------- + +from .managed_proxy_resource import ManagedProxyResource + + +class ServiceResourceDescription(ManagedProxyResource): + """This type describes a service resource. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Fully qualified identifier for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + :vartype id: str + :param name: The name of the resource + :type name: str + :ivar type: The type of the resource. Ex- + Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + :vartype type: str + :param os_type: The Operating system type required by the code in service. + . Possible values include: 'Linux', 'Windows' + :type os_type: str or + ~azure.mgmt.servicefabricmesh.models.OperatingSystemTypes + :param code_packages: Describes the set of code packages that forms the + service. A code package describes the container and the properties for + running it. All the code packages are started together on the same host + and share the same context (network, process etc.). + :type code_packages: + list[~azure.mgmt.servicefabricmesh.models.ContainerCodePackageProperties] + :param network_refs: The names of the private networks that this service + needs to be part of. + :type network_refs: list[~azure.mgmt.servicefabricmesh.models.NetworkRef] + :param diagnostics: Reference to sinks in DiagnosticsDescription. + :type diagnostics: ~azure.mgmt.servicefabricmesh.models.DiagnosticsRef + :param description: User readable description of the service. + :type description: str + :param replica_count: The number of replicas of the service to create. + Defaults to 1 if not specified. + :type replica_count: int + :param health_state: The health state of a resource such as Application, + Service, or Network. Possible values include: 'Invalid', 'Ok', 'Warning', + 'Error', 'Unknown' + :type health_state: str or + ~azure.mgmt.servicefabricmesh.models.HealthState + :ivar status: Represents the status of the service. Possible values + include: 'Unknown', 'Active', 'Upgrading', 'Deleting', 'Creating', + 'Failed' + :vartype status: str or + ~azure.mgmt.servicefabricmesh.models.ServiceResourceStatus + """ + + _validation = { + 'id': {'readonly': True}, + 'type': {'readonly': True}, + 'os_type': {'required': True}, + 'code_packages': {'required': True}, + 'status': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'os_type': {'key': 'properties.osType', 'type': 'str'}, + 'code_packages': {'key': 'properties.codePackages', 'type': '[ContainerCodePackageProperties]'}, + 'network_refs': {'key': 'properties.networkRefs', 'type': '[NetworkRef]'}, + 'diagnostics': {'key': 'properties.diagnostics', 'type': 'DiagnosticsRef'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'replica_count': {'key': 'properties.replicaCount', 'type': 'int'}, + 'health_state': {'key': 'properties.healthState', 'type': 'str'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + } + + def __init__(self, os_type, code_packages, name=None, network_refs=None, diagnostics=None, description=None, replica_count=None, health_state=None): + super(ServiceResourceDescription, self).__init__(name=name) + self.os_type = os_type + self.code_packages = code_packages + self.network_refs = network_refs + self.diagnostics = diagnostics + self.description = description + self.replica_count = replica_count + self.health_state = health_state + self.status = None diff --git a/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/models/service_resource_description_paged.py b/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/models/service_resource_description_paged.py new file mode 100644 index 0000000000..c0faa1ff35 --- /dev/null +++ b/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/models/service_resource_description_paged.py @@ -0,0 +1,27 @@ +# 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. +# -------------------------------------------------------------------------- + +from msrest.paging import Paged + + +class ServiceResourceDescriptionPaged(Paged): + """ + A paging container for iterating over a list of :class:`ServiceResourceDescription ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[ServiceResourceDescription]'} + } + + def __init__(self, *args, **kwargs): + + super(ServiceResourceDescriptionPaged, self).__init__(*args, **kwargs) diff --git a/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/models/setting.py b/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/models/setting.py new file mode 100644 index 0000000000..8ed85b648e --- /dev/null +++ b/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/models/setting.py @@ -0,0 +1,32 @@ +# 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. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class Setting(Model): + """Describes a setting for the container. + + :param name: The name of the setting. + :type name: str + :param value: The value of the setting. + :type value: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'value': {'key': 'value', 'type': 'str'}, + } + + def __init__(self, name=None, value=None): + super(Setting, self).__init__() + self.name = name + self.value = value diff --git a/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/models/tracked_resource.py b/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/models/tracked_resource.py new file mode 100644 index 0000000000..bce753a393 --- /dev/null +++ b/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/models/tracked_resource.py @@ -0,0 +1,52 @@ +# 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. +# -------------------------------------------------------------------------- + +from .resource import Resource + + +class TrackedResource(Resource): + """The resource model definition for Azure Resource Manager tracked top-level + resource. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Fully qualified identifier for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + :vartype id: str + :ivar name: The name of the resource + :vartype name: str + :ivar type: The type of the resource. Ex- + Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + :vartype type: str + :param location: The geo-location where the resource lives + :type location: str + :param tags: Resource tags. + :type tags: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__(self, location=None, tags=None): + super(TrackedResource, self).__init__(location=location) + self.tags = tags diff --git a/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/models/volume_properties.py b/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/models/volume_properties.py new file mode 100644 index 0000000000..377eb252e6 --- /dev/null +++ b/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/models/volume_properties.py @@ -0,0 +1,46 @@ +# 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. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class VolumeProperties(Model): + """This type describes properties of a volume resource. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :param description: User readable description of the volume. + :type description: str + :ivar provider: Provider of the volume. Default value: "SFAzureFile" . + :vartype provider: str + :param azure_file_parameters: This type describes a volume provided by an + Azure Files file share. + :type azure_file_parameters: + ~azure.mgmt.servicefabricmesh.models.VolumeProviderParametersAzureFile + """ + + _validation = { + 'provider': {'required': True, 'constant': True}, + } + + _attribute_map = { + 'description': {'key': 'description', 'type': 'str'}, + 'provider': {'key': 'provider', 'type': 'str'}, + 'azure_file_parameters': {'key': 'azureFileParameters', 'type': 'VolumeProviderParametersAzureFile'}, + } + + provider = "SFAzureFile" + + def __init__(self, description=None, azure_file_parameters=None): + super(VolumeProperties, self).__init__() + self.description = description + self.azure_file_parameters = azure_file_parameters diff --git a/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/models/volume_provider_parameters_azure_file.py b/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/models/volume_provider_parameters_azure_file.py new file mode 100644 index 0000000000..e631b1cd6f --- /dev/null +++ b/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/models/volume_provider_parameters_azure_file.py @@ -0,0 +1,43 @@ +# 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. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class VolumeProviderParametersAzureFile(Model): + """This type describes a volume provided by an Azure Files file share. + + :param account_name: Name of the Azure storage account for the File Share. + :type account_name: str + :param account_key: Access key of the Azure storage account for the File + Share. + :type account_key: str + :param share_name: Name of the Azure Files file share that provides + storage for the volume. + :type share_name: str + """ + + _validation = { + 'account_name': {'required': True}, + 'share_name': {'required': True}, + } + + _attribute_map = { + 'account_name': {'key': 'accountName', 'type': 'str'}, + 'account_key': {'key': 'accountKey', 'type': 'str'}, + 'share_name': {'key': 'shareName', 'type': 'str'}, + } + + def __init__(self, account_name, share_name, account_key=None): + super(VolumeProviderParametersAzureFile, self).__init__() + self.account_name = account_name + self.account_key = account_key + self.share_name = share_name diff --git a/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/models/volume_resource_description.py b/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/models/volume_resource_description.py new file mode 100644 index 0000000000..65b59acd50 --- /dev/null +++ b/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/models/volume_resource_description.py @@ -0,0 +1,71 @@ +# 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. +# -------------------------------------------------------------------------- + +from .tracked_resource import TrackedResource + + +class VolumeResourceDescription(TrackedResource): + """This type describes a volume resource. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Fully qualified identifier for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + :vartype id: str + :ivar name: The name of the resource + :vartype name: str + :ivar type: The type of the resource. Ex- + Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + :vartype type: str + :param location: The geo-location where the resource lives + :type location: str + :param tags: Resource tags. + :type tags: dict[str, str] + :ivar provisioning_state: State of the resource. + :vartype provisioning_state: str + :param description: User readable description of the volume. + :type description: str + :ivar provider: Provider of the volume. Default value: "SFAzureFile" . + :vartype provider: str + :param azure_file_parameters: This type describes a volume provided by an + Azure Files file share. + :type azure_file_parameters: + ~azure.mgmt.servicefabricmesh.models.VolumeProviderParametersAzureFile + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'provider': {'required': True, 'constant': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'provider': {'key': 'properties.provider', 'type': 'str'}, + 'azure_file_parameters': {'key': 'properties.azureFileParameters', 'type': 'VolumeProviderParametersAzureFile'}, + } + + provider = "SFAzureFile" + + def __init__(self, location=None, tags=None, description=None, azure_file_parameters=None): + super(VolumeResourceDescription, self).__init__(location=location, tags=tags) + self.provisioning_state = None + self.description = description + self.azure_file_parameters = azure_file_parameters diff --git a/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/models/volume_resource_description_paged.py b/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/models/volume_resource_description_paged.py new file mode 100644 index 0000000000..606c2f28f7 --- /dev/null +++ b/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/models/volume_resource_description_paged.py @@ -0,0 +1,27 @@ +# 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. +# -------------------------------------------------------------------------- + +from msrest.paging import Paged + + +class VolumeResourceDescriptionPaged(Paged): + """ + A paging container for iterating over a list of :class:`VolumeResourceDescription ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[VolumeResourceDescription]'} + } + + def __init__(self, *args, **kwargs): + + super(VolumeResourceDescriptionPaged, self).__init__(*args, **kwargs) diff --git a/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/operations/__init__.py b/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/operations/__init__.py new file mode 100644 index 0000000000..96ea0a9e40 --- /dev/null +++ b/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/operations/__init__.py @@ -0,0 +1,28 @@ +# 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. +# -------------------------------------------------------------------------- + +from .application_operations import ApplicationOperations +from .service_operations import ServiceOperations +from .replica_operations import ReplicaOperations +from .code_package_operations import CodePackageOperations +from .operations import Operations +from .network_operations import NetworkOperations +from .volume_operations import VolumeOperations + +__all__ = [ + 'ApplicationOperations', + 'ServiceOperations', + 'ReplicaOperations', + 'CodePackageOperations', + 'Operations', + 'NetworkOperations', + 'VolumeOperations', +] diff --git a/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/operations/application_operations.py b/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/operations/application_operations.py new file mode 100644 index 0000000000..13e94b0ca1 --- /dev/null +++ b/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/operations/application_operations.py @@ -0,0 +1,378 @@ +# 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. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse + +from .. import models + + +class ApplicationOperations(object): + """ApplicationOperations operations. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: The version of the API. This parameter is required and its value must be `2018-07-01-preview`. Constant value: "2018-07-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2018-07-01-preview" + + self.config = config + + def create( + self, resource_group_name, application_name, application_resource_description, custom_headers=None, raw=False, **operation_config): + """Creates or updates an application resource. + + Creates an application resource with the specified name and + description. If an application with the same name already exists, then + its description is updated to the one indicated in this request. + Use network resources to provide public connectivity to the services of + an application. + . + + :param resource_group_name: Azure resource group name + :type resource_group_name: str + :param application_name: The identity of the application. + :type application_name: str + :param application_resource_description: Description for creating an + application resource. + :type application_resource_description: + ~azure.mgmt.servicefabricmesh.models.ApplicationResourceDescription + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: ApplicationResourceDescription or ClientRawResponse if + raw=true + :rtype: + ~azure.mgmt.servicefabricmesh.models.ApplicationResourceDescription or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorModelException` + """ + # Construct URL + url = self.create.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'applicationName': self._serialize.url("application_name", application_name, 'str', skip_quote=True) + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(application_resource_description, 'ApplicationResourceDescription') + + # Construct and send request + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) + + if response.status_code not in [200, 201]: + raise models.ErrorModelException(self._deserialize, response) + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('ApplicationResourceDescription', response) + if response.status_code == 201: + deserialized = self._deserialize('ApplicationResourceDescription', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabricMesh/applications/{applicationName}'} + + def get( + self, resource_group_name, application_name, custom_headers=None, raw=False, **operation_config): + """Gets the application resource. + + Gets the information about the application resource with a given name. + The information includes the information about the application's + services and other runtime properties. + + :param resource_group_name: Azure resource group name + :type resource_group_name: str + :param application_name: The identity of the application. + :type application_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: ApplicationResourceDescription or ClientRawResponse if + raw=true + :rtype: + ~azure.mgmt.servicefabricmesh.models.ApplicationResourceDescription or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorModelException` + """ + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'applicationName': self._serialize.url("application_name", application_name, 'str', skip_quote=True) + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorModelException(self._deserialize, response) + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('ApplicationResourceDescription', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabricMesh/applications/{applicationName}'} + + def delete( + self, resource_group_name, application_name, custom_headers=None, raw=False, **operation_config): + """Deletes the application resource. + + Deletes the application resource identified by the name. + + :param resource_group_name: Azure resource group name + :type resource_group_name: str + :param application_name: The identity of the application. + :type application_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorModelException` + """ + # Construct URL + url = self.delete.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'applicationName': self._serialize.url("application_name", application_name, 'str', skip_quote=True) + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200, 204]: + raise models.ErrorModelException(self._deserialize, response) + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabricMesh/applications/{applicationName}'} + + def list_by_resource_group( + self, resource_group_name, custom_headers=None, raw=False, **operation_config): + """Gets all the application resources in a given resource group. + + Gets the information about all application resources in a given + resource group. The information includes the information about the + application's services and other runtime properties. + + :param resource_group_name: Azure resource group name + :type resource_group_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of ApplicationResourceDescription + :rtype: + ~azure.mgmt.servicefabricmesh.models.ApplicationResourceDescriptionPaged[~azure.mgmt.servicefabricmesh.models.ApplicationResourceDescription] + :raises: + :class:`ErrorModelException` + """ + def internal_paging(next_link=None, raw=False): + + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters) + response = self._client.send( + request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorModelException(self._deserialize, response) + + return response + + # Deserialize response + deserialized = models.ApplicationResourceDescriptionPaged(internal_paging, self._deserialize.dependencies) + + if raw: + header_dict = {} + client_raw_response = models.ApplicationResourceDescriptionPaged(internal_paging, self._deserialize.dependencies, header_dict) + return client_raw_response + + return deserialized + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabricMesh/applications'} + + def list_by_subscription( + self, custom_headers=None, raw=False, **operation_config): + """Gets all the application resources in a given subscription. + + Gets the information about all application resources in a given + subscription. The information includes the information about the + application's services and other runtime properties. + + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of ApplicationResourceDescription + :rtype: + ~azure.mgmt.servicefabricmesh.models.ApplicationResourceDescriptionPaged[~azure.mgmt.servicefabricmesh.models.ApplicationResourceDescription] + :raises: + :class:`ErrorModelException` + """ + def internal_paging(next_link=None, raw=False): + + if not next_link: + # Construct URL + url = self.list_by_subscription.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters) + response = self._client.send( + request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorModelException(self._deserialize, response) + + return response + + # Deserialize response + deserialized = models.ApplicationResourceDescriptionPaged(internal_paging, self._deserialize.dependencies) + + if raw: + header_dict = {} + client_raw_response = models.ApplicationResourceDescriptionPaged(internal_paging, self._deserialize.dependencies, header_dict) + return client_raw_response + + return deserialized + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabricMesh/applications'} diff --git a/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/operations/code_package_operations.py b/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/operations/code_package_operations.py new file mode 100644 index 0000000000..c5f5648a5b --- /dev/null +++ b/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/operations/code_package_operations.py @@ -0,0 +1,115 @@ +# 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. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse + +from .. import models + + +class CodePackageOperations(object): + """CodePackageOperations operations. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: The version of the API. This parameter is required and its value must be `2018-07-01-preview`. Constant value: "2018-07-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2018-07-01-preview" + + self.config = config + + def get_container_log( + self, resource_group_name, application_name, service_name, replica_name, code_package_name, tail=None, custom_headers=None, raw=False, **operation_config): + """Gets the logs for the container. + + Get the logs for the container of a given code package of an + application. + + :param resource_group_name: Azure resource group name + :type resource_group_name: str + :param application_name: The identity of the application. + :type application_name: str + :param service_name: The identity of the service. + :type service_name: str + :param replica_name: The identity of the service replica. + :type replica_name: str + :param code_package_name: The name of the code package. + :type code_package_name: str + :param tail: Number of lines to show from the end of the logs. Default + is 100. + :type tail: int + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: ContainerLogs or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.servicefabricmesh.models.ContainerLogs or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorModelException` + """ + # Construct URL + url = self.get_container_log.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'applicationName': self._serialize.url("application_name", application_name, 'str', skip_quote=True), + 'serviceName': self._serialize.url("service_name", service_name, 'str', skip_quote=True), + 'replicaName': self._serialize.url("replica_name", replica_name, 'str', skip_quote=True), + 'codePackageName': self._serialize.url("code_package_name", code_package_name, 'str', skip_quote=True) + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + if tail is not None: + query_parameters['tail'] = self._serialize.query("tail", tail, 'int') + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorModelException(self._deserialize, response) + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('ContainerLogs', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_container_log.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabricMesh/applications/{applicationName}/services/{serviceName}/replicas/{replicaName}/codePackages/{codePackageName}/logs'} diff --git a/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/operations/network_operations.py b/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/operations/network_operations.py new file mode 100644 index 0000000000..50258fda95 --- /dev/null +++ b/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/operations/network_operations.py @@ -0,0 +1,378 @@ +# 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. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse + +from .. import models + + +class NetworkOperations(object): + """NetworkOperations operations. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: The version of the API. This parameter is required and its value must be `2018-07-01-preview`. Constant value: "2018-07-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2018-07-01-preview" + + self.config = config + + def create( + self, resource_group_name, network_name, network_resource_description, custom_headers=None, raw=False, **operation_config): + """Creates or updates a network resource. + + Creates a network resource with the specified name and description. If + a network with the same name already exists, then its description is + updated to the one indicated in this request. + Use network resources to create private network and configure public + connectivity for services within your application. + . + + :param resource_group_name: Azure resource group name + :type resource_group_name: str + :param network_name: The identity of the network. + :type network_name: str + :param network_resource_description: Description for creating a + network resource. + :type network_resource_description: + ~azure.mgmt.servicefabricmesh.models.NetworkResourceDescription + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: NetworkResourceDescription or ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.servicefabricmesh.models.NetworkResourceDescription or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorModelException` + """ + # Construct URL + url = self.create.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'networkName': self._serialize.url("network_name", network_name, 'str', skip_quote=True) + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(network_resource_description, 'NetworkResourceDescription') + + # Construct and send request + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) + + if response.status_code not in [200, 201]: + raise models.ErrorModelException(self._deserialize, response) + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('NetworkResourceDescription', response) + if response.status_code == 201: + deserialized = self._deserialize('NetworkResourceDescription', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabricMesh/networks/{networkName}'} + + def get( + self, resource_group_name, network_name, custom_headers=None, raw=False, **operation_config): + """Gets the network resource. + + Gets the information about the network resource with a given name. This + information includes the network description and other runtime + information. + . + + :param resource_group_name: Azure resource group name + :type resource_group_name: str + :param network_name: The identity of the network. + :type network_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: NetworkResourceDescription or ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.servicefabricmesh.models.NetworkResourceDescription or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorModelException` + """ + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'networkName': self._serialize.url("network_name", network_name, 'str', skip_quote=True) + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorModelException(self._deserialize, response) + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('NetworkResourceDescription', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabricMesh/networks/{networkName}'} + + def delete( + self, resource_group_name, network_name, custom_headers=None, raw=False, **operation_config): + """Deletes the network resource. + + Deletes the network resource identified by the name. + + :param resource_group_name: Azure resource group name + :type resource_group_name: str + :param network_name: The identity of the network. + :type network_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorModelException` + """ + # Construct URL + url = self.delete.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'networkName': self._serialize.url("network_name", network_name, 'str', skip_quote=True) + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200, 204]: + raise models.ErrorModelException(self._deserialize, response) + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabricMesh/networks/{networkName}'} + + def list_by_resource_group( + self, resource_group_name, custom_headers=None, raw=False, **operation_config): + """Gets all the network resources in a given resource group. + + Gets the information about all network resources in a given resource + group. The information includes the network description and other + runtime properties. + . + + :param resource_group_name: Azure resource group name + :type resource_group_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of NetworkResourceDescription + :rtype: + ~azure.mgmt.servicefabricmesh.models.NetworkResourceDescriptionPaged[~azure.mgmt.servicefabricmesh.models.NetworkResourceDescription] + :raises: + :class:`ErrorModelException` + """ + def internal_paging(next_link=None, raw=False): + + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters) + response = self._client.send( + request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorModelException(self._deserialize, response) + + return response + + # Deserialize response + deserialized = models.NetworkResourceDescriptionPaged(internal_paging, self._deserialize.dependencies) + + if raw: + header_dict = {} + client_raw_response = models.NetworkResourceDescriptionPaged(internal_paging, self._deserialize.dependencies, header_dict) + return client_raw_response + + return deserialized + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabricMesh/networks'} + + def list_by_subscription( + self, custom_headers=None, raw=False, **operation_config): + """Gets all the network resources in a given subscription. + + Gets the information about all network resources in a given + subscription. The information includes the network description and + other runtime properties. + + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of NetworkResourceDescription + :rtype: + ~azure.mgmt.servicefabricmesh.models.NetworkResourceDescriptionPaged[~azure.mgmt.servicefabricmesh.models.NetworkResourceDescription] + :raises: + :class:`ErrorModelException` + """ + def internal_paging(next_link=None, raw=False): + + if not next_link: + # Construct URL + url = self.list_by_subscription.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters) + response = self._client.send( + request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorModelException(self._deserialize, response) + + return response + + # Deserialize response + deserialized = models.NetworkResourceDescriptionPaged(internal_paging, self._deserialize.dependencies) + + if raw: + header_dict = {} + client_raw_response = models.NetworkResourceDescriptionPaged(internal_paging, self._deserialize.dependencies, header_dict) + return client_raw_response + + return deserialized + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabricMesh/networks'} diff --git a/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/operations/operations.py b/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/operations/operations.py new file mode 100644 index 0000000000..1782310127 --- /dev/null +++ b/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/operations/operations.py @@ -0,0 +1,100 @@ +# 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. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse + +from .. import models + + +class Operations(object): + """Operations operations. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: The version of the API. This parameter is required and its value must be `2018-07-01-preview`. Constant value: "2018-07-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2018-07-01-preview" + + self.config = config + + def list( + self, custom_headers=None, raw=False, **operation_config): + """Lists all of the available operations. + + Lists all the available operations provided by Service Fabric SeaBreeze + resource provider. + + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of OperationResult + :rtype: + ~azure.mgmt.servicefabricmesh.models.OperationResultPaged[~azure.mgmt.servicefabricmesh.models.OperationResult] + :raises: + :class:`ErrorModelException` + """ + def internal_paging(next_link=None, raw=False): + + if not next_link: + # Construct URL + url = self.list.metadata['url'] + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters) + response = self._client.send( + request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorModelException(self._deserialize, response) + + return response + + # Deserialize response + deserialized = models.OperationResultPaged(internal_paging, self._deserialize.dependencies) + + if raw: + header_dict = {} + client_raw_response = models.OperationResultPaged(internal_paging, self._deserialize.dependencies, header_dict) + return client_raw_response + + return deserialized + list.metadata = {'url': '/providers/Microsoft.ServiceFabricMesh/operations'} diff --git a/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/operations/replica_operations.py b/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/operations/replica_operations.py new file mode 100644 index 0000000000..664077f256 --- /dev/null +++ b/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/operations/replica_operations.py @@ -0,0 +1,188 @@ +# 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. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse +from msrestazure.azure_exceptions import CloudError + +from .. import models + + +class ReplicaOperations(object): + """ReplicaOperations operations. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: The version of the API. This parameter is required and its value must be `2018-07-01-preview`. Constant value: "2018-07-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2018-07-01-preview" + + self.config = config + + def list_by_service_name( + self, resource_group_name, application_name, service_name, custom_headers=None, raw=False, **operation_config): + """Gets replicas of a given service. + + Gets the information about all replicas of a given service of an + application. The information includes the runtime properties of the + replica instance. + + :param resource_group_name: Azure resource group name + :type resource_group_name: str + :param application_name: The identity of the application. + :type application_name: str + :param service_name: The identity of the service. + :type service_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of ServiceReplicaDescription + :rtype: + ~azure.mgmt.servicefabricmesh.models.ServiceReplicaDescriptionPaged[~azure.mgmt.servicefabricmesh.models.ServiceReplicaDescription] + :raises: :class:`CloudError` + """ + def internal_paging(next_link=None, raw=False): + + if not next_link: + # Construct URL + url = self.list_by_service_name.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'applicationName': self._serialize.url("application_name", application_name, 'str', skip_quote=True), + 'serviceName': self._serialize.url("service_name", service_name, 'str', skip_quote=True) + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters) + response = self._client.send( + request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + deserialized = models.ServiceReplicaDescriptionPaged(internal_paging, self._deserialize.dependencies) + + if raw: + header_dict = {} + client_raw_response = models.ServiceReplicaDescriptionPaged(internal_paging, self._deserialize.dependencies, header_dict) + return client_raw_response + + return deserialized + list_by_service_name.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabricMesh/applications/{applicationName}/services/{serviceName}/replicas'} + + def get( + self, resource_group_name, application_name, service_name, replica_name, custom_headers=None, raw=False, **operation_config): + """Gets a specific replica of a given service. + + Gets the information about the specified replica of a given service of + an application. The information includes the runtime properties of the + replica instance. + + :param resource_group_name: Azure resource group name + :type resource_group_name: str + :param application_name: The identity of the application. + :type application_name: str + :param service_name: The identity of the service. + :type service_name: str + :param replica_name: The identity of the service replica. + :type replica_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: ServiceReplicaDescription or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.servicefabricmesh.models.ServiceReplicaDescription + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'applicationName': self._serialize.url("application_name", application_name, 'str', skip_quote=True), + 'serviceName': self._serialize.url("service_name", service_name, 'str', skip_quote=True), + 'replicaName': self._serialize.url("replica_name", replica_name, 'str', skip_quote=True) + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('ServiceReplicaDescription', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabricMesh/applications/{applicationName}/services/{serviceName}/replicas/{replicaName}'} diff --git a/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/operations/service_operations.py b/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/operations/service_operations.py new file mode 100644 index 0000000000..14f3c650d7 --- /dev/null +++ b/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/operations/service_operations.py @@ -0,0 +1,181 @@ +# 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. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse +from msrestazure.azure_exceptions import CloudError + +from .. import models + + +class ServiceOperations(object): + """ServiceOperations operations. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: The version of the API. This parameter is required and its value must be `2018-07-01-preview`. Constant value: "2018-07-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2018-07-01-preview" + + self.config = config + + def list_by_application_name( + self, resource_group_name, application_name, custom_headers=None, raw=False, **operation_config): + """Gets services of a given application. + + Gets the information about all services of a given service of an + application. The information includes the runtime properties of the + service instance. + + :param resource_group_name: Azure resource group name + :type resource_group_name: str + :param application_name: The identity of the application. + :type application_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of ServiceResourceDescription + :rtype: + ~azure.mgmt.servicefabricmesh.models.ServiceResourceDescriptionPaged[~azure.mgmt.servicefabricmesh.models.ServiceResourceDescription] + :raises: :class:`CloudError` + """ + def internal_paging(next_link=None, raw=False): + + if not next_link: + # Construct URL + url = self.list_by_application_name.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'applicationName': self._serialize.url("application_name", application_name, 'str', skip_quote=True) + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters) + response = self._client.send( + request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + deserialized = models.ServiceResourceDescriptionPaged(internal_paging, self._deserialize.dependencies) + + if raw: + header_dict = {} + client_raw_response = models.ServiceResourceDescriptionPaged(internal_paging, self._deserialize.dependencies, header_dict) + return client_raw_response + + return deserialized + list_by_application_name.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabricMesh/applications/{applicationName}/services'} + + def get( + self, resource_group_name, application_name, service_name, custom_headers=None, raw=False, **operation_config): + """Gets the properties of the service. + + The operation returns the properties of the service. + + :param resource_group_name: Azure resource group name + :type resource_group_name: str + :param application_name: The identity of the application. + :type application_name: str + :param service_name: The identity of the service. + :type service_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: ServiceResourceDescription or ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.servicefabricmesh.models.ServiceResourceDescription or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'applicationName': self._serialize.url("application_name", application_name, 'str', skip_quote=True), + 'serviceName': self._serialize.url("service_name", service_name, 'str', skip_quote=True) + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('ServiceResourceDescription', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabricMesh/applications/{applicationName}/services/{serviceName}'} diff --git a/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/operations/volume_operations.py b/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/operations/volume_operations.py new file mode 100644 index 0000000000..ac3c7bad21 --- /dev/null +++ b/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/operations/volume_operations.py @@ -0,0 +1,375 @@ +# 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. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse + +from .. import models + + +class VolumeOperations(object): + """VolumeOperations operations. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: The version of the API. This parameter is required and its value must be `2018-07-01-preview`. Constant value: "2018-07-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2018-07-01-preview" + + self.config = config + + def create( + self, resource_group_name, volume_name, volume_resource_description, custom_headers=None, raw=False, **operation_config): + """Creates or updates a volume resource. + + Creates a volume resource with the specified name and description. If a + volume with the same name already exists, then its description is + updated to the one indicated in this request. + . + + :param resource_group_name: Azure resource group name + :type resource_group_name: str + :param volume_name: The identity of the volume. + :type volume_name: str + :param volume_resource_description: Description for creating a volume + resource. + :type volume_resource_description: + ~azure.mgmt.servicefabricmesh.models.VolumeResourceDescription + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: VolumeResourceDescription or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.servicefabricmesh.models.VolumeResourceDescription + or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorModelException` + """ + # Construct URL + url = self.create.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'volumeName': self._serialize.url("volume_name", volume_name, 'str', skip_quote=True) + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(volume_resource_description, 'VolumeResourceDescription') + + # Construct and send request + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) + + if response.status_code not in [200, 201]: + raise models.ErrorModelException(self._deserialize, response) + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('VolumeResourceDescription', response) + if response.status_code == 201: + deserialized = self._deserialize('VolumeResourceDescription', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabricMesh/volumes/{volumeName}'} + + def get( + self, resource_group_name, volume_name, custom_headers=None, raw=False, **operation_config): + """Gets the volume resource. + + Gets the information about the volume resource with a given name. This + information includes the volume description and other runtime + information. + . + + :param resource_group_name: Azure resource group name + :type resource_group_name: str + :param volume_name: The identity of the volume. + :type volume_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: VolumeResourceDescription or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.servicefabricmesh.models.VolumeResourceDescription + or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorModelException` + """ + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'volumeName': self._serialize.url("volume_name", volume_name, 'str', skip_quote=True) + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorModelException(self._deserialize, response) + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('VolumeResourceDescription', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabricMesh/volumes/{volumeName}'} + + def delete( + self, resource_group_name, volume_name, custom_headers=None, raw=False, **operation_config): + """Deletes the volume resource. + + Deletes the volume identified by the name. + + :param resource_group_name: Azure resource group name + :type resource_group_name: str + :param volume_name: The identity of the volume. + :type volume_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorModelException` + """ + # Construct URL + url = self.delete.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'volumeName': self._serialize.url("volume_name", volume_name, 'str', skip_quote=True) + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.delete(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200, 204]: + raise models.ErrorModelException(self._deserialize, response) + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabricMesh/volumes/{volumeName}'} + + def list_by_resource_group( + self, resource_group_name, custom_headers=None, raw=False, **operation_config): + """Gets all the volume resources in a given resource group. + + Gets the information about all volume resources in a given resource + group. The information includes the volume description and other + runtime information. + . + + :param resource_group_name: Azure resource group name + :type resource_group_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of VolumeResourceDescription + :rtype: + ~azure.mgmt.servicefabricmesh.models.VolumeResourceDescriptionPaged[~azure.mgmt.servicefabricmesh.models.VolumeResourceDescription] + :raises: + :class:`ErrorModelException` + """ + def internal_paging(next_link=None, raw=False): + + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters) + response = self._client.send( + request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorModelException(self._deserialize, response) + + return response + + # Deserialize response + deserialized = models.VolumeResourceDescriptionPaged(internal_paging, self._deserialize.dependencies) + + if raw: + header_dict = {} + client_raw_response = models.VolumeResourceDescriptionPaged(internal_paging, self._deserialize.dependencies, header_dict) + return client_raw_response + + return deserialized + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabricMesh/volumes'} + + def list_by_subscription( + self, custom_headers=None, raw=False, **operation_config): + """Gets all the volume resources in a given subscription. + + Gets the information about all volume resources in a given + subscription. The information includes the volume description and other + runtime information. + . + + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of VolumeResourceDescription + :rtype: + ~azure.mgmt.servicefabricmesh.models.VolumeResourceDescriptionPaged[~azure.mgmt.servicefabricmesh.models.VolumeResourceDescription] + :raises: + :class:`ErrorModelException` + """ + def internal_paging(next_link=None, raw=False): + + if not next_link: + # Construct URL + url = self.list_by_subscription.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters) + response = self._client.send( + request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorModelException(self._deserialize, response) + + return response + + # Deserialize response + deserialized = models.VolumeResourceDescriptionPaged(internal_paging, self._deserialize.dependencies) + + if raw: + header_dict = {} + client_raw_response = models.VolumeResourceDescriptionPaged(internal_paging, self._deserialize.dependencies, header_dict) + return client_raw_response + + return deserialized + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabricMesh/volumes'} diff --git a/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/service_fabric_mesh_management_client.py b/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/service_fabric_mesh_management_client.py new file mode 100644 index 0000000000..11b0f51e26 --- /dev/null +++ b/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/service_fabric_mesh_management_client.py @@ -0,0 +1,111 @@ +# 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. +# -------------------------------------------------------------------------- + +from msrest.service_client import ServiceClient +from msrest import Serializer, Deserializer +from msrestazure import AzureConfiguration +from .version import VERSION +from .operations.application_operations import ApplicationOperations +from .operations.service_operations import ServiceOperations +from .operations.replica_operations import ReplicaOperations +from .operations.code_package_operations import CodePackageOperations +from .operations.operations import Operations +from .operations.network_operations import NetworkOperations +from .operations.volume_operations import VolumeOperations +from . import models + + +class ServiceFabricMeshManagementClientConfiguration(AzureConfiguration): + """Configuration for ServiceFabricMeshManagementClient + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credentials: Credentials needed for the client to connect to Azure. + :type credentials: :mod:`A msrestazure Credentials + object` + :param subscription_id: The customer subscription identifier + :type subscription_id: str + :param str base_url: Service URL + """ + + def __init__( + self, credentials, subscription_id, base_url=None): + + if credentials is None: + raise ValueError("Parameter 'credentials' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + if not base_url: + base_url = 'https://management.azure.com' + + super(ServiceFabricMeshManagementClientConfiguration, self).__init__(base_url) + + self.add_user_agent('azure-mgmt-servicefabricmesh/{}'.format(VERSION)) + self.add_user_agent('Azure-SDK-For-Python') + + self.credentials = credentials + self.subscription_id = subscription_id + + +class ServiceFabricMeshManagementClient(object): + """Service Fabric Mesh Management Client + + :ivar config: Configuration for client. + :vartype config: ServiceFabricMeshManagementClientConfiguration + + :ivar application: Application operations + :vartype application: azure.mgmt.servicefabricmesh.operations.ApplicationOperations + :ivar service: Service operations + :vartype service: azure.mgmt.servicefabricmesh.operations.ServiceOperations + :ivar replica: Replica operations + :vartype replica: azure.mgmt.servicefabricmesh.operations.ReplicaOperations + :ivar code_package: CodePackage operations + :vartype code_package: azure.mgmt.servicefabricmesh.operations.CodePackageOperations + :ivar operations: Operations operations + :vartype operations: azure.mgmt.servicefabricmesh.operations.Operations + :ivar network: Network operations + :vartype network: azure.mgmt.servicefabricmesh.operations.NetworkOperations + :ivar volume: Volume operations + :vartype volume: azure.mgmt.servicefabricmesh.operations.VolumeOperations + + :param credentials: Credentials needed for the client to connect to Azure. + :type credentials: :mod:`A msrestazure Credentials + object` + :param subscription_id: The customer subscription identifier + :type subscription_id: str + :param str base_url: Service URL + """ + + def __init__( + self, credentials, subscription_id, base_url=None): + + self.config = ServiceFabricMeshManagementClientConfiguration(credentials, subscription_id, base_url) + self._client = ServiceClient(self.config.credentials, self.config) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self.api_version = '2018-07-01-preview' + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + + self.application = ApplicationOperations( + self._client, self.config, self._serialize, self._deserialize) + self.service = ServiceOperations( + self._client, self.config, self._serialize, self._deserialize) + self.replica = ReplicaOperations( + self._client, self.config, self._serialize, self._deserialize) + self.code_package = CodePackageOperations( + self._client, self.config, self._serialize, self._deserialize) + self.operations = Operations( + self._client, self.config, self._serialize, self._deserialize) + self.network = NetworkOperations( + self._client, self.config, self._serialize, self._deserialize) + self.volume = VolumeOperations( + self._client, self.config, self._serialize, self._deserialize) diff --git a/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/version.py b/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/version.py new file mode 100644 index 0000000000..0442112a91 --- /dev/null +++ b/src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/version.py @@ -0,0 +1,12 @@ +# 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 = "2018-07-01-preview" diff --git a/src/mesh/setup.cfg b/src/mesh/setup.cfg new file mode 100644 index 0000000000..3c6e79cf31 --- /dev/null +++ b/src/mesh/setup.cfg @@ -0,0 +1,2 @@ +[bdist_wheel] +universal=1 diff --git a/src/mesh/setup.py b/src/mesh/setup.py new file mode 100644 index 0000000000..1d8870099f --- /dev/null +++ b/src/mesh/setup.py @@ -0,0 +1,48 @@ +#!/usr/bin/env python + +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- + +from codecs import open +from setuptools import setup, find_packages + +VERSION = "0.9.0" + +CLASSIFIERS = [ + 'Development Status :: 4 - Beta', + 'Intended Audience :: Developers', + 'Intended Audience :: System Administrators', + 'Programming Language :: Python', + 'Programming Language :: Python :: 2', + 'Programming Language :: Python :: 2.7', + 'Programming Language :: Python :: 3', + 'Programming Language :: Python :: 3.4', + 'Programming Language :: Python :: 3.5', + 'Programming Language :: Python :: 3.6', + 'License :: OSI Approved :: MIT License', +] + +DEPENDENCIES = [ +] + +with open('README.rst', 'r', encoding='utf-8') as f: + README = f.read() +with open('HISTORY.rst', 'r', encoding='utf-8') as f: + HISTORY = f.read() + +setup( + name='mesh', + version=VERSION, + description='Support for Microsoft Azure Service Fabric Mesh - Public Preview', + long_description=README + '\n\n' + HISTORY, + license='MIT', + author='Microsoft Corporation', + author_email='azpycli@microsoft.com', + url='https://github.com/Azure/azure-cli-extensions', + classifiers=CLASSIFIERS, + package_data={'azext_mesh': ['azext_metadata.json']}, + packages=find_packages(), + install_requires=DEPENDENCIES +)