コード例 #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
ファイル: test_storage.py プロジェクト: ritwik20/azure-cli
 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
ファイル: _validators.py プロジェクト: davidmu1/azure-cli
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))