Exemplo n.º 1
0
        public Module UpdateModule(string resourceGroupName, string automationAccountName, string name, Uri contentLinkUri, string contentLinkVersion)
        {
            var moduleModel = this.automationManagementClient.Modules.Get(resourceGroupName, automationAccountName, name).Module;

            if (contentLinkUri != null)
            {
                var modulePatchParameters = new AutomationManagement.Models.ModulePatchParameters();

                modulePatchParameters.Name                           = name;
                modulePatchParameters.Properties                     = new ModulePatchProperties();
                modulePatchParameters.Properties.ContentLink         = new AutomationManagement.Models.ContentLink();
                modulePatchParameters.Properties.ContentLink.Uri     = contentLinkUri;
                modulePatchParameters.Properties.ContentLink.Version =
                    (String.IsNullOrWhiteSpace(contentLinkVersion))
                        ? Guid.NewGuid().ToString()
                        : contentLinkVersion;

                modulePatchParameters.Tags = moduleModel.Tags;

                this.automationManagementClient.Modules.Patch(resourceGroupName, automationAccountName, modulePatchParameters);
            }
            var updatedModule = this.automationManagementClient.Modules.Get(resourceGroupName, automationAccountName, name).Module;

            return(new Module(resourceGroupName, automationAccountName, updatedModule));
        }
Exemplo n.º 2
0
        public Module UpdateModule(string resourceGroupName, string automationAccountName, string name,
            Uri contentLinkUri, string contentLinkVersion)
        {
            var moduleModel =
                this.automationManagementClient.Modules.Get(resourceGroupName, automationAccountName, name).Module;
            if (contentLinkUri != null)
            {
                var modulePatchParameters = new AutomationManagement.Models.ModulePatchParameters();

                modulePatchParameters.Name = name;
                modulePatchParameters.Properties = new ModulePatchProperties();
                modulePatchParameters.Properties.ContentLink = new AutomationManagement.Models.ContentLink();
                modulePatchParameters.Properties.ContentLink.Uri = contentLinkUri;
                modulePatchParameters.Properties.ContentLink.Version =
                    (String.IsNullOrWhiteSpace(contentLinkVersion))
                        ? Guid.NewGuid().ToString()
                        : contentLinkVersion;

                modulePatchParameters.Tags = moduleModel.Tags;

                this.automationManagementClient.Modules.Patch(resourceGroupName, automationAccountName,
                    modulePatchParameters);
            }
            var updatedModule =
                this.automationManagementClient.Modules.Get(resourceGroupName, automationAccountName, name).Module;
            return new Module(resourceGroupName, automationAccountName, updatedModule);
        }