本文整理汇总了C#中AzureService类的典型用法代码示例。如果您正苦于以下问题:C# AzureService类的具体用法?C# AzureService怎么用?C# AzureService使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AzureService类属于命名空间,在下文中一共展示了AzureService类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: SetDeploymentStatusProcessDeploymentDoesNotExistTest
public void SetDeploymentStatusProcessDeploymentDoesNotExistTest()
{
SimpleServiceManagement channel = new SimpleServiceManagement();
string newStatus = DeploymentStatus.Running;
string resultMessage;
string expectedMessage = string.Format(Resources.ServiceSlotDoesNotExist, slot, serviceName);
bool statusUpdated = false;
channel.UpdateDeploymentStatusBySlotThunk = ar =>
{
statusUpdated = true;
channel.GetDeploymentBySlotThunk = ar2 => new Deployment{Name = serviceName, DeploymentSlot = slot, Status = newStatus};
};
channel.GetDeploymentBySlotThunk = ar => { throw new ServiceManagementClientException(HttpStatusCode.NotFound, new ServiceManagementError(), string.Empty); };
using (FileSystemHelper files = new FileSystemHelper(this))
{
files.CreateAzureSdkDirectoryAndImportPublishSettings();
AzureService service = new AzureService(files.RootPath, serviceName, null);
var deploymentManager = new DeploymentStatusManager(channel);
deploymentManager.ShareChannel = true;
deploymentManager.CommandRuntime = new MockCommandRuntime();
deploymentManager.SetDeploymentStatusProcess(service.Paths.RootPath, newStatus, slot, Data.ValidSubscriptionNames[0], serviceName);
resultMessage = ((MockCommandRuntime)deploymentManager.CommandRuntime).WarningStream[0];
Assert.IsFalse(statusUpdated);
Assert.IsTrue(resultMessage.Contains(expectedMessage));
Assert.IsTrue(((MockCommandRuntime)deploymentManager.CommandRuntime).OutputPipeline.Count.Equals(0));
}
}
开发者ID:huangpf,项目名称:azure-sdk-tools,代码行数:29,代码来源:DeploymentStatusManagerTests.cs
示例2: StartAzureEmulatorProcess
public AzureService StartAzureEmulatorProcess(string rootPath)
{
string standardOutput;
string standardError;
StringBuilder message = new StringBuilder();
AzureService service = new AzureService(rootPath ,null);
if (Directory.Exists(service.Paths.LocalPackage))
{
WriteVerbose(string.Format(Resources.RemovePackage, service.Paths.LocalPackage));
Directory.Delete(service.Paths.LocalPackage, true);
}
WriteVerbose(string.Format(Resources.CreatingPackageMessage, "local"));
service.CreatePackage(DevEnv.Local, out standardOutput, out standardError);
WriteVerbose(Resources.StartingEmulator);
service.StartEmulator(Launch.ToBool(), out standardOutput, out standardError);
WriteVerbose(standardOutput);
WriteVerbose(Resources.StartedEmulator);
SafeWriteOutputPSObject(
service.GetType().FullName,
Parameters.ServiceName, service.ServiceName,
Parameters.RootPath, service.Paths.RootPath);
return service;
}
开发者ID:bielawb,项目名称:azure-sdk-tools,代码行数:29,代码来源:StartAzureEmulator.cs
示例3: RemoveAzureServiceProcessTest
public void RemoveAzureServiceProcessTest()
{
bool serviceDeleted = false;
bool deploymentDeleted = false;
channel.GetDeploymentBySlotThunk = ar =>
{
if (deploymentDeleted) throw new EndpointNotFoundException();
return new Deployment(serviceName, ArgumentConstants.Slots[Slot.Production], DeploymentStatus.Suspended);
};
channel.DeleteHostedServiceThunk = ar => serviceDeleted = true;
channel.DeleteDeploymentBySlotThunk = ar =>
{
deploymentDeleted = true;
};
channel.IsDNSAvailableThunk = ida => new AvailabilityResponse { Result = false };
using (FileSystemHelper files = new FileSystemHelper(this))
{
files.CreateAzureSdkDirectoryAndImportPublishSettings();
AzureService service = new AzureService(files.RootPath, serviceName, null);
removeServiceCmdlet.PassThru = true;
removeServiceCmdlet.RemoveAzureServiceProcess(service.Paths.RootPath, string.Empty, serviceName);
Assert.IsTrue(deploymentDeleted);
Assert.IsTrue(serviceDeleted);
Assert.IsTrue((bool)mockCommandRuntime.OutputPipeline[0]);
}
}
开发者ID:bielawb,项目名称:azure-sdk-tools,代码行数:27,代码来源:RemoveAzureServiceTests.cs
示例4: SetDeploymentStatusProcessDeploymentDoesNotExistTest
public void SetDeploymentStatusProcessDeploymentDoesNotExistTest()
{
SimpleServiceManagement channel = new SimpleServiceManagement();
string newStatus = DeploymentStatus.Running;
string resultMessage;
string expectedMessage = string.Format(Resources.ServiceSlotDoesNotExist, serviceName, slot);
bool statusUpdated = false;
channel.UpdateDeploymentStatusBySlotThunk = ar =>
{
statusUpdated = true;
channel.GetDeploymentBySlotThunk = ar2 => new Deployment(serviceName, slot, newStatus);
};
channel.GetDeploymentBySlotThunk = ar => { throw new EndpointNotFoundException(); };
using (FileSystemHelper files = new FileSystemHelper(this))
{
files.CreateAzureSdkDirectoryAndImportPublishSettings();
AzureService service = new AzureService(files.RootPath, serviceName, null);
var deploymentManager = new DeploymentStatusManager(channel);
deploymentManager.ShareChannel = true;
resultMessage = deploymentManager.SetDeploymentStatusProcess(service.Paths.RootPath, newStatus, slot, Data.ValidSubscriptionName[0], serviceName);
Assert.IsFalse(statusUpdated);
Assert.AreEqual<string>(expectedMessage, resultMessage);
}
}
开发者ID:nicopeelen,项目名称:azure-sdk-tools,代码行数:26,代码来源:DeploymentStatusManagerTests.cs
示例5: GetAzureRuntimesProcess
/// <summary>
/// Retrieve the runtimes from the given manifest, or from the default cloud location, if none given.
/// The manifest parameter is mainly a testing hook.
/// </summary>
/// <param name="runtimeType">The runtime type to filter by</param>
/// <param name="rootPath">The path to the service in question</param>
/// <param name="manifest">The path to the manifest file, if null, the default cloud manifest is used (test hook)</param>
public void GetAzureRuntimesProcess(string runtimeType, string rootPath, string manifest = null)
{
AzureService service = new AzureService(rootPath, null);
CloudRuntimeCollection runtimes = service.GetCloudRuntimes(service.Paths, manifest);
WriteObject(runtimes.Where<CloudRuntimePackage>(p => string.IsNullOrEmpty(runtimeType) ||
p.Runtime == CloudRuntime.GetRuntimeByType(runtimeType)), true);
}
开发者ID:nickchal,项目名称:pash,代码行数:14,代码来源:GetAzureServiceProjectRoleRuntime.cs
示例6: EnableRemoteDesktop
public void EnableRemoteDesktop()
{
Validate.ValidateStringIsNullOrEmpty(Username, "Username");
if (Password == null)
{
throw new ArgumentNullException("Password");
}
string plainPassword = GetPlainPassword();
if (!IsPasswordComplex(plainPassword))
{
throw new ArgumentException(Properties.Resources.EnableAzureRemoteDesktopCommand_Enable_NeedComplexPassword);
}
AzureService service = new AzureService(GetServiceRootPath(), null);
WebRole[] webRoles = service.Components.Definition.WebRole ?? new WebRole[0];
WorkerRole[] workerRoles = service.Components.Definition.WorkerRole ?? new WorkerRole[0];
string forwarderName = GetForwarderName(webRoles, workerRoles);
RemoveOtherRemoteForwarders(webRoles, workerRoles, forwarderName);
AddRemoteAccess(webRoles, workerRoles);
X509Certificate2 cert = ChooseCertificate();
ServiceConfigurationSchema.Certificate certElement = new ServiceConfigurationSchema.Certificate
{
name = "Microsoft.WindowsAzure.Plugins.RemoteAccess.PasswordEncryption",
thumbprintAlgorithm = ThumbprintAlgorithmTypes.sha1,
thumbprint = cert.Thumbprint
};
string encryptedPassword = Encrypt(plainPassword, cert);
UpdateServiceConfigurations(service, forwarderName, certElement, encryptedPassword);
service.Components.Save(service.Paths);
}
开发者ID:nickchal,项目名称:pash,代码行数:34,代码来源:EnableAzureRemoteDesktop.cs
示例7: GetNextPortAllNull
public void GetNextPortAllNull()
{
using (FileSystemHelper files = new FileSystemHelper(this))
{
int expectedPort = int.Parse(Resources.DefaultWebPort);
AzureService service = new AzureService(files.RootPath, serviceName, null);
int nextPort = service.Components.GetNextPort();
Assert.AreEqual<int>(expectedPort, nextPort);
}
}
开发者ID:bielawb,项目名称:azure-sdk-tools,代码行数:10,代码来源:ServiceComponentsTests.cs
示例8: StopAzureEmulatorProcess
public string StopAzureEmulatorProcess()
{
string standardOutput;
string standardError;
AzureService service = new AzureService();
SafeWriteObject(Resources.StopEmulatorMessage);
service.StopEmulator(out standardOutput, out standardError);
SafeWriteObject(Resources.StoppedEmulatorMessage);
return null;
}
开发者ID:paulyuk,项目名称:azure-sdk-tools,代码行数:11,代码来源:StopAzureEmulator.cs
示例9: GetNextPortNodeWebRoleNull
public void GetNextPortNodeWebRoleNull()
{
using (FileSystemHelper files = new FileSystemHelper(this))
{
int expectedPort = int.Parse(Resources.DefaultPort);
AzureService service = new AzureService(files.RootPath, serviceName, null);
service.AddWorkerRole(Data.NodeWorkerRoleScaffoldingPath);
service = new AzureService(service.Paths.RootPath, null);
int nextPort = service.Components.GetNextPort();
Assert.AreEqual<int>(expectedPort, nextPort);
}
}
开发者ID:bielawb,项目名称:azure-sdk-tools,代码行数:12,代码来源:ServiceComponentsTests.cs
示例10: CreateLocalPackageWithNodeWorkerRoleTest
public void CreateLocalPackageWithNodeWorkerRoleTest()
{
using (FileSystemHelper files = new FileSystemHelper(this))
{
string standardOutput;
string standardError;
AzureService service = new AzureService(files.RootPath, serviceName, null);
service.AddWorkerRole(Data.NodeWorkerRoleScaffoldingPath);
service.CreatePackage(DevEnv.Local, out standardOutput, out standardError);
AzureAssert.ScaffoldingExists(Path.Combine(service.Paths.LocalPackage, @"roles\WorkerRole1\approot"), Path.Combine(Resources.NodeScaffolding, Resources.WorkerRole));
}
}
开发者ID:bielawb,项目名称:azure-sdk-tools,代码行数:13,代码来源:CsPackTests.cs
示例11: NewAzureServiceProcess
internal string NewAzureServiceProcess(string parentDirectory, string serviceName)
{
string message;
AzureService newService;
// Create scaffolding structure
//
newService = new AzureService(parentDirectory, serviceName, null);
message = string.Format(Resources.NewServiceCreatedMessage, newService.Paths.RootPath);
return message;
}
开发者ID:nickchal,项目名称:pash,代码行数:13,代码来源:NewAzureServiceProject.cs
示例12: GetNextPortAddingThirdEndpoint
public void GetNextPortAddingThirdEndpoint()
{
using (FileSystemHelper files = new FileSystemHelper(this))
{
int expectedPort = int.Parse(Resources.DefaultPort) + 1;
AzureService service = new AzureService(files.RootPath, serviceName, null);
service.AddWebRole(Resources.NodeScaffolding);
service.AddWebRole(Resources.PHPScaffolding);
service = new AzureServiceWrapper(service.Paths.RootPath, null);
int nextPort = service.Components.GetNextPort();
Assert.AreEqual<int>(expectedPort, nextPort);
}
}
开发者ID:nicopeelen,项目名称:azure-sdk-tools,代码行数:13,代码来源:ServiceComponentsTests.cs
示例13: DisableRemoteDesktop
public void DisableRemoteDesktop()
{
AzureService service = new AzureService(GetServiceRootPath(), null);
WebRole[] webRoles = service.Components.Definition.WebRole ?? new WebRole[0];
WorkerRole[] workerRoles = service.Components.Definition.WorkerRole ?? new WorkerRole[0];
string forwarderName = GetForwarderName(webRoles, workerRoles);
if (forwarderName != null)
{
UpdateServiceConfigurations(service, forwarderName);
service.Components.Save(service.Paths);
}
}
开发者ID:paulyuk,项目名称:azure-sdk-tools,代码行数:13,代码来源:DisableAzureRemoteDesktop.cs
示例14: StartAzureEmulatorProcess
public string StartAzureEmulatorProcess(string rootPath)
{
string standardOutput;
string standardError;
StringBuilder message = new StringBuilder();
AzureService service = new AzureService(rootPath ,null);
SafeWriteObject(string.Format(Resources.CreatingPackageMessage, "local"));
service.CreatePackage(DevEnv.Local, out standardOutput, out standardError);
SafeWriteObject(Resources.StartingEmulator);
service.StartEmulator(Launch.ToBool(), out standardOutput, out standardError);
SafeWriteObject(standardOutput);
SafeWriteObject(Resources.StartedEmulator);
return message.ToString();
}
开发者ID:nickchal,项目名称:pash,代码行数:15,代码来源:StartAzureEmulator.cs
示例15: StopAzureEmulatorProcess
public void StopAzureEmulatorProcess()
{
string standardOutput;
string standardError;
AzureService service = new AzureService();
WriteVerbose(Resources.StopEmulatorMessage);
service.StopEmulator(out standardOutput, out standardError);
WriteVerbose(Resources.StoppedEmulatorMessage);
if (PassThru.IsPresent)
{
WriteObject(true);
}
}
开发者ID:bielawb,项目名称:azure-sdk-tools,代码行数:16,代码来源:StopAzureEmulator.cs
示例16: NewAzureServiceProcess
internal AzureService NewAzureServiceProcess(string parentDirectory, string serviceName)
{
// Create scaffolding structure
//
AzureService newService = new AzureService(parentDirectory, serviceName, null);
SafeWriteOutputPSObject(
newService.GetType().FullName,
Parameters.ServiceName, newService.ServiceName,
Parameters.RootPath, newService.Paths.RootPath
);
WriteVerbose(string.Format(Resources.NewServiceCreatedMessage, newService.Paths.RootPath));
return newService;
}
开发者ID:bielawb,项目名称:azure-sdk-tools,代码行数:16,代码来源:NewAzureServiceProject.cs
示例17: AddAzureDjangoWebRoleProcess
internal string AddAzureDjangoWebRoleProcess(string webRoleName, int instances, string rootPath)
{
string result;
AzureService service = new AzureService(rootPath, null);
RoleInfo webRole = service.AddDjangoWebRole(webRoleName, instances);
// let Django create it's scaffolding
var interpPath = FindPythonInterpreterPath();
if (interpPath != null)
{
string stdOut, stdErr;
Environment.CurrentDirectory = Path.Combine(rootPath, webRole.Name);
ProcessHelper.StartAndWaitForProcess(
new ProcessStartInfo(
Path.Combine(interpPath, PythonInterpreterExe),
String.Format(DjangoStartProjectCommand, webRole.Name)
),
out stdOut,
out stdErr
);
if (!string.IsNullOrEmpty(stdErr))
{
SafeWriteObject(String.Format(Resources.UnableToCreateDjangoApp, stdErr));
SafeWriteObject(Resources.UnableToCreateDjangoAppFix);
}
}
else
{
SafeWriteObject(Resources.MissingPythonPreReq);
}
try
{
service.ChangeRolePermissions(webRole);
}
catch (UnauthorizedAccessException)
{
SafeWriteObject(Resources.AddRoleMessageInsufficientPermissions);
SafeWriteObject(Environment.NewLine);
}
result = string.Format(Resources.AddRoleMessageCreatePython, rootPath, webRole.Name);
return result;
}
开发者ID:nicopeelen,项目名称:azure-sdk-tools,代码行数:46,代码来源:AddAzureDjangoWebRole.cs
示例18: DisableRemoteDesktop
public void DisableRemoteDesktop()
{
AzureService service = new AzureService(CloudServiceUtilities.GetServiceRootPath(CurrentPath()), null);
WebRole[] webRoles = service.Components.Definition.WebRole ?? new WebRole[0];
WorkerRole[] workerRoles = service.Components.Definition.WorkerRole ?? new WorkerRole[0];
string forwarderName = GetForwarderName(webRoles, workerRoles);
if (forwarderName != null)
{
UpdateServiceConfigurations(service, forwarderName);
service.Components.Save(service.Paths);
}
if (PassThru)
{
WriteObject(true);
}
}
开发者ID:huangpf,项目名称:azure-sdk-tools,代码行数:18,代码来源:DisableAzureRemoteDesktop.cs
示例19: AddAzurePHPWebRoleProcess
internal string AddAzurePHPWebRoleProcess(string webRoleName, int instances, string rootPath)
{
string result;
AzureService service = new AzureService(rootPath, null);
RoleInfo webRole = service.AddWebRole(Resources.PHPScaffolding, webRoleName, instances);
try
{
service.ChangeRolePermissions(webRole);
}
catch (UnauthorizedAccessException)
{
SafeWriteObject(Resources.AddRoleMessageInsufficientPermissions);
SafeWriteObject(Environment.NewLine);
}
result = string.Format(Resources.AddRoleMessageCreate, rootPath, webRole.Name);
return result;
}
开发者ID:nickchal,项目名称:pash,代码行数:18,代码来源:AddAzurePHPWebRole.cs
示例20: CreateLocalPackageWithOneNodeWebRoleTest
public void CreateLocalPackageWithOneNodeWebRoleTest()
{
using (FileSystemHelper files = new FileSystemHelper(this))
{
string standardOutput;
string standardError;
AzureService service = new AzureService(files.RootPath, serviceName, null);
RoleInfo webRoleInfo = service.AddWebRole(Data.NodeWebRoleScaffoldingPath);
string logsDir = Path.Combine(service.Paths.RootPath, webRoleInfo.Name, "server.js.logs");
string logFile = Path.Combine(logsDir, "0.txt");
string targetLogsFile = Path.Combine(service.Paths.LocalPackage, "roles", webRoleInfo.Name, @"approot\server.js.logs\0.txt");
files.CreateDirectory(logsDir);
files.CreateEmptyFile(logFile);
service.CreatePackage(DevEnv.Local, out standardOutput, out standardError);
AzureAssert.ScaffoldingExists(Path.Combine(service.Paths.LocalPackage, @"roles\WebRole1\approot"), Path.Combine(Resources.NodeScaffolding, Resources.WebRole));
Assert.IsTrue(File.Exists(targetLogsFile));
}
}
开发者ID:bielawb,项目名称:azure-sdk-tools,代码行数:19,代码来源:CsPackTests.cs
注:本文中的AzureService类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论