コード例 #1
0
        public async Task SetUp()
        {
            // need to overwrite with the resource group fetched by ArmClient, otherwise it won't be recorded
            _resourceGroup = await ArmClient.GetResourceGroupResource(_resourceGroupIdentifier).GetAsync();

            _databaseAccount = await ArmClient.GetDatabaseAccountResource(_databaseAccountIdentifier).GetAsync();
        }
コード例 #2
0
 public async Task Setup()
 {
     ArmClient = GetArmClient();
     _notificationHubsResourceId       = TestEnvironment.NotificationHubsResourceId;
     _notificationHubsConnectionString = TestEnvironment.NotificationHubsConnectionString;
     _resourceGroup = await ArmClient.GetResourceGroupResource(_resourceGroupIdentifier).GetAsync();
 }
コード例 #3
0
    public async virtual Task <ArmDeploymentPropertiesExtended> DeployLocalTemplateAsync <TParameters>(
        string templateName,
        TParameters parameters,
        ResourceIdentifier scope,
        CancellationToken cancellationToken)
    {
        var armClient = new ArmClient(_credential);
        var rgClient  = armClient.GetResourceGroupResource(scope);

        var template = File.ReadAllText(Path.Combine(Assembly.GetExecutingAssembly().Location, "..", templateName + ".json"));
        var props    = new ArmDeploymentProperties(ArmDeploymentMode.Incremental)
        {
            Template   = BinaryData.FromString(template),
            Parameters = BinaryData.FromObjectAsJson(parameters),
        };

        _logger.LogInformation("Beginning deployment of {}.json", templateName);
        var deploymentOperation = await rgClient.GetArmDeployments().CreateOrUpdateAsync(WaitUntil.Completed, templateName, new ArmDeploymentContent(props), cancellationToken);

        var deployment = await deploymentOperation.WaitForCompletionAsync(cancellationToken);

        var result = deployment.Value.Data.Properties;

        if (result.ProvisioningState != ResourcesProvisioningState.Succeeded)
        {
            throw new Exception();
        }
        return(result);
    }
コード例 #4
0
        public async Task SetUp()
        {
            ArmClient      = GetArmClient();
            _resourceGroup = await ArmClient.GetResourceGroupResource(_resourceGroupIdentifier).GetAsync();

            _emailService = await _resourceGroup.GetEmailServiceResourceAsync(_emailServiceName);
        }
コード例 #5
0
        public ArmDeploymentCollection GetDeploymentCollection(ArmClient armClient, ResourceIdentifier resourceIdentifier, string scope)
        {
            switch (scope)
            {
            case LanguageConstants.TargetScopeTypeResourceGroup:
                var resourceGroup = armClient.GetResourceGroupResource(resourceIdentifier);
                return(resourceGroup.GetArmDeployments());

            case LanguageConstants.TargetScopeTypeSubscription:
                var subscription = armClient.GetSubscriptionResource(resourceIdentifier);
                return(subscription.GetArmDeployments());

            case LanguageConstants.TargetScopeTypeManagementGroup:
                var managementGroup = armClient.GetManagementGroupResource(resourceIdentifier);
                return(managementGroup.GetArmDeployments());

            default:
                throw new Exception(string.Format(LangServerResources.UnsupportedTargetScopeMessage, scope));
            }
        }
コード例 #6
0
 public async Task TestSetup()
 {
     _resourceGroup = await ArmClient.GetResourceGroupResource(_resourceGroupIdentifier).GetAsync();
 }
コード例 #7
0
 public async Task SetUp()
 {
     ArmClient      = GetArmClient();
     _resourceGroup = await ArmClient.GetResourceGroupResource(_resourceGroupIdentifier).GetAsync();
 }