Skip to content

Instantly share code, notes, and snippets.

View mbohlool's full-sized avatar

Mehdy Bohlool mbohlool

  • San Francisco, CA
View GitHub Profile
@mbohlool
mbohlool / openapi_generated.go
Created October 6, 2017 23:54
OpenAPI generated sample
// +build !ignore_autogenerated
/*
Copyright 2016 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
package main
import (
"bytes"
"compress/gzip"
"fmt"
"io/ioutil"
"os"
"time"

python

from kubernetes import client, config

# Configs can be set in Configuration class directly or using helper utility
config.load_kube_config()

v1 = client.CoreV1Api()
print("Listing pods with their IPs:")

Ruby:

# load the gem
require 'kubernetes'
# setup authorization
Kubernetes.configure do |config|
  # Configure API key authorization: BearerToken
  config.api_key['authorization'] = 'YOUR API KEY'
  # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
  #config.api_key_prefix['authorization'] = 'Bearer'
# 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.