using System.Collections.Generic;
using System.ComponentModel;
using System.Runtime.Serialization;
using GitHub.DistributedTask.WebApi;
namespace GitHub.DistributedTask.Pipelines
{
[DataContract]
[EditorBrowsable(EditorBrowsableState.Never)]
public sealed class JobResources
{
///
/// Gets the collection of containers associated with the current job
///
public List Containers
{
get
{
if (m_containers == null)
{
m_containers = new List();
}
return m_containers;
}
}
///
/// Gets the collection of endpoints associated with the current job
///
public List Endpoints
{
get
{
if (m_endpoints == null)
{
m_endpoints = new List();
}
return m_endpoints;
}
}
///
/// Gets the collection of repositories associated with the current job
///
public List Repositories
{
get
{
if (m_repositories == null)
{
m_repositories = new List();
}
return m_repositories;
}
}
[OnSerializing]
private void OnSerializing(StreamingContext context)
{
if (m_containers?.Count == 0)
{
m_containers = null;
}
if (m_endpoints?.Count == 0)
{
m_endpoints = null;
}
if (m_repositories?.Count == 0)
{
m_repositories = null;
}
}
[DataMember(Name = "Containers", EmitDefaultValue = false)]
private List m_containers;
[DataMember(Name = "Endpoints", EmitDefaultValue = false)]
private List m_endpoints;
[DataMember(Name = "Repositories", EmitDefaultValue = false)]
private List m_repositories;
}
}