k8s-API(按功能划分)

K8sAPI

功能 操作方式 描述
自定义资源资源增删改查 使用 CustomObjectsApi apiInstance = new CustomObjectsApi(); CRD(CustomResourceDefinition,自定义资源)资源增删改查
Namespaces增删改查 使用 CoreV1Api apiInstance = new CoreV1Api(); Namespaces增删改查
Node增删改查 使用 CoreV1Api apiInstance = new CoreV1Api(); Node增删改查
Pod增删改查 使用 CoreV1Api apiInstance = new CoreV1Api(); Pod增删改查
Service增删改查 使用 CoreV1Api apiInstance = new CoreV1Api(); Service增删改查
优先级增删查改 使用 SchedulingV1Api apiInstance = new SchedulingV1Api(); 优先级增删改查
Deployment增删改查 使用 AppsV1Api apiInstance = new AppsV1Api(); Deployment增删改查

自定义资源资源增删改查


回到K8sAPI根目录

All URIs are relative to http://localhost

Method HTTP request Description
createClusterCustomObject POST /apis/{group}/{version}/ 创建集群范围CRD资源对象
createNamespacedCustomObject POST /apis/{group}/{version}/namespaces/{namespace}/ 创建分区范围CRD资源对象
deleteClusterCustomObject DELETE /apis/{group}/{version}/{plural}/ 删除集群范围CRD资源对象
deleteNamespacedCustomObject DELETE /apis/{group}/{version}/namespaces/{namespace}/{plural}/ 删除分区范围CRD资源对象
getClusterCustomObject GET /apis/{group}/{version}/{plural}/ 获取集群范围CRD资源对象
getClusterCustomObjectScale GET /apis/{group}/{version}/{plural}/{name}/scale 获取集群范围CRD资源对象-scale
getClusterCustomObjectStatus GET /apis/{group}/{version}/{plural}/{name}/status 获取集群范围CRD资源对象-状态
getNamespacedCustomObject GET /apis/{group}/{version}/namespaces/{namespace}/{plural}/ 获取分区范围CRD资源对象
getNamespacedCustomObjectScale GET /apis/{group}/{version}/namespaces/{namespace}/{plural}/{name}/scale 获取分区范围CRD资源对象-scale
getNamespacedCustomObjectStatus GET /apis/{group}/{version}/namespaces/{namespace}/{plural}/{name}/status 获取分区范围CRD资源对象-状态
listClusterCustomObject GET /apis/{group}/{version}/ 集群范围CRD资源对象列表
listNamespacedCustomObject GET /apis/{group}/{version}/namespaces/{namespace}/ 分区范围CRD资源对象列表
patchClusterCustomObject PATCH /apis/{group}/{version}/{plural}/ 更新集群范围CRD资源对象
patchClusterCustomObjectScale PATCH /apis/{group}/{version}/{plural}/{name}/scale 更新集群范围CRD资源对象-scale
patchClusterCustomObjectStatus PATCH /apis/{group}/{version}/{plural}/{name}/status 更新集群范围CRD资源对象-状态
patchNamespacedCustomObject PATCH /apis/{group}/{version}/namespaces/{namespace}/{plural}/ 更新分区范围CRD资源对象
patchNamespacedCustomObjectScale PATCH /apis/{group}/{version}/namespaces/{namespace}/{plural}/{name}/scale 更新分区范围CRD资源对象-scale
patchNamespacedCustomObjectStatus PATCH /apis/{group}/{version}/namespaces/{namespace}/{plural}/{name}/status 更新分区范围CRD资源对象-状态
replaceClusterCustomObject PUT /apis/{group}/{version}/{plural}/ 替换集群范围CRD资源对象
replaceClusterCustomObjectScale PUT /apis/{group}/{version}/{plural}/{name}/scale 替换集群范围CRD资源对象-scale
replaceClusterCustomObjectStatus PUT /apis/{group}/{version}/{plural}/{name}/status 替换集群范围CRD资源对象-状态
replaceNamespacedCustomObject PUT /apis/{group}/{version}/namespaces/{namespace}/{plural}/ 替换分区范围CRD资源对象
replaceNamespacedCustomObjectScale PUT /apis/{group}/{version}/namespaces/{namespace}/{plural}/{name}/scale 替换分区范围CRD资源对象-scale
replaceNamespacedCustomObjectStatus PUT /apis/{group}/{version}/namespaces/{namespace}/{plural}/{name}/status 替换分区范围CRD资源对象-状态

createClusterCustomObject


回到“自定义资源增删查改”目录

Object createClusterCustomObject(group, version, plural, body, pretty, dryRun, fieldManager)

Creates a cluster scoped Custom object(创建群集范围的自定义对象)

Example

// Import classes:
import io.kubernetes.client.openapi.ApiClient;
import io.kubernetes.client.openapi.ApiException;
import io.kubernetes.client.openapi.Configuration;
import io.kubernetes.client.openapi.auth.*;
import io.kubernetes.client.openapi.models.*;
import io.kubernetes.client.openapi.apis.CustomObjectsApi;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("http://localhost");
    
    // Configure API key authorization: BearerToken
    ApiKeyAuth BearerToken = (ApiKeyAuth) defaultClient.getAuthentication("BearerToken");
    BearerToken.setApiKey("YOUR API KEY");
    // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
    //BearerToken.setApiKeyPrefix("Token");

    CustomObjectsApi apiInstance = new CustomObjectsApi(defaultClient);
    String group = "group_example"; // String | The custom resource's group name
    String version = "version_example"; // String | The custom resource's version
    String plural = "plural_example"; // String | 自定义资源的复数名。对于TPR,这将是小写复数形式。The custom resource's plural name. For TPRs this would be lowercase plural kind.
    Object body = null; // Object | 要创建的资源的JSON模式。The JSON schema of the Resource to create..
    String pretty = "pretty_example"; // String | 如果为“true”,则输出相当打印。If 'true', then the output is pretty printed.
    String dryRun = "dryRun_example"; // String | 如果存在,则表示不应保留修改。无效或无法识别的dryRun指令将导致错误响应,并且不会进一步处理请求。有效值为:-全部:将处理所有干运行阶段。如果存在,则表示不应保留修改。无效或无法识别的dryRun指令将导致错误响应,并且不会进一步处理请求。有效值为:-全部:将处理所有干运行阶段。When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed
    String fieldManager = "fieldManager_example"; // String | fieldManager是与进行这些更改的参与者或实体关联的名称。该值的长度必须小于或128个字符,并且仅包含可打印字符,如https://golang.org/pkg/unicode/#IsPrint.应用请求(应用程序/应用补丁)需要此字段,但非应用补丁类型(JsonPatch、MergePatch、StrategicMergePatch)可选择此字段。 fieldManager是与进行这些更改的参与者或实体关联的名称。该值的长度必须小于或128个字符,并且仅包含可打印字符,如https://golang.org/pkg/unicode/#IsPrint.fieldManager is a name associated with the actor or entity that is making these changes. The value must be less than or 128 characters long, and only contain printable characters, as defined by https://golang.org/pkg/unicode/#IsPrint. This field is required for apply requests (application/apply-patch) but optional for non-apply patch types (JsonPatch, MergePatch, StrategicMergePatch).
    try {
      Object result = apiInstance.createClusterCustomObject(group, version, plural, body, pretty, dryRun, fieldManager);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling CustomObjectsApi#createClusterCustomObject");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
group String The custom resource's group name
version String The custom resource's version
plural String The custom resource's plural name. For TPRs this would be lowercase plural kind.
body Object 要创建的资源的JSON模式。The JSON schema of the Resource to create..
pretty String 如果为“true”,则输出相当打印。If 'true', then the output is pretty printed. [optional]
dryRun String 如果存在,则表示不应保留修改。无效或无法识别的dryRun指令将导致错误响应,并且不会进一步处理请求。有效值为:-全部:将处理所有干运行阶段。When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed [optional]
fieldManager String fieldManager是与进行这些更改的参与者或实体关联的名称。该值的长度必须小于或128个字符,并且仅包含可打印字符,如https://golang.org/pkg/unicode/#IsPrint.应用请求(应用程序/应用补丁)需要此字段,但非应用补丁类型(JsonPatch、MergePatch、StrategicMergePatch)可选择此字段。 fieldManager是与进行这些更改的参与者或实体关联的名称。该值的长度必须小于或128个字符,并且仅包含可打印字符,如https://golang.org/pkg/unicode/#IsPrint.fieldManager is a name associated with the actor or entity that is making these changes. The value must be less than or 128 characters long, and only contain printable characters, as defined by https://golang.org/pkg/unicode/#IsPrint. This field is required for apply requests (application/apply-patch) but optional for non-apply patch types (JsonPatch, MergePatch, StrategicMergePatch). [optional]

Return type

Object

Authorization

BearerToken

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
201 Created -
401 Unauthorized -

createNamespacedCustomObject


回到“自定义资源增删查改”目录

Object createNamespacedCustomObject(group, version, namespace, plural, body, pretty, dryRun, fieldManager)

Creates a namespace scoped Custom object

Example

// Import classes:
import io.kubernetes.client.openapi.ApiClient;
import io.kubernetes.client.openapi.ApiException;
import io.kubernetes.client.openapi.Configuration;
import io.kubernetes.client.openapi.auth.*;
import io.kubernetes.client.openapi.models.*;
import io.kubernetes.client.openapi.apis.CustomObjectsApi;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("http://localhost");
    
    // Configure API key authorization: BearerToken
    ApiKeyAuth BearerToken = (ApiKeyAuth) defaultClient.getAuthentication("BearerToken");
    BearerToken.setApiKey("YOUR API KEY");
    // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
    //BearerToken.setApiKeyPrefix("Token");

    CustomObjectsApi apiInstance = new CustomObjectsApi(defaultClient);
    String group = "group_example"; // String | The custom resource's group name
    String version = "version_example"; // String | The custom resource's version
    String namespace = "namespace_example"; // String | The custom resource's namespace
    String plural = "plural_example"; // String | 自定义资源的复数名。对于TPR,这将是小写复数形式。The custom resource's plural name. For TPRs this would be lowercase plural kind.
    Object body = null; // Object | 要创建的资源的JSON模式。The JSON schema of the Resource to create..
    String pretty = "pretty_example"; // String | 如果为“true”,则输出相当打印。If 'true', then the output is pretty printed.
    String dryRun = "dryRun_example"; // String | 如果存在,则表示不应保留修改。无效或无法识别的dryRun指令将导致错误响应,并且不会进一步处理请求。有效值为:-全部:将处理所有干运行阶段。When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed
    String fieldManager = "fieldManager_example"; // String | fieldManager是与进行这些更改的参与者或实体关联的名称。该值的长度必须小于或128个字符,并且仅包含可打印字符,如https://golang.org/pkg/unicode/#IsPrint.fieldManager is a name associated with the actor or entity that is making these changes. The value must be less than or 128 characters long, and only contain printable characters, as defined by https://golang.org/pkg/unicode/#IsPrint.
    try {
      Object result = apiInstance.createNamespacedCustomObject(group, version, namespace, plural, body, pretty, dryRun, fieldManager);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling CustomObjectsApi#createNamespacedCustomObject");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
group String The custom resource's group name
version String The custom resource's version
namespace String The custom resource's namespace
plural String 自定义资源的复数名。对于TPR,这将是小写复数形式。
body Object 要创建的资源的JSON模式。The JSON schema of the Resource to create..
pretty String 如果为“true”,则输出相当打印。If 'true', then the output is pretty printed. [optional]
dryRun String 如果存在,则表示不应保留修改。无效或无法识别的dryRun指令将导致错误响应,并且不会进一步处理请求。有效值为:-全部:将处理所有干运行阶段。When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed [optional]
fieldManager String fieldManager是与进行这些更改的参与者或实体关联的名称。该值的长度必须小于或128个字符,并且仅包含可打印字符,如https://golang.org/pkg/unicode/#IsPrint.fieldManager is a name associated with the actor or entity that is making these changes. The value must be less than or 128 characters long, and only contain printable characters, as defined by https://golang.org/pkg/unicode/#IsPrint. [optional]

Return type

Object

Authorization

BearerToken

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
201 Created -
401 Unauthorized -

deleteClusterCustomObject


回到“自定义资源增删查改”目录

Object deleteClusterCustomObject(group, version, plural, name, gracePeriodSeconds, orphanDependents, propagationPolicy, dryRun, body)

Deletes the specified cluster scoped custom object

Example

// Import classes:
import io.kubernetes.client.openapi.ApiClient;
import io.kubernetes.client.openapi.ApiException;
import io.kubernetes.client.openapi.Configuration;
import io.kubernetes.client.openapi.auth.*;
import io.kubernetes.client.openapi.models.*;
import io.kubernetes.client.openapi.apis.CustomObjectsApi;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("http://localhost");
    
    // Configure API key authorization: BearerToken
    ApiKeyAuth BearerToken = (ApiKeyAuth) defaultClient.getAuthentication("BearerToken");
    BearerToken.setApiKey("YOUR API KEY");
    // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
    //BearerToken.setApiKeyPrefix("Token");

    CustomObjectsApi apiInstance = new CustomObjectsApi(defaultClient);
    String group = "group_example"; // String | the custom resource's group
    String version = "version_example"; // String | the custom resource's version
    String plural = "plural_example"; // String | 自定义资源的复数名。对于TPR,这将是小写复数形式。the custom object's plural name. For TPRs this would be lowercase plural kind.
    String name = "name_example"; // String | the custom object's name
    Integer gracePeriodSeconds = 56; // Integer | 删除对象前的持续时间(秒)。值必须是非负整数。值为零表示立即删除。如果此值为nil,则将使用指定类型的默认宽限期。如果未指定,则默认为每对象值。零表示立即删除。The duration in seconds before the object should be deleted. Value must be non-negative integer. The value zero indicates delete immediately. If this value is nil, the default grace period for the specified type will be used. Defaults to a per object value if not specified. zero means delete immediately.
    Boolean orphanDependents = true; // Boolean | 已弃用:请使用PropagationPolicy,此字段将在1.7中弃用。从属对象应该是孤立的吗。如果为真/假,“孤立”终结器将被添加到对象的终结器列表中或从中删除。可以设置此字段或PropagationPolicy,但不能同时设置两者。已弃用:请使用PropagationPolicy,此字段将在1.7中弃用。从属对象应该是孤立的吗。如果为真/假,“孤立”终结器将被添加到对象的终结器列表中或从中删除。可以设置此字段或PropagationPolicy,但不能同时设置两者。Deprecated: please use the PropagationPolicy, this field will be deprecated in 1.7. Should the dependent objects be orphaned. If true/false, the \"orphan\" finalizer will be added to/removed from the object's finalizers list. Either this field or PropagationPolicy may be set, but not both.
    String propagationPolicy = "propagationPolicy_example"; // String | 是否以及如何执行垃圾收集。可以设置此字段或孤立从属项,但不能同时设置两者。默认策略由元数据中设置的现有终结器决定。终结器和特定于资源的默认策略。Whether and how garbage collection will be performed. Either this field or OrphanDependents may be set, but not both. The default policy is decided by the existing finalizer set in the metadata.finalizers and the resource-specific default policy.
    String dryRun = "dryRun_example"; // String | 如果存在,则表示不应保留修改。无效或无法识别的dryRun指令将导致错误响应,并且不会进一步处理请求。有效值为:-全部:将处理所有干运行阶段。When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed
    V1DeleteOptions body = new V1DeleteOptions(); // V1DeleteOptions | 
    try {
      Object result = apiInstance.deleteClusterCustomObject(group, version, plural, name, gracePeriodSeconds, orphanDependents, propagationPolicy, dryRun, body);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling CustomObjectsApi#deleteClusterCustomObject");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
group String the custom resource's group
version String the custom resource's version
plural String 自定义资源的复数名。对于TPR,这将是小写复数形式。the custom object's plural name. For TPRs this would be lowercase plural kind.
name String the custom object's name
gracePeriodSeconds Integer 删除对象前的持续时间(秒)。值必须是非负整数。值为零表示立即删除。如果此值为nil,则将使用指定类型的默认宽限期。如果未指定,则默认为每对象值。零表示立即删除。The duration in seconds before the object should be deleted. Value must be non-negative integer. The value zero indicates delete immediately. If this value is nil, the default grace period for the specified type will be used. Defaults to a per object value if not specified. zero means delete immediately. [optional]
orphanDependents Boolean 已弃用:请使用PropagationPolicy,此字段将在1.7中弃用。从属对象应该是孤立的吗。如果为真/假,“孤立”终结器将被添加到对象的终结器列表中或从中删除。可以设置此字段或PropagationPolicy,但不能同时设置两者。已弃用:请使用PropagationPolicy,此字段将在1.7中弃用。从属对象应该是孤立的吗。如果为真/假,“孤立”终结器将被添加到对象的终结器列表中或从中删除。可以设置此字段或PropagationPolicy,但不能同时设置两者。Deprecated: please use the PropagationPolicy, this field will be deprecated in 1.7. Should the dependent objects be orphaned. If true/false, the "orphan" finalizer will be added to/removed from the object's finalizers list. Either this field or PropagationPolicy may be set, but not both. [optional]
propagationPolicy String 是否以及如何执行垃圾收集。可以设置此字段或孤立从属项,但不能同时设置两者。默认策略由元数据中设置的现有终结器决定。终结器和特定于资源的默认策略。Whether and how garbage collection will be performed. Either this field or OrphanDependents may be set, but not both. The default policy is decided by the existing finalizer set in the metadata.finalizers and the resource-specific default policy. [optional]
dryRun String 如果存在,则表示不应保留修改。无效或无法识别的dryRun指令将导致错误响应,并且不会进一步处理请求。有效值为:-全部:将处理所有干运行阶段。When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed [optional]
body V1DeleteOptions [optional]

Return type

Object

Authorization

BearerToken

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 OK -
401 Unauthorized -

deleteNamespacedCustomObject


回到“自定义资源增删查改”目录

Object deleteNamespacedCustomObject(group, version, namespace, plural, name, gracePeriodSeconds, orphanDependents, propagationPolicy, dryRun, body)

Deletes the specified namespace scoped custom object

Example

// Import classes:
import io.kubernetes.client.openapi.ApiClient;
import io.kubernetes.client.openapi.ApiException;
import io.kubernetes.client.openapi.Configuration;
import io.kubernetes.client.openapi.auth.*;
import io.kubernetes.client.openapi.models.*;
import io.kubernetes.client.openapi.apis.CustomObjectsApi;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("http://localhost");
    
    // Configure API key authorization: BearerToken
    ApiKeyAuth BearerToken = (ApiKeyAuth) defaultClient.getAuthentication("BearerToken");
    BearerToken.setApiKey("YOUR API KEY");
    // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
    //BearerToken.setApiKeyPrefix("Token");

    CustomObjectsApi apiInstance = new CustomObjectsApi(defaultClient);
    String group = "group_example"; // String | the custom resource's group
    String version = "version_example"; // String | the custom resource's version
    String namespace = "namespace_example"; // String | The custom resource's namespace
    String plural = "plural_example"; // String | 自定义资源的复数名。对于TPR,这将是小写复数形式。the custom resource's plural name. For TPRs this would be lowercase plural kind.
    String name = "name_example"; // String | the custom object's name
    Integer gracePeriodSeconds = 56; // Integer | 删除对象前的持续时间(秒)。值必须是非负整数。值为零表示立即删除。如果此值为nil,则将使用指定类型的默认宽限期。如果未指定,则默认为每对象值。零表示立即删除。The duration in seconds before the object should be deleted. Value must be non-negative integer. The value zero indicates delete immediately. If this value is nil, the default grace period for the specified type will be used. Defaults to a per object value if not specified. zero means delete immediately.
    Boolean orphanDependents = true; // Boolean | 已弃用:请使用PropagationPolicy,此字段将在1.7中弃用。从属对象应该是孤立的吗。如果为真/假,“孤立”终结器将被添加到对象的终结器列表中或从中删除。可以设置此字段或PropagationPolicy,但不能同时设置两者。已弃用:请使用PropagationPolicy,此字段将在1.7中弃用。从属对象应该是孤立的吗。如果为真/假,“孤立”终结器将被添加到对象的终结器列表中或从中删除。可以设置此字段或PropagationPolicy,但不能同时设置两者。Deprecated: please use the PropagationPolicy, this field will be deprecated in 1.7. Should the dependent objects be orphaned. If true/false, the \"orphan\" finalizer will be added to/removed from the object's finalizers list. Either this field or PropagationPolicy may be set, but not both.
    String propagationPolicy = "propagationPolicy_example"; // String | 是否以及如何执行垃圾收集。可以设置此字段或孤立从属项,但不能同时设置两者。默认策略由元数据中设置的现有终结器决定。终结器和特定于资源的默认策略。Whether and how garbage collection will be performed. Either this field or OrphanDependents may be set, but not both. The default policy is decided by the existing finalizer set in the metadata.finalizers and the resource-specific default policy.
    String dryRun = "dryRun_example"; // String | 如果存在,则表示不应保留修改。无效或无法识别的dryRun指令将导致错误响应,并且不会进一步处理请求。有效值为:-全部:将处理所有干运行阶段。When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed
    V1DeleteOptions body = new V1DeleteOptions(); // V1DeleteOptions | 
    try {
      Object result = apiInstance.deleteNamespacedCustomObject(group, version, namespace, plural, name, gracePeriodSeconds, orphanDependents, propagationPolicy, dryRun, body);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling CustomObjectsApi#deleteNamespacedCustomObject");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
group String the custom resource's group
version String the custom resource's version
namespace String The custom resource's namespace
plural String 自定义资源的复数名。对于TPR,这将是小写复数形式。
name String the custom object's name
gracePeriodSeconds Integer 删除对象前的持续时间(秒)。值必须是非负整数。值为零表示立即删除。如果此值为nil,则将使用指定类型的默认宽限期。如果未指定,则默认为每对象值。零表示立即删除。The duration in seconds before the object should be deleted. Value must be non-negative integer. The value zero indicates delete immediately. If this value is nil, the default grace period for the specified type will be used. Defaults to a per object value if not specified. zero means delete immediately. [optional]
orphanDependents Boolean 已弃用:请使用PropagationPolicy,此字段将在1.7中弃用。从属对象应该是孤立的吗。如果为真/假,“孤立”终结器将被添加到对象的终结器列表中或从中删除。可以设置此字段或PropagationPolicy,但不能同时设置两者。已弃用:请使用PropagationPolicy,此字段将在1.7中弃用。从属对象应该是孤立的吗。如果为真/假,“孤立”终结器将被添加到对象的终结器列表中或从中删除。可以设置此字段或PropagationPolicy,但不能同时设置两者。Deprecated: please use the PropagationPolicy, this field will be deprecated in 1.7. Should the dependent objects be orphaned. If true/false, the "orphan" finalizer will be added to/removed from the object's finalizers list. Either this field or PropagationPolicy may be set, but not both. [optional]
propagationPolicy String 是否以及如何执行垃圾收集。可以设置此字段或孤立从属项,但不能同时设置两者。默认策略由元数据中设置的现有终结器决定。终结器和特定于资源的默认策略。Whether and how garbage collection will be performed. Either this field or OrphanDependents may be set, but not both. The default policy is decided by the existing finalizer set in the metadata.finalizers and the resource-specific default policy. [optional]
dryRun String 如果存在,则表示不应保留修改。无效或无法识别的dryRun指令将导致错误响应,并且不会进一步处理请求。有效值为:-全部:将处理所有干运行阶段。When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed [optional]
body V1DeleteOptions [optional]

Return type

Object

Authorization

BearerToken

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 OK -
401 Unauthorized -

getClusterCustomObject


回到“自定义资源增删查改”目录

Object getClusterCustomObject(group, version, plural, name)

Returns a cluster scoped custom object

Example

// Import classes:
import io.kubernetes.client.openapi.ApiClient;
import io.kubernetes.client.openapi.ApiException;
import io.kubernetes.client.openapi.Configuration;
import io.kubernetes.client.openapi.auth.*;
import io.kubernetes.client.openapi.models.*;
import io.kubernetes.client.openapi.apis.CustomObjectsApi;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("http://localhost");
    
    // Configure API key authorization: BearerToken
    ApiKeyAuth BearerToken = (ApiKeyAuth) defaultClient.getAuthentication("BearerToken");
    BearerToken.setApiKey("YOUR API KEY");
    // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
    //BearerToken.setApiKeyPrefix("Token");

    CustomObjectsApi apiInstance = new CustomObjectsApi(defaultClient);
    String group = "group_example"; // String | the custom resource's group
    String version = "version_example"; // String | the custom resource's version
    String plural = "plural_example"; // String | 自定义对象的复数名称。对于TPR,这将是小写复数形式。the custom object's plural name. For TPRs this would be lowercase plural kind..
    String name = "name_example"; // String | the custom object's name
    try {
      Object result = apiInstance.getClusterCustomObject(group, version, plural, name);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling CustomObjectsApi#getClusterCustomObject");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
group String the custom resource's group
version String the custom resource's version
plural String the custom object's plural name. For TPRs this would be lowercase plural kind.
name String the custom object's name

Return type

Object

Authorization

BearerToken

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 A single Resource -
401 Unauthorized -

getClusterCustomObjectScale


回到“自定义资源增删查改”目录

Object getClusterCustomObjectScale(group, version, plural, name)

read scale of the specified custom object

Example

// Import classes:
import io.kubernetes.client.openapi.ApiClient;
import io.kubernetes.client.openapi.ApiException;
import io.kubernetes.client.openapi.Configuration;
import io.kubernetes.client.openapi.auth.*;
import io.kubernetes.client.openapi.models.*;
import io.kubernetes.client.openapi.apis.CustomObjectsApi;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("http://localhost");
    
    // Configure API key authorization: BearerToken
    ApiKeyAuth BearerToken = (ApiKeyAuth) defaultClient.getAuthentication("BearerToken");
    BearerToken.setApiKey("YOUR API KEY");
    // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
    //BearerToken.setApiKeyPrefix("Token");

    CustomObjectsApi apiInstance = new CustomObjectsApi(defaultClient);
    String group = "group_example"; // String | the custom resource's group
    String version = "version_example"; // String | the custom resource's version
    String plural = "plural_example"; // String | 自定义资源的复数名。对于TPR,这将是小写复数形式。the custom resource's plural name. For TPRs this would be lowercase plural kind.
    String name = "name_example"; // String | the custom object's name
    try {
      Object result = apiInstance.getClusterCustomObjectScale(group, version, plural, name);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling CustomObjectsApi#getClusterCustomObjectScale");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
group String the custom resource's group
version String the custom resource's version
plural String 自定义资源的复数名。对于TPR,这将是小写复数形式。
name String the custom object's name

Return type

Object

Authorization

BearerToken

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json, application/yaml, application/vnd.kubernetes.protobuf

HTTP response details

Status code Description Response headers
200 OK -
401 Unauthorized -

getClusterCustomObjectStatus


回到“自定义资源增删查改”目录

Object getClusterCustomObjectStatus(group, version, plural, name)

read status of the specified cluster scoped custom object

Example

// Import classes:
import io.kubernetes.client.openapi.ApiClient;
import io.kubernetes.client.openapi.ApiException;
import io.kubernetes.client.openapi.Configuration;
import io.kubernetes.client.openapi.auth.*;
import io.kubernetes.client.openapi.models.*;
import io.kubernetes.client.openapi.apis.CustomObjectsApi;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("http://localhost");
    
    // Configure API key authorization: BearerToken
    ApiKeyAuth BearerToken = (ApiKeyAuth) defaultClient.getAuthentication("BearerToken");
    BearerToken.setApiKey("YOUR API KEY");
    // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
    //BearerToken.setApiKeyPrefix("Token");

    CustomObjectsApi apiInstance = new CustomObjectsApi(defaultClient);
    String group = "group_example"; // String | the custom resource's group
    String version = "version_example"; // String | the custom resource's version
    String plural = "plural_example"; // String | 自定义资源的复数名。对于TPR,这将是小写复数形式。the custom resource's plural name. For TPRs this would be lowercase plural kind.
    String name = "name_example"; // String | the custom object's name
    try {
      Object result = apiInstance.getClusterCustomObjectStatus(group, version, plural, name);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling CustomObjectsApi#getClusterCustomObjectStatus");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
group String the custom resource's group
version String the custom resource's version
plural String 自定义资源的复数名。对于TPR,这将是小写复数形式。
name String the custom object's name

Return type

Object

Authorization

BearerToken

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json, application/yaml, application/vnd.kubernetes.protobuf

HTTP response details

Status code Description Response headers
200 OK -
401 Unauthorized -

getNamespacedCustomObject


回到“自定义资源增删查改”目录

Object getNamespacedCustomObject(group, version, namespace, plural, name)

Returns a namespace scoped custom object

Example

// Import classes:
import io.kubernetes.client.openapi.ApiClient;
import io.kubernetes.client.openapi.ApiException;
import io.kubernetes.client.openapi.Configuration;
import io.kubernetes.client.openapi.auth.*;
import io.kubernetes.client.openapi.models.*;
import io.kubernetes.client.openapi.apis.CustomObjectsApi;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("http://localhost");
    
    // Configure API key authorization: BearerToken
    ApiKeyAuth BearerToken = (ApiKeyAuth) defaultClient.getAuthentication("BearerToken");
    BearerToken.setApiKey("YOUR API KEY");
    // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
    //BearerToken.setApiKeyPrefix("Token");

    CustomObjectsApi apiInstance = new CustomObjectsApi(defaultClient);
    String group = "group_example"; // String | the custom resource's group
    String version = "version_example"; // String | the custom resource's version
    String namespace = "namespace_example"; // String | The custom resource's namespace
    String plural = "plural_example"; // String | 自定义资源的复数名。对于TPR,这将是小写复数形式。the custom resource's plural name. For TPRs this would be lowercase plural kind.
    String name = "name_example"; // String | the custom object's name
    try {
      Object result = apiInstance.getNamespacedCustomObject(group, version, namespace, plural, name);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling CustomObjectsApi#getNamespacedCustomObject");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
group String the custom resource's group
version String the custom resource's version
namespace String The custom resource's namespace
plural String 自定义资源的复数名。对于TPR,这将是小写复数形式。
name String the custom object's name

Return type

Object

Authorization

BearerToken

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 A single Resource -
401 Unauthorized -

getNamespacedCustomObjectScale


回到“自定义资源增删查改”目录

Object getNamespacedCustomObjectScale(group, version, namespace, plural, name)

read scale of the specified namespace scoped custom object

Example

// Import classes:
import io.kubernetes.client.openapi.ApiClient;
import io.kubernetes.client.openapi.ApiException;
import io.kubernetes.client.openapi.Configuration;
import io.kubernetes.client.openapi.auth.*;
import io.kubernetes.client.openapi.models.*;
import io.kubernetes.client.openapi.apis.CustomObjectsApi;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("http://localhost");
    
    // Configure API key authorization: BearerToken
    ApiKeyAuth BearerToken = (ApiKeyAuth) defaultClient.getAuthentication("BearerToken");
    BearerToken.setApiKey("YOUR API KEY");
    // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
    //BearerToken.setApiKeyPrefix("Token");

    CustomObjectsApi apiInstance = new CustomObjectsApi(defaultClient);
    String group = "group_example"; // String | the custom resource's group
    String version = "version_example"; // String | the custom resource's version
    String namespace = "namespace_example"; // String | The custom resource's namespace
    String plural = "plural_example"; // String | 自定义资源的复数名。对于TPR,这将是小写复数形式。the custom resource's plural name. For TPRs this would be lowercase plural kind.
    String name = "name_example"; // String | the custom object's name
    try {
      Object result = apiInstance.getNamespacedCustomObjectScale(group, version, namespace, plural, name);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling CustomObjectsApi#getNamespacedCustomObjectScale");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
group String the custom resource's group
version String the custom resource's version
namespace String The custom resource's namespace
plural String 自定义资源的复数名。对于TPR,这将是小写复数形式。
name String the custom object's name

Return type

Object

Authorization

BearerToken

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json, application/yaml, application/vnd.kubernetes.protobuf

HTTP response details

Status code Description Response headers
200 OK -
401 Unauthorized -

getNamespacedCustomObjectStatus


回到“自定义资源增删查改”目录

Object getNamespacedCustomObjectStatus(group, version, namespace, plural, name)

read status of the specified namespace scoped custom object

Example

// Import classes:
import io.kubernetes.client.openapi.ApiClient;
import io.kubernetes.client.openapi.ApiException;
import io.kubernetes.client.openapi.Configuration;
import io.kubernetes.client.openapi.auth.*;
import io.kubernetes.client.openapi.models.*;
import io.kubernetes.client.openapi.apis.CustomObjectsApi;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("http://localhost");
    
    // Configure API key authorization: BearerToken
    ApiKeyAuth BearerToken = (ApiKeyAuth) defaultClient.getAuthentication("BearerToken");
    BearerToken.setApiKey("YOUR API KEY");
    // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
    //BearerToken.setApiKeyPrefix("Token");

    CustomObjectsApi apiInstance = new CustomObjectsApi(defaultClient);
    String group = "group_example"; // String | the custom resource's group
    String version = "version_example"; // String | the custom resource's version
    String namespace = "namespace_example"; // String | The custom resource's namespace
    String plural = "plural_example"; // String | 自定义资源的复数名。对于TPR,这将是小写复数形式。the custom resource's plural name. For TPRs this would be lowercase plural kind.
    String name = "name_example"; // String | the custom object's name
    try {
      Object result = apiInstance.getNamespacedCustomObjectStatus(group, version, namespace, plural, name);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling CustomObjectsApi#getNamespacedCustomObjectStatus");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
group String the custom resource's group
version String the custom resource's version
namespace String The custom resource's namespace
plural String 自定义资源的复数名。对于TPR,这将是小写复数形式。
name String the custom object's name

Return type

Object

Authorization

BearerToken

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json, application/yaml, application/vnd.kubernetes.protobuf

HTTP response details

Status code Description Response headers
200 OK -
401 Unauthorized -

listClusterCustomObject


回到“自定义资源增删查改”目录

Object listClusterCustomObject(group, version, plural, pretty, _continue, fieldSelector, labelSelector, limit, resourceVersion, timeoutSeconds, watch)

list or watch cluster scoped custom objects

Example

// Import classes:
import io.kubernetes.client.openapi.ApiClient;
import io.kubernetes.client.openapi.ApiException;
import io.kubernetes.client.openapi.Configuration;
import io.kubernetes.client.openapi.auth.*;
import io.kubernetes.client.openapi.models.*;
import io.kubernetes.client.openapi.apis.CustomObjectsApi;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("http://localhost");
    
    // Configure API key authorization: BearerToken
    ApiKeyAuth BearerToken = (ApiKeyAuth) defaultClient.getAuthentication("BearerToken");
    BearerToken.setApiKey("YOUR API KEY");
    // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
    //BearerToken.setApiKeyPrefix("Token");

    CustomObjectsApi apiInstance = new CustomObjectsApi(defaultClient);
    String group = "group_example"; // String | The custom resource's group name
    String version = "version_example"; // String | The custom resource's version
    String plural = "plural_example"; // String | 自定义资源的复数名。对于TPR,这将是小写复数形式。The custom resource's plural name. For TPRs this would be lowercase plural kind.
    String pretty = "pretty_example"; // String | 如果为“true”,则输出相当打印。If 'true', then the output is pretty printed.
    String _continue = "_continue_example"; // String | 从服务器检索更多结果时,应设置“继续”选项。由于此值是服务器定义的,因此客户端只能使用具有相同查询参数(continue值除外)的上一个查询结果中的continue值,服务器可能会拒绝它无法识别的continue值。如果指定的continue值因过期(通常为5到15分钟)或服务器上的配置更改而不再有效,服务器将响应410 ResourceExpired错误和continue令牌。如果客户端需要一个一致的列表,它必须在不使用continue字段的情况下重新启动它们的列表。从另一台服务器发送的结果可能与前一台服务器发送的结果不一致,但从下一台服务器发送的结果可能与前一台服务器发送的结果不一致,只要他们的钥匙在“下一个钥匙”之后。watch为true时不支持此字段。客户端可以从服务器返回的最后一个resourceVersion值开始监视,并且不会错过任何修改。The continue option should be set when retrieving more results from the server. Since this value is server defined, clients may only use the continue value from a previous query result with identical query parameters (except for the value of continue) and the server may reject a continue value it does not recognize. If the specified continue value is no longer valid whether due to expiration (generally five to fifteen minutes) or a configuration change on the server, the server will respond with a 410 ResourceExpired error together with a continue token. If the client needs a consistent list, it must restart their list without the continue field. Otherwise, the client may send another list request with the token received with the 410 error, the server will respond with a list starting from the next key, but from the latest snapshot, which is inconsistent from the previous list results - objects that are created, modified, or deleted after the first list request will be included in the response, as long as their keys are after the "next key".  This field is not supported when watch is true. Clients may start a watch from the last resourceVersion value returned by the server and not miss any modifications.(except for the value of continue) and the server may reject a continue value it does not recognize. If the specified continue value is no longer valid whether due to expiration (generally five to fifteen minutes) or a configuration change on the server, the server will respond with a 410 ResourceExpired error together with a continue token. If the client needs a consistent list, it must restart their list without the continue field. Otherwise, the client may send another list request with the token received with the 410 error, the server will respond with a list starting from the next key, but from the latest snapshot, which is inconsistent from the previous list results - objects that are created, modified, or deleted after the first list request will be included in the response, as long as their keys are after the \"next key\".  This field is not supported when watch is true. Clients may start a watch from the last resourceVersion value returned by the server and not miss any modifications.
    String fieldSelector = "fieldSelector_example"; // String | 一个选择器,用于按字段限制返回对象的列表。默认为一切。A selector to restrict the list of returned objects by their fields. Defaults to everything.
    String labelSelector = "labelSelector_example"; // String | 一个选择器,用于根据返回对象的标签限制其列表。默认为一切。A selector to restrict the list of returned objects by their labels. Defaults to everything.
    Integer limit = 56; // Integer | limit是列表调用返回的最大响应数。如果存在更多项,服务器会将列表元数据上的“continue”字段设置为一个值,该值可用于同一初始查询,以检索下一组结果。如果所有请求的对象都被过滤掉,设置限制可能会返回少于请求数量的项目(最多为零个项目),客户端应该只使用continue字段来确定是否有更多结果可用。服务器可能会选择不支持limit参数,并将返回所有可用的结果。如果指定了limit且continue字段为空,则客户端可能会认为没有更多结果可用。如果watch为true,则不支持此字段。服务器保证在使用continue时返回的对象将与无限制地发出单个列表调用相同——也就是说,在发出第一个请求后创建、修改或删除的对象不会包含在任何后续的continue请求中。这有时被称为一致性快照,可以确保使用limit接收非常大结果的较小数据块的客户端可以确保看到所有可能的对象。如果在分块列表期间更新对象,则返回在计算第一个列表结果时存在的对象版本。limit is a maximum number of responses to return for a list call. If more items exist, the server will set the `continue` field on the list metadata to a value that can be used with the same initial query to retrieve the next set of results. Setting a limit may return fewer than the requested amount of items (up to zero items) in the event all requested objects are filtered out and clients should only use the presence of the continue field to determine whether more results are available. Servers may choose not to support the limit argument and will return all of the available results. If limit is specified and the continue field is empty, clients may assume that no more results are available. This field is not supported if watch is true.  The server guarantees that the objects returned when using continue will be identical to issuing a single list call without a limit - that is, no objects created, modified, or deleted after the first request is issued will be included in any subsequent continued requests. This is sometimes referred to as a consistent snapshot, and ensures that a client that is using limit to receive smaller chunks of a very large result can ensure they see all possible objects. If objects are updated during a chunked list the version of the object that was present at the time the first list result was calculated is returned.
    String resourceVersion = "resourceVersion_example"; // String | 当通过监视调用指定时,显示在资源的特定版本之后发生的更改。默认为历史开始时的更改。为列表指定时:-如果未设置,则根据仲裁读取标志从远程存储返回结果;-如果是0,那么我们只返回当前缓存中的内容,不保证;-如果设置为非零,则结果至少与给定值一样新鲜When specified with a watch call, shows changes that occur after that particular version of a resource. Defaults to changes from the beginning of history. When specified for list: - if unset, then the result is returned from remote storage based on quorum-read flag; - if it's 0, then we simply return what we currently have in cache, no guarantee; - if set to non zero, then the result is at least as fresh as given rv.
    Integer timeoutSeconds = 56; // Integer | 列表/监视呼叫超时。这会限制通话的持续时间,而不管通话是否处于活动状态。列表/监视呼叫超时。这会限制通话的持续时间,而不管通话是否处于活动状态。Timeout for the list/watch call. This limits the duration of the call, regardless of any activity or inactivity.
    Boolean watch = true; // Boolean | 观察对所描述资源的更改,并将其作为添加、更新和删除通知流返回。Watch for changes to the described resources and return them as a stream of add, update, and remove notifications.
    try {
      Object result = apiInstance.listClusterCustomObject(group, version, plural, pretty, _continue, fieldSelector, labelSelector, limit, resourceVersion, timeoutSeconds, watch);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling CustomObjectsApi#listClusterCustomObject");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
group String The custom resource's group name
version String The custom resource's version
plural String 自定义资源的复数名。对于TPR,这将是小写复数形式。
pretty String 如果为“true”,则输出相当打印。If 'true', then the output is pretty printed. [optional]
_continue String 从服务器检索更多结果时,应设置“继续”选项。由于此值是服务器定义的,因此客户端只能使用具有相同查询参数(continue值除外)的上一个查询结果中的continue值,服务器可能会拒绝它无法识别的continue值。如果指定的continue值因过期(通常为5到15分钟)或服务器上的配置更改而不再有效,服务器将响应410 ResourceExpired错误和continue令牌。如果客户端需要一个一致的列表,它必须在不使用continue字段的情况下重新启动它们的列表。从另一台服务器发送的结果可能与前一台服务器发送的结果不一致,但从下一台服务器发送的结果可能与前一台服务器发送的结果不一致,只要他们的钥匙在“下一个钥匙”之后。watch为true时不支持此字段。客户端可以从服务器返回的最后一个resourceVersion值开始监视,并且不会错过任何修改。The continue option should be set when retrieving more results from the server. Since this value is server defined, clients may only use the continue value from a previous query result with identical query parameters (except for the value of continue) and the server may reject a continue value it does not recognize. If the specified continue value is no longer valid whether due to expiration (generally five to fifteen minutes) or a configuration change on the server, the server will respond with a 410 ResourceExpired error together with a continue token. If the client needs a consistent list, it must restart their list without the continue field. Otherwise, the client may send another list request with the token received with the 410 error, the server will respond with a list starting from the next key, but from the latest snapshot, which is inconsistent from the previous list results - objects that are created, modified, or deleted after the first list request will be included in the response, as long as their keys are after the "next key". This field is not supported when watch is true. Clients may start a watch from the last resourceVersion value returned by the server and not miss any modifications.(except for the value of continue) and the server may reject a continue value it does not recognize. If the specified continue value is no longer valid whether due to expiration (generally five to fifteen minutes) or a configuration change on the server, the server will respond with a 410 ResourceExpired error together with a continue token. If the client needs a consistent list, it must restart their list without the continue field. Otherwise, the client may send another list request with the token received with the 410 error, the server will respond with a list starting from the next key, but from the latest snapshot, which is inconsistent from the previous list results - objects that are created, modified, or deleted after the first list request will be included in the response, as long as their keys are after the "next key". This field is not supported when watch is true. Clients may start a watch from the last resourceVersion value returned by the server and not miss any modifications. [optional]
fieldSelector String 一个选择器,用于按字段限制返回对象的列表。默认为一切。A selector to restrict the list of returned objects by their fields. Defaults to everything. [optional]
labelSelector String 一个选择器,用于根据返回对象的标签限制其列表。默认为一切。A selector to restrict the list of returned objects by their labels. Defaults to everything. [optional]
limit Integer limit是列表调用返回的最大响应数。如果存在更多项目,服务器将设置`继续`字段的值,该值可用于同一初始查询以检索下一组结果。如果所有请求的对象都被过滤掉,设置限制可能会返回少于请求数量的项目(最多为零个项目),客户端应该只使用continue字段来确定是否有更多结果可用。服务器可能会选择不支持limit参数,并将返回所有可用的结果。如果指定了limit且continue字段为空,则客户端可能会认为没有更多结果可用。如果watch为true,则不支持此字段。服务器保证在使用continue时返回的对象将与无限制地发出单个列表调用相同——也就是说,在发出第一个请求后创建、修改或删除的对象不会包含在任何后续的continue请求中。这有时被称为一致性快照,可以确保使用limit接收非常大结果的较小数据块的客户端可以确保看到所有可能的对象。如果在分块列表期间更新对象,则返回在计算第一个列表结果时存在的对象版本。 limit is a maximum number of responses to return for a list call. If more items exist, the server will set the `continue` field on the list metadata to a value that can be used with the same initial query to retrieve the next set of results. Setting a limit may return fewer than the requested amount of items (up to zero items) in the event all requested objects are filtered out and clients should only use the presence of the continue field to determine whether more results are available. Servers may choose not to support the limit argument and will return all of the available results. If limit is specified and the continue field is empty, clients may assume that no more results are available. This field is not supported if watch is true. The server guarantees that the objects returned when using continue will be identical to issuing a single list call without a limit - that is, no objects created, modified, or deleted after the first request is issued will be included in any subsequent continued requests. This is sometimes referred to as a consistent snapshot, and ensures that a client that is using limit to receive smaller chunks of a very large result can ensure they see all possible objects. If objects are updated during a chunked list the version of the object that was present at the time the first list result was calculated is returned. [optional]
resourceVersion String 当通过监视调用指定时,显示在资源的特定版本之后发生的更改。默认为历史开始时的更改。为列表指定时:-如果未设置,则根据仲裁读取标志从远程存储返回结果;-如果是's 0,然后我们只返回当前缓存中的内容,不保证;-如果设置为非零,则结果至少与给定值一样新鲜。When specified with a watch call, shows changes that occur after that particular version of a resource. Defaults to changes from the beginning of history. When specified for list: - if unset, then the result is returned from remote storage based on quorum-read flag; - if it's 0, then we simply return what we currently have in cache, no guarantee; - if set to non zero, then the result is at least as fresh as given rv. [optional]
timeoutSeconds Integer 列表/监视呼叫超时。这会限制通话的持续时间,而不管通话是否处于活动状态。列表/监视呼叫超时。这会限制通话的持续时间,而不管通话是否处于活动状态。Timeout for the list/watch call. This limits the duration of the call, regardless of any activity or inactivity. [optional]
watch Boolean 观察对所描述资源的更改,并将其作为添加、更新和删除通知流返回。Watch for changes to the described resources and return them as a stream of add, update, and remove notifications. [optional]

Return type

Object

Authorization

BearerToken

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json, application/json;stream=watch

HTTP response details

Status code Description Response headers
200 OK -
401 Unauthorized -

listNamespacedCustomObject


回到“自定义资源增删查改”目录

Object listNamespacedCustomObject(group, version, namespace, plural, pretty, _continue, fieldSelector, labelSelector, limit, resourceVersion, timeoutSeconds, watch)

list or watch namespace scoped custom objects

Example

// Import classes:
import io.kubernetes.client.openapi.ApiClient;
import io.kubernetes.client.openapi.ApiException;
import io.kubernetes.client.openapi.Configuration;
import io.kubernetes.client.openapi.auth.*;
import io.kubernetes.client.openapi.models.*;
import io.kubernetes.client.openapi.apis.CustomObjectsApi;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("http://localhost");
    
    // Configure API key authorization: BearerToken
    ApiKeyAuth BearerToken = (ApiKeyAuth) defaultClient.getAuthentication("BearerToken");
    BearerToken.setApiKey("YOUR API KEY");
    // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
    //BearerToken.setApiKeyPrefix("Token");

    CustomObjectsApi apiInstance = new CustomObjectsApi(defaultClient);
    String group = "group_example"; // String | The custom resource's group name
    String version = "version_example"; // String | The custom resource's version
    String namespace = "namespace_example"; // String | The custom resource's namespace
    String plural = "plural_example"; // String | 自定义资源的复数名。对于TPR,这将是小写复数形式。The custom resource's plural name. For TPRs this would be lowercase plural kind.
    String pretty = "pretty_example"; // String | 如果为“true”,则输出相当打印。If 'true', then the output is pretty printed.
    String _continue = "_continue_example"; // String | 从服务器检索更多结果时,应设置“继续”选项。由于此值是服务器定义的,因此客户端只能使用具有相同查询参数(continue值除外)的上一个查询结果中的continue值,服务器可能会拒绝它无法识别的continue值。如果指定的continue值因过期(通常为5到15分钟)或服务器上的配置更改而不再有效,服务器将响应410 ResourceExpired错误和continue令牌。如果客户端需要一个一致的列表,它必须在不使用continue字段的情况下重新启动它们的列表。从另一台服务器发送的结果可能与前一台服务器发送的结果不一致,但从下一台服务器发送的结果可能与前一台服务器发送的结果不一致,只要他们的钥匙在“下一个钥匙”之后。watch为true时不支持此字段。客户端可以从服务器返回的最后一个resourceVersion值开始监视,并且不会错过任何修改。The continue option should be set when retrieving more results from the server. Since this value is server defined, clients may only use the continue value from a previous query result with identical query parameters (except for the value of continue) and the server may reject a continue value it does not recognize. If the specified continue value is no longer valid whether due to expiration (generally five to fifteen minutes) or a configuration change on the server, the server will respond with a 410 ResourceExpired error together with a continue token. If the client needs a consistent list, it must restart their list without the continue field. Otherwise, the client may send another list request with the token received with the 410 error, the server will respond with a list starting from the next key, but from the latest snapshot, which is inconsistent from the previous list results - objects that are created, modified, or deleted after the first list request will be included in the response, as long as their keys are after the "next key".  This field is not supported when watch is true. Clients may start a watch from the last resourceVersion value returned by the server and not miss any modifications.(except for the value of continue) and the server may reject a continue value it does not recognize. If the specified continue value is no longer valid whether due to expiration (generally five to fifteen minutes) or a configuration change on the server, the server will respond with a 410 ResourceExpired error together with a continue token. If the client needs a consistent list, it must restart their list without the continue field. Otherwise, the client may send another list request with the token received with the 410 error, the server will respond with a list starting from the next key, but from the latest snapshot, which is inconsistent from the previous list results - objects that are created, modified, or deleted after the first list request will be included in the response, as long as their keys are after the \"next key\".  This field is not supported when watch is true. Clients may start a watch from the last resourceVersion value returned by the server and not miss any modifications.
    String fieldSelector = "fieldSelector_example"; // String | 一个选择器,用于按字段限制返回对象的列表。默认为一切。A selector to restrict the list of returned objects by their fields. Defaults to everything.
    String labelSelector = "labelSelector_example"; // String | 一个选择器,用于根据返回对象的标签限制其列表。默认为一切。A selector to restrict the list of returned objects by their labels. Defaults to everything.
    Integer limit = 56; // Integer | limit是列表调用返回的最大响应数。如果存在更多项,服务器会将列表元数据上的“continue”字段设置为一个值,该值可用于同一初始查询,以检索下一组结果。如果所有请求的对象都被过滤掉,设置限制可能会返回少于请求数量的项目(最多为零个项目),客户端应该只使用continue字段来确定是否有更多结果可用。服务器可能会选择不支持limit参数,并将返回所有可用的结果。如果指定了limit且continue字段为空,则客户端可能会认为没有更多结果可用。如果watch为true,则不支持此字段。服务器保证在使用continue时返回的对象将与无限制地发出单个列表调用相同——也就是说,在发出第一个请求后创建、修改或删除的对象不会包含在任何后续的continue请求中。这有时被称为一致性快照,可以确保使用limit接收非常大结果的较小数据块的客户端可以确保看到所有可能的对象。如果在分块列表期间更新对象,则返回在计算第一个列表结果时存在的对象版本。limit is a maximum number of responses to return for a list call. If more items exist, the server will set the `continue` field on the list metadata to a value that can be used with the same initial query to retrieve the next set of results. Setting a limit may return fewer than the requested amount of items (up to zero items) in the event all requested objects are filtered out and clients should only use the presence of the continue field to determine whether more results are available. Servers may choose not to support the limit argument and will return all of the available results. If limit is specified and the continue field is empty, clients may assume that no more results are available. This field is not supported if watch is true.  The server guarantees that the objects returned when using continue will be identical to issuing a single list call without a limit - that is, no objects created, modified, or deleted after the first request is issued will be included in any subsequent continued requests. This is sometimes referred to as a consistent snapshot, and ensures that a client that is using limit to receive smaller chunks of a very large result can ensure they see all possible objects. If objects are updated during a chunked list the version of the object that was present at the time the first list result was calculated is returned.
    String resourceVersion = "resourceVersion_example"; // String | 当通过监视调用指定时,显示在资源的特定版本之后发生的更改。默认为历史开始时的更改。为列表指定时:-如果未设置,则根据仲裁读取标志从远程存储返回结果;-如果是0,那么我们只返回当前缓存中的内容,不保证;-如果设置为非零,则结果至少与给定值一样新鲜When specified with a watch call, shows changes that occur after that particular version of a resource. Defaults to changes from the beginning of history. When specified for list: - if unset, then the result is returned from remote storage based on quorum-read flag; - if it's 0, then we simply return what we currently have in cache, no guarantee; - if set to non zero, then the result is at least as fresh as given rv.
    Integer timeoutSeconds = 56; // Integer | 列表/监视呼叫超时。这会限制通话的持续时间,而不管通话是否处于活动状态。列表/监视呼叫超时。这会限制通话的持续时间,而不管通话是否处于活动状态。Timeout for the list/watch call. This limits the duration of the call, regardless of any activity or inactivity.
    Boolean watch = true; // Boolean | 观察对所描述资源的更改,并将其作为添加、更新和删除通知流返回。Watch for changes to the described resources and return them as a stream of add, update, and remove notifications.
    try {
      Object result = apiInstance.listNamespacedCustomObject(group, version, namespace, plural, pretty, _continue, fieldSelector, labelSelector, limit, resourceVersion, timeoutSeconds, watch);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling CustomObjectsApi#listNamespacedCustomObject");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
group String The custom resource's group name
version String The custom resource's version
namespace String The custom resource's namespace
plural String 自定义资源的复数名。对于TPR,这将是小写复数形式。
pretty String 如果为“true”,则输出相当打印。If 'true', then the output is pretty printed. [optional]
_continue String 从服务器检索更多结果时,应设置“继续”选项。由于此值是服务器定义的,因此客户端只能使用具有相同查询参数(continue值除外)的上一个查询结果中的continue值,服务器可能会拒绝它无法识别的continue值。如果指定的continue值因过期(通常为5到15分钟)或服务器上的配置更改而不再有效,服务器将响应410 ResourceExpired错误和continue令牌。如果客户端需要一个一致的列表,它必须在不使用continue字段的情况下重新启动它们的列表。从另一台服务器发送的结果可能与前一台服务器发送的结果不一致,但从下一台服务器发送的结果可能与前一台服务器发送的结果不一致,只要他们的钥匙在“下一个钥匙”之后。watch为true时不支持此字段。客户端可以从服务器返回的最后一个resourceVersion值开始监视,并且不会错过任何修改。The continue option should be set when retrieving more results from the server. Since this value is server defined, clients may only use the continue value from a previous query result with identical query parameters (except for the value of continue) and the server may reject a continue value it does not recognize. If the specified continue value is no longer valid whether due to expiration (generally five to fifteen minutes) or a configuration change on the server, the server will respond with a 410 ResourceExpired error together with a continue token. If the client needs a consistent list, it must restart their list without the continue field. Otherwise, the client may send another list request with the token received with the 410 error, the server will respond with a list starting from the next key, but from the latest snapshot, which is inconsistent from the previous list results - objects that are created, modified, or deleted after the first list request will be included in the response, as long as their keys are after the "next key". This field is not supported when watch is true. Clients may start a watch from the last resourceVersion value returned by the server and not miss any modifications.(except for the value of continue) and the server may reject a continue value it does not recognize. If the specified continue value is no longer valid whether due to expiration (generally five to fifteen minutes) or a configuration change on the server, the server will respond with a 410 ResourceExpired error together with a continue token. If the client needs a consistent list, it must restart their list without the continue field. Otherwise, the client may send another list request with the token received with the 410 error, the server will respond with a list starting from the next key, but from the latest snapshot, which is inconsistent from the previous list results - objects that are created, modified, or deleted after the first list request will be included in the response, as long as their keys are after the "next key". This field is not supported when watch is true. Clients may start a watch from the last resourceVersion value returned by the server and not miss any modifications. [optional]
fieldSelector String 一个选择器,用于按字段限制返回对象的列表。默认为一切。A selector to restrict the list of returned objects by their fields. Defaults to everything. [optional]
labelSelector String 一个选择器,用于根据返回对象的标签限制其列表。默认为一切。A selector to restrict the list of returned objects by their labels. Defaults to everything. [optional]
limit Integer limit是列表调用返回的最大响应数。如果存在更多项目,服务器将设置`继续`字段的值,该值可用于同一初始查询以检索下一组结果。如果所有请求的对象都被过滤掉,设置限制可能会返回少于请求数量的项目(最多为零个项目),客户端应该只使用continue字段来确定是否有更多结果可用。服务器可能会选择不支持limit参数,并将返回所有可用的结果。如果指定了limit且continue字段为空,则客户端可能会认为没有更多结果可用。如果watch为true,则不支持此字段。服务器保证在使用continue时返回的对象将与无限制地发出单个列表调用相同——也就是说,在发出第一个请求后创建、修改或删除的对象不会包含在任何后续的continue请求中。这有时被称为一致性快照,可以确保使用limit接收非常大结果的较小数据块的客户端可以确保看到所有可能的对象。如果在分块列表期间更新对象,则返回在计算第一个列表结果时存在的对象版本。 limit is a maximum number of responses to return for a list call. If more items exist, the server will set the `continue` field on the list metadata to a value that can be used with the same initial query to retrieve the next set of results. Setting a limit may return fewer than the requested amount of items (up to zero items) in the event all requested objects are filtered out and clients should only use the presence of the continue field to determine whether more results are available. Servers may choose not to support the limit argument and will return all of the available results. If limit is specified and the continue field is empty, clients may assume that no more results are available. This field is not supported if watch is true. The server guarantees that the objects returned when using continue will be identical to issuing a single list call without a limit - that is, no objects created, modified, or deleted after the first request is issued will be included in any subsequent continued requests. This is sometimes referred to as a consistent snapshot, and ensures that a client that is using limit to receive smaller chunks of a very large result can ensure they see all possible objects. If objects are updated during a chunked list the version of the object that was present at the time the first list result was calculated is returned. [optional]
resourceVersion String 当通过监视调用指定时,显示在资源的特定版本之后发生的更改。默认为历史开始时的更改。为列表指定时:-如果未设置,则根据仲裁读取标志从远程存储返回结果;-如果是's 0,然后我们只返回当前缓存中的内容,不保证;-如果设置为非零,则结果至少与给定值一样新鲜。When specified with a watch call, shows changes that occur after that particular version of a resource. Defaults to changes from the beginning of history. When specified for list: - if unset, then the result is returned from remote storage based on quorum-read flag; - if it's 0, then we simply return what we currently have in cache, no guarantee; - if set to non zero, then the result is at least as fresh as given rv. [optional]
timeoutSeconds Integer 列表/监视呼叫超时。这会限制通话的持续时间,而不管通话是否处于活动状态。列表/监视呼叫超时。这会限制通话的持续时间,而不管通话是否处于活动状态。Timeout for the list/watch call. This limits the duration of the call, regardless of any activity or inactivity. [optional]
watch Boolean 观察对所描述资源的更改,并将其作为添加、更新和删除通知流返回。Watch for changes to the described resources and return them as a stream of add, update, and remove notifications. [optional]

Return type

Object

Authorization

BearerToken

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json, application/json;stream=watch

HTTP response details

Status code Description Response headers
200 OK -
401 Unauthorized -

patchClusterCustomObject


回到“自定义资源增删查改”目录

Object patchClusterCustomObject(group, version, plural, name, body, dryRun, fieldManager, force)

patch the specified cluster scoped custom object

Example

// Import classes:
import io.kubernetes.client.openapi.ApiClient;
import io.kubernetes.client.openapi.ApiException;
import io.kubernetes.client.openapi.Configuration;
import io.kubernetes.client.openapi.auth.*;
import io.kubernetes.client.openapi.models.*;
import io.kubernetes.client.openapi.apis.CustomObjectsApi;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("http://localhost");
    
    // Configure API key authorization: BearerToken
    ApiKeyAuth BearerToken = (ApiKeyAuth) defaultClient.getAuthentication("BearerToken");
    BearerToken.setApiKey("YOUR API KEY");
    // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
    //BearerToken.setApiKeyPrefix("Token");

    CustomObjectsApi apiInstance = new CustomObjectsApi(defaultClient);
    String group = "group_example"; // String | the custom resource's group
    String version = "version_example"; // String | the custom resource's version
    String plural = "plural_example"; // String | 自定义资源的复数名。对于TPR,这将是小写复数形式。the custom object's plural name. For TPRs this would be lowercase plural kind.
    String name = "name_example"; // String | the custom object's name
    Object body = null; // Object | The JSON schema of the Resource to patch.
    String dryRun = "dryRun_example"; // String | 如果存在,则表示不应保留修改。无效或无法识别的dryRun指令将导致错误响应,并且不会进一步处理请求。有效值为:-全部:将处理所有干运行阶段。When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed
    String fieldManager = "fieldManager_example"; // String |  fieldManager是与进行这些更改的参与者或实体关联的名称。该值的长度必须小于或128个字符,并且仅包含可打印字符,如https://golang.org/pkg/unicode/#IsPrint.fieldManager is a name associated with the actor or entity that is making these changes. The value must be less than or 128 characters long, and only contain printable characters, as defined by https://golang.org/pkg/unicode/#IsPrint. This field is required for apply requests (application/apply-patch) but optional for non-apply patch types (JsonPatch, MergePatch, StrategicMergePatch).
    Boolean force = true; // Boolean | Force将“强制”应用请求。这意味着用户将重新获取其他人拥有的冲突字段。对于非应用补丁请求,必须取消设置强制标志。Force is going to \"force\" Apply requests. It means user will re-acquire conflicting fields owned by other people. Force flag must be unset for non-apply patch requests.
    try {
      Object result = apiInstance.patchClusterCustomObject(group, version, plural, name, body, dryRun, fieldManager, force);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling CustomObjectsApi#patchClusterCustomObject");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
group String the custom resource's group
version String the custom resource's version
plural String 自定义资源的复数名。对于TPR,这将是小写复数形式。
name String the custom object's name
body Object The JSON schema of the Resource to patch.
dryRun String 如果存在,则表示不应保留修改。无效或无法识别的dryRun指令将导致错误响应,并且不会进一步处理请求。有效值为:-全部:将处理所有干运行阶段。When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed [optional]
fieldManager String fieldManager是与进行这些更改的参与者或实体关联的名称。该值的长度必须小于或128个字符,并且仅包含可打印字符,如https://golang.org/pkg/unicode/#IsPrint.fieldManager is a name associated with the actor or entity that is making these changes. The value must be less than or 128 characters long, and only contain printable characters, as defined by https://golang.org/pkg/unicode/#IsPrint. This field is required for apply requests (application/apply-patch) but optional for non-apply patch types (JsonPatch, MergePatch, StrategicMergePatch). [optional]
force Boolean Force将“强制”应用请求。这意味着用户将重新获取其他人拥有的冲突字段。对于非应用补丁请求,必须取消设置强制标志。Force is going to "force" Apply requests. It means user will re-acquire conflicting fields owned by other people. Force flag must be unset for non-apply patch requests. [optional]

Return type

Object

Authorization

BearerToken

HTTP request headers

  • Content-Type: application/json-patch+json, application/merge-patch+json
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 OK -
401 Unauthorized -

patchClusterCustomObjectScale


回到“自定义资源增删查改”目录

Object patchClusterCustomObjectScale(group, version, plural, name, body, dryRun, fieldManager, force)

partially update scale of the specified cluster scoped custom object

Example

// Import classes:
import io.kubernetes.client.openapi.ApiClient;
import io.kubernetes.client.openapi.ApiException;
import io.kubernetes.client.openapi.Configuration;
import io.kubernetes.client.openapi.auth.*;
import io.kubernetes.client.openapi.models.*;
import io.kubernetes.client.openapi.apis.CustomObjectsApi;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("http://localhost");
    
    // Configure API key authorization: BearerToken
    ApiKeyAuth BearerToken = (ApiKeyAuth) defaultClient.getAuthentication("BearerToken");
    BearerToken.setApiKey("YOUR API KEY");
    // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
    //BearerToken.setApiKeyPrefix("Token");

    CustomObjectsApi apiInstance = new CustomObjectsApi(defaultClient);
    String group = "group_example"; // String | the custom resource's group
    String version = "version_example"; // String | the custom resource's version
    String plural = "plural_example"; // String | 自定义资源的复数名。对于TPR,这将是小写复数形式。the custom resource's plural name. For TPRs this would be lowercase plural kind.
    String name = "name_example"; // String | the custom object's name
    Object body = null; // Object | 
    String dryRun = "dryRun_example"; // String | 如果存在,则表示不应保留修改。无效或无法识别的dryRun指令将导致错误响应,并且不会进一步处理请求。有效值为:-全部:将处理所有干运行阶段。When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed
    String fieldManager = "fieldManager_example"; // String |  fieldManager是与进行这些更改的参与者或实体关联的名称。该值的长度必须小于或128个字符,并且仅包含可打印字符,如https://golang.org/pkg/unicode/#IsPrint.fieldManager is a name associated with the actor or entity that is making these changes. The value must be less than or 128 characters long, and only contain printable characters, as defined by https://golang.org/pkg/unicode/#IsPrint. This field is required for apply requests (application/apply-patch) but optional for non-apply patch types (JsonPatch, MergePatch, StrategicMergePatch).
    Boolean force = true; // Boolean | Force将“强制”应用请求。这意味着用户将重新获取其他人拥有的冲突字段。对于非应用补丁请求,必须取消设置强制标志。Force is going to \"force\" Apply requests. It means user will re-acquire conflicting fields owned by other people. Force flag must be unset for non-apply patch requests.
    try {
      Object result = apiInstance.patchClusterCustomObjectScale(group, version, plural, name, body, dryRun, fieldManager, force);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling CustomObjectsApi#patchClusterCustomObjectScale");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
group String the custom resource's group
version String the custom resource's version
plural String 自定义资源的复数名。对于TPR,这将是小写复数形式。.
name String the custom object's name
body Object
dryRun String 如果存在,则表示不应保留修改。无效或无法识别的dryRun指令将导致错误响应,并且不会进一步处理请求。有效值为:-全部:将处理所有干运行阶段。When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed [optional]
fieldManager String fieldManager是与进行这些更改的参与者或实体关联的名称。该值的长度必须小于或128个字符,并且仅包含可打印字符,如https://golang.org/pkg/unicode/#IsPrint.fieldManager is a name associated with the actor or entity that is making these changes. The value must be less than or 128 characters long, and only contain printable characters, as defined by https://golang.org/pkg/unicode/#IsPrint. This field is required for apply requests (application/apply-patch) but optional for non-apply patch types (JsonPatch, MergePatch, StrategicMergePatch). [optional]
force Boolean Force将“强制”应用请求。这意味着用户将重新获取其他人拥有的冲突字段。对于非应用补丁请求,必须取消设置强制标志。Force is going to "force" Apply requests. It means user will re-acquire conflicting fields owned by other people. Force flag must be unset for non-apply patch requests. [optional]

Return type

Object

Authorization

BearerToken

HTTP request headers

  • Content-Type: application/json-patch+json, application/merge-patch+json
  • Accept: application/json, application/yaml, application/vnd.kubernetes.protobuf

HTTP response details

Status code Description Response headers
200 OK -
401 Unauthorized -

patchClusterCustomObjectStatus


回到“自定义资源增删查改”目录

Object patchClusterCustomObjectStatus(group, version, plural, name, body, dryRun, fieldManager, force)

partially update status of the specified cluster scoped custom object

Example

// Import classes:
import io.kubernetes.client.openapi.ApiClient;
import io.kubernetes.client.openapi.ApiException;
import io.kubernetes.client.openapi.Configuration;
import io.kubernetes.client.openapi.auth.*;
import io.kubernetes.client.openapi.models.*;
import io.kubernetes.client.openapi.apis.CustomObjectsApi;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("http://localhost");
    
    // Configure API key authorization: BearerToken
    ApiKeyAuth BearerToken = (ApiKeyAuth) defaultClient.getAuthentication("BearerToken");
    BearerToken.setApiKey("YOUR API KEY");
    // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
    //BearerToken.setApiKeyPrefix("Token");

    CustomObjectsApi apiInstance = new CustomObjectsApi(defaultClient);
    String group = "group_example"; // String | the custom resource's group
    String version = "version_example"; // String | the custom resource's version
    String plural = "plural_example"; // String | 自定义资源的复数名。对于TPR,这将是小写复数形式。the custom resource's plural name. For TPRs this would be lowercase plural kind.
    String name = "name_example"; // String | the custom object's name
    Object body = null; // Object | 
    String dryRun = "dryRun_example"; // String | 如果存在,则表示不应保留修改。无效或无法识别的dryRun指令将导致错误响应,并且不会进一步处理请求。有效值为:-全部:将处理所有干运行阶段。When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed
    String fieldManager = "fieldManager_example"; // String |  fieldManager是与进行这些更改的参与者或实体关联的名称。该值的长度必须小于或128个字符,并且仅包含可打印字符,如https://golang.org/pkg/unicode/#IsPrint.fieldManager is a name associated with the actor or entity that is making these changes. The value must be less than or 128 characters long, and only contain printable characters, as defined by https://golang.org/pkg/unicode/#IsPrint. This field is required for apply requests (application/apply-patch) but optional for non-apply patch types (JsonPatch, MergePatch, StrategicMergePatch).
    Boolean force = true; // Boolean | Force将“强制”应用请求。这意味着用户将重新获取其他人拥有的冲突字段。对于非应用补丁请求,必须取消设置强制标志。Force is going to \"force\" Apply requests. It means user will re-acquire conflicting fields owned by other people. Force flag must be unset for non-apply patch requests.
    try {
      Object result = apiInstance.patchClusterCustomObjectStatus(group, version, plural, name, body, dryRun, fieldManager, force);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling CustomObjectsApi#patchClusterCustomObjectStatus");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
group String the custom resource's group
version String the custom resource's version
plural String 自定义资源的复数名。对于TPR,这将是小写复数形式。
name String the custom object's name
body Object
dryRun String 如果存在,则表示不应保留修改。无效或无法识别的dryRun指令将导致错误响应,并且不会进一步处理请求。有效值为:-全部:将处理所有干运行阶段。When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed [optional]
fieldManager String fieldManager是与进行这些更改的参与者或实体关联的名称。该值的长度必须小于或128个字符,并且仅包含可打印字符,如https://golang.org/pkg/unicode/#IsPrint.fieldManager is a name associated with the actor or entity that is making these changes. The value must be less than or 128 characters long, and only contain printable characters, as defined by https://golang.org/pkg/unicode/#IsPrint. This field is required for apply requests (application/apply-patch) but optional for non-apply patch types (JsonPatch, MergePatch, StrategicMergePatch). [optional]
force Boolean Force将“强制”应用请求。这意味着用户将重新获取其他人拥有的冲突字段。对于非应用补丁请求,必须取消设置强制标志。Force is going to "force" Apply requests. It means user will re-acquire conflicting fields owned by other people. Force flag must be unset for non-apply patch requests. [optional]

Return type

Object

Authorization

BearerToken

HTTP request headers

  • Content-Type: application/json-patch+json, application/merge-patch+json
  • Accept: application/json, application/yaml, application/vnd.kubernetes.protobuf

HTTP response details

Status code Description Response headers
200 OK -
401 Unauthorized -

patchNamespacedCustomObject


回到“自定义资源增删查改”目录

Object patchNamespacedCustomObject(group, version, namespace, plural, name, body, dryRun, fieldManager, force)

patch the specified namespace scoped custom object

Example

// Import classes:
import io.kubernetes.client.openapi.ApiClient;
import io.kubernetes.client.openapi.ApiException;
import io.kubernetes.client.openapi.Configuration;
import io.kubernetes.client.openapi.auth.*;
import io.kubernetes.client.openapi.models.*;
import io.kubernetes.client.openapi.apis.CustomObjectsApi;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("http://localhost");
    
    // Configure API key authorization: BearerToken
    ApiKeyAuth BearerToken = (ApiKeyAuth) defaultClient.getAuthentication("BearerToken");
    BearerToken.setApiKey("YOUR API KEY");
    // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
    //BearerToken.setApiKeyPrefix("Token");

    CustomObjectsApi apiInstance = new CustomObjectsApi(defaultClient);
    String group = "group_example"; // String | the custom resource's group
    String version = "version_example"; // String | the custom resource's version
    String namespace = "namespace_example"; // String | The custom resource's namespace
    String plural = "plural_example"; // String | 自定义资源的复数名。对于TPR,这将是小写复数形式。the custom resource's plural name. For TPRs this would be lowercase plural kind.
    String name = "name_example"; // String | the custom object's name
    Object body = null; // Object | The JSON schema of the Resource to patch.
    String dryRun = "dryRun_example"; // String | 如果存在,则表示不应保留修改。无效或无法识别的dryRun指令将导致错误响应,并且不会进一步处理请求。有效值为:-全部:将处理所有干运行阶段。When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed
    String fieldManager = "fieldManager_example"; // String |  fieldManager是与进行这些更改的参与者或实体关联的名称。该值的长度必须小于或128个字符,并且仅包含可打印字符,如https://golang.org/pkg/unicode/#IsPrint.fieldManager is a name associated with the actor or entity that is making these changes. The value must be less than or 128 characters long, and only contain printable characters, as defined by https://golang.org/pkg/unicode/#IsPrint. This field is required for apply requests (application/apply-patch) but optional for non-apply patch types (JsonPatch, MergePatch, StrategicMergePatch).
    Boolean force = true; // Boolean | Force将“强制”应用请求。这意味着用户将重新获取其他人拥有的冲突字段。对于非应用补丁请求,必须取消设置强制标志。Force is going to \"force\" Apply requests. It means user will re-acquire conflicting fields owned by other people. Force flag must be unset for non-apply patch requests.
    try {
      Object result = apiInstance.patchNamespacedCustomObject(group, version, namespace, plural, name, body, dryRun, fieldManager, force);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling CustomObjectsApi#patchNamespacedCustomObject");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
group String the custom resource's group
version String the custom resource's version
namespace String The custom resource's namespace
plural String 自定义资源的复数名。对于TPR,这将是小写复数形式。
name String the custom object's name
body Object The JSON schema of the Resource to patch.
dryRun String 如果存在,则表示不应保留修改。无效或无法识别的dryRun指令将导致错误响应,并且不会进一步处理请求。有效值为:-全部:将处理所有干运行阶段。When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed [optional]
fieldManager String fieldManager是与进行这些更改的参与者或实体关联的名称。该值的长度必须小于或128个字符,并且仅包含可打印字符,如https://golang.org/pkg/unicode/#IsPrint.fieldManager is a name associated with the actor or entity that is making these changes. The value must be less than or 128 characters long, and only contain printable characters, as defined by https://golang.org/pkg/unicode/#IsPrint. This field is required for apply requests (application/apply-patch) but optional for non-apply patch types (JsonPatch, MergePatch, StrategicMergePatch). [optional]
force Boolean Force将“强制”应用请求。这意味着用户将重新获取其他人拥有的冲突字段。对于非应用补丁请求,必须取消设置强制标志。Force is going to "force" Apply requests. It means user will re-acquire conflicting fields owned by other people. Force flag must be unset for non-apply patch requests. [optional]

Return type

Object

Authorization

BearerToken

HTTP request headers

  • Content-Type: application/json-patch+json, application/merge-patch+json
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 OK -
401 Unauthorized -

patchNamespacedCustomObjectScale


回到“自定义资源增删查改”目录

Object patchNamespacedCustomObjectScale(group, version, namespace, plural, name, body, dryRun, fieldManager, force)

partially update scale of the specified namespace scoped custom object

Example

// Import classes:
import io.kubernetes.client.openapi.ApiClient;
import io.kubernetes.client.openapi.ApiException;
import io.kubernetes.client.openapi.Configuration;
import io.kubernetes.client.openapi.auth.*;
import io.kubernetes.client.openapi.models.*;
import io.kubernetes.client.openapi.apis.CustomObjectsApi;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("http://localhost");
    
    // Configure API key authorization: BearerToken
    ApiKeyAuth BearerToken = (ApiKeyAuth) defaultClient.getAuthentication("BearerToken");
    BearerToken.setApiKey("YOUR API KEY");
    // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
    //BearerToken.setApiKeyPrefix("Token");

    CustomObjectsApi apiInstance = new CustomObjectsApi(defaultClient);
    String group = "group_example"; // String | the custom resource's group
    String version = "version_example"; // String | the custom resource's version
    String namespace = "namespace_example"; // String | The custom resource's namespace
    String plural = "plural_example"; // String | 自定义资源的复数名。对于TPR,这将是小写复数形式。the custom resource's plural name. For TPRs this would be lowercase plural kind.
    String name = "name_example"; // String | the custom object's name
    Object body = null; // Object | 
    String dryRun = "dryRun_example"; // String | 如果存在,则表示不应保留修改。无效或无法识别的dryRun指令将导致错误响应,并且不会进一步处理请求。有效值为:-全部:将处理所有干运行阶段。When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed
    String fieldManager = "fieldManager_example"; // String |  fieldManager是与进行这些更改的参与者或实体关联的名称。该值的长度必须小于或128个字符,并且仅包含可打印字符,如https://golang.org/pkg/unicode/#IsPrint.fieldManager is a name associated with the actor or entity that is making these changes. The value must be less than or 128 characters long, and only contain printable characters, as defined by https://golang.org/pkg/unicode/#IsPrint. This field is required for apply requests (application/apply-patch) but optional for non-apply patch types (JsonPatch, MergePatch, StrategicMergePatch).
    Boolean force = true; // Boolean | Force将“强制”应用请求。这意味着用户将重新获取其他人拥有的冲突字段。对于非应用补丁请求,必须取消设置强制标志。Force is going to \"force\" Apply requests. It means user will re-acquire conflicting fields owned by other people. Force flag must be unset for non-apply patch requests.
    try {
      Object result = apiInstance.patchNamespacedCustomObjectScale(group, version, namespace, plural, name, body, dryRun, fieldManager, force);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling CustomObjectsApi#patchNamespacedCustomObjectScale");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
group String the custom resource's group
version String the custom resource's version
namespace String The custom resource's namespace
plural String 自定义资源的复数名。对于TPR,这将是小写复数形式。
name String the custom object's name
body Object
dryRun String 如果存在,则表示不应保留修改。无效或无法识别的dryRun指令将导致错误响应,并且不会进一步处理请求。有效值为:-全部:将处理所有干运行阶段。When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed [optional]
fieldManager String fieldManager是与进行这些更改的参与者或实体关联的名称。该值的长度必须小于或128个字符,并且仅包含可打印字符,如https://golang.org/pkg/unicode/#IsPrint.fieldManager is a name associated with the actor or entity that is making these changes. The value must be less than or 128 characters long, and only contain printable characters, as defined by https://golang.org/pkg/unicode/#IsPrint. This field is required for apply requests (application/apply-patch) but optional for non-apply patch types (JsonPatch, MergePatch, StrategicMergePatch). [optional]
force Boolean Force将“强制”应用请求。这意味着用户将重新获取其他人拥有的冲突字段。对于非应用补丁请求,必须取消设置强制标志。Force is going to "force" Apply requests. It means user will re-acquire conflicting fields owned by other people. Force flag must be unset for non-apply patch requests. [optional]

Return type

Object

Authorization

BearerToken

HTTP request headers

  • Content-Type: application/json-patch+json, application/merge-patch+json, application/apply-patch+yaml
  • Accept: application/json, application/yaml, application/vnd.kubernetes.protobuf

HTTP response details

Status code Description Response headers
200 OK -
401 Unauthorized -

patchNamespacedCustomObjectStatus


回到“自定义资源增删查改”目录

Object patchNamespacedCustomObjectStatus(group, version, namespace, plural, name, body, dryRun, fieldManager, force)

partially update status of the specified namespace scoped custom object

Example

// Import classes:
import io.kubernetes.client.openapi.ApiClient;
import io.kubernetes.client.openapi.ApiException;
import io.kubernetes.client.openapi.Configuration;
import io.kubernetes.client.openapi.auth.*;
import io.kubernetes.client.openapi.models.*;
import io.kubernetes.client.openapi.apis.CustomObjectsApi;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("http://localhost");
    
    // Configure API key authorization: BearerToken
    ApiKeyAuth BearerToken = (ApiKeyAuth) defaultClient.getAuthentication("BearerToken");
    BearerToken.setApiKey("YOUR API KEY");
    // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
    //BearerToken.setApiKeyPrefix("Token");

    CustomObjectsApi apiInstance = new CustomObjectsApi(defaultClient);
    String group = "group_example"; // String | the custom resource's group
    String version = "version_example"; // String | the custom resource's version
    String namespace = "namespace_example"; // String | The custom resource's namespace
    String plural = "plural_example"; // String | 自定义资源的复数名。对于TPR,这将是小写复数形式。the custom resource's plural name. For TPRs this would be lowercase plural kind.
    String name = "name_example"; // String | the custom object's name
    Object body = null; // Object | 
    String dryRun = "dryRun_example"; // String | 如果存在,则表示不应保留修改。无效或无法识别的dryRun指令将导致错误响应,并且不会进一步处理请求。有效值为:-全部:将处理所有干运行阶段。When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed
    String fieldManager = "fieldManager_example"; // String |  fieldManager是与进行这些更改的参与者或实体关联的名称。该值的长度必须小于或128个字符,并且仅包含可打印字符,如https://golang.org/pkg/unicode/#IsPrint.fieldManager is a name associated with the actor or entity that is making these changes. The value must be less than or 128 characters long, and only contain printable characters, as defined by https://golang.org/pkg/unicode/#IsPrint. This field is required for apply requests (application/apply-patch) but optional for non-apply patch types (JsonPatch, MergePatch, StrategicMergePatch).
    Boolean force = true; // Boolean | Force将“强制”应用请求。这意味着用户将重新获取其他人拥有的冲突字段。对于非应用补丁请求,必须取消设置强制标志。Force is going to \"force\" Apply requests. It means user will re-acquire conflicting fields owned by other people. Force flag must be unset for non-apply patch requests.
    try {
      Object result = apiInstance.patchNamespacedCustomObjectStatus(group, version, namespace, plural, name, body, dryRun, fieldManager, force);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling CustomObjectsApi#patchNamespacedCustomObjectStatus");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
group String the custom resource's group
version String the custom resource's version
namespace String The custom resource's namespace
plural String 自定义资源的复数名。对于TPR,这将是小写复数形式。
name String the custom object's name
body Object
dryRun String 如果存在,则表示不应保留修改。无效或无法识别的dryRun指令将导致错误响应,并且不会进一步处理请求。有效值为:-全部:将处理所有干运行阶段。When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed [optional]
fieldManager String fieldManager是与进行这些更改的参与者或实体关联的名称。该值的长度必须小于或128个字符,并且仅包含可打印字符,如https://golang.org/pkg/unicode/#IsPrint.fieldManager is a name associated with the actor or entity that is making these changes. The value must be less than or 128 characters long, and only contain printable characters, as defined by https://golang.org/pkg/unicode/#IsPrint. This field is required for apply requests (application/apply-patch) but optional for non-apply patch types (JsonPatch, MergePatch, StrategicMergePatch). [optional]
force Boolean Force将“强制”应用请求。这意味着用户将重新获取其他人拥有的冲突字段。对于非应用补丁请求,必须取消设置强制标志。Force is going to "force" Apply requests. It means user will re-acquire conflicting fields owned by other people. Force flag must be unset for non-apply patch requests. [optional]

Return type

Object

Authorization

BearerToken

HTTP request headers

  • Content-Type: application/json-patch+json, application/merge-patch+json, application/apply-patch+yaml
  • Accept: application/json, application/yaml, application/vnd.kubernetes.protobuf

HTTP response details

Status code Description Response headers
200 OK -
401 Unauthorized -

replaceClusterCustomObject


回到“自定义资源增删查改”目录

Object replaceClusterCustomObject(group, version, plural, name, body, dryRun, fieldManager)

replace the specified cluster scoped custom object

Example

// Import classes:
import io.kubernetes.client.openapi.ApiClient;
import io.kubernetes.client.openapi.ApiException;
import io.kubernetes.client.openapi.Configuration;
import io.kubernetes.client.openapi.auth.*;
import io.kubernetes.client.openapi.models.*;
import io.kubernetes.client.openapi.apis.CustomObjectsApi;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("http://localhost");
    
    // Configure API key authorization: BearerToken
    ApiKeyAuth BearerToken = (ApiKeyAuth) defaultClient.getAuthentication("BearerToken");
    BearerToken.setApiKey("YOUR API KEY");
    // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
    //BearerToken.setApiKeyPrefix("Token");

    CustomObjectsApi apiInstance = new CustomObjectsApi(defaultClient);
    String group = "group_example"; // String | the custom resource's group
    String version = "version_example"; // String | the custom resource's version
    String plural = "plural_example"; // String | 自定义资源的复数名。对于TPR,这将是小写复数形式。the custom object's plural name. For TPRs this would be lowercase plural kind.
    String name = "name_example"; // String | the custom object's name
    Object body = null; // Object | The JSON schema of the Resource to replace.
    String dryRun = "dryRun_example"; // String | 如果存在,则表示不应保留修改。无效或无法识别的dryRun指令将导致错误响应,并且不会进一步处理请求。有效值为:-全部:将处理所有干运行阶段。When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed
    String fieldManager = "fieldManager_example"; // String |  fieldManager是与进行这些更改的参与者或实体关联的名称。该值的长度必须小于或128个字符,并且仅包含可打印字符,如https://golang.org/pkg/unicode/#IsPrint.fieldManager is a name associated with the actor or entity that is making these changes. The value must be less than or 128 characters long, and only contain printable characters, as defined by https://golang.org/pkg/unicode/#IsPrint.
    try {
      Object result = apiInstance.replaceClusterCustomObject(group, version, plural, name, body, dryRun, fieldManager);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling CustomObjectsApi#replaceClusterCustomObject");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
group String the custom resource's group
version String the custom resource's version
plural String the custom object's plural name. For TPRs this would be lowercase plural kind.
name String the custom object's name
body Object The JSON schema of the Resource to replace.
dryRun String 如果存在,则表示不应保留修改。无效或无法识别的dryRun指令将导致错误响应,并且不会进一步处理请求。有效值为:-全部:将处理所有干运行阶段。When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed [optional]
fieldManager String fieldManager是与进行这些更改的参与者或实体关联的名称。该值的长度必须小于或128个字符,并且仅包含可打印字符,如https://golang.org/pkg/unicode/#IsPrint.fieldManager is a name associated with the actor or entity that is making these changes. The value must be less than or 128 characters long, and only contain printable characters, as defined by https://golang.org/pkg/unicode/#IsPrint. [optional]

Return type

Object

Authorization

BearerToken

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 OK -
401 Unauthorized -

replaceClusterCustomObjectScale


回到“自定义资源增删查改”目录

Object replaceClusterCustomObjectScale(group, version, plural, name, body, dryRun, fieldManager)

replace scale of the specified cluster scoped custom object

Example

// Import classes:
import io.kubernetes.client.openapi.ApiClient;
import io.kubernetes.client.openapi.ApiException;
import io.kubernetes.client.openapi.Configuration;
import io.kubernetes.client.openapi.auth.*;
import io.kubernetes.client.openapi.models.*;
import io.kubernetes.client.openapi.apis.CustomObjectsApi;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("http://localhost");
    
    // Configure API key authorization: BearerToken
    ApiKeyAuth BearerToken = (ApiKeyAuth) defaultClient.getAuthentication("BearerToken");
    BearerToken.setApiKey("YOUR API KEY");
    // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
    //BearerToken.setApiKeyPrefix("Token");

    CustomObjectsApi apiInstance = new CustomObjectsApi(defaultClient);
    String group = "group_example"; // String | the custom resource's group
    String version = "version_example"; // String | the custom resource's version
    String plural = "plural_example"; // String | 自定义资源的复数名。对于TPR,这将是小写复数形式。the custom resource's plural name. For TPRs this would be lowercase plural kind.
    String name = "name_example"; // String | the custom object's name
    Object body = null; // Object | 
    String dryRun = "dryRun_example"; // String | 如果存在,则表示不应保留修改。无效或无法识别的dryRun指令将导致错误响应,并且不会进一步处理请求。有效值为:-全部:将处理所有干运行阶段。When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed
    String fieldManager = "fieldManager_example"; // String |  fieldManager是与进行这些更改的参与者或实体关联的名称。该值的长度必须小于或128个字符,并且仅包含可打印字符,如https://golang.org/pkg/unicode/#IsPrint.fieldManager is a name associated with the actor or entity that is making these changes. The value must be less than or 128 characters long, and only contain printable characters, as defined by https://golang.org/pkg/unicode/#IsPrint.
    try {
      Object result = apiInstance.replaceClusterCustomObjectScale(group, version, plural, name, body, dryRun, fieldManager);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling CustomObjectsApi#replaceClusterCustomObjectScale");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
group String the custom resource's group
version String the custom resource's version
plural String 自定义资源的复数名。对于TPR,这将是小写复数形式。
name String the custom object's name
body Object
dryRun String 如果存在,则表示不应保留修改。无效或无法识别的dryRun指令将导致错误响应,并且不会进一步处理请求。有效值为:-全部:将处理所有干运行阶段。When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed [optional]
fieldManager String fieldManager是与进行这些更改的参与者或实体关联的名称。该值的长度必须小于或128个字符,并且仅包含可打印字符,如https://golang.org/pkg/unicode/#IsPrint.fieldManager is a name associated with the actor or entity that is making these changes. The value must be less than or 128 characters long, and only contain printable characters, as defined by https://golang.org/pkg/unicode/#IsPrint. [optional]

Return type

Object

Authorization

BearerToken

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json, application/yaml, application/vnd.kubernetes.protobuf

HTTP response details

Status code Description Response headers
200 OK -
201 Created -
401 Unauthorized -

replaceClusterCustomObjectStatus


回到“自定义资源增删查改”目录

Object replaceClusterCustomObjectStatus(group, version, plural, name, body, dryRun, fieldManager)

replace status of the cluster scoped specified custom object

Example

// Import classes:
import io.kubernetes.client.openapi.ApiClient;
import io.kubernetes.client.openapi.ApiException;
import io.kubernetes.client.openapi.Configuration;
import io.kubernetes.client.openapi.auth.*;
import io.kubernetes.client.openapi.models.*;
import io.kubernetes.client.openapi.apis.CustomObjectsApi;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("http://localhost");
    
    // Configure API key authorization: BearerToken
    ApiKeyAuth BearerToken = (ApiKeyAuth) defaultClient.getAuthentication("BearerToken");
    BearerToken.setApiKey("YOUR API KEY");
    // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
    //BearerToken.setApiKeyPrefix("Token");

    CustomObjectsApi apiInstance = new CustomObjectsApi(defaultClient);
    String group = "group_example"; // String | the custom resource's group
    String version = "version_example"; // String | the custom resource's version
    String plural = "plural_example"; // String | 自定义资源的复数名。对于TPR,这将是小写复数形式。the custom resource's plural name. For TPRs this would be lowercase plural kind.
    String name = "name_example"; // String | the custom object's name
    Object body = null; // Object | 
    String dryRun = "dryRun_example"; // String | 如果存在,则表示不应保留修改。无效或无法识别的dryRun指令将导致错误响应,并且不会进一步处理请求。有效值为:-全部:将处理所有干运行阶段。When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed
    String fieldManager = "fieldManager_example"; // String |  fieldManager是与进行这些更改的参与者或实体关联的名称。该值的长度必须小于或128个字符,并且仅包含可打印字符,如https://golang.org/pkg/unicode/#IsPrint.fieldManager is a name associated with the actor or entity that is making these changes. The value must be less than or 128 characters long, and only contain printable characters, as defined by https://golang.org/pkg/unicode/#IsPrint.
    try {
      Object result = apiInstance.replaceClusterCustomObjectStatus(group, version, plural, name, body, dryRun, fieldManager);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling CustomObjectsApi#replaceClusterCustomObjectStatus");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
group String the custom resource's group
version String the custom resource's version
plural String 自定义资源的复数名。对于TPR,这将是小写复数形式。
name String the custom object's name
body Object
dryRun String 如果存在,则表示不应保留修改。无效或无法识别的dryRun指令将导致错误响应,并且不会进一步处理请求。有效值为:-全部:将处理所有干运行阶段。When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed [optional]
fieldManager String fieldManager是与进行这些更改的参与者或实体关联的名称。该值的长度必须小于或128个字符,并且仅包含可打印字符,如https://golang.org/pkg/unicode/#IsPrint.fieldManager is a name associated with the actor or entity that is making these changes. The value must be less than or 128 characters long, and only contain printable characters, as defined by https://golang.org/pkg/unicode/#IsPrint. [optional]

Return type

Object

Authorization

BearerToken

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json, application/yaml, application/vnd.kubernetes.protobuf

HTTP response details

Status code Description Response headers
200 OK -
201 Created -
401 Unauthorized -

replaceNamespacedCustomObject


回到“自定义资源增删查改”目录

Object replaceNamespacedCustomObject(group, version, namespace, plural, name, body, dryRun, fieldManager)

replace the specified namespace scoped custom object

Example

// Import classes:
import io.kubernetes.client.openapi.ApiClient;
import io.kubernetes.client.openapi.ApiException;
import io.kubernetes.client.openapi.Configuration;
import io.kubernetes.client.openapi.auth.*;
import io.kubernetes.client.openapi.models.*;
import io.kubernetes.client.openapi.apis.CustomObjectsApi;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("http://localhost");
    
    // Configure API key authorization: BearerToken
    ApiKeyAuth BearerToken = (ApiKeyAuth) defaultClient.getAuthentication("BearerToken");
    BearerToken.setApiKey("YOUR API KEY");
    // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
    //BearerToken.setApiKeyPrefix("Token");

    CustomObjectsApi apiInstance = new CustomObjectsApi(defaultClient);
    String group = "group_example"; // String | the custom resource's group
    String version = "version_example"; // String | the custom resource's version
    String namespace = "namespace_example"; // String | The custom resource's namespace
    String plural = "plural_example"; // String | 自定义资源的复数名。对于TPR,这将是小写复数形式。the custom resource's plural name. For TPRs this would be lowercase plural kind.
    String name = "name_example"; // String | the custom object's name
    Object body = null; // Object | The JSON schema of the Resource to replace.
    String dryRun = "dryRun_example"; // String | 如果存在,则表示不应保留修改。无效或无法识别的dryRun指令将导致错误响应,并且不会进一步处理请求。有效值为:-全部:将处理所有干运行阶段。When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed
    String fieldManager = "fieldManager_example"; // String |  fieldManager是与进行这些更改的参与者或实体关联的名称。该值的长度必须小于或128个字符,并且仅包含可打印字符,如https://golang.org/pkg/unicode/#IsPrint.fieldManager is a name associated with the actor or entity that is making these changes. The value must be less than or 128 characters long, and only contain printable characters, as defined by https://golang.org/pkg/unicode/#IsPrint.
    try {
      Object result = apiInstance.replaceNamespacedCustomObject(group, version, namespace, plural, name, body, dryRun, fieldManager);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling CustomObjectsApi#replaceNamespacedCustomObject");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
group String the custom resource's group
version String the custom resource's version
namespace String The custom resource's namespace
plural String 自定义资源的复数名。对于TPR,这将是小写复数形式。
name String the custom object's name
body Object The JSON schema of the Resource to replace.
dryRun String 如果存在,则表示不应保留修改。无效或无法识别的dryRun指令将导致错误响应,并且不会进一步处理请求。有效值为:-全部:将处理所有干运行阶段。When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed [optional]
fieldManager String fieldManager是与进行这些更改的参与者或实体关联的名称。该值的长度必须小于或128个字符,并且仅包含可打印字符,如https://golang.org/pkg/unicode/#IsPrint.fieldManager is a name associated with the actor or entity that is making these changes. The value must be less than or 128 characters long, and only contain printable characters, as defined by https://golang.org/pkg/unicode/#IsPrint. [optional]

Return type

Object

Authorization

BearerToken

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 OK -
401 Unauthorized -

replaceNamespacedCustomObjectScale


回到“自定义资源增删查改”目录

Object replaceNamespacedCustomObjectScale(group, version, namespace, plural, name, body, dryRun, fieldManager)

replace scale of the specified namespace scoped custom object

Example

// Import classes:
import io.kubernetes.client.openapi.ApiClient;
import io.kubernetes.client.openapi.ApiException;
import io.kubernetes.client.openapi.Configuration;
import io.kubernetes.client.openapi.auth.*;
import io.kubernetes.client.openapi.models.*;
import io.kubernetes.client.openapi.apis.CustomObjectsApi;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("http://localhost");
    
    // Configure API key authorization: BearerToken
    ApiKeyAuth BearerToken = (ApiKeyAuth) defaultClient.getAuthentication("BearerToken");
    BearerToken.setApiKey("YOUR API KEY");
    // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
    //BearerToken.setApiKeyPrefix("Token");

    CustomObjectsApi apiInstance = new CustomObjectsApi(defaultClient);
    String group = "group_example"; // String | the custom resource's group
    String version = "version_example"; // String | the custom resource's version
    String namespace = "namespace_example"; // String | The custom resource's namespace
    String plural = "plural_example"; // String | 自定义资源的复数名。对于TPR,这将是小写复数形式。the custom resource's plural name. For TPRs this would be lowercase plural kind.
    String name = "name_example"; // String | the custom object's name
    Object body = null; // Object | 
    String dryRun = "dryRun_example"; // String | 如果存在,则表示不应保留修改。无效或无法识别的dryRun指令将导致错误响应,并且不会进一步处理请求。有效值为:-全部:将处理所有干运行阶段。When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed
    String fieldManager = "fieldManager_example"; // String |  fieldManager是与进行这些更改的参与者或实体关联的名称。该值的长度必须小于或128个字符,并且仅包含可打印字符,如https://golang.org/pkg/unicode/#IsPrint.fieldManager is a name associated with the actor or entity that is making these changes. The value must be less than or 128 characters long, and only contain printable characters, as defined by https://golang.org/pkg/unicode/#IsPrint.
    try {
      Object result = apiInstance.replaceNamespacedCustomObjectScale(group, version, namespace, plural, name, body, dryRun, fieldManager);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling CustomObjectsApi#replaceNamespacedCustomObjectScale");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
group String the custom resource's group
version String the custom resource's version
namespace String The custom resource's namespace
plural String 自定义资源的复数名。对于TPR,这将是小写复数形式。
name String the custom object's name
body Object
dryRun String 如果存在,则表示不应保留修改。无效或无法识别的dryRun指令将导致错误响应,并且不会进一步处理请求。有效值为:-全部:将处理所有干运行阶段。When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed [optional]
fieldManager String fieldManager是与进行这些更改的参与者或实体关联的名称。该值的长度必须小于或128个字符,并且仅包含可打印字符,如https://golang.org/pkg/unicode/#IsPrint.fieldManager is a name associated with the actor or entity that is making these changes. The value must be less than or 128 characters long, and only contain printable characters, as defined by https://golang.org/pkg/unicode/#IsPrint. [optional]

Return type

Object

Authorization

BearerToken

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json, application/yaml, application/vnd.kubernetes.protobuf

HTTP response details

Status code Description Response headers
200 OK -
201 Created -
401 Unauthorized -

replaceNamespacedCustomObjectStatus


回到“自定义资源增删查改”目录

Object replaceNamespacedCustomObjectStatus(group, version, namespace, plural, name, body, dryRun, fieldManager)

replace status of the specified namespace scoped custom object

Example

// Import classes:
import io.kubernetes.client.openapi.ApiClient;
import io.kubernetes.client.openapi.ApiException;
import io.kubernetes.client.openapi.Configuration;
import io.kubernetes.client.openapi.auth.*;
import io.kubernetes.client.openapi.models.*;
import io.kubernetes.client.openapi.apis.CustomObjectsApi;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("http://localhost");
    
    // Configure API key authorization: BearerToken
    ApiKeyAuth BearerToken = (ApiKeyAuth) defaultClient.getAuthentication("BearerToken");
    BearerToken.setApiKey("YOUR API KEY");
    // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
    //BearerToken.setApiKeyPrefix("Token");

    CustomObjectsApi apiInstance = new CustomObjectsApi(defaultClient);
    String group = "group_example"; // String | the custom resource's group
    String version = "version_example"; // String | the custom resource's version
    String namespace = "namespace_example"; // String | The custom resource's namespace
    String plural = "plural_example"; // String | 自定义资源的复数名。对于TPR,这将是小写复数形式。the custom resource's plural name. For TPRs this would be lowercase plural kind.
    String name = "name_example"; // String | the custom object's name
    Object body = null; // Object | 
    String dryRun = "dryRun_example"; // String | 如果存在,则表示不应保留修改。无效或无法识别的dryRun指令将导致错误响应,并且不会进一步处理请求。有效值为:-全部:将处理所有干运行阶段。When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed
    String fieldManager = "fieldManager_example"; // String |  fieldManager是与进行这些更改的参与者或实体关联的名称。该值的长度必须小于或128个字符,并且仅包含可打印字符,如https://golang.org/pkg/unicode/#IsPrint.fieldManager is a name associated with the actor or entity that is making these changes. The value must be less than or 128 characters long, and only contain printable characters, as defined by https://golang.org/pkg/unicode/#IsPrint.
    try {
      Object result = apiInstance.replaceNamespacedCustomObjectStatus(group, version, namespace, plural, name, body, dryRun, fieldManager);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling CustomObjectsApi#replaceNamespacedCustomObjectStatus");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
group String the custom resource's group
version String the custom resource's version
namespace String The custom resource's namespace
plural String 自定义资源的复数名。对于TPR,这将是小写复数形式。.
name String the custom object's name
body Object
dryRun String 如果存在,则表示不应保留修改。无效或无法识别的dryRun指令将导致错误响应,并且不会进一步处理请求。有效值为:-全部:将处理所有干运行阶段。When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed [optional]
fieldManager String fieldManager是与进行这些更改的参与者或实体关联的名称。该值的长度必须小于或128个字符,并且仅包含可打印字符,如https://golang.org/pkg/unicode/#IsPrint.fieldManager is a name associated with the actor or entity that is making these changes. The value must be less than or 128 characters long, and only contain printable characters, as defined by https://golang.org/pkg/unicode/#IsPrint. [optional]

Return type

Object

Authorization

BearerToken

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json, application/yaml, application/vnd.kubernetes.protobuf

HTTP response details

Status code Description Response headers
200 OK -
201 Created -
401 Unauthorized -

NameSpace增删改查


回到K8sAPI根目录

All URIs are relative to http://localhost

Method HTTP request Description
createNamespace POST /api/v1/namespaces 创建分区
deleteNamespace DELETE /api/v1/namespaces/ 删除分区
listNamespace GET /api/v1/namespaces 分区列表
patchNamespace PATCH /api/v1/namespaces/ 更新分区内容
readNamespace GET /api/v1/namespaces/ 查询指定分区详情
replaceNamespace PUT /api/v1/namespaces/ 替换分区内容

createNamespace


回到“NameSpace增删改查”目录

V1Namespace createNamespace(body, pretty, dryRun, fieldManager)

create a Namespace

Example

// Import classes:
import io.kubernetes.client.openapi.ApiClient;
import io.kubernetes.client.openapi.ApiException;
import io.kubernetes.client.openapi.Configuration;
import io.kubernetes.client.openapi.auth.*;
import io.kubernetes.client.openapi.models.*;
import io.kubernetes.client.openapi.apis.CoreV1Api;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("http://localhost");
    
    // Configure API key authorization: BearerToken
    ApiKeyAuth BearerToken = (ApiKeyAuth) defaultClient.getAuthentication("BearerToken");
    BearerToken.setApiKey("YOUR API KEY");
    // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
    //BearerToken.setApiKeyPrefix("Token");

    CoreV1Api apiInstance = new CoreV1Api(defaultClient);
    V1Namespace body = new V1Namespace(); // V1Namespace | 
    String pretty = "pretty_example"; // String | 如果为“true”,则输出相当打印。If 'true', then the output is pretty printed.
    String dryRun = "dryRun_example"; // String | 如果存在,则表示不应保留修改。无效或无法识别的dryRun指令将导致错误响应,并且不会进一步处理请求。有效值为:-全部:将处理所有干运行阶段。When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed
    String fieldManager = "fieldManager_example"; // String |  fieldManager是与进行这些更改的参与者或实体关联的名称。该值的长度必须小于或128个字符,并且仅包含可打印字符,如https://golang.org/pkg/unicode/#IsPrint.fieldManager is a name associated with the actor or entity that is making these changes. The value must be less than or 128 characters long, and only contain printable characters, as defined by https://golang.org/pkg/unicode/#IsPrint.
    try {
      V1Namespace result = apiInstance.createNamespace(body, pretty, dryRun, fieldManager);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling CoreV1Api#createNamespace");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
body V1Namespace
pretty String 如果为“true”,则输出相当打印。If 'true', then the output is pretty printed. [optional]
dryRun String 如果存在,则表示不应保留修改。无效或无法识别的dryRun指令将导致错误响应,并且不会进一步处理请求。有效值为:-全部:将处理所有干运行阶段。When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed [optional]
fieldManager String fieldManager是与进行这些更改的参与者或实体关联的名称。该值的长度必须小于或128个字符,并且仅包含可打印字符,如https://golang.org/pkg/unicode/#IsPrint.fieldManager is a name associated with the actor or entity that is making these changes. The value must be less than or 128 characters long, and only contain printable characters, as defined by https://golang.org/pkg/unicode/#IsPrint. [optional]

Return type

V1Namespace

Authorization

BearerToken

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json, application/yaml, application/vnd.kubernetes.protobuf

HTTP response details

Status code Description Response headers
200 OK -
201 Created -
202 Accepted -
401 Unauthorized -

deleteNamespace


回到“NameSpace增删改查”目录

V1Status deleteNamespace(name, pretty, dryRun, gracePeriodSeconds, orphanDependents, propagationPolicy, body)

delete a Namespace

Example

// Import classes:
import io.kubernetes.client.openapi.ApiClient;
import io.kubernetes.client.openapi.ApiException;
import io.kubernetes.client.openapi.Configuration;
import io.kubernetes.client.openapi.auth.*;
import io.kubernetes.client.openapi.models.*;
import io.kubernetes.client.openapi.apis.CoreV1Api;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("http://localhost");
    
    // Configure API key authorization: BearerToken
    ApiKeyAuth BearerToken = (ApiKeyAuth) defaultClient.getAuthentication("BearerToken");
    BearerToken.setApiKey("YOUR API KEY");
    // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
    //BearerToken.setApiKeyPrefix("Token");

    CoreV1Api apiInstance = new CoreV1Api(defaultClient);
    String name = "name_example"; // String | name of the Namespace
    String pretty = "pretty_example"; // String | 如果为“true”,则输出相当打印。If 'true', then the output is pretty printed.
    String dryRun = "dryRun_example"; // String | 如果存在,则表示不应保留修改。无效或无法识别的dryRun指令将导致错误响应,并且不会进一步处理请求。有效值为:-全部:将处理所有干运行阶段。When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed
    Integer gracePeriodSeconds = 56; // Integer | 删除对象前的持续时间(秒)。值必须是非负整数。值为零表示立即删除。如果此值为nil,则将使用指定类型的默认宽限期。如果未指定,则默认为每对象值。零表示立即删除。The duration in seconds before the object should be deleted. Value must be non-negative integer. The value zero indicates delete immediately. If this value is nil, the default grace period for the specified type will be used. Defaults to a per object value if not specified. zero means delete immediately.
    Boolean orphanDependents = true; // Boolean | 已弃用:请使用PropagationPolicy,此字段将在1.7中弃用。从属对象应该是孤立的吗。如果为真/假,“孤立”终结器将被添加到对象的终结器列表中或从中删除。可以设置此字段或PropagationPolicy,但不能同时设置两者。已弃用:请使用PropagationPolicy,此字段将在1.7中弃用。从属对象应该是孤立的吗。如果为真/假,“孤立”终结器将被添加到对象的终结器列表中或从中删除。可以设置此字段或PropagationPolicy,但不能同时设置两者。Deprecated: please use the PropagationPolicy, this field will be deprecated in 1.7. Should the dependent objects be orphaned. If true/false, the \"orphan\" finalizer will be added to/removed from the object's finalizers list. Either this field or PropagationPolicy may be set, but not both.
    String propagationPolicy = "propagationPolicy_example"; // String | 是否以及如何执行垃圾收集。可以设置此字段或孤立从属项,但不能同时设置两者。默认策略由元数据中设置的现有终结器决定。终结器和特定于资源的默认策略。Whether and how garbage collection will be performed. Either this field or OrphanDependents may be set, but not both. The default policy is decided by the existing finalizer set in the metadata.finalizers and the resource-specific default policy. Acceptable values are: 'Orphan' - orphan the dependents; 'Background' - allow the garbage collector to delete the dependents in the background; 'Foreground' - a cascading policy that deletes all dependents in the foreground.
    V1DeleteOptions body = new V1DeleteOptions(); // V1DeleteOptions | 
    try {
      V1Status result = apiInstance.deleteNamespace(name, pretty, dryRun, gracePeriodSeconds, orphanDependents, propagationPolicy, body);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling CoreV1Api#deleteNamespace");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
name String name of the Namespace
pretty String 如果为“true”,则输出相当打印。If 'true', then the output is pretty printed. [optional]
dryRun String 如果存在,则表示不应保留修改。无效或无法识别的dryRun指令将导致错误响应,并且不会进一步处理请求。有效值为:-全部:将处理所有干运行阶段。When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed [optional]
gracePeriodSeconds Integer 删除对象前的持续时间(秒)。值必须是非负整数。值为零表示立即删除。如果此值为nil,则将使用指定类型的默认宽限期。如果未指定,则默认为每对象值。零表示立即删除。The duration in seconds before the object should be deleted. Value must be non-negative integer. The value zero indicates delete immediately. If this value is nil, the default grace period for the specified type will be used. Defaults to a per object value if not specified. zero means delete immediately. [optional]
orphanDependents Boolean 已弃用:请使用PropagationPolicy,此字段将在1.7中弃用。从属对象应该是孤立的吗。如果为真/假,“孤立”终结器将被添加到对象的终结器列表中或从中删除。可以设置此字段或PropagationPolicy,但不能同时设置两者。已弃用:请使用PropagationPolicy,此字段将在1.7中弃用。从属对象应该是孤立的吗。如果为真/假,“孤立”终结器将被添加到对象的终结器列表中或从中删除。可以设置此字段或PropagationPolicy,但不能同时设置两者。Deprecated: please use the PropagationPolicy, this field will be deprecated in 1.7. Should the dependent objects be orphaned. If true/false, the "orphan" finalizer will be added to/removed from the object's finalizers list. Either this field or PropagationPolicy may be set, but not both. [optional]
propagationPolicy String 是否以及如何执行垃圾收集。可以设置此字段或孤立从属项,但不能同时设置两者。默认策略由元数据中设置的现有终结器决定。终结器和特定于资源的默认策略。Whether and how garbage collection will be performed. Either this field or OrphanDependents may be set, but not both. The default policy is decided by the existing finalizer set in the metadata.finalizers and the resource-specific default policy. Acceptable values are: 'Orphan' - orphan the dependents; 'Background' - allow the garbage collector to delete the dependents in the background; 'Foreground' - a cascading policy that deletes all dependents in the foreground. [optional]
body V1DeleteOptions [optional]

Return type

V1Status

Authorization

BearerToken

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json, application/yaml, application/vnd.kubernetes.protobuf

HTTP response details

Status code Description Response headers
200 OK -
202 Accepted -
401 Unauthorized -

listNamespace


回到“NameSpace增删改查”目录

V1NamespaceList listNamespace(pretty, allowWatchBookmarks, _continue, fieldSelector, labelSelector, limit, resourceVersion, timeoutSeconds, watch)

list or watch objects of kind Namespace

Example

// Import classes:
import io.kubernetes.client.openapi.ApiClient;
import io.kubernetes.client.openapi.ApiException;
import io.kubernetes.client.openapi.Configuration;
import io.kubernetes.client.openapi.auth.*;
import io.kubernetes.client.openapi.models.*;
import io.kubernetes.client.openapi.apis.CoreV1Api;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("http://localhost");
    
    // Configure API key authorization: BearerToken
    ApiKeyAuth BearerToken = (ApiKeyAuth) defaultClient.getAuthentication("BearerToken");
    BearerToken.setApiKey("YOUR API KEY");
    // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
    //BearerToken.setApiKeyPrefix("Token");

    CoreV1Api apiInstance = new CoreV1Api(defaultClient);
    String pretty = "pretty_example"; // String | 如果为“true”,则输出相当打印。If 'true', then the output is pretty printed.
    Boolean allowWatchBookmarks = true; // Boolean |  allowWatchBookmarks请求观看类型为“BOOKMARK”的事件。未实现书签的服务器可能会忽略此标志,并由服务器自行决定是否发送书签。客户端不应假定书签是在任何特定的时间间隔返回的,也不应假定服务器将在会话期间发送任何书签事件。如果这不是手表,则忽略此字段。如果apiserver中未启用功能gate WatchBookmarks,则忽略此字段。allowWatchBookmarks请求观看类型为“的事件;书签"。未实现书签的服务器可能会忽略此标志,书签会在服务器上发送'这是自由裁量权。客户端不应假定书签是在任何特定的时间间隔返回的,也不应假定服务器将在会话期间发送任何书签事件。如果这不是手表,则忽略此字段。如果apiserver中未启用功能gate WatchBookmarks,则忽略此字段。allowWatchBookmarks requests watch events with type \"BOOKMARK\". Servers that do not implement bookmarks may ignore this flag and bookmarks are sent at the server's discretion. Clients should not assume bookmarks are returned at any specific interval, nor may they assume the server will send any BOOKMARK event during a session. If this is not a watch, this field is ignored. If the feature gate WatchBookmarks is not enabled in apiserver, this field is ignored.
    String _continue = "_continue_example"; // String | 从服务器检索更多结果时,应设置“继续”选项。由于此值是服务器定义的,因此客户端只能使用具有相同查询参数(continue值除外)的上一个查询结果中的continue值,服务器可能会拒绝它无法识别的continue值。如果指定的continue值因过期(通常为5到15分钟)或服务器上的配置更改而不再有效,服务器将响应410 ResourceExpired错误和continue令牌。如果客户端需要一个一致的列表,它必须在不使用continue字段的情况下重新启动它们的列表。从另一台服务器发送的结果可能与前一台服务器发送的结果不一致,但从下一台服务器发送的结果可能与前一台服务器发送的结果不一致,只要他们的钥匙在“下一个钥匙”之后。watch为true时不支持此字段。客户端可以从服务器返回的最后一个resourceVersion值开始监视,并且不会错过任何修改。从服务器检索更多结果时,应设置“继续”选项。由于此值是服务器定义的,因此客户端只能使用具有相同查询参数(continue值除外)的上一个查询结果中的continue值,服务器可能会拒绝它无法识别的continue值。如果指定的continue值因过期(通常为5到15分钟)或服务器上的配置更改而不再有效,服务器将响应410 ResourceExpired错误和continue令牌。如果客户端需要一个一致的列表,它必须在不使用continue字段的情况下重新启动它们的列表。从另一台服务器发送的结果可能与前一台服务器发送的结果不一致,但从下一台服务器发送的结果可能与前一台服务器发送的结果不一致,只要他们的钥匙在“下一个钥匙”之后。watch为true时不支持此字段。客户端可以从服务器返回的最后一个resourceVersion值开始监视,并且不会错过任何修改。The continue option should be set when retrieving more results from the server. Since this value is server defined, clients may only use the continue value from a previous query result with identical query parameters (except for the value of continue) and the server may reject a continue value it does not recognize. If the specified continue value is no longer valid whether due to expiration (generally five to fifteen minutes) or a configuration change on the server, the server will respond with a 410 ResourceExpired error together with a continue token. If the client needs a consistent list, it must restart their list without the continue field. Otherwise, the client may send another list request with the token received with the 410 error, the server will respond with a list starting from the next key, but from the latest snapshot, which is inconsistent from the previous list results - objects that are created, modified, or deleted after the first list request will be included in the response, as long as their keys are after the "next key".  This field is not supported when watch is true. Clients may start a watch from the last resourceVersion value returned by the server and not miss any modifications.(except for the value of continue) and the server may reject a continue value it does not recognize. If the specified continue value is no longer valid whether due to expiration (generally five to fifteen minutes) or a configuration change on the server, the server will respond with a 410 ResourceExpired error together with a continue token. If the client needs a consistent list, it must restart their list without the continue field. Otherwise, the client may send another list request with the token received with the 410 error, the server will respond with a list starting from the next key, but from the latest snapshot, which is inconsistent from the previous list results - objects that are created, modified, or deleted after the first list request will be included in the response, as long as their keys are after the \"next key\".  This field is not supported when watch is true. Clients may start a watch from the last resourceVersion value returned by the server and not miss any modifications.
    String fieldSelector = "fieldSelector_example"; // String | 一个选择器,用于按字段限制返回对象的列表。默认为一切。A selector to restrict the list of returned objects by their fields. Defaults to everything.
    String labelSelector = "labelSelector_example"; // String | 一个选择器,用于根据返回对象的标签限制其列表。默认为一切。A selector to restrict the list of returned objects by their labels. Defaults to everything.
    Integer limit = 56; // Integer | limit是列表调用返回的最大响应数。如果存在更多项,服务器会将列表元数据上的“continue”字段设置为一个值,该值可用于同一初始查询,以检索下一组结果。如果所有请求的对象都被过滤掉,设置限制可能会返回少于请求数量的项目(最多为零个项目),客户端应该只使用continue字段来确定是否有更多结果可用。服务器可能会选择不支持limit参数,并将返回所有可用的结果。如果指定了limit且continue字段为空,则客户端可能会认为没有更多结果可用。如果watch为true,则不支持此字段。服务器保证在使用continue时返回的对象将与无限制地发出单个列表调用相同——也就是说,在发出第一个请求后创建、修改或删除的对象不会包含在任何后续的continue请求中。这有时被称为一致性快照,可以确保使用limit接收非常大结果的较小数据块的客户端可以确保看到所有可能的对象。如果在分块列表期间更新对象,则返回在计算第一个列表结果时存在的对象版本。limit is a maximum number of responses to return for a list call. If more items exist, the server will set the `continue` field on the list metadata to a value that can be used with the same initial query to retrieve the next set of results. Setting a limit may return fewer than the requested amount of items (up to zero items) in the event all requested objects are filtered out and clients should only use the presence of the continue field to determine whether more results are available. Servers may choose not to support the limit argument and will return all of the available results. If limit is specified and the continue field is empty, clients may assume that no more results are available. This field is not supported if watch is true.  The server guarantees that the objects returned when using continue will be identical to issuing a single list call without a limit - that is, no objects created, modified, or deleted after the first request is issued will be included in any subsequent continued requests. This is sometimes referred to as a consistent snapshot, and ensures that a client that is using limit to receive smaller chunks of a very large result can ensure they see all possible objects. If objects are updated during a chunked list the version of the object that was present at the time the first list result was calculated is returned.
    String resourceVersion = "resourceVersion_example"; // String | 当通过监视调用指定时,显示在资源的特定版本之后发生的更改。默认为历史开始时的更改。为列表指定时:-如果未设置,则根据仲裁读取标志从远程存储返回结果;-如果是0,那么我们只返回当前缓存中的内容,不保证;-如果设置为非零,则结果至少与给定值一样新鲜When specified with a watch call, shows changes that occur after that particular version of a resource. Defaults to changes from the beginning of history. When specified for list: - if unset, then the result is returned from remote storage based on quorum-read flag; - if it's 0, then we simply return what we currently have in cache, no guarantee; - if set to non zero, then the result is at least as fresh as given rv.
    Integer timeoutSeconds = 56; // Integer | 列表/监视呼叫超时。这会限制通话的持续时间,而不管通话是否处于活动状态。列表/监视呼叫超时。这会限制通话的持续时间,而不管通话是否处于活动状态。Timeout for the list/watch call. This limits the duration of the call, regardless of any activity or inactivity.
    Boolean watch = true; // Boolean | 观察对所描述资源的更改,并将其作为添加、更新和删除通知流返回。指定resourceVersion。观察对所描述资源的更改,并将其作为添加、更新和删除通知流返回。Watch for changes to the described resources and return them as a stream of add, update, and remove notifications. Specify resourceVersion.
    try {
      V1NamespaceList result = apiInstance.listNamespace(pretty, allowWatchBookmarks, _continue, fieldSelector, labelSelector, limit, resourceVersion, timeoutSeconds, watch);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling CoreV1Api#listNamespace");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
pretty String 如果为“true”,则输出相当打印。If 'true', then the output is pretty printed. [optional]
allowWatchBookmarks请求观看类型为“BOOKMARK”的事件。未实现书签的服务器可能会忽略此标志,并由服务器自行决定是否发送书签。客户端不应假定书签是在任何特定的时间间隔返回的,也不应假定服务器将在会话期间发送任何书签事件。如果这不是手表,则忽略此字段。如果apiserver中未启用功能gate WatchBookmarks,则忽略此字段。allowWatchBookmarks请求观看类型为“的事件;书签"。未实现书签的服务器可能会忽略此标志,书签会在服务器上发送'这是自由裁量权。客户端不应假定书签是在任何特定的时间间隔返回的,也不应假定服务器将在会话期间发送任何书签事件。如果这不是手表,则忽略此字段。如果apiserver中未启用功能gate WatchBookmarks,则忽略此字段。allowWatchBookmarks requests watch events with type "BOOKMARK". Servers that do not implement bookmarks may ignore this flag and bookmarks are sent at the server's discretion. Clients should not assume bookmarks are returned at any specific interval, nor may they assume the server will send any BOOKMARK event during a session. If this is not a watch, this field is ignored. If the feature gate WatchBookmarks is not enabled in apiserver, this field is ignored. [optional]
_continue String 从服务器检索更多结果时,应设置“继续”选项。由于此值是服务器定义的,因此客户端只能使用具有相同查询参数(continue值除外)的上一个查询结果中的continue值,服务器可能会拒绝它无法识别的continue值。如果指定的continue值因过期(通常为5到15分钟)或服务器上的配置更改而不再有效,服务器将响应410 ResourceExpired错误和continue令牌。如果客户端需要一个一致的列表,它必须在不使用continue字段的情况下重新启动它们的列表。从另一台服务器发送的结果可能与前一台服务器发送的结果不一致,但从下一台服务器发送的结果可能与前一台服务器发送的结果不一致,只要他们的钥匙在“下一个钥匙”之后。watch为true时不支持此字段。客户端可以从服务器返回的最后一个resourceVersion值开始监视,并且不会错过任何修改。从服务器检索更多结果时,应设置“继续”选项。由于此值是服务器定义的,因此客户端只能使用具有相同查询参数(continue值除外)的上一个查询结果中的continue值,服务器可能会拒绝它无法识别的continue值。如果指定的continue值因过期(通常为5到15分钟)或服务器上的配置更改而不再有效,服务器将响应410 ResourceExpired错误和continue令牌。如果客户端需要一个一致的列表,它必须在不使用continue字段的情况下重新启动它们的列表。从另一台服务器发送的结果可能与前一台服务器发送的结果不一致,但从下一台服务器发送的结果可能与前一台服务器发送的结果不一致,只要他们的钥匙在“下一个钥匙”之后。watch为true时不支持此字段。客户端可以从服务器返回的最后一个resourceVersion值开始监视,并且不会错过任何修改。The continue option should be set when retrieving more results from the server. Since this value is server defined, clients may only use the continue value from a previous query result with identical query parameters (except for the value of continue) and the server may reject a continue value it does not recognize. If the specified continue value is no longer valid whether due to expiration (generally five to fifteen minutes) or a configuration change on the server, the server will respond with a 410 ResourceExpired error together with a continue token. If the client needs a consistent list, it must restart their list without the continue field. Otherwise, the client may send another list request with the token received with the 410 error, the server will respond with a list starting from the next key, but from the latest snapshot, which is inconsistent from the previous list results - objects that are created, modified, or deleted after the first list request will be included in the response, as long as their keys are after the "next key". This field is not supported when watch is true. Clients may start a watch from the last resourceVersion value returned by the server and not miss any modifications.(except for the value of continue) and the server may reject a continue value it does not recognize. If the specified continue value is no longer valid whether due to expiration (generally five to fifteen minutes) or a configuration change on the server, the server will respond with a 410 ResourceExpired error together with a continue token. If the client needs a consistent list, it must restart their list without the continue field. Otherwise, the client may send another list request with the token received with the 410 error, the server will respond with a list starting from the next key, but from the latest snapshot, which is inconsistent from the previous list results - objects that are created, modified, or deleted after the first list request will be included in the response, as long as their keys are after the "next key". This field is not supported when watch is true. Clients may start a watch from the last resourceVersion value returned by the server and not miss any modifications. [optional]
fieldSelector String 一个选择器,用于按字段限制返回对象的列表。默认为一切。A selector to restrict the list of returned objects by their fields. Defaults to everything. [optional]
labelSelector String 一个选择器,用于根据返回对象的标签限制其列表。默认为一切。A selector to restrict the list of returned objects by their labels. Defaults to everything. [optional]
limit Integer limit是列表调用返回的最大响应数。如果存在更多项目,服务器将设置`继续`字段的值,该值可用于同一初始查询以检索下一组结果。如果所有请求的对象都被过滤掉,设置限制可能会返回少于请求数量的项目(最多为零个项目),客户端应该只使用continue字段来确定是否有更多结果可用。服务器可能会选择不支持limit参数,并将返回所有可用的结果。如果指定了limit且continue字段为空,则客户端可能会认为没有更多结果可用。如果watch为true,则不支持此字段。服务器保证在使用continue时返回的对象将与无限制地发出单个列表调用相同——也就是说,在发出第一个请求后创建、修改或删除的对象不会包含在任何后续的continue请求中。这有时被称为一致性快照,可以确保使用limit接收非常大结果的较小数据块的客户端可以确保看到所有可能的对象。如果在分块列表期间更新对象,则返回在计算第一个列表结果时存在的对象版本。 limit is a maximum number of responses to return for a list call. If more items exist, the server will set the `continue` field on the list metadata to a value that can be used with the same initial query to retrieve the next set of results. Setting a limit may return fewer than the requested amount of items (up to zero items) in the event all requested objects are filtered out and clients should only use the presence of the continue field to determine whether more results are available. Servers may choose not to support the limit argument and will return all of the available results. If limit is specified and the continue field is empty, clients may assume that no more results are available. This field is not supported if watch is true. The server guarantees that the objects returned when using continue will be identical to issuing a single list call without a limit - that is, no objects created, modified, or deleted after the first request is issued will be included in any subsequent continued requests. This is sometimes referred to as a consistent snapshot, and ensures that a client that is using limit to receive smaller chunks of a very large result can ensure they see all possible objects. If objects are updated during a chunked list the version of the object that was present at the time the first list result was calculated is returned. [optional]
resourceVersion String 当通过监视调用指定时,显示在资源的特定版本之后发生的更改。默认为历史开始时的更改。为列表指定时:-如果未设置,则根据仲裁读取标志从远程存储返回结果;-如果是's 0,然后我们只返回当前缓存中的内容,不保证;-如果设置为非零,则结果至少与给定值一样新鲜。When specified with a watch call, shows changes that occur after that particular version of a resource. Defaults to changes from the beginning of history. When specified for list: - if unset, then the result is returned from remote storage based on quorum-read flag; - if it's 0, then we simply return what we currently have in cache, no guarantee; - if set to non zero, then the result is at least as fresh as given rv. [optional]
timeoutSeconds Integer 列表/监视呼叫超时。这会限制通话的持续时间,而不管通话是否处于活动状态。列表/监视呼叫超时。这会限制通话的持续时间,而不管通话是否处于活动状态。Timeout for the list/watch call. This limits the duration of the call, regardless of any activity or inactivity. [optional]
watch Boolean 观察对所描述资源的更改,并将其作为添加、更新和删除通知流返回。指定resourceVersion。观察对所描述资源的更改,并将其作为添加、更新和删除通知流返回。Watch for changes to the described resources and return them as a stream of add, update, and remove notifications. Specify resourceVersion. [optional]

Return type

V1NamespaceList

Authorization

BearerToken

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json, application/yaml, application/vnd.kubernetes.protobuf, application/json;stream=watch, application/vnd.kubernetes.protobuf;stream=watch

HTTP response details

Status code Description Response headers
200 OK -
401 Unauthorized -

patchNamespace


回到“NameSpace增删改查”目录

V1Namespace patchNamespace(name, body, pretty, dryRun, fieldManager, force)

partially update the specified Namespace

Example

// Import classes:
import io.kubernetes.client.openapi.ApiClient;
import io.kubernetes.client.openapi.ApiException;
import io.kubernetes.client.openapi.Configuration;
import io.kubernetes.client.openapi.auth.*;
import io.kubernetes.client.openapi.models.*;
import io.kubernetes.client.openapi.apis.CoreV1Api;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("http://localhost");
    
    // Configure API key authorization: BearerToken
    ApiKeyAuth BearerToken = (ApiKeyAuth) defaultClient.getAuthentication("BearerToken");
    BearerToken.setApiKey("YOUR API KEY");
    // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
    //BearerToken.setApiKeyPrefix("Token");

    CoreV1Api apiInstance = new CoreV1Api(defaultClient);
    String name = "name_example"; // String | name of the Namespace
    V1Patch body = new V1Patch(); // V1Patch | 
    String pretty = "pretty_example"; // String | 如果为“true”,则输出相当打印。If 'true', then the output is pretty printed.
    String dryRun = "dryRun_example"; // String | 如果存在,则表示不应保留修改。无效或无法识别的dryRun指令将导致错误响应,并且不会进一步处理请求。有效值为:-全部:将处理所有干运行阶段。When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed
    String fieldManager = "fieldManager_example"; // String |  fieldManager是与进行这些更改的参与者或实体关联的名称。该值的长度必须小于或128个字符,并且仅包含可打印字符,如https://golang.org/pkg/unicode/#IsPrint.fieldManager is a name associated with the actor or entity that is making these changes. The value must be less than or 128 characters long, and only contain printable characters, as defined by https://golang.org/pkg/unicode/#IsPrint. This field is required for apply requests (application/apply-patch) but optional for non-apply patch types (JsonPatch, MergePatch, StrategicMergePatch).
    Boolean force = true; // Boolean | Force将“强制”应用请求。这意味着用户将重新获取其他人拥有的冲突字段。对于非应用补丁请求,必须取消设置强制标志。Force is going to \"force\" Apply requests. It means user will re-acquire conflicting fields owned by other people. Force flag must be unset for non-apply patch requests.
    try {
      V1Namespace result = apiInstance.patchNamespace(name, body, pretty, dryRun, fieldManager, force);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling CoreV1Api#patchNamespace");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
name String name of the Namespace
body V1Patch
pretty String 如果为“true”,则输出相当打印。If 'true', then the output is pretty printed. [optional]
dryRun String 如果存在,则表示不应保留修改。无效或无法识别的dryRun指令将导致错误响应,并且不会进一步处理请求。有效值为:-全部:将处理所有干运行阶段。When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed [optional]
fieldManager String fieldManager是与进行这些更改的参与者或实体关联的名称。该值的长度必须小于或128个字符,并且仅包含可打印字符,如https://golang.org/pkg/unicode/#IsPrint.fieldManager is a name associated with the actor or entity that is making these changes. The value must be less than or 128 characters long, and only contain printable characters, as defined by https://golang.org/pkg/unicode/#IsPrint. This field is required for apply requests (application/apply-patch) but optional for non-apply patch types (JsonPatch, MergePatch, StrategicMergePatch). [optional]
force Boolean Force将“强制”应用请求。这意味着用户将重新获取其他人拥有的冲突字段。对于非应用补丁请求,必须取消设置强制标志。Force is going to "force" Apply requests. It means user will re-acquire conflicting fields owned by other people. Force flag must be unset for non-apply patch requests. [optional]

Return type

V1Namespace

Authorization

BearerToken

HTTP request headers

  • Content-Type: application/json-patch+json, application/merge-patch+json, application/strategic-merge-patch+json, application/apply-patch+yaml
  • Accept: application/json, application/yaml, application/vnd.kubernetes.protobuf

HTTP response details

Status code Description Response headers
200 OK -
401 Unauthorized -

readNamespace


回到“NameSpace增删改查”目录

V1Namespace readNamespace(name, pretty, exact, export)

read the specified Namespace

Example

// Import classes:
import io.kubernetes.client.openapi.ApiClient;
import io.kubernetes.client.openapi.ApiException;
import io.kubernetes.client.openapi.Configuration;
import io.kubernetes.client.openapi.auth.*;
import io.kubernetes.client.openapi.models.*;
import io.kubernetes.client.openapi.apis.CoreV1Api;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("http://localhost");
    
    // Configure API key authorization: BearerToken
    ApiKeyAuth BearerToken = (ApiKeyAuth) defaultClient.getAuthentication("BearerToken");
    BearerToken.setApiKey("YOUR API KEY");
    // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
    //BearerToken.setApiKeyPrefix("Token");

    CoreV1Api apiInstance = new CoreV1Api(defaultClient);
    String name = "name_example"; // String | name of the Namespace
    String pretty = "pretty_example"; // String | 如果为“true”,则输出相当打印。If 'true', then the output is pretty printed.
    Boolean exact = true; // Boolean | 出口应该是准确的。Exact export维护特定于集群的字段,如“Namespace”。不赞成。计划于1.18年拆除。Should the export be exact.  Exact export maintains cluster-specific fields like 'Namespace'. Deprecated. Planned for removal in 1.18.
    Boolean export = true; // Boolean | 应该将该值导出。导出用户无法指定的字段。不赞成。计划于1.18年拆除。Should this value be exported.  Export strips fields that a user can not specify. Deprecated. Planned for removal in 1.18.
    try {
      V1Namespace result = apiInstance.readNamespace(name, pretty, exact, export);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling CoreV1Api#readNamespace");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
name String name of the Namespace
pretty String 如果为“true”,则输出相当打印。If 'true', then the output is pretty printed. [optional]
exact Boolean 出口应该是准确的。Exact export维护特定于集群的字段,如“Namespace”。不赞成。计划于1.18年拆除。Should the export be exact. Exact export maintains cluster-specific fields like 'Namespace'. Deprecated. Planned for removal in 1.18. [optional]
export Boolean 应该将该值导出。导出用户无法指定的字段。不赞成。计划于1.18年拆除。Should this value be exported. Export strips fields that a user can not specify. Deprecated. Planned for removal in 1.18. [optional]

Return type

V1Namespace

Authorization

BearerToken

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json, application/yaml, application/vnd.kubernetes.protobuf

HTTP response details

Status code Description Response headers
200 OK -
401 Unauthorized -

replaceNamespace


回到“NameSpace增删改查”目录

V1Namespace replaceNamespace(name, body, pretty, dryRun, fieldManager)

replace the specified Namespace

Example

// Import classes:
import io.kubernetes.client.openapi.ApiClient;
import io.kubernetes.client.openapi.ApiException;
import io.kubernetes.client.openapi.Configuration;
import io.kubernetes.client.openapi.auth.*;
import io.kubernetes.client.openapi.models.*;
import io.kubernetes.client.openapi.apis.CoreV1Api;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("http://localhost");
    
    // Configure API key authorization: BearerToken
    ApiKeyAuth BearerToken = (ApiKeyAuth) defaultClient.getAuthentication("BearerToken");
    BearerToken.setApiKey("YOUR API KEY");
    // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
    //BearerToken.setApiKeyPrefix("Token");

    CoreV1Api apiInstance = new CoreV1Api(defaultClient);
    String name = "name_example"; // String | name of the Namespace
    V1Namespace body = new V1Namespace(); // V1Namespace | 
    String pretty = "pretty_example"; // String | 如果为“true”,则输出相当打印。If 'true', then the output is pretty printed.
    String dryRun = "dryRun_example"; // String | 如果存在,则表示不应保留修改。无效或无法识别的dryRun指令将导致错误响应,并且不会进一步处理请求。有效值为:-全部:将处理所有干运行阶段。When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed
    String fieldManager = "fieldManager_example"; // String |  fieldManager是与进行这些更改的参与者或实体关联的名称。该值的长度必须小于或128个字符,并且仅包含可打印字符,如https://golang.org/pkg/unicode/#IsPrint.fieldManager is a name associated with the actor or entity that is making these changes. The value must be less than or 128 characters long, and only contain printable characters, as defined by https://golang.org/pkg/unicode/#IsPrint.
    try {
      V1Namespace result = apiInstance.replaceNamespace(name, body, pretty, dryRun, fieldManager);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling CoreV1Api#replaceNamespace");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
name String name of the Namespace
body V1Namespace
pretty String 如果为“true”,则输出相当打印。If 'true', then the output is pretty printed. [optional]
dryRun String 如果存在,则表示不应保留修改。无效或无法识别的dryRun指令将导致错误响应,并且不会进一步处理请求。有效值为:-全部:将处理所有干运行阶段。When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed [optional]
fieldManager String fieldManager是与进行这些更改的参与者或实体关联的名称。该值的长度必须小于或128个字符,并且仅包含可打印字符,如https://golang.org/pkg/unicode/#IsPrint.fieldManager is a name associated with the actor or entity that is making these changes. The value must be less than or 128 characters long, and only contain printable characters, as defined by https://golang.org/pkg/unicode/#IsPrint. [optional]

Return type

V1Namespace

Authorization

BearerToken

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json, application/yaml, application/vnd.kubernetes.protobuf

HTTP response details

Status code Description Response headers
200 OK -
201 Created -
401 Unauthorized -

Node增删改查


回到K8sAPI根目录

All URIs are relative to http://localhost

Method HTTP request Description
createNode POST /api/v1/nodes 创建节点
deleteCollectionNode DELETE /api/v1/nodes 删除多个节点
deleteNode DELETE /api/v1/nodes/ 删除节点
listNode GET /api/v1/nodes 节点列表
patchNode PATCH /api/v1/nodes/ 更新节点
readNode GET /api/v1/nodes/ 查询指定节点
replaceNode PUT /api/v1/nodes/ 替换指定节点内容
replaceNodeStatus PUT /api/v1/nodes/{name}/status 修改节点状态

createNode


回到“Node增删改查”目录

V1Node createNode(body, pretty, dryRun, fieldManager)

create a Node

Example

// Import classes:
import io.kubernetes.client.openapi.ApiClient;
import io.kubernetes.client.openapi.ApiException;
import io.kubernetes.client.openapi.Configuration;
import io.kubernetes.client.openapi.auth.*;
import io.kubernetes.client.openapi.models.*;
import io.kubernetes.client.openapi.apis.CoreV1Api;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("http://localhost");
    
    // Configure API key authorization: BearerToken
    ApiKeyAuth BearerToken = (ApiKeyAuth) defaultClient.getAuthentication("BearerToken");
    BearerToken.setApiKey("YOUR API KEY");
    // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
    //BearerToken.setApiKeyPrefix("Token");

    CoreV1Api apiInstance = new CoreV1Api(defaultClient);
    V1Node body = new V1Node(); // V1Node | 
    String pretty = "pretty_example"; // String | 如果为“true”,则输出相当打印。If 'true', then the output is pretty printed.
    String dryRun = "dryRun_example"; // String | 如果存在,则表示不应保留修改。无效或无法识别的dryRun指令将导致错误响应,并且不会进一步处理请求。有效值为:-全部:将处理所有干运行阶段。When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed
    String fieldManager = "fieldManager_example"; // String |  fieldManager是与进行这些更改的参与者或实体关联的名称。该值的长度必须小于或128个字符,并且仅包含可打印字符,如https://golang.org/pkg/unicode/#IsPrint.fieldManager is a name associated with the actor or entity that is making these changes. The value must be less than or 128 characters long, and only contain printable characters, as defined by https://golang.org/pkg/unicode/#IsPrint.
    try {
      V1Node result = apiInstance.createNode(body, pretty, dryRun, fieldManager);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling CoreV1Api#createNode");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
body V1Node
pretty String 如果为“true”,则输出相当打印。If 'true', then the output is pretty printed. [optional]
dryRun String 如果存在,则表示不应保留修改。无效或无法识别的dryRun指令将导致错误响应,并且不会进一步处理请求。有效值为:-全部:将处理所有干运行阶段。When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed [optional]
fieldManager String fieldManager是与进行这些更改的参与者或实体关联的名称。该值的长度必须小于或128个字符,并且仅包含可打印字符,如https://golang.org/pkg/unicode/#IsPrint.fieldManager is a name associated with the actor or entity that is making these changes. The value must be less than or 128 characters long, and only contain printable characters, as defined by https://golang.org/pkg/unicode/#IsPrint. [optional]

Return type

V1Node

Authorization

BearerToken

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json, application/yaml, application/vnd.kubernetes.protobuf

HTTP response details

Status code Description Response headers
200 OK -
201 Created -
202 Accepted -
401 Unauthorized -

deleteCollectionNode


回到“Node增删改查”目录

V1Status deleteCollectionNode(pretty, _continue, dryRun, fieldSelector, gracePeriodSeconds, labelSelector, limit, orphanDependents, propagationPolicy, resourceVersion, timeoutSeconds, body)

delete collection of Node

Example

// Import classes:
import io.kubernetes.client.openapi.ApiClient;
import io.kubernetes.client.openapi.ApiException;
import io.kubernetes.client.openapi.Configuration;
import io.kubernetes.client.openapi.auth.*;
import io.kubernetes.client.openapi.models.*;
import io.kubernetes.client.openapi.apis.CoreV1Api;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("http://localhost");
    
    // Configure API key authorization: BearerToken
    ApiKeyAuth BearerToken = (ApiKeyAuth) defaultClient.getAuthentication("BearerToken");
    BearerToken.setApiKey("YOUR API KEY");
    // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
    //BearerToken.setApiKeyPrefix("Token");

    CoreV1Api apiInstance = new CoreV1Api(defaultClient);
    String pretty = "pretty_example"; // String | 如果为“true”,则输出相当打印。If 'true', then the output is pretty printed.
    String _continue = "_continue_example"; // String | 从服务器检索更多结果时,应设置“继续”选项。由于此值是服务器定义的,因此客户端只能使用具有相同查询参数(continue值除外)的上一个查询结果中的continue值,服务器可能会拒绝它无法识别的continue值。如果指定的continue值因过期(通常为5到15分钟)或服务器上的配置更改而不再有效,服务器将响应410 ResourceExpired错误和continue令牌。如果客户端需要一个一致的列表,它必须在不使用continue字段的情况下重新启动它们的列表。从另一台服务器发送的结果可能与前一台服务器发送的结果不一致,但从下一台服务器发送的结果可能与前一台服务器发送的结果不一致,只要他们的钥匙在“下一个钥匙”之后。watch为true时不支持此字段。客户端可以从服务器返回的最后一个resourceVersion值开始监视,并且不会错过任何修改。The continue option should be set when retrieving more results from the server. Since this value is server defined, clients may only use the continue value from a previous query result with identical query parameters (except for the value of continue) and the server may reject a continue value it does not recognize. If the specified continue value is no longer valid whether due to expiration (generally five to fifteen minutes) or a configuration change on the server, the server will respond with a 410 ResourceExpired error together with a continue token. If the client needs a consistent list, it must restart their list without the continue field. Otherwise, the client may send another list request with the token received with the 410 error, the server will respond with a list starting from the next key, but from the latest snapshot, which is inconsistent from the previous list results - objects that are created, modified, or deleted after the first list request will be included in the response, as long as their keys are after the "next key".  This field is not supported when watch is true. Clients may start a watch from the last resourceVersion value returned by the server and not miss any modifications.(except for the value of continue) and the server may reject a continue value it does not recognize. If the specified continue value is no longer valid whether due to expiration (generally five to fifteen minutes) or a configuration change on the server, the server will respond with a 410 ResourceExpired error together with a continue token. If the client needs a consistent list, it must restart their list without the continue field. Otherwise, the client may send another list request with the token received with the 410 error, the server will respond with a list starting from the next key, but from the latest snapshot, which is inconsistent from the previous list results - objects that are created, modified, or deleted after the first list request will be included in the response, as long as their keys are after the \"next key\".  This field is not supported when watch is true. Clients may start a watch from the last resourceVersion value returned by the server and not miss any modifications.
    String dryRun = "dryRun_example"; // String | 如果存在,则表示不应保留修改。无效或无法识别的dryRun指令将导致错误响应,并且不会进一步处理请求。有效值为:-全部:将处理所有干运行阶段。When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed
    String fieldSelector = "fieldSelector_example"; // String | 一个选择器,用于按字段限制返回对象的列表。默认为一切。A selector to restrict the list of returned objects by their fields. Defaults to everything.
    Integer gracePeriodSeconds = 56; // Integer | 删除对象前的持续时间(秒)。值必须是非负整数。值为零表示立即删除。如果此值为nil,则将使用指定类型的默认宽限期。如果未指定,则默认为每对象值。零表示立即删除。The duration in seconds before the object should be deleted. Value must be non-negative integer. The value zero indicates delete immediately. If this value is nil, the default grace period for the specified type will be used. Defaults to a per object value if not specified. zero means delete immediately.
    String labelSelector = "labelSelector_example"; // String | 一个选择器,用于根据返回对象的标签限制其列表。默认为一切。A selector to restrict the list of returned objects by their labels. Defaults to everything.
    Integer limit = 56; // Integer | limit是列表调用返回的最大响应数。如果存在更多项目,服务器将设置`继续`字段的值,该值可用于同一初始查询以检索下一组结果。如果所有请求的对象都被过滤掉,设置限制可能会返回少于请求数量的项目(最多为零个项目),客户端应该只使用continue字段来确定是否有更多结果可用。服务器可能会选择不支持limit参数,并将返回所有可用的结果。如果指定了limit且continue字段为空,则客户端可能会认为没有更多结果可用。如果watch为true,则不支持此字段。服务器保证在使用continue时返回的对象将与无限制地发出单个列表调用相同——也就是说,在发出第一个请求后创建、修改或删除的对象不会包含在任何后续的continue请求中。这有时被称为一致性快照,可以确保使用limit接收非常大结果的较小数据块的客户端可以确保看到所有可能的对象。如果在分块列表期间更新对象,则返回在计算第一个列表结果时存在的对象版本。limit是列表调用返回的最大响应数。如果存在更多项,服务器会将列表元数据上的“continue”字段设置为一个值,该值可用于同一初始查询,以检索下一组结果。如果所有请求的对象都被过滤掉,设置限制可能会返回少于请求数量的项目(最多为零个项目),客户端应该只使用continue字段来确定是否有更多结果可用。服务器可能会选择不支持limit参数,并将返回所有可用的结果。如果指定了limit且continue字段为空,则客户端可能会认为没有更多结果可用。如果watch为true,则不支持此字段。服务器保证在使用continue时返回的对象将与无限制地发出单个列表调用相同——也就是说,在发出第一个请求后创建、修改或删除的对象不会包含在任何后续的continue请求中。这有时被称为一致性快照,可以确保使用limit接收非常大结果的较小数据块的客户端可以确保看到所有可能的对象。如果在分块列表期间更新对象,则返回在计算第一个列表结果时存在的对象版本。limit is a maximum number of responses to return for a list call. If more items exist, the server will set the `continue` field on the list metadata to a value that can be used with the same initial query to retrieve the next set of results. Setting a limit may return fewer than the requested amount of items (up to zero items) in the event all requested objects are filtered out and clients should only use the presence of the continue field to determine whether more results are available. Servers may choose not to support the limit argument and will return all of the available results. If limit is specified and the continue field is empty, clients may assume that no more results are available. This field is not supported if watch is true.  The server guarantees that the objects returned when using continue will be identical to issuing a single list call without a limit - that is, no objects created, modified, or deleted after the first request is issued will be included in any subsequent continued requests. This is sometimes referred to as a consistent snapshot, and ensures that a client that is using limit to receive smaller chunks of a very large result can ensure they see all possible objects. If objects are updated during a chunked list the version of the object that was present at the time the first list result was calculated is returned.
    Boolean orphanDependents = true; // Boolean | 已弃用:请使用PropagationPolicy,此字段将在1.7中弃用。从属对象应该是孤立的吗。如果为真/假,“孤立”终结器将被添加到对象的终结器列表中或从中删除。可以设置此字段或PropagationPolicy,但不能同时设置两者。已弃用:请使用PropagationPolicy,此字段将在1.7中弃用。从属对象应该是孤立的吗。如果为真/假,“孤立”终结器将被添加到对象的终结器列表中或从中删除。可以设置此字段或PropagationPolicy,但不能同时设置两者。Deprecated: please use the PropagationPolicy, this field will be deprecated in 1.7. Should the dependent objects be orphaned. If true/false, the \"orphan\" finalizer will be added to/removed from the object's finalizers list. Either this field or PropagationPolicy may be set, but not both.
    String propagationPolicy = "propagationPolicy_example"; // String | 是否以及如何执行垃圾收集。可以设置此字段或孤立从属项,但不能同时设置两者。默认策略由元数据中设置的现有终结器决定。终结器和特定于资源的默认策略。Whether and how garbage collection will be performed. Either this field or OrphanDependents may be set, but not both. The default policy is decided by the existing finalizer set in the metadata.finalizers and the resource-specific default policy. Acceptable values are: 'Orphan' - orphan the dependents; 'Background' - allow the garbage collector to delete the dependents in the background; 'Foreground' - a cascading policy that deletes all dependents in the foreground.
    String resourceVersion = "resourceVersion_example"; // String | 当通过监视调用指定时,显示在资源的特定版本之后发生的更改。默认为历史开始时的更改。为列表指定时:-如果未设置,则根据仲裁读取标志从远程存储返回结果;-如果是0,那么我们只返回当前缓存中的内容,不保证;-如果设置为非零,则结果至少与给定值一样新鲜When specified with a watch call, shows changes that occur after that particular version of a resource. Defaults to changes from the beginning of history. When specified for list: - if unset, then the result is returned from remote storage based on quorum-read flag; - if it's 0, then we simply return what we currently have in cache, no guarantee; - if set to non zero, then the result is at least as fresh as given rv.
    Integer timeoutSeconds = 56; // Integer | 列表/监视呼叫超时。这会限制通话的持续时间,而不管通话是否处于活动状态。列表/监视呼叫超时。这会限制通话的持续时间,而不管通话是否处于活动状态。Timeout for the list/watch call. This limits the duration of the call, regardless of any activity or inactivity.
    V1DeleteOptions body = new V1DeleteOptions(); // V1DeleteOptions | 
    try {
      V1Status result = apiInstance.deleteCollectionNode(pretty, _continue, dryRun, fieldSelector, gracePeriodSeconds, labelSelector, limit, orphanDependents, propagationPolicy, resourceVersion, timeoutSeconds, body);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling CoreV1Api#deleteCollectionNode");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
pretty String 如果为“true”,则输出相当打印。If 'true', then the output is pretty printed. [optional]
_continue String 从服务器检索更多结果时,应设置“继续”选项。由于此值是服务器定义的,因此客户端只能使用具有相同查询参数(continue值除外)的上一个查询结果中的continue值,服务器可能会拒绝它无法识别的continue值。如果指定的continue值因过期(通常为5到15分钟)或服务器上的配置更改而不再有效,服务器将响应410 ResourceExpired错误和continue令牌。如果客户端需要一个一致的列表,它必须在不使用continue字段的情况下重新启动它们的列表。从另一台服务器发送的结果可能与前一台服务器发送的结果不一致,但从下一台服务器发送的结果可能与前一台服务器发送的结果不一致,只要他们的钥匙在“下一个钥匙”之后。watch为true时不支持此字段。客户端可以从服务器返回的最后一个resourceVersion值开始监视,并且不会错过任何修改。The continue option should be set when retrieving more results from the server. Since this value is server defined, clients may only use the continue value from a previous query result with identical query parameters (except for the value of continue) and the server may reject a continue value it does not recognize. If the specified continue value is no longer valid whether due to expiration (generally five to fifteen minutes) or a configuration change on the server, the server will respond with a 410 ResourceExpired error together with a continue token. If the client needs a consistent list, it must restart their list without the continue field. Otherwise, the client may send another list request with the token received with the 410 error, the server will respond with a list starting from the next key, but from the latest snapshot, which is inconsistent from the previous list results - objects that are created, modified, or deleted after the first list request will be included in the response, as long as their keys are after the "next key". This field is not supported when watch is true. Clients may start a watch from the last resourceVersion value returned by the server and not miss any modifications.(except for the value of continue) and the server may reject a continue value it does not recognize. If the specified continue value is no longer valid whether due to expiration (generally five to fifteen minutes) or a configuration change on the server, the server will respond with a 410 ResourceExpired error together with a continue token. If the client needs a consistent list, it must restart their list without the continue field. Otherwise, the client may send another list request with the token received with the 410 error, the server will respond with a list starting from the next key, but from the latest snapshot, which is inconsistent from the previous list results - objects that are created, modified, or deleted after the first list request will be included in the response, as long as their keys are after the "next key". This field is not supported when watch is true. Clients may start a watch from the last resourceVersion value returned by the server and not miss any modifications. [optional]
dryRun String 如果存在,则表示不应保留修改。无效或无法识别的dryRun指令将导致错误响应,并且不会进一步处理请求。有效值为:-全部:将处理所有干运行阶段。When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed [optional]
fieldSelector String 一个选择器,用于按字段限制返回对象的列表。默认为一切。A selector to restrict the list of returned objects by their fields. Defaults to everything. [optional]
gracePeriodSeconds Integer 删除对象前的持续时间(秒)。值必须是非负整数。值为零表示立即删除。如果此值为nil,则将使用指定类型的默认宽限期。如果未指定,则默认为每对象值。零表示立即删除。The duration in seconds before the object should be deleted. Value must be non-negative integer. The value zero indicates delete immediately. If this value is nil, the default grace period for the specified type will be used. Defaults to a per object value if not specified. zero means delete immediately. [optional]
labelSelector String 一个选择器,用于根据返回对象的标签限制其列表。默认为一切。A selector to restrict the list of returned objects by their labels. Defaults to everything. [optional]
limit Integer limit是列表调用返回的最大响应数。如果存在更多项目,服务器将设置`继续`字段的值,该值可用于同一初始查询以检索下一组结果。如果所有请求的对象都被过滤掉,设置限制可能会返回少于请求数量的项目(最多为零个项目),客户端应该只使用continue字段来确定是否有更多结果可用。服务器可能会选择不支持limit参数,并将返回所有可用的结果。如果指定了limit且continue字段为空,则客户端可能会认为没有更多结果可用。如果watch为true,则不支持此字段。服务器保证在使用continue时返回的对象将与无限制地发出单个列表调用相同——也就是说,在发出第一个请求后创建、修改或删除的对象不会包含在任何后续的continue请求中。这有时被称为一致性快照,可以确保使用limit接收非常大结果的较小数据块的客户端可以确保看到所有可能的对象。如果在分块列表期间更新对象,则返回在计算第一个列表结果时存在的对象版本。limit is a maximum number of responses to return for a list call. If more items exist, the server will set the `continue` field on the list metadata to a value that can be used with the same initial query to retrieve the next set of results. Setting a limit may return fewer than the requested amount of items (up to zero items) in the event all requested objects are filtered out and clients should only use the presence of the continue field to determine whether more results are available. Servers may choose not to support the limit argument and will return all of the available results. If limit is specified and the continue field is empty, clients may assume that no more results are available. This field is not supported if watch is true. The server guarantees that the objects returned when using continue will be identical to issuing a single list call without a limit - that is, no objects created, modified, or deleted after the first request is issued will be included in any subsequent continued requests. This is sometimes referred to as a consistent snapshot, and ensures that a client that is using limit to receive smaller chunks of a very large result can ensure they see all possible objects. If objects are updated during a chunked list the version of the object that was present at the time the first list result was calculated is returned. [optional]
orphanDependents Boolean 已弃用:请使用PropagationPolicy,此字段将在1.7中弃用。从属对象应该是孤立的吗。如果为真/假,“孤立”终结器将被添加到对象的终结器列表中或从中删除。可以设置此字段或PropagationPolicy,但不能同时设置两者。已弃用:请使用PropagationPolicy,此字段将在1.7中弃用。从属对象应该是孤立的吗。如果为真/假,“孤立”终结器将被添加到对象的终结器列表中或从中删除。可以设置此字段或PropagationPolicy,但不能同时设置两者。Deprecated: please use the PropagationPolicy, this field will be deprecated in 1.7. Should the dependent objects be orphaned. If true/false, the "orphan" finalizer will be added to/removed from the object's finalizers list. Either this field or PropagationPolicy may be set, but not both. [optional]
propagationPolicy String 是否以及如何执行垃圾收集。可以设置此字段或孤立从属项,但不能同时设置两者。默认策略由元数据中设置的现有终结器决定。终结器和特定于资源的默认策略。Whether and how garbage collection will be performed. Either this field or OrphanDependents may be set, but not both. The default policy is decided by the existing finalizer set in the metadata.finalizers and the resource-specific default policy. Acceptable values are: 'Orphan' - orphan the dependents; 'Background' - allow the garbage collector to delete the dependents in the background; 'Foreground' - a cascading policy that deletes all dependents in the foreground. [optional]
resourceVersion String 当通过监视调用指定时,显示在资源的特定版本之后发生的更改。默认为历史开始时的更改。为列表指定时:-如果未设置,则根据仲裁读取标志从远程存储返回结果;-如果是's 0,然后我们只返回当前缓存中的内容,不保证;-如果设置为非零,则结果至少与给定值一样新鲜。When specified with a watch call, shows changes that occur after that particular version of a resource. Defaults to changes from the beginning of history. When specified for list: - if unset, then the result is returned from remote storage based on quorum-read flag; - if it's 0, then we simply return what we currently have in cache, no guarantee; - if set to non zero, then the result is at least as fresh as given rv. [optional]
timeoutSeconds Integer 列表/监视呼叫超时。这会限制通话的持续时间,而不管通话是否处于活动状态。列表/监视呼叫超时。这会限制通话的持续时间,而不管通话是否处于活动状态。Timeout for the list/watch call. This limits the duration of the call, regardless of any activity or inactivity. [optional]
body V1DeleteOptions [optional]

Return type

V1Status

Authorization

BearerToken

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json, application/yaml, application/vnd.kubernetes.protobuf

HTTP response details

Status code Description Response headers
200 OK -
401 Unauthorized -

deleteNode


回到“Node增删改查”目录

V1Status deleteNode(name, pretty, dryRun, gracePeriodSeconds, orphanDependents, propagationPolicy, body)

delete a Node

Example

// Import classes:
import io.kubernetes.client.openapi.ApiClient;
import io.kubernetes.client.openapi.ApiException;
import io.kubernetes.client.openapi.Configuration;
import io.kubernetes.client.openapi.auth.*;
import io.kubernetes.client.openapi.models.*;
import io.kubernetes.client.openapi.apis.CoreV1Api;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("http://localhost");
    
    // Configure API key authorization: BearerToken
    ApiKeyAuth BearerToken = (ApiKeyAuth) defaultClient.getAuthentication("BearerToken");
    BearerToken.setApiKey("YOUR API KEY");
    // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
    //BearerToken.setApiKeyPrefix("Token");

    CoreV1Api apiInstance = new CoreV1Api(defaultClient);
    String name = "name_example"; // String | name of the Node
    String pretty = "pretty_example"; // String | 如果为“true”,则输出相当打印。If 'true', then the output is pretty printed.
    String dryRun = "dryRun_example"; // String | 如果存在,则表示不应保留修改。无效或无法识别的dryRun指令将导致错误响应,并且不会进一步处理请求。有效值为:-全部:将处理所有干运行阶段。When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed
    Integer gracePeriodSeconds = 56; // Integer | 删除对象前的持续时间(秒)。值必须是非负整数。值为零表示立即删除。如果此值为nil,则将使用指定类型的默认宽限期。如果未指定,则默认为每对象值。零表示立即删除。The duration in seconds before the object should be deleted. Value must be non-negative integer. The value zero indicates delete immediately. If this value is nil, the default grace period for the specified type will be used. Defaults to a per object value if not specified. zero means delete immediately.
    Boolean orphanDependents = true; // Boolean | 已弃用:请使用PropagationPolicy,此字段将在1.7中弃用。从属对象应该是孤立的吗。如果为真/假,“孤立”终结器将被添加到对象的终结器列表中或从中删除。可以设置此字段或PropagationPolicy,但不能同时设置两者。已弃用:请使用PropagationPolicy,此字段将在1.7中弃用。从属对象应该是孤立的吗。如果为真/假,“孤立”终结器将被添加到对象的终结器列表中或从中删除。可以设置此字段或PropagationPolicy,但不能同时设置两者。Deprecated: please use the PropagationPolicy, this field will be deprecated in 1.7. Should the dependent objects be orphaned. If true/false, the \"orphan\" finalizer will be added to/removed from the object's finalizers list. Either this field or PropagationPolicy may be set, but not both.
    String propagationPolicy = "propagationPolicy_example"; // String | 是否以及如何执行垃圾收集。可以设置此字段或孤立从属项,但不能同时设置两者。默认策略由元数据中设置的现有终结器决定。终结器和特定于资源的默认策略。Whether and how garbage collection will be performed. Either this field or OrphanDependents may be set, but not both. The default policy is decided by the existing finalizer set in the metadata.finalizers and the resource-specific default policy. Acceptable values are: 'Orphan' - orphan the dependents; 'Background' - allow the garbage collector to delete the dependents in the background; 'Foreground' - a cascading policy that deletes all dependents in the foreground.
    V1DeleteOptions body = new V1DeleteOptions(); // V1DeleteOptions | 
    try {
      V1Status result = apiInstance.deleteNode(name, pretty, dryRun, gracePeriodSeconds, orphanDependents, propagationPolicy, body);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling CoreV1Api#deleteNode");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
name String name of the Node
pretty String 如果为“true”,则输出相当打印。If 'true', then the output is pretty printed. [optional]
dryRun String 如果存在,则表示不应保留修改。无效或无法识别的dryRun指令将导致错误响应,并且不会进一步处理请求。有效值为:-全部:将处理所有干运行阶段。When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed [optional]
gracePeriodSeconds Integer 删除对象前的持续时间(秒)。值必须是非负整数。值为零表示立即删除。如果此值为nil,则将使用指定类型的默认宽限期。如果未指定,则默认为每对象值。零表示立即删除。The duration in seconds before the object should be deleted. Value must be non-negative integer. The value zero indicates delete immediately. If this value is nil, the default grace period for the specified type will be used. Defaults to a per object value if not specified. zero means delete immediately. [optional]
orphanDependents Boolean 已弃用:请使用PropagationPolicy,此字段将在1.7中弃用。从属对象应该是孤立的吗。如果为真/假,“孤立”终结器将被添加到对象的终结器列表中或从中删除。可以设置此字段或PropagationPolicy,但不能同时设置两者。已弃用:请使用PropagationPolicy,此字段将在1.7中弃用。从属对象应该是孤立的吗。如果为真/假,“孤立”终结器将被添加到对象的终结器列表中或从中删除。可以设置此字段或PropagationPolicy,但不能同时设置两者。Deprecated: please use the PropagationPolicy, this field will be deprecated in 1.7. Should the dependent objects be orphaned. If true/false, the "orphan" finalizer will be added to/removed from the object's finalizers list. Either this field or PropagationPolicy may be set, but not both. [optional]
propagationPolicy String 是否以及如何执行垃圾收集。可以设置此字段或孤立从属项,但不能同时设置两者。默认策略由元数据中设置的现有终结器决定。终结器和特定于资源的默认策略。Whether and how garbage collection will be performed. Either this field or OrphanDependents may be set, but not both. The default policy is decided by the existing finalizer set in the metadata.finalizers and the resource-specific default policy. Acceptable values are: 'Orphan' - orphan the dependents; 'Background' - allow the garbage collector to delete the dependents in the background; 'Foreground' - a cascading policy that deletes all dependents in the foreground. [optional]
body V1DeleteOptions [optional]

Return type

V1Status

Authorization

BearerToken

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json, application/yaml, application/vnd.kubernetes.protobuf

HTTP response details

Status code Description Response headers
200 OK -
202 Accepted -
401 Unauthorized -

listNode


回到“Node增删改查”目录

V1NodeList listNode(pretty, allowWatchBookmarks, _continue, fieldSelector, labelSelector, limit, resourceVersion, timeoutSeconds, watch)

list or watch objects of kind Node

Example

// Import classes:
import io.kubernetes.client.openapi.ApiClient;
import io.kubernetes.client.openapi.ApiException;
import io.kubernetes.client.openapi.Configuration;
import io.kubernetes.client.openapi.auth.*;
import io.kubernetes.client.openapi.models.*;
import io.kubernetes.client.openapi.apis.CoreV1Api;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("http://localhost");
    
    // Configure API key authorization: BearerToken
    ApiKeyAuth BearerToken = (ApiKeyAuth) defaultClient.getAuthentication("BearerToken");
    BearerToken.setApiKey("YOUR API KEY");
    // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
    //BearerToken.setApiKeyPrefix("Token");

    CoreV1Api apiInstance = new CoreV1Api(defaultClient);
    String pretty = "pretty_example"; // String | 如果为“true”,则输出相当打印。If 'true', then the output is pretty printed.
    Boolean allowWatchBookmarks = true; // Boolean | allowWatchBookmarks请求观看类型为“BOOKMARK”的事件。未实现书签的服务器可能会忽略此标志,并由服务器自行决定是否发送书签。客户端不应假定书签是在任何特定的时间间隔返回的,也不应假定服务器将在会话期间发送任何书签事件。如果这不是手表,则忽略此字段。如果apiserver中未启用功能gate WatchBookmarks,则忽略此字段。allowWatchBookmarks请求观看类型为“的事件;书签"。未实现书签的服务器可能会忽略此标志,书签会在服务器上发送'这是自由裁量权。客户端不应假定书签是在任何特定的时间间隔返回的,也不应假定服务器将在会话期间发送任何书签事件。如果这不是手表,则忽略此字段。如果apiserver中未启用功能gate WatchBookmarks,则忽略此字段。allowWatchBookmarks requests watch events with type \"BOOKMARK\". Servers that do not implement bookmarks may ignore this flag and bookmarks are sent at the server's discretion. Clients should not assume bookmarks are returned at any specific interval, nor may they assume the server will send any BOOKMARK event during a session. If this is not a watch, this field is ignored. If the feature gate WatchBookmarks is not enabled in apiserver, this field is ignored.
    String _continue = "_continue_example"; // String | 从服务器检索更多结果时,应设置“继续”选项。由于此值是服务器定义的,因此客户端只能使用具有相同查询参数(continue值除外)的上一个查询结果中的continue值,服务器可能会拒绝它无法识别的continue值。如果指定的continue值因过期(通常为5到15分钟)或服务器上的配置更改而不再有效,服务器将响应410 ResourceExpired错误和continue令牌。如果客户端需要一个一致的列表,它必须在不使用continue字段的情况下重新启动它们的列表。从另一台服务器发送的结果可能与前一台服务器发送的结果不一致,但从下一台服务器发送的结果可能与前一台服务器发送的结果不一致,只要他们的钥匙在“下一个钥匙”之后。watch为true时不支持此字段。客户端可以从服务器返回的最后一个resourceVersion值开始监视,并且不会错过任何修改。The continue option should be set when retrieving more results from the server. Since this value is server defined, clients may only use the continue value from a previous query result with identical query parameters (except for the value of continue) and the server may reject a continue value it does not recognize. If the specified continue value is no longer valid whether due to expiration (generally five to fifteen minutes) or a configuration change on the server, the server will respond with a 410 ResourceExpired error together with a continue token. If the client needs a consistent list, it must restart their list without the continue field. Otherwise, the client may send another list request with the token received with the 410 error, the server will respond with a list starting from the next key, but from the latest snapshot, which is inconsistent from the previous list results - objects that are created, modified, or deleted after the first list request will be included in the response, as long as their keys are after the "next key".  This field is not supported when watch is true. Clients may start a watch from the last resourceVersion value returned by the server and not miss any modifications.(except for the value of continue) and the server may reject a continue value it does not recognize. If the specified continue value is no longer valid whether due to expiration (generally five to fifteen minutes) or a configuration change on the server, the server will respond with a 410 ResourceExpired error together with a continue token. If the client needs a consistent list, it must restart their list without the continue field. Otherwise, the client may send another list request with the token received with the 410 error, the server will respond with a list starting from the next key, but from the latest snapshot, which is inconsistent from the previous list results - objects that are created, modified, or deleted after the first list request will be included in the response, as long as their keys are after the \"next key\".  This field is not supported when watch is true. Clients may start a watch from the last resourceVersion value returned by the server and not miss any modifications.
    String fieldSelector = "fieldSelector_example"; // String | 一个选择器,用于按字段限制返回对象的列表。默认为一切。A selector to restrict the list of returned objects by their fields. Defaults to everything.
    String labelSelector = "labelSelector_example"; // String | 一个选择器,用于根据返回对象的标签限制其列表。默认为一切。A selector to restrict the list of returned objects by their labels. Defaults to everything.
    Integer limit = 56; // Integer | limit是列表调用返回的最大响应数。如果存在更多项,服务器会将列表元数据上的“continue”字段设置为一个值,该值可用于同一初始查询,以检索下一组结果。如果所有请求的对象都被过滤掉,设置限制可能会返回少于请求数量的项目(最多为零个项目),客户端应该只使用continue字段来确定是否有更多结果可用。服务器可能会选择不支持limit参数,并将返回所有可用的结果。如果指定了limit且continue字段为空,则客户端可能会认为没有更多结果可用。如果watch为true,则不支持此字段。服务器保证在使用continue时返回的对象将与无限制地发出单个列表调用相同——也就是说,在发出第一个请求后创建、修改或删除的对象不会包含在任何后续的continue请求中。这有时被称为一致性快照,可以确保使用limit接收非常大结果的较小数据块的客户端可以确保看到所有可能的对象。如果在分块列表期间更新对象,则返回在计算第一个列表结果时存在的对象版本。limit is a maximum number of responses to return for a list call. If more items exist, the server will set the `continue` field on the list metadata to a value that can be used with the same initial query to retrieve the next set of results. Setting a limit may return fewer than the requested amount of items (up to zero items) in the event all requested objects are filtered out and clients should only use the presence of the continue field to determine whether more results are available. Servers may choose not to support the limit argument and will return all of the available results. If limit is specified and the continue field is empty, clients may assume that no more results are available. This field is not supported if watch is true.  The server guarantees that the objects returned when using continue will be identical to issuing a single list call without a limit - that is, no objects created, modified, or deleted after the first request is issued will be included in any subsequent continued requests. This is sometimes referred to as a consistent snapshot, and ensures that a client that is using limit to receive smaller chunks of a very large result can ensure they see all possible objects. If objects are updated during a chunked list the version of the object that was present at the time the first list result was calculated is returned.
    String resourceVersion = "resourceVersion_example"; // String | 当通过监视调用指定时,显示在资源的特定版本之后发生的更改。默认为历史开始时的更改。为列表指定时:-如果未设置,则根据仲裁读取标志从远程存储返回结果;-如果是0,那么我们只返回当前缓存中的内容,不保证;-如果设置为非零,则结果至少与给定值一样新鲜When specified with a watch call, shows changes that occur after that particular version of a resource. Defaults to changes from the beginning of history. When specified for list: - if unset, then the result is returned from remote storage based on quorum-read flag; - if it's 0, then we simply return what we currently have in cache, no guarantee; - if set to non zero, then the result is at least as fresh as given rv.
    Integer timeoutSeconds = 56; // Integer | 列表/监视呼叫超时。这会限制通话的持续时间,而不管通话是否处于活动状态。列表/监视呼叫超时。这会限制通话的持续时间,而不管通话是否处于活动状态。Timeout for the list/watch call. This limits the duration of the call, regardless of any activity or inactivity.
    Boolean watch = true; // Boolean | 观察对所描述资源的更改,并将其作为添加、更新和删除通知流返回。指定resourceVersion。观察对所描述资源的更改,并将其作为添加、更新和删除通知流返回。Watch for changes to the described resources and return them as a stream of add, update, and remove notifications. Specify resourceVersion.
    try {
      V1NodeList result = apiInstance.listNode(pretty, allowWatchBookmarks, _continue, fieldSelector, labelSelector, limit, resourceVersion, timeoutSeconds, watch);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling CoreV1Api#listNode");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
pretty String 如果为“true”,则输出相当打印。If 'true', then the output is pretty printed. [optional]
allowWatchBookmarks Boolean allowWatchBookmarks请求观看类型为“BOOKMARK”的事件。未实现书签的服务器可能会忽略此标志,并由服务器自行决定是否发送书签。客户端不应假定书签是在任何特定的时间间隔返回的,也不应假定服务器将在会话期间发送任何书签事件。如果这不是手表,则忽略此字段。如果apiserver中未启用功能gate WatchBookmarks,则忽略此字段。allowWatchBookmarks请求观看类型为“的事件;书签"。未实现书签的服务器可能会忽略此标志,书签会在服务器上发送'这是自由裁量权。客户端不应假定书签是在任何特定的时间间隔返回的,也不应假定服务器将在会话期间发送任何书签事件。如果这不是手表,则忽略此字段。如果apiserver中未启用功能gate WatchBookmarks,则忽略此字段。allowWatchBookmarks requests watch events with type "BOOKMARK". Servers that do not implement bookmarks may ignore this flag and bookmarks are sent at the server's discretion. Clients should not assume bookmarks are returned at any specific interval, nor may they assume the server will send any BOOKMARK event during a session. If this is not a watch, this field is ignored. If the feature gate WatchBookmarks is not enabled in apiserver, this field is ignored. [optional]
_continue String 从服务器检索更多结果时,应设置“继续”选项。由于此值是服务器定义的,因此客户端只能使用具有相同查询参数(continue值除外)的上一个查询结果中的continue值,服务器可能会拒绝它无法识别的continue值。如果指定的continue值因过期(通常为5到15分钟)或服务器上的配置更改而不再有效,服务器将响应410 ResourceExpired错误和continue令牌。如果客户端需要一个一致的列表,它必须在不使用continue字段的情况下重新启动它们的列表。从另一台服务器发送的结果可能与前一台服务器发送的结果不一致,但从下一台服务器发送的结果可能与前一台服务器发送的结果不一致,只要他们的钥匙在“下一个钥匙”之后。watch为true时不支持此字段。客户端可以从服务器返回的最后一个resourceVersion值开始监视,并且不会错过任何修改。The continue option should be set when retrieving more results from the server. Since this value is server defined, clients may only use the continue value from a previous query result with identical query parameters (except for the value of continue) and the server may reject a continue value it does not recognize. If the specified continue value is no longer valid whether due to expiration (generally five to fifteen minutes) or a configuration change on the server, the server will respond with a 410 ResourceExpired error together with a continue token. If the client needs a consistent list, it must restart their list without the continue field. Otherwise, the client may send another list request with the token received with the 410 error, the server will respond with a list starting from the next key, but from the latest snapshot, which is inconsistent from the previous list results - objects that are created, modified, or deleted after the first list request will be included in the response, as long as their keys are after the "next key". This field is not supported when watch is true. Clients may start a watch from the last resourceVersion value returned by the server and not miss any modifications.(except for the value of continue) and the server may reject a continue value it does not recognize. If the specified continue value is no longer valid whether due to expiration (generally five to fifteen minutes) or a configuration change on the server, the server will respond with a 410 ResourceExpired error together with a continue token. If the client needs a consistent list, it must restart their list without the continue field. Otherwise, the client may send another list request with the token received with the 410 error, the server will respond with a list starting from the next key, but from the latest snapshot, which is inconsistent from the previous list results - objects that are created, modified, or deleted after the first list request will be included in the response, as long as their keys are after the "next key". This field is not supported when watch is true. Clients may start a watch from the last resourceVersion value returned by the server and not miss any modifications. [optional]
fieldSelector String 一个选择器,用于按字段限制返回对象的列表。默认为一切。A selector to restrict the list of returned objects by their fields. Defaults to everything. [optional]
labelSelector String 一个选择器,用于根据返回对象的标签限制其列表。默认为一切。A selector to restrict the list of returned objects by their labels. Defaults to everything. [optional]
limit Integer limit是列表调用返回的最大响应数。如果存在更多项目,服务器将设置`继续`字段的值,该值可用于同一初始查询以检索下一组结果。如果所有请求的对象都被过滤掉,设置限制可能会返回少于请求数量的项目(最多为零个项目),客户端应该只使用continue字段来确定是否有更多结果可用。服务器可能会选择不支持limit参数,并将返回所有可用的结果。如果指定了limit且continue字段为空,则客户端可能会认为没有更多结果可用。如果watch为true,则不支持此字段。服务器保证在使用continue时返回的对象将与无限制地发出单个列表调用相同——也就是说,在发出第一个请求后创建、修改或删除的对象不会包含在任何后续的continue请求中。这有时被称为一致性快照,可以确保使用limit接收非常大结果的较小数据块的客户端可以确保看到所有可能的对象。如果在分块列表期间更新对象,则返回在计算第一个列表结果时存在的对象版本。 limit is a maximum number of responses to return for a list call. If more items exist, the server will set the `continue` field on the list metadata to a value that can be used with the same initial query to retrieve the next set of results. Setting a limit may return fewer than the requested amount of items (up to zero items) in the event all requested objects are filtered out and clients should only use the presence of the continue field to determine whether more results are available. Servers may choose not to support the limit argument and will return all of the available results. If limit is specified and the continue field is empty, clients may assume that no more results are available. This field is not supported if watch is true. The server guarantees that the objects returned when using continue will be identical to issuing a single list call without a limit - that is, no objects created, modified, or deleted after the first request is issued will be included in any subsequent continued requests. This is sometimes referred to as a consistent snapshot, and ensures that a client that is using limit to receive smaller chunks of a very large result can ensure they see all possible objects. If objects are updated during a chunked list the version of the object that was present at the time the first list result was calculated is returned. [optional]
resourceVersion String 当通过监视调用指定时,显示在资源的特定版本之后发生的更改。默认为历史开始时的更改。为列表指定时:-如果未设置,则根据仲裁读取标志从远程存储返回结果;-如果是's 0,然后我们只返回当前缓存中的内容,不保证;-如果设置为非零,则结果至少与给定值一样新鲜。When specified with a watch call, shows changes that occur after that particular version of a resource. Defaults to changes from the beginning of history. When specified for list: - if unset, then the result is returned from remote storage based on quorum-read flag; - if it's 0, then we simply return what we currently have in cache, no guarantee; - if set to non zero, then the result is at least as fresh as given rv. [optional]
timeoutSeconds Integer 列表/监视呼叫超时。这会限制通话的持续时间,而不管通话是否处于活动状态。列表/监视呼叫超时。这会限制通话的持续时间,而不管通话是否处于活动状态。Timeout for the list/watch call. This limits the duration of the call, regardless of any activity or inactivity. [optional]
watch Boolean 观察对所描述资源的更改,并将其作为添加、更新和删除通知流返回。指定resourceVersion。观察对所描述资源的更改,并将其作为添加、更新和删除通知流返回。Watch for changes to the described resources and return them as a stream of add, update, and remove notifications. Specify resourceVersion. [optional]

Return type

V1NodeList

Authorization

BearerToken

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json, application/yaml, application/vnd.kubernetes.protobuf, application/json;stream=watch, application/vnd.kubernetes.protobuf;stream=watch

HTTP response details

Status code Description Response headers
200 OK -
401 Unauthorized -

patchNode


回到“Node增删改查”目录

V1Node patchNode(name, body, pretty, dryRun, fieldManager, force)

partially update the specified Node

Example

// Import classes:
import io.kubernetes.client.openapi.ApiClient;
import io.kubernetes.client.openapi.ApiException;
import io.kubernetes.client.openapi.Configuration;
import io.kubernetes.client.openapi.auth.*;
import io.kubernetes.client.openapi.models.*;
import io.kubernetes.client.openapi.apis.CoreV1Api;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("http://localhost");
    
    // Configure API key authorization: BearerToken
    ApiKeyAuth BearerToken = (ApiKeyAuth) defaultClient.getAuthentication("BearerToken");
    BearerToken.setApiKey("YOUR API KEY");
    // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
    //BearerToken.setApiKeyPrefix("Token");

    CoreV1Api apiInstance = new CoreV1Api(defaultClient);
    String name = "name_example"; // String | name of the Node
    V1Patch body = new V1Patch(); // V1Patch | 
    String pretty = "pretty_example"; // String | 如果为“true”,则输出相当打印。If 'true', then the output is pretty printed.
    String dryRun = "dryRun_example"; // String | 如果存在,则表示不应保留修改。无效或无法识别的dryRun指令将导致错误响应,并且不会进一步处理请求。有效值为:-全部:将处理所有干运行阶段。When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed
    String fieldManager = "fieldManager_example"; // String |  fieldManager是与进行这些更改的参与者或实体关联的名称。该值的长度必须小于或128个字符,并且仅包含可打印字符,如https://golang.org/pkg/unicode/#IsPrint.fieldManager is a name associated with the actor or entity that is making these changes. The value must be less than or 128 characters long, and only contain printable characters, as defined by https://golang.org/pkg/unicode/#IsPrint. This field is required for apply requests (application/apply-patch) but optional for non-apply patch types (JsonPatch, MergePatch, StrategicMergePatch).
    Boolean force = true; // Boolean | Force将“强制”应用请求。这意味着用户将重新获取其他人拥有的冲突字段。对于非应用补丁请求,必须取消设置强制标志。Force is going to \"force\" Apply requests. It means user will re-acquire conflicting fields owned by other people. Force flag must be unset for non-apply patch requests.
    try {
      V1Node result = apiInstance.patchNode(name, body, pretty, dryRun, fieldManager, force);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling CoreV1Api#patchNode");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
name String name of the Node
body V1Patch
pretty String 如果为“true”,则输出相当打印。If 'true', then the output is pretty printed. [optional]
dryRun String 如果存在,则表示不应保留修改。无效或无法识别的dryRun指令将导致错误响应,并且不会进一步处理请求。有效值为:-全部:将处理所有干运行阶段。When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed [optional]
fieldManager String fieldManager是与进行这些更改的参与者或实体关联的名称。该值的长度必须小于或128个字符,并且仅包含可打印字符,如https://golang.org/pkg/unicode/#IsPrint.fieldManager is a name associated with the actor or entity that is making these changes. The value must be less than or 128 characters long, and only contain printable characters, as defined by https://golang.org/pkg/unicode/#IsPrint. This field is required for apply requests (application/apply-patch) but optional for non-apply patch types (JsonPatch, MergePatch, StrategicMergePatch). [optional]
force Boolean Force将“强制”应用请求。这意味着用户将重新获取其他人拥有的冲突字段。对于非应用补丁请求,必须取消设置强制标志。Force is going to "force" Apply requests. It means user will re-acquire conflicting fields owned by other people. Force flag must be unset for non-apply patch requests. [optional]

Return type

V1Node

Authorization

BearerToken

HTTP request headers

  • Content-Type: application/json-patch+json, application/merge-patch+json, application/strategic-merge-patch+json, application/apply-patch+yaml
  • Accept: application/json, application/yaml, application/vnd.kubernetes.protobuf

HTTP response details

Status code Description Response headers
200 OK -
401 Unauthorized -

readNode


回到“Node增删改查”目录

V1Node readNode(name, pretty, exact, export)

read the specified Node

Example

// Import classes:
import io.kubernetes.client.openapi.ApiClient;
import io.kubernetes.client.openapi.ApiException;
import io.kubernetes.client.openapi.Configuration;
import io.kubernetes.client.openapi.auth.*;
import io.kubernetes.client.openapi.models.*;
import io.kubernetes.client.openapi.apis.CoreV1Api;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("http://localhost");
    
    // Configure API key authorization: BearerToken
    ApiKeyAuth BearerToken = (ApiKeyAuth) defaultClient.getAuthentication("BearerToken");
    BearerToken.setApiKey("YOUR API KEY");
    // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
    //BearerToken.setApiKeyPrefix("Token");

    CoreV1Api apiInstance = new CoreV1Api(defaultClient);
    String name = "name_example"; // String | name of the Node
    String pretty = "pretty_example"; // String | 如果为“true”,则输出相当打印。If 'true', then the output is pretty printed.
    Boolean exact = true; // Boolean | 出口应该是准确的。Exact export维护特定于集群的字段,如“Namespace”。不赞成。计划于1.18年拆除。Should the export be exact.  Exact export maintains cluster-specific fields like 'Namespace'. Deprecated. Planned for removal in 1.18.
    Boolean export = true; // Boolean | 应该将该值导出。导出用户无法指定的字段。不赞成。计划于1.18年拆除。Should this value be exported.  Export strips fields that a user can not specify. Deprecated. Planned for removal in 1.18.
    try {
      V1Node result = apiInstance.readNode(name, pretty, exact, export);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling CoreV1Api#readNode");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
name String name of the Node
pretty String 如果为“true”,则输出相当打印。If 'true', then the output is pretty printed. [optional]
exact Boolean Should the export be exact. Exact export maintains cluster-specific fields like 'Namespace'. Deprecated. Planned for removal in 1.18. [optional]
export Boolean 应该将该值导出。导出用户无法指定的字段。不赞成。计划于1.18年拆除。Should this value be exported. Export strips fields that a user can not specify. Deprecated. Planned for removal in 1.18. [optional]

Return type

V1Node

Authorization

BearerToken

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json, application/yaml, application/vnd.kubernetes.protobuf

HTTP response details

Status code Description Response headers
200 OK -

replaceNode


回到“Node增删改查”目录

V1Node replaceNode(name, body, pretty, dryRun, fieldManager)

replace the specified Node

Example

// Import classes:
import io.kubernetes.client.openapi.ApiClient;
import io.kubernetes.client.openapi.ApiException;
import io.kubernetes.client.openapi.Configuration;
import io.kubernetes.client.openapi.auth.*;
import io.kubernetes.client.openapi.models.*;
import io.kubernetes.client.openapi.apis.CoreV1Api;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("http://localhost");
    
    // Configure API key authorization: BearerToken
    ApiKeyAuth BearerToken = (ApiKeyAuth) defaultClient.getAuthentication("BearerToken");
    BearerToken.setApiKey("YOUR API KEY");
    // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
    //BearerToken.setApiKeyPrefix("Token");

    CoreV1Api apiInstance = new CoreV1Api(defaultClient);
    String name = "name_example"; // String | name of the Node
    V1Node body = new V1Node(); // V1Node | 
    String pretty = "pretty_example"; // String | 如果为“true”,则输出相当打印。If 'true', then the output is pretty printed.
    String dryRun = "dryRun_example"; // String | 如果存在,则表示不应保留修改。无效或无法识别的dryRun指令将导致错误响应,并且不会进一步处理请求。有效值为:-全部:将处理所有干运行阶段。When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed
    String fieldManager = "fieldManager_example"; // String |  fieldManager是与进行这些更改的参与者或实体关联的名称。该值的长度必须小于或128个字符,并且仅包含可打印字符,如https://golang.org/pkg/unicode/#IsPrint.fieldManager is a name associated with the actor or entity that is making these changes. The value must be less than or 128 characters long, and only contain printable characters, as defined by https://golang.org/pkg/unicode/#IsPrint.
    try {
      V1Node result = apiInstance.replaceNode(name, body, pretty, dryRun, fieldManager);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling CoreV1Api#replaceNode");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
name String name of the Node
body V1Node
pretty String 如果为“true”,则输出相当打印。If 'true', then the output is pretty printed. [optional]
dryRun String 如果存在,则表示不应保留修改。无效或无法识别的dryRun指令将导致错误响应,并且不会进一步处理请求。有效值为:-全部:将处理所有干运行阶段。When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed [optional]
fieldManager String fieldManager是与进行这些更改的参与者或实体关联的名称。该值的长度必须小于或128个字符,并且仅包含可打印字符,如https://golang.org/pkg/unicode/#IsPrint.fieldManager is a name associated with the actor or entity that is making these changes. The value must be less than or 128 characters long, and only contain printable characters, as defined by https://golang.org/pkg/unicode/#IsPrint. [optional]

Return type

V1Node

Authorization

BearerToken

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json, application/yaml, application/vnd.kubernetes.protobuf

HTTP response details

Status code Description Response headers
200 OK -
201 Created -
401 Unauthorized -

replaceNodeStatus


回到“Node增删改查”目录

V1Node replaceNodeStatus(name, body, pretty, dryRun, fieldManager)

replace status of the specified Node

Example

// Import classes:
import io.kubernetes.client.openapi.ApiClient;
import io.kubernetes.client.openapi.ApiException;
import io.kubernetes.client.openapi.Configuration;
import io.kubernetes.client.openapi.auth.*;
import io.kubernetes.client.openapi.models.*;
import io.kubernetes.client.openapi.apis.CoreV1Api;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("http://localhost");
    
    // Configure API key authorization: BearerToken
    ApiKeyAuth BearerToken = (ApiKeyAuth) defaultClient.getAuthentication("BearerToken");
    BearerToken.setApiKey("YOUR API KEY");
    // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
    //BearerToken.setApiKeyPrefix("Token");

    CoreV1Api apiInstance = new CoreV1Api(defaultClient);
    String name = "name_example"; // String | name of the Node
    V1Node body = new V1Node(); // V1Node | 
    String pretty = "pretty_example"; // String | 如果为“true”,则输出相当打印。If 'true', then the output is pretty printed.
    String dryRun = "dryRun_example"; // String | 如果存在,则表示不应保留修改。无效或无法识别的dryRun指令将导致错误响应,并且不会进一步处理请求。有效值为:-全部:将处理所有干运行阶段。When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed
    String fieldManager = "fieldManager_example"; // String |  fieldManager是与进行这些更改的参与者或实体关联的名称。该值的长度必须小于或128个字符,并且仅包含可打印字符,如https://golang.org/pkg/unicode/#IsPrint.fieldManager is a name associated with the actor or entity that is making these changes. The value must be less than or 128 characters long, and only contain printable characters, as defined by https://golang.org/pkg/unicode/#IsPrint.
    try {
      V1Node result = apiInstance.replaceNodeStatus(name, body, pretty, dryRun, fieldManager);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling CoreV1Api#replaceNodeStatus");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
name String name of the Node
body V1Node
pretty String 如果为“true”,则输出相当打印。If 'true', then the output is pretty printed. [optional]
dryRun String 如果存在,则表示不应保留修改。无效或无法识别的dryRun指令将导致错误响应,并且不会进一步处理请求。有效值为:-全部:将处理所有干运行阶段。When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed [optional]
fieldManager String fieldManager是与进行这些更改的参与者或实体关联的名称。该值的长度必须小于或128个字符,并且仅包含可打印字符,如https://golang.org/pkg/unicode/#IsPrint.fieldManager is a name associated with the actor or entity that is making these changes. The value must be less than or 128 characters long, and only contain printable characters, as defined by https://golang.org/pkg/unicode/#IsPrint. [optional]

Return type

V1Node

Authorization

BearerToken

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json, application/yaml, application/vnd.kubernetes.protobuf

HTTP response details

Status code Description Response headers
200 OK -
201 Created -
401 Unauthorized -

Pod增删改查


回到K8sAPI根目录

All URIs are relative to http://localhost

Method HTTP request Description
createNamespacedPod POST /api/v1/namespaces/{namespace}/pods 创建pod
deleteCollectionNamespacedPod DELETE /api/v1/namespaces/{namespace}/pods 删除多个pod
deleteNamespacedPod DELETE /api/v1/namespaces/{namespace}/pods/ 删除pod
listNamespacedPod GET /api/v1/namespaces/{namespace}/pods pod列表
patchNamespacedPod PATCH /api/v1/namespaces/{namespace}/pods/ 更新pod
readNamespacedPod GET /api/v1/namespaces/{namespace}/pods/ 查询指定pod
replaceNamespacedPod PUT /api/v1/namespaces/{namespace}/pods/ 替换指定pod内容

createNamespacedPod


回到“Pod增删查改”目录

V1Pod createNamespacedPod(namespace, body, pretty, dryRun, fieldManager)

create a Pod

Example

// Import classes:
import io.kubernetes.client.openapi.ApiClient;
import io.kubernetes.client.openapi.ApiException;
import io.kubernetes.client.openapi.Configuration;
import io.kubernetes.client.openapi.auth.*;
import io.kubernetes.client.openapi.models.*;
import io.kubernetes.client.openapi.apis.CoreV1Api;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("http://localhost");
    
    // Configure API key authorization: BearerToken
    ApiKeyAuth BearerToken = (ApiKeyAuth) defaultClient.getAuthentication("BearerToken");
    BearerToken.setApiKey("YOUR API KEY");
    // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
    //BearerToken.setApiKeyPrefix("Token");

    CoreV1Api apiInstance = new CoreV1Api(defaultClient);
    String namespace = "namespace_example"; // String | 对象名称和身份验证范围,例如团队和项目。object name and auth scope, such as for teams and projects
    V1Pod body = new V1Pod(); // V1Pod | 
    String pretty = "pretty_example"; // String | 如果为“true”,则输出相当打印。If 'true', then the output is pretty printed.
    String dryRun = "dryRun_example"; // String | 如果存在,则表示不应保留修改。无效或无法识别的dryRun指令将导致错误响应,并且不会进一步处理请求。有效值为:-全部:将处理所有干运行阶段。When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed
    String fieldManager = "fieldManager_example"; // String |  fieldManager是与进行这些更改的参与者或实体关联的名称。该值的长度必须小于或128个字符,并且仅包含可打印字符,如https://golang.org/pkg/unicode/#IsPrint.fieldManager is a name associated with the actor or entity that is making these changes. The value must be less than or 128 characters long, and only contain printable characters, as defined by https://golang.org/pkg/unicode/#IsPrint.
    try {
      V1Pod result = apiInstance.createNamespacedPod(namespace, body, pretty, dryRun, fieldManager);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling CoreV1Api#createNamespacedPod");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
namespace String 对象名称和身份验证范围,例如团队和项目。object name and auth scope, such as for teams and projects
body V1Pod
pretty String 如果为“true”,则输出相当打印。If 'true', then the output is pretty printed. [optional]
dryRun String 如果存在,则表示不应保留修改。无效或无法识别的dryRun指令将导致错误响应,并且不会进一步处理请求。有效值为:-全部:将处理所有干运行阶段。When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed [optional]
fieldManager String fieldManager是与进行这些更改的参与者或实体关联的名称。该值的长度必须小于或128个字符,并且仅包含可打印字符,如https://golang.org/pkg/unicode/#IsPrint.fieldManager is a name associated with the actor or entity that is making these changes. The value must be less than or 128 characters long, and only contain printable characters, as defined by https://golang.org/pkg/unicode/#IsPrint. [optional]

Return type

V1Pod

Authorization

BearerToken

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json, application/yaml, application/vnd.kubernetes.protobuf

HTTP response details

Status code Description Response headers
200 OK -
201 Created -
202 Accepted -
401 Unauthorized -

deleteCollectionNamespacedPod


回到“Pod增删查改”目录

V1Status deleteCollectionNamespacedPod(namespace, pretty, _continue, dryRun, fieldSelector, gracePeriodSeconds, labelSelector, limit, orphanDependents, propagationPolicy, resourceVersion, timeoutSeconds, body)

delete collection of Pod

Example

// Import classes:
import io.kubernetes.client.openapi.ApiClient;
import io.kubernetes.client.openapi.ApiException;
import io.kubernetes.client.openapi.Configuration;
import io.kubernetes.client.openapi.auth.*;
import io.kubernetes.client.openapi.models.*;
import io.kubernetes.client.openapi.apis.CoreV1Api;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("http://localhost");
    
    // Configure API key authorization: BearerToken
    ApiKeyAuth BearerToken = (ApiKeyAuth) defaultClient.getAuthentication("BearerToken");
    BearerToken.setApiKey("YOUR API KEY");
    // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
    //BearerToken.setApiKeyPrefix("Token");

    CoreV1Api apiInstance = new CoreV1Api(defaultClient);
    String namespace = "namespace_example"; // String | 对象名称和身份验证范围,例如团队和项目。object name and auth scope, such as for teams and projects
    String pretty = "pretty_example"; // String | 如果为“true”,则输出相当打印。If 'true', then the output is pretty printed.
    String _continue = "_continue_example"; // String | 从服务器检索更多结果时,应设置“继续”选项。由于此值是服务器定义的,因此客户端只能使用具有相同查询参数(continue值除外)的上一个查询结果中的continue值,服务器可能会拒绝它无法识别的continue值。如果指定的continue值因过期(通常为5到15分钟)或服务器上的配置更改而不再有效,服务器将响应410 ResourceExpired错误和continue令牌。如果客户端需要一个一致的列表,它必须在不使用continue字段的情况下重新启动它们的列表。从另一台服务器发送的结果可能与前一台服务器发送的结果不一致,但从下一台服务器发送的结果可能与前一台服务器发送的结果不一致,只要他们的钥匙在“下一个钥匙”之后。watch为true时不支持此字段。客户端可以从服务器返回的最后一个resourceVersion值开始监视,并且不会错过任何修改。The continue option should be set when retrieving more results from the server. Since this value is server defined, clients may only use the continue value from a previous query result with identical query parameters (except for the value of continue) and the server may reject a continue value it does not recognize. If the specified continue value is no longer valid whether due to expiration (generally five to fifteen minutes) or a configuration change on the server, the server will respond with a 410 ResourceExpired error together with a continue token. If the client needs a consistent list, it must restart their list without the continue field. Otherwise, the client may send another list request with the token received with the 410 error, the server will respond with a list starting from the next key, but from the latest snapshot, which is inconsistent from the previous list results - objects that are created, modified, or deleted after the first list request will be included in the response, as long as their keys are after the "next key".  This field is not supported when watch is true. Clients may start a watch from the last resourceVersion value returned by the server and not miss any modifications.(except for the value of continue) and the server may reject a continue value it does not recognize. If the specified continue value is no longer valid whether due to expiration (generally five to fifteen minutes) or a configuration change on the server, the server will respond with a 410 ResourceExpired error together with a continue token. If the client needs a consistent list, it must restart their list without the continue field. Otherwise, the client may send another list request with the token received with the 410 error, the server will respond with a list starting from the next key, but from the latest snapshot, which is inconsistent from the previous list results - objects that are created, modified, or deleted after the first list request will be included in the response, as long as their keys are after the \"next key\".  This field is not supported when watch is true. Clients may start a watch from the last resourceVersion value returned by the server and not miss any modifications.
    String dryRun = "dryRun_example"; // String | 如果存在,则表示不应保留修改。无效或无法识别的dryRun指令将导致错误响应,并且不会进一步处理请求。有效值为:-全部:将处理所有干运行阶段。When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed
    String fieldSelector = "fieldSelector_example"; // String | 一个选择器,用于按字段限制返回对象的列表。默认为一切。A selector to restrict the list of returned objects by their fields. Defaults to everything.
    Integer gracePeriodSeconds = 56; // Integer | 删除对象前的持续时间(秒)。值必须是非负整数。值为零表示立即删除。如果此值为nil,则将使用指定类型的默认宽限期。如果未指定,则默认为每对象值。零表示立即删除。The duration in seconds before the object should be deleted. Value must be non-negative integer. The value zero indicates delete immediately. If this value is nil, the default grace period for the specified type will be used. Defaults to a per object value if not specified. zero means delete immediately.
    String labelSelector = "labelSelector_example"; // String | 一个选择器,用于根据返回对象的标签限制其列表。默认为一切。A selector to restrict the list of returned objects by their labels. Defaults to everything.
    Integer limit = 56; // Integer | limit是列表调用返回的最大响应数。如果存在更多项,服务器会将列表元数据上的“continue”字段设置为一个值,该值可用于同一初始查询,以检索下一组结果。如果所有请求的对象都被过滤掉,设置限制可能会返回少于请求数量的项目(最多为零个项目),客户端应该只使用continue字段来确定是否有更多结果可用。服务器可能会选择不支持limit参数,并将返回所有可用的结果。如果指定了limit且continue字段为空,则客户端可能会认为没有更多结果可用。如果watch为true,则不支持此字段。服务器保证在使用continue时返回的对象将与无限制地发出单个列表调用相同——也就是说,在发出第一个请求后创建、修改或删除的对象不会包含在任何后续的continue请求中。这有时被称为一致性快照,可以确保使用limit接收非常大结果的较小数据块的客户端可以确保看到所有可能的对象。如果在分块列表期间更新对象,则返回在计算第一个列表结果时存在的对象版本。limit is a maximum number of responses to return for a list call. If more items exist, the server will set the `continue` field on the list metadata to a value that can be used with the same initial query to retrieve the next set of results. Setting a limit may return fewer than the requested amount of items (up to zero items) in the event all requested objects are filtered out and clients should only use the presence of the continue field to determine whether more results are available. Servers may choose not to support the limit argument and will return all of the available results. If limit is specified and the continue field is empty, clients may assume that no more results are available. This field is not supported if watch is true.  The server guarantees that the objects returned when using continue will be identical to issuing a single list call without a limit - that is, no objects created, modified, or deleted after the first request is issued will be included in any subsequent continued requests. This is sometimes referred to as a consistent snapshot, and ensures that a client that is using limit to receive smaller chunks of a very large result can ensure they see all possible objects. If objects are updated during a chunked list the version of the object that was present at the time the first list result was calculated is returned.
    Boolean orphanDependents = true; // Boolean | 已弃用:请使用PropagationPolicy,此字段将在1.7中弃用。从属对象应该是孤立的吗。如果为真/假,“孤立”终结器将被添加到对象的终结器列表中或从中删除。可以设置此字段或PropagationPolicy,但不能同时设置两者。Deprecated: please use the PropagationPolicy, this field will be deprecated in 1.7. Should the dependent objects be orphaned. If true/false, the \"orphan\" finalizer will be added to/removed from the object's finalizers list. Either this field or PropagationPolicy may be set, but not both.
    String propagationPolicy = "propagationPolicy_example"; // String | 是否以及如何执行垃圾收集。可以设置此字段或孤立从属项,但不能同时设置两者。默认策略由元数据中设置的现有终结器决定。终结器和特定于资源的默认策略。Whether and how garbage collection will be performed. Either this field or OrphanDependents may be set, but not both. The default policy is decided by the existing finalizer set in the metadata.finalizers and the resource-specific default policy. Acceptable values are: 'Orphan' - orphan the dependents; 'Background' - allow the garbage collector to delete the dependents in the background; 'Foreground' - a cascading policy that deletes all dependents in the foreground.
    String resourceVersion = "resourceVersion_example"; // String | 当通过监视调用指定时,显示在资源的特定版本之后发生的更改。默认为历史开始时的更改。为列表指定时:-如果未设置,则根据仲裁读取标志从远程存储返回结果;-如果是0,那么我们只返回当前缓存中的内容,不保证;-如果设置为非零,则结果至少与给定值一样新鲜When specified with a watch call, shows changes that occur after that particular version of a resource. Defaults to changes from the beginning of history. When specified for list: - if unset, then the result is returned from remote storage based on quorum-read flag; - if it's 0, then we simply return what we currently have in cache, no guarantee; - if set to non zero, then the result is at least as fresh as given rv.
    Integer timeoutSeconds = 56; // Integer | 列表/监视呼叫超时。这会限制通话的持续时间,而不管通话是否处于活动状态。列表/监视呼叫超时。这会限制通话的持续时间,而不管通话是否处于活动状态。Timeout for the list/watch call. This limits the duration of the call, regardless of any activity or inactivity.
    V1DeleteOptions body = new V1DeleteOptions(); // V1DeleteOptions | 
    try {
      V1Status result = apiInstance.deleteCollectionNamespacedPod(namespace, pretty, _continue, dryRun, fieldSelector, gracePeriodSeconds, labelSelector, limit, orphanDependents, propagationPolicy, resourceVersion, timeoutSeconds, body);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling CoreV1Api#deleteCollectionNamespacedPod");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
namespace String 对象名称和身份验证范围,例如团队和项目。object name and auth scope, such as for teams and projects
pretty String 如果为“true”,则输出相当打印。If 'true', then the output is pretty printed. [optional]
_continue String 从服务器检索更多结果时,应设置“继续”选项。由于此值是服务器定义的,因此客户端只能使用具有相同查询参数(continue值除外)的上一个查询结果中的continue值,服务器可能会拒绝它无法识别的continue值。如果指定的continue值因过期(通常为5到15分钟)或服务器上的配置更改而不再有效,服务器将响应410 ResourceExpired错误和continue令牌。如果客户端需要一个一致的列表,它必须在不使用continue字段的情况下重新启动它们的列表。从另一台服务器发送的结果可能与前一台服务器发送的结果不一致,但从下一台服务器发送的结果可能与前一台服务器发送的结果不一致,只要他们的钥匙在“下一个钥匙”之后。watch为true时不支持此字段。客户端可以从服务器返回的最后一个resourceVersion值开始监视,并且不会错过任何修改。The continue option should be set when retrieving more results from the server. Since this value is server defined, clients may only use the continue value from a previous query result with identical query parameters (except for the value of continue) and the server may reject a continue value it does not recognize. If the specified continue value is no longer valid whether due to expiration (generally five to fifteen minutes) or a configuration change on the server, the server will respond with a 410 ResourceExpired error together with a continue token. If the client needs a consistent list, it must restart their list without the continue field. Otherwise, the client may send another list request with the token received with the 410 error, the server will respond with a list starting from the next key, but from the latest snapshot, which is inconsistent from the previous list results - objects that are created, modified, or deleted after the first list request will be included in the response, as long as their keys are after the "next key". This field is not supported when watch is true. Clients may start a watch from the last resourceVersion value returned by the server and not miss any modifications.(except for the value of continue) and the server may reject a continue value it does not recognize. If the specified continue value is no longer valid whether due to expiration (generally five to fifteen minutes) or a configuration change on the server, the server will respond with a 410 ResourceExpired error together with a continue token. If the client needs a consistent list, it must restart their list without the continue field. Otherwise, the client may send another list request with the token received with the 410 error, the server will respond with a list starting from the next key, but from the latest snapshot, which is inconsistent from the previous list results - objects that are created, modified, or deleted after the first list request will be included in the response, as long as their keys are after the "next key". This field is not supported when watch is true. Clients may start a watch from the last resourceVersion value returned by the server and not miss any modifications. [optional]
dryRun String 如果存在,则表示不应保留修改。无效或无法识别的dryRun指令将导致错误响应,并且不会进一步处理请求。有效值为:-全部:将处理所有干运行阶段。When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed [optional]
fieldSelector String 一个选择器,用于按字段限制返回对象的列表。默认为一切。A selector to restrict the list of returned objects by their fields. Defaults to everything. [optional]
gracePeriodSeconds Integer 删除对象前的持续时间(秒)。值必须是非负整数。值为零表示立即删除。如果此值为nil,则将使用指定类型的默认宽限期。如果未指定,则默认为每对象值。零表示立即删除。The duration in seconds before the object should be deleted. Value must be non-negative integer. The value zero indicates delete immediately. If this value is nil, the default grace period for the specified type will be used. Defaults to a per object value if not specified. zero means delete immediately. [optional]
labelSelector String 一个选择器,用于根据返回对象的标签限制其列表。默认为一切。A selector to restrict the list of returned objects by their labels. Defaults to everything. [optional]
limit Integer limit是列表调用返回的最大响应数。如果存在更多项目,服务器将设置`继续`字段的值,该值可用于同一初始查询以检索下一组结果。如果所有请求的对象都被过滤掉,设置限制可能会返回少于请求数量的项目(最多为零个项目),客户端应该只使用continue字段来确定是否有更多结果可用。服务器可能会选择不支持limit参数,并将返回所有可用的结果。如果指定了limit且continue字段为空,则客户端可能会认为没有更多结果可用。如果watch为true,则不支持此字段。服务器保证在使用continue时返回的对象将与无限制地发出单个列表调用相同——也就是说,在发出第一个请求后创建、修改或删除的对象不会包含在任何后续的continue请求中。这有时被称为一致性快照,可以确保使用limit接收非常大结果的较小数据块的客户端可以确保看到所有可能的对象。如果在分块列表期间更新对象,则返回在计算第一个列表结果时存在的对象版本。 limit is a maximum number of responses to return for a list call. If more items exist, the server will set the `continue` field on the list metadata to a value that can be used with the same initial query to retrieve the next set of results. Setting a limit may return fewer than the requested amount of items (up to zero items) in the event all requested objects are filtered out and clients should only use the presence of the continue field to determine whether more results are available. Servers may choose not to support the limit argument and will return all of the available results. If limit is specified and the continue field is empty, clients may assume that no more results are available. This field is not supported if watch is true. The server guarantees that the objects returned when using continue will be identical to issuing a single list call without a limit - that is, no objects created, modified, or deleted after the first request is issued will be included in any subsequent continued requests. This is sometimes referred to as a consistent snapshot, and ensures that a client that is using limit to receive smaller chunks of a very large result can ensure they see all possible objects. If objects are updated during a chunked list the version of the object that was present at the time the first list result was calculated is returned. [optional]
orphanDependents Boolean 已弃用:请使用PropagationPolicy,此字段将在1.7中弃用。从属对象应该是孤立的吗。如果为真/假,“孤立”终结器将被添加到对象的终结器列表中或从中删除。可以设置此字段或PropagationPolicy,但不能同时设置两者。Deprecated: please use the PropagationPolicy, this field will be deprecated in 1.7. Should the dependent objects be orphaned. If true/false, the "orphan" finalizer will be added to/removed from the object's finalizers list. Either this field or PropagationPolicy may be set, but not both. [optional]
propagationPolicy String 是否以及如何执行垃圾收集。可以设置此字段或孤立从属项,但不能同时设置两者。默认策略由元数据中设置的现有终结器决定。终结器和特定于资源的默认策略。Whether and how garbage collection will be performed. Either this field or OrphanDependents may be set, but not both. The default policy is decided by the existing finalizer set in the metadata.finalizers and the resource-specific default policy. Acceptable values are: 'Orphan' - orphan the dependents; 'Background' - allow the garbage collector to delete the dependents in the background; 'Foreground' - a cascading policy that deletes all dependents in the foreground. [optional]
resourceVersion String 当通过监视调用指定时,显示在资源的特定版本之后发生的更改。默认为历史开始时的更改。为列表指定时:-如果未设置,则根据仲裁读取标志从远程存储返回结果;-如果是's 0,然后我们只返回当前缓存中的内容,不保证;-如果设置为非零,则结果至少与给定值一样新鲜。When specified with a watch call, shows changes that occur after that particular version of a resource. Defaults to changes from the beginning of history. When specified for list: - if unset, then the result is returned from remote storage based on quorum-read flag; - if it's 0, then we simply return what we currently have in cache, no guarantee; - if set to non zero, then the result is at least as fresh as given rv. [optional]
timeoutSeconds Integer 列表/监视呼叫超时。这会限制通话的持续时间,而不管通话是否处于活动状态。列表/监视呼叫超时。这会限制通话的持续时间,而不管通话是否处于活动状态。Timeout for the list/watch call. This limits the duration of the call, regardless of any activity or inactivity. [optional]
body V1DeleteOptions [optional]

Return type

V1Status

Authorization

BearerToken

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json, application/yaml, application/vnd.kubernetes.protobuf

HTTP response details

Status code Description Response headers
200 OK -
401 Unauthorized -

deleteNamespacedPod


回到“Pod增删查改”目录

V1Pod deleteNamespacedPod(name, namespace, pretty, dryRun, gracePeriodSeconds, orphanDependents, propagationPolicy, body)

delete a Pod

Example

// Import classes:
import io.kubernetes.client.openapi.ApiClient;
import io.kubernetes.client.openapi.ApiException;
import io.kubernetes.client.openapi.Configuration;
import io.kubernetes.client.openapi.auth.*;
import io.kubernetes.client.openapi.models.*;
import io.kubernetes.client.openapi.apis.CoreV1Api;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("http://localhost");
    
    // Configure API key authorization: BearerToken
    ApiKeyAuth BearerToken = (ApiKeyAuth) defaultClient.getAuthentication("BearerToken");
    BearerToken.setApiKey("YOUR API KEY");
    // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
    //BearerToken.setApiKeyPrefix("Token");

    CoreV1Api apiInstance = new CoreV1Api(defaultClient);
    String name = "name_example"; // String | name of the Pod
    String namespace = "namespace_example"; // String | 对象名称和身份验证范围,例如团队和项目。object name and auth scope, such as for teams and projects
    String pretty = "pretty_example"; // String | 如果为“true”,则输出相当打印。If 'true', then the output is pretty printed.
    String dryRun = "dryRun_example"; // String | 如果存在,则表示不应保留修改。无效或无法识别的dryRun指令将导致错误响应,并且不会进一步处理请求。有效值为:-全部:将处理所有干运行阶段。When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed
    Integer gracePeriodSeconds = 56; // Integer | 删除对象前的持续时间(秒)。值必须是非负整数。值为零表示立即删除。如果此值为nil,则将使用指定类型的默认宽限期。如果未指定,则默认为每对象值。零表示立即删除。The duration in seconds before the object should be deleted. Value must be non-negative integer. The value zero indicates delete immediately. If this value is nil, the default grace period for the specified type will be used. Defaults to a per object value if not specified. zero means delete immediately.
    Boolean orphanDependents = true; // Boolean | 已弃用:请使用PropagationPolicy,此字段将在1.7中弃用。从属对象应该是孤立的吗。如果为真/假,“孤立”终结器将被添加到对象的终结器列表中或从中删除。可以设置此字段或PropagationPolicy,但不能同时设置两者。Deprecated: please use the PropagationPolicy, this field will be deprecated in 1.7. Should the dependent objects be orphaned. If true/false, the \"orphan\" finalizer will be added to/removed from the object's finalizers list. Either this field or PropagationPolicy may be set, but not both.
    String propagationPolicy = "propagationPolicy_example"; // String | 是否以及如何执行垃圾收集。可以设置此字段或孤立从属项,但不能同时设置两者。默认策略由元数据中设置的现有终结器决定。终结器和特定于资源的默认策略。Whether and how garbage collection will be performed. Either this field or OrphanDependents may be set, but not both. The default policy is decided by the existing finalizer set in the metadata.finalizers and the resource-specific default policy. Acceptable values are: 'Orphan' - orphan the dependents; 'Background' - allow the garbage collector to delete the dependents in the background; 'Foreground' - a cascading policy that deletes all dependents in the foreground.
    V1DeleteOptions body = new V1DeleteOptions(); // V1DeleteOptions | 
    try {
      V1Pod result = apiInstance.deleteNamespacedPod(name, namespace, pretty, dryRun, gracePeriodSeconds, orphanDependents, propagationPolicy, body);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling CoreV1Api#deleteNamespacedPod");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
name String name of the Pod
namespace String 对象名称和身份验证范围,例如团队和项目。object name and auth scope, such as for teams and projects
pretty String 如果为“true”,则输出相当打印。If 'true', then the output is pretty printed. [optional]
dryRun String 如果存在,则表示不应保留修改。无效或无法识别的dryRun指令将导致错误响应,并且不会进一步处理请求。有效值为:-全部:将处理所有干运行阶段。When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed [optional]
gracePeriodSeconds Integer 删除对象前的持续时间(秒)。值必须是非负整数。值为零表示立即删除。如果此值为nil,则将使用指定类型的默认宽限期。如果未指定,则默认为每对象值。零表示立即删除。The duration in seconds before the object should be deleted. Value must be non-negative integer. The value zero indicates delete immediately. If this value is nil, the default grace period for the specified type will be used. Defaults to a per object value if not specified. zero means delete immediately. [optional]
orphanDependents Boolean 已弃用:请使用PropagationPolicy,此字段将在1.7中弃用。从属对象应该是孤立的吗。如果为真/假,“孤立”终结器将被添加到对象的终结器列表中或从中删除。可以设置此字段或PropagationPolicy,但不能同时设置两者。Deprecated: please use the PropagationPolicy, this field will be deprecated in 1.7. Should the dependent objects be orphaned. If true/false, the "orphan" finalizer will be added to/removed from the object's finalizers list. Either this field or PropagationPolicy may be set, but not both. [optional]
propagationPolicy String 是否以及如何执行垃圾收集。可以设置此字段或孤立从属项,但不能同时设置两者。默认策略由元数据中设置的现有终结器决定。终结器和特定于资源的默认策略。Whether and how garbage collection will be performed. Either this field or OrphanDependents may be set, but not both. The default policy is decided by the existing finalizer set in the metadata.finalizers and the resource-specific default policy. Acceptable values are: 'Orphan' - orphan the dependents; 'Background' - allow the garbage collector to delete the dependents in the background; 'Foreground' - a cascading policy that deletes all dependents in the foreground. [optional]
body V1DeleteOptions [optional]

Return type

V1Pod

Authorization

BearerToken

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json, application/yaml, application/vnd.kubernetes.protobuf

HTTP response details

Status code Description Response headers
200 OK -
202 Accepted -
401 Unauthorized -

listNamespacedPod


回到“Pod增删查改”目录

V1PodList listNamespacedPod(namespace, pretty, allowWatchBookmarks, _continue, fieldSelector, labelSelector, limit, resourceVersion, timeoutSeconds, watch)

list or watch objects of kind Pod

Example

// Import classes:
import io.kubernetes.client.openapi.ApiClient;
import io.kubernetes.client.openapi.ApiException;
import io.kubernetes.client.openapi.Configuration;
import io.kubernetes.client.openapi.auth.*;
import io.kubernetes.client.openapi.models.*;
import io.kubernetes.client.openapi.apis.CoreV1Api;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("http://localhost");
    
    // Configure API key authorization: BearerToken
    ApiKeyAuth BearerToken = (ApiKeyAuth) defaultClient.getAuthentication("BearerToken");
    BearerToken.setApiKey("YOUR API KEY");
    // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
    //BearerToken.setApiKeyPrefix("Token");

    CoreV1Api apiInstance = new CoreV1Api(defaultClient);
    String namespace = "namespace_example"; // String | 对象名称和身份验证范围,例如团队和项目。object name and auth scope, such as for teams and projects
    String pretty = "pretty_example"; // String | 如果为“true”,则输出相当打印。If 'true', then the output is pretty printed.
    Boolean allowWatchBookmarks = true; // Boolean | allowWatchBookmarks请求观看类型为“的事件;书签"。未实现书签的服务器可能会忽略此标志,书签会在服务器上发送'这是自由裁量权。客户端不应假定书签是在任何特定的时间间隔返回的,也不应假定服务器将在会话期间发送任何书签事件。如果这不是手表,则忽略此字段。如果apiserver中未启用功能gate WatchBookmarks,则忽略此字段。allowWatchBookmarks requests watch events with type \"BOOKMARK\". Servers that do not implement bookmarks may ignore this flag and bookmarks are sent at the server's discretion. Clients should not assume bookmarks are returned at any specific interval, nor may they assume the server will send any BOOKMARK event during a session. If this is not a watch, this field is ignored. If the feature gate WatchBookmarks is not enabled in apiserver, this field is ignored.
    String _continue = "_continue_example"; // String | 从服务器检索更多结果时,应设置“继续”选项。由于此值是服务器定义的,因此客户端只能使用具有相同查询参数(continue值除外)的上一个查询结果中的continue值,服务器可能会拒绝它无法识别的continue值。如果指定的continue值因过期(通常为5到15分钟)或服务器上的配置更改而不再有效,服务器将响应410 ResourceExpired错误和continue令牌。如果客户端需要一个一致的列表,它必须在不使用continue字段的情况下重新启动它们的列表。从另一台服务器发送的结果可能与前一台服务器发送的结果不一致,但从下一台服务器发送的结果可能与前一台服务器发送的结果不一致,只要他们的钥匙在“下一个钥匙”之后。watch为true时不支持此字段。客户端可以从服务器返回的最后一个resourceVersion值开始监视,并且不会错过任何修改。The continue option should be set when retrieving more results from the server. Since this value is server defined, clients may only use the continue value from a previous query result with identical query parameters (except for the value of continue) and the server may reject a continue value it does not recognize. If the specified continue value is no longer valid whether due to expiration (generally five to fifteen minutes) or a configuration change on the server, the server will respond with a 410 ResourceExpired error together with a continue token. If the client needs a consistent list, it must restart their list without the continue field. Otherwise, the client may send another list request with the token received with the 410 error, the server will respond with a list starting from the next key, but from the latest snapshot, which is inconsistent from the previous list results - objects that are created, modified, or deleted after the first list request will be included in the response, as long as their keys are after the "next key".  This field is not supported when watch is true. Clients may start a watch from the last resourceVersion value returned by the server and not miss any modifications.(except for the value of continue) and the server may reject a continue value it does not recognize. If the specified continue value is no longer valid whether due to expiration (generally five to fifteen minutes) or a configuration change on the server, the server will respond with a 410 ResourceExpired error together with a continue token. If the client needs a consistent list, it must restart their list without the continue field. Otherwise, the client may send another list request with the token received with the 410 error, the server will respond with a list starting from the next key, but from the latest snapshot, which is inconsistent from the previous list results - objects that are created, modified, or deleted after the first list request will be included in the response, as long as their keys are after the \"next key\".  This field is not supported when watch is true. Clients may start a watch from the last resourceVersion value returned by the server and not miss any modifications.
    String fieldSelector = "fieldSelector_example"; // String | 一个选择器,用于按字段限制返回对象的列表。默认为一切。A selector to restrict the list of returned objects by their fields. Defaults to everything.
    String labelSelector = "labelSelector_example"; // String | 一个选择器,用于根据返回对象的标签限制其列表。默认为一切。A selector to restrict the list of returned objects by their labels. Defaults to everything.
    Integer limit = 56; // Integer | limit是列表调用返回的最大响应数。如果存在更多项,服务器会将列表元数据上的“continue”字段设置为一个值,该值可用于同一初始查询,以检索下一组结果。如果所有请求的对象都被过滤掉,设置限制可能会返回少于请求数量的项目(最多为零个项目),客户端应该只使用continue字段来确定是否有更多结果可用。服务器可能会选择不支持limit参数,并将返回所有可用的结果。如果指定了limit且continue字段为空,则客户端可能会认为没有更多结果可用。如果watch为true,则不支持此字段。服务器保证在使用continue时返回的对象将与无限制地发出单个列表调用相同——也就是说,在发出第一个请求后创建、修改或删除的对象不会包含在任何后续的continue请求中。这有时被称为一致性快照,可以确保使用limit接收非常大结果的较小数据块的客户端可以确保看到所有可能的对象。如果在分块列表期间更新对象,则返回在计算第一个列表结果时存在的对象版本。limit is a maximum number of responses to return for a list call. If more items exist, the server will set the `continue` field on the list metadata to a value that can be used with the same initial query to retrieve the next set of results. Setting a limit may return fewer than the requested amount of items (up to zero items) in the event all requested objects are filtered out and clients should only use the presence of the continue field to determine whether more results are available. Servers may choose not to support the limit argument and will return all of the available results. If limit is specified and the continue field is empty, clients may assume that no more results are available. This field is not supported if watch is true.  The server guarantees that the objects returned when using continue will be identical to issuing a single list call without a limit - that is, no objects created, modified, or deleted after the first request is issued will be included in any subsequent continued requests. This is sometimes referred to as a consistent snapshot, and ensures that a client that is using limit to receive smaller chunks of a very large result can ensure they see all possible objects. If objects are updated during a chunked list the version of the object that was present at the time the first list result was calculated is returned.
    String resourceVersion = "resourceVersion_example"; // String | 当通过监视调用指定时,显示在资源的特定版本之后发生的更改。默认为历史开始时的更改。为列表指定时:-如果未设置,则根据仲裁读取标志从远程存储返回结果;-如果是0,那么我们只返回当前缓存中的内容,不保证;-如果设置为非零,则结果至少与给定值一样新鲜When specified with a watch call, shows changes that occur after that particular version of a resource. Defaults to changes from the beginning of history. When specified for list: - if unset, then the result is returned from remote storage based on quorum-read flag; - if it's 0, then we simply return what we currently have in cache, no guarantee; - if set to non zero, then the result is at least as fresh as given rv.
    Integer timeoutSeconds = 56; // Integer | 列表/监视呼叫超时。这会限制通话的持续时间,而不管通话是否处于活动状态。列表/监视呼叫超时。这会限制通话的持续时间,而不管通话是否处于活动状态。Timeout for the list/watch call. This limits the duration of the call, regardless of any activity or inactivity.
    Boolean watch = true; // Boolean | 观察对所描述资源的更改,并将其作为添加、更新和删除通知流返回。指定resourceVersion。观察对所描述资源的更改,并将其作为添加、更新和删除通知流返回。Watch for changes to the described resources and return them as a stream of add, update, and remove notifications. Specify resourceVersion.
    try {
      V1PodList result = apiInstance.listNamespacedPod(namespace, pretty, allowWatchBookmarks, _continue, fieldSelector, labelSelector, limit, resourceVersion, timeoutSeconds, watch);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling CoreV1Api#listNamespacedPod");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
namespace String 对象名称和身份验证范围,例如团队和项目。object name and auth scope, such as for teams and projects
pretty String 如果为“true”,则输出相当打印。If 'true', then the output is pretty printed. [optional]
allowWatchBookmarks Boolean allowWatchBookmarks请求观看类型为“的事件;书签"。未实现书签的服务器可能会忽略此标志,书签会在服务器上发送'这是自由裁量权。客户端不应假定书签是在任何特定的时间间隔返回的,也不应假定服务器将在会话期间发送任何书签事件。如果这不是手表,则忽略此字段。如果apiserver中未启用功能gate WatchBookmarks,则忽略此字段。allowWatchBookmarks requests watch events with type "BOOKMARK". Servers that do not implement bookmarks may ignore this flag and bookmarks are sent at the server's discretion. Clients should not assume bookmarks are returned at any specific interval, nor may they assume the server will send any BOOKMARK event during a session. If this is not a watch, this field is ignored. If the feature gate WatchBookmarks is not enabled in apiserver, this field is ignored. [optional]
_continue String 从服务器检索更多结果时,应设置“继续”选项。由于此值是服务器定义的,因此客户端只能使用具有相同查询参数(continue值除外)的上一个查询结果中的continue值,服务器可能会拒绝它无法识别的continue值。如果指定的continue值因过期(通常为5到15分钟)或服务器上的配置更改而不再有效,服务器将响应410 ResourceExpired错误和continue令牌。如果客户端需要一个一致的列表,它必须在不使用continue字段的情况下重新启动它们的列表。从另一台服务器发送的结果可能与前一台服务器发送的结果不一致,但从下一台服务器发送的结果可能与前一台服务器发送的结果不一致,只要他们的钥匙在“下一个钥匙”之后。watch为true时不支持此字段。客户端可以从服务器返回的最后一个resourceVersion值开始监视,并且不会错过任何修改。The continue option should be set when retrieving more results from the server. Since this value is server defined, clients may only use the continue value from a previous query result with identical query parameters (except for the value of continue) and the server may reject a continue value it does not recognize. If the specified continue value is no longer valid whether due to expiration (generally five to fifteen minutes) or a configuration change on the server, the server will respond with a 410 ResourceExpired error together with a continue token. If the client needs a consistent list, it must restart their list without the continue field. Otherwise, the client may send another list request with the token received with the 410 error, the server will respond with a list starting from the next key, but from the latest snapshot, which is inconsistent from the previous list results - objects that are created, modified, or deleted after the first list request will be included in the response, as long as their keys are after the "next key". This field is not supported when watch is true. Clients may start a watch from the last resourceVersion value returned by the server and not miss any modifications.(except for the value of continue) and the server may reject a continue value it does not recognize. If the specified continue value is no longer valid whether due to expiration (generally five to fifteen minutes) or a configuration change on the server, the server will respond with a 410 ResourceExpired error together with a continue token. If the client needs a consistent list, it must restart their list without the continue field. Otherwise, the client may send another list request with the token received with the 410 error, the server will respond with a list starting from the next key, but from the latest snapshot, which is inconsistent from the previous list results - objects that are created, modified, or deleted after the first list request will be included in the response, as long as their keys are after the "next key". This field is not supported when watch is true. Clients may start a watch from the last resourceVersion value returned by the server and not miss any modifications. [optional]
fieldSelector String 一个选择器,用于按字段限制返回对象的列表。默认为一切。A selector to restrict the list of returned objects by their fields. Defaults to everything. [optional]
labelSelector String 一个选择器,用于根据返回对象的标签限制其列表。默认为一切。A selector to restrict the list of returned objects by their labels. Defaults to everything. [optional]
limit Integer limit是列表调用返回的最大响应数。如果存在更多项目,服务器将设置`继续`字段的值,该值可用于同一初始查询以检索下一组结果。如果所有请求的对象都被过滤掉,设置限制可能会返回少于请求数量的项目(最多为零个项目),客户端应该只使用continue字段来确定是否有更多结果可用。服务器可能会选择不支持limit参数,并将返回所有可用的结果。如果指定了limit且continue字段为空,则客户端可能会认为没有更多结果可用。如果watch为true,则不支持此字段。服务器保证在使用continue时返回的对象将与无限制地发出单个列表调用相同——也就是说,在发出第一个请求后创建、修改或删除的对象不会包含在任何后续的continue请求中。这有时被称为一致性快照,可以确保使用limit接收非常大结果的较小数据块的客户端可以确保看到所有可能的对象。如果在分块列表期间更新对象,则返回在计算第一个列表结果时存在的对象版本。 limit is a maximum number of responses to return for a list call. If more items exist, the server will set the `continue` field on the list metadata to a value that can be used with the same initial query to retrieve the next set of results. Setting a limit may return fewer than the requested amount of items (up to zero items) in the event all requested objects are filtered out and clients should only use the presence of the continue field to determine whether more results are available. Servers may choose not to support the limit argument and will return all of the available results. If limit is specified and the continue field is empty, clients may assume that no more results are available. This field is not supported if watch is true. The server guarantees that the objects returned when using continue will be identical to issuing a single list call without a limit - that is, no objects created, modified, or deleted after the first request is issued will be included in any subsequent continued requests. This is sometimes referred to as a consistent snapshot, and ensures that a client that is using limit to receive smaller chunks of a very large result can ensure they see all possible objects. If objects are updated during a chunked list the version of the object that was present at the time the first list result was calculated is returned. [optional]
resourceVersion String 当通过监视调用指定时,显示在资源的特定版本之后发生的更改。默认为历史开始时的更改。为列表指定时:-如果未设置,则根据仲裁读取标志从远程存储返回结果;-如果是's 0,然后我们只返回当前缓存中的内容,不保证;-如果设置为非零,则结果至少与给定值一样新鲜。When specified with a watch call, shows changes that occur after that particular version of a resource. Defaults to changes from the beginning of history. When specified for list: - if unset, then the result is returned from remote storage based on quorum-read flag; - if it's 0, then we simply return what we currently have in cache, no guarantee; - if set to non zero, then the result is at least as fresh as given rv. [optional]
timeoutSeconds Integer 列表/监视呼叫超时。这会限制通话的持续时间,而不管通话是否处于活动状态。列表/监视呼叫超时。这会限制通话的持续时间,而不管通话是否处于活动状态。Timeout for the list/watch call. This limits the duration of the call, regardless of any activity or inactivity. [optional]
watch Boolean 观察对所描述资源的更改,并将其作为添加、更新和删除通知流返回。指定resourceVersion。观察对所描述资源的更改,并将其作为添加、更新和删除通知流返回。Watch for changes to the described resources and return them as a stream of add, update, and remove notifications. Specify resourceVersion. [optional]

Return type

V1PodList

Authorization

BearerToken

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json, application/yaml, application/vnd.kubernetes.protobuf, application/json;stream=watch, application/vnd.kubernetes.protobuf;stream=watch

HTTP response details

Status code Description Response headers
200 OK -
401 Unauthorized -

patchNamespacedPod


回到“Pod增删查改”目录

V1Pod patchNamespacedPod(name, namespace, body, pretty, dryRun, fieldManager, force)

partially update the specified Pod

Example

// Import classes:
import io.kubernetes.client.openapi.ApiClient;
import io.kubernetes.client.openapi.ApiException;
import io.kubernetes.client.openapi.Configuration;
import io.kubernetes.client.openapi.auth.*;
import io.kubernetes.client.openapi.models.*;
import io.kubernetes.client.openapi.apis.CoreV1Api;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("http://localhost");
    
    // Configure API key authorization: BearerToken
    ApiKeyAuth BearerToken = (ApiKeyAuth) defaultClient.getAuthentication("BearerToken");
    BearerToken.setApiKey("YOUR API KEY");
    // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
    //BearerToken.setApiKeyPrefix("Token");

    CoreV1Api apiInstance = new CoreV1Api(defaultClient);
    String name = "name_example"; // String | name of the Pod
    String namespace = "namespace_example"; // String | 对象名称和身份验证范围,例如团队和项目。object name and auth scope, such as for teams and projects
    V1Patch body = new V1Patch(); // V1Patch | 
    String pretty = "pretty_example"; // String | 如果为“true”,则输出相当打印。If 'true', then the output is pretty printed.
    String dryRun = "dryRun_example"; // String | 如果存在,则表示不应保留修改。无效或无法识别的dryRun指令将导致错误响应,并且不会进一步处理请求。有效值为:-全部:将处理所有干运行阶段。When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed
    String fieldManager = "fieldManager_example"; // String |  fieldManager是与进行这些更改的参与者或实体关联的名称。该值的长度必须小于或128个字符,并且仅包含可打印字符,如https://golang.org/pkg/unicode/#IsPrint.fieldManager is a name associated with the actor or entity that is making these changes. The value must be less than or 128 characters long, and only contain printable characters, as defined by https://golang.org/pkg/unicode/#IsPrint. This field is required for apply requests (application/apply-patch) but optional for non-apply patch types (JsonPatch, MergePatch, StrategicMergePatch).
    Boolean force = true; // Boolean | Force将“强制”应用请求。这意味着用户将重新获取其他人拥有的冲突字段。对于非应用补丁请求,必须取消设置强制标志。Force is going to \"force\" Apply requests. It means user will re-acquire conflicting fields owned by other people. Force flag must be unset for non-apply patch requests.
    try {
      V1Pod result = apiInstance.patchNamespacedPod(name, namespace, body, pretty, dryRun, fieldManager, force);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling CoreV1Api#patchNamespacedPod");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
name String name of the Pod
namespace String 对象名称和身份验证范围,例如团队和项目。object name and auth scope, such as for teams and projects
body V1Patch
pretty String 如果为“true”,则输出相当打印。If 'true', then the output is pretty printed. [optional]
dryRun String 如果存在,则表示不应保留修改。无效或无法识别的dryRun指令将导致错误响应,并且不会进一步处理请求。有效值为:-全部:将处理所有干运行阶段。When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed [optional]
fieldManager String fieldManager是与进行这些更改的参与者或实体关联的名称。该值的长度必须小于或128个字符,并且仅包含可打印字符,如https://golang.org/pkg/unicode/#IsPrint.fieldManager is a name associated with the actor or entity that is making these changes. The value must be less than or 128 characters long, and only contain printable characters, as defined by https://golang.org/pkg/unicode/#IsPrint. This field is required for apply requests (application/apply-patch) but optional for non-apply patch types (JsonPatch, MergePatch, StrategicMergePatch). [optional]
force Boolean Force将“强制”应用请求。这意味着用户将重新获取其他人拥有的冲突字段。对于非应用补丁请求,必须取消设置强制标志。Force is going to "force" Apply requests. It means user will re-acquire conflicting fields owned by other people. Force flag must be unset for non-apply patch requests. [optional]

Return type

V1Pod

Authorization

BearerToken

HTTP request headers

  • Content-Type: application/json-patch+json, application/merge-patch+json, application/strategic-merge-patch+json, application/apply-patch+yaml
  • Accept: application/json, application/yaml, application/vnd.kubernetes.protobuf

HTTP response details

Status code Description Response headers
200 OK -
401 Unauthorized -

readNamespacedPod


回到“Pod增删查改”目录

V1Pod readNamespacedPod(name, namespace, pretty, exact, export)

read the specified Pod

Example

// Import classes:
import io.kubernetes.client.openapi.ApiClient;
import io.kubernetes.client.openapi.ApiException;
import io.kubernetes.client.openapi.Configuration;
import io.kubernetes.client.openapi.auth.*;
import io.kubernetes.client.openapi.models.*;
import io.kubernetes.client.openapi.apis.CoreV1Api;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("http://localhost");
    
    // Configure API key authorization: BearerToken
    ApiKeyAuth BearerToken = (ApiKeyAuth) defaultClient.getAuthentication("BearerToken");
    BearerToken.setApiKey("YOUR API KEY");
    // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
    //BearerToken.setApiKeyPrefix("Token");

    CoreV1Api apiInstance = new CoreV1Api(defaultClient);
    String name = "name_example"; // String | name of the Pod
    String namespace = "namespace_example"; // String | 对象名称和身份验证范围,例如团队和项目。object name and auth scope, such as for teams and projects
    String pretty = "pretty_example"; // String | 如果为“true”,则输出相当打印。If 'true', then the output is pretty printed.
    Boolean exact = true; // Boolean | 出口应该是准确的。Exact export维护特定于集群的字段,如“Namespace”。不赞成。计划于1.18年拆除。Should the export be exact.  Exact export maintains cluster-specific fields like 'Namespace'. Deprecated. Planned for removal in 1.18.
    Boolean export = true; // Boolean | 应该将该值导出。导出用户无法指定的字段。不赞成。计划于1.18年拆除。Should this value be exported.  Export strips fields that a user can not specify. Deprecated. Planned for removal in 1.18.
    try {
      V1Pod result = apiInstance.readNamespacedPod(name, namespace, pretty, exact, export);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling CoreV1Api#readNamespacedPod");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
name String name of the Pod
namespace String 对象名称和身份验证范围,例如团队和项目。object name and auth scope, such as for teams and projects
pretty String 如果为“true”,则输出相当打印。If 'true', then the output is pretty printed. [optional]
exact Boolean Should the export be exact. Exact export maintains cluster-specific fields like 'Namespace'. Deprecated. Planned for removal in 1.18. [optional]
export Boolean 应该将该值导出。导出用户无法指定的字段。不赞成。计划于1.18年拆除。Should this value be exported. Export strips fields that a user can not specify. Deprecated. Planned for removal in 1.18. [optional]

Return type

V1Pod

Authorization

BearerToken

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json, application/yaml, application/vnd.kubernetes.protobuf

HTTP response details

Status code Description Response headers
200 OK -
401 Unauthorized -

replaceNamespacedPod


回到“Pod增删查改”目录

V1Pod replaceNamespacedPod(name, namespace, body, pretty, dryRun, fieldManager)

replace the specified Pod

Example

// Import classes:
import io.kubernetes.client.openapi.ApiClient;
import io.kubernetes.client.openapi.ApiException;
import io.kubernetes.client.openapi.Configuration;
import io.kubernetes.client.openapi.auth.*;
import io.kubernetes.client.openapi.models.*;
import io.kubernetes.client.openapi.apis.CoreV1Api;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("http://localhost");
    
    // Configure API key authorization: BearerToken
    ApiKeyAuth BearerToken = (ApiKeyAuth) defaultClient.getAuthentication("BearerToken");
    BearerToken.setApiKey("YOUR API KEY");
    // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
    //BearerToken.setApiKeyPrefix("Token");

    CoreV1Api apiInstance = new CoreV1Api(defaultClient);
    String name = "name_example"; // String | name of the Pod
    String namespace = "namespace_example"; // String | 对象名称和身份验证范围,例如团队和项目。object name and auth scope, such as for teams and projects
    V1Pod body = new V1Pod(); // V1Pod | 
    String pretty = "pretty_example"; // String | 如果为“true”,则输出相当打印。If 'true', then the output is pretty printed.
    String dryRun = "dryRun_example"; // String | 如果存在,则表示不应保留修改。无效或无法识别的dryRun指令将导致错误响应,并且不会进一步处理请求。有效值为:-全部:将处理所有干运行阶段。When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed
    String fieldManager = "fieldManager_example"; // String |  fieldManager是与进行这些更改的参与者或实体关联的名称。该值的长度必须小于或128个字符,并且仅包含可打印字符,如https://golang.org/pkg/unicode/#IsPrint.fieldManager is a name associated with the actor or entity that is making these changes. The value must be less than or 128 characters long, and only contain printable characters, as defined by https://golang.org/pkg/unicode/#IsPrint.
    try {
      V1Pod result = apiInstance.replaceNamespacedPod(name, namespace, body, pretty, dryRun, fieldManager);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling CoreV1Api#replaceNamespacedPod");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
name String name of the Pod
namespace String 对象名称和身份验证范围,例如团队和项目。object name and auth scope, such as for teams and projects
body V1Pod
pretty String 如果为“true”,则输出相当打印。If 'true', then the output is pretty printed. [optional]
dryRun String 如果存在,则表示不应保留修改。无效或无法识别的dryRun指令将导致错误响应,并且不会进一步处理请求。有效值为:-全部:将处理所有干运行阶段。When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed [optional]
fieldManager String fieldManager是与进行这些更改的参与者或实体关联的名称。该值的长度必须小于或128个字符,并且仅包含可打印字符,如https://golang.org/pkg/unicode/#IsPrint.fieldManager is a name associated with the actor or entity that is making these changes. The value must be less than or 128 characters long, and only contain printable characters, as defined by https://golang.org/pkg/unicode/#IsPrint. [optional]

Return type

V1Pod

Authorization

BearerToken

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json, application/yaml, application/vnd.kubernetes.protobuf

HTTP response details

Status code Description Response headers
200 OK -
201 Created -
401 Unauthorized -

Service增删改查


回到K8sAPI根目录

All URIs are relative to http://localhost

Method HTTP request Description
createNamespacedService POST /api/v1/namespaces/{namespace}/services 创建服务
deleteNamespacedService DELETE /api/v1/namespaces/{namespace}/services/ 删除服务
listNamespacedService GET /api/v1/namespaces/{namespace}/services 服务列表
patchNamespacedService PATCH /api/v1/namespaces/{namespace}/services/ 修改指定服务内容
readNamespacedService GET /api/v1/namespaces/{namespace}/services/ 查询指定服务内容
replaceNamespacedService PUT /api/v1/namespaces/{namespace}/services/ 替换指定服务内容

createNamespacedService


回到“Service增删查改”目录

V1Service createNamespacedService(namespace, body, pretty, dryRun, fieldManager)

create a Service

Example

// Import classes:
import io.kubernetes.client.openapi.ApiClient;
import io.kubernetes.client.openapi.ApiException;
import io.kubernetes.client.openapi.Configuration;
import io.kubernetes.client.openapi.auth.*;
import io.kubernetes.client.openapi.models.*;
import io.kubernetes.client.openapi.apis.CoreV1Api;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("http://localhost");
    
    // Configure API key authorization: BearerToken
    ApiKeyAuth BearerToken = (ApiKeyAuth) defaultClient.getAuthentication("BearerToken");
    BearerToken.setApiKey("YOUR API KEY");
    // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
    //BearerToken.setApiKeyPrefix("Token");

    CoreV1Api apiInstance = new CoreV1Api(defaultClient);
    String namespace = "namespace_example"; // String | 对象名称和身份验证范围,例如团队和项目。object name and auth scope, such as for teams and projects
    V1Service body = new V1Service(); // V1Service | 
    String pretty = "pretty_example"; // String | 如果为“true”,则输出相当打印。If 'true', then the output is pretty printed.
    String dryRun = "dryRun_example"; // String | 如果存在,则表示不应保留修改。无效或无法识别的dryRun指令将导致错误响应,并且不会进一步处理请求。有效值为:-全部:将处理所有干运行阶段。When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed
    String fieldManager = "fieldManager_example"; // String |  fieldManager是与进行这些更改的参与者或实体关联的名称。该值的长度必须小于或128个字符,并且仅包含可打印字符,如https://golang.org/pkg/unicode/#IsPrint.fieldManager is a name associated with the actor or entity that is making these changes. The value must be less than or 128 characters long, and only contain printable characters, as defined by https://golang.org/pkg/unicode/#IsPrint.
    try {
      V1Service result = apiInstance.createNamespacedService(namespace, body, pretty, dryRun, fieldManager);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling CoreV1Api#createNamespacedService");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
namespace String 对象名称和身份验证范围,例如团队和项目。object name and auth scope, such as for teams and projects
body V1Service
pretty String 如果为“true”,则输出相当打印。If 'true', then the output is pretty printed. [optional]
dryRun String 如果存在,则表示不应保留修改。无效或无法识别的dryRun指令将导致错误响应,并且不会进一步处理请求。有效值为:-全部:将处理所有干运行阶段。When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed [optional]
fieldManager String fieldManager是与进行这些更改的参与者或实体关联的名称。该值的长度必须小于或128个字符,并且仅包含可打印字符,如https://golang.org/pkg/unicode/#IsPrint.fieldManager is a name associated with the actor or entity that is making these changes. The value must be less than or 128 characters long, and only contain printable characters, as defined by https://golang.org/pkg/unicode/#IsPrint. [optional]

Return type

V1Service

Authorization

BearerToken

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json, application/yaml, application/vnd.kubernetes.protobuf

HTTP response details

Status code Description Response headers
200 OK -
201 Created -
202 Accepted -
401 Unauthorized -

deleteNamespacedService


回到“Service增删查改”目录

V1Status deleteNamespacedService(name, namespace, pretty, dryRun, gracePeriodSeconds, orphanDependents, propagationPolicy, body)

delete a Service

Example

// Import classes:
import io.kubernetes.client.openapi.ApiClient;
import io.kubernetes.client.openapi.ApiException;
import io.kubernetes.client.openapi.Configuration;
import io.kubernetes.client.openapi.auth.*;
import io.kubernetes.client.openapi.models.*;
import io.kubernetes.client.openapi.apis.CoreV1Api;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("http://localhost");
    
    // Configure API key authorization: BearerToken
    ApiKeyAuth BearerToken = (ApiKeyAuth) defaultClient.getAuthentication("BearerToken");
    BearerToken.setApiKey("YOUR API KEY");
    // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
    //BearerToken.setApiKeyPrefix("Token");

    CoreV1Api apiInstance = new CoreV1Api(defaultClient);
    String name = "name_example"; // String | name of the Service
    String namespace = "namespace_example"; // String | 对象名称和身份验证范围,例如团队和项目。object name and auth scope, such as for teams and projects
    String pretty = "pretty_example"; // String | 如果为“true”,则输出相当打印。If 'true', then the output is pretty printed.
    String dryRun = "dryRun_example"; // String | 如果存在,则表示不应保留修改。无效或无法识别的dryRun指令将导致错误响应,并且不会进一步处理请求。有效值为:-全部:将处理所有干运行阶段。When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed
    Integer gracePeriodSeconds = 56; // Integer | 删除对象前的持续时间(秒)。值必须是非负整数。值为零表示立即删除。如果此值为nil,则将使用指定类型的默认宽限期。如果未指定,则默认为每对象值。零表示立即删除。The duration in seconds before the object should be deleted. Value must be non-negative integer. The value zero indicates delete immediately. If this value is nil, the default grace period for the specified type will be used. Defaults to a per object value if not specified. zero means delete immediately.
    Boolean orphanDependents = true; // Boolean | 已弃用:请使用PropagationPolicy,此字段将在1.7中弃用。从属对象应该是孤立的吗。如果为真/假,“孤立”终结器将被添加到对象的终结器列表中或从中删除。可以设置此字段或PropagationPolicy,但不能同时设置两者。Deprecated: please use the PropagationPolicy, this field will be deprecated in 1.7. Should the dependent objects be orphaned. If true/false, the \"orphan\" finalizer will be added to/removed from the object's finalizers list. Either this field or PropagationPolicy may be set, but not both.
    String propagationPolicy = "propagationPolicy_example"; // String | 是否以及如何执行垃圾收集。可以设置此字段或孤立从属项,但不能同时设置两者。默认策略由元数据中设置的现有终结器决定。终结器和特定于资源的默认策略。Whether and how garbage collection will be performed. Either this field or OrphanDependents may be set, but not both. The default policy is decided by the existing finalizer set in the metadata.finalizers and the resource-specific default policy. Acceptable values are: 'Orphan' - orphan the dependents; 'Background' - allow the garbage collector to delete the dependents in the background; 'Foreground' - a cascading policy that deletes all dependents in the foreground.
    V1DeleteOptions body = new V1DeleteOptions(); // V1DeleteOptions | 
    try {
      V1Status result = apiInstance.deleteNamespacedService(name, namespace, pretty, dryRun, gracePeriodSeconds, orphanDependents, propagationPolicy, body);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling CoreV1Api#deleteNamespacedService");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
name String name of the Service
namespace String 对象名称和身份验证范围,例如团队和项目。object name and auth scope, such as for teams and projects
pretty String 如果为“true”,则输出相当打印。If 'true', then the output is pretty printed. [optional]
dryRun String 如果存在,则表示不应保留修改。无效或无法识别的dryRun指令将导致错误响应,并且不会进一步处理请求。有效值为:-全部:将处理所有干运行阶段。When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed [optional]
gracePeriodSeconds Integer 删除对象前的持续时间(秒)。值必须是非负整数。值为零表示立即删除。如果此值为nil,则将使用指定类型的默认宽限期。如果未指定,则默认为每对象值。零表示立即删除。The duration in seconds before the object should be deleted. Value must be non-negative integer. The value zero indicates delete immediately. If this value is nil, the default grace period for the specified type will be used. Defaults to a per object value if not specified. zero means delete immediately. [optional]
orphanDependents Boolean 已弃用:请使用PropagationPolicy,此字段将在1.7中弃用。从属对象应该是孤立的吗。如果为真/假,“孤立”终结器将被添加到对象的终结器列表中或从中删除。可以设置此字段或PropagationPolicy,但不能同时设置两者。Deprecated: please use the PropagationPolicy, this field will be deprecated in 1.7. Should the dependent objects be orphaned. If true/false, the "orphan" finalizer will be added to/removed from the object's finalizers list. Either this field or PropagationPolicy may be set, but not both. [optional]
propagationPolicy String 是否以及如何执行垃圾收集。可以设置此字段或孤立从属项,但不能同时设置两者。默认策略由元数据中设置的现有终结器决定。终结器和特定于资源的默认策略。Whether and how garbage collection will be performed. Either this field or OrphanDependents may be set, but not both. The default policy is decided by the existing finalizer set in the metadata.finalizers and the resource-specific default policy. Acceptable values are: 'Orphan' - orphan the dependents; 'Background' - allow the garbage collector to delete the dependents in the background; 'Foreground' - a cascading policy that deletes all dependents in the foreground. [optional]
body V1DeleteOptions [optional]

Return type

V1Status

Authorization

BearerToken

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json, application/yaml, application/vnd.kubernetes.protobuf

HTTP response details

Status code Description Response headers
200 OK -
202 Accepted -
401 Unauthorized -

listNamespacedService


回到“Service增删查改”目录

V1ServiceList listNamespacedService(namespace, pretty, allowWatchBookmarks, _continue, fieldSelector, labelSelector, limit, resourceVersion, timeoutSeconds, watch)

list or watch objects of kind Service

Example

// Import classes:
import io.kubernetes.client.openapi.ApiClient;
import io.kubernetes.client.openapi.ApiException;
import io.kubernetes.client.openapi.Configuration;
import io.kubernetes.client.openapi.auth.*;
import io.kubernetes.client.openapi.models.*;
import io.kubernetes.client.openapi.apis.CoreV1Api;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("http://localhost");
    
    // Configure API key authorization: BearerToken
    ApiKeyAuth BearerToken = (ApiKeyAuth) defaultClient.getAuthentication("BearerToken");
    BearerToken.setApiKey("YOUR API KEY");
    // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
    //BearerToken.setApiKeyPrefix("Token");

    CoreV1Api apiInstance = new CoreV1Api(defaultClient);
    String namespace = "namespace_example"; // String | 对象名称和身份验证范围,例如团队和项目。object name and auth scope, such as for teams and projects
    String pretty = "pretty_example"; // String | 如果为“true”,则输出相当打印。If 'true', then the output is pretty printed.
    Boolean allowWatchBookmarks = true; // Boolean | allowWatchBookmarks请求观看类型为“的事件;书签"。未实现书签的服务器可能会忽略此标志,书签会在服务器上发送'这是自由裁量权。客户端不应假定书签是在任何特定的时间间隔返回的,也不应假定服务器将在会话期间发送任何书签事件。如果这不是手表,则忽略此字段。如果apiserver中未启用功能gate WatchBookmarks,则忽略此字段。allowWatchBookmarks requests watch events with type \"BOOKMARK\". Servers that do not implement bookmarks may ignore this flag and bookmarks are sent at the server's discretion. Clients should not assume bookmarks are returned at any specific interval, nor may they assume the server will send any BOOKMARK event during a session. If this is not a watch, this field is ignored. If the feature gate WatchBookmarks is not enabled in apiserver, this field is ignored.
    String _continue = "_continue_example"; // String | 从服务器检索更多结果时,应设置“继续”选项。由于此值是服务器定义的,因此客户端只能使用具有相同查询参数(continue值除外)的上一个查询结果中的continue值,服务器可能会拒绝它无法识别的continue值。如果指定的continue值因过期(通常为5到15分钟)或服务器上的配置更改而不再有效,服务器将响应410 ResourceExpired错误和continue令牌。如果客户端需要一个一致的列表,它必须在不使用continue字段的情况下重新启动它们的列表。从另一台服务器发送的结果可能与前一台服务器发送的结果不一致,但从下一台服务器发送的结果可能与前一台服务器发送的结果不一致,只要他们的钥匙在“下一个钥匙”之后。watch为true时不支持此字段。客户端可以从服务器返回的最后一个resourceVersion值开始监视,并且不会错过任何修改。The continue option should be set when retrieving more results from the server. Since this value is server defined, clients may only use the continue value from a previous query result with identical query parameters (except for the value of continue) and the server may reject a continue value it does not recognize. If the specified continue value is no longer valid whether due to expiration (generally five to fifteen minutes) or a configuration change on the server, the server will respond with a 410 ResourceExpired error together with a continue token. If the client needs a consistent list, it must restart their list without the continue field. Otherwise, the client may send another list request with the token received with the 410 error, the server will respond with a list starting from the next key, but from the latest snapshot, which is inconsistent from the previous list results - objects that are created, modified, or deleted after the first list request will be included in the response, as long as their keys are after the "next key".  This field is not supported when watch is true. Clients may start a watch from the last resourceVersion value returned by the server and not miss any modifications.(except for the value of continue) and the server may reject a continue value it does not recognize. If the specified continue value is no longer valid whether due to expiration (generally five to fifteen minutes) or a configuration change on the server, the server will respond with a 410 ResourceExpired error together with a continue token. If the client needs a consistent list, it must restart their list without the continue field. Otherwise, the client may send another list request with the token received with the 410 error, the server will respond with a list starting from the next key, but from the latest snapshot, which is inconsistent from the previous list results - objects that are created, modified, or deleted after the first list request will be included in the response, as long as their keys are after the \"next key\".  This field is not supported when watch is true. Clients may start a watch from the last resourceVersion value returned by the server and not miss any modifications.
    String fieldSelector = "fieldSelector_example"; // String | 一个选择器,用于按字段限制返回对象的列表。默认为一切。A selector to restrict the list of returned objects by their fields. Defaults to everything.
    String labelSelector = "labelSelector_example"; // String | 一个选择器,用于根据返回对象的标签限制其列表。默认为一切。A selector to restrict the list of returned objects by their labels. Defaults to everything.
    Integer limit = 56; // Integer | limit是列表调用返回的最大响应数。如果存在更多项,服务器会将列表元数据上的“continue”字段设置为一个值,该值可用于同一初始查询,以检索下一组结果。如果所有请求的对象都被过滤掉,设置限制可能会返回少于请求数量的项目(最多为零个项目),客户端应该只使用continue字段来确定是否有更多结果可用。服务器可能会选择不支持limit参数,并将返回所有可用的结果。如果指定了limit且continue字段为空,则客户端可能会认为没有更多结果可用。如果watch为true,则不支持此字段。服务器保证在使用continue时返回的对象将与无限制地发出单个列表调用相同——也就是说,在发出第一个请求后创建、修改或删除的对象不会包含在任何后续的continue请求中。这有时被称为一致性快照,可以确保使用limit接收非常大结果的较小数据块的客户端可以确保看到所有可能的对象。如果在分块列表期间更新对象,则返回在计算第一个列表结果时存在的对象版本。limit is a maximum number of responses to return for a list call. If more items exist, the server will set the `continue` field on the list metadata to a value that can be used with the same initial query to retrieve the next set of results. Setting a limit may return fewer than the requested amount of items (up to zero items) in the event all requested objects are filtered out and clients should only use the presence of the continue field to determine whether more results are available. Servers may choose not to support the limit argument and will return all of the available results. If limit is specified and the continue field is empty, clients may assume that no more results are available. This field is not supported if watch is true.  The server guarantees that the objects returned when using continue will be identical to issuing a single list call without a limit - that is, no objects created, modified, or deleted after the first request is issued will be included in any subsequent continued requests. This is sometimes referred to as a consistent snapshot, and ensures that a client that is using limit to receive smaller chunks of a very large result can ensure they see all possible objects. If objects are updated during a chunked list the version of the object that was present at the time the first list result was calculated is returned.
    String resourceVersion = "resourceVersion_example"; // String | 当通过监视调用指定时,显示在资源的特定版本之后发生的更改。默认为历史开始时的更改。为列表指定时:-如果未设置,则根据仲裁读取标志从远程存储返回结果;-如果是0,那么我们只返回当前缓存中的内容,不保证;-如果设置为非零,则结果至少与给定值一样新鲜When specified with a watch call, shows changes that occur after that particular version of a resource. Defaults to changes from the beginning of history. When specified for list: - if unset, then the result is returned from remote storage based on quorum-read flag; - if it's 0, then we simply return what we currently have in cache, no guarantee; - if set to non zero, then the result is at least as fresh as given rv.
    Integer timeoutSeconds = 56; // Integer | 列表/监视呼叫超时。这会限制通话的持续时间,而不管通话是否处于活动状态。列表/监视呼叫超时。这会限制通话的持续时间,而不管通话是否处于活动状态。Timeout for the list/watch call. This limits the duration of the call, regardless of any activity or inactivity.
    Boolean watch = true; // Boolean | 观察对所描述资源的更改,并将其作为添加、更新和删除通知流返回。指定resourceVersion。观察对所描述资源的更改,并将其作为添加、更新和删除通知流返回。Watch for changes to the described resources and return them as a stream of add, update, and remove notifications. Specify resourceVersion.
    try {
      V1ServiceList result = apiInstance.listNamespacedService(namespace, pretty, allowWatchBookmarks, _continue, fieldSelector, labelSelector, limit, resourceVersion, timeoutSeconds, watch);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling CoreV1Api#listNamespacedService");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
namespace String 对象名称和身份验证范围,例如团队和项目。object name and auth scope, such as for teams and projects
pretty String 如果为“true”,则输出相当打印。If 'true', then the output is pretty printed. [optional]
allowWatchBookmarks Boolean allowWatchBookmarks请求观看类型为“的事件;书签"。未实现书签的服务器可能会忽略此标志,书签会在服务器上发送'这是自由裁量权。客户端不应假定书签是在任何特定的时间间隔返回的,也不应假定服务器将在会话期间发送任何书签事件。如果这不是手表,则忽略此字段。如果apiserver中未启用功能gate WatchBookmarks,则忽略此字段。allowWatchBookmarks requests watch events with type "BOOKMARK". Servers that do not implement bookmarks may ignore this flag and bookmarks are sent at the server's discretion. Clients should not assume bookmarks are returned at any specific interval, nor may they assume the server will send any BOOKMARK event during a session. If this is not a watch, this field is ignored. If the feature gate WatchBookmarks is not enabled in apiserver, this field is ignored. [optional]
_continue String 从服务器检索更多结果时,应设置“继续”选项。由于此值是服务器定义的,因此客户端只能使用具有相同查询参数(continue值除外)的上一个查询结果中的continue值,服务器可能会拒绝它无法识别的continue值。如果指定的continue值因过期(通常为5到15分钟)或服务器上的配置更改而不再有效,服务器将响应410 ResourceExpired错误和continue令牌。如果客户端需要一个一致的列表,它必须在不使用continue字段的情况下重新启动它们的列表。从另一台服务器发送的结果可能与前一台服务器发送的结果不一致,但从下一台服务器发送的结果可能与前一台服务器发送的结果不一致,只要他们的钥匙在“下一个钥匙”之后。watch为true时不支持此字段。客户端可以从服务器返回的最后一个resourceVersion值开始监视,并且不会错过任何修改。The continue option should be set when retrieving more results from the server. Since this value is server defined, clients may only use the continue value from a previous query result with identical query parameters (except for the value of continue) and the server may reject a continue value it does not recognize. If the specified continue value is no longer valid whether due to expiration (generally five to fifteen minutes) or a configuration change on the server, the server will respond with a 410 ResourceExpired error together with a continue token. If the client needs a consistent list, it must restart their list without the continue field. Otherwise, the client may send another list request with the token received with the 410 error, the server will respond with a list starting from the next key, but from the latest snapshot, which is inconsistent from the previous list results - objects that are created, modified, or deleted after the first list request will be included in the response, as long as their keys are after the "next key". This field is not supported when watch is true. Clients may start a watch from the last resourceVersion value returned by the server and not miss any modifications.(except for the value of continue) and the server may reject a continue value it does not recognize. If the specified continue value is no longer valid whether due to expiration (generally five to fifteen minutes) or a configuration change on the server, the server will respond with a 410 ResourceExpired error together with a continue token. If the client needs a consistent list, it must restart their list without the continue field. Otherwise, the client may send another list request with the token received with the 410 error, the server will respond with a list starting from the next key, but from the latest snapshot, which is inconsistent from the previous list results - objects that are created, modified, or deleted after the first list request will be included in the response, as long as their keys are after the "next key". This field is not supported when watch is true. Clients may start a watch from the last resourceVersion value returned by the server and not miss any modifications. [optional]
fieldSelector String 一个选择器,用于按字段限制返回对象的列表。默认为一切。A selector to restrict the list of returned objects by their fields. Defaults to everything. [optional]
labelSelector String 一个选择器,用于根据返回对象的标签限制其列表。默认为一切。A selector to restrict the list of returned objects by their labels. Defaults to everything. [optional]
limit Integer limit是列表调用返回的最大响应数。如果存在更多项目,服务器将设置`继续`字段的值,该值可用于同一初始查询以检索下一组结果。如果所有请求的对象都被过滤掉,设置限制可能会返回少于请求数量的项目(最多为零个项目),客户端应该只使用continue字段来确定是否有更多结果可用。服务器可能会选择不支持limit参数,并将返回所有可用的结果。如果指定了limit且continue字段为空,则客户端可能会认为没有更多结果可用。如果watch为true,则不支持此字段。服务器保证在使用continue时返回的对象将与无限制地发出单个列表调用相同——也就是说,在发出第一个请求后创建、修改或删除的对象不会包含在任何后续的continue请求中。这有时被称为一致性快照,可以确保使用limit接收非常大结果的较小数据块的客户端可以确保看到所有可能的对象。如果在分块列表期间更新对象,则返回在计算第一个列表结果时存在的对象版本。 limit is a maximum number of responses to return for a list call. If more items exist, the server will set the `continue` field on the list metadata to a value that can be used with the same initial query to retrieve the next set of results. Setting a limit may return fewer than the requested amount of items (up to zero items) in the event all requested objects are filtered out and clients should only use the presence of the continue field to determine whether more results are available. Servers may choose not to support the limit argument and will return all of the available results. If limit is specified and the continue field is empty, clients may assume that no more results are available. This field is not supported if watch is true. The server guarantees that the objects returned when using continue will be identical to issuing a single list call without a limit - that is, no objects created, modified, or deleted after the first request is issued will be included in any subsequent continued requests. This is sometimes referred to as a consistent snapshot, and ensures that a client that is using limit to receive smaller chunks of a very large result can ensure they see all possible objects. If objects are updated during a chunked list the version of the object that was present at the time the first list result was calculated is returned. [optional]
resourceVersion String 当通过监视调用指定时,显示在资源的特定版本之后发生的更改。默认为历史开始时的更改。为列表指定时:-如果未设置,则根据仲裁读取标志从远程存储返回结果;-如果是's 0,然后我们只返回当前缓存中的内容,不保证;-如果设置为非零,则结果至少与给定值一样新鲜。When specified with a watch call, shows changes that occur after that particular version of a resource. Defaults to changes from the beginning of history. When specified for list: - if unset, then the result is returned from remote storage based on quorum-read flag; - if it's 0, then we simply return what we currently have in cache, no guarantee; - if set to non zero, then the result is at least as fresh as given rv. [optional]
timeoutSeconds Integer 列表/监视呼叫超时。这会限制通话的持续时间,而不管通话是否处于活动状态。列表/监视呼叫超时。这会限制通话的持续时间,而不管通话是否处于活动状态。Timeout for the list/watch call. This limits the duration of the call, regardless of any activity or inactivity. [optional]
watch Boolean 观察对所描述资源的更改,并将其作为添加、更新和删除通知流返回。指定resourceVersion。观察对所描述资源的更改,并将其作为添加、更新和删除通知流返回。Watch for changes to the described resources and return them as a stream of add, update, and remove notifications. Specify resourceVersion. [optional]

Return type

V1ServiceList

Authorization

BearerToken

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json, application/yaml, application/vnd.kubernetes.protobuf, application/json;stream=watch, application/vnd.kubernetes.protobuf;stream=watch

HTTP response details

Status code Description Response headers
200 OK -
401 Unauthorized -

patchNamespacedService


回到“Service增删查改”目录

V1Service patchNamespacedService(name, namespace, body, pretty, dryRun, fieldManager, force)

partially update the specified Service

Example

// Import classes:
import io.kubernetes.client.openapi.ApiClient;
import io.kubernetes.client.openapi.ApiException;
import io.kubernetes.client.openapi.Configuration;
import io.kubernetes.client.openapi.auth.*;
import io.kubernetes.client.openapi.models.*;
import io.kubernetes.client.openapi.apis.CoreV1Api;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("http://localhost");
    
    // Configure API key authorization: BearerToken
    ApiKeyAuth BearerToken = (ApiKeyAuth) defaultClient.getAuthentication("BearerToken");
    BearerToken.setApiKey("YOUR API KEY");
    // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
    //BearerToken.setApiKeyPrefix("Token");

    CoreV1Api apiInstance = new CoreV1Api(defaultClient);
    String name = "name_example"; // String | name of the Service
    String namespace = "namespace_example"; // String | 对象名称和身份验证范围,例如团队和项目。object name and auth scope, such as for teams and projects
    V1Patch body = new V1Patch(); // V1Patch | 
    String pretty = "pretty_example"; // String | 如果为“true”,则输出相当打印。If 'true', then the output is pretty printed.
    String dryRun = "dryRun_example"; // String | 如果存在,则表示不应保留修改。无效或无法识别的dryRun指令将导致错误响应,并且不会进一步处理请求。有效值为:-全部:将处理所有干运行阶段。When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed
    String fieldManager = "fieldManager_example"; // String |  fieldManager是与进行这些更改的参与者或实体关联的名称。该值的长度必须小于或128个字符,并且仅包含可打印字符,如https://golang.org/pkg/unicode/#IsPrint.fieldManager is a name associated with the actor or entity that is making these changes. The value must be less than or 128 characters long, and only contain printable characters, as defined by https://golang.org/pkg/unicode/#IsPrint. This field is required for apply requests (application/apply-patch) but optional for non-apply patch types (JsonPatch, MergePatch, StrategicMergePatch).
    Boolean force = true; // Boolean | Force将“强制”应用请求。这意味着用户将重新获取其他人拥有的冲突字段。对于非应用补丁请求,必须取消设置强制标志。Force is going to \"force\" Apply requests. It means user will re-acquire conflicting fields owned by other people. Force flag must be unset for non-apply patch requests.
    try {
      V1Service result = apiInstance.patchNamespacedService(name, namespace, body, pretty, dryRun, fieldManager, force);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling CoreV1Api#patchNamespacedService");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
name String name of the Service
namespace String 对象名称和身份验证范围,例如团队和项目。object name and auth scope, such as for teams and projects
body V1Patch
pretty String 如果为“true”,则输出相当打印。If 'true', then the output is pretty printed. [optional]
dryRun String 如果存在,则表示不应保留修改。无效或无法识别的dryRun指令将导致错误响应,并且不会进一步处理请求。有效值为:-全部:将处理所有干运行阶段。When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed [optional]
fieldManager String fieldManager是与进行这些更改的参与者或实体关联的名称。该值的长度必须小于或128个字符,并且仅包含可打印字符,如https://golang.org/pkg/unicode/#IsPrint.fieldManager is a name associated with the actor or entity that is making these changes. The value must be less than or 128 characters long, and only contain printable characters, as defined by https://golang.org/pkg/unicode/#IsPrint. This field is required for apply requests (application/apply-patch) but optional for non-apply patch types (JsonPatch, MergePatch, StrategicMergePatch). [optional]
force Boolean Force将“强制”应用请求。这意味着用户将重新获取其他人拥有的冲突字段。对于非应用补丁请求,必须取消设置强制标志。Force is going to "force" Apply requests. It means user will re-acquire conflicting fields owned by other people. Force flag must be unset for non-apply patch requests. [optional]

Return type

V1Service

Authorization

BearerToken

HTTP request headers

  • Content-Type: application/json-patch+json, application/merge-patch+json, application/strategic-merge-patch+json, application/apply-patch+yaml
  • Accept: application/json, application/yaml, application/vnd.kubernetes.protobuf

HTTP response details

Status code Description Response headers
200 OK -
401 Unauthorized -

readNamespacedService


回到“Service增删查改”目录

V1Service readNamespacedService(name, namespace, pretty, exact, export)

read the specified Service

Example

// Import classes:
import io.kubernetes.client.openapi.ApiClient;
import io.kubernetes.client.openapi.ApiException;
import io.kubernetes.client.openapi.Configuration;
import io.kubernetes.client.openapi.auth.*;
import io.kubernetes.client.openapi.models.*;
import io.kubernetes.client.openapi.apis.CoreV1Api;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("http://localhost");
    
    // Configure API key authorization: BearerToken
    ApiKeyAuth BearerToken = (ApiKeyAuth) defaultClient.getAuthentication("BearerToken");
    BearerToken.setApiKey("YOUR API KEY");
    // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
    //BearerToken.setApiKeyPrefix("Token");

    CoreV1Api apiInstance = new CoreV1Api(defaultClient);
    String name = "name_example"; // String | name of the Service
    String namespace = "namespace_example"; // String | 对象名称和身份验证范围,例如团队和项目。object name and auth scope, such as for teams and projects
    String pretty = "pretty_example"; // String | 如果为“true”,则输出相当打印。If 'true', then the output is pretty printed.
    Boolean exact = true; // Boolean | 出口应该是准确的。Exact export维护特定于集群的字段,如“Namespace”。不赞成。计划于1.18年拆除。Should the export be exact.  Exact export maintains cluster-specific fields like 'Namespace'. Deprecated. Planned for removal in 1.18.
    Boolean export = true; // Boolean | 应该将该值导出。导出用户无法指定的字段。不赞成。计划于1.18年拆除。Should this value be exported.  Export strips fields that a user can not specify. Deprecated. Planned for removal in 1.18.
    try {
      V1Service result = apiInstance.readNamespacedService(name, namespace, pretty, exact, export);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling CoreV1Api#readNamespacedService");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
name String name of the Service
namespace String 对象名称和身份验证范围,例如团队和项目。object name and auth scope, such as for teams and projects
pretty String 如果为“true”,则输出相当打印。If 'true', then the output is pretty printed. [optional]
exact Boolean Should the export be exact. Exact export maintains cluster-specific fields like 'Namespace'. Deprecated. Planned for removal in 1.18. [optional]
export Boolean 应该将该值导出。导出用户无法指定的字段。不赞成。计划于1.18年拆除。Should this value be exported. Export strips fields that a user can not specify. Deprecated. Planned for removal in 1.18. [optional]

Return type

V1Service

Authorization

BearerToken

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json, application/yaml, application/vnd.kubernetes.protobuf

HTTP response details

Status code Description Response headers
200 OK -
401 Unauthorized -

replaceNamespacedService


回到“Service增删查改”目录

V1Service replaceNamespacedService(name, namespace, body, pretty, dryRun, fieldManager)

replace the specified Service

Example

// Import classes:
import io.kubernetes.client.openapi.ApiClient;
import io.kubernetes.client.openapi.ApiException;
import io.kubernetes.client.openapi.Configuration;
import io.kubernetes.client.openapi.auth.*;
import io.kubernetes.client.openapi.models.*;
import io.kubernetes.client.openapi.apis.CoreV1Api;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("http://localhost");
    
    // Configure API key authorization: BearerToken
    ApiKeyAuth BearerToken = (ApiKeyAuth) defaultClient.getAuthentication("BearerToken");
    BearerToken.setApiKey("YOUR API KEY");
    // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
    //BearerToken.setApiKeyPrefix("Token");

    CoreV1Api apiInstance = new CoreV1Api(defaultClient);
    String name = "name_example"; // String | name of the Service
    String namespace = "namespace_example"; // String | 对象名称和身份验证范围,例如团队和项目。object name and auth scope, such as for teams and projects
    V1Service body = new V1Service(); // V1Service | 
    String pretty = "pretty_example"; // String | 如果为“true”,则输出相当打印。If 'true', then the output is pretty printed.
    String dryRun = "dryRun_example"; // String | 如果存在,则表示不应保留修改。无效或无法识别的dryRun指令将导致错误响应,并且不会进一步处理请求。有效值为:-全部:将处理所有干运行阶段。When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed
    String fieldManager = "fieldManager_example"; // String |  fieldManager是与进行这些更改的参与者或实体关联的名称。该值的长度必须小于或128个字符,并且仅包含可打印字符,如https://golang.org/pkg/unicode/#IsPrint.fieldManager is a name associated with the actor or entity that is making these changes. The value must be less than or 128 characters long, and only contain printable characters, as defined by https://golang.org/pkg/unicode/#IsPrint.
    try {
      V1Service result = apiInstance.replaceNamespacedService(name, namespace, body, pretty, dryRun, fieldManager);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling CoreV1Api#replaceNamespacedService");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
name String name of the Service
namespace String 对象名称和身份验证范围,例如团队和项目。object name and auth scope, such as for teams and projects
body V1Service
pretty String 如果为“true”,则输出相当打印。If 'true', then the output is pretty printed. [optional]
dryRun String 如果存在,则表示不应保留修改。无效或无法识别的dryRun指令将导致错误响应,并且不会进一步处理请求。有效值为:-全部:将处理所有干运行阶段。When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed [optional]
fieldManager String fieldManager是与进行这些更改的参与者或实体关联的名称。该值的长度必须小于或128个字符,并且仅包含可打印字符,如https://golang.org/pkg/unicode/#IsPrint.fieldManager is a name associated with the actor or entity that is making these changes. The value must be less than or 128 characters long, and only contain printable characters, as defined by https://golang.org/pkg/unicode/#IsPrint. [optional]

Return type

V1Service

Authorization

BearerToken

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json, application/yaml, application/vnd.kubernetes.protobuf

HTTP response details

Status code Description Response headers
200 OK -
201 Created -
401 Unauthorized -

优先级增删改查


回到K8sAPI根目录

All URIs are relative to http://localhost

Method HTTP request Description
createPriorityClass POST /apis/scheduling.k8s.io/v1/priorityclasses 创建优先级
deleteCollectionPriorityClass DELETE /apis/scheduling.k8s.io/v1/priorityclasses 删除多个优先级
deletePriorityClass DELETE /apis/scheduling.k8s.io/v1/priorityclasses/ 删除优先级
getAPIResources GET /apis/scheduling.k8s.io/v1/ 获取可用资源
listPriorityClass GET /apis/scheduling.k8s.io/v1/priorityclasses 优先级列表
patchPriorityClass PATCH /apis/scheduling.k8s.io/v1/priorityclasses/ 修改优先级
readPriorityClass GET /apis/scheduling.k8s.io/v1/priorityclasses/ 查询指定优先级
replacePriorityClass PUT /apis/scheduling.k8s.io/v1/priorityclasses/ 替换优先级

createPriorityClass


回到“优先级增删改查”目录

V1PriorityClass createPriorityClass(body, pretty, dryRun, fieldManager)

create a PriorityClass

Example

// Import classes:
import io.kubernetes.client.openapi.ApiClient;
import io.kubernetes.client.openapi.ApiException;
import io.kubernetes.client.openapi.Configuration;
import io.kubernetes.client.openapi.auth.*;
import io.kubernetes.client.openapi.models.*;
import io.kubernetes.client.openapi.apis.SchedulingV1Api;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("http://localhost");
    
    // Configure API key authorization: BearerToken
    ApiKeyAuth BearerToken = (ApiKeyAuth) defaultClient.getAuthentication("BearerToken");
    BearerToken.setApiKey("YOUR API KEY");
    // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
    //BearerToken.setApiKeyPrefix("Token");

    SchedulingV1Api apiInstance = new SchedulingV1Api(defaultClient);
    V1PriorityClass body = new V1PriorityClass(); // V1PriorityClass | 
    String pretty = "pretty_example"; // String | 如果为“true”,则输出相当打印。If 'true', then the output is pretty printed.
    String dryRun = "dryRun_example"; // String | 如果存在,则表示不应保留修改。无效或无法识别的dryRun指令将导致错误响应,并且不会进一步处理请求。有效值为:-全部:将处理所有干运行阶段。When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed
    String fieldManager = "fieldManager_example"; // String |  fieldManager是与进行这些更改的参与者或实体关联的名称。该值的长度必须小于或128个字符,并且仅包含可打印字符,如https://golang.org/pkg/unicode/#IsPrint.fieldManager is a name associated with the actor or entity that is making these changes. The value must be less than or 128 characters long, and only contain printable characters, as defined by https://golang.org/pkg/unicode/#IsPrint.
    try {
      V1PriorityClass result = apiInstance.createPriorityClass(body, pretty, dryRun, fieldManager);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling SchedulingV1Api#createPriorityClass");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
body V1PriorityClass
pretty String 如果为“true”,则输出相当打印。If 'true', then the output is pretty printed. [optional]
dryRun String 如果存在,则表示不应保留修改。无效或无法识别的dryRun指令将导致错误响应,并且不会进一步处理请求。有效值为:-全部:将处理所有干运行阶段。When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed [optional]
fieldManager String fieldManager是与进行这些更改的参与者或实体关联的名称。该值的长度必须小于或128个字符,并且仅包含可打印字符,如https://golang.org/pkg/unicode/#IsPrint.fieldManager is a name associated with the actor or entity that is making these changes. The value must be less than or 128 characters long, and only contain printable characters, as defined by https://golang.org/pkg/unicode/#IsPrint. [optional]

Return type

V1PriorityClass

Authorization

BearerToken

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json, application/yaml, application/vnd.kubernetes.protobuf

HTTP response details

Status code Description Response headers
200 OK -
201 Created -
202 Accepted -
401 Unauthorized -

deleteCollectionPriorityClass


回到“优先级增删改查”目录

V1Status deleteCollectionPriorityClass(pretty, _continue, dryRun, fieldSelector, gracePeriodSeconds, labelSelector, limit, orphanDependents, propagationPolicy, resourceVersion, timeoutSeconds, body)

delete collection of PriorityClass

Example

// Import classes:
import io.kubernetes.client.openapi.ApiClient;
import io.kubernetes.client.openapi.ApiException;
import io.kubernetes.client.openapi.Configuration;
import io.kubernetes.client.openapi.auth.*;
import io.kubernetes.client.openapi.models.*;
import io.kubernetes.client.openapi.apis.SchedulingV1Api;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("http://localhost");
    
    // Configure API key authorization: BearerToken
    ApiKeyAuth BearerToken = (ApiKeyAuth) defaultClient.getAuthentication("BearerToken");
    BearerToken.setApiKey("YOUR API KEY");
    // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
    //BearerToken.setApiKeyPrefix("Token");

    SchedulingV1Api apiInstance = new SchedulingV1Api(defaultClient);
    String pretty = "pretty_example"; // String | 如果为“true”,则输出相当打印。If 'true', then the output is pretty printed.
    String _continue = "_continue_example"; // String | 从服务器检索更多结果时,应设置“继续”选项。由于此值是服务器定义的,因此客户端只能使用具有相同查询参数(continue值除外)的上一个查询结果中的continue值,服务器可能会拒绝它无法识别的continue值。如果指定的continue值因过期(通常为5到15分钟)或服务器上的配置更改而不再有效,服务器将响应410 ResourceExpired错误和continue令牌。如果客户端需要一个一致的列表,它必须在不使用continue字段的情况下重新启动它们的列表。从另一台服务器发送的结果可能与前一台服务器发送的结果不一致,但从下一台服务器发送的结果可能与前一台服务器发送的结果不一致,只要他们的钥匙在“下一个钥匙”之后。watch为true时不支持此字段。客户端可以从服务器返回的最后一个resourceVersion值开始监视,并且不会错过任何修改。The continue option should be set when retrieving more results from the server. Since this value is server defined, clients may only use the continue value from a previous query result with identical query parameters (except for the value of continue) and the server may reject a continue value it does not recognize. If the specified continue value is no longer valid whether due to expiration (generally five to fifteen minutes) or a configuration change on the server, the server will respond with a 410 ResourceExpired error together with a continue token. If the client needs a consistent list, it must restart their list without the continue field. Otherwise, the client may send another list request with the token received with the 410 error, the server will respond with a list starting from the next key, but from the latest snapshot, which is inconsistent from the previous list results - objects that are created, modified, or deleted after the first list request will be included in the response, as long as their keys are after the "next key".  This field is not supported when watch is true. Clients may start a watch from the last resourceVersion value returned by the server and not miss any modifications.(except for the value of continue) and the server may reject a continue value it does not recognize. If the specified continue value is no longer valid whether due to expiration (generally five to fifteen minutes) or a configuration change on the server, the server will respond with a 410 ResourceExpired error together with a continue token. If the client needs a consistent list, it must restart their list without the continue field. Otherwise, the client may send another list request with the token received with the 410 error, the server will respond with a list starting from the next key, but from the latest snapshot, which is inconsistent from the previous list results - objects that are created, modified, or deleted after the first list request will be included in the response, as long as their keys are after the \"next key\".  This field is not supported when watch is true. Clients may start a watch from the last resourceVersion value returned by the server and not miss any modifications.
    String dryRun = "dryRun_example"; // String | 如果存在,则表示不应保留修改。无效或无法识别的dryRun指令将导致错误响应,并且不会进一步处理请求。有效值为:-全部:将处理所有干运行阶段。When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed
    String fieldSelector = "fieldSelector_example"; // String | 一个选择器,用于按字段限制返回对象的列表。默认为一切。A selector to restrict the list of returned objects by their fields. Defaults to everything.
    Integer gracePeriodSeconds = 56; // Integer | 删除对象前的持续时间(秒)。值必须是非负整数。值为零表示立即删除。如果此值为nil,则将使用指定类型的默认宽限期。如果未指定,则默认为每对象值。零表示立即删除。The duration in seconds before the object should be deleted. Value must be non-negative integer. The value zero indicates delete immediately. If this value is nil, the default grace period for the specified type will be used. Defaults to a per object value if not specified. zero means delete immediately.
    String labelSelector = "labelSelector_example"; // String | 一个选择器,用于根据返回对象的标签限制其列表。默认为一切。A selector to restrict the list of returned objects by their labels. Defaults to everything.
    Integer limit = 56; // Integer | limit是列表调用返回的最大响应数。如果存在更多项,服务器会将列表元数据上的“continue”字段设置为一个值,该值可用于同一初始查询,以检索下一组结果。如果所有请求的对象都被过滤掉,设置限制可能会返回少于请求数量的项目(最多为零个项目),客户端应该只使用continue字段来确定是否有更多结果可用。服务器可能会选择不支持limit参数,并将返回所有可用的结果。如果指定了limit且continue字段为空,则客户端可能会认为没有更多结果可用。如果watch为true,则不支持此字段。服务器保证在使用continue时返回的对象将与无限制地发出单个列表调用相同——也就是说,在发出第一个请求后创建、修改或删除的对象不会包含在任何后续的continue请求中。这有时被称为一致性快照,可以确保使用limit接收非常大结果的较小数据块的客户端可以确保看到所有可能的对象。如果在分块列表期间更新对象,则返回在计算第一个列表结果时存在的对象版本。limit is a maximum number of responses to return for a list call. If more items exist, the server will set the `continue` field on the list metadata to a value that can be used with the same initial query to retrieve the next set of results. Setting a limit may return fewer than the requested amount of items (up to zero items) in the event all requested objects are filtered out and clients should only use the presence of the continue field to determine whether more results are available. Servers may choose not to support the limit argument and will return all of the available results. If limit is specified and the continue field is empty, clients may assume that no more results are available. This field is not supported if watch is true.  The server guarantees that the objects returned when using continue will be identical to issuing a single list call without a limit - that is, no objects created, modified, or deleted after the first request is issued will be included in any subsequent continued requests. This is sometimes referred to as a consistent snapshot, and ensures that a client that is using limit to receive smaller chunks of a very large result can ensure they see all possible objects. If objects are updated during a chunked list the version of the object that was present at the time the first list result was calculated is returned.
    Boolean orphanDependents = true; // Boolean | 已弃用:请使用PropagationPolicy,此字段将在1.7中弃用。从属对象应该是孤立的吗。如果为真/假,“孤立”终结器将被添加到对象的终结器列表中或从中删除。可以设置此字段或PropagationPolicy,但不能同时设置两者。Deprecated: please use the PropagationPolicy, this field will be deprecated in 1.7. Should the dependent objects be orphaned. If true/false, the \"orphan\" finalizer will be added to/removed from the object's finalizers list. Either this field or PropagationPolicy may be set, but not both.
    String propagationPolicy = "propagationPolicy_example"; // String | 是否以及如何执行垃圾收集。可以设置此字段或孤立从属项,但不能同时设置两者。默认策略由元数据中设置的现有终结器决定。终结器和特定于资源的默认策略。Whether and how garbage collection will be performed. Either this field or OrphanDependents may be set, but not both. The default policy is decided by the existing finalizer set in the metadata.finalizers and the resource-specific default policy. Acceptable values are: 'Orphan' - orphan the dependents; 'Background' - allow the garbage collector to delete the dependents in the background; 'Foreground' - a cascading policy that deletes all dependents in the foreground.
    String resourceVersion = "resourceVersion_example"; // String | 当通过监视调用指定时,显示在资源的特定版本之后发生的更改。默认为历史开始时的更改。为列表指定时:-如果未设置,则根据仲裁读取标志从远程存储返回结果;-如果是0,那么我们只返回当前缓存中的内容,不保证;-如果设置为非零,则结果至少与给定值一样新鲜When specified with a watch call, shows changes that occur after that particular version of a resource. Defaults to changes from the beginning of history. When specified for list: - if unset, then the result is returned from remote storage based on quorum-read flag; - if it's 0, then we simply return what we currently have in cache, no guarantee; - if set to non zero, then the result is at least as fresh as given rv.
    Integer timeoutSeconds = 56; // Integer | 列表/监视呼叫超时。这会限制通话的持续时间,而不管通话是否处于活动状态。列表/监视呼叫超时。这会限制通话的持续时间,而不管通话是否处于活动状态。Timeout for the list/watch call. This limits the duration of the call, regardless of any activity or inactivity.
    V1DeleteOptions body = new V1DeleteOptions(); // V1DeleteOptions | 
    try {
      V1Status result = apiInstance.deleteCollectionPriorityClass(pretty, _continue, dryRun, fieldSelector, gracePeriodSeconds, labelSelector, limit, orphanDependents, propagationPolicy, resourceVersion, timeoutSeconds, body);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling SchedulingV1Api#deleteCollectionPriorityClass");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
pretty String 如果为“true”,则输出相当打印。If 'true', then the output is pretty printed. [optional]
_continue String 从服务器检索更多结果时,应设置“继续”选项。由于此值是服务器定义的,因此客户端只能使用具有相同查询参数(continue值除外)的上一个查询结果中的continue值,服务器可能会拒绝它无法识别的continue值。如果指定的continue值因过期(通常为5到15分钟)或服务器上的配置更改而不再有效,服务器将响应410 ResourceExpired错误和continue令牌。如果客户端需要一个一致的列表,它必须在不使用continue字段的情况下重新启动它们的列表。从另一台服务器发送的结果可能与前一台服务器发送的结果不一致,但从下一台服务器发送的结果可能与前一台服务器发送的结果不一致,只要他们的钥匙在“下一个钥匙”之后。watch为true时不支持此字段。客户端可以从服务器返回的最后一个resourceVersion值开始监视,并且不会错过任何修改。The continue option should be set when retrieving more results from the server. Since this value is server defined, clients may only use the continue value from a previous query result with identical query parameters (except for the value of continue) and the server may reject a continue value it does not recognize. If the specified continue value is no longer valid whether due to expiration (generally five to fifteen minutes) or a configuration change on the server, the server will respond with a 410 ResourceExpired error together with a continue token. If the client needs a consistent list, it must restart their list without the continue field. Otherwise, the client may send another list request with the token received with the 410 error, the server will respond with a list starting from the next key, but from the latest snapshot, which is inconsistent from the previous list results - objects that are created, modified, or deleted after the first list request will be included in the response, as long as their keys are after the "next key". This field is not supported when watch is true. Clients may start a watch from the last resourceVersion value returned by the server and not miss any modifications.(except for the value of continue) and the server may reject a continue value it does not recognize. If the specified continue value is no longer valid whether due to expiration (generally five to fifteen minutes) or a configuration change on the server, the server will respond with a 410 ResourceExpired error together with a continue token. If the client needs a consistent list, it must restart their list without the continue field. Otherwise, the client may send another list request with the token received with the 410 error, the server will respond with a list starting from the next key, but from the latest snapshot, which is inconsistent from the previous list results - objects that are created, modified, or deleted after the first list request will be included in the response, as long as their keys are after the "next key". This field is not supported when watch is true. Clients may start a watch from the last resourceVersion value returned by the server and not miss any modifications. [optional]
dryRun String 如果存在,则表示不应保留修改。无效或无法识别的dryRun指令将导致错误响应,并且不会进一步处理请求。有效值为:-全部:将处理所有干运行阶段。When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed [optional]
fieldSelector String 一个选择器,用于按字段限制返回对象的列表。默认为一切。A selector to restrict the list of returned objects by their fields. Defaults to everything. [optional]
gracePeriodSeconds Integer 删除对象前的持续时间(秒)。值必须是非负整数。值为零表示立即删除。如果此值为nil,则将使用指定类型的默认宽限期。如果未指定,则默认为每对象值。零表示立即删除。The duration in seconds before the object should be deleted. Value must be non-negative integer. The value zero indicates delete immediately. If this value is nil, the default grace period for the specified type will be used. Defaults to a per object value if not specified. zero means delete immediately. [optional]
labelSelector String 一个选择器,用于根据返回对象的标签限制其列表。默认为一切。A selector to restrict the list of returned objects by their labels. Defaults to everything. [optional]
limit Integer limit是列表调用返回的最大响应数。如果存在更多项目,服务器将设置`继续`字段的值,该值可用于同一初始查询以检索下一组结果。如果所有请求的对象都被过滤掉,设置限制可能会返回少于请求数量的项目(最多为零个项目),客户端应该只使用continue字段来确定是否有更多结果可用。服务器可能会选择不支持limit参数,并将返回所有可用的结果。如果指定了limit且continue字段为空,则客户端可能会认为没有更多结果可用。如果watch为true,则不支持此字段。服务器保证在使用continue时返回的对象将与无限制地发出单个列表调用相同——也就是说,在发出第一个请求后创建、修改或删除的对象不会包含在任何后续的continue请求中。这有时被称为一致性快照,可以确保使用limit接收非常大结果的较小数据块的客户端可以确保看到所有可能的对象。如果在分块列表期间更新对象,则返回在计算第一个列表结果时存在的对象版本。 limit is a maximum number of responses to return for a list call. If more items exist, the server will set the `continue` field on the list metadata to a value that can be used with the same initial query to retrieve the next set of results. Setting a limit may return fewer than the requested amount of items (up to zero items) in the event all requested objects are filtered out and clients should only use the presence of the continue field to determine whether more results are available. Servers may choose not to support the limit argument and will return all of the available results. If limit is specified and the continue field is empty, clients may assume that no more results are available. This field is not supported if watch is true. The server guarantees that the objects returned when using continue will be identical to issuing a single list call without a limit - that is, no objects created, modified, or deleted after the first request is issued will be included in any subsequent continued requests. This is sometimes referred to as a consistent snapshot, and ensures that a client that is using limit to receive smaller chunks of a very large result can ensure they see all possible objects. If objects are updated during a chunked list the version of the object that was present at the time the first list result was calculated is returned. [optional]
orphanDependents Boolean 已弃用:请使用PropagationPolicy,此字段将在1.7中弃用。从属对象应该是孤立的吗。如果为真/假,“孤立”终结器将被添加到对象的终结器列表中或从中删除。可以设置此字段或PropagationPolicy,但不能同时设置两者。Deprecated: please use the PropagationPolicy, this field will be deprecated in 1.7. Should the dependent objects be orphaned. If true/false, the "orphan" finalizer will be added to/removed from the object's finalizers list. Either this field or PropagationPolicy may be set, but not both. [optional]
propagationPolicy String 是否以及如何执行垃圾收集。可以设置此字段或孤立从属项,但不能同时设置两者。默认策略由元数据中设置的现有终结器决定。终结器和特定于资源的默认策略。Whether and how garbage collection will be performed. Either this field or OrphanDependents may be set, but not both. The default policy is decided by the existing finalizer set in the metadata.finalizers and the resource-specific default policy. Acceptable values are: 'Orphan' - orphan the dependents; 'Background' - allow the garbage collector to delete the dependents in the background; 'Foreground' - a cascading policy that deletes all dependents in the foreground. [optional]
resourceVersion String 当通过监视调用指定时,显示在资源的特定版本之后发生的更改。默认为历史开始时的更改。为列表指定时:-如果未设置,则根据仲裁读取标志从远程存储返回结果;-如果是's 0,然后我们只返回当前缓存中的内容,不保证;-如果设置为非零,则结果至少与给定值一样新鲜。When specified with a watch call, shows changes that occur after that particular version of a resource. Defaults to changes from the beginning of history. When specified for list: - if unset, then the result is returned from remote storage based on quorum-read flag; - if it's 0, then we simply return what we currently have in cache, no guarantee; - if set to non zero, then the result is at least as fresh as given rv. [optional]
timeoutSeconds Integer 列表/监视呼叫超时。这会限制通话的持续时间,而不管通话是否处于活动状态。列表/监视呼叫超时。这会限制通话的持续时间,而不管通话是否处于活动状态。Timeout for the list/watch call. This limits the duration of the call, regardless of any activity or inactivity. [optional]
body V1DeleteOptions [optional]

Return type

V1Status

Authorization

BearerToken

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json, application/yaml, application/vnd.kubernetes.protobuf

HTTP response details

Status code Description Response headers
200 OK -
401 Unauthorized -

deletePriorityClass


回到“优先级增删改查”目录

V1Status deletePriorityClass(name, pretty, dryRun, gracePeriodSeconds, orphanDependents, propagationPolicy, body)

delete a PriorityClass

Example

// Import classes:
import io.kubernetes.client.openapi.ApiClient;
import io.kubernetes.client.openapi.ApiException;
import io.kubernetes.client.openapi.Configuration;
import io.kubernetes.client.openapi.auth.*;
import io.kubernetes.client.openapi.models.*;
import io.kubernetes.client.openapi.apis.SchedulingV1Api;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("http://localhost");
    
    // Configure API key authorization: BearerToken
    ApiKeyAuth BearerToken = (ApiKeyAuth) defaultClient.getAuthentication("BearerToken");
    BearerToken.setApiKey("YOUR API KEY");
    // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
    //BearerToken.setApiKeyPrefix("Token");

    SchedulingV1Api apiInstance = new SchedulingV1Api(defaultClient);
    String name = "name_example"; // String | name of the PriorityClass
    String pretty = "pretty_example"; // String | 如果为“true”,则输出相当打印。If 'true', then the output is pretty printed.
    String dryRun = "dryRun_example"; // String | 如果存在,则表示不应保留修改。无效或无法识别的dryRun指令将导致错误响应,并且不会进一步处理请求。有效值为:-全部:将处理所有干运行阶段。When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed
    Integer gracePeriodSeconds = 56; // Integer | 删除对象前的持续时间(秒)。值必须是非负整数。值为零表示立即删除。如果此值为nil,则将使用指定类型的默认宽限期。如果未指定,则默认为每对象值。零表示立即删除。The duration in seconds before the object should be deleted. Value must be non-negative integer. The value zero indicates delete immediately. If this value is nil, the default grace period for the specified type will be used. Defaults to a per object value if not specified. zero means delete immediately.
    Boolean orphanDependents = true; // Boolean | 已弃用:请使用PropagationPolicy,此字段将在1.7中弃用。从属对象应该是孤立的吗。如果为真/假,“孤立”终结器将被添加到对象的终结器列表中或从中删除。可以设置此字段或PropagationPolicy,但不能同时设置两者。Deprecated: please use the PropagationPolicy, this field will be deprecated in 1.7. Should the dependent objects be orphaned. If true/false, the \"orphan\" finalizer will be added to/removed from the object's finalizers list. Either this field or PropagationPolicy may be set, but not both.
    String propagationPolicy = "propagationPolicy_example"; // String | 是否以及如何执行垃圾收集。可以设置此字段或孤立从属项,但不能同时设置两者。默认策略由元数据中设置的现有终结器决定。终结器和特定于资源的默认策略。Whether and how garbage collection will be performed. Either this field or OrphanDependents may be set, but not both. The default policy is decided by the existing finalizer set in the metadata.finalizers and the resource-specific default policy. Acceptable values are: 'Orphan' - orphan the dependents; 'Background' - allow the garbage collector to delete the dependents in the background; 'Foreground' - a cascading policy that deletes all dependents in the foreground.
    V1DeleteOptions body = new V1DeleteOptions(); // V1DeleteOptions | 
    try {
      V1Status result = apiInstance.deletePriorityClass(name, pretty, dryRun, gracePeriodSeconds, orphanDependents, propagationPolicy, body);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling SchedulingV1Api#deletePriorityClass");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
name String name of the PriorityClass
pretty String 如果为“true”,则输出相当打印。If 'true', then the output is pretty printed. [optional]
dryRun String 如果存在,则表示不应保留修改。无效或无法识别的dryRun指令将导致错误响应,并且不会进一步处理请求。有效值为:-全部:将处理所有干运行阶段。When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed [optional]
gracePeriodSeconds Integer 删除对象前的持续时间(秒)。值必须是非负整数。值为零表示立即删除。如果此值为nil,则将使用指定类型的默认宽限期。如果未指定,则默认为每对象值。零表示立即删除。The duration in seconds before the object should be deleted. Value must be non-negative integer. The value zero indicates delete immediately. If this value is nil, the default grace period for the specified type will be used. Defaults to a per object value if not specified. zero means delete immediately. [optional]
orphanDependents Boolean 已弃用:请使用PropagationPolicy,此字段将在1.7中弃用。从属对象应该是孤立的吗。如果为真/假,“孤立”终结器将被添加到对象的终结器列表中或从中删除。可以设置此字段或PropagationPolicy,但不能同时设置两者。Deprecated: please use the PropagationPolicy, this field will be deprecated in 1.7. Should the dependent objects be orphaned. If true/false, the "orphan" finalizer will be added to/removed from the object's finalizers list. Either this field or PropagationPolicy may be set, but not both. [optional]
propagationPolicy String 是否以及如何执行垃圾收集。可以设置此字段或孤立从属项,但不能同时设置两者。默认策略由元数据中设置的现有终结器决定。终结器和特定于资源的默认策略。Whether and how garbage collection will be performed. Either this field or OrphanDependents may be set, but not both. The default policy is decided by the existing finalizer set in the metadata.finalizers and the resource-specific default policy. Acceptable values are: 'Orphan' - orphan the dependents; 'Background' - allow the garbage collector to delete the dependents in the background; 'Foreground' - a cascading policy that deletes all dependents in the foreground. [optional]
body V1DeleteOptions [optional]

Return type

V1Status

Authorization

BearerToken

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json, application/yaml, application/vnd.kubernetes.protobuf

HTTP response details

Status code Description Response headers
200 OK -
202 Accepted -
401 Unauthorized -

getAPIResources


回到“优先级增删改查”目录

V1APIResourceList getAPIResources()

get available resources

Example

// Import classes:
import io.kubernetes.client.openapi.ApiClient;
import io.kubernetes.client.openapi.ApiException;
import io.kubernetes.client.openapi.Configuration;
import io.kubernetes.client.openapi.auth.*;
import io.kubernetes.client.openapi.models.*;
import io.kubernetes.client.openapi.apis.SchedulingV1Api;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("http://localhost");
    
    // Configure API key authorization: BearerToken
    ApiKeyAuth BearerToken = (ApiKeyAuth) defaultClient.getAuthentication("BearerToken");
    BearerToken.setApiKey("YOUR API KEY");
    // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
    //BearerToken.setApiKeyPrefix("Token");

    SchedulingV1Api apiInstance = new SchedulingV1Api(defaultClient);
    try {
      V1APIResourceList result = apiInstance.getAPIResources();
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling SchedulingV1Api#getAPIResources");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

This endpoint does not need any parameter.

Return type

V1APIResourceList

Authorization

BearerToken

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json, application/yaml, application/vnd.kubernetes.protobuf

HTTP response details

Status code Description Response headers
200 OK -
401 Unauthorized -

listPriorityClass


回到“优先级增删改查”目录

V1PriorityClassList listPriorityClass(pretty, allowWatchBookmarks, _continue, fieldSelector, labelSelector, limit, resourceVersion, timeoutSeconds, watch)

list or watch objects of kind PriorityClass

Example

// Import classes:
import io.kubernetes.client.openapi.ApiClient;
import io.kubernetes.client.openapi.ApiException;
import io.kubernetes.client.openapi.Configuration;
import io.kubernetes.client.openapi.auth.*;
import io.kubernetes.client.openapi.models.*;
import io.kubernetes.client.openapi.apis.SchedulingV1Api;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("http://localhost");
    
    // Configure API key authorization: BearerToken
    ApiKeyAuth BearerToken = (ApiKeyAuth) defaultClient.getAuthentication("BearerToken");
    BearerToken.setApiKey("YOUR API KEY");
    // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
    //BearerToken.setApiKeyPrefix("Token");

    SchedulingV1Api apiInstance = new SchedulingV1Api(defaultClient);
    String pretty = "pretty_example"; // String | 如果为“true”,则输出相当打印。If 'true', then the output is pretty printed.
    Boolean allowWatchBookmarks = true; // Boolean | allowWatchBookmarks请求观看类型为“的事件;书签"。未实现书签的服务器可能会忽略此标志,书签会在服务器上发送'这是自由裁量权。客户端不应假定书签是在任何特定的时间间隔返回的,也不应假定服务器将在会话期间发送任何书签事件。如果这不是手表,则忽略此字段。如果apiserver中未启用功能gate WatchBookmarks,则忽略此字段。allowWatchBookmarks requests watch events with type \"BOOKMARK\". Servers that do not implement bookmarks may ignore this flag and bookmarks are sent at the server's discretion. Clients should not assume bookmarks are returned at any specific interval, nor may they assume the server will send any BOOKMARK event during a session. If this is not a watch, this field is ignored. If the feature gate WatchBookmarks is not enabled in apiserver, this field is ignored.
    String _continue = "_continue_example"; // String | 从服务器检索更多结果时,应设置“继续”选项。由于此值是服务器定义的,因此客户端只能使用具有相同查询参数(continue值除外)的上一个查询结果中的continue值,服务器可能会拒绝它无法识别的continue值。如果指定的continue值因过期(通常为5到15分钟)或服务器上的配置更改而不再有效,服务器将响应410 ResourceExpired错误和continue令牌。如果客户端需要一个一致的列表,它必须在不使用continue字段的情况下重新启动它们的列表。从另一台服务器发送的结果可能与前一台服务器发送的结果不一致,但从下一台服务器发送的结果可能与前一台服务器发送的结果不一致,只要他们的钥匙在“下一个钥匙”之后。watch为true时不支持此字段。客户端可以从服务器返回的最后一个resourceVersion值开始监视,并且不会错过任何修改。The continue option should be set when retrieving more results from the server. Since this value is server defined, clients may only use the continue value from a previous query result with identical query parameters (except for the value of continue) and the server may reject a continue value it does not recognize. If the specified continue value is no longer valid whether due to expiration (generally five to fifteen minutes) or a configuration change on the server, the server will respond with a 410 ResourceExpired error together with a continue token. If the client needs a consistent list, it must restart their list without the continue field. Otherwise, the client may send another list request with the token received with the 410 error, the server will respond with a list starting from the next key, but from the latest snapshot, which is inconsistent from the previous list results - objects that are created, modified, or deleted after the first list request will be included in the response, as long as their keys are after the "next key".  This field is not supported when watch is true. Clients may start a watch from the last resourceVersion value returned by the server and not miss any modifications.(except for the value of continue) and the server may reject a continue value it does not recognize. If the specified continue value is no longer valid whether due to expiration (generally five to fifteen minutes) or a configuration change on the server, the server will respond with a 410 ResourceExpired error together with a continue token. If the client needs a consistent list, it must restart their list without the continue field. Otherwise, the client may send another list request with the token received with the 410 error, the server will respond with a list starting from the next key, but from the latest snapshot, which is inconsistent from the previous list results - objects that are created, modified, or deleted after the first list request will be included in the response, as long as their keys are after the \"next key\".  This field is not supported when watch is true. Clients may start a watch from the last resourceVersion value returned by the server and not miss any modifications.
    String fieldSelector = "fieldSelector_example"; // String | 一个选择器,用于按字段限制返回对象的列表。默认为一切。A selector to restrict the list of returned objects by their fields. Defaults to everything.
    String labelSelector = "labelSelector_example"; // String | 一个选择器,用于根据返回对象的标签限制其列表。默认为一切。A selector to restrict the list of returned objects by their labels. Defaults to everything.
    Integer limit = 56; // Integer | limit是列表调用返回的最大响应数。如果存在更多项,服务器会将列表元数据上的“continue”字段设置为一个值,该值可用于同一初始查询,以检索下一组结果。如果所有请求的对象都被过滤掉,设置限制可能会返回少于请求数量的项目(最多为零个项目),客户端应该只使用continue字段来确定是否有更多结果可用。服务器可能会选择不支持limit参数,并将返回所有可用的结果。如果指定了limit且continue字段为空,则客户端可能会认为没有更多结果可用。如果watch为true,则不支持此字段。服务器保证在使用continue时返回的对象将与无限制地发出单个列表调用相同——也就是说,在发出第一个请求后创建、修改或删除的对象不会包含在任何后续的continue请求中。这有时被称为一致性快照,可以确保使用limit接收非常大结果的较小数据块的客户端可以确保看到所有可能的对象。如果在分块列表期间更新对象,则返回在计算第一个列表结果时存在的对象版本。limit is a maximum number of responses to return for a list call. If more items exist, the server will set the `continue` field on the list metadata to a value that can be used with the same initial query to retrieve the next set of results. Setting a limit may return fewer than the requested amount of items (up to zero items) in the event all requested objects are filtered out and clients should only use the presence of the continue field to determine whether more results are available. Servers may choose not to support the limit argument and will return all of the available results. If limit is specified and the continue field is empty, clients may assume that no more results are available. This field is not supported if watch is true.  The server guarantees that the objects returned when using continue will be identical to issuing a single list call without a limit - that is, no objects created, modified, or deleted after the first request is issued will be included in any subsequent continued requests. This is sometimes referred to as a consistent snapshot, and ensures that a client that is using limit to receive smaller chunks of a very large result can ensure they see all possible objects. If objects are updated during a chunked list the version of the object that was present at the time the first list result was calculated is returned.
    String resourceVersion = "resourceVersion_example"; // String | 当通过监视调用指定时,显示在资源的特定版本之后发生的更改。默认为历史开始时的更改。为列表指定时:-如果未设置,则根据仲裁读取标志从远程存储返回结果;-如果是0,那么我们只返回当前缓存中的内容,不保证;-如果设置为非零,则结果至少与给定值一样新鲜When specified with a watch call, shows changes that occur after that particular version of a resource. Defaults to changes from the beginning of history. When specified for list: - if unset, then the result is returned from remote storage based on quorum-read flag; - if it's 0, then we simply return what we currently have in cache, no guarantee; - if set to non zero, then the result is at least as fresh as given rv.
    Integer timeoutSeconds = 56; // Integer | 列表/监视呼叫超时。这会限制通话的持续时间,而不管通话是否处于活动状态。列表/监视呼叫超时。这会限制通话的持续时间,而不管通话是否处于活动状态。Timeout for the list/watch call. This limits the duration of the call, regardless of any activity or inactivity.
    Boolean watch = true; // Boolean | 观察对所描述资源的更改,并将其作为添加、更新和删除通知流返回。指定resourceVersion。观察对所描述资源的更改,并将其作为添加、更新和删除通知流返回。Watch for changes to the described resources and return them as a stream of add, update, and remove notifications. Specify resourceVersion.
    try {
      V1PriorityClassList result = apiInstance.listPriorityClass(pretty, allowWatchBookmarks, _continue, fieldSelector, labelSelector, limit, resourceVersion, timeoutSeconds, watch);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling SchedulingV1Api#listPriorityClass");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
pretty String 如果为“true”,则输出相当打印。If 'true', then the output is pretty printed. [optional]
allowWatchBookmarks Boolean allowWatchBookmarks请求观看类型为“的事件;书签"。未实现书签的服务器可能会忽略此标志,书签会在服务器上发送'这是自由裁量权。客户端不应假定书签是在任何特定的时间间隔返回的,也不应假定服务器将在会话期间发送任何书签事件。如果这不是手表,则忽略此字段。如果apiserver中未启用功能gate WatchBookmarks,则忽略此字段。allowWatchBookmarks requests watch events with type "BOOKMARK". Servers that do not implement bookmarks may ignore this flag and bookmarks are sent at the server's discretion. Clients should not assume bookmarks are returned at any specific interval, nor may they assume the server will send any BOOKMARK event during a session. If this is not a watch, this field is ignored. If the feature gate WatchBookmarks is not enabled in apiserver, this field is ignored. [optional]
_continue String 从服务器检索更多结果时,应设置“继续”选项。由于此值是服务器定义的,因此客户端只能使用具有相同查询参数(continue值除外)的上一个查询结果中的continue值,服务器可能会拒绝它无法识别的continue值。如果指定的continue值因过期(通常为5到15分钟)或服务器上的配置更改而不再有效,服务器将响应410 ResourceExpired错误和continue令牌。如果客户端需要一个一致的列表,它必须在不使用continue字段的情况下重新启动它们的列表。从另一台服务器发送的结果可能与前一台服务器发送的结果不一致,但从下一台服务器发送的结果可能与前一台服务器发送的结果不一致,只要他们的钥匙在“下一个钥匙”之后。watch为true时不支持此字段。客户端可以从服务器返回的最后一个resourceVersion值开始监视,并且不会错过任何修改。The continue option should be set when retrieving more results from the server. Since this value is server defined, clients may only use the continue value from a previous query result with identical query parameters (except for the value of continue) and the server may reject a continue value it does not recognize. If the specified continue value is no longer valid whether due to expiration (generally five to fifteen minutes) or a configuration change on the server, the server will respond with a 410 ResourceExpired error together with a continue token. If the client needs a consistent list, it must restart their list without the continue field. Otherwise, the client may send another list request with the token received with the 410 error, the server will respond with a list starting from the next key, but from the latest snapshot, which is inconsistent from the previous list results - objects that are created, modified, or deleted after the first list request will be included in the response, as long as their keys are after the "next key". This field is not supported when watch is true. Clients may start a watch from the last resourceVersion value returned by the server and not miss any modifications.(except for the value of continue) and the server may reject a continue value it does not recognize. If the specified continue value is no longer valid whether due to expiration (generally five to fifteen minutes) or a configuration change on the server, the server will respond with a 410 ResourceExpired error together with a continue token. If the client needs a consistent list, it must restart their list without the continue field. Otherwise, the client may send another list request with the token received with the 410 error, the server will respond with a list starting from the next key, but from the latest snapshot, which is inconsistent from the previous list results - objects that are created, modified, or deleted after the first list request will be included in the response, as long as their keys are after the "next key". This field is not supported when watch is true. Clients may start a watch from the last resourceVersion value returned by the server and not miss any modifications. [optional]
fieldSelector String 一个选择器,用于按字段限制返回对象的列表。默认为一切。A selector to restrict the list of returned objects by their fields. Defaults to everything. [optional]
labelSelector String 一个选择器,用于根据返回对象的标签限制其列表。默认为一切。A selector to restrict the list of returned objects by their labels. Defaults to everything. [optional]
limit Integer limit是列表调用返回的最大响应数。如果存在更多项目,服务器将设置`继续`字段的值,该值可用于同一初始查询以检索下一组结果。如果所有请求的对象都被过滤掉,设置限制可能会返回少于请求数量的项目(最多为零个项目),客户端应该只使用continue字段来确定是否有更多结果可用。服务器可能会选择不支持limit参数,并将返回所有可用的结果。如果指定了limit且continue字段为空,则客户端可能会认为没有更多结果可用。如果watch为true,则不支持此字段。服务器保证在使用continue时返回的对象将与无限制地发出单个列表调用相同——也就是说,在发出第一个请求后创建、修改或删除的对象不会包含在任何后续的continue请求中。这有时被称为一致性快照,可以确保使用limit接收非常大结果的较小数据块的客户端可以确保看到所有可能的对象。如果在分块列表期间更新对象,则返回在计算第一个列表结果时存在的对象版本。 limit is a maximum number of responses to return for a list call. If more items exist, the server will set the `continue` field on the list metadata to a value that can be used with the same initial query to retrieve the next set of results. Setting a limit may return fewer than the requested amount of items (up to zero items) in the event all requested objects are filtered out and clients should only use the presence of the continue field to determine whether more results are available. Servers may choose not to support the limit argument and will return all of the available results. If limit is specified and the continue field is empty, clients may assume that no more results are available. This field is not supported if watch is true. The server guarantees that the objects returned when using continue will be identical to issuing a single list call without a limit - that is, no objects created, modified, or deleted after the first request is issued will be included in any subsequent continued requests. This is sometimes referred to as a consistent snapshot, and ensures that a client that is using limit to receive smaller chunks of a very large result can ensure they see all possible objects. If objects are updated during a chunked list the version of the object that was present at the time the first list result was calculated is returned. [optional]
resourceVersion String 当通过监视调用指定时,显示在资源的特定版本之后发生的更改。默认为历史开始时的更改。为列表指定时:-如果未设置,则根据仲裁读取标志从远程存储返回结果;-如果是's 0,然后我们只返回当前缓存中的内容,不保证;-如果设置为非零,则结果至少与给定值一样新鲜。When specified with a watch call, shows changes that occur after that particular version of a resource. Defaults to changes from the beginning of history. When specified for list: - if unset, then the result is returned from remote storage based on quorum-read flag; - if it's 0, then we simply return what we currently have in cache, no guarantee; - if set to non zero, then the result is at least as fresh as given rv. [optional]
timeoutSeconds Integer 列表/监视呼叫超时。这会限制通话的持续时间,而不管通话是否处于活动状态。列表/监视呼叫超时。这会限制通话的持续时间,而不管通话是否处于活动状态。Timeout for the list/watch call. This limits the duration of the call, regardless of any activity or inactivity. [optional]
watch Boolean 观察对所描述资源的更改,并将其作为添加、更新和删除通知流返回。指定resourceVersion。观察对所描述资源的更改,并将其作为添加、更新和删除通知流返回。Watch for changes to the described resources and return them as a stream of add, update, and remove notifications. Specify resourceVersion. [optional]

Return type

V1PriorityClassList

Authorization

BearerToken

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json, application/yaml, application/vnd.kubernetes.protobuf, application/json;stream=watch, application/vnd.kubernetes.protobuf;stream=watch

HTTP response details

Status code Description Response headers
200 OK -
401 Unauthorized -

patchPriorityClass


回到“优先级增删改查”目录

V1PriorityClass patchPriorityClass(name, body, pretty, dryRun, fieldManager, force)

partially update the specified PriorityClass

Example

// Import classes:
import io.kubernetes.client.openapi.ApiClient;
import io.kubernetes.client.openapi.ApiException;
import io.kubernetes.client.openapi.Configuration;
import io.kubernetes.client.openapi.auth.*;
import io.kubernetes.client.openapi.models.*;
import io.kubernetes.client.openapi.apis.SchedulingV1Api;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("http://localhost");
    
    // Configure API key authorization: BearerToken
    ApiKeyAuth BearerToken = (ApiKeyAuth) defaultClient.getAuthentication("BearerToken");
    BearerToken.setApiKey("YOUR API KEY");
    // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
    //BearerToken.setApiKeyPrefix("Token");

    SchedulingV1Api apiInstance = new SchedulingV1Api(defaultClient);
    String name = "name_example"; // String | name of the PriorityClass
    V1Patch body = new V1Patch(); // V1Patch | 
    String pretty = "pretty_example"; // String | 如果为“true”,则输出相当打印。If 'true', then the output is pretty printed.
    String dryRun = "dryRun_example"; // String | 如果存在,则表示不应保留修改。无效或无法识别的dryRun指令将导致错误响应,并且不会进一步处理请求。有效值为:-全部:将处理所有干运行阶段。When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed
    String fieldManager = "fieldManager_example"; // String |  fieldManager是与进行这些更改的参与者或实体关联的名称。该值的长度必须小于或128个字符,并且仅包含可打印字符,如https://golang.org/pkg/unicode/#IsPrint.fieldManager is a name associated with the actor or entity that is making these changes. The value must be less than or 128 characters long, and only contain printable characters, as defined by https://golang.org/pkg/unicode/#IsPrint. This field is required for apply requests (application/apply-patch) but optional for non-apply patch types (JsonPatch, MergePatch, StrategicMergePatch).
    Boolean force = true; // Boolean | Force将“强制”应用请求。这意味着用户将重新获取其他人拥有的冲突字段。对于非应用补丁请求,必须取消设置强制标志。Force is going to \"force\" Apply requests. It means user will re-acquire conflicting fields owned by other people. Force flag must be unset for non-apply patch requests.
    try {
      V1PriorityClass result = apiInstance.patchPriorityClass(name, body, pretty, dryRun, fieldManager, force);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling SchedulingV1Api#patchPriorityClass");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
name String name of the PriorityClass
body V1Patch
pretty String 如果为“true”,则输出相当打印。If 'true', then the output is pretty printed. [optional]
dryRun String 如果存在,则表示不应保留修改。无效或无法识别的dryRun指令将导致错误响应,并且不会进一步处理请求。有效值为:-全部:将处理所有干运行阶段。When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed [optional]
fieldManager String fieldManager是与进行这些更改的参与者或实体关联的名称。该值的长度必须小于或128个字符,并且仅包含可打印字符,如https://golang.org/pkg/unicode/#IsPrint.fieldManager is a name associated with the actor or entity that is making these changes. The value must be less than or 128 characters long, and only contain printable characters, as defined by https://golang.org/pkg/unicode/#IsPrint. This field is required for apply requests (application/apply-patch) but optional for non-apply patch types (JsonPatch, MergePatch, StrategicMergePatch). [optional]
force Boolean Force将“强制”应用请求。这意味着用户将重新获取其他人拥有的冲突字段。对于非应用补丁请求,必须取消设置强制标志。Force is going to "force" Apply requests. It means user will re-acquire conflicting fields owned by other people. Force flag must be unset for non-apply patch requests. [optional]

Return type

V1PriorityClass

Authorization

BearerToken

HTTP request headers

  • Content-Type: application/json-patch+json, application/merge-patch+json, application/strategic-merge-patch+json, application/apply-patch+yaml
  • Accept: application/json, application/yaml, application/vnd.kubernetes.protobuf

HTTP response details

Status code Description Response headers
200 OK -
401 Unauthorized -

readPriorityClass


回到“优先级增删改查”目录

V1PriorityClass readPriorityClass(name, pretty, exact, export)

read the specified PriorityClass

Example

// Import classes:
import io.kubernetes.client.openapi.ApiClient;
import io.kubernetes.client.openapi.ApiException;
import io.kubernetes.client.openapi.Configuration;
import io.kubernetes.client.openapi.auth.*;
import io.kubernetes.client.openapi.models.*;
import io.kubernetes.client.openapi.apis.SchedulingV1Api;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("http://localhost");
    
    // Configure API key authorization: BearerToken
    ApiKeyAuth BearerToken = (ApiKeyAuth) defaultClient.getAuthentication("BearerToken");
    BearerToken.setApiKey("YOUR API KEY");
    // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
    //BearerToken.setApiKeyPrefix("Token");

    SchedulingV1Api apiInstance = new SchedulingV1Api(defaultClient);
    String name = "name_example"; // String | name of the PriorityClass
    String pretty = "pretty_example"; // String | 如果为“true”,则输出相当打印。If 'true', then the output is pretty printed.
    Boolean exact = true; // Boolean | 出口应该是准确的。Exact export维护特定于集群的字段,如“Namespace”。不赞成。计划于1.18年拆除。Should the export be exact.  Exact export maintains cluster-specific fields like 'Namespace'. Deprecated. Planned for removal in 1.18.
    Boolean export = true; // Boolean | 应该将该值导出。导出用户无法指定的字段。不赞成。计划于1.18年拆除。Should this value be exported.  Export strips fields that a user can not specify. Deprecated. Planned for removal in 1.18.
    try {
      V1PriorityClass result = apiInstance.readPriorityClass(name, pretty, exact, export);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling SchedulingV1Api#readPriorityClass");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
name String name of the PriorityClass
pretty String 如果为“true”,则输出相当打印。If 'true', then the output is pretty printed. [optional]
exact Boolean Should the export be exact. Exact export maintains cluster-specific fields like 'Namespace'. Deprecated. Planned for removal in 1.18. [optional]
export Boolean 应该将该值导出。导出用户无法指定的字段。不赞成。计划于1.18年拆除。Should this value be exported. Export strips fields that a user can not specify. Deprecated. Planned for removal in 1.18. [optional]

Return type

V1PriorityClass

Authorization

BearerToken

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json, application/yaml, application/vnd.kubernetes.protobuf

HTTP response details

Status code Description Response headers
200 OK -
401 Unauthorized -

replacePriorityClass


回到“优先级增删改查”目录

V1PriorityClass replacePriorityClass(name, body, pretty, dryRun, fieldManager)

replace the specified PriorityClass

Example

// Import classes:
import io.kubernetes.client.openapi.ApiClient;
import io.kubernetes.client.openapi.ApiException;
import io.kubernetes.client.openapi.Configuration;
import io.kubernetes.client.openapi.auth.*;
import io.kubernetes.client.openapi.models.*;
import io.kubernetes.client.openapi.apis.SchedulingV1Api;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("http://localhost");
    
    // Configure API key authorization: BearerToken
    ApiKeyAuth BearerToken = (ApiKeyAuth) defaultClient.getAuthentication("BearerToken");
    BearerToken.setApiKey("YOUR API KEY");
    // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
    //BearerToken.setApiKeyPrefix("Token");

    SchedulingV1Api apiInstance = new SchedulingV1Api(defaultClient);
    String name = "name_example"; // String | name of the PriorityClass
    V1PriorityClass body = new V1PriorityClass(); // V1PriorityClass | 
    String pretty = "pretty_example"; // String | 如果为“true”,则输出相当打印。If 'true', then the output is pretty printed.
    String dryRun = "dryRun_example"; // String | 如果存在,则表示不应保留修改。无效或无法识别的dryRun指令将导致错误响应,并且不会进一步处理请求。有效值为:-全部:将处理所有干运行阶段。When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed
    String fieldManager = "fieldManager_example"; // String |  fieldManager是与进行这些更改的参与者或实体关联的名称。该值的长度必须小于或128个字符,并且仅包含可打印字符,如https://golang.org/pkg/unicode/#IsPrint.fieldManager is a name associated with the actor or entity that is making these changes. The value must be less than or 128 characters long, and only contain printable characters, as defined by https://golang.org/pkg/unicode/#IsPrint.
    try {
      V1PriorityClass result = apiInstance.replacePriorityClass(name, body, pretty, dryRun, fieldManager);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling SchedulingV1Api#replacePriorityClass");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
name String name of the PriorityClass
body V1PriorityClass
pretty String 如果为“true”,则输出相当打印。If 'true', then the output is pretty printed. [optional]
dryRun String 如果存在,则表示不应保留修改。无效或无法识别的dryRun指令将导致错误响应,并且不会进一步处理请求。有效值为:-全部:将处理所有干运行阶段。When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed [optional]
fieldManager String fieldManager是与进行这些更改的参与者或实体关联的名称。该值的长度必须小于或128个字符,并且仅包含可打印字符,如https://golang.org/pkg/unicode/#IsPrint.fieldManager is a name associated with the actor or entity that is making these changes. The value must be less than or 128 characters long, and only contain printable characters, as defined by https://golang.org/pkg/unicode/#IsPrint. [optional]

Return type

V1PriorityClass

Authorization

BearerToken

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json, application/yaml, application/vnd.kubernetes.protobuf

HTTP response details

Status code Description Response headers
200 OK -
201 Created -
401 Unauthorized -

Deployment增删改查


回到K8sAPI根目录

All URIs are relative to http://localhost

Method HTTP request Description
createNamespacedDeployment POST /apis/apps/v1/namespaces/{namespace}/deployments 创建应用
deleteCollectionNamespacedDeployment DELETE /apis/apps/v1/namespaces/{namespace}/deployments 删除多个应用
deleteNamespacedDeployment DELETE /apis/apps/v1/namespaces/{namespace}/deployments/ 删除应用
listNamespacedDeployment GET /apis/apps/v1/namespaces/{namespace}/deployments 应用列表
patchNamespacedDeployment PATCH /apis/apps/v1/namespaces/{namespace}/deployments/ 更新应用
readNamespacedDeployment GET /apis/apps/v1/namespaces/{namespace}/deployments/ 查询指定应用
replaceNamespacedDeployment PUT /apis/apps/v1/namespaces/{namespace}/deployments/ 替换指定应用内容

createNamespacedDeployment


回到“Deployment增删改查”目录

V1Deployment createNamespacedDeployment(namespace, body, pretty, dryRun, fieldManager)

create a Deployment

Example

// Import classes:
import io.kubernetes.client.openapi.ApiClient;
import io.kubernetes.client.openapi.ApiException;
import io.kubernetes.client.openapi.Configuration;
import io.kubernetes.client.openapi.auth.*;
import io.kubernetes.client.openapi.models.*;
import io.kubernetes.client.openapi.apis.AppsV1Api;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("http://localhost");
    
    // Configure API key authorization: BearerToken
    ApiKeyAuth BearerToken = (ApiKeyAuth) defaultClient.getAuthentication("BearerToken");
    BearerToken.setApiKey("YOUR API KEY");
    // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
    //BearerToken.setApiKeyPrefix("Token");

    AppsV1Api apiInstance = new AppsV1Api(defaultClient);
    String namespace = "namespace_example"; // String | 对象名称和身份验证范围,例如团队和项目。object name and auth scope, such as for teams and projects
    V1Deployment body = new V1Deployment(); // V1Deployment | 
    String pretty = "pretty_example"; // String | 如果为“true”,则输出相当打印。If 'true', then the output is pretty printed.
    String dryRun = "dryRun_example"; // String | 如果存在,则表示不应保留修改。无效或无法识别的dryRun指令将导致错误响应,并且不会进一步处理请求。有效值为:-全部:将处理所有干运行阶段。When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed
    String fieldManager = "fieldManager_example"; // String |  fieldManager是与进行这些更改的参与者或实体关联的名称。该值的长度必须小于或128个字符,并且仅包含可打印字符,如https://golang.org/pkg/unicode/#IsPrint.fieldManager is a name associated with the actor or entity that is making these changes. The value must be less than or 128 characters long, and only contain printable characters, as defined by https://golang.org/pkg/unicode/#IsPrint.
    try {
      V1Deployment result = apiInstance.createNamespacedDeployment(namespace, body, pretty, dryRun, fieldManager);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling AppsV1Api#createNamespacedDeployment");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
namespace String 对象名称和身份验证范围,例如团队和项目。object name and auth scope, such as for teams and projects
body V1Deployment
pretty String 如果为“true”,则输出相当打印。If 'true', then the output is pretty printed. [optional]
dryRun String 如果存在,则表示不应保留修改。无效或无法识别的dryRun指令将导致错误响应,并且不会进一步处理请求。有效值为:-全部:将处理所有干运行阶段。When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed [optional]
fieldManager String fieldManager是与进行这些更改的参与者或实体关联的名称。该值的长度必须小于或128个字符,并且仅包含可打印字符,如https://golang.org/pkg/unicode/#IsPrint.fieldManager is a name associated with the actor or entity that is making these changes. The value must be less than or 128 characters long, and only contain printable characters, as defined by https://golang.org/pkg/unicode/#IsPrint. [optional]

Return type

V1Deployment

Authorization

BearerToken

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json, application/yaml, application/vnd.kubernetes.protobuf

HTTP response details

Status code Description Response headers
200 OK -
201 Created -
202 Accepted -
401 Unauthorized -

deleteCollectionNamespacedDeployment


回到“Deployment增删改查”目录

V1Status deleteCollectionNamespacedDeployment(namespace, pretty, _continue, dryRun, fieldSelector, gracePeriodSeconds, labelSelector, limit, orphanDependents, propagationPolicy, resourceVersion, timeoutSeconds, body)

delete collection of Deployment

Example

// Import classes:
import io.kubernetes.client.openapi.ApiClient;
import io.kubernetes.client.openapi.ApiException;
import io.kubernetes.client.openapi.Configuration;
import io.kubernetes.client.openapi.auth.*;
import io.kubernetes.client.openapi.models.*;
import io.kubernetes.client.openapi.apis.AppsV1Api;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("http://localhost");
    
    // Configure API key authorization: BearerToken
    ApiKeyAuth BearerToken = (ApiKeyAuth) defaultClient.getAuthentication("BearerToken");
    BearerToken.setApiKey("YOUR API KEY");
    // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
    //BearerToken.setApiKeyPrefix("Token");

    AppsV1Api apiInstance = new AppsV1Api(defaultClient);
    String namespace = "namespace_example"; // String | 对象名称和身份验证范围,例如团队和项目。object name and auth scope, such as for teams and projects
    String pretty = "pretty_example"; // String | 如果为“true”,则输出相当打印。If 'true', then the output is pretty printed.
    String _continue = "_continue_example"; // String | 从服务器检索更多结果时,应设置“继续”选项。由于此值是服务器定义的,因此客户端只能使用具有相同查询参数(continue值除外)的上一个查询结果中的continue值,服务器可能会拒绝它无法识别的continue值。如果指定的continue值因过期(通常为5到15分钟)或服务器上的配置更改而不再有效,服务器将响应410 ResourceExpired错误和continue令牌。如果客户端需要一个一致的列表,它必须在不使用continue字段的情况下重新启动它们的列表。从另一台服务器发送的结果可能与前一台服务器发送的结果不一致,但从下一台服务器发送的结果可能与前一台服务器发送的结果不一致,只要他们的钥匙在“下一个钥匙”之后。watch为true时不支持此字段。客户端可以从服务器返回的最后一个resourceVersion值开始监视,并且不会错过任何修改。The continue option should be set when retrieving more results from the server. Since this value is server defined, clients may only use the continue value from a previous query result with identical query parameters (except for the value of continue) and the server may reject a continue value it does not recognize. If the specified continue value is no longer valid whether due to expiration (generally five to fifteen minutes) or a configuration change on the server, the server will respond with a 410 ResourceExpired error together with a continue token. If the client needs a consistent list, it must restart their list without the continue field. Otherwise, the client may send another list request with the token received with the 410 error, the server will respond with a list starting from the next key, but from the latest snapshot, which is inconsistent from the previous list results - objects that are created, modified, or deleted after the first list request will be included in the response, as long as their keys are after the "next key".  This field is not supported when watch is true. Clients may start a watch from the last resourceVersion value returned by the server and not miss any modifications.(except for the value of continue) and the server may reject a continue value it does not recognize. If the specified continue value is no longer valid whether due to expiration (generally five to fifteen minutes) or a configuration change on the server, the server will respond with a 410 ResourceExpired error together with a continue token. If the client needs a consistent list, it must restart their list without the continue field. Otherwise, the client may send another list request with the token received with the 410 error, the server will respond with a list starting from the next key, but from the latest snapshot, which is inconsistent from the previous list results - objects that are created, modified, or deleted after the first list request will be included in the response, as long as their keys are after the \"next key\".  This field is not supported when watch is true. Clients may start a watch from the last resourceVersion value returned by the server and not miss any modifications.
    String dryRun = "dryRun_example"; // String | 如果存在,则表示不应保留修改。无效或无法识别的dryRun指令将导致错误响应,并且不会进一步处理请求。有效值为:-全部:将处理所有干运行阶段。When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed
    String fieldSelector = "fieldSelector_example"; // String | 一个选择器,用于按字段限制返回对象的列表。默认为一切。A selector to restrict the list of returned objects by their fields. Defaults to everything.
    Integer gracePeriodSeconds = 56; // Integer | 删除对象前的持续时间(秒)。值必须是非负整数。值为零表示立即删除。如果此值为nil,则将使用指定类型的默认宽限期。如果未指定,则默认为每对象值。零表示立即删除。The duration in seconds before the object should be deleted. Value must be non-negative integer. The value zero indicates delete immediately. If this value is nil, the default grace period for the specified type will be used. Defaults to a per object value if not specified. zero means delete immediately.
    String labelSelector = "labelSelector_example"; // String | 一个选择器,用于根据返回对象的标签限制其列表。默认为一切。A selector to restrict the list of returned objects by their labels. Defaults to everything.
    Integer limit = 56; // Integer | limit是列表调用返回的最大响应数。如果存在更多项,服务器会将列表元数据上的“continue”字段设置为一个值,该值可用于同一初始查询,以检索下一组结果。如果所有请求的对象都被过滤掉,设置限制可能会返回少于请求数量的项目(最多为零个项目),客户端应该只使用continue字段来确定是否有更多结果可用。服务器可能会选择不支持limit参数,并将返回所有可用的结果。如果指定了limit且continue字段为空,则客户端可能会认为没有更多结果可用。如果watch为true,则不支持此字段。服务器保证在使用continue时返回的对象将与无限制地发出单个列表调用相同——也就是说,在发出第一个请求后创建、修改或删除的对象不会包含在任何后续的continue请求中。这有时被称为一致性快照,可以确保使用limit接收非常大结果的较小数据块的客户端可以确保看到所有可能的对象。如果在分块列表期间更新对象,则返回在计算第一个列表结果时存在的对象版本。limit is a maximum number of responses to return for a list call. If more items exist, the server will set the `continue` field on the list metadata to a value that can be used with the same initial query to retrieve the next set of results. Setting a limit may return fewer than the requested amount of items (up to zero items) in the event all requested objects are filtered out and clients should only use the presence of the continue field to determine whether more results are available. Servers may choose not to support the limit argument and will return all of the available results. If limit is specified and the continue field is empty, clients may assume that no more results are available. This field is not supported if watch is true.  The server guarantees that the objects returned when using continue will be identical to issuing a single list call without a limit - that is, no objects created, modified, or deleted after the first request is issued will be included in any subsequent continued requests. This is sometimes referred to as a consistent snapshot, and ensures that a client that is using limit to receive smaller chunks of a very large result can ensure they see all possible objects. If objects are updated during a chunked list the version of the object that was present at the time the first list result was calculated is returned.
    Boolean orphanDependents = true; // Boolean | 已弃用:请使用PropagationPolicy,此字段将在1.7中弃用。从属对象应该是孤立的吗。如果为真/假,“孤立”终结器将被添加到对象的终结器列表中或从中删除。可以设置此字段或PropagationPolicy,但不能同时设置两者。Deprecated: please use the PropagationPolicy, this field will be deprecated in 1.7. Should the dependent objects be orphaned. If true/false, the \"orphan\" finalizer will be added to/removed from the object's finalizers list. Either this field or PropagationPolicy may be set, but not both.
    String propagationPolicy = "propagationPolicy_example"; // String | 是否以及如何执行垃圾收集。可以设置此字段或孤立从属项,但不能同时设置两者。默认策略由元数据中设置的现有终结器决定。终结器和特定于资源的默认策略。Whether and how garbage collection will be performed. Either this field or OrphanDependents may be set, but not both. The default policy is decided by the existing finalizer set in the metadata.finalizers and the resource-specific default policy. Acceptable values are: 'Orphan' - orphan the dependents; 'Background' - allow the garbage collector to delete the dependents in the background; 'Foreground' - a cascading policy that deletes all dependents in the foreground.
    String resourceVersion = "resourceVersion_example"; // String | 当通过监视调用指定时,显示在资源的特定版本之后发生的更改。默认为历史开始时的更改。为列表指定时:-如果未设置,则根据仲裁读取标志从远程存储返回结果;-如果是0,那么我们只返回当前缓存中的内容,不保证;-如果设置为非零,则结果至少与给定值一样新鲜When specified with a watch call, shows changes that occur after that particular version of a resource. Defaults to changes from the beginning of history. When specified for list: - if unset, then the result is returned from remote storage based on quorum-read flag; - if it's 0, then we simply return what we currently have in cache, no guarantee; - if set to non zero, then the result is at least as fresh as given rv.
    Integer timeoutSeconds = 56; // Integer | 列表/监视呼叫超时。这会限制通话的持续时间,而不管通话是否处于活动状态。列表/监视呼叫超时。这会限制通话的持续时间,而不管通话是否处于活动状态。Timeout for the list/watch call. This limits the duration of the call, regardless of any activity or inactivity.
    V1DeleteOptions body = new V1DeleteOptions(); // V1DeleteOptions | 
    try {
      V1Status result = apiInstance.deleteCollectionNamespacedDeployment(namespace, pretty, _continue, dryRun, fieldSelector, gracePeriodSeconds, labelSelector, limit, orphanDependents, propagationPolicy, resourceVersion, timeoutSeconds, body);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling AppsV1Api#deleteCollectionNamespacedDeployment");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
namespace String 对象名称和身份验证范围,例如团队和项目。object name and auth scope, such as for teams and projects
pretty String 如果为“true”,则输出相当打印。If 'true', then the output is pretty printed. [optional]
_continue String 从服务器检索更多结果时,应设置“继续”选项。由于此值是服务器定义的,因此客户端只能使用具有相同查询参数(continue值除外)的上一个查询结果中的continue值,服务器可能会拒绝它无法识别的continue值。如果指定的continue值因过期(通常为5到15分钟)或服务器上的配置更改而不再有效,服务器将响应410 ResourceExpired错误和continue令牌。如果客户端需要一个一致的列表,它必须在不使用continue字段的情况下重新启动它们的列表。从另一台服务器发送的结果可能与前一台服务器发送的结果不一致,但从下一台服务器发送的结果可能与前一台服务器发送的结果不一致,只要他们的钥匙在“下一个钥匙”之后。watch为true时不支持此字段。客户端可以从服务器返回的最后一个resourceVersion值开始监视,并且不会错过任何修改。The continue option should be set when retrieving more results from the server. Since this value is server defined, clients may only use the continue value from a previous query result with identical query parameters (except for the value of continue) and the server may reject a continue value it does not recognize. If the specified continue value is no longer valid whether due to expiration (generally five to fifteen minutes) or a configuration change on the server, the server will respond with a 410 ResourceExpired error together with a continue token. If the client needs a consistent list, it must restart their list without the continue field. Otherwise, the client may send another list request with the token received with the 410 error, the server will respond with a list starting from the next key, but from the latest snapshot, which is inconsistent from the previous list results - objects that are created, modified, or deleted after the first list request will be included in the response, as long as their keys are after the "next key". This field is not supported when watch is true. Clients may start a watch from the last resourceVersion value returned by the server and not miss any modifications.(except for the value of continue) and the server may reject a continue value it does not recognize. If the specified continue value is no longer valid whether due to expiration (generally five to fifteen minutes) or a configuration change on the server, the server will respond with a 410 ResourceExpired error together with a continue token. If the client needs a consistent list, it must restart their list without the continue field. Otherwise, the client may send another list request with the token received with the 410 error, the server will respond with a list starting from the next key, but from the latest snapshot, which is inconsistent from the previous list results - objects that are created, modified, or deleted after the first list request will be included in the response, as long as their keys are after the "next key". This field is not supported when watch is true. Clients may start a watch from the last resourceVersion value returned by the server and not miss any modifications. [optional]
dryRun String 如果存在,则表示不应保留修改。无效或无法识别的dryRun指令将导致错误响应,并且不会进一步处理请求。有效值为:-全部:将处理所有干运行阶段。When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed [optional]
fieldSelector String 一个选择器,用于按字段限制返回对象的列表。默认为一切。A selector to restrict the list of returned objects by their fields. Defaults to everything. [optional]
gracePeriodSeconds Integer 删除对象前的持续时间(秒)。值必须是非负整数。值为零表示立即删除。如果此值为nil,则将使用指定类型的默认宽限期。如果未指定,则默认为每对象值。零表示立即删除。The duration in seconds before the object should be deleted. Value must be non-negative integer. The value zero indicates delete immediately. If this value is nil, the default grace period for the specified type will be used. Defaults to a per object value if not specified. zero means delete immediately. [optional]
labelSelector String 一个选择器,用于根据返回对象的标签限制其列表。默认为一切。A selector to restrict the list of returned objects by their labels. Defaults to everything. [optional]
limit Integer limit是列表调用返回的最大响应数。如果存在更多项目,服务器将设置`继续`字段的值,该值可用于同一初始查询以检索下一组结果。如果所有请求的对象都被过滤掉,设置限制可能会返回少于请求数量的项目(最多为零个项目),客户端应该只使用continue字段来确定是否有更多结果可用。服务器可能会选择不支持limit参数,并将返回所有可用的结果。如果指定了limit且continue字段为空,则客户端可能会认为没有更多结果可用。如果watch为true,则不支持此字段。服务器保证在使用continue时返回的对象将与无限制地发出单个列表调用相同——也就是说,在发出第一个请求后创建、修改或删除的对象不会包含在任何后续的continue请求中。这有时被称为一致性快照,可以确保使用limit接收非常大结果的较小数据块的客户端可以确保看到所有可能的对象。如果在分块列表期间更新对象,则返回在计算第一个列表结果时存在的对象版本。 limit is a maximum number of responses to return for a list call. If more items exist, the server will set the `continue` field on the list metadata to a value that can be used with the same initial query to retrieve the next set of results. Setting a limit may return fewer than the requested amount of items (up to zero items) in the event all requested objects are filtered out and clients should only use the presence of the continue field to determine whether more results are available. Servers may choose not to support the limit argument and will return all of the available results. If limit is specified and the continue field is empty, clients may assume that no more results are available. This field is not supported if watch is true. The server guarantees that the objects returned when using continue will be identical to issuing a single list call without a limit - that is, no objects created, modified, or deleted after the first request is issued will be included in any subsequent continued requests. This is sometimes referred to as a consistent snapshot, and ensures that a client that is using limit to receive smaller chunks of a very large result can ensure they see all possible objects. If objects are updated during a chunked list the version of the object that was present at the time the first list result was calculated is returned. [optional]
orphanDependents Boolean 已弃用:请使用PropagationPolicy,此字段将在1.7中弃用。从属对象应该是孤立的吗。如果为真/假,“孤立”终结器将被添加到对象的终结器列表中或从中删除。可以设置此字段或PropagationPolicy,但不能同时设置两者。Deprecated: please use the PropagationPolicy, this field will be deprecated in 1.7. Should the dependent objects be orphaned. If true/false, the "orphan" finalizer will be added to/removed from the object's finalizers list. Either this field or PropagationPolicy may be set, but not both. [optional]
propagationPolicy String 是否以及如何执行垃圾收集。可以设置此字段或孤立从属项,但不能同时设置两者。默认策略由元数据中设置的现有终结器决定。终结器和特定于资源的默认策略。Whether and how garbage collection will be performed. Either this field or OrphanDependents may be set, but not both. The default policy is decided by the existing finalizer set in the metadata.finalizers and the resource-specific default policy. Acceptable values are: 'Orphan' - orphan the dependents; 'Background' - allow the garbage collector to delete the dependents in the background; 'Foreground' - a cascading policy that deletes all dependents in the foreground. [optional]
resourceVersion String 当通过监视调用指定时,显示在资源的特定版本之后发生的更改。默认为历史开始时的更改。为列表指定时:-如果未设置,则根据仲裁读取标志从远程存储返回结果;-如果是's 0,然后我们只返回当前缓存中的内容,不保证;-如果设置为非零,则结果至少与给定值一样新鲜。When specified with a watch call, shows changes that occur after that particular version of a resource. Defaults to changes from the beginning of history. When specified for list: - if unset, then the result is returned from remote storage based on quorum-read flag; - if it's 0, then we simply return what we currently have in cache, no guarantee; - if set to non zero, then the result is at least as fresh as given rv. [optional]
timeoutSeconds Integer 列表/监视呼叫超时。这会限制通话的持续时间,而不管通话是否处于活动状态。列表/监视呼叫超时。这会限制通话的持续时间,而不管通话是否处于活动状态。Timeout for the list/watch call. This limits the duration of the call, regardless of any activity or inactivity. [optional]
body V1DeleteOptions [optional]

Return type

V1Status

Authorization

BearerToken

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json, application/yaml, application/vnd.kubernetes.protobuf

HTTP response details

Status code Description Response headers
200 OK -
401 Unauthorized -

deleteNamespacedDeployment


回到“Deployment增删改查”目录

V1Status deleteNamespacedDeployment(name, namespace, pretty, dryRun, gracePeriodSeconds, orphanDependents, propagationPolicy, body)

delete a Deployment

Example

// Import classes:
import io.kubernetes.client.openapi.ApiClient;
import io.kubernetes.client.openapi.ApiException;
import io.kubernetes.client.openapi.Configuration;
import io.kubernetes.client.openapi.auth.*;
import io.kubernetes.client.openapi.models.*;
import io.kubernetes.client.openapi.apis.AppsV1Api;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("http://localhost");
    
    // Configure API key authorization: BearerToken
    ApiKeyAuth BearerToken = (ApiKeyAuth) defaultClient.getAuthentication("BearerToken");
    BearerToken.setApiKey("YOUR API KEY");
    // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
    //BearerToken.setApiKeyPrefix("Token");

    AppsV1Api apiInstance = new AppsV1Api(defaultClient);
    String name = "name_example"; // String | name of the Deployment
    String namespace = "namespace_example"; // String | 对象名称和身份验证范围,例如团队和项目。object name and auth scope, such as for teams and projects
    String pretty = "pretty_example"; // String | 如果为“true”,则输出相当打印。If 'true', then the output is pretty printed.
    String dryRun = "dryRun_example"; // String | 如果存在,则表示不应保留修改。无效或无法识别的dryRun指令将导致错误响应,并且不会进一步处理请求。有效值为:-全部:将处理所有干运行阶段。When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed
    Integer gracePeriodSeconds = 56; // Integer | 删除对象前的持续时间(秒)。值必须是非负整数。值为零表示立即删除。如果此值为nil,则将使用指定类型的默认宽限期。如果未指定,则默认为每对象值。零表示立即删除。The duration in seconds before the object should be deleted. Value must be non-negative integer. The value zero indicates delete immediately. If this value is nil, the default grace period for the specified type will be used. Defaults to a per object value if not specified. zero means delete immediately.
    Boolean orphanDependents = true; // Boolean | 已弃用:请使用PropagationPolicy,此字段将在1.7中弃用。从属对象应该是孤立的吗。如果为真/假,“孤立”终结器将被添加到对象的终结器列表中或从中删除。可以设置此字段或PropagationPolicy,但不能同时设置两者。Deprecated: please use the PropagationPolicy, this field will be deprecated in 1.7. Should the dependent objects be orphaned. If true/false, the \"orphan\" finalizer will be added to/removed from the object's finalizers list. Either this field or PropagationPolicy may be set, but not both.
    String propagationPolicy = "propagationPolicy_example"; // String | 是否以及如何执行垃圾收集。可以设置此字段或孤立从属项,但不能同时设置两者。默认策略由元数据中设置的现有终结器决定。终结器和特定于资源的默认策略。Whether and how garbage collection will be performed. Either this field or OrphanDependents may be set, but not both. The default policy is decided by the existing finalizer set in the metadata.finalizers and the resource-specific default policy. Acceptable values are: 'Orphan' - orphan the dependents; 'Background' - allow the garbage collector to delete the dependents in the background; 'Foreground' - a cascading policy that deletes all dependents in the foreground.
    V1DeleteOptions body = new V1DeleteOptions(); // V1DeleteOptions | 
    try {
      V1Status result = apiInstance.deleteNamespacedDeployment(name, namespace, pretty, dryRun, gracePeriodSeconds, orphanDependents, propagationPolicy, body);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling AppsV1Api#deleteNamespacedDeployment");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
name String name of the Deployment
namespace String 对象名称和身份验证范围,例如团队和项目。object name and auth scope, such as for teams and projects
pretty String 如果为“true”,则输出相当打印。If 'true', then the output is pretty printed. [optional]
dryRun String 如果存在,则表示不应保留修改。无效或无法识别的dryRun指令将导致错误响应,并且不会进一步处理请求。有效值为:-全部:将处理所有干运行阶段。When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed [optional]
gracePeriodSeconds Integer 删除对象前的持续时间(秒)。值必须是非负整数。值为零表示立即删除。如果此值为nil,则将使用指定类型的默认宽限期。如果未指定,则默认为每对象值。零表示立即删除。The duration in seconds before the object should be deleted. Value must be non-negative integer. The value zero indicates delete immediately. If this value is nil, the default grace period for the specified type will be used. Defaults to a per object value if not specified. zero means delete immediately. [optional]
orphanDependents Boolean 已弃用:请使用PropagationPolicy,此字段将在1.7中弃用。从属对象应该是孤立的吗。如果为真/假,“孤立”终结器将被添加到对象的终结器列表中或从中删除。可以设置此字段或PropagationPolicy,但不能同时设置两者。Deprecated: please use the PropagationPolicy, this field will be deprecated in 1.7. Should the dependent objects be orphaned. If true/false, the "orphan" finalizer will be added to/removed from the object's finalizers list. Either this field or PropagationPolicy may be set, but not both. [optional]
propagationPolicy String 是否以及如何执行垃圾收集。可以设置此字段或孤立从属项,但不能同时设置两者。默认策略由元数据中设置的现有终结器决定。终结器和特定于资源的默认策略。Whether and how garbage collection will be performed. Either this field or OrphanDependents may be set, but not both. The default policy is decided by the existing finalizer set in the metadata.finalizers and the resource-specific default policy. Acceptable values are: 'Orphan' - orphan the dependents; 'Background' - allow the garbage collector to delete the dependents in the background; 'Foreground' - a cascading policy that deletes all dependents in the foreground. [optional]
body V1DeleteOptions [optional]

Return type

V1Status

Authorization

BearerToken

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json, application/yaml, application/vnd.kubernetes.protobuf

HTTP response details

Status code Description Response headers
200 OK -
202 Accepted -
401 Unauthorized -

listNamespacedDeployment


回到“Deployment增删改查”目录

V1DeploymentList listNamespacedDeployment(namespace, pretty, allowWatchBookmarks, _continue, fieldSelector, labelSelector, limit, resourceVersion, timeoutSeconds, watch)

list or watch objects of kind Deployment

Example

// Import classes:
import io.kubernetes.client.openapi.ApiClient;
import io.kubernetes.client.openapi.ApiException;
import io.kubernetes.client.openapi.Configuration;
import io.kubernetes.client.openapi.auth.*;
import io.kubernetes.client.openapi.models.*;
import io.kubernetes.client.openapi.apis.AppsV1Api;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("http://localhost");
    
    // Configure API key authorization: BearerToken
    ApiKeyAuth BearerToken = (ApiKeyAuth) defaultClient.getAuthentication("BearerToken");
    BearerToken.setApiKey("YOUR API KEY");
    // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
    //BearerToken.setApiKeyPrefix("Token");

    AppsV1Api apiInstance = new AppsV1Api(defaultClient);
    String namespace = "namespace_example"; // String | 对象名称和身份验证范围,例如团队和项目。object name and auth scope, such as for teams and projects
    String pretty = "pretty_example"; // String | 如果为“true”,则输出相当打印。If 'true', then the output is pretty printed.
    Boolean allowWatchBookmarks = true; // Boolean | allowWatchBookmarks请求观看类型为“的事件;书签"。未实现书签的服务器可能会忽略此标志,书签会在服务器上发送'这是自由裁量权。客户端不应假定书签是在任何特定的时间间隔返回的,也不应假定服务器将在会话期间发送任何书签事件。如果这不是手表,则忽略此字段。如果apiserver中未启用功能gate WatchBookmarks,则忽略此字段。allowWatchBookmarks requests watch events with type \"BOOKMARK\". Servers that do not implement bookmarks may ignore this flag and bookmarks are sent at the server's discretion. Clients should not assume bookmarks are returned at any specific interval, nor may they assume the server will send any BOOKMARK event during a session. If this is not a watch, this field is ignored. If the feature gate WatchBookmarks is not enabled in apiserver, this field is ignored.
    String _continue = "_continue_example"; // String | 从服务器检索更多结果时,应设置“继续”选项。由于此值是服务器定义的,因此客户端只能使用具有相同查询参数(continue值除外)的上一个查询结果中的continue值,服务器可能会拒绝它无法识别的continue值。如果指定的continue值因过期(通常为5到15分钟)或服务器上的配置更改而不再有效,服务器将响应410 ResourceExpired错误和continue令牌。如果客户端需要一个一致的列表,它必须在不使用continue字段的情况下重新启动它们的列表。从另一台服务器发送的结果可能与前一台服务器发送的结果不一致,但从下一台服务器发送的结果可能与前一台服务器发送的结果不一致,只要他们的钥匙在“下一个钥匙”之后。watch为true时不支持此字段。客户端可以从服务器返回的最后一个resourceVersion值开始监视,并且不会错过任何修改。The continue option should be set when retrieving more results from the server. Since this value is server defined, clients may only use the continue value from a previous query result with identical query parameters (except for the value of continue) and the server may reject a continue value it does not recognize. If the specified continue value is no longer valid whether due to expiration (generally five to fifteen minutes) or a configuration change on the server, the server will respond with a 410 ResourceExpired error together with a continue token. If the client needs a consistent list, it must restart their list without the continue field. Otherwise, the client may send another list request with the token received with the 410 error, the server will respond with a list starting from the next key, but from the latest snapshot, which is inconsistent from the previous list results - objects that are created, modified, or deleted after the first list request will be included in the response, as long as their keys are after the "next key".  This field is not supported when watch is true. Clients may start a watch from the last resourceVersion value returned by the server and not miss any modifications.(except for the value of continue) and the server may reject a continue value it does not recognize. If the specified continue value is no longer valid whether due to expiration (generally five to fifteen minutes) or a configuration change on the server, the server will respond with a 410 ResourceExpired error together with a continue token. If the client needs a consistent list, it must restart their list without the continue field. Otherwise, the client may send another list request with the token received with the 410 error, the server will respond with a list starting from the next key, but from the latest snapshot, which is inconsistent from the previous list results - objects that are created, modified, or deleted after the first list request will be included in the response, as long as their keys are after the \"next key\".  This field is not supported when watch is true. Clients may start a watch from the last resourceVersion value returned by the server and not miss any modifications.
    String fieldSelector = "fieldSelector_example"; // String | 一个选择器,用于按字段限制返回对象的列表。默认为一切。A selector to restrict the list of returned objects by their fields. Defaults to everything.
    String labelSelector = "labelSelector_example"; // String | 一个选择器,用于根据返回对象的标签限制其列表。默认为一切。A selector to restrict the list of returned objects by their labels. Defaults to everything.
    Integer limit = 56; // Integer | limit是列表调用返回的最大响应数。如果存在更多项,服务器会将列表元数据上的“continue”字段设置为一个值,该值可用于同一初始查询,以检索下一组结果。如果所有请求的对象都被过滤掉,设置限制可能会返回少于请求数量的项目(最多为零个项目),客户端应该只使用continue字段来确定是否有更多结果可用。服务器可能会选择不支持limit参数,并将返回所有可用的结果。如果指定了limit且continue字段为空,则客户端可能会认为没有更多结果可用。如果watch为true,则不支持此字段。服务器保证在使用continue时返回的对象将与无限制地发出单个列表调用相同——也就是说,在发出第一个请求后创建、修改或删除的对象不会包含在任何后续的continue请求中。这有时被称为一致性快照,可以确保使用limit接收非常大结果的较小数据块的客户端可以确保看到所有可能的对象。如果在分块列表期间更新对象,则返回在计算第一个列表结果时存在的对象版本。limit is a maximum number of responses to return for a list call. If more items exist, the server will set the `continue` field on the list metadata to a value that can be used with the same initial query to retrieve the next set of results. Setting a limit may return fewer than the requested amount of items (up to zero items) in the event all requested objects are filtered out and clients should only use the presence of the continue field to determine whether more results are available. Servers may choose not to support the limit argument and will return all of the available results. If limit is specified and the continue field is empty, clients may assume that no more results are available. This field is not supported if watch is true.  The server guarantees that the objects returned when using continue will be identical to issuing a single list call without a limit - that is, no objects created, modified, or deleted after the first request is issued will be included in any subsequent continued requests. This is sometimes referred to as a consistent snapshot, and ensures that a client that is using limit to receive smaller chunks of a very large result can ensure they see all possible objects. If objects are updated during a chunked list the version of the object that was present at the time the first list result was calculated is returned.
    String resourceVersion = "resourceVersion_example"; // String | 当通过监视调用指定时,显示在资源的特定版本之后发生的更改。默认为历史开始时的更改。为列表指定时:-如果未设置,则根据仲裁读取标志从远程存储返回结果;-如果是0,那么我们只返回当前缓存中的内容,不保证;-如果设置为非零,则结果至少与给定值一样新鲜When specified with a watch call, shows changes that occur after that particular version of a resource. Defaults to changes from the beginning of history. When specified for list: - if unset, then the result is returned from remote storage based on quorum-read flag; - if it's 0, then we simply return what we currently have in cache, no guarantee; - if set to non zero, then the result is at least as fresh as given rv.
    Integer timeoutSeconds = 56; // Integer | 列表/监视呼叫超时。这会限制通话的持续时间,而不管通话是否处于活动状态。列表/监视呼叫超时。这会限制通话的持续时间,而不管通话是否处于活动状态。Timeout for the list/watch call. This limits the duration of the call, regardless of any activity or inactivity.
    Boolean watch = true; // Boolean | 观察对所描述资源的更改,并将其作为添加、更新和删除通知流返回。指定resourceVersion。观察对所描述资源的更改,并将其作为添加、更新和删除通知流返回。Watch for changes to the described resources and return them as a stream of add, update, and remove notifications. Specify resourceVersion.
    try {
      V1DeploymentList result = apiInstance.listNamespacedDeployment(namespace, pretty, allowWatchBookmarks, _continue, fieldSelector, labelSelector, limit, resourceVersion, timeoutSeconds, watch);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling AppsV1Api#listNamespacedDeployment");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
namespace String 对象名称和身份验证范围,例如团队和项目。object name and auth scope, such as for teams and projects
pretty String 如果为“true”,则输出相当打印。If 'true', then the output is pretty printed. [optional]
allowWatchBookmarks Boolean allowWatchBookmarks请求观看类型为“的事件;书签"。未实现书签的服务器可能会忽略此标志,书签会在服务器上发送'这是自由裁量权。客户端不应假定书签是在任何特定的时间间隔返回的,也不应假定服务器将在会话期间发送任何书签事件。如果这不是手表,则忽略此字段。如果apiserver中未启用功能gate WatchBookmarks,则忽略此字段。allowWatchBookmarks requests watch events with type "BOOKMARK". Servers that do not implement bookmarks may ignore this flag and bookmarks are sent at the server's discretion. Clients should not assume bookmarks are returned at any specific interval, nor may they assume the server will send any BOOKMARK event during a session. If this is not a watch, this field is ignored. If the feature gate WatchBookmarks is not enabled in apiserver, this field is ignored. [optional]
_continue String 从服务器检索更多结果时,应设置“继续”选项。由于此值是服务器定义的,因此客户端只能使用具有相同查询参数(continue值除外)的上一个查询结果中的continue值,服务器可能会拒绝它无法识别的continue值。如果指定的continue值因过期(通常为5到15分钟)或服务器上的配置更改而不再有效,服务器将响应410 ResourceExpired错误和continue令牌。如果客户端需要一个一致的列表,它必须在不使用continue字段的情况下重新启动它们的列表。从另一台服务器发送的结果可能与前一台服务器发送的结果不一致,但从下一台服务器发送的结果可能与前一台服务器发送的结果不一致,只要他们的钥匙在“下一个钥匙”之后。watch为true时不支持此字段。客户端可以从服务器返回的最后一个resourceVersion值开始监视,并且不会错过任何修改。The continue option should be set when retrieving more results from the server. Since this value is server defined, clients may only use the continue value from a previous query result with identical query parameters (except for the value of continue) and the server may reject a continue value it does not recognize. If the specified continue value is no longer valid whether due to expiration (generally five to fifteen minutes) or a configuration change on the server, the server will respond with a 410 ResourceExpired error together with a continue token. If the client needs a consistent list, it must restart their list without the continue field. Otherwise, the client may send another list request with the token received with the 410 error, the server will respond with a list starting from the next key, but from the latest snapshot, which is inconsistent from the previous list results - objects that are created, modified, or deleted after the first list request will be included in the response, as long as their keys are after the "next key". This field is not supported when watch is true. Clients may start a watch from the last resourceVersion value returned by the server and not miss any modifications.(except for the value of continue) and the server may reject a continue value it does not recognize. If the specified continue value is no longer valid whether due to expiration (generally five to fifteen minutes) or a configuration change on the server, the server will respond with a 410 ResourceExpired error together with a continue token. If the client needs a consistent list, it must restart their list without the continue field. Otherwise, the client may send another list request with the token received with the 410 error, the server will respond with a list starting from the next key, but from the latest snapshot, which is inconsistent from the previous list results - objects that are created, modified, or deleted after the first list request will be included in the response, as long as their keys are after the "next key". This field is not supported when watch is true. Clients may start a watch from the last resourceVersion value returned by the server and not miss any modifications. [optional]
fieldSelector String 一个选择器,用于按字段限制返回对象的列表。默认为一切。A selector to restrict the list of returned objects by their fields. Defaults to everything. [optional]
labelSelector String 一个选择器,用于根据返回对象的标签限制其列表。默认为一切。A selector to restrict the list of returned objects by their labels. Defaults to everything. [optional]
limit Integer limit是列表调用返回的最大响应数。如果存在更多项目,服务器将设置`继续`字段的值,该值可用于同一初始查询以检索下一组结果。如果所有请求的对象都被过滤掉,设置限制可能会返回少于请求数量的项目(最多为零个项目),客户端应该只使用continue字段来确定是否有更多结果可用。服务器可能会选择不支持limit参数,并将返回所有可用的结果。如果指定了limit且continue字段为空,则客户端可能会认为没有更多结果可用。如果watch为true,则不支持此字段。服务器保证在使用continue时返回的对象将与无限制地发出单个列表调用相同——也就是说,在发出第一个请求后创建、修改或删除的对象不会包含在任何后续的continue请求中。这有时被称为一致性快照,可以确保使用limit接收非常大结果的较小数据块的客户端可以确保看到所有可能的对象。如果在分块列表期间更新对象,则返回在计算第一个列表结果时存在的对象版本。 limit is a maximum number of responses to return for a list call. If more items exist, the server will set the `continue` field on the list metadata to a value that can be used with the same initial query to retrieve the next set of results. Setting a limit may return fewer than the requested amount of items (up to zero items) in the event all requested objects are filtered out and clients should only use the presence of the continue field to determine whether more results are available. Servers may choose not to support the limit argument and will return all of the available results. If limit is specified and the continue field is empty, clients may assume that no more results are available. This field is not supported if watch is true. The server guarantees that the objects returned when using continue will be identical to issuing a single list call without a limit - that is, no objects created, modified, or deleted after the first request is issued will be included in any subsequent continued requests. This is sometimes referred to as a consistent snapshot, and ensures that a client that is using limit to receive smaller chunks of a very large result can ensure they see all possible objects. If objects are updated during a chunked list the version of the object that was present at the time the first list result was calculated is returned. [optional]
resourceVersion String 当通过监视调用指定时,显示在资源的特定版本之后发生的更改。默认为历史开始时的更改。为列表指定时:-如果未设置,则根据仲裁读取标志从远程存储返回结果;-如果是's 0,然后我们只返回当前缓存中的内容,不保证;-如果设置为非零,则结果至少与给定值一样新鲜。When specified with a watch call, shows changes that occur after that particular version of a resource. Defaults to changes from the beginning of history. When specified for list: - if unset, then the result is returned from remote storage based on quorum-read flag; - if it's 0, then we simply return what we currently have in cache, no guarantee; - if set to non zero, then the result is at least as fresh as given rv. [optional]
timeoutSeconds Integer 列表/监视呼叫超时。这会限制通话的持续时间,而不管通话是否处于活动状态。列表/监视呼叫超时。这会限制通话的持续时间,而不管通话是否处于活动状态。Timeout for the list/watch call. This limits the duration of the call, regardless of any activity or inactivity. [optional]
watch Boolean 观察对所描述资源的更改,并将其作为添加、更新和删除通知流返回。指定resourceVersion。观察对所描述资源的更改,并将其作为添加、更新和删除通知流返回。Watch for changes to the described resources and return them as a stream of add, update, and remove notifications. Specify resourceVersion. [optional]

Return type

V1DeploymentList

Authorization

BearerToken

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json, application/yaml, application/vnd.kubernetes.protobuf, application/json;stream=watch, application/vnd.kubernetes.protobuf;stream=watch

HTTP response details

Status code Description Response headers
200 OK -
401 Unauthorized -

patchNamespacedDeployment


回到“Deployment增删改查”目录

V1Deployment patchNamespacedDeployment(name, namespace, body, pretty, dryRun, fieldManager, force)

partially update the specified Deployment

Example

// Import classes:
import io.kubernetes.client.openapi.ApiClient;
import io.kubernetes.client.openapi.ApiException;
import io.kubernetes.client.openapi.Configuration;
import io.kubernetes.client.openapi.auth.*;
import io.kubernetes.client.openapi.models.*;
import io.kubernetes.client.openapi.apis.AppsV1Api;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("http://localhost");
    
    // Configure API key authorization: BearerToken
    ApiKeyAuth BearerToken = (ApiKeyAuth) defaultClient.getAuthentication("BearerToken");
    BearerToken.setApiKey("YOUR API KEY");
    // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
    //BearerToken.setApiKeyPrefix("Token");

    AppsV1Api apiInstance = new AppsV1Api(defaultClient);
    String name = "name_example"; // String | name of the Deployment
    String namespace = "namespace_example"; // String | 对象名称和身份验证范围,例如团队和项目。object name and auth scope, such as for teams and projects
    V1Patch body = new V1Patch(); // V1Patch | 
    String pretty = "pretty_example"; // String | 如果为“true”,则输出相当打印。If 'true', then the output is pretty printed.
    String dryRun = "dryRun_example"; // String | 如果存在,则表示不应保留修改。无效或无法识别的dryRun指令将导致错误响应,并且不会进一步处理请求。有效值为:-全部:将处理所有干运行阶段。When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed
    String fieldManager = "fieldManager_example"; // String |  fieldManager是与进行这些更改的参与者或实体关联的名称。该值的长度必须小于或128个字符,并且仅包含可打印字符,如https://golang.org/pkg/unicode/#IsPrint.fieldManager is a name associated with the actor or entity that is making these changes. The value must be less than or 128 characters long, and only contain printable characters, as defined by https://golang.org/pkg/unicode/#IsPrint. This field is required for apply requests (application/apply-patch) but optional for non-apply patch types (JsonPatch, MergePatch, StrategicMergePatch).
    Boolean force = true; // Boolean | Force将“强制”应用请求。这意味着用户将重新获取其他人拥有的冲突字段。对于非应用补丁请求,必须取消设置强制标志。Force is going to \"force\" Apply requests. It means user will re-acquire conflicting fields owned by other people. Force flag must be unset for non-apply patch requests.
    try {
      V1Deployment result = apiInstance.patchNamespacedDeployment(name, namespace, body, pretty, dryRun, fieldManager, force);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling AppsV1Api#patchNamespacedDeployment");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
name String name of the Deployment
namespace String 对象名称和身份验证范围,例如团队和项目。object name and auth scope, such as for teams and projects
body V1Patch
pretty String 如果为“true”,则输出相当打印。If 'true', then the output is pretty printed. [optional]
dryRun String 如果存在,则表示不应保留修改。无效或无法识别的dryRun指令将导致错误响应,并且不会进一步处理请求。有效值为:-全部:将处理所有干运行阶段。When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed [optional]
fieldManager String fieldManager是与进行这些更改的参与者或实体关联的名称。该值的长度必须小于或128个字符,并且仅包含可打印字符,如https://golang.org/pkg/unicode/#IsPrint.fieldManager is a name associated with the actor or entity that is making these changes. The value must be less than or 128 characters long, and only contain printable characters, as defined by https://golang.org/pkg/unicode/#IsPrint. This field is required for apply requests (application/apply-patch) but optional for non-apply patch types (JsonPatch, MergePatch, StrategicMergePatch). [optional]
force Boolean Force将“强制”应用请求。这意味着用户将重新获取其他人拥有的冲突字段。对于非应用补丁请求,必须取消设置强制标志。Force is going to "force" Apply requests. It means user will re-acquire conflicting fields owned by other people. Force flag must be unset for non-apply patch requests. [optional]

Return type

V1Deployment

Authorization

BearerToken

HTTP request headers

  • Content-Type: application/json-patch+json, application/merge-patch+json, application/strategic-merge-patch+json, application/apply-patch+yaml
  • Accept: application/json, application/yaml, application/vnd.kubernetes.protobuf

HTTP response details

Status code Description Response headers
200 OK -
401 Unauthorized -

readNamespacedDeployment


回到“Deployment增删改查”目录

V1Deployment readNamespacedDeployment(name, namespace, pretty, exact, export)

read the specified Deployment

Example

// Import classes:
import io.kubernetes.client.openapi.ApiClient;
import io.kubernetes.client.openapi.ApiException;
import io.kubernetes.client.openapi.Configuration;
import io.kubernetes.client.openapi.auth.*;
import io.kubernetes.client.openapi.models.*;
import io.kubernetes.client.openapi.apis.AppsV1Api;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("http://localhost");
    
    // Configure API key authorization: BearerToken
    ApiKeyAuth BearerToken = (ApiKeyAuth) defaultClient.getAuthentication("BearerToken");
    BearerToken.setApiKey("YOUR API KEY");
    // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
    //BearerToken.setApiKeyPrefix("Token");

    AppsV1Api apiInstance = new AppsV1Api(defaultClient);
    String name = "name_example"; // String | name of the Deployment
    String namespace = "namespace_example"; // String | 对象名称和身份验证范围,例如团队和项目。object name and auth scope, such as for teams and projects
    String pretty = "pretty_example"; // String | 如果为“true”,则输出相当打印。If 'true', then the output is pretty printed.
    Boolean exact = true; // Boolean | 出口应该是准确的。Exact export维护特定于集群的字段,如“Namespace”。不赞成。计划于1.18年拆除。Should the export be exact.  Exact export maintains cluster-specific fields like 'Namespace'. Deprecated. Planned for removal in 1.18.
    Boolean export = true; // Boolean | 应该将该值导出。导出用户无法指定的字段。不赞成。计划于1.18年拆除。Should this value be exported.  Export strips fields that a user can not specify. Deprecated. Planned for removal in 1.18.
    try {
      V1Deployment result = apiInstance.readNamespacedDeployment(name, namespace, pretty, exact, export);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling AppsV1Api#readNamespacedDeployment");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
name String name of the Deployment
namespace String 对象名称和身份验证范围,例如团队和项目。object name and auth scope, such as for teams and projects
pretty String 如果为“true”,则输出相当打印。If 'true', then the output is pretty printed. [optional]
exact Boolean Should the export be exact. Exact export maintains cluster-specific fields like 'Namespace'. Deprecated. Planned for removal in 1.18. [optional]
export Boolean 应该将该值导出。导出用户无法指定的字段。不赞成。计划于1.18年拆除。Should this value be exported. Export strips fields that a user can not specify. Deprecated. Planned for removal in 1.18. [optional]

Return type

V1Deployment

Authorization

BearerToken

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json, application/yaml, application/vnd.kubernetes.protobuf

HTTP response details

Status code Description Response headers
200 OK -
401 Unauthorized -

replaceNamespacedDeployment


回到“Deployment增删改查”目录

V1Deployment replaceNamespacedDeployment(name, namespace, body, pretty, dryRun, fieldManager)

replace the specified Deployment

Example

// Import classes:
import io.kubernetes.client.openapi.ApiClient;
import io.kubernetes.client.openapi.ApiException;
import io.kubernetes.client.openapi.Configuration;
import io.kubernetes.client.openapi.auth.*;
import io.kubernetes.client.openapi.models.*;
import io.kubernetes.client.openapi.apis.AppsV1Api;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("http://localhost");
    
    // Configure API key authorization: BearerToken
    ApiKeyAuth BearerToken = (ApiKeyAuth) defaultClient.getAuthentication("BearerToken");
    BearerToken.setApiKey("YOUR API KEY");
    // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
    //BearerToken.setApiKeyPrefix("Token");

    AppsV1Api apiInstance = new AppsV1Api(defaultClient);
    String name = "name_example"; // String | name of the Deployment
    String namespace = "namespace_example"; // String | 对象名称和身份验证范围,例如团队和项目。object name and auth scope, such as for teams and projects
    V1Deployment body = new V1Deployment(); // V1Deployment | 
    String pretty = "pretty_example"; // String | 如果为“true”,则输出相当打印。If 'true', then the output is pretty printed.
    String dryRun = "dryRun_example"; // String | 如果存在,则表示不应保留修改。无效或无法识别的dryRun指令将导致错误响应,并且不会进一步处理请求。有效值为:-全部:将处理所有干运行阶段。When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed
    String fieldManager = "fieldManager_example"; // String |  fieldManager是与进行这些更改的参与者或实体关联的名称。该值的长度必须小于或128个字符,并且仅包含可打印字符,如https://golang.org/pkg/unicode/#IsPrint.fieldManager is a name associated with the actor or entity that is making these changes. The value must be less than or 128 characters long, and only contain printable characters, as defined by https://golang.org/pkg/unicode/#IsPrint.
    try {
      V1Deployment result = apiInstance.replaceNamespacedDeployment(name, namespace, body, pretty, dryRun, fieldManager);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling AppsV1Api#replaceNamespacedDeployment");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
name String name of the Deployment
namespace String 对象名称和身份验证范围,例如团队和项目。object name and auth scope, such as for teams and projects
body V1Deployment
pretty String 如果为“true”,则输出相当打印。If 'true', then the output is pretty printed. [optional]
dryRun String 如果存在,则表示不应保留修改。无效或无法识别的dryRun指令将导致错误响应,并且不会进一步处理请求。有效值为:-全部:将处理所有干运行阶段。When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed [optional]
fieldManager String fieldManager是与进行这些更改的参与者或实体关联的名称。该值的长度必须小于或128个字符,并且仅包含可打印字符,如https://golang.org/pkg/unicode/#IsPrint.fieldManager is a name associated with the actor or entity that is making these changes. The value must be less than or 128 characters long, and only contain printable characters, as defined by https://golang.org/pkg/unicode/#IsPrint. [optional]

Return type

V1Deployment

Authorization

BearerToken

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json, application/yaml, application/vnd.kubernetes.protobuf

HTTP response details

Status code Description Response headers
200 OK -
201 Created -
401 Unauthorized -
posted @ 2022-04-28 14:25  希声lx  阅读(728)  评论(0编辑  收藏  举报