コード例 #1
0
        public override void ExecuteCmdlet()
        {
            var patchRequest = new ClusterUpdateParameters();

            if (UpgradeMode == ClusterUpgradeMode.Manual)
            {
                patchRequest.ClusterCodeVersion = this.Version;
            }

            patchRequest.UpgradeMode = UpgradeMode.ToString();

            if (ShouldProcess(target: this.Name, action: string.Format("Set fabric upgrade type to {0} ", this.UpgradeMode)))
            {
                var cluster = SendPatchRequest(patchRequest);
                WriteObject(cluster, true);
            }
        }
コード例 #2
0
ファイル: Deployment.cs プロジェクト: llenroc/API
        /// <summary>
        /// Upgrades the given deployment with the package contents.
        /// </summary>
        public async Task UpgradeAsync(
            Uri packageUrl,
            DeploymentType deploymentType,
            string roleToUpgrade = null,
            UpgradeMode mode     = UpgradeMode.Auto)
        {
            Contract.Requires(Parent != null);
            Contract.Requires(packageUrl != null);
            Contract.Requires(!string.IsNullOrWhiteSpace(Label));
            Contract.Requires(Configuration != null);

            var ns      = XmlNamespaces.WindowsAzure;
            var content = new XElement(ns + "UpgradeDeployment",
                                       new XElement(ns + "Mode", mode.ToString()),
                                       new XElement(ns + "PackageUrl", packageUrl.ToString()),
                                       new XElement(ns + "Configuration", Configuration.ToXml().ToString().ToBase64String()),
                                       new XElement(ns + "Label", Label.ToBase64String()),
                                       new XElement(ns + "RoleToUpgrade", roleToUpgrade),
                                       new XElement(ns + "Force", deploymentType == DeploymentType.Forced));
            // With the deployments endpoint, you need a forward slash separating the URI from the query string!
            HttpResponseMessage response = await GetRestClient(Parent, "/?comp=upgrade").PostAsync(content);

            await Parent.Subscription.WaitForOperationCompletionAsync(response);
        }
コード例 #3
0
ファイル: Deployment.cs プロジェクト: mortizzle/API
 /// <summary>
 /// Upgrades the given deployment with the package contents.
 /// </summary>
 public async Task UpgradeAsync(
     Uri packageUrl,
     DeploymentType deploymentType,
     string roleToUpgrade = null,
     UpgradeMode mode = UpgradeMode.Auto)
 {
     Contract.Requires(Parent != null);
     Contract.Requires(packageUrl != null);
     Contract.Requires(!string.IsNullOrWhiteSpace(Label));
     Contract.Requires(Configuration != null);
     
     var ns = XmlNamespaces.WindowsAzure;
     var content = new XElement(ns + "UpgradeDeployment",
         new XElement(ns + "Mode", mode.ToString()),
         new XElement(ns + "PackageUrl", packageUrl.ToString()),
         new XElement(ns + "Configuration", Configuration.ToXml().ToString().ToBase64String()),
         new XElement(ns + "Label", Label.ToBase64String()),
         new XElement(ns + "RoleToUpgrade", roleToUpgrade),
         new XElement(ns + "Force", deploymentType == DeploymentType.Forced));
     // With the deployments endpoint, you need a forward slash separating the URI from the query string!
     HttpResponseMessage response = await GetRestClient(Parent, "/?comp=upgrade").PostAsync(content);
     await Parent.Subscription.WaitForOperationCompletionAsync(response);
 }