本文整理汇总了C#中DeploymentSlot.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# DeploymentSlot.ToString方法的具体用法?C# DeploymentSlot.ToString怎么用?C# DeploymentSlot.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DeploymentSlot
的用法示例。
在下文中一共展示了DeploymentSlot.ToString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetHostedServiceContainsDeploymentCommand
/// <summary>
/// Constructs a GetHostedServiceList command
/// </summary>
internal GetHostedServiceContainsDeploymentCommand(string serviceName, DeploymentSlot slot = DeploymentSlot.Production)
{
OperationId = "hostedservices";
ServiceType = "services";
HttpCommand = (HostedServiceName = serviceName) + "/deploymentslots/" + slot.ToString().ToLower();
HttpVerb = HttpVerbGet;
}
示例2: GetConfiguration
public XDocument GetConfiguration(SubscriptionCloudCredentials credentials, string serviceName, DeploymentSlot slot)
{
using (var client = CloudContext.Clients.CreateComputeManagementClient(credentials))
{
try
{
var response = client.Deployments.GetBySlot(serviceName, slot);
if (response.StatusCode != HttpStatusCode.OK)
{
throw new Exception(string.Format("Getting deployment by slot returned HTTP Status Code: {0}",
response.StatusCode));
}
return string.IsNullOrEmpty(response.Configuration)
? null
: XDocument.Parse(response.Configuration);
}
catch (CloudException cloudException)
{
Log.VerboseFormat("Getting deployments for service '{0}', slot {1}, returned:\n{2}", serviceName, slot.ToString(), cloudException.Message);
return null;
}
}
}
示例3: GetAggregateDeploymentStatusCommand
/// <summary>
/// Used to create an instance of GetAggregateDeploymentStatusCommand
/// </summary>
//https://management.core.windows.net/<subscription-id>/services/hostedservices/<service-name>/deploymentslots/<deployment-slot>
internal GetAggregateDeploymentStatusCommand(string hostedServiceName, DeploymentSlot slot)
{
OperationId = "hostedservices";
ServiceType = "services";
HttpCommand = (HostedServiceName = hostedServiceName) + "/deploymentslots/" + slot.ToString().ToLower();
HttpVerb = HttpVerbGet;
}
示例4: UpdateRoleStatusCommand
/// <summary>
/// Constructs a command to create an update to the status of a role
/// </summary>
internal UpdateRoleStatusCommand(string serviceName, DeploymentSlot slot, UpdateDeploymentStatus status)
{
OperationId = "hostedservices";
ServiceType = "services";
HttpCommand = serviceName + "/deploymentslots/" + slot.ToString().ToLower() + "/?comp=status";
Status = status;
}
示例5: DeleteDeploymentCommand
// https://management.core.windows.net/<subscription-id>/services/hostedservices/<service-name>/deploymentslots/<deployment-slot>
/// <summary>
/// Constructs a service deployment delete command with a given name and slot
/// </summary>
/// <param name="serviceName">The name of the service which is being swept for deployments</param>
/// <param name="slot">The deployment slot used can be production or staging</param>
internal DeleteDeploymentCommand(string serviceName, DeploymentSlot slot)
{
Name = serviceName;
DeploymentSlot = slot;
HttpVerb = HttpVerbDelete;
HttpCommand = Name + "/deploymentslots/" + slot.ToString().ToLower();
ServiceType = "services";
OperationId = "hostedservices";
}
示例6: GetDeploymenConfigurationCommand
/// <summary>
/// Constructs a GetHostedServiceList command
/// </summary>
// https://management.core.windows.net/<subscription-id>/services/hostedservices/<service-name>/deploymentslots/<deployment-slot>
internal GetDeploymenConfigurationCommand(string serviceName, DeploymentSlot slot = DeploymentSlot.Production)
{
// need to increment the version in this request otherwise will not be able to check vm instances
AdditionalHeaders["x-ms-version"] = "2012-03-01";
OperationId = "hostedservices";
ServiceType = "services";
HttpCommand = (HostedServiceName = serviceName) + "/deploymentslots/" + slot.ToString().ToLower();
HttpVerb = HttpVerbGet;
}
示例7: GetRoleStatusCommand
/// <summary>
/// Used to create an instance of GetRoleStatusCommand
/// </summary>
//https://management.core.windows.net/<subscription-id>/services/hostedservices/<service-name>/deploymentslots/<deployment-slot>
internal GetRoleStatusCommand(string hostedServiceName, string roleName, DeploymentSlot slot)
{
OperationId = "hostedservices";
ServiceType = "services";
HttpCommand = (HostedServiceName = hostedServiceName) + "/deploymentslots/" + slot.ToString().ToLower();
;
HttpVerb = HttpVerbGet;
RoleName = roleName;
Slot = slot;
}
示例8: ChangeDeploymentConfigurationAsync
/// <summary>
/// Begins an asychronous operation to change the configuration of a deployment.
/// </summary>
/// <param name="cloudServiceName">The name of the cloud service which contains the deployment with the configuration to be changed. Required.</param>
/// <param name="slot">The <see cref="DeploymentSlot"/> which contains the deployment with the configuration to be changed.</param>
/// <param name="configFilePath">The local file path to the Azure deployment configuration file (.cscfg) defining the deployment. Required.</param>
/// <param name="treatWarningsAsError">Set to true to treat configuation warnings as errors and fail the configuration change. Default is false.</param>
/// <param name="mode">The <see cref="UpgradeType"/> value indicating whether the configuation change should happen automatically (<see cref="UpgradeType.Auto"/> or
/// manually (<see cref="UpgradeType.Manual"/>. If set to <see cref="UpgradeType.Manual"/>, you must subsequently call <see cref="WalkUpgradeDomainAsync"/> to
/// control the configuration change across the deployment.</param>
/// <param name="extendedProperties">An optional <see cref="IDictionary{String, String}"/> that contains Name Value pairs representing user defined metadata for the deployment.</param>
/// <param name="token">An optional <see cref="CancellationToken"/>.</param>
/// <returns>A <see cref="Task"/> which returns a string representing the operation Id for this operation.</returns>
/// <remarks>ChangeDeploymentConfigurationAsync is a long-running asynchronous operation. When the Task representing ChangeDeploymentConfigurationAsync is complete,
/// without throwing an exception, this indicates that the operation as been accepted by the server, but has not completed. To track progress of
/// the long-running operation use the operation Id returned from the ChangeDeploymentConfigurationAsync <see cref="Task"/> in calls to <see cref="GetOperationStatusAsync"/>
/// until it returns either <see cref="OperationStatus.Succeeded"/> or <see cref="OperationStatus.Failed"/>.</remarks>
public Task<string> ChangeDeploymentConfigurationAsync(string cloudServiceName, DeploymentSlot slot, string configFilePath, bool treatWarningsAsError = false, UpgradeType mode = UpgradeType.Auto, IDictionary<string, string> extendedProperties = null, CancellationToken token = default(CancellationToken))
{
Validation.ValidateStringArg(cloudServiceName, "cloudServiceName");
//this validates the other parameters...
ChangeDeploymentConfigurationInfo info = ChangeDeploymentConfigurationInfo.Create(configFilePath, treatWarningsAsError, mode, extendedProperties);
HttpRequestMessage message = CreateBaseMessage(HttpMethod.Post, CreateTargetUri(UriFormatStrings.DeploymentSlotChangeConfig, cloudServiceName, slot.ToString()), info);
return StartSendTask(message, token);
}
示例9: CreateDeploymentCommand
/// <summary>
/// Constructs a command to create a deployment to a particular cloud service
/// </summary>
/// <param name="serviceName">the name of the cloud service</param>
/// <param name="deploymentName">The name of the deployment</param>
/// <param name="packageUri">The blob store and endpoint address where the package has been uploaded to</param>
/// <param name="config">The base64 encoded config of .cscfg file</param>
/// <param name="slot">The deployment slot - can be production or staging</param>
/// <param name="startDeployment">an optional parameter which defaults to true as to whether the deployment should be started when complete</param>
/// <param name="treatWarningsAsErrors">an optional parameter set to false - any warnings (such as SLA or config violations) will be treated as an error and stop the deployment</param>
internal CreateDeploymentCommand(string serviceName, string deploymentName, string packageUri, string config,
DeploymentSlot slot, bool startDeployment = true,
bool treatWarningsAsErrors = false)
{
OperationId = "hostedservices";
ServiceType = "services";
Name = serviceName;
DeploymentSlot = slot;
DeploymentName = deploymentName;
PackageUri = packageUri;
Config = config;
HttpCommand = Name + "/deploymentslots/" + slot.ToString().ToLower();
StartDeploymentAutomatically = startDeployment;
TreatWarningsAsErrors = treatWarningsAsErrors;
}
示例10: CreateDeploymentInternal
private Deployment CreateDeploymentInternal(DeploymentSlot slot, Uri blobUri, bool startWithDeployment = false, bool treatWarningsAsError = false)
{
TestContext.WriteLine("Beginning CreateDeployment operation");
CancellationToken token = TokenSource.Token;
string name = Guid.NewGuid().ToString("N", CultureInfo.InvariantCulture);
string label = name + "_TestDeployment";
TestContext.WriteLine("Creating Deployment with name {0} and label {1} in slot {2}", name, label, slot.ToString());
var createAndWaitTask = TestClient.CreateDeploymentAsync(CloudServiceName, slot, name, blobUri, label, Path.Combine(Utilities.DataPath, Utilities.CSCfgFile), startWithDeployment, treatWarningsAsError, null, token)
.ContinueWith(Utilities.PollUntilComplete(TestClient, "Create Deployment", TestContext, token));
TestContext.WriteLine("CreateDeployment called, waiting...");
createAndWaitTask.Wait();
TestContext.WriteLine("Deployment in slot {0} created.", slot.ToString());
TestContext.WriteLine("End CreateDeployment operation");
TestContext.WriteLine("Getting properties of new Deployment");
var getTask = TestClient.GetDeploymentAsync(CloudServiceName, slot, token);
TestContext.WriteLine(getTask.Result.ToString());
return getTask.Result;
}
示例11: WalkUpgradeDomainAsync
/// <summary>
/// Begins an asychronous operation to upgrade a particular domain in a manual deployment upgrade or configuration change.
/// </summary>
/// <param name="cloudServiceName">The name of the cloud service which contains the deployment to upgrade.</param>
/// <param name="slot">The <see cref="DeploymentSlot"/> which contains the deployment to upgrade.</param>
/// <param name="upgradeDomain">In integer representing the particular upgrade domain to upgrade.</param>
/// <param name="token">An optional <see cref="CancellationToken"/>.</param>
/// <returns>A <see cref="Task"/> which returns a string representing the operation Id for this operation.</returns>
/// <remarks>WalkUpgradeDomainAsync is a long-running asynchronous operation. When the Task representing WalkUpgradeDomainAsync is complete,
/// without throwing an exception, this indicates that the operation as been accepted by the server, but has not completed. To track progress of
/// the long-running operation use the operation Id returned from the WalkUpgradeDomainAsync <see cref="Task"/> in calls to <see cref="GetOperationStatusAsync"/>
/// until it returns either <see cref="OperationStatus.Succeeded"/> or <see cref="OperationStatus.Failed"/>.</remarks>
public Task<string> WalkUpgradeDomainAsync(string cloudServiceName, DeploymentSlot slot, int upgradeDomain, CancellationToken token = default(CancellationToken))
{
Validation.ValidateStringArg(cloudServiceName, "cloudServiceName");
WalkUpgradeDomainInfo info = WalkUpgradeDomainInfo.Create(upgradeDomain);
HttpRequestMessage message = CreateBaseMessage(HttpMethod.Post, CreateTargetUri(UriFormatStrings.DeploymentSlotWalkUpgradeDomain, cloudServiceName, slot.ToString()), info);
return StartSendTask(message, token);
}
示例12: UpgradeDeploymentAsync
/// <summary>
/// Begins an asychronous operation to upgrade a deployment.
/// </summary>
/// <param name="cloudServiceName">The name of the cloud service which contains the deployment to be upgraded. Required.</param>
/// <param name="slot">The <see cref="DeploymentSlot"/> which contains the deployment to be upgraded.</param>
/// <param name="mode">The <see cref="UpgradeType"/> value indicating whether the ugrade should happen automatically (<see cref="UpgradeType.Auto"/> or
/// manually (<see cref="UpgradeType.Manual"/>. If set to <see cref="UpgradeType.Manual"/>, you must subsequently call <see cref="WalkUpgradeDomainAsync"/> to
/// control the upgrade across the deployment.</param>
/// <param name="packageUrl">The <see cref="Uri"/> representing the location of the azure deployment package (.cspkg) to be deployed.
/// The service package can be located either in a storage account beneath the same subscription or a Shared Access Signature (SAS) URI from any storage account.
/// For more info about Shared Access Signatures, see <see href="http://msdn.microsoft.com/en-us/library/windowsazure/ee395415">Using a Shared Access Signature (REST API)</see>. Required.
/// </param>
/// <param name="configFilePath">The local file path to the Azure deployment configuration file (.cscfg) defining the deployment. Required.</param>
/// <param name="label">The label for the deployment, may be up to 100 characters in length. Required.</param>
/// <param name="roleToUpgrade">The name of a specific role to upgrade. Optional.</param>
/// <param name="treatWarningsAsError">Specifies whether to treat package validation warnings as errors and fail the upgrade. Default is false.</param>
/// <param name="force">Specifies whether the upgrade should proceed even when it will cause local data to be lost from some role instances. Default is false.</param>
/// <param name="extendedProperties">An optional <see cref="IDictionary{String, String}"/> that contains Name Value pairs representing user defined metadata for the service.</param>
/// <param name="token">An optional <see cref="CancellationToken"/>.</param>
/// <returns>A <see cref="Task"/> which returns a string representing the operation Id for this operation.</returns>
/// <remarks>UpgradeDeploymentAsync is a long-running asynchronous operation. When the Task representing UpgradeDeploymentAsync is complete,
/// without throwing an exception, this indicates that the operation as been accepted by the server, but has not completed. To track progress of
/// the long-running operation use the operation Id returned from the UpgradeDeploymentAsync <see cref="Task"/> in calls to <see cref="GetOperationStatusAsync"/>
/// until it returns either <see cref="OperationStatus.Succeeded"/> or <see cref="OperationStatus.Failed"/>.</remarks>
public Task<string> UpgradeDeploymentAsync(string cloudServiceName, DeploymentSlot slot, UpgradeType mode, Uri packageUrl, string configFilePath, string label, string roleToUpgrade = null, bool treatWarningsAsError = false, bool force = false, IDictionary<string, string> extendedProperties = null, CancellationToken token = default(CancellationToken))
{
Validation.ValidateStringArg(cloudServiceName, "cloudServiceName");
//this validates the other parameters...
UpgradeDeploymentInfo info = UpgradeDeploymentInfo.Create(mode, packageUrl, configFilePath, label, roleToUpgrade, treatWarningsAsError, force, extendedProperties);
HttpRequestMessage message = CreateBaseMessage(HttpMethod.Post, CreateTargetUri(UriFormatStrings.DeploymentSlotUpgrade, cloudServiceName, slot.ToString()), info);
return StartSendTask(message, token);
}
示例13: StopDeploymentAsync
/// <summary>
/// Begins an asychronous operation to stop a running deployment.
/// </summary>
/// <param name="cloudServiceName">The name of the cloud service which contains the deployment to be stopped. Required.</param>
/// <param name="slot">The <see cref="DeploymentSlot"/> which contains the deployment to be stopped.</param>
/// <param name="token">An optional <see cref="CancellationToken"/>.</param>
/// <returns>A <see cref="Task"/> which returns a string representing the operation Id for this operation.</returns>
/// <remarks>StopDeploymentAsync is a long-running asynchronous operation. When the Task representing StopDeploymentAsync is complete,
/// without throwing an exception, this indicates that the operation as been accepted by the server, but has not completed. To track progress of
/// the long-running operation use the operation Id returned from the StopDeploymentAsync <see cref="Task"/> in calls to <see cref="GetOperationStatusAsync"/>
/// until it returns either <see cref="OperationStatus.Succeeded"/> or <see cref="OperationStatus.Failed"/>.</remarks>
public Task<string> StopDeploymentAsync(string cloudServiceName, DeploymentSlot slot, CancellationToken token = default(CancellationToken))
{
Validation.ValidateStringArg(cloudServiceName, "cloudServiceName");
UpdateDeploymentStatusInfo info = UpdateDeploymentStatusInfo.Create(false);
HttpRequestMessage message = CreateBaseMessage(HttpMethod.Post, CreateTargetUri(UriFormatStrings.DeploymentSlotUpdateStatus, cloudServiceName, slot.ToString()), info);
return StartSendTask(message, token);
}
示例14: GetDeploymentAsync
/// <summary>
/// Begins an asychronous operation to get properties for a deployment.
/// </summary>
/// <param name="cloudServiceName">The name of the cloud service which contains the deployment. Required.</param>
/// <param name="slot">The <see cref="DeploymentSlot"/> which contains the deployment.</param>
/// <param name="token">An optional <see cref="CancellationToken"/>.</param>
/// <returns>A <see cref="Task"/> which returns a <see cref="Deployment"/>.</returns>
public Task<Deployment> GetDeploymentAsync(string cloudServiceName, DeploymentSlot slot, CancellationToken token = default(CancellationToken))
{
Validation.ValidateStringArg(cloudServiceName, "cloudServiceName");
HttpRequestMessage message = CreateBaseMessage(HttpMethod.Get, CreateTargetUri(UriFormatStrings.DeploymentSlot, cloudServiceName, slot.ToString()));
return StartGetTask<Deployment>(message, token);
}
示例15: SetAzureReservedIPAssociationSimpleBySlot
private void SetAzureReservedIPAssociationSimpleBySlot(DeploymentSlot slot)
{
SetAzureReservedIPAssociationCmdlet setassociation = new SetAzureReservedIPAssociationCmdlet(testClientProvider)
{
ReservedIPName = ReservedIPName,
ServiceName = ServiceName,
Slot = slot.ToString(),
CommandRuntime = mockCommandRuntime,
};
// Action
setassociation.ExecuteCmdlet();
// Assert
computeClientMock.Verify(
c => c.Deployments.GetBySlotAsync(
ServiceName,
slot,
It.IsAny<CancellationToken>()),
Times.Once);
networkingClientMock.Verify(
c => c.ReservedIPs.AssociateAsync(
ReservedIPName,
It.Is<NetworkReservedIPMobilityParameters>(
p =>
string.Equals(p.ServiceName, ServiceName) &&
string.IsNullOrEmpty(p.VirtualIPName) && string.Equals(p.DeploymentName, DeploymentName)),
It.IsAny<CancellationToken>()),
Times.Once());
Assert.Equal(1, mockCommandRuntime.OutputPipeline.Count);
Assert.Equal("Succeeded", ((ManagementOperationContext) mockCommandRuntime.OutputPipeline[0]).OperationStatus);
}