Example #1
0
        public async Task Get()
        {
            SubscriptionResource subscription = await Client.GetDefaultSubscriptionAsync();

            string            rgName = Recording.GenerateAssetName("testRg-2-");
            ResourceGroupData rgData = new ResourceGroupData(AzureLocation.WestUS2);
            var lro = await subscription.GetResourceGroups().CreateOrUpdateAsync(WaitUntil.Completed, rgName, rgData);

            ResourceGroupResource rg         = lro.Value;
            string deployName                = Recording.GenerateAssetName("deployEx-");
            var    deploymentData            = CreateDeploymentData(CreateDeploymentProperties());
            ArmDeploymentResource deployment = (await rg.GetArmDeployments().CreateOrUpdateAsync(WaitUntil.Completed, deployName, deploymentData)).Value;

            await foreach (var tempDeploymentOperation in deployment.GetDeploymentOperationsAsync())
            {
                var getDeploymentOperation = await deployment.GetDeploymentOperationAsync(tempDeploymentOperation.OperationId);

                AssertValidDeploymentOperation(tempDeploymentOperation, getDeploymentOperation);
            }
        }
Example #2
0
        public async Task List()
        {
            SubscriptionResource subscription = await Client.GetDefaultSubscriptionAsync();

            string            rgName = Recording.GenerateAssetName("testRg-1-");
            ResourceGroupData rgData = new ResourceGroupData(AzureLocation.WestUS2);
            var lro = await subscription.GetResourceGroups().CreateOrUpdateAsync(WaitUntil.Completed, rgName, rgData);

            ResourceGroupResource rg         = lro.Value;
            string deployName                = Recording.GenerateAssetName("deployEx-");
            var    deploymentData            = CreateDeploymentData(CreateDeploymentProperties());
            ArmDeploymentResource deployment = (await rg.GetArmDeployments().CreateOrUpdateAsync(WaitUntil.Completed, deployName, deploymentData)).Value;
            int count = 0;

            await foreach (var tempDeploymentOperation in deployment.GetDeploymentOperationsAsync())
            {
                count++;
            }
            Assert.AreEqual(count, 2); //One deployment contains two operations: Create and EvaluteDeploymentOutput
        }