コード例 #1
0
 private static void AddAdditionalParameters(JObject parametersObject, ArmTemplate armTemplate)
 {
     foreach (var additionalResource in armTemplate.AdditionalResourceNames)
     {
         parametersObject.Add(CreateParameterProperty(additionalResource));
     }
 }
コード例 #2
0
        protected override ArmTemplate TransformInner(ArmTemplate armTemplate, IArmPropertyValueResolver armPropertyValueResolver)
        {
            JObject variables = CreateVariablesObject(armTemplate);

            armTemplate.Json.AddFirst(new JProperty(ArmTemplatePropertyNameConstants.Variables, variables));

            return(armTemplate);
        }
コード例 #3
0
        protected override ArmTemplate TransformInner(ArmTemplate armTemplate, IArmPropertyValueResolver armPropertyValueResolver)
        {
            armTemplate.Json.AddFirst(new JProperty(ArmTemplatePropertyNameConstants.Variables, new JObject()));
            armTemplate.Json.AddFirst(BuildTemplateParameters(armTemplate));
            armTemplate.Json.AddFirst(new JProperty(ArmTemplatePropertyNameConstants.ContentVersion, ArmPropertyValueConstants.ContentVersion));
            armTemplate.Json.AddFirst(new JProperty("$schema", ArmPropertyValueConstants.TemplateSchema));

            return(armTemplate);
        }
コード例 #4
0
        protected override ArmTemplate TransformInner(ArmTemplate armTemplate, IArmPropertyValueResolver armPropertyValueResolver)
        {
            var properties = armTemplate.Json.SelectToken("properties");
            var parts      = properties.SelectToken("lenses.0.parts");

            UpdateParts(parts, armPropertyValueResolver);
            UpdateTemplateMetadata(armTemplate.Json, armPropertyValueResolver);

            return(armTemplate);
        }
コード例 #5
0
        private static JObject CreateVariablesObject(ArmTemplate armTemplate)
        {
            var parametersObject = new JObject(
                CreateParameterProperty(ArmTemplateDynamicProperty.AppInsightsName.DynamicValue),
                CreateParameterProperty(ArmTemplateDynamicProperty.DashboardName.DynamicValue),
                CreateParameterProperty(ArmTemplateDynamicProperty.DashboardDisplayName.DynamicValue));

            AddAdditionalParameters(parametersObject, armTemplate);

            return(parametersObject);
        }
コード例 #6
0
        protected override ArmTemplate TransformInner(ArmTemplate armTemplate, IArmPropertyValueResolver armPropertyValueResolver)
        {
            var dependencies = new JArray();

            dependencies.Add(WrapVariableSelector(armPropertyValueResolver.GetValue(ArmTemplateDynamicProperty.AppInsightsName)));
            foreach (var additionalResource in armTemplate.AdditionalResourceNames)
            {
                dependencies.Add(WrapVariableSelector(armPropertyValueResolver.GetValue(additionalResource)));
            }

            armTemplate.Json.Add(new JProperty("dependsOn", dependencies));
            return(armTemplate);
        }
コード例 #7
0
        protected override ArmTemplate TransformInner(ArmTemplate armTemplate, IArmPropertyValueResolver armPropertyValueResolver)
        {
            var resourceIdProperties    = armTemplate.Json.GetAllChildProperties("resourceId");
            var additionalResourceNames = new HashSet <string>();

            foreach (var resourceIdProperty in resourceIdProperties)
            {
                var resourceId = new ResourceId(resourceIdProperty.Value.Value <string>(), armPropertyValueResolver);
                resourceIdProperty.Value = resourceId.ToParameterisedString();
                additionalResourceNames.Add(resourceId.ResourceParameterName);
            }
            armTemplate.AdditionalResourceNames.AddRange(additionalResourceNames);
            return(armTemplate);
        }
コード例 #8
0
        protected override ArmTemplate TransformInner(ArmTemplate armTemplate, IArmPropertyValueResolver armPropertyValueResolver)
        {
            var resources       = new JArray();
            var properties      = armTemplate.Json.Properties();
            var resourcesObject = new JObject();

            foreach (var property in properties)
            {
                resourcesObject.Add(property);
            }

            resources.Add(resourcesObject);
            armTemplate.ReplaceJson(new JObject(new JProperty("resources", resources)));
            return(armTemplate);
        }
コード例 #9
0
        private static JProperty BuildTemplateParameters(ArmTemplate armTemplate)
        {
            var parameters = new JObject(
                CreateParameterProperty(ArmTemplateDynamicProperty.AppInsightsName),
                CreateParameterProperty(ArmTemplateDynamicProperty.DashboardName),
                CreateParameterProperty(ArmTemplateDynamicProperty.DashboardDisplayName),
                CreateParameterProperty(ArmTemplateDynamicProperty.ResourceGroupName),
                CreateParameterProperty(ArmTemplateDynamicProperty.SubscriptionId)
                );

            foreach (var additionalParameter in armTemplate.AdditionalResourceNames)
            {
                parameters.Add(CreateParameterProperty(additionalParameter));
            }

            return(new JProperty(ArmTemplatePropertyNameConstants.Parameters, parameters));
        }
コード例 #10
0
 protected abstract ArmTemplate TransformInner(ArmTemplate armTemplate, IArmPropertyValueResolver armPropertyValueResolver);
コード例 #11
0
 public ArmTemplate Transform(ArmTemplate armTemplate, IArmPropertyValueResolver armPropertyValueResolver)
 {
     armTemplate = this.TransformInner(armTemplate, armPropertyValueResolver);
     return(this.nextTransformer != null?this.nextTransformer.Transform(armTemplate, armPropertyValueResolver) : armTemplate);
 }