using System;
using System.Collections.Generic;
using System.Runtime.Serialization;
using GitHub.Services.WebApi;
namespace GitHub.Build.WebApi
{
///
/// Represents resources used by a build process.
///
[DataContract]
public sealed class BuildProcessResources : BaseSecuredObject
{
public BuildProcessResources()
{
}
internal BuildProcessResources(
ISecuredObject securedObject)
: base(securedObject)
{
}
///
/// Information about the queues used by the process.
///
public IList Queues
{
get
{
if (m_queues == null)
{
m_queues = new List();
}
return m_queues;
}
set
{
m_queues = new List(value);
}
}
///
/// Information about the endpoints used by the process.
///
public IList Endpoints
{
get
{
if (m_endpoints == null)
{
m_endpoints = new List();
}
return m_endpoints;
}
set
{
m_endpoints = new List(value);
}
}
///
/// Information about the secure files used by the process.
///
public IList Files
{
get
{
if (m_files == null)
{
m_files = new List();
}
return m_files;
}
set
{
m_files = new List(value);
}
}
///
/// Information about the variable groups used by the process.
///
public IList VariableGroups
{
get
{
if (m_variableGroups == null)
{
m_variableGroups = new List();
}
return m_variableGroups;
}
set
{
m_variableGroups = new List(value);
}
}
[OnSerializing]
private void OnSerializing(StreamingContext context)
{
if (m_queues?.Count == 0)
{
m_queues = null;
}
if (m_endpoints?.Count == 0)
{
m_endpoints = null;
}
if (m_files?.Count == 0)
{
m_files = null;
}
if (m_variableGroups?.Count == 0)
{
m_variableGroups = null;
}
}
[DataMember(Name = "Queues", EmitDefaultValue = false)]
private List m_queues;
[DataMember(Name = "Endpoints", EmitDefaultValue = false)]
private List m_endpoints;
[DataMember(Name = "Files", EmitDefaultValue = false)]
private List m_files;
[DataMember(Name = "VariableGroups", EmitDefaultValue = false)]
private List m_variableGroups;
}
///
/// Represents a reference to a resource.
///
[DataContract]
public abstract class ResourceReference : BaseSecuredObject
{
public ResourceReference()
{
}
protected ResourceReference(
ISecuredObject securedObject)
: base(securedObject)
{
}
///
/// An alias to be used when referencing the resource.
///
[DataMember(EmitDefaultValue = false)]
public String Alias
{
get;
set;
}
}
///
/// Represents a reference to an agent queue.
///
[DataContract]
public class AgentPoolQueueReference : ResourceReference
{
public AgentPoolQueueReference()
: this(null)
{
}
internal AgentPoolQueueReference(
ISecuredObject securedObject)
: base(securedObject)
{
}
///
/// The ID of the queue.
///
[DataMember(EmitDefaultValue = false)]
public Int32 Id
{
get;
set;
}
}
///
/// Represents a referenec to a service endpoint.
///
[DataContract]
public class ServiceEndpointReference : ResourceReference
{
public ServiceEndpointReference()
: this(null)
{
}
internal ServiceEndpointReference(
ISecuredObject securedObject)
: base(securedObject)
{
}
///
/// The ID of the service endpoint.
///
[DataMember(EmitDefaultValue = false)]
public Guid Id
{
get;
set;
}
}
///
/// Represents a reference to a secure file.
///
[DataContract]
public class SecureFileReference : ResourceReference
{
public SecureFileReference()
: this(null)
{
}
internal SecureFileReference(
ISecuredObject securedObject)
: base(securedObject)
{
}
///
/// The ID of the secure file.
///
[DataMember(EmitDefaultValue = false)]
public Guid Id
{
get;
set;
}
}
}