本文整理汇总了C#中DeploymentSlot类的典型用法代码示例。如果您正苦于以下问题:C# DeploymentSlot类的具体用法?C# DeploymentSlot怎么用?C# DeploymentSlot使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DeploymentSlot类属于命名空间,在下文中一共展示了DeploymentSlot类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetAzureDeyployment
/// <summary>
/// Returns a list of Deployment objects for a given subscription
/// </summary>
/// <param name="serviceName">The name of the cloud service</param>
/// <param name="slot">The slot being either Production or Staging</param>
/// <returns></returns>
protected DeploymentGetResponse GetAzureDeyployment(string serviceName, DeploymentSlot slot)
{
ComputeManagementClient client = new ComputeManagementClient(MyCloudCredentials);
try
{
try
{
return client.Deployments.GetBySlot(serviceName, slot);
}
catch (CloudException ex)
{
if (ex.ErrorCode == "ResourceNotFound")
{
Logger.Warn(ex, String.Format("Resource not found during retrieval of Deployment object for service: {0}, {1}", serviceName, ex.ErrorCode));
return null;
}
else
{
Logger.Warn(ex, String.Format("Exception during retrieval of Deployment objects for the service: {0}, Errorcode: {1}", serviceName, ex.ErrorCode));
return null;
}
}
}
catch (Exception e)
{
Logger.Warn(e, String.Format("Exception during retrieval of Deployment objects for the service: {0}", serviceName));
return null;
}
}
示例2: RoleContextManager
/// <summary>
/// Used to create a role context
/// </summary>
internal RoleContextManager(string subscriptionId, X509Certificate2 certificate, string serviceName, DeploymentSlot slot)
{
SubscriptionId = subscriptionId;
ManagementCertificate = certificate;
ServiceName = serviceName;
DeploymentSlot = slot;
}
示例3: 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;
}
示例4: ServiceClient
/// <summary>
/// Used to construct the ServiceClient
/// </summary>
public ServiceClient(string subscriptionId, X509Certificate2 certificate, string cloudService, DeploymentSlot slot = DeploymentSlot.Production)
{
SubscriptionId = subscriptionId;
ManagementCertificate = certificate;
Name = cloudService;
Slot = slot;
}
示例5: 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;
}
}
}
示例6: 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;
}
示例7: 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;
}
示例8: ChangeDeploymentConfiguration
public virtual async Task<OperationResponse> ChangeDeploymentConfiguration(XDocument serviceConfiguration, DeploymentSlot slot = DeploymentSlot.Production)
{
return await ChangeDeploymentConfiguration(new DeploymentChangeConfigurationParameters
{
Configuration = serviceConfiguration.ToString(),
Mode = DeploymentChangeConfigurationMode.Auto,
}, slot);
}
示例9: 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";
}
示例10: 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;
}
示例11: SetDeploymenConfigurationCommand
/// <summary>
/// Constructs a SetDeploymenConfigurationCommand command
/// </summary>
// POST https://management.core.windows.net/<subscription-id>/services/hostedservices/<service-name>/deploymentslots/<deployment-slot>/?comp=config
internal SetDeploymenConfigurationCommand(string serviceName, CscfgFile config, 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 = (CloudServiceName = serviceName) + "/deploymentslots/" + (Slot = slot).ToString().ToLower() + "/?comp=config";
Configuration = config;
HttpVerb = HttpVerbPost;
}
示例12: 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;
}
示例13: Deployment
public Deployment(string deploymentName, DeploymentSlot deploymentSlot, ServiceConfiguration serviceConfig)
: this()
{
Contract.Requires(deploymentName != null);
Contract.Requires(serviceConfig != null);
Name = Label = deploymentName;
Slot = deploymentSlot;
Configuration = serviceConfig;
}
示例14: 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);
}
示例15: GetRoleInstanceCount
public Task<int> GetRoleInstanceCount(string serviceName, string roleName, DeploymentSlot deploymentSlot, CancellationToken cancellationToken)
{
var client = HttpClientFactory.Create(_subscriptionId, _certificate);
var completionSource = new TaskCompletionSource<int>();
DoGetDeploymentConfiguration(client, serviceName, deploymentSlot, cancellationToken).ContinuePropagateWith(
completionSource, cancellationToken,
queryTask => completionSource.TrySetResult(Int32.Parse(GetInstanceCountConfigElement(queryTask.Result, roleName).Value)));
completionSource.Task.ContinueRaiseSystemEventOnFault(_observer, EventForFailedOperation);
return completionSource.Task;
}