Reason
The Reason
property is used to provide a machine-readable validation failure reason that is returned to the caller when a request fails this validation rule. The HTTP status code returned to the caller will match the reason of the first failed validation rule.
Source: swagger.json
Supported Reasons
The currently supported reasons are:
"FieldValueInvalid"
: The provided field value is invalid."FieldValueForbidden"
: The provided field value is forbidden."FieldValueRequired"
: The provided field value is required."FieldValueDuplicate"
: The provided field value is a duplicate.
Source: swagger.json
Default Reason
If the Reason
property is not set, the default value is "FieldValueInvalid"
.
Source: swagger.json
Handling Unknown Reasons
Clients should treat unknown reasons as "FieldValueInvalid"
.
Source: swagger.json
Example
// Example of using the Reason property
var status = new V1Status {
Reason = "FieldValueInvalid",
Message = "The provided field value is invalid."
};
// The HTTP status code returned to the caller will be 400 (Bad Request)
V1Status ToString()
The V1Status.ToString()
method provides a short description of the status. The description includes the Reason
and Message
properties. If the Reason
property is not set and the Code
property is not 0, the ToString()
method will use the HTTP status code as the reason.
Source: src/KubernetesClient/Models/V1Status.cs
// Example of using the ToString() method
var status = new V1Status {
Reason = "FieldValueInvalid",
Message = "The provided field value is invalid."
};
// The ToString() method will return the following string:
// "FieldValueInvalid - The provided field value is invalid."
## Top-Level Directory Explanations
<a class='local-link directory-link' data-ref="examples/" href="#examples/">examples/</a> - This directory contains example projects and usage scenarios for the Kubernetes client library.
<a class='local-link directory-link' data-ref="examples/customResource/" href="#examples/customResource/">examples/customResource/</a> - This subdirectory contains examples of creating custom Kubernetes resources.
<a class='local-link directory-link' data-ref="examples/restart/" href="#examples/restart/">examples/restart/</a> - This subdirectory contains examples of restarting Kubernetes pods.
<a class='local-link directory-link' data-ref="src/" href="#src/">src/</a> - This directory contains the source code for the project.
<a class='local-link directory-link' data-ref="src/KubernetesClient/" href="#src/KubernetesClient/">src/KubernetesClient/</a> - This subdirectory contains the main Kubernetes client library source code.
<a class='local-link directory-link' data-ref="src/KubernetesClient/Autorest/" href="#src/KubernetesClient/Autorest/">src/KubernetesClient/Autorest/</a> - This subdirectory contains Autorest code for generating client code from OpenAPI definitions.
<a class='local-link directory-link' data-ref="src/KubernetesClient/Models/" href="#src/KubernetesClient/Models/">src/KubernetesClient/Models/</a> - This subdirectory contains model classes for various Kubernetes resources and objects.
<a class='local-link directory-link' data-ref="src/LibKubernetesGenerator/" href="#src/LibKubernetesGenerator/">src/LibKubernetesGenerator/</a> - This subdirectory contains code for generating C# code from OpenAPI definitions.
<a class='local-link directory-link' data-ref="tests/" href="#tests/">tests/</a> - This directory contains test code for the project.
<a class='local-link directory-link' data-ref="tests/KubernetesClient.Tests/" href="#tests/KubernetesClient.Tests/">tests/KubernetesClient.Tests/</a> - This subdirectory contains tests for the main implementation of the Kubernetes client library.