예제 #1
0
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
예제 #2
0
 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
예제 #3
0
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
예제 #4
0
def validate_nsg_name(namespace):
    namespace.network_security_group_name = namespace.network_security_group_name \
        or '{}_NSG_{}'.format(namespace.vm_name, random_string(8))
예제 #5
0
 def generate_random_tag(cls):
     return '_{}_'.format(random_string(4, force_lower=True))
예제 #6
0
 def generate_account_name(cls):
     return 'vcrstorage{}'.format(random_string(12, digits_only=True))
예제 #7
0
 def generate_random_tag(cls):
     return '_{}_'.format(random_string(4, force_lower=True))
예제 #8
0
 def generate_account_name(cls):
     return 'vcrstorage{}'.format(random_string(12, digits_only=True))
예제 #9
0
def validate_nsg_name(namespace):
    namespace.network_security_group_name = namespace.network_security_group_name \
        or '{}_NSG_{}'.format(namespace.vm_name, random_string(8))