using System.Collections.ObjectModel;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using Octokit.Internal;
namespace Octokit
{
///
/// Describes a new deployment status to create. Deployments are a request for a specific ref(branch,sha,tag) to
/// be deployed.
///
///
/// API: https://developer.github.com/v3/repos/deployments/
///
[DebuggerDisplay("{DebuggerDisplay,nq}")]
public class NewDeployment
{
///
/// Initializes a new instance of the class.
///
/// The ref to deploy.
public NewDeployment(string @ref)
{
Ref = @ref;
}
///
/// The ref to deploy. This can be a branch, tag, or sha. (REQUIRED)
///
public string Ref { get; private set; }
///
/// Gets or sets the optional task used to specify a task to execute, e.g. deploy or deploy:migrations.
/// Default: deploy
///
///
/// The task.
///
public DeployTask Task { get; set; }
///
/// Merges the default branch into the requested deployment branch if true;
/// Does nothing if false. (DEFAULT if not specified: True)
///
public bool? AutoMerge { get; set; }
///
/// Optional array of status contexts verified against commit status checks. If this property is null then
/// all unique contexts will be verified before a deployment is created. To bypass checking entirely, set this
/// to an empty collection. Defaults to all unique contexts (aka null).
///
///
/// The required contexts.
///
[SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
public Collection RequiredContexts { get; set; }
///
/// JSON payload with extra information about the deployment.
///
public string Payload { get; set; }
///
/// Optional name for the target deployment environment (e.g., production, staging, qa). Default: "production"
///
///
/// The environment.
///
public string Environment { get; set; }
///
/// A short description of the deployment.
///
public string Description { get; set; }
///
/// Indicates if the environment is specific to a deployment and will no longer exist at some point in the future.
/// (DEFAULT if not specified: False)
///
public bool? TransientEnvironment { get; set; }
///
/// Indicates if the environment is one with which end users directly interact.
/// (DEFAULT if not specified: True when environment is "production" and False otherwise)
///
public bool? ProductionEnvironment { get; set; }
internal string DebuggerDisplay
{
get
{
return string.Format(CultureInfo.InvariantCulture, "Description: {0}", Description);
}
}
}
///
/// The types of deployments tasks that are availabel.
///
public enum DeployTask
{
///
/// Deploy everything (default)
///
Deploy,
///
/// Deploy migrations only.
///
[Parameter(Value = "deploy:migrations")]
DeployMigrations
}
}