Пример #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ConfigurationContent"/> class.
        /// </summary>
        /// <param name="resourceGroupName">
        /// The resource group name.
        /// </param>
        /// <param name="accountName">
        /// The account name.
        /// </param>
        /// <param name="configuration">
        /// The configuration.
        /// </param>
        /// <param name="content">
        /// The content.
        /// </param>
        /// <param name="slot">
        /// Slot published or draft.
        /// </param>
        public ConfigurationContent(string resourceGroupName, string accountName, AutomationManagement.Models.DscConfiguration configuration, string content, string slot)
        {
            Requires.Argument("configuration", configuration).NotNull();
            Requires.Argument("accountName", accountName).NotNull();
            Requires.Argument("resourceGroupName", resourceGroupName).NotNull();
            Requires.Argument("slot", slot).NotNull();

            this.AutomationAccountName = accountName;
            this.Name    = configuration.Name;
            this.Content = content;

            if (configuration == null)
            {
                return;
            }

            this.CreationTime     = configuration.CreationTime.ToLocalTime();
            this.LastModifiedTime = configuration.LastModifiedTime.ToLocalTime();
            this.Slot             = slot;
        }
Пример #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="DscConfiguration"/> class.
        /// </summary>
        /// <param name="resourceGroupName">
        /// The resource group name.
        /// </param>
        /// <param name="automationAccountName">
        /// The automation account.
        /// </param>
        /// <param name="configuration">
        /// The configuration script.
        /// </param>
        public DscConfiguration(string resourceGroupName, string automationAccountName, AutomationManagement.Models.DscConfiguration configuration)
        {
            Requires.Argument("ResourceGroupName", resourceGroupName).NotNull();
            Requires.Argument("AutomationAccountName", automationAccountName).NotNull();
            Requires.Argument("Configuration", configuration).NotNull();

            this.ResourceGroupName     = resourceGroupName;
            this.AutomationAccountName = automationAccountName;
            this.Name     = configuration.Name;
            this.Location = configuration.Location;
            this.Tags     = null;

            if (configuration == null)
            {
                return;
            }

            this.CreationTime     = configuration.CreationTime.ToLocalTime();
            this.LastModifiedTime = configuration.LastModifiedTime.ToLocalTime();
            this.Description      = configuration.Description;
            this.LogVerbose       = configuration.LogVerbose ?? false;
            this.State            = configuration.State;
            this.Location         = configuration.Location;

            this.Tags = new Hashtable(StringComparer.InvariantCultureIgnoreCase);

            if (configuration.Tags != null)
            {
                foreach (var kvp in configuration.Tags)
                {
                    this.Tags.Add(kvp.Key, kvp.Value);
                }
            }

            this.Parameters = new Hashtable(StringComparer.InvariantCultureIgnoreCase);

            if (configuration.Parameters != null)
            {
                foreach (var kvp in configuration.Parameters)
                {
                    this.Parameters.Add(kvp.Key, (object)kvp.Value);
                }
            }
        }