amdatu-kubernetes-go: bitbucket.org/amdatulabs/amdatu-kubernetes-go/client Index | Files

package client

import "bitbucket.org/amdatulabs/amdatu-kubernetes-go/client"

amdatu-kubernetes-go is a client library for Kubernetes. It uses the Kuberentes REST API internally.

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

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Package Files

client.go

type Client Uses

type Client struct {
    HttpClient *http.Client
    Url        string
    Username   string
    Password   string
}

func NewClient Uses

func NewClient(url, username, password string) Client

NewClient creates a new Client. If authentication on the API server is disabled, the username/password arguments can remain empty strings.

func NewClientWithHttpClient Uses

func NewClientWithHttpClient(httpClient *http.Client, url, username, password string) Client

NewClientWithHttpClient creates a new Client, based on a pre-configured httpClient. This is useful for configuring SSL for example. If authentication on the API server is disabled, the username/password arguments can remain empty strings.

func (*Client) CreateNamespace Uses

func (c *Client) CreateNamespace(namespace string) (*v1.Namespace, error)

func (*Client) CreateReplicationController Uses

func (c *Client) CreateReplicationController(namespace string, rc *v1.ReplicationController) (*v1.ReplicationController, error)

CreateReplicationController creates a new replication controller within the namespace. Returns the created resource.

func (*Client) CreateService Uses

func (c *Client) CreateService(namespace string, service *v1.Service) (*v1.Service, error)

func (*Client) DeleteNamespace Uses

func (c *Client) DeleteNamespace(namespace string) error

func (*Client) DeleteNode Uses

func (c *Client) DeleteNode(node string) error

func (*Client) DeletePod Uses

func (c *Client) DeletePod(namespace, pod string) error

DeletePod deletes a pod by name within the namespace

func (*Client) DeleteReplicationController Uses

func (c *Client) DeleteReplicationController(namespace, replicationController string) error

DeleteReplicationController deletes a replication controller by name within a namespace.

func (*Client) DeleteService Uses

func (c *Client) DeleteService(namespace, service string) error

func (*Client) GetNode Uses

func (c *Client) GetNode(node string) (*v1.Node, error)

func (*Client) GetPod Uses

func (c *Client) GetPod(namespace, podName string) (*v1.Pod, error)

GetPod finds a pod by name within the namespace When the pod is not found an error will be returned.

func (*Client) GetReplicationController Uses

func (c *Client) GetReplicationController(namespace, replicationController string) (*v1.ReplicationController, error)

GetReplicationController finds a replication controller by name within a namespace When the replication controller is not found an error will be returned.

func (*Client) GetService Uses

func (c *Client) GetService(namespace, service string) (*v1.Service, error)

GetService finds a service by name within a namespace. When the service is not found an error will be returned.

func (*Client) ListNamespaces Uses

func (c *Client) ListNamespaces() (*v1.NamespaceList, error)

func (*Client) ListNodes Uses

func (c *Client) ListNodes() (*v1.NodeList, error)

func (*Client) ListPods Uses

func (c *Client) ListPods(namespace string) (*v1.PodList, error)

ListPods lists pods within a namespace. If no namespace is specified (empty string), it returns all pods in all namespaces.

func (*Client) ListPodsWithLabel Uses

func (c *Client) ListPodsWithLabel(namespace string, labels Labels) (*v1.PodList, error)

ListPodsWithLabel lists pods within a namespace, filtered by the pod's labels. If no namespace is specified (empty string), it returns all pods in all namespaces, filtered by labels.

func (*Client) ListReplicationControllers Uses

func (c *Client) ListReplicationControllers(namespace string) (*v1.ReplicationControllerList, error)

ListReplicationControllers lists replication controllers within a namespace

func (*Client) ListReplicationControllersWithLabel Uses

func (c *Client) ListReplicationControllersWithLabel(namespace string, labels Labels) (*v1.ReplicationControllerList, error)

ListReplicationControllersWithLabel finds replication controllers by name within a namespace, filtered by labels.

func (*Client) ListServices Uses

func (c *Client) ListServices(namespace string) (*v1.ServiceList, error)

ListServices lists services within a namespace

func (*Client) ListServicesWithLabel Uses

func (c *Client) ListServicesWithLabel(namespace string, labels Labels) (*v1.ServiceList, error)

ListServicesWithLabel lists services within a namespace, filtered by labels.

func (*Client) Patch Uses

func (c *Client) Patch(namespace, resourceType, objectName, jsonPatch string) error

func (*Client) UpdateNode Uses

func (c *Client) UpdateNode(node *v1.Node) (*v1.Node, error)

UpdateNode updates a node. Note that this method updates uses a PUT, so the existing object is overwritten.

func (*Client) UpdatePod Uses

func (c *Client) UpdatePod(namespace string, pod *v1.Pod) (*v1.Pod, error)

UpdatePod updates a pod and return the updated version Note that this method updates uses a PUT, so the existing object is overwritten.

func (*Client) UpdateReplicationController Uses

func (c *Client) UpdateReplicationController(namespace string, rc *v1.ReplicationController) (*v1.ReplicationController, error)

UpdateReplicationController updates a replication controller within the namespace. Note that this method updates uses a PUT, so the existing object is overwritten.

func (*Client) UpdateService Uses

func (c *Client) UpdateService(namespace string, service *v1.Service) (*v1.Service, error)

UpdateService updates a service within the namespace. Note that this method updates uses a PUT, so the existing object is overwritten.

func (*Client) WatchPodsWithLabel Uses

func (c *Client) WatchPodsWithLabel(namespace string, labels Labels) (chan PodEvent, chan string, error)

WatchPodsWithLabel watches pods, filtered by labels. This starts a new go routine, and results are posted to the returned channel. The second return value is a signal channel, which can be used to cancel the watch.

type EventType Uses

type EventType string
const (
    Added    EventType = "ADDED"
    Modified EventType = "MODIFIED"
    Deleted  EventType = "DELETED"
    Error    EventType = "ERROR"
)

type Labels Uses

type Labels map[string]string

type PodEvent Uses

type PodEvent struct {
    Type EventType

    // Object is:
    //  * If Type is Added or Modified: the new state of the object.
    //  * If Type is Deleted: the state of the object immediately before deletion.
    //  * If Type is Error: *api.Status is recommended; other types may make sense
    //    depending on context.
    Object v1.Pod
}

Package client imports 14 packages (graph) and is imported by 4 packages. Updated 2019-05-06. Refresh now. Tools for package owners.