Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
# simplified read_namespaced_pod method from core_v1_api.py located at https://raw.githubusercontent.com/kubernetes-incubator/client-python/master/kubernetes/client/apis/core_v1_api.py
""" Generated python client""" ...
def read_namespaced_pod(self, name, namespace, **params):
"""
read the specified Pod
:param str name: name of the Pod (required)
:param str namespace: object name and auth scope, such as for teams and projects (required)
:param str pretty: If 'true', then the output is pretty printed.
:param bool exact: Should the export be exact. Exact export maintains cluster-specific fields like 'Namespace'
:param bool export: Should this value be exported. Export strips fields that a user can not specify.
:return: V1Pod
"""
# verify the required parameter 'name' is set
if ('name' not in params) or (params['name'] is None):
raise ValueError("Missing the required parameter `name` when calling `read_namespaced_pod`")
# verify the required parameter 'namespace' is set
if ('namespace' not in params) or (params['namespace'] is None):
raise ValueError("Missing the required parameter `namespace` when calling `read_namespaced_pod`")
resource_path = '/api/v1/namespaces/{namespace}/pods/{name}'.replace('{format}', 'json')
path_params = {}
if 'name' in params:
path_params['name'] = params['name']
if 'namespace' in params:
path_params['namespace'] = params['namespace']
query_params = {}
if 'pretty' in params:
query_params['pretty'] = params['pretty']
if 'exact' in params:
query_params['exact'] = params['exact']
if 'export' in params:
query_params['export'] = params['export']
header_params['Accept'] = {'Accept' : 'application/json'}
return self.api_client.call_api(resource_path, 'GET',
path_params,
query_params,
header_params,
response_type='V1Pod',
auth_settings=['BearerToken'])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment