Exemplo n.º 1
0
        /// <summary>
        /// Provisions all the components in the <see cref="DevOpsFlexDbContext"/>.
        /// </summary>
        /// <param name="context">The database context that we want to provision components from.</param>
        /// <param name="subscriptionId">The subscription Id where we want to provision in.</param>
        /// <param name="settingsPath">The path to the settings file with the management certificate.</param>
        /// <returns>The async <see cref="Task"/> wrapper.</returns>
        public static async Task ProvisionAllAsync(this DevOpsFlexDbContext context, string subscriptionId, string settingsPath)
        {
            Contract.Requires(context != null);
            Contract.Requires(!string.IsNullOrEmpty(subscriptionId));
            Contract.Requires(!string.IsNullOrEmpty(settingsPath));

            await Task.WhenAll(context.ProvisionAll(subscriptionId, settingsPath));
        }
        /// <summary>
        /// Processes the Push-DevOpsFlexConfiguration commandlet synchronously.
        /// </summary>
        protected override void ProcessRecord()
        {
            FlexDataConfiguration.Branch        = Branch;
            FlexDataConfiguration.Configuration = Configuration;
            FlexStreams.UseThreadQueue(ThreadAdapter);

            using (EventStream.Subscribe(e => WriteObject(e.Message)))
                using (var context = new DevOpsFlexDbContext(SqlConnectionString))
                {
                    ProcessAsyncWork(context.ProvisionAll(SubscriptionId, SettingsPath));
                }

            WriteObject("Push-DevOpsFlexConfiguration completed!");
            base.ProcessRecord();
        }