本文整理汇总了C#中Deployment类的典型用法代码示例。如果您正苦于以下问题:C# Deployment类的具体用法?C# Deployment怎么用?C# Deployment使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Deployment类属于命名空间,在下文中一共展示了Deployment类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SummaryInfo
/// <summary>
/// Creates a new instance of the <see cref="SummaryInfo"/> class copying values
/// from the <see cref="Deployment.WindowsInstaller.SummaryInfo"/> object.
/// </summary>
/// <param name="info">The <see cref="Deployment.WindowsInstaller.SummaryInfo"/> from which to copy values.</param>
/// <exception cref="ArgumentNullException">The parameter <paramref name="info"/> is null.</exception>
internal SummaryInfo(Deployment.WindowsInstaller.SummaryInfo info)
{
if (null == info)
{
throw new ArgumentNullException("info");
}
this.Author = info.Author;
this.CharacterCount = info.CharacterCount;
this.CodePage = info.CodePage;
this.Comments = info.Comments;
this.CreateTime = info.CreateTime;
this.CreatingApp = info.CreatingApp;
this.Keywords = info.Keywords;
this.LastPrintTime = info.LastPrintTime;
this.LastSavedBy = info.LastSavedBy;
this.LastSaveTime = info.LastSaveTime;
this.PageCount = info.PageCount;
this.RevisionNumber = info.RevisionNumber;
this.Security = info.Security;
this.Subject = info.Subject;
this.Template = info.Template;
this.Title = info.Title;
this.WordCount = info.WordCount;
}
示例2: DeploymentStatusClientTests
public DeploymentStatusClientTests()
{
var github = Helper.GetAuthenticatedClient();
_deploymentsClient = github.Repository.Deployment;
_context = github.CreateRepositoryContext("public-repo").Result;
var blob = new NewBlob
{
Content = "Hello World!",
Encoding = EncodingType.Utf8
};
var blobResult = github.Git.Blob.Create(_context.RepositoryOwner, _context.RepositoryName, blob).Result;
var newTree = new NewTree();
newTree.Tree.Add(new NewTreeItem
{
Type = TreeType.Blob,
Mode = FileMode.File,
Path = "README.md",
Sha = blobResult.Sha
});
var treeResult = github.Git.Tree.Create(_context.RepositoryOwner, _context.RepositoryName, newTree).Result;
var newCommit = new NewCommit("test-commit", treeResult.Sha);
var commit = github.Git.Commit.Create(_context.RepositoryOwner, _context.RepositoryName, newCommit).Result;
var newDeployment = new NewDeployment(commit.Sha) { AutoMerge = false };
_deployment = _deploymentsClient.Create(_context.RepositoryOwner, _context.RepositoryName, newDeployment).Result;
}
示例3: NameSpecifiedAndRoleInstanceListDoesNotHaveMatchingRoleInstanceInDeployment
public void NameSpecifiedAndRoleInstanceListDoesNotHaveMatchingRoleInstanceInDeployment()
{
var deployment = new Deployment
{
Url = AnyUrl(),
RoleInstanceList = new RoleInstanceList
{
new RoleInstance()
}
};
var winRmUri = new GetAzureWinRMUriStub(deployment)
{
Name = AnyString(),
CommandRuntime = mockCommandRuntime
};
try
{
winRmUri.ExecuteCommandBody();
Assert.Fail("Should never reach here.");
}
catch (ArgumentOutOfRangeException)
{
}
Assert.AreEqual(0, mockCommandRuntime.OutputPipeline.Count, "Nothing should be written to output pipeline");
}
示例4: UpdateDeploymentSlofIfEmpty
Deployment UpdateDeploymentSlofIfEmpty(Deployment deployment)
{
if (string.IsNullOrEmpty(deployment.DeploymentSlot))
{
deployment.DeploymentSlot = this.Slot;
}
return deployment;
}
示例5: DeployRelease
public static Deployment DeployRelease(this IOctopusSession session, Release release, DeploymentEnvironment environment, bool forceRedeploymentOfExistingPackages = false)
{
var deployment = new Deployment();
deployment.EnvironmentId = environment.Id;
deployment.ReleaseId = release.Id;
deployment.ForceRedeployment = forceRedeploymentOfExistingPackages;
return session.Create(release.Link("Deployments"), deployment);
}
示例6: KickItOutThereAlready
public static void KickItOutThereAlready(Deployment deployment, DeploymentArguments args)
{
_inspector = new DropkickDeploymentInspector(args.ServerMappings);
if (args.Role != "ALL") _inspector.RolesToGet(args.Role.Split(','));
var plan = _inspector.GetPlan(deployment);
//HOW TO PLUG IN args.Role
//TODO: should be able to block here
_actions[args.Command](plan);
}
示例7: KickItOutThereAlready
public static DeploymentResult KickItOutThereAlready(Deployment deployment, DeploymentArguments args)
{
_inspector = new DropkickDeploymentInspector(args.ServerMappings);
if (args.Role != "ALL") _inspector.RolesToGet(args.Role.Split(','));
var plan = _inspector.GetPlan(deployment);
plan.AbortOnError = args.AbortOnError;
//HOW TO PLUG IN args.Role
//TODO: should be able to block here
return plan.Run(args.Command);
}
示例8: NoUrlInDeployment
//[TestMethod]
public void NoUrlInDeployment()
{
var deployment = new Deployment();
var winRmUri = new GetAzureWinRMUriStub(deployment)
{
CommandRuntime = mockCommandRuntime
};
try
{
winRmUri.ExecuteCommandBody();
Assert.Fail("Should throw argument out of range exception");
}
catch (ArgumentOutOfRangeException)
{
}
}
示例9: SelectTargetPortalDialog
public SelectTargetPortalDialog(Deployment deployment)
{
InitializeComponent();
var targetPortals = deployment.Targets
.SelectMany(target => target.Portals.Select(portal => new TargetPortalInfo(target, portal)))
.ToList();
cboTargetPortals.DataSource = targetPortals;
//default to last deployed target portal
if (_lastDeployedPortal != null)
{
var portalFromList = targetPortals.FirstOrDefault(portal => portal.TargetPortal == _lastDeployedPortal);
if (portalFromList != null)
cboTargetPortals.SelectedItem = portalFromList;
}
}
示例10: DeploymentStatusClientTests
public DeploymentStatusClientTests()
{
_gitHubClient = new GitHubClient(new ProductHeaderValue("OctokitTests"))
{
Credentials = Helper.Credentials
};
_deploymentsClient = _gitHubClient.Repository.Deployment;
var newRepository = new NewRepository
{
Name = Helper.MakeNameWithTimestamp("public-repo"),
AutoInit = true
};
_repository = _gitHubClient.Repository.Create(newRepository).Result;
_repositoryOwner = _repository.Owner.Login;
var blob = new NewBlob
{
Content = "Hello World!",
Encoding = EncodingType.Utf8
};
var blobResult = _gitHubClient.GitDatabase.Blob.Create(_repositoryOwner, _repository.Name, blob).Result;
var newTree = new NewTree();
newTree.Tree.Add(new NewTreeItem
{
Type = TreeType.Blob,
Mode = FileMode.File,
Path = "README.md",
Sha = blobResult.Sha
});
var treeResult = _gitHubClient.GitDatabase.Tree.Create(_repositoryOwner, _repository.Name, newTree).Result;
var newCommit = new NewCommit("test-commit", treeResult.Sha);
_commit = _gitHubClient.GitDatabase.Commit.Create(_repositoryOwner, _repository.Name, newCommit).Result;
var newDeployment = new NewDeployment { Ref = _commit.Sha };
_deployment = _deploymentsClient.Create(_repositoryOwner, _repository.Name, newDeployment).Result;
}
示例11: NameSpecifiedAndNoRoleInstanceListInDeployment
public void NameSpecifiedAndNoRoleInstanceListInDeployment()
{
var deployment = new Deployment
{
Url = AnyUrl()
};
var winRmUri = new GetAzureWinRMUriStub(deployment)
{
CommandRuntime = mockCommandRuntime,
Name = AnyString()
};
try
{
winRmUri.ExecuteCommandBody();
Assert.Fail("Should throw argument out of range exception");
}
catch (ArgumentOutOfRangeException)
{
}
}
示例12: DeploymentInfoContext
public DeploymentInfoContext(Deployment innerDeployment)
{
this.innerDeployment = innerDeployment;
if (this.innerDeployment.RoleInstanceList != null)
{
this.RoleInstanceList = new List<AzureDeploymentCmdlets.Concrete.RoleInstance>();
foreach (var roleInstance in this.innerDeployment.RoleInstanceList)
{
this.RoleInstanceList.Add(new AzureDeploymentCmdlets.Concrete.RoleInstance(roleInstance));
}
}
if (!string.IsNullOrEmpty(this.innerDeployment.Configuration))
{
string xmlString = ServiceManagementHelper.DecodeFromBase64String(this.innerDeployment.Configuration);
XDocument doc = null;
using (var stringReader = new StringReader(xmlString))
{
XmlReader reader = XmlReader.Create(stringReader);
doc = XDocument.Load(reader);
}
this.OSVersion = doc.Root.Attribute("osVersion") != null ?
doc.Root.Attribute("osVersion").Value :
string.Empty;
this.RolesConfiguration = new Dictionary<string, RoleConfiguration>();
var roles = doc.Root.Descendants(this.ns + "Role");
foreach (var role in roles)
{
this.RolesConfiguration.Add(role.Attribute("name").Value, new RoleConfiguration(role));
}
}
}
示例13: DeploymentStatusClientTests
public DeploymentStatusClientTests()
{
var gitHubClient = Helper.GetAuthenticatedClient();
_deploymentsClient = gitHubClient.Repository.Deployment;
var newRepository = new NewRepository(Helper.MakeNameWithTimestamp("public-repo"))
{
AutoInit = true
};
_repository = gitHubClient.Repository.Create(newRepository).Result;
_repositoryOwner = _repository.Owner.Login;
var blob = new NewBlob
{
Content = "Hello World!",
Encoding = EncodingType.Utf8
};
var blobResult = gitHubClient.GitDatabase.Blob.Create(_repositoryOwner, _repository.Name, blob).Result;
var newTree = new NewTree();
newTree.Tree.Add(new NewTreeItem
{
Type = TreeType.Blob,
Mode = FileMode.File,
Path = "README.md",
Sha = blobResult.Sha
});
var treeResult = gitHubClient.GitDatabase.Tree.Create(_repositoryOwner, _repository.Name, newTree).Result;
var newCommit = new NewCommit("test-commit", treeResult.Sha);
var commit = gitHubClient.GitDatabase.Commit.Create(_repositoryOwner, _repository.Name, newCommit).Result;
var newDeployment = new NewDeployment(commit.Sha) { AutoMerge = false };
_deployment = _deploymentsClient.Create(_repositoryOwner, _repository.Name, newDeployment).Result;
}
示例14: GetStatus
public string GetStatus(string serviceName, string slot)
{
Deployment deployment = new Deployment();
try
{
InvokeInOperationContext(() =>
{
deployment = this.RetryCall<Deployment>(s => this.Channel.GetDeploymentBySlot(s, serviceName, slot));
});
}
catch (ServiceManagementClientException ex)
{
if(ex.HttpStatus == HttpStatusCode.NotFound)
{
throw new EndpointNotFoundException(string.Format(Resources.ServiceSlotDoesNotExist, slot, serviceName));
}
}
return deployment.Status;
}
示例15: NewAzureVMProcess
public void NewAzureVMProcess()
{
SubscriptionData currentSubscription = this.GetCurrentSubscription();
CloudStorageAccount currentStorage = null;
try
{
currentStorage = currentSubscription.GetCurrentStorageAccount(Channel);
}
catch (EndpointNotFoundException) // couldn't access
{
throw new ArgumentException("CurrentStorageAccount is not accessible. Ensure the current storage account is accessible and in the same location or affinity group as your cloud service.");
}
if (currentStorage == null) // not set
{
throw new ArgumentException("CurrentStorageAccount is not set. Use Set-AzureSubscription subname -CurrentStorageAccount storageaccount to set it.");
}
var vm = new PersistentVMRole
{
AvailabilitySetName = AvailabilitySetName,
ConfigurationSets = new Collection<ConfigurationSet>(),
DataVirtualHardDisks = new Collection<DataVirtualHardDisk>(),
RoleName = String.IsNullOrEmpty(Name) ? ServiceName : Name, // default like the portal
RoleSize = String.IsNullOrEmpty(InstanceSize) ? null : InstanceSize,
RoleType = "PersistentVMRole",
Label = ServiceManagementHelper.EncodeToBase64String(ServiceName)
};
vm.OSVirtualHardDisk = new OSVirtualHardDisk()
{
DiskName = null,
SourceImageName = ImageName,
MediaLink = string.IsNullOrEmpty(MediaLocation) ? null : new Uri(MediaLocation),
HostCaching = HostCaching
};
if (vm.OSVirtualHardDisk.MediaLink == null && String.IsNullOrEmpty(vm.OSVirtualHardDisk.DiskName))
{
DateTime dtCreated = DateTime.Now;
string vhdname = String.Format("{0}-{1}-{2}-{3}-{4}-{5}.vhd", this.ServiceName, vm.RoleName, dtCreated.Year, dtCreated.Month, dtCreated.Day, dtCreated.Millisecond);
string blobEndpoint = currentStorage.BlobEndpoint.AbsoluteUri;
if (blobEndpoint.EndsWith("/") == false)
blobEndpoint += "/";
vm.OSVirtualHardDisk.MediaLink = new Uri(blobEndpoint + "vhds/" + vhdname);
}
NetworkConfigurationSet netConfig = new NetworkConfigurationSet();
netConfig.InputEndpoints = new Collection<InputEndpoint>();
if (SubnetNames != null)
{
netConfig.SubnetNames = new SubnetNamesCollection();
foreach (string subnet in SubnetNames)
{
netConfig.SubnetNames.Add(subnet);
}
}
if (ParameterSetName.Equals("Windows", StringComparison.OrdinalIgnoreCase))
{
WindowsProvisioningConfigurationSet windowsConfig = new WindowsProvisioningConfigurationSet
{
AdminPassword = Password,
ComputerName = string.IsNullOrEmpty(Name) ? ServiceName : Name,
EnableAutomaticUpdates = true,
ResetPasswordOnFirstLogon = false,
StoredCertificateSettings = Certificates
};
InputEndpoint rdpEndpoint = new InputEndpoint { LocalPort = 3389, Protocol = "tcp", Name = "RemoteDesktop" };
netConfig.InputEndpoints.Add(rdpEndpoint);
vm.ConfigurationSets.Add(windowsConfig);
vm.ConfigurationSets.Add(netConfig);
}
else
{
LinuxProvisioningConfigurationSet linuxConfig = new LinuxProvisioningConfigurationSet();
linuxConfig.HostName = string.IsNullOrEmpty(this.Name) ? this.ServiceName : this.Name;
linuxConfig.UserName = this.LinuxUser;
linuxConfig.UserPassword = this.Password;
linuxConfig.DisableSshPasswordAuthentication = false;
if (this.SSHKeyPairs != null && this.SSHKeyPairs.Count > 0 || this.SSHPublicKeys != null && this.SSHPublicKeys.Count > 0)
{
linuxConfig.SSH = new LinuxProvisioningConfigurationSet.SSHSettings();
linuxConfig.SSH.PublicKeys = this.SSHPublicKeys;
linuxConfig.SSH.KeyPairs = this.SSHKeyPairs;
}
InputEndpoint rdpEndpoint = new InputEndpoint();
rdpEndpoint.LocalPort = 22;
rdpEndpoint.Protocol = "tcp";
rdpEndpoint.Name = "SSH";
netConfig.InputEndpoints.Add(rdpEndpoint);
vm.ConfigurationSets.Add(linuxConfig);
vm.ConfigurationSets.Add(netConfig);
}
string CreateCloudServiceOperationID = String.Empty;
string CreateDeploymentOperationID = String.Empty;
//.........这里部分代码省略.........