def build_output_deployment_resource(key, property_name, property_provider, property_type, parent_name=None, output_type='object', path=None): from azure.cli.core._util import random_string output_tb = ArmTemplateBuilder() output_tb.add_output(key, property_name, property_provider, property_type, output_type=output_type, path=path) output_template = output_tb.build() deployment_name = '{}_{}'.format(property_name, random_string(16)) deployment = { 'name': deployment_name, 'type': 'Microsoft.Resources/deployments', 'apiVersion': '2015-01-01', 'properties': { 'mode': 'Incremental', 'template': output_template, } } deployment['dependsOn'] = [] if not parent_name \ else ['Microsoft.Resources/deployments/{}'.format(parent_name)] return deployment
def __init__(self, test_method): super(StorageAccountScenarioTest, self).__init__(__file__, test_method, resource_group='test_storage_account_scenario') if not self.playback: self.account = 'vcrstorage{}'.format(random_string(12, digits_only=True)) else: from azure.cli.core.test_utils.vcr_test_base import MOCKED_STORAGE_ACCOUNT self.account = MOCKED_STORAGE_ACCOUNT
def validate_nsg_name(namespace): namespace.network_security_group_name = namespace.network_security_group_name \ or '{}_NSG_{}'.format(namespace.vm_name, random_string(8))
def generate_random_tag(cls): return '_{}_'.format(random_string(4, force_lower=True))
def generate_account_name(cls): return 'vcrstorage{}'.format(random_string(12, digits_only=True))