Files
csharp/src/generated/Models/V2alpha1MetricSpec.cs

119 lines
4.7 KiB
C#
Raw Normal View History

2017-06-16 10:47:10 -07:00
// Code generated by Microsoft (R) AutoRest Code Generator 1.1.0.0
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
namespace k8s.Models
{
using Microsoft.Rest;
using Newtonsoft.Json;
using System.Linq;
/// <summary>
/// MetricSpec specifies how to scale based on a single metric (only `type`
/// and one other matching field should be set at once).
/// </summary>
public partial class V2alpha1MetricSpec
{
/// <summary>
/// Initializes a new instance of the V2alpha1MetricSpec class.
/// </summary>
public V2alpha1MetricSpec()
{
CustomInit();
}
/// <summary>
/// Initializes a new instance of the V2alpha1MetricSpec class.
/// </summary>
/// <param name="type">type is the type of metric source. It should
/// match one of the fields below.</param>
/// <param name="objectProperty">object refers to a metric describing a
/// single kubernetes object (for example, hits-per-second on an
/// Ingress object).</param>
/// <param name="pods">pods refers to a metric describing each pod in
/// the current scale target (for example,
/// transactions-processed-per-second). The values will be averaged
/// together before being compared to the target value.</param>
/// <param name="resource">resource refers to a resource metric (such
/// as those specified in requests and limits) known to Kubernetes
/// describing each pod in the current scale target (e.g. CPU or
/// memory). Such metrics are built in to Kubernetes, and have special
/// scaling options on top of those available to normal per-pod metrics
/// using the "pods" source.</param>
public V2alpha1MetricSpec(string type, V2alpha1ObjectMetricSource objectProperty = default(V2alpha1ObjectMetricSource), V2alpha1PodsMetricSource pods = default(V2alpha1PodsMetricSource), V2alpha1ResourceMetricSource resource = default(V2alpha1ResourceMetricSource))
{
ObjectProperty = objectProperty;
Pods = pods;
Resource = resource;
Type = type;
CustomInit();
}
/// <summary>
/// An initialization method that performs custom operations like setting defaults
/// </summary>
partial void CustomInit();
/// <summary>
/// Gets or sets object refers to a metric describing a single
/// kubernetes object (for example, hits-per-second on an Ingress
/// object).
/// </summary>
[JsonProperty(PropertyName = "object")]
public V2alpha1ObjectMetricSource ObjectProperty { get; set; }
/// <summary>
/// Gets or sets pods refers to a metric describing each pod in the
/// current scale target (for example,
/// transactions-processed-per-second). The values will be averaged
/// together before being compared to the target value.
/// </summary>
[JsonProperty(PropertyName = "pods")]
public V2alpha1PodsMetricSource Pods { get; set; }
/// <summary>
/// Gets or sets resource refers to a resource metric (such as those
/// specified in requests and limits) known to Kubernetes describing
/// each pod in the current scale target (e.g. CPU or memory). Such
/// metrics are built in to Kubernetes, and have special scaling
/// options on top of those available to normal per-pod metrics using
/// the "pods" source.
/// </summary>
[JsonProperty(PropertyName = "resource")]
public V2alpha1ResourceMetricSource Resource { get; set; }
/// <summary>
/// Gets or sets type is the type of metric source. It should match
/// one of the fields below.
/// </summary>
[JsonProperty(PropertyName = "type")]
public string Type { get; set; }
/// <summary>
/// Validate the object.
/// </summary>
/// <exception cref="ValidationException">
/// Thrown if validation fails
/// </exception>
public virtual void Validate()
{
if (Type == null)
{
throw new ValidationException(ValidationRules.CannotBeNull, "Type");
}
if (ObjectProperty != null)
{
ObjectProperty.Validate();
}
if (Pods != null)
{
Pods.Validate();
}
if (Resource != null)
{
Resource.Validate();
}
}
}
}