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

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
195 changes: 151 additions & 44 deletions azure-cli.pyproj

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions src/azure/cli/commands/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
'metavar': 'DEPLOYMENTNAME',
'help': 'Name of the resource deployment',
'default': 'azurecli' + str(time.time()) + str(random.randint(0, 10000000)),
'required': False
},
'location': {
'name': '--location -l',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ interactions:
body: {string: ''}
headers:
Cache-Control: [no-cache]
Date: ['Fri, 06 May 2016 16:02:34 GMT']
Date: ['Tue, 26 Apr 2016 15:35:44 GMT']
Expires: ['-1']
Pragma: [no-cache]
Strict-Transport-Security: [max-age=31536000; includeSubDomains]
Expand Down Expand Up @@ -45,7 +45,7 @@ interactions:
Cache-Control: [no-cache]
Content-Encoding: [gzip]
Content-Type: [application/json]
Date: ['Fri, 06 May 2016 16:02:35 GMT']
Date: ['Tue, 26 Apr 2016 15:35:44 GMT']
Expires: ['-1']
Pragma: [no-cache]
Server: [Microsoft-Azure-Storage-Resource-Provider/1.0, Microsoft-HTTPAPI/2.0]
Expand Down Expand Up @@ -76,7 +76,7 @@ interactions:
Cache-Control: [no-cache]
Content-Encoding: [gzip]
Content-Type: [application/json]
Date: ['Fri, 06 May 2016 16:14:04 GMT']
Date: ['Tue, 26 Apr 2016 15:36:12 GMT']
Expires: ['-1']
Pragma: [no-cache]
Server: [Microsoft-Azure-Storage-Resource-Provider/1.0, Microsoft-HTTPAPI/2.0]
Expand Down Expand Up @@ -107,7 +107,7 @@ interactions:
Cache-Control: [no-cache]
Content-Encoding: [gzip]
Content-Type: [application/json]
Date: ['Fri, 06 May 2016 16:14:06 GMT']
Date: ['Tue, 26 Apr 2016 15:36:12 GMT']
Expires: ['-1']
Pragma: [no-cache]
Server: [Microsoft-Azure-Storage-Resource-Provider/1.0, Microsoft-HTTPAPI/2.0]
Expand All @@ -132,7 +132,7 @@ interactions:
headers:
Cache-Control: [no-cache]
Content-Length: ['0']
Date: ['Fri, 06 May 2016 16:14:06 GMT']
Date: ['Tue, 26 Apr 2016 15:36:16 GMT']
Expires: ['-1']
Pragma: [no-cache]
Server: [Microsoft-Azure-Storage-Resource-Provider/1.0, Microsoft-HTTPAPI/2.0]
Expand Down Expand Up @@ -162,7 +162,7 @@ interactions:
Cache-Control: [no-cache]
Content-Encoding: [gzip]
Content-Type: [application/json]
Date: ['Fri, 06 May 2016 16:14:08 GMT']
Date: ['Tue, 26 Apr 2016 15:36:16 GMT']
Expires: ['-1']
Pragma: [no-cache]
Server: [Microsoft-Azure-Storage-Resource-Provider/1.0, Microsoft-HTTPAPI/2.0]
Expand All @@ -186,10 +186,10 @@ interactions:
body: {string: ''}
headers:
Cache-Control: [no-cache]
Date: ['Fri, 06 May 2016 16:14:08 GMT']
Date: ['Tue, 26 Apr 2016 15:36:17 GMT']
Expires: ['-1']
Pragma: [no-cache]
Strict-Transport-Security: [max-age=31536000; includeSubDomains]
x-ms-ratelimit-remaining-subscription-writes: ['1199']
x-ms-ratelimit-remaining-subscription-writes: ['1198']
status: {code: 204, message: No Content}
version: 1
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,17 @@
from azure.cli.commands._auto_command import build_operation, CommandDefinition
from azure.cli.commands._command_creation import get_mgmt_service_client
from azure.cli.commands import CommandTable, LongRunningOperation, patch_aliases
from azure.cli.command_modules.vm.mgmt.lib import (VMCreationClient as VMClient,
VMCreationClientConfiguration
as VMClientConfig)
from azure.cli.command_modules.vm.mgmt.lib.operations import VMOperations
from azure.cli._locale import L
from azure.cli.command_modules.vm.mgmt_avail_set.lib import (AvailSetCreationClient
as AvailSetClient,
AvailSetCreationClientConfiguration
as AvailSetClientConfig)
from azure.cli.command_modules.vm.mgmt_avail_set.lib.operations import AvailSetOperations
from azure.cli.command_modules.vm.mgmt_vm_create.lib import (VMCreationClient as VMClient,
VMCreationClientConfiguration
as VMClientConfig)
from azure.cli.command_modules.vm.mgmt_vm_create.lib.operations import VMOperations
from azure.cli._help_files import helps

from ._params import (PARAMETER_ALIASES, VM_CREATE_EXTRA_PARAMETERS, VM_CREATE_PARAMETER_ALIASES,
VM_PATCH_EXTRA_PARAMETERS)
Expand All @@ -36,7 +42,7 @@
],
command_table, patch_aliases(PARAMETER_ALIASES, {
'availability_set_name': {'name': '--name -n'}
}))
}))

build_operation(
'vm machine-extension-image', 'virtual_machine_extension_images', _compute_client_factory,
Expand Down Expand Up @@ -64,7 +70,7 @@
],
command_table, patch_aliases(PARAMETER_ALIASES, {
'vm_extension_name': {'name': '--name -n'}
}))
}))

build_operation(
'vm image', 'virtual_machine_images', _compute_client_factory,
Expand Down Expand Up @@ -104,7 +110,7 @@
],
command_table, patch_aliases(PARAMETER_ALIASES, {
'vm_name': {'name': '--name -n'}
}))
}))

build_operation(
'vm', None, ConvenienceVmCommands,
Expand Down Expand Up @@ -167,4 +173,27 @@
],
command_table, patch_aliases(PARAMETER_ALIASES, {
'image_location': {'name': '--location -l'}
}))
}))

avail_set_param_aliases = {
'name': {
'name': '--name -n'
}
}

helps['vm availability-set create'] = """
type: command
long-summary: For more info, see https://blogs.technet.microsoft.com/yungchou/2013/05/14/window-azure-fault-domain-and-upgrade-domain-explained-explained-reprised/
"""

build_operation("vm availability-set",
'avail_set',
lambda **_: get_mgmt_service_client(AvailSetClient, AvailSetClientConfig),
[
CommandDefinition(AvailSetOperations.create_or_update,
LongRunningOperation(L('Creating availability set'), L('Availability set created')),
'create')
],
command_table,
avail_set_param_aliases)

Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"name": {
"type": "string",
"minLength": 1,
"metadata": {
"description": "Name of the availability set."
}
},
"location": {
"type": "string",
"defaultValue": "[resourceGroup().location]",
"metadata": {
"description": "Location to deploy the availability set."
}
},
"platformUpdateDomainCount": {
"type": "string",
"defaultValue": 1,
"metadata": {
"description": "Number of Update Domains."
}
},
"platformFaultDomainCount": {
"type": "string",
"defaultValue": 1,
"metadata": {
"description": "Number of Fault Domains."
}
}
},
"variables": {
},
"resources": [
{
"name": "[parameters('name')]",
"type": "Microsoft.Compute/availabilitySets",
"location": "[parameters('location')]",
"apiVersion": "2015-06-15",
"dependsOn": [ ],
"tags": {
"displayName": "AvailabilitySet"
},
"properties": {
"platformUpdateDomainCount": "[parameters('platformUpdateDomainCount')]",
"platformFaultDomainCount": "[parameters('platformFaultDomainCount')]"
}
}
],
"outputs": {
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#pylint: skip-file
# coding=utf-8
# --------------------------------------------------------------------------
# Code generated by Microsoft (R) AutoRest Code Generator 0.16.0.0
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------

from .avail_set_creation_client import AvailSetCreationClient, AvailSetCreationClientConfiguration
from .version import VERSION

__all__ = [
'AvailSetCreationClient',
'AvailSetCreationClientConfiguration'
]

__version__ = VERSION

Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
#pylint: skip-file
# coding=utf-8
# --------------------------------------------------------------------------
# Code generated by Microsoft (R) AutoRest Code Generator 0.16.0.0
# 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.avail_set_operations import AvailSetOperations
from . import models


class AvailSetCreationClientConfiguration(AzureConfiguration):
"""Configuration for AvailSetCreationClient
Note that all parameters used to create this instance are saved as instance
attributes.

:param credentials: Gets Azure subscription credentials.
:type credentials: :mod:`A msrestazure Credentials
object<msrestazure.azure_active_directory>`
:param subscription_id: Gets subscription credentials which uniquely
identify Microsoft Azure subscription. The subscription ID forms part of
the URI for every service call.
:type subscription_id: str
:param api_version: Client Api Version.
:type api_version: str
:param accept_language: Gets or sets the preferred language for the
response.
:type accept_language: str
:param long_running_operation_retry_timeout: Gets or sets the retry
timeout in seconds for Long Running Operations. Default value is 30.
:type long_running_operation_retry_timeout: int
:param generate_client_request_id: When set to true a unique
x-ms-client-request-id value is generated and included in each request.
Default is true.
:type generate_client_request_id: bool
:param str base_url: Service URL
:param str filepath: Existing config
"""

def __init__(
self, credentials, subscription_id, api_version='2015-11-01', accept_language='en-US', long_running_operation_retry_timeout=30, generate_client_request_id=True, base_url=None, filepath=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 isinstance(subscription_id, str):
raise TypeError("Parameter 'subscription_id' must be str.")
if api_version is not None and not isinstance(api_version, str):
raise TypeError("Optional parameter 'api_version' must be str.")
if accept_language is not None and not isinstance(accept_language, str):
raise TypeError("Optional parameter 'accept_language' must be str.")
if not base_url:
base_url = 'https://management.azure.com'

super(AvailSetCreationClientConfiguration, self).__init__(base_url, filepath)

self.add_user_agent('availsetcreationclient/{}'.format(VERSION))
self.add_user_agent('Azure-SDK-For-Python')

self.credentials = credentials
self.subscription_id = subscription_id
self.api_version = api_version
self.accept_language = accept_language
self.long_running_operation_retry_timeout = long_running_operation_retry_timeout
self.generate_client_request_id = generate_client_request_id


class AvailSetCreationClient(object):
"""AvailSetCreationClient

:param config: Configuration for client.
:type config: AvailSetCreationClientConfiguration

:ivar avail_set: AvailSet operations
:vartype avail_set: .operations.AvailSetOperations
"""

def __init__(self, config):

self._client = ServiceClient(config.credentials, config)

client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
self._serialize = Serializer()
self._deserialize = Deserializer(client_models)

self.config = config
self.avail_set = AvailSetOperations(
self._client, self.config, self._serialize, self._deserialize)
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#pylint: skip-file
# coding=utf-8
# --------------------------------------------------------------------------
# Code generated by Microsoft (R) AutoRest Code Generator 0.16.0.0
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------

from .deployment_avail_set import DeploymentAvailSet
from .template_link import TemplateLink
from .parameters_link import ParametersLink
from .provider_resource_type import ProviderResourceType
from .provider import Provider
from .basic_dependency import BasicDependency
from .dependency import Dependency
from .deployment_properties_extended import DeploymentPropertiesExtended
from .deployment_extended import DeploymentExtended
from .avail_set_creation_client_enums import (
DeploymentMode,
)

__all__ = [
'DeploymentAvailSet',
'TemplateLink',
'ParametersLink',
'ProviderResourceType',
'Provider',
'BasicDependency',
'Dependency',
'DeploymentPropertiesExtended',
'DeploymentExtended',
'DeploymentMode',
]
Loading