Exemple #1
0
        internal override async Task <int> RunAsync(CancellationToken cancellationToken)
        {
            var validHostingPlanSkus  = new string[] { "Y1", "F1", "D1", "B1", "S1", "S2", "S3", "P1", "P2", "P3", "P1V2", "P2V2", "P3V2" };
            var validHostingPlanTiers = new string[] { "Dynamic", "Free", "Shared", "Basic", "Standard", "Premium" };

            if (!validHostingPlanSkus.Contains(HostingPlanSku))
            {
                Logger.WriteError($"Invalid value for hostingPlanSku: must be one of {String.Join(",", validHostingPlanSkus)}");
                return(2);
            }
            if (!validHostingPlanTiers.Contains(HostingPlanTier))
            {
                Logger.WriteError($"Invalid value for hostingPlanTier: must be one of {String.Join(",", validHostingPlanTiers)}");
                return(2);
            }

            var context = await Context
                          .WithAzureLogon()
                          .WithDevOpsLogon() // need the token, so we can save it in the app settings
                          .BuildAsync(cancellationToken);

            var  instances = new AggregatorInstances(context.Azure, context.Logger);
            var  instance  = new InstanceName(Name, ResourceGroup);
            bool ok        = await instances.AddAsync(instance, Location, RequiredVersion, SourceUrl, cancellationToken);

            return(ok ? 0 : 1);
        }
        internal override async Task <int> RunAsync(CancellationToken cancellationToken)
        {
            var validHostingPlanSkus  = new string[] { "Y1", "F1", "D1", "B1", "S1", "S2", "S3", "P1", "P2", "P3", "P1V2", "P2V2", "P3V2" };
            var validHostingPlanTiers = new string[] { "Dynamic", "Free", "Shared", "Basic", "Standard", "Premium" };

            if (!validHostingPlanSkus.Contains(HostingPlanSku))
            {
                Logger.WriteError($"Invalid value for hostingPlanSku: must be one of {String.Join(",", validHostingPlanSkus)}");
                return(ExitCodes.InvalidArguments);
            }
            if (!validHostingPlanTiers.Contains(HostingPlanTier))
            {
                Logger.WriteError($"Invalid value for hostingPlanTier: must be one of {String.Join(",", validHostingPlanTiers)}");
                return(ExitCodes.InvalidArguments);
            }
            var tuning = new AggregatorInstances.InstanceFineTuning
            {
                AppInsightLocation = string.IsNullOrWhiteSpace(AppInsightLocation) ? Location : AppInsightLocation,
                HostingPlanSku     = HostingPlanSku,
                HostingPlanTier    = HostingPlanTier
            };

            var context = await Context
                          .WithAzureLogon()
                          .WithDevOpsLogon() // need the token, so we can save it in the app settings
                          .BuildAsync(cancellationToken);

            context.ResourceGroupDeprecationCheck(this.ResourceGroup);
            var  instances = new AggregatorInstances(context.Azure, context.Logger, context.Naming);
            var  instance  = context.Naming.GetInstanceCreateNames(Name, ResourceGroup);
            bool ok        = await instances.AddAsync(instance, Location, RequiredVersion, SourceUrl, tuning, cancellationToken);

            return(ok ? ExitCodes.Success : ExitCodes.Failure);
        }
        internal override async Task <int> RunAsync(CancellationToken cancellationToken)
        {
            var context = await Context
                          .WithAzureLogon()
                          .WithDevOpsLogon() // need the token, so we can save it in the app settings
                          .BuildAsync(cancellationToken);

            var  instances = new AggregatorInstances(context.Azure, context.Logger);
            var  instance  = new InstanceName(Name, ResourceGroup);
            bool ok        = await instances.AddAsync(instance, Location, RequiredVersion, cancellationToken);

            return(ok ? 0 : 1);
        }