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();
        }
 public async Task Setup()
 {
     ArmClient = GetArmClient();
     _notificationHubsResourceId       = TestEnvironment.NotificationHubsResourceId;
     _notificationHubsConnectionString = TestEnvironment.NotificationHubsConnectionString;
     _resourceGroup = await ArmClient.GetResourceGroupResource(_resourceGroupIdentifier).GetAsync();
 }
    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);
        }
        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));
            }
        }
 public async Task TestSetup()
 {
     _resourceGroup = await ArmClient.GetResourceGroupResource(_resourceGroupIdentifier).GetAsync();
 }
示例#7
0
 public async Task SetUp()
 {
     ArmClient      = GetArmClient();
     _resourceGroup = await ArmClient.GetResourceGroupResource(_resourceGroupIdentifier).GetAsync();
 }