{"modulePath":"github.com/UnityTech/client-go","version":"v11.0.0+incompatible","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package auth\n\nPackage auth defines a file format for holding authentication information needed by clients of Kubernetes.  Typically, a Kubernetes cluster will put auth info for the admin in a known location when it is created, and will (soon) put it in a known location within a Container's file tree for Containers that need access to the Kubernetes API.\n\nHaving a defined format allows:\n\n  - clients to be implemented in multiple languages\n  - applications which link clients to be portable across clusters with different authentication styles (e.g. some may use SSL Client certs, others may not, etc)\n  - when the format changes, applications only need to update this code.\n\nThe file format is json, marshalled from a struct authcfg.Info.\n\nClinet libraries in other languages should use the same format.\n\nIt is not intended to store general preferences, such as default namespace, output options, etc.  CLIs (such as kubectl) and UIs should develop their own format and may wish to inline the authcfg.Info type.\n\nThe authcfg.Info is just a file format.  It is distinct from client.Config which holds options for creating a client.Client. Helper functions are provided in this package to fill in a client.Client from an authcfg.Info.\n\nExample:\n\n\timport (\n\t    \"pkg/client\"\n\t    \"pkg/client/auth\"\n\t)\n\n\tinfo, err := auth.LoadFromFile(filename)\n\tif err != nil {\n\t  // handle error\n\t}\n\tclientConfig = client.Config{}\n\tclientConfig.Host = \"example.com:4901\"\n\tclientConfig = info.MergeWithConfig()\n\tclient := client.New(clientConfig)\n\tclient.Pods(ns).List()\n\n## Types\n\n```go\ntype Info struct {\n\tUser        string\n\tPassword    string\n\tCAFile      string\n\tCertFile    string\n\tKeyFile     string\n\tBearerToken string\n\tInsecure    *bool\n}\n```\nInfo holds Kubernetes API authorization config.  It is intended to be read/written from a file as a JSON object.\n\n```go\nfunc LoadFromFile(path string) (*Info, error)\n```\nLoadFromFile parses an Info object from a file path. If the file does not exist, then os.IsNotExist(err) == true\n\n```go\nfunc (info Info) Complete() bool\n```\n\n```go\nfunc (info Info) MergeWithConfig(c restclient.Config) (restclient.Config, error)\n```\nMergeWithConfig returns a copy of a client.Config with values from the Info. The fields of client.Config with a corresponding field in the Info are set with the value from the Info.\n\n","path":"github.com/UnityTech/client-go/tools/auth","name":"auth","synopsis":"Package auth defines a file format for holding authentication information needed by clients of Kubernetes.","isRedistributable":true}
