diff --git a/Makefile b/Makefile
index fd61a0aca7..cee513aa4a 100644
--- a/Makefile
+++ b/Makefile
@@ -13,7 +13,7 @@ MOCKGEN := ./scripts/generate_mocks.sh
IMAGE_REPO := quay.io/operator-framework/olm
IMAGE_TAG ?= "dev"
KUBE_DEPS := api apiserver apimachinery apiextensions-apiserver kube-aggregator code-generator cli-runtime
-KUBE_RELEASE := release-1.12
+KUBE_RELEASE := release-1.14
SPECIFIC_UNIT_TEST := $(if $(TEST),-run $(TEST),)
.PHONY: build test run clean vendor schema-check \
diff --git a/go.mod b/go.mod
index ff201f209e..a42b93932c 100644
--- a/go.mod
+++ b/go.mod
@@ -29,6 +29,7 @@ require (
github.com/google/gofuzz v1.0.0 // indirect
github.com/grpc-ecosystem/grpc-gateway v1.8.5 // indirect
github.com/json-iterator/go v1.1.6 // indirect
+ github.com/liggitt/tabwriter v0.0.0-20181228230101-89fcab3d43de // indirect
github.com/maxbrunsfeld/counterfeiter/v6 v6.0.2
github.com/onsi/ginkgo v1.8.0 // indirect
github.com/openshift/api v3.9.1-0.20190424152011-77b8897ec79a+incompatible
@@ -47,19 +48,19 @@ require (
google.golang.org/appengine v1.5.0 // indirect
google.golang.org/grpc v1.19.1
gotest.tools v2.2.0+incompatible // indirect
- k8s.io/api v0.0.0-20190118113203-912cbe2bfef3
- k8s.io/apiextensions-apiserver v0.0.0-20190221101132-cda7b6cfba78
- k8s.io/apimachinery v0.0.0-20190221084156-01f179d85dbc
- k8s.io/apiserver v0.0.0-20190518070817-682b37ff211e
- k8s.io/cli-runtime v0.0.0-20190221101700-11047e25a94a // indirect
+ k8s.io/api v0.0.0-20190313235455-40a48860b5ab
+ k8s.io/apiextensions-apiserver v0.0.0-20190315093550-53c4693659ed
+ k8s.io/apimachinery v0.0.0-20190404173353-6a84e37a896d
+ k8s.io/apiserver v0.0.0-20190531031430-24fd0f18bc21
k8s.io/client-go v11.0.0+incompatible
- k8s.io/code-generator v0.0.0-20181203235156-f8cba74510f3
+ k8s.io/code-generator v0.0.0-20190311093542-50b561225d70
k8s.io/gengo v0.0.0-20190327210449-e17681d19d3a // indirect
k8s.io/klog v0.2.0 // indirect
- k8s.io/kube-aggregator v0.0.0-20190221095344-e77f03c95d65
+ k8s.io/kube-aggregator v0.0.0-20190404125450-f5e124c822d6
k8s.io/kube-openapi v0.0.0-20190401085232-94e1e7b7574c
- k8s.io/kubernetes v1.12.8
+ k8s.io/kubernetes v1.14.2
k8s.io/utils v0.0.0-20190308190857-21c4ce38f2a7 // indirect
+ sigs.k8s.io/yaml v1.1.0 // indirect
)
replace (
diff --git a/go.sum b/go.sum
index 5b8b001c57..33df66d18a 100644
--- a/go.sum
+++ b/go.sum
@@ -170,6 +170,8 @@ github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORN
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
+github.com/liggitt/tabwriter v0.0.0-20181228230101-89fcab3d43de h1:9TO3cAIGXtEhnIaL+V+BEER86oLrvS+kWobKpbJuye0=
+github.com/liggitt/tabwriter v0.0.0-20181228230101-89fcab3d43de/go.mod h1:zAbeS9B/r2mtpb6U+EI2rYA5OAXxsYw6wTamcNW+zcE=
github.com/mailru/easyjson v0.0.0-20180823135443-60711f1a8329 h1:2gxZ0XQIU/5z3Z3bUBu+FXuk2pFbkN6tcwi/pjyaDic=
github.com/mailru/easyjson v0.0.0-20180823135443-60711f1a8329/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
github.com/mattn/go-sqlite3 v1.9.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc=
@@ -368,8 +370,6 @@ k8s.io/apimachinery v0.0.0-20190221084156-01f179d85dbc h1:7z9/6jKWBqkK9GI1RRB0B5
k8s.io/apimachinery v0.0.0-20190221084156-01f179d85dbc/go.mod h1:ccL7Eh7zubPUSh9A3USN90/OzHNSVN6zxzde07TDCL0=
k8s.io/apiserver v0.0.0-20190402012035-5e1c1f41ee34 h1:5d+YN9C7gYxZIdr9aFzYzYjaFP2cT/5O06rOImHvHIQ=
k8s.io/apiserver v0.0.0-20190402012035-5e1c1f41ee34/go.mod h1:6bqaTSOSJavUIXUtfaR9Os9JtTCm8ZqH2SUl2S60C4w=
-k8s.io/cli-runtime v0.0.0-20190221101700-11047e25a94a h1:GAcwIisjZPZ+M1SnvTMt36TeoGLN+CNKjAn/4DG4T4I=
-k8s.io/cli-runtime v0.0.0-20190221101700-11047e25a94a/go.mod h1:qWnH3/b8sp/l7EvlDh7ulDU3UWA4P4N1NFbEEP791tM=
k8s.io/client-go v0.0.0-20190228133956-77e032213d34 h1:6Iif3YYUETtutLCzzC1hPC6Fjvg/qdcQM3NwxS86TmA=
k8s.io/client-go v0.0.0-20190228133956-77e032213d34/go.mod h1:7vJpHMYJwNQCWgzmNV+VYUl1zCObLyodBc8nIyt8L5s=
k8s.io/code-generator v0.0.0-20181128191024-b1289fc74931 h1:5nlNOG+ShM9gcSivU8/IEhrANa/ljMMEJ1sw86/eFzQ=
@@ -388,8 +388,10 @@ k8s.io/kube-openapi v0.0.0-20180711000925-0cf8f7e6ed1d h1:mn2F9UzCk6KGa7M/d2ibLy
k8s.io/kube-openapi v0.0.0-20180711000925-0cf8f7e6ed1d/go.mod h1:BXM9ceUBTj2QnfH2MK1odQs778ajze1RxcmP6S8RVVc=
k8s.io/kubernetes v1.11.7-beta.0.0.20181219023948-b875d52ea96d/go.mod h1:ocZa8+6APFNC2tX1DZASIbocyYT5jHzqFVsY5aoB7Jk=
k8s.io/kubernetes v1.11.8-beta.0.0.20190124204751-3a10094374f2/go.mod h1:ocZa8+6APFNC2tX1DZASIbocyYT5jHzqFVsY5aoB7Jk=
-k8s.io/kubernetes v1.12.8 h1:HPJalm9oRobwrLC76RnZRT4zFBRA8Mgv7cgLZN0CG8U=
-k8s.io/kubernetes v1.12.8/go.mod h1:ocZa8+6APFNC2tX1DZASIbocyYT5jHzqFVsY5aoB7Jk=
+k8s.io/kubernetes v1.14.2 h1:Gdq2hPpttbaJBoClIanCE6WSu4IZReA54yhkZtvPUOo=
+k8s.io/kubernetes v1.14.2/go.mod h1:ocZa8+6APFNC2tX1DZASIbocyYT5jHzqFVsY5aoB7Jk=
k8s.io/utils v0.0.0-20190308190857-21c4ce38f2a7 h1:8r+l4bNWjRlsFYlQJnKJ2p7s1YQPj4XyXiJVqDHRx7c=
k8s.io/utils v0.0.0-20190308190857-21c4ce38f2a7/go.mod h1:8k8uAuAQ0rXslZKaEWd0c3oVhZz7sSzSiPnVZayjIX0=
sigs.k8s.io/controller-runtime v0.1.10/go.mod h1:HFAYoOh6XMV+jKF1UjFwrknPbowfyHEHHRdJMf2jMX8=
+sigs.k8s.io/yaml v1.1.0 h1:4A07+ZFc2wgJwo8YNlQpr1rVlgUDlxXHhPJciaPY5gs=
+sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o=
diff --git a/pkg/lib/operatorclient/serviceaccount.go b/pkg/lib/operatorclient/serviceaccount.go
index 4e6591d5b2..8af9c5d2d0 100644
--- a/pkg/lib/operatorclient/serviceaccount.go
+++ b/pkg/lib/operatorclient/serviceaccount.go
@@ -35,5 +35,5 @@ func (c *Client) UpdateServiceAccount(sa *v1.ServiceAccount) (*v1.ServiceAccount
if err != nil {
return nil, fmt.Errorf("error creating patch for ServiceAccount: %v", err)
}
- return c.Core().ServiceAccounts(sa.GetNamespace()).Patch(sa.GetName(), types.StrategicMergePatchType, patchBytes)
+ return c.CoreV1().ServiceAccounts(sa.GetNamespace()).Patch(sa.GetName(), types.StrategicMergePatchType, patchBytes)
}
diff --git a/vendor/github.com/liggitt/tabwriter/.travis.yml b/vendor/github.com/liggitt/tabwriter/.travis.yml
new file mode 100644
index 0000000000..2768dc0727
--- /dev/null
+++ b/vendor/github.com/liggitt/tabwriter/.travis.yml
@@ -0,0 +1,11 @@
+language: go
+
+go:
+ - "1.8"
+ - "1.9"
+ - "1.10"
+ - "1.11"
+ - "1.12"
+ - master
+
+script: go test -v ./...
diff --git a/vendor/github.com/liggitt/tabwriter/LICENSE b/vendor/github.com/liggitt/tabwriter/LICENSE
new file mode 100644
index 0000000000..6a66aea5ea
--- /dev/null
+++ b/vendor/github.com/liggitt/tabwriter/LICENSE
@@ -0,0 +1,27 @@
+Copyright (c) 2009 The Go Authors. All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+ * Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above
+copyright notice, this list of conditions and the following disclaimer
+in the documentation and/or other materials provided with the
+distribution.
+ * Neither the name of Google Inc. nor the names of its
+contributors may be used to endorse or promote products derived from
+this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/vendor/github.com/liggitt/tabwriter/README.md b/vendor/github.com/liggitt/tabwriter/README.md
new file mode 100644
index 0000000000..e75d35672e
--- /dev/null
+++ b/vendor/github.com/liggitt/tabwriter/README.md
@@ -0,0 +1,7 @@
+This repo is a drop-in replacement for the golang [text/tabwriter](https://golang.org/pkg/text/tabwriter/) package.
+
+It is based on that package at [cf2c2ea8](https://github.com/golang/go/tree/cf2c2ea89d09d486bb018b1817c5874388038c3a/src/text/tabwriter) and inherits its license.
+
+The following additional features are supported:
+* `RememberWidths` flag allows remembering maximum widths seen per column even after Flush() is called.
+* `RememberedWidths() []int` and `SetRememberedWidths([]int) *Writer` allows obtaining and transferring remembered column width between writers.
diff --git a/vendor/github.com/liggitt/tabwriter/tabwriter.go b/vendor/github.com/liggitt/tabwriter/tabwriter.go
new file mode 100644
index 0000000000..fd3431fb03
--- /dev/null
+++ b/vendor/github.com/liggitt/tabwriter/tabwriter.go
@@ -0,0 +1,637 @@
+// Copyright 2009 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// Package tabwriter implements a write filter (tabwriter.Writer) that
+// translates tabbed columns in input into properly aligned text.
+//
+// It is a drop-in replacement for the golang text/tabwriter package (https://golang.org/pkg/text/tabwriter),
+// based on that package at https://github.com/golang/go/tree/cf2c2ea89d09d486bb018b1817c5874388038c3a
+// with support for additional features.
+//
+// The package is using the Elastic Tabstops algorithm described at
+// http://nickgravgaard.com/elastictabstops/index.html.
+package tabwriter
+
+import (
+ "io"
+ "unicode/utf8"
+)
+
+// ----------------------------------------------------------------------------
+// Filter implementation
+
+// A cell represents a segment of text terminated by tabs or line breaks.
+// The text itself is stored in a separate buffer; cell only describes the
+// segment's size in bytes, its width in runes, and whether it's an htab
+// ('\t') terminated cell.
+//
+type cell struct {
+ size int // cell size in bytes
+ width int // cell width in runes
+ htab bool // true if the cell is terminated by an htab ('\t')
+}
+
+// A Writer is a filter that inserts padding around tab-delimited
+// columns in its input to align them in the output.
+//
+// The Writer treats incoming bytes as UTF-8-encoded text consisting
+// of cells terminated by horizontal ('\t') or vertical ('\v') tabs,
+// and newline ('\n') or formfeed ('\f') characters; both newline and
+// formfeed act as line breaks.
+//
+// Tab-terminated cells in contiguous lines constitute a column. The
+// Writer inserts padding as needed to make all cells in a column have
+// the same width, effectively aligning the columns. It assumes that
+// all characters have the same width, except for tabs for which a
+// tabwidth must be specified. Column cells must be tab-terminated, not
+// tab-separated: non-tab terminated trailing text at the end of a line
+// forms a cell but that cell is not part of an aligned column.
+// For instance, in this example (where | stands for a horizontal tab):
+//
+// aaaa|bbb|d
+// aa |b |dd
+// a |
+// aa |cccc|eee
+//
+// the b and c are in distinct columns (the b column is not contiguous
+// all the way). The d and e are not in a column at all (there's no
+// terminating tab, nor would the column be contiguous).
+//
+// The Writer assumes that all Unicode code points have the same width;
+// this may not be true in some fonts or if the string contains combining
+// characters.
+//
+// If DiscardEmptyColumns is set, empty columns that are terminated
+// entirely by vertical (or "soft") tabs are discarded. Columns
+// terminated by horizontal (or "hard") tabs are not affected by
+// this flag.
+//
+// If a Writer is configured to filter HTML, HTML tags and entities
+// are passed through. The widths of tags and entities are
+// assumed to be zero (tags) and one (entities) for formatting purposes.
+//
+// A segment of text may be escaped by bracketing it with Escape
+// characters. The tabwriter passes escaped text segments through
+// unchanged. In particular, it does not interpret any tabs or line
+// breaks within the segment. If the StripEscape flag is set, the
+// Escape characters are stripped from the output; otherwise they
+// are passed through as well. For the purpose of formatting, the
+// width of the escaped text is always computed excluding the Escape
+// characters.
+//
+// The formfeed character acts like a newline but it also terminates
+// all columns in the current line (effectively calling Flush). Tab-
+// terminated cells in the next line start new columns. Unless found
+// inside an HTML tag or inside an escaped text segment, formfeed
+// characters appear as newlines in the output.
+//
+// The Writer must buffer input internally, because proper spacing
+// of one line may depend on the cells in future lines. Clients must
+// call Flush when done calling Write.
+//
+type Writer struct {
+ // configuration
+ output io.Writer
+ minwidth int
+ tabwidth int
+ padding int
+ padbytes [8]byte
+ flags uint
+
+ // current state
+ buf []byte // collected text excluding tabs or line breaks
+ pos int // buffer position up to which cell.width of incomplete cell has been computed
+ cell cell // current incomplete cell; cell.width is up to buf[pos] excluding ignored sections
+ endChar byte // terminating char of escaped sequence (Escape for escapes, '>', ';' for HTML tags/entities, or 0)
+ lines [][]cell // list of lines; each line is a list of cells
+ widths []int // list of column widths in runes - re-used during formatting
+
+ maxwidths []int // list of max column widths in runes
+}
+
+// addLine adds a new line.
+// flushed is a hint indicating whether the underlying writer was just flushed.
+// If so, the previous line is not likely to be a good indicator of the new line's cells.
+func (b *Writer) addLine(flushed bool) {
+ // Grow slice instead of appending,
+ // as that gives us an opportunity
+ // to re-use an existing []cell.
+ if n := len(b.lines) + 1; n <= cap(b.lines) {
+ b.lines = b.lines[:n]
+ b.lines[n-1] = b.lines[n-1][:0]
+ } else {
+ b.lines = append(b.lines, nil)
+ }
+
+ if !flushed {
+ // The previous line is probably a good indicator
+ // of how many cells the current line will have.
+ // If the current line's capacity is smaller than that,
+ // abandon it and make a new one.
+ if n := len(b.lines); n >= 2 {
+ if prev := len(b.lines[n-2]); prev > cap(b.lines[n-1]) {
+ b.lines[n-1] = make([]cell, 0, prev)
+ }
+ }
+ }
+}
+
+// Reset the current state.
+func (b *Writer) reset() {
+ b.buf = b.buf[:0]
+ b.pos = 0
+ b.cell = cell{}
+ b.endChar = 0
+ b.lines = b.lines[0:0]
+ b.widths = b.widths[0:0]
+ b.addLine(true)
+}
+
+// Internal representation (current state):
+//
+// - all text written is appended to buf; tabs and line breaks are stripped away
+// - at any given time there is a (possibly empty) incomplete cell at the end
+// (the cell starts after a tab or line break)
+// - cell.size is the number of bytes belonging to the cell so far
+// - cell.width is text width in runes of that cell from the start of the cell to
+// position pos; html tags and entities are excluded from this width if html
+// filtering is enabled
+// - the sizes and widths of processed text are kept in the lines list
+// which contains a list of cells for each line
+// - the widths list is a temporary list with current widths used during
+// formatting; it is kept in Writer because it's re-used
+//
+// |<---------- size ---------->|
+// | |
+// |<- width ->|<- ignored ->| |
+// | | | |
+// [---processed---tab------------......]
+// ^ ^ ^
+// | | |
+// buf start of incomplete cell pos
+
+// Formatting can be controlled with these flags.
+const (
+ // Ignore html tags and treat entities (starting with '&'
+ // and ending in ';') as single characters (width = 1).
+ FilterHTML uint = 1 << iota
+
+ // Strip Escape characters bracketing escaped text segments
+ // instead of passing them through unchanged with the text.
+ StripEscape
+
+ // Force right-alignment of cell content.
+ // Default is left-alignment.
+ AlignRight
+
+ // Handle empty columns as if they were not present in
+ // the input in the first place.
+ DiscardEmptyColumns
+
+ // Always use tabs for indentation columns (i.e., padding of
+ // leading empty cells on the left) independent of padchar.
+ TabIndent
+
+ // Print a vertical bar ('|') between columns (after formatting).
+ // Discarded columns appear as zero-width columns ("||").
+ Debug
+
+ // Remember maximum widths seen per column even after Flush() is called.
+ RememberWidths
+)
+
+// A Writer must be initialized with a call to Init. The first parameter (output)
+// specifies the filter output. The remaining parameters control the formatting:
+//
+// minwidth minimal cell width including any padding
+// tabwidth width of tab characters (equivalent number of spaces)
+// padding padding added to a cell before computing its width
+// padchar ASCII char used for padding
+// if padchar == '\t', the Writer will assume that the
+// width of a '\t' in the formatted output is tabwidth,
+// and cells are left-aligned independent of align_left
+// (for correct-looking results, tabwidth must correspond
+// to the tab width in the viewer displaying the result)
+// flags formatting control
+//
+func (b *Writer) Init(output io.Writer, minwidth, tabwidth, padding int, padchar byte, flags uint) *Writer {
+ if minwidth < 0 || tabwidth < 0 || padding < 0 {
+ panic("negative minwidth, tabwidth, or padding")
+ }
+ b.output = output
+ b.minwidth = minwidth
+ b.tabwidth = tabwidth
+ b.padding = padding
+ for i := range b.padbytes {
+ b.padbytes[i] = padchar
+ }
+ if padchar == '\t' {
+ // tab padding enforces left-alignment
+ flags &^= AlignRight
+ }
+ b.flags = flags
+
+ b.reset()
+
+ return b
+}
+
+// debugging support (keep code around)
+func (b *Writer) dump() {
+ pos := 0
+ for i, line := range b.lines {
+ print("(", i, ") ")
+ for _, c := range line {
+ print("[", string(b.buf[pos:pos+c.size]), "]")
+ pos += c.size
+ }
+ print("\n")
+ }
+ print("\n")
+}
+
+// local error wrapper so we can distinguish errors we want to return
+// as errors from genuine panics (which we don't want to return as errors)
+type osError struct {
+ err error
+}
+
+func (b *Writer) write0(buf []byte) {
+ n, err := b.output.Write(buf)
+ if n != len(buf) && err == nil {
+ err = io.ErrShortWrite
+ }
+ if err != nil {
+ panic(osError{err})
+ }
+}
+
+func (b *Writer) writeN(src []byte, n int) {
+ for n > len(src) {
+ b.write0(src)
+ n -= len(src)
+ }
+ b.write0(src[0:n])
+}
+
+var (
+ newline = []byte{'\n'}
+ tabs = []byte("\t\t\t\t\t\t\t\t")
+)
+
+func (b *Writer) writePadding(textw, cellw int, useTabs bool) {
+ if b.padbytes[0] == '\t' || useTabs {
+ // padding is done with tabs
+ if b.tabwidth == 0 {
+ return // tabs have no width - can't do any padding
+ }
+ // make cellw the smallest multiple of b.tabwidth
+ cellw = (cellw + b.tabwidth - 1) / b.tabwidth * b.tabwidth
+ n := cellw - textw // amount of padding
+ if n < 0 {
+ panic("internal error")
+ }
+ b.writeN(tabs, (n+b.tabwidth-1)/b.tabwidth)
+ return
+ }
+
+ // padding is done with non-tab characters
+ b.writeN(b.padbytes[0:], cellw-textw)
+}
+
+var vbar = []byte{'|'}
+
+func (b *Writer) writeLines(pos0 int, line0, line1 int) (pos int) {
+ pos = pos0
+ for i := line0; i < line1; i++ {
+ line := b.lines[i]
+
+ // if TabIndent is set, use tabs to pad leading empty cells
+ useTabs := b.flags&TabIndent != 0
+
+ for j, c := range line {
+ if j > 0 && b.flags&Debug != 0 {
+ // indicate column break
+ b.write0(vbar)
+ }
+
+ if c.size == 0 {
+ // empty cell
+ if j < len(b.widths) {
+ b.writePadding(c.width, b.widths[j], useTabs)
+ }
+ } else {
+ // non-empty cell
+ useTabs = false
+ if b.flags&AlignRight == 0 { // align left
+ b.write0(b.buf[pos : pos+c.size])
+ pos += c.size
+ if j < len(b.widths) {
+ b.writePadding(c.width, b.widths[j], false)
+ }
+ } else { // align right
+ if j < len(b.widths) {
+ b.writePadding(c.width, b.widths[j], false)
+ }
+ b.write0(b.buf[pos : pos+c.size])
+ pos += c.size
+ }
+ }
+ }
+
+ if i+1 == len(b.lines) {
+ // last buffered line - we don't have a newline, so just write
+ // any outstanding buffered data
+ b.write0(b.buf[pos : pos+b.cell.size])
+ pos += b.cell.size
+ } else {
+ // not the last line - write newline
+ b.write0(newline)
+ }
+ }
+ return
+}
+
+// Format the text between line0 and line1 (excluding line1); pos
+// is the buffer position corresponding to the beginning of line0.
+// Returns the buffer position corresponding to the beginning of
+// line1 and an error, if any.
+//
+func (b *Writer) format(pos0 int, line0, line1 int) (pos int) {
+ pos = pos0
+ column := len(b.widths)
+ for this := line0; this < line1; this++ {
+ line := b.lines[this]
+
+ if column >= len(line)-1 {
+ continue
+ }
+ // cell exists in this column => this line
+ // has more cells than the previous line
+ // (the last cell per line is ignored because cells are
+ // tab-terminated; the last cell per line describes the
+ // text before the newline/formfeed and does not belong
+ // to a column)
+
+ // print unprinted lines until beginning of block
+ pos = b.writeLines(pos, line0, this)
+ line0 = this
+
+ // column block begin
+ width := b.minwidth // minimal column width
+ discardable := true // true if all cells in this column are empty and "soft"
+ for ; this < line1; this++ {
+ line = b.lines[this]
+ if column >= len(line)-1 {
+ break
+ }
+ // cell exists in this column
+ c := line[column]
+ // update width
+ if w := c.width + b.padding; w > width {
+ width = w
+ }
+ // update discardable
+ if c.width > 0 || c.htab {
+ discardable = false
+ }
+ }
+ // column block end
+
+ // discard empty columns if necessary
+ if discardable && b.flags&DiscardEmptyColumns != 0 {
+ width = 0
+ }
+
+ if b.flags&RememberWidths != 0 {
+ if len(b.maxwidths) < len(b.widths) {
+ b.maxwidths = append(b.maxwidths, b.widths[len(b.maxwidths):]...)
+ }
+
+ switch {
+ case len(b.maxwidths) == len(b.widths):
+ b.maxwidths = append(b.maxwidths, width)
+ case b.maxwidths[len(b.widths)] > width:
+ width = b.maxwidths[len(b.widths)]
+ case b.maxwidths[len(b.widths)] < width:
+ b.maxwidths[len(b.widths)] = width
+ }
+ }
+
+ // format and print all columns to the right of this column
+ // (we know the widths of this column and all columns to the left)
+ b.widths = append(b.widths, width) // push width
+ pos = b.format(pos, line0, this)
+ b.widths = b.widths[0 : len(b.widths)-1] // pop width
+ line0 = this
+ }
+
+ // print unprinted lines until end
+ return b.writeLines(pos, line0, line1)
+}
+
+// Append text to current cell.
+func (b *Writer) append(text []byte) {
+ b.buf = append(b.buf, text...)
+ b.cell.size += len(text)
+}
+
+// Update the cell width.
+func (b *Writer) updateWidth() {
+ b.cell.width += utf8.RuneCount(b.buf[b.pos:])
+ b.pos = len(b.buf)
+}
+
+// To escape a text segment, bracket it with Escape characters.
+// For instance, the tab in this string "Ignore this tab: \xff\t\xff"
+// does not terminate a cell and constitutes a single character of
+// width one for formatting purposes.
+//
+// The value 0xff was chosen because it cannot appear in a valid UTF-8 sequence.
+//
+const Escape = '\xff'
+
+// Start escaped mode.
+func (b *Writer) startEscape(ch byte) {
+ switch ch {
+ case Escape:
+ b.endChar = Escape
+ case '<':
+ b.endChar = '>'
+ case '&':
+ b.endChar = ';'
+ }
+}
+
+// Terminate escaped mode. If the escaped text was an HTML tag, its width
+// is assumed to be zero for formatting purposes; if it was an HTML entity,
+// its width is assumed to be one. In all other cases, the width is the
+// unicode width of the text.
+//
+func (b *Writer) endEscape() {
+ switch b.endChar {
+ case Escape:
+ b.updateWidth()
+ if b.flags&StripEscape == 0 {
+ b.cell.width -= 2 // don't count the Escape chars
+ }
+ case '>': // tag of zero width
+ case ';':
+ b.cell.width++ // entity, count as one rune
+ }
+ b.pos = len(b.buf)
+ b.endChar = 0
+}
+
+// Terminate the current cell by adding it to the list of cells of the
+// current line. Returns the number of cells in that line.
+//
+func (b *Writer) terminateCell(htab bool) int {
+ b.cell.htab = htab
+ line := &b.lines[len(b.lines)-1]
+ *line = append(*line, b.cell)
+ b.cell = cell{}
+ return len(*line)
+}
+
+func handlePanic(err *error, op string) {
+ if e := recover(); e != nil {
+ if nerr, ok := e.(osError); ok {
+ *err = nerr.err
+ return
+ }
+ panic("tabwriter: panic during " + op)
+ }
+}
+
+// RememberedWidths returns a copy of the remembered per-column maximum widths.
+// Requires use of the RememberWidths flag, and is not threadsafe.
+func (b *Writer) RememberedWidths() []int {
+ retval := make([]int, len(b.maxwidths))
+ copy(retval, b.maxwidths)
+ return retval
+}
+
+// SetRememberedWidths sets the remembered per-column maximum widths.
+// Requires use of the RememberWidths flag, and is not threadsafe.
+func (b *Writer) SetRememberedWidths(widths []int) *Writer {
+ b.maxwidths = make([]int, len(widths))
+ copy(b.maxwidths, widths)
+ return b
+}
+
+// Flush should be called after the last call to Write to ensure
+// that any data buffered in the Writer is written to output. Any
+// incomplete escape sequence at the end is considered
+// complete for formatting purposes.
+func (b *Writer) Flush() error {
+ return b.flush()
+}
+
+func (b *Writer) flush() (err error) {
+ defer b.reset() // even in the presence of errors
+ defer handlePanic(&err, "Flush")
+
+ // add current cell if not empty
+ if b.cell.size > 0 {
+ if b.endChar != 0 {
+ // inside escape - terminate it even if incomplete
+ b.endEscape()
+ }
+ b.terminateCell(false)
+ }
+
+ // format contents of buffer
+ b.format(0, 0, len(b.lines))
+ return nil
+}
+
+var hbar = []byte("---\n")
+
+// Write writes buf to the writer b.
+// The only errors returned are ones encountered
+// while writing to the underlying output stream.
+//
+func (b *Writer) Write(buf []byte) (n int, err error) {
+ defer handlePanic(&err, "Write")
+
+ // split text into cells
+ n = 0
+ for i, ch := range buf {
+ if b.endChar == 0 {
+ // outside escape
+ switch ch {
+ case '\t', '\v', '\n', '\f':
+ // end of cell
+ b.append(buf[n:i])
+ b.updateWidth()
+ n = i + 1 // ch consumed
+ ncells := b.terminateCell(ch == '\t')
+ if ch == '\n' || ch == '\f' {
+ // terminate line
+ b.addLine(ch == '\f')
+ if ch == '\f' || ncells == 1 {
+ // A '\f' always forces a flush. Otherwise, if the previous
+ // line has only one cell which does not have an impact on
+ // the formatting of the following lines (the last cell per
+ // line is ignored by format()), thus we can flush the
+ // Writer contents.
+ if err = b.Flush(); err != nil {
+ return
+ }
+ if ch == '\f' && b.flags&Debug != 0 {
+ // indicate section break
+ b.write0(hbar)
+ }
+ }
+ }
+
+ case Escape:
+ // start of escaped sequence
+ b.append(buf[n:i])
+ b.updateWidth()
+ n = i
+ if b.flags&StripEscape != 0 {
+ n++ // strip Escape
+ }
+ b.startEscape(Escape)
+
+ case '<', '&':
+ // possibly an html tag/entity
+ if b.flags&FilterHTML != 0 {
+ // begin of tag/entity
+ b.append(buf[n:i])
+ b.updateWidth()
+ n = i
+ b.startEscape(ch)
+ }
+ }
+
+ } else {
+ // inside escape
+ if ch == b.endChar {
+ // end of tag/entity
+ j := i + 1
+ if ch == Escape && b.flags&StripEscape != 0 {
+ j = i // strip Escape
+ }
+ b.append(buf[n:j])
+ n = i + 1 // ch consumed
+ b.endEscape()
+ }
+ }
+ }
+
+ // append leftover text
+ b.append(buf[n:])
+ n = len(buf)
+ return
+}
+
+// NewWriter allocates and initializes a new tabwriter.Writer.
+// The parameters are the same as for the Init function.
+//
+func NewWriter(output io.Writer, minwidth, tabwidth, padding int, padchar byte, flags uint) *Writer {
+ return new(Writer).Init(output, minwidth, tabwidth, padding, padchar, flags)
+}
diff --git a/vendor/golang.org/x/text/encoding/encoding.go b/vendor/golang.org/x/text/encoding/encoding.go
deleted file mode 100644
index a0bd7cd4d0..0000000000
--- a/vendor/golang.org/x/text/encoding/encoding.go
+++ /dev/null
@@ -1,335 +0,0 @@
-// Copyright 2013 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// Package encoding defines an interface for character encodings, such as Shift
-// JIS and Windows 1252, that can convert to and from UTF-8.
-//
-// Encoding implementations are provided in other packages, such as
-// golang.org/x/text/encoding/charmap and
-// golang.org/x/text/encoding/japanese.
-package encoding // import "golang.org/x/text/encoding"
-
-import (
- "errors"
- "io"
- "strconv"
- "unicode/utf8"
-
- "golang.org/x/text/encoding/internal/identifier"
- "golang.org/x/text/transform"
-)
-
-// TODO:
-// - There seems to be some inconsistency in when decoders return errors
-// and when not. Also documentation seems to suggest they shouldn't return
-// errors at all (except for UTF-16).
-// - Encoders seem to rely on or at least benefit from the input being in NFC
-// normal form. Perhaps add an example how users could prepare their output.
-
-// Encoding is a character set encoding that can be transformed to and from
-// UTF-8.
-type Encoding interface {
- // NewDecoder returns a Decoder.
- NewDecoder() *Decoder
-
- // NewEncoder returns an Encoder.
- NewEncoder() *Encoder
-}
-
-// A Decoder converts bytes to UTF-8. It implements transform.Transformer.
-//
-// Transforming source bytes that are not of that encoding will not result in an
-// error per se. Each byte that cannot be transcoded will be represented in the
-// output by the UTF-8 encoding of '\uFFFD', the replacement rune.
-type Decoder struct {
- transform.Transformer
-
- // This forces external creators of Decoders to use names in struct
- // initializers, allowing for future extendibility without having to break
- // code.
- _ struct{}
-}
-
-// Bytes converts the given encoded bytes to UTF-8. It returns the converted
-// bytes or nil, err if any error occurred.
-func (d *Decoder) Bytes(b []byte) ([]byte, error) {
- b, _, err := transform.Bytes(d, b)
- if err != nil {
- return nil, err
- }
- return b, nil
-}
-
-// String converts the given encoded string to UTF-8. It returns the converted
-// string or "", err if any error occurred.
-func (d *Decoder) String(s string) (string, error) {
- s, _, err := transform.String(d, s)
- if err != nil {
- return "", err
- }
- return s, nil
-}
-
-// Reader wraps another Reader to decode its bytes.
-//
-// The Decoder may not be used for any other operation as long as the returned
-// Reader is in use.
-func (d *Decoder) Reader(r io.Reader) io.Reader {
- return transform.NewReader(r, d)
-}
-
-// An Encoder converts bytes from UTF-8. It implements transform.Transformer.
-//
-// Each rune that cannot be transcoded will result in an error. In this case,
-// the transform will consume all source byte up to, not including the offending
-// rune. Transforming source bytes that are not valid UTF-8 will be replaced by
-// `\uFFFD`. To return early with an error instead, use transform.Chain to
-// preprocess the data with a UTF8Validator.
-type Encoder struct {
- transform.Transformer
-
- // This forces external creators of Encoders to use names in struct
- // initializers, allowing for future extendibility without having to break
- // code.
- _ struct{}
-}
-
-// Bytes converts bytes from UTF-8. It returns the converted bytes or nil, err if
-// any error occurred.
-func (e *Encoder) Bytes(b []byte) ([]byte, error) {
- b, _, err := transform.Bytes(e, b)
- if err != nil {
- return nil, err
- }
- return b, nil
-}
-
-// String converts a string from UTF-8. It returns the converted string or
-// "", err if any error occurred.
-func (e *Encoder) String(s string) (string, error) {
- s, _, err := transform.String(e, s)
- if err != nil {
- return "", err
- }
- return s, nil
-}
-
-// Writer wraps another Writer to encode its UTF-8 output.
-//
-// The Encoder may not be used for any other operation as long as the returned
-// Writer is in use.
-func (e *Encoder) Writer(w io.Writer) io.Writer {
- return transform.NewWriter(w, e)
-}
-
-// ASCIISub is the ASCII substitute character, as recommended by
-// https://unicode.org/reports/tr36/#Text_Comparison
-const ASCIISub = '\x1a'
-
-// Nop is the nop encoding. Its transformed bytes are the same as the source
-// bytes; it does not replace invalid UTF-8 sequences.
-var Nop Encoding = nop{}
-
-type nop struct{}
-
-func (nop) NewDecoder() *Decoder {
- return &Decoder{Transformer: transform.Nop}
-}
-func (nop) NewEncoder() *Encoder {
- return &Encoder{Transformer: transform.Nop}
-}
-
-// Replacement is the replacement encoding. Decoding from the replacement
-// encoding yields a single '\uFFFD' replacement rune. Encoding from UTF-8 to
-// the replacement encoding yields the same as the source bytes except that
-// invalid UTF-8 is converted to '\uFFFD'.
-//
-// It is defined at http://encoding.spec.whatwg.org/#replacement
-var Replacement Encoding = replacement{}
-
-type replacement struct{}
-
-func (replacement) NewDecoder() *Decoder {
- return &Decoder{Transformer: replacementDecoder{}}
-}
-
-func (replacement) NewEncoder() *Encoder {
- return &Encoder{Transformer: replacementEncoder{}}
-}
-
-func (replacement) ID() (mib identifier.MIB, other string) {
- return identifier.Replacement, ""
-}
-
-type replacementDecoder struct{ transform.NopResetter }
-
-func (replacementDecoder) Transform(dst, src []byte, atEOF bool) (nDst, nSrc int, err error) {
- if len(dst) < 3 {
- return 0, 0, transform.ErrShortDst
- }
- if atEOF {
- const fffd = "\ufffd"
- dst[0] = fffd[0]
- dst[1] = fffd[1]
- dst[2] = fffd[2]
- nDst = 3
- }
- return nDst, len(src), nil
-}
-
-type replacementEncoder struct{ transform.NopResetter }
-
-func (replacementEncoder) Transform(dst, src []byte, atEOF bool) (nDst, nSrc int, err error) {
- r, size := rune(0), 0
-
- for ; nSrc < len(src); nSrc += size {
- r = rune(src[nSrc])
-
- // Decode a 1-byte rune.
- if r < utf8.RuneSelf {
- size = 1
-
- } else {
- // Decode a multi-byte rune.
- r, size = utf8.DecodeRune(src[nSrc:])
- if size == 1 {
- // All valid runes of size 1 (those below utf8.RuneSelf) were
- // handled above. We have invalid UTF-8 or we haven't seen the
- // full character yet.
- if !atEOF && !utf8.FullRune(src[nSrc:]) {
- err = transform.ErrShortSrc
- break
- }
- r = '\ufffd'
- }
- }
-
- if nDst+utf8.RuneLen(r) > len(dst) {
- err = transform.ErrShortDst
- break
- }
- nDst += utf8.EncodeRune(dst[nDst:], r)
- }
- return nDst, nSrc, err
-}
-
-// HTMLEscapeUnsupported wraps encoders to replace source runes outside the
-// repertoire of the destination encoding with HTML escape sequences.
-//
-// This wrapper exists to comply to URL and HTML forms requiring a
-// non-terminating legacy encoder. The produced sequences may lead to data
-// loss as they are indistinguishable from legitimate input. To avoid this
-// issue, use UTF-8 encodings whenever possible.
-func HTMLEscapeUnsupported(e *Encoder) *Encoder {
- return &Encoder{Transformer: &errorHandler{e, errorToHTML}}
-}
-
-// ReplaceUnsupported wraps encoders to replace source runes outside the
-// repertoire of the destination encoding with an encoding-specific
-// replacement.
-//
-// This wrapper is only provided for backwards compatibility and legacy
-// handling. Its use is strongly discouraged. Use UTF-8 whenever possible.
-func ReplaceUnsupported(e *Encoder) *Encoder {
- return &Encoder{Transformer: &errorHandler{e, errorToReplacement}}
-}
-
-type errorHandler struct {
- *Encoder
- handler func(dst []byte, r rune, err repertoireError) (n int, ok bool)
-}
-
-// TODO: consider making this error public in some form.
-type repertoireError interface {
- Replacement() byte
-}
-
-func (h errorHandler) Transform(dst, src []byte, atEOF bool) (nDst, nSrc int, err error) {
- nDst, nSrc, err = h.Transformer.Transform(dst, src, atEOF)
- for err != nil {
- rerr, ok := err.(repertoireError)
- if !ok {
- return nDst, nSrc, err
- }
- r, sz := utf8.DecodeRune(src[nSrc:])
- n, ok := h.handler(dst[nDst:], r, rerr)
- if !ok {
- return nDst, nSrc, transform.ErrShortDst
- }
- err = nil
- nDst += n
- if nSrc += sz; nSrc < len(src) {
- var dn, sn int
- dn, sn, err = h.Transformer.Transform(dst[nDst:], src[nSrc:], atEOF)
- nDst += dn
- nSrc += sn
- }
- }
- return nDst, nSrc, err
-}
-
-func errorToHTML(dst []byte, r rune, err repertoireError) (n int, ok bool) {
- buf := [8]byte{}
- b := strconv.AppendUint(buf[:0], uint64(r), 10)
- if n = len(b) + len(""); n >= len(dst) {
- return 0, false
- }
- dst[0] = '&'
- dst[1] = '#'
- dst[copy(dst[2:], b)+2] = ';'
- return n, true
-}
-
-func errorToReplacement(dst []byte, r rune, err repertoireError) (n int, ok bool) {
- if len(dst) == 0 {
- return 0, false
- }
- dst[0] = err.Replacement()
- return 1, true
-}
-
-// ErrInvalidUTF8 means that a transformer encountered invalid UTF-8.
-var ErrInvalidUTF8 = errors.New("encoding: invalid UTF-8")
-
-// UTF8Validator is a transformer that returns ErrInvalidUTF8 on the first
-// input byte that is not valid UTF-8.
-var UTF8Validator transform.Transformer = utf8Validator{}
-
-type utf8Validator struct{ transform.NopResetter }
-
-func (utf8Validator) Transform(dst, src []byte, atEOF bool) (nDst, nSrc int, err error) {
- n := len(src)
- if n > len(dst) {
- n = len(dst)
- }
- for i := 0; i < n; {
- if c := src[i]; c < utf8.RuneSelf {
- dst[i] = c
- i++
- continue
- }
- _, size := utf8.DecodeRune(src[i:])
- if size == 1 {
- // All valid runes of size 1 (those below utf8.RuneSelf) were
- // handled above. We have invalid UTF-8 or we haven't seen the
- // full character yet.
- err = ErrInvalidUTF8
- if !atEOF && !utf8.FullRune(src[i:]) {
- err = transform.ErrShortSrc
- }
- return i, i, err
- }
- if i+size > len(dst) {
- return i, i, transform.ErrShortDst
- }
- for ; size > 0; size-- {
- dst[i] = src[i]
- i++
- }
- }
- if len(src) > len(dst) {
- err = transform.ErrShortDst
- }
- return n, n, err
-}
diff --git a/vendor/golang.org/x/text/encoding/internal/identifier/gen.go b/vendor/golang.org/x/text/encoding/internal/identifier/gen.go
deleted file mode 100644
index 0c8eba7e52..0000000000
--- a/vendor/golang.org/x/text/encoding/internal/identifier/gen.go
+++ /dev/null
@@ -1,137 +0,0 @@
-// Copyright 2015 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build ignore
-
-package main
-
-import (
- "bytes"
- "encoding/xml"
- "fmt"
- "io"
- "log"
- "strings"
-
- "golang.org/x/text/internal/gen"
-)
-
-type registry struct {
- XMLName xml.Name `xml:"registry"`
- Updated string `xml:"updated"`
- Registry []struct {
- ID string `xml:"id,attr"`
- Record []struct {
- Name string `xml:"name"`
- Xref []struct {
- Type string `xml:"type,attr"`
- Data string `xml:"data,attr"`
- } `xml:"xref"`
- Desc struct {
- Data string `xml:",innerxml"`
- // Any []struct {
- // Data string `xml:",chardata"`
- // } `xml:",any"`
- // Data string `xml:",chardata"`
- } `xml:"description,"`
- MIB string `xml:"value"`
- Alias []string `xml:"alias"`
- MIME string `xml:"preferred_alias"`
- } `xml:"record"`
- } `xml:"registry"`
-}
-
-func main() {
- r := gen.OpenIANAFile("assignments/character-sets/character-sets.xml")
- reg := ®istry{}
- if err := xml.NewDecoder(r).Decode(®); err != nil && err != io.EOF {
- log.Fatalf("Error decoding charset registry: %v", err)
- }
- if len(reg.Registry) == 0 || reg.Registry[0].ID != "character-sets-1" {
- log.Fatalf("Unexpected ID %s", reg.Registry[0].ID)
- }
-
- w := &bytes.Buffer{}
- fmt.Fprintf(w, "const (\n")
- for _, rec := range reg.Registry[0].Record {
- constName := ""
- for _, a := range rec.Alias {
- if strings.HasPrefix(a, "cs") && strings.IndexByte(a, '-') == -1 {
- // Some of the constant definitions have comments in them. Strip those.
- constName = strings.Title(strings.SplitN(a[2:], "\n", 2)[0])
- }
- }
- if constName == "" {
- switch rec.MIB {
- case "2085":
- constName = "HZGB2312" // Not listed as alias for some reason.
- default:
- log.Fatalf("No cs alias defined for %s.", rec.MIB)
- }
- }
- if rec.MIME != "" {
- rec.MIME = fmt.Sprintf(" (MIME: %s)", rec.MIME)
- }
- fmt.Fprintf(w, "// %s is the MIB identifier with IANA name %s%s.\n//\n", constName, rec.Name, rec.MIME)
- if len(rec.Desc.Data) > 0 {
- fmt.Fprint(w, "// ")
- d := xml.NewDecoder(strings.NewReader(rec.Desc.Data))
- inElem := true
- attr := ""
- for {
- t, err := d.Token()
- if err != nil {
- if err != io.EOF {
- log.Fatal(err)
- }
- break
- }
- switch x := t.(type) {
- case xml.CharData:
- attr = "" // Don't need attribute info.
- a := bytes.Split([]byte(x), []byte("\n"))
- for i, b := range a {
- if b = bytes.TrimSpace(b); len(b) != 0 {
- if !inElem && i > 0 {
- fmt.Fprint(w, "\n// ")
- }
- inElem = false
- fmt.Fprintf(w, "%s ", string(b))
- }
- }
- case xml.StartElement:
- if x.Name.Local == "xref" {
- inElem = true
- use := false
- for _, a := range x.Attr {
- if a.Name.Local == "type" {
- use = use || a.Value != "person"
- }
- if a.Name.Local == "data" && use {
- attr = a.Value + " "
- }
- }
- }
- case xml.EndElement:
- inElem = false
- fmt.Fprint(w, attr)
- }
- }
- fmt.Fprint(w, "\n")
- }
- for _, x := range rec.Xref {
- switch x.Type {
- case "rfc":
- fmt.Fprintf(w, "// Reference: %s\n", strings.ToUpper(x.Data))
- case "uri":
- fmt.Fprintf(w, "// Reference: %s\n", x.Data)
- }
- }
- fmt.Fprintf(w, "%s MIB = %s\n", constName, rec.MIB)
- fmt.Fprintln(w)
- }
- fmt.Fprintln(w, ")")
-
- gen.WriteGoFile("mib.go", "identifier", w.Bytes())
-}
diff --git a/vendor/golang.org/x/text/encoding/internal/identifier/identifier.go b/vendor/golang.org/x/text/encoding/internal/identifier/identifier.go
deleted file mode 100644
index 5c9b85c280..0000000000
--- a/vendor/golang.org/x/text/encoding/internal/identifier/identifier.go
+++ /dev/null
@@ -1,81 +0,0 @@
-// Copyright 2015 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-//go:generate go run gen.go
-
-// Package identifier defines the contract between implementations of Encoding
-// and Index by defining identifiers that uniquely identify standardized coded
-// character sets (CCS) and character encoding schemes (CES), which we will
-// together refer to as encodings, for which Encoding implementations provide
-// converters to and from UTF-8. This package is typically only of concern to
-// implementers of Indexes and Encodings.
-//
-// One part of the identifier is the MIB code, which is defined by IANA and
-// uniquely identifies a CCS or CES. Each code is associated with data that
-// references authorities, official documentation as well as aliases and MIME
-// names.
-//
-// Not all CESs are covered by the IANA registry. The "other" string that is
-// returned by ID can be used to identify other character sets or versions of
-// existing ones.
-//
-// It is recommended that each package that provides a set of Encodings provide
-// the All and Common variables to reference all supported encodings and
-// commonly used subset. This allows Index implementations to include all
-// available encodings without explicitly referencing or knowing about them.
-package identifier
-
-// Note: this package is internal, but could be made public if there is a need
-// for writing third-party Indexes and Encodings.
-
-// References:
-// - http://source.icu-project.org/repos/icu/icu/trunk/source/data/mappings/convrtrs.txt
-// - http://www.iana.org/assignments/character-sets/character-sets.xhtml
-// - http://www.iana.org/assignments/ianacharset-mib/ianacharset-mib
-// - http://www.ietf.org/rfc/rfc2978.txt
-// - https://www.unicode.org/reports/tr22/
-// - http://www.w3.org/TR/encoding/
-// - https://encoding.spec.whatwg.org/
-// - https://encoding.spec.whatwg.org/encodings.json
-// - https://tools.ietf.org/html/rfc6657#section-5
-
-// Interface can be implemented by Encodings to define the CCS or CES for which
-// it implements conversions.
-type Interface interface {
- // ID returns an encoding identifier. Exactly one of the mib and other
- // values should be non-zero.
- //
- // In the usual case it is only necessary to indicate the MIB code. The
- // other string can be used to specify encodings for which there is no MIB,
- // such as "x-mac-dingbat".
- //
- // The other string may only contain the characters a-z, A-Z, 0-9, - and _.
- ID() (mib MIB, other string)
-
- // NOTE: the restrictions on the encoding are to allow extending the syntax
- // with additional information such as versions, vendors and other variants.
-}
-
-// A MIB identifies an encoding. It is derived from the IANA MIB codes and adds
-// some identifiers for some encodings that are not covered by the IANA
-// standard.
-//
-// See http://www.iana.org/assignments/ianacharset-mib.
-type MIB uint16
-
-// These additional MIB types are not defined in IANA. They are added because
-// they are common and defined within the text repo.
-const (
- // Unofficial marks the start of encodings not registered by IANA.
- Unofficial MIB = 10000 + iota
-
- // Replacement is the WhatWG replacement encoding.
- Replacement
-
- // XUserDefined is the code for x-user-defined.
- XUserDefined
-
- // MacintoshCyrillic is the code for x-mac-cyrillic.
- MacintoshCyrillic
-)
diff --git a/vendor/golang.org/x/text/encoding/internal/identifier/mib.go b/vendor/golang.org/x/text/encoding/internal/identifier/mib.go
deleted file mode 100644
index 8cc29021c8..0000000000
--- a/vendor/golang.org/x/text/encoding/internal/identifier/mib.go
+++ /dev/null
@@ -1,1621 +0,0 @@
-// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT.
-
-package identifier
-
-const (
- // ASCII is the MIB identifier with IANA name US-ASCII (MIME: US-ASCII).
- //
- // ANSI X3.4-1986
- // Reference: RFC2046
- ASCII MIB = 3
-
- // ISOLatin1 is the MIB identifier with IANA name ISO_8859-1:1987 (MIME: ISO-8859-1).
- //
- // ISO-IR: International Register of Escape Sequences
- // Note: The current registration authority is IPSJ/ITSCJ, Japan.
- // Reference: RFC1345
- ISOLatin1 MIB = 4
-
- // ISOLatin2 is the MIB identifier with IANA name ISO_8859-2:1987 (MIME: ISO-8859-2).
- //
- // ISO-IR: International Register of Escape Sequences
- // Note: The current registration authority is IPSJ/ITSCJ, Japan.
- // Reference: RFC1345
- ISOLatin2 MIB = 5
-
- // ISOLatin3 is the MIB identifier with IANA name ISO_8859-3:1988 (MIME: ISO-8859-3).
- //
- // ISO-IR: International Register of Escape Sequences
- // Note: The current registration authority is IPSJ/ITSCJ, Japan.
- // Reference: RFC1345
- ISOLatin3 MIB = 6
-
- // ISOLatin4 is the MIB identifier with IANA name ISO_8859-4:1988 (MIME: ISO-8859-4).
- //
- // ISO-IR: International Register of Escape Sequences
- // Note: The current registration authority is IPSJ/ITSCJ, Japan.
- // Reference: RFC1345
- ISOLatin4 MIB = 7
-
- // ISOLatinCyrillic is the MIB identifier with IANA name ISO_8859-5:1988 (MIME: ISO-8859-5).
- //
- // ISO-IR: International Register of Escape Sequences
- // Note: The current registration authority is IPSJ/ITSCJ, Japan.
- // Reference: RFC1345
- ISOLatinCyrillic MIB = 8
-
- // ISOLatinArabic is the MIB identifier with IANA name ISO_8859-6:1987 (MIME: ISO-8859-6).
- //
- // ISO-IR: International Register of Escape Sequences
- // Note: The current registration authority is IPSJ/ITSCJ, Japan.
- // Reference: RFC1345
- ISOLatinArabic MIB = 9
-
- // ISOLatinGreek is the MIB identifier with IANA name ISO_8859-7:1987 (MIME: ISO-8859-7).
- //
- // ISO-IR: International Register of Escape Sequences
- // Note: The current registration authority is IPSJ/ITSCJ, Japan.
- // Reference: RFC1947
- // Reference: RFC1345
- ISOLatinGreek MIB = 10
-
- // ISOLatinHebrew is the MIB identifier with IANA name ISO_8859-8:1988 (MIME: ISO-8859-8).
- //
- // ISO-IR: International Register of Escape Sequences
- // Note: The current registration authority is IPSJ/ITSCJ, Japan.
- // Reference: RFC1345
- ISOLatinHebrew MIB = 11
-
- // ISOLatin5 is the MIB identifier with IANA name ISO_8859-9:1989 (MIME: ISO-8859-9).
- //
- // ISO-IR: International Register of Escape Sequences
- // Note: The current registration authority is IPSJ/ITSCJ, Japan.
- // Reference: RFC1345
- ISOLatin5 MIB = 12
-
- // ISOLatin6 is the MIB identifier with IANA name ISO-8859-10 (MIME: ISO-8859-10).
- //
- // ISO-IR: International Register of Escape Sequences
- // Note: The current registration authority is IPSJ/ITSCJ, Japan.
- // Reference: RFC1345
- ISOLatin6 MIB = 13
-
- // ISOTextComm is the MIB identifier with IANA name ISO_6937-2-add.
- //
- // ISO-IR: International Register of Escape Sequences and ISO 6937-2:1983
- // Note: The current registration authority is IPSJ/ITSCJ, Japan.
- // Reference: RFC1345
- ISOTextComm MIB = 14
-
- // HalfWidthKatakana is the MIB identifier with IANA name JIS_X0201.
- //
- // JIS X 0201-1976. One byte only, this is equivalent to
- // JIS/Roman (similar to ASCII) plus eight-bit half-width
- // Katakana
- // Reference: RFC1345
- HalfWidthKatakana MIB = 15
-
- // JISEncoding is the MIB identifier with IANA name JIS_Encoding.
- //
- // JIS X 0202-1991. Uses ISO 2022 escape sequences to
- // shift code sets as documented in JIS X 0202-1991.
- JISEncoding MIB = 16
-
- // ShiftJIS is the MIB identifier with IANA name Shift_JIS (MIME: Shift_JIS).
- //
- // This charset is an extension of csHalfWidthKatakana by
- // adding graphic characters in JIS X 0208. The CCS's are
- // JIS X0201:1997 and JIS X0208:1997. The
- // complete definition is shown in Appendix 1 of JIS
- // X0208:1997.
- // This charset can be used for the top-level media type "text".
- ShiftJIS MIB = 17
-
- // EUCPkdFmtJapanese is the MIB identifier with IANA name Extended_UNIX_Code_Packed_Format_for_Japanese (MIME: EUC-JP).
- //
- // Standardized by OSF, UNIX International, and UNIX Systems
- // Laboratories Pacific. Uses ISO 2022 rules to select
- // code set 0: US-ASCII (a single 7-bit byte set)
- // code set 1: JIS X0208-1990 (a double 8-bit byte set)
- // restricted to A0-FF in both bytes
- // code set 2: Half Width Katakana (a single 7-bit byte set)
- // requiring SS2 as the character prefix
- // code set 3: JIS X0212-1990 (a double 7-bit byte set)
- // restricted to A0-FF in both bytes
- // requiring SS3 as the character prefix
- EUCPkdFmtJapanese MIB = 18
-
- // EUCFixWidJapanese is the MIB identifier with IANA name Extended_UNIX_Code_Fixed_Width_for_Japanese.
- //
- // Used in Japan. Each character is 2 octets.
- // code set 0: US-ASCII (a single 7-bit byte set)
- // 1st byte = 00
- // 2nd byte = 20-7E
- // code set 1: JIS X0208-1990 (a double 7-bit byte set)
- // restricted to A0-FF in both bytes
- // code set 2: Half Width Katakana (a single 7-bit byte set)
- // 1st byte = 00
- // 2nd byte = A0-FF
- // code set 3: JIS X0212-1990 (a double 7-bit byte set)
- // restricted to A0-FF in
- // the first byte
- // and 21-7E in the second byte
- EUCFixWidJapanese MIB = 19
-
- // ISO4UnitedKingdom is the MIB identifier with IANA name BS_4730.
- //
- // ISO-IR: International Register of Escape Sequences
- // Note: The current registration authority is IPSJ/ITSCJ, Japan.
- // Reference: RFC1345
- ISO4UnitedKingdom MIB = 20
-
- // ISO11SwedishForNames is the MIB identifier with IANA name SEN_850200_C.
- //
- // ISO-IR: International Register of Escape Sequences
- // Note: The current registration authority is IPSJ/ITSCJ, Japan.
- // Reference: RFC1345
- ISO11SwedishForNames MIB = 21
-
- // ISO15Italian is the MIB identifier with IANA name IT.
- //
- // ISO-IR: International Register of Escape Sequences
- // Note: The current registration authority is IPSJ/ITSCJ, Japan.
- // Reference: RFC1345
- ISO15Italian MIB = 22
-
- // ISO17Spanish is the MIB identifier with IANA name ES.
- //
- // ISO-IR: International Register of Escape Sequences
- // Note: The current registration authority is IPSJ/ITSCJ, Japan.
- // Reference: RFC1345
- ISO17Spanish MIB = 23
-
- // ISO21German is the MIB identifier with IANA name DIN_66003.
- //
- // ISO-IR: International Register of Escape Sequences
- // Note: The current registration authority is IPSJ/ITSCJ, Japan.
- // Reference: RFC1345
- ISO21German MIB = 24
-
- // ISO60Norwegian1 is the MIB identifier with IANA name NS_4551-1.
- //
- // ISO-IR: International Register of Escape Sequences
- // Note: The current registration authority is IPSJ/ITSCJ, Japan.
- // Reference: RFC1345
- ISO60Norwegian1 MIB = 25
-
- // ISO69French is the MIB identifier with IANA name NF_Z_62-010.
- //
- // ISO-IR: International Register of Escape Sequences
- // Note: The current registration authority is IPSJ/ITSCJ, Japan.
- // Reference: RFC1345
- ISO69French MIB = 26
-
- // ISO10646UTF1 is the MIB identifier with IANA name ISO-10646-UTF-1.
- //
- // Universal Transfer Format (1), this is the multibyte
- // encoding, that subsets ASCII-7. It does not have byte
- // ordering issues.
- ISO10646UTF1 MIB = 27
-
- // ISO646basic1983 is the MIB identifier with IANA name ISO_646.basic:1983.
- //
- // ISO-IR: International Register of Escape Sequences
- // Note: The current registration authority is IPSJ/ITSCJ, Japan.
- // Reference: RFC1345
- ISO646basic1983 MIB = 28
-
- // INVARIANT is the MIB identifier with IANA name INVARIANT.
- //
- // Reference: RFC1345
- INVARIANT MIB = 29
-
- // ISO2IntlRefVersion is the MIB identifier with IANA name ISO_646.irv:1983.
- //
- // ISO-IR: International Register of Escape Sequences
- // Note: The current registration authority is IPSJ/ITSCJ, Japan.
- // Reference: RFC1345
- ISO2IntlRefVersion MIB = 30
-
- // NATSSEFI is the MIB identifier with IANA name NATS-SEFI.
- //
- // ISO-IR: International Register of Escape Sequences
- // Note: The current registration authority is IPSJ/ITSCJ, Japan.
- // Reference: RFC1345
- NATSSEFI MIB = 31
-
- // NATSSEFIADD is the MIB identifier with IANA name NATS-SEFI-ADD.
- //
- // ISO-IR: International Register of Escape Sequences
- // Note: The current registration authority is IPSJ/ITSCJ, Japan.
- // Reference: RFC1345
- NATSSEFIADD MIB = 32
-
- // NATSDANO is the MIB identifier with IANA name NATS-DANO.
- //
- // ISO-IR: International Register of Escape Sequences
- // Note: The current registration authority is IPSJ/ITSCJ, Japan.
- // Reference: RFC1345
- NATSDANO MIB = 33
-
- // NATSDANOADD is the MIB identifier with IANA name NATS-DANO-ADD.
- //
- // ISO-IR: International Register of Escape Sequences
- // Note: The current registration authority is IPSJ/ITSCJ, Japan.
- // Reference: RFC1345
- NATSDANOADD MIB = 34
-
- // ISO10Swedish is the MIB identifier with IANA name SEN_850200_B.
- //
- // ISO-IR: International Register of Escape Sequences
- // Note: The current registration authority is IPSJ/ITSCJ, Japan.
- // Reference: RFC1345
- ISO10Swedish MIB = 35
-
- // KSC56011987 is the MIB identifier with IANA name KS_C_5601-1987.
- //
- // ISO-IR: International Register of Escape Sequences
- // Note: The current registration authority is IPSJ/ITSCJ, Japan.
- // Reference: RFC1345
- KSC56011987 MIB = 36
-
- // ISO2022KR is the MIB identifier with IANA name ISO-2022-KR (MIME: ISO-2022-KR).
- //
- // rfc1557 (see also KS_C_5601-1987)
- // Reference: RFC1557
- ISO2022KR MIB = 37
-
- // EUCKR is the MIB identifier with IANA name EUC-KR (MIME: EUC-KR).
- //
- // rfc1557 (see also KS_C_5861-1992)
- // Reference: RFC1557
- EUCKR MIB = 38
-
- // ISO2022JP is the MIB identifier with IANA name ISO-2022-JP (MIME: ISO-2022-JP).
- //
- // rfc1468 (see also rfc2237 )
- // Reference: RFC1468
- ISO2022JP MIB = 39
-
- // ISO2022JP2 is the MIB identifier with IANA name ISO-2022-JP-2 (MIME: ISO-2022-JP-2).
- //
- // rfc1554
- // Reference: RFC1554
- ISO2022JP2 MIB = 40
-
- // ISO13JISC6220jp is the MIB identifier with IANA name JIS_C6220-1969-jp.
- //
- // ISO-IR: International Register of Escape Sequences
- // Note: The current registration authority is IPSJ/ITSCJ, Japan.
- // Reference: RFC1345
- ISO13JISC6220jp MIB = 41
-
- // ISO14JISC6220ro is the MIB identifier with IANA name JIS_C6220-1969-ro.
- //
- // ISO-IR: International Register of Escape Sequences
- // Note: The current registration authority is IPSJ/ITSCJ, Japan.
- // Reference: RFC1345
- ISO14JISC6220ro MIB = 42
-
- // ISO16Portuguese is the MIB identifier with IANA name PT.
- //
- // ISO-IR: International Register of Escape Sequences
- // Note: The current registration authority is IPSJ/ITSCJ, Japan.
- // Reference: RFC1345
- ISO16Portuguese MIB = 43
-
- // ISO18Greek7Old is the MIB identifier with IANA name greek7-old.
- //
- // ISO-IR: International Register of Escape Sequences
- // Note: The current registration authority is IPSJ/ITSCJ, Japan.
- // Reference: RFC1345
- ISO18Greek7Old MIB = 44
-
- // ISO19LatinGreek is the MIB identifier with IANA name latin-greek.
- //
- // ISO-IR: International Register of Escape Sequences
- // Note: The current registration authority is IPSJ/ITSCJ, Japan.
- // Reference: RFC1345
- ISO19LatinGreek MIB = 45
-
- // ISO25French is the MIB identifier with IANA name NF_Z_62-010_(1973).
- //
- // ISO-IR: International Register of Escape Sequences
- // Note: The current registration authority is IPSJ/ITSCJ, Japan.
- // Reference: RFC1345
- ISO25French MIB = 46
-
- // ISO27LatinGreek1 is the MIB identifier with IANA name Latin-greek-1.
- //
- // ISO-IR: International Register of Escape Sequences
- // Note: The current registration authority is IPSJ/ITSCJ, Japan.
- // Reference: RFC1345
- ISO27LatinGreek1 MIB = 47
-
- // ISO5427Cyrillic is the MIB identifier with IANA name ISO_5427.
- //
- // ISO-IR: International Register of Escape Sequences
- // Note: The current registration authority is IPSJ/ITSCJ, Japan.
- // Reference: RFC1345
- ISO5427Cyrillic MIB = 48
-
- // ISO42JISC62261978 is the MIB identifier with IANA name JIS_C6226-1978.
- //
- // ISO-IR: International Register of Escape Sequences
- // Note: The current registration authority is IPSJ/ITSCJ, Japan.
- // Reference: RFC1345
- ISO42JISC62261978 MIB = 49
-
- // ISO47BSViewdata is the MIB identifier with IANA name BS_viewdata.
- //
- // ISO-IR: International Register of Escape Sequences
- // Note: The current registration authority is IPSJ/ITSCJ, Japan.
- // Reference: RFC1345
- ISO47BSViewdata MIB = 50
-
- // ISO49INIS is the MIB identifier with IANA name INIS.
- //
- // ISO-IR: International Register of Escape Sequences
- // Note: The current registration authority is IPSJ/ITSCJ, Japan.
- // Reference: RFC1345
- ISO49INIS MIB = 51
-
- // ISO50INIS8 is the MIB identifier with IANA name INIS-8.
- //
- // ISO-IR: International Register of Escape Sequences
- // Note: The current registration authority is IPSJ/ITSCJ, Japan.
- // Reference: RFC1345
- ISO50INIS8 MIB = 52
-
- // ISO51INISCyrillic is the MIB identifier with IANA name INIS-cyrillic.
- //
- // ISO-IR: International Register of Escape Sequences
- // Note: The current registration authority is IPSJ/ITSCJ, Japan.
- // Reference: RFC1345
- ISO51INISCyrillic MIB = 53
-
- // ISO54271981 is the MIB identifier with IANA name ISO_5427:1981.
- //
- // ISO-IR: International Register of Escape Sequences
- // Note: The current registration authority is IPSJ/ITSCJ, Japan.
- // Reference: RFC1345
- ISO54271981 MIB = 54
-
- // ISO5428Greek is the MIB identifier with IANA name ISO_5428:1980.
- //
- // ISO-IR: International Register of Escape Sequences
- // Note: The current registration authority is IPSJ/ITSCJ, Japan.
- // Reference: RFC1345
- ISO5428Greek MIB = 55
-
- // ISO57GB1988 is the MIB identifier with IANA name GB_1988-80.
- //
- // ISO-IR: International Register of Escape Sequences
- // Note: The current registration authority is IPSJ/ITSCJ, Japan.
- // Reference: RFC1345
- ISO57GB1988 MIB = 56
-
- // ISO58GB231280 is the MIB identifier with IANA name GB_2312-80.
- //
- // ISO-IR: International Register of Escape Sequences
- // Note: The current registration authority is IPSJ/ITSCJ, Japan.
- // Reference: RFC1345
- ISO58GB231280 MIB = 57
-
- // ISO61Norwegian2 is the MIB identifier with IANA name NS_4551-2.
- //
- // ISO-IR: International Register of Escape Sequences
- // Note: The current registration authority is IPSJ/ITSCJ, Japan.
- // Reference: RFC1345
- ISO61Norwegian2 MIB = 58
-
- // ISO70VideotexSupp1 is the MIB identifier with IANA name videotex-suppl.
- //
- // ISO-IR: International Register of Escape Sequences
- // Note: The current registration authority is IPSJ/ITSCJ, Japan.
- // Reference: RFC1345
- ISO70VideotexSupp1 MIB = 59
-
- // ISO84Portuguese2 is the MIB identifier with IANA name PT2.
- //
- // ISO-IR: International Register of Escape Sequences
- // Note: The current registration authority is IPSJ/ITSCJ, Japan.
- // Reference: RFC1345
- ISO84Portuguese2 MIB = 60
-
- // ISO85Spanish2 is the MIB identifier with IANA name ES2.
- //
- // ISO-IR: International Register of Escape Sequences
- // Note: The current registration authority is IPSJ/ITSCJ, Japan.
- // Reference: RFC1345
- ISO85Spanish2 MIB = 61
-
- // ISO86Hungarian is the MIB identifier with IANA name MSZ_7795.3.
- //
- // ISO-IR: International Register of Escape Sequences
- // Note: The current registration authority is IPSJ/ITSCJ, Japan.
- // Reference: RFC1345
- ISO86Hungarian MIB = 62
-
- // ISO87JISX0208 is the MIB identifier with IANA name JIS_C6226-1983.
- //
- // ISO-IR: International Register of Escape Sequences
- // Note: The current registration authority is IPSJ/ITSCJ, Japan.
- // Reference: RFC1345
- ISO87JISX0208 MIB = 63
-
- // ISO88Greek7 is the MIB identifier with IANA name greek7.
- //
- // ISO-IR: International Register of Escape Sequences
- // Note: The current registration authority is IPSJ/ITSCJ, Japan.
- // Reference: RFC1345
- ISO88Greek7 MIB = 64
-
- // ISO89ASMO449 is the MIB identifier with IANA name ASMO_449.
- //
- // ISO-IR: International Register of Escape Sequences
- // Note: The current registration authority is IPSJ/ITSCJ, Japan.
- // Reference: RFC1345
- ISO89ASMO449 MIB = 65
-
- // ISO90 is the MIB identifier with IANA name iso-ir-90.
- //
- // ISO-IR: International Register of Escape Sequences
- // Note: The current registration authority is IPSJ/ITSCJ, Japan.
- // Reference: RFC1345
- ISO90 MIB = 66
-
- // ISO91JISC62291984a is the MIB identifier with IANA name JIS_C6229-1984-a.
- //
- // ISO-IR: International Register of Escape Sequences
- // Note: The current registration authority is IPSJ/ITSCJ, Japan.
- // Reference: RFC1345
- ISO91JISC62291984a MIB = 67
-
- // ISO92JISC62991984b is the MIB identifier with IANA name JIS_C6229-1984-b.
- //
- // ISO-IR: International Register of Escape Sequences
- // Note: The current registration authority is IPSJ/ITSCJ, Japan.
- // Reference: RFC1345
- ISO92JISC62991984b MIB = 68
-
- // ISO93JIS62291984badd is the MIB identifier with IANA name JIS_C6229-1984-b-add.
- //
- // ISO-IR: International Register of Escape Sequences
- // Note: The current registration authority is IPSJ/ITSCJ, Japan.
- // Reference: RFC1345
- ISO93JIS62291984badd MIB = 69
-
- // ISO94JIS62291984hand is the MIB identifier with IANA name JIS_C6229-1984-hand.
- //
- // ISO-IR: International Register of Escape Sequences
- // Note: The current registration authority is IPSJ/ITSCJ, Japan.
- // Reference: RFC1345
- ISO94JIS62291984hand MIB = 70
-
- // ISO95JIS62291984handadd is the MIB identifier with IANA name JIS_C6229-1984-hand-add.
- //
- // ISO-IR: International Register of Escape Sequences
- // Note: The current registration authority is IPSJ/ITSCJ, Japan.
- // Reference: RFC1345
- ISO95JIS62291984handadd MIB = 71
-
- // ISO96JISC62291984kana is the MIB identifier with IANA name JIS_C6229-1984-kana.
- //
- // ISO-IR: International Register of Escape Sequences
- // Note: The current registration authority is IPSJ/ITSCJ, Japan.
- // Reference: RFC1345
- ISO96JISC62291984kana MIB = 72
-
- // ISO2033 is the MIB identifier with IANA name ISO_2033-1983.
- //
- // ISO-IR: International Register of Escape Sequences
- // Note: The current registration authority is IPSJ/ITSCJ, Japan.
- // Reference: RFC1345
- ISO2033 MIB = 73
-
- // ISO99NAPLPS is the MIB identifier with IANA name ANSI_X3.110-1983.
- //
- // ISO-IR: International Register of Escape Sequences
- // Note: The current registration authority is IPSJ/ITSCJ, Japan.
- // Reference: RFC1345
- ISO99NAPLPS MIB = 74
-
- // ISO102T617bit is the MIB identifier with IANA name T.61-7bit.
- //
- // ISO-IR: International Register of Escape Sequences
- // Note: The current registration authority is IPSJ/ITSCJ, Japan.
- // Reference: RFC1345
- ISO102T617bit MIB = 75
-
- // ISO103T618bit is the MIB identifier with IANA name T.61-8bit.
- //
- // ISO-IR: International Register of Escape Sequences
- // Note: The current registration authority is IPSJ/ITSCJ, Japan.
- // Reference: RFC1345
- ISO103T618bit MIB = 76
-
- // ISO111ECMACyrillic is the MIB identifier with IANA name ECMA-cyrillic.
- //
- // ISO registry
- // (formerly ECMA
- // registry )
- ISO111ECMACyrillic MIB = 77
-
- // ISO121Canadian1 is the MIB identifier with IANA name CSA_Z243.4-1985-1.
- //
- // ISO-IR: International Register of Escape Sequences
- // Note: The current registration authority is IPSJ/ITSCJ, Japan.
- // Reference: RFC1345
- ISO121Canadian1 MIB = 78
-
- // ISO122Canadian2 is the MIB identifier with IANA name CSA_Z243.4-1985-2.
- //
- // ISO-IR: International Register of Escape Sequences
- // Note: The current registration authority is IPSJ/ITSCJ, Japan.
- // Reference: RFC1345
- ISO122Canadian2 MIB = 79
-
- // ISO123CSAZ24341985gr is the MIB identifier with IANA name CSA_Z243.4-1985-gr.
- //
- // ISO-IR: International Register of Escape Sequences
- // Note: The current registration authority is IPSJ/ITSCJ, Japan.
- // Reference: RFC1345
- ISO123CSAZ24341985gr MIB = 80
-
- // ISO88596E is the MIB identifier with IANA name ISO_8859-6-E (MIME: ISO-8859-6-E).
- //
- // rfc1556
- // Reference: RFC1556
- ISO88596E MIB = 81
-
- // ISO88596I is the MIB identifier with IANA name ISO_8859-6-I (MIME: ISO-8859-6-I).
- //
- // rfc1556
- // Reference: RFC1556
- ISO88596I MIB = 82
-
- // ISO128T101G2 is the MIB identifier with IANA name T.101-G2.
- //
- // ISO-IR: International Register of Escape Sequences
- // Note: The current registration authority is IPSJ/ITSCJ, Japan.
- // Reference: RFC1345
- ISO128T101G2 MIB = 83
-
- // ISO88598E is the MIB identifier with IANA name ISO_8859-8-E (MIME: ISO-8859-8-E).
- //
- // rfc1556
- // Reference: RFC1556
- ISO88598E MIB = 84
-
- // ISO88598I is the MIB identifier with IANA name ISO_8859-8-I (MIME: ISO-8859-8-I).
- //
- // rfc1556
- // Reference: RFC1556
- ISO88598I MIB = 85
-
- // ISO139CSN369103 is the MIB identifier with IANA name CSN_369103.
- //
- // ISO-IR: International Register of Escape Sequences
- // Note: The current registration authority is IPSJ/ITSCJ, Japan.
- // Reference: RFC1345
- ISO139CSN369103 MIB = 86
-
- // ISO141JUSIB1002 is the MIB identifier with IANA name JUS_I.B1.002.
- //
- // ISO-IR: International Register of Escape Sequences
- // Note: The current registration authority is IPSJ/ITSCJ, Japan.
- // Reference: RFC1345
- ISO141JUSIB1002 MIB = 87
-
- // ISO143IECP271 is the MIB identifier with IANA name IEC_P27-1.
- //
- // ISO-IR: International Register of Escape Sequences
- // Note: The current registration authority is IPSJ/ITSCJ, Japan.
- // Reference: RFC1345
- ISO143IECP271 MIB = 88
-
- // ISO146Serbian is the MIB identifier with IANA name JUS_I.B1.003-serb.
- //
- // ISO-IR: International Register of Escape Sequences
- // Note: The current registration authority is IPSJ/ITSCJ, Japan.
- // Reference: RFC1345
- ISO146Serbian MIB = 89
-
- // ISO147Macedonian is the MIB identifier with IANA name JUS_I.B1.003-mac.
- //
- // ISO-IR: International Register of Escape Sequences
- // Note: The current registration authority is IPSJ/ITSCJ, Japan.
- // Reference: RFC1345
- ISO147Macedonian MIB = 90
-
- // ISO150GreekCCITT is the MIB identifier with IANA name greek-ccitt.
- //
- // ISO-IR: International Register of Escape Sequences
- // Note: The current registration authority is IPSJ/ITSCJ, Japan.
- // Reference: RFC1345
- ISO150GreekCCITT MIB = 91
-
- // ISO151Cuba is the MIB identifier with IANA name NC_NC00-10:81.
- //
- // ISO-IR: International Register of Escape Sequences
- // Note: The current registration authority is IPSJ/ITSCJ, Japan.
- // Reference: RFC1345
- ISO151Cuba MIB = 92
-
- // ISO6937Add is the MIB identifier with IANA name ISO_6937-2-25.
- //
- // ISO-IR: International Register of Escape Sequences
- // Note: The current registration authority is IPSJ/ITSCJ, Japan.
- // Reference: RFC1345
- ISO6937Add MIB = 93
-
- // ISO153GOST1976874 is the MIB identifier with IANA name GOST_19768-74.
- //
- // ISO-IR: International Register of Escape Sequences
- // Note: The current registration authority is IPSJ/ITSCJ, Japan.
- // Reference: RFC1345
- ISO153GOST1976874 MIB = 94
-
- // ISO8859Supp is the MIB identifier with IANA name ISO_8859-supp.
- //
- // ISO-IR: International Register of Escape Sequences
- // Note: The current registration authority is IPSJ/ITSCJ, Japan.
- // Reference: RFC1345
- ISO8859Supp MIB = 95
-
- // ISO10367Box is the MIB identifier with IANA name ISO_10367-box.
- //
- // ISO-IR: International Register of Escape Sequences
- // Note: The current registration authority is IPSJ/ITSCJ, Japan.
- // Reference: RFC1345
- ISO10367Box MIB = 96
-
- // ISO158Lap is the MIB identifier with IANA name latin-lap.
- //
- // ISO-IR: International Register of Escape Sequences
- // Note: The current registration authority is IPSJ/ITSCJ, Japan.
- // Reference: RFC1345
- ISO158Lap MIB = 97
-
- // ISO159JISX02121990 is the MIB identifier with IANA name JIS_X0212-1990.
- //
- // ISO-IR: International Register of Escape Sequences
- // Note: The current registration authority is IPSJ/ITSCJ, Japan.
- // Reference: RFC1345
- ISO159JISX02121990 MIB = 98
-
- // ISO646Danish is the MIB identifier with IANA name DS_2089.
- //
- // Danish Standard, DS 2089, February 1974
- // Reference: RFC1345
- ISO646Danish MIB = 99
-
- // USDK is the MIB identifier with IANA name us-dk.
- //
- // Reference: RFC1345
- USDK MIB = 100
-
- // DKUS is the MIB identifier with IANA name dk-us.
- //
- // Reference: RFC1345
- DKUS MIB = 101
-
- // KSC5636 is the MIB identifier with IANA name KSC5636.
- //
- // Reference: RFC1345
- KSC5636 MIB = 102
-
- // Unicode11UTF7 is the MIB identifier with IANA name UNICODE-1-1-UTF-7.
- //
- // rfc1642
- // Reference: RFC1642
- Unicode11UTF7 MIB = 103
-
- // ISO2022CN is the MIB identifier with IANA name ISO-2022-CN.
- //
- // rfc1922
- // Reference: RFC1922
- ISO2022CN MIB = 104
-
- // ISO2022CNEXT is the MIB identifier with IANA name ISO-2022-CN-EXT.
- //
- // rfc1922
- // Reference: RFC1922
- ISO2022CNEXT MIB = 105
-
- // UTF8 is the MIB identifier with IANA name UTF-8.
- //
- // rfc3629
- // Reference: RFC3629
- UTF8 MIB = 106
-
- // ISO885913 is the MIB identifier with IANA name ISO-8859-13.
- //
- // ISO See http://www.iana.org/assignments/charset-reg/ISO-8859-13 http://www.iana.org/assignments/charset-reg/ISO-8859-13
- ISO885913 MIB = 109
-
- // ISO885914 is the MIB identifier with IANA name ISO-8859-14.
- //
- // ISO See http://www.iana.org/assignments/charset-reg/ISO-8859-14
- ISO885914 MIB = 110
-
- // ISO885915 is the MIB identifier with IANA name ISO-8859-15.
- //
- // ISO
- // Please see: http://www.iana.org/assignments/charset-reg/ISO-8859-15
- ISO885915 MIB = 111
-
- // ISO885916 is the MIB identifier with IANA name ISO-8859-16.
- //
- // ISO
- ISO885916 MIB = 112
-
- // GBK is the MIB identifier with IANA name GBK.
- //
- // Chinese IT Standardization Technical Committee
- // Please see: http://www.iana.org/assignments/charset-reg/GBK
- GBK MIB = 113
-
- // GB18030 is the MIB identifier with IANA name GB18030.
- //
- // Chinese IT Standardization Technical Committee
- // Please see: http://www.iana.org/assignments/charset-reg/GB18030
- GB18030 MIB = 114
-
- // OSDEBCDICDF0415 is the MIB identifier with IANA name OSD_EBCDIC_DF04_15.
- //
- // Fujitsu-Siemens standard mainframe EBCDIC encoding
- // Please see: http://www.iana.org/assignments/charset-reg/OSD-EBCDIC-DF04-15
- OSDEBCDICDF0415 MIB = 115
-
- // OSDEBCDICDF03IRV is the MIB identifier with IANA name OSD_EBCDIC_DF03_IRV.
- //
- // Fujitsu-Siemens standard mainframe EBCDIC encoding
- // Please see: http://www.iana.org/assignments/charset-reg/OSD-EBCDIC-DF03-IRV
- OSDEBCDICDF03IRV MIB = 116
-
- // OSDEBCDICDF041 is the MIB identifier with IANA name OSD_EBCDIC_DF04_1.
- //
- // Fujitsu-Siemens standard mainframe EBCDIC encoding
- // Please see: http://www.iana.org/assignments/charset-reg/OSD-EBCDIC-DF04-1
- OSDEBCDICDF041 MIB = 117
-
- // ISO115481 is the MIB identifier with IANA name ISO-11548-1.
- //
- // See http://www.iana.org/assignments/charset-reg/ISO-11548-1
- ISO115481 MIB = 118
-
- // KZ1048 is the MIB identifier with IANA name KZ-1048.
- //
- // See http://www.iana.org/assignments/charset-reg/KZ-1048
- KZ1048 MIB = 119
-
- // Unicode is the MIB identifier with IANA name ISO-10646-UCS-2.
- //
- // the 2-octet Basic Multilingual Plane, aka Unicode
- // this needs to specify network byte order: the standard
- // does not specify (it is a 16-bit integer space)
- Unicode MIB = 1000
-
- // UCS4 is the MIB identifier with IANA name ISO-10646-UCS-4.
- //
- // the full code space. (same comment about byte order,
- // these are 31-bit numbers.
- UCS4 MIB = 1001
-
- // UnicodeASCII is the MIB identifier with IANA name ISO-10646-UCS-Basic.
- //
- // ASCII subset of Unicode. Basic Latin = collection 1
- // See ISO 10646, Appendix A
- UnicodeASCII MIB = 1002
-
- // UnicodeLatin1 is the MIB identifier with IANA name ISO-10646-Unicode-Latin1.
- //
- // ISO Latin-1 subset of Unicode. Basic Latin and Latin-1
- // Supplement = collections 1 and 2. See ISO 10646,
- // Appendix A. See rfc1815 .
- UnicodeLatin1 MIB = 1003
-
- // UnicodeJapanese is the MIB identifier with IANA name ISO-10646-J-1.
- //
- // ISO 10646 Japanese, see rfc1815 .
- UnicodeJapanese MIB = 1004
-
- // UnicodeIBM1261 is the MIB identifier with IANA name ISO-Unicode-IBM-1261.
- //
- // IBM Latin-2, -3, -5, Extended Presentation Set, GCSGID: 1261
- UnicodeIBM1261 MIB = 1005
-
- // UnicodeIBM1268 is the MIB identifier with IANA name ISO-Unicode-IBM-1268.
- //
- // IBM Latin-4 Extended Presentation Set, GCSGID: 1268
- UnicodeIBM1268 MIB = 1006
-
- // UnicodeIBM1276 is the MIB identifier with IANA name ISO-Unicode-IBM-1276.
- //
- // IBM Cyrillic Greek Extended Presentation Set, GCSGID: 1276
- UnicodeIBM1276 MIB = 1007
-
- // UnicodeIBM1264 is the MIB identifier with IANA name ISO-Unicode-IBM-1264.
- //
- // IBM Arabic Presentation Set, GCSGID: 1264
- UnicodeIBM1264 MIB = 1008
-
- // UnicodeIBM1265 is the MIB identifier with IANA name ISO-Unicode-IBM-1265.
- //
- // IBM Hebrew Presentation Set, GCSGID: 1265
- UnicodeIBM1265 MIB = 1009
-
- // Unicode11 is the MIB identifier with IANA name UNICODE-1-1.
- //
- // rfc1641
- // Reference: RFC1641
- Unicode11 MIB = 1010
-
- // SCSU is the MIB identifier with IANA name SCSU.
- //
- // SCSU See http://www.iana.org/assignments/charset-reg/SCSU
- SCSU MIB = 1011
-
- // UTF7 is the MIB identifier with IANA name UTF-7.
- //
- // rfc2152
- // Reference: RFC2152
- UTF7 MIB = 1012
-
- // UTF16BE is the MIB identifier with IANA name UTF-16BE.
- //
- // rfc2781
- // Reference: RFC2781
- UTF16BE MIB = 1013
-
- // UTF16LE is the MIB identifier with IANA name UTF-16LE.
- //
- // rfc2781
- // Reference: RFC2781
- UTF16LE MIB = 1014
-
- // UTF16 is the MIB identifier with IANA name UTF-16.
- //
- // rfc2781
- // Reference: RFC2781
- UTF16 MIB = 1015
-
- // CESU8 is the MIB identifier with IANA name CESU-8.
- //
- // https://www.unicode.org/unicode/reports/tr26
- CESU8 MIB = 1016
-
- // UTF32 is the MIB identifier with IANA name UTF-32.
- //
- // https://www.unicode.org/unicode/reports/tr19/
- UTF32 MIB = 1017
-
- // UTF32BE is the MIB identifier with IANA name UTF-32BE.
- //
- // https://www.unicode.org/unicode/reports/tr19/
- UTF32BE MIB = 1018
-
- // UTF32LE is the MIB identifier with IANA name UTF-32LE.
- //
- // https://www.unicode.org/unicode/reports/tr19/
- UTF32LE MIB = 1019
-
- // BOCU1 is the MIB identifier with IANA name BOCU-1.
- //
- // https://www.unicode.org/notes/tn6/
- BOCU1 MIB = 1020
-
- // Windows30Latin1 is the MIB identifier with IANA name ISO-8859-1-Windows-3.0-Latin-1.
- //
- // Extended ISO 8859-1 Latin-1 for Windows 3.0.
- // PCL Symbol Set id: 9U
- Windows30Latin1 MIB = 2000
-
- // Windows31Latin1 is the MIB identifier with IANA name ISO-8859-1-Windows-3.1-Latin-1.
- //
- // Extended ISO 8859-1 Latin-1 for Windows 3.1.
- // PCL Symbol Set id: 19U
- Windows31Latin1 MIB = 2001
-
- // Windows31Latin2 is the MIB identifier with IANA name ISO-8859-2-Windows-Latin-2.
- //
- // Extended ISO 8859-2. Latin-2 for Windows 3.1.
- // PCL Symbol Set id: 9E
- Windows31Latin2 MIB = 2002
-
- // Windows31Latin5 is the MIB identifier with IANA name ISO-8859-9-Windows-Latin-5.
- //
- // Extended ISO 8859-9. Latin-5 for Windows 3.1
- // PCL Symbol Set id: 5T
- Windows31Latin5 MIB = 2003
-
- // HPRoman8 is the MIB identifier with IANA name hp-roman8.
- //
- // LaserJet IIP Printer User's Manual,
- // HP part no 33471-90901, Hewlet-Packard, June 1989.
- // Reference: RFC1345
- HPRoman8 MIB = 2004
-
- // AdobeStandardEncoding is the MIB identifier with IANA name Adobe-Standard-Encoding.
- //
- // PostScript Language Reference Manual
- // PCL Symbol Set id: 10J
- AdobeStandardEncoding MIB = 2005
-
- // VenturaUS is the MIB identifier with IANA name Ventura-US.
- //
- // Ventura US. ASCII plus characters typically used in
- // publishing, like pilcrow, copyright, registered, trade mark,
- // section, dagger, and double dagger in the range A0 (hex)
- // to FF (hex).
- // PCL Symbol Set id: 14J
- VenturaUS MIB = 2006
-
- // VenturaInternational is the MIB identifier with IANA name Ventura-International.
- //
- // Ventura International. ASCII plus coded characters similar
- // to Roman8.
- // PCL Symbol Set id: 13J
- VenturaInternational MIB = 2007
-
- // DECMCS is the MIB identifier with IANA name DEC-MCS.
- //
- // VAX/VMS User's Manual,
- // Order Number: AI-Y517A-TE, April 1986.
- // Reference: RFC1345
- DECMCS MIB = 2008
-
- // PC850Multilingual is the MIB identifier with IANA name IBM850.
- //
- // IBM NLS RM Vol2 SE09-8002-01, March 1990
- // Reference: RFC1345
- PC850Multilingual MIB = 2009
-
- // PC8DanishNorwegian is the MIB identifier with IANA name PC8-Danish-Norwegian.
- //
- // PC Danish Norwegian
- // 8-bit PC set for Danish Norwegian
- // PCL Symbol Set id: 11U
- PC8DanishNorwegian MIB = 2012
-
- // PC862LatinHebrew is the MIB identifier with IANA name IBM862.
- //
- // IBM NLS RM Vol2 SE09-8002-01, March 1990
- // Reference: RFC1345
- PC862LatinHebrew MIB = 2013
-
- // PC8Turkish is the MIB identifier with IANA name PC8-Turkish.
- //
- // PC Latin Turkish. PCL Symbol Set id: 9T
- PC8Turkish MIB = 2014
-
- // IBMSymbols is the MIB identifier with IANA name IBM-Symbols.
- //
- // Presentation Set, CPGID: 259
- IBMSymbols MIB = 2015
-
- // IBMThai is the MIB identifier with IANA name IBM-Thai.
- //
- // Presentation Set, CPGID: 838
- IBMThai MIB = 2016
-
- // HPLegal is the MIB identifier with IANA name HP-Legal.
- //
- // PCL 5 Comparison Guide, Hewlett-Packard,
- // HP part number 5961-0510, October 1992
- // PCL Symbol Set id: 1U
- HPLegal MIB = 2017
-
- // HPPiFont is the MIB identifier with IANA name HP-Pi-font.
- //
- // PCL 5 Comparison Guide, Hewlett-Packard,
- // HP part number 5961-0510, October 1992
- // PCL Symbol Set id: 15U
- HPPiFont MIB = 2018
-
- // HPMath8 is the MIB identifier with IANA name HP-Math8.
- //
- // PCL 5 Comparison Guide, Hewlett-Packard,
- // HP part number 5961-0510, October 1992
- // PCL Symbol Set id: 8M
- HPMath8 MIB = 2019
-
- // HPPSMath is the MIB identifier with IANA name Adobe-Symbol-Encoding.
- //
- // PostScript Language Reference Manual
- // PCL Symbol Set id: 5M
- HPPSMath MIB = 2020
-
- // HPDesktop is the MIB identifier with IANA name HP-DeskTop.
- //
- // PCL 5 Comparison Guide, Hewlett-Packard,
- // HP part number 5961-0510, October 1992
- // PCL Symbol Set id: 7J
- HPDesktop MIB = 2021
-
- // VenturaMath is the MIB identifier with IANA name Ventura-Math.
- //
- // PCL 5 Comparison Guide, Hewlett-Packard,
- // HP part number 5961-0510, October 1992
- // PCL Symbol Set id: 6M
- VenturaMath MIB = 2022
-
- // MicrosoftPublishing is the MIB identifier with IANA name Microsoft-Publishing.
- //
- // PCL 5 Comparison Guide, Hewlett-Packard,
- // HP part number 5961-0510, October 1992
- // PCL Symbol Set id: 6J
- MicrosoftPublishing MIB = 2023
-
- // Windows31J is the MIB identifier with IANA name Windows-31J.
- //
- // Windows Japanese. A further extension of Shift_JIS
- // to include NEC special characters (Row 13), NEC
- // selection of IBM extensions (Rows 89 to 92), and IBM
- // extensions (Rows 115 to 119). The CCS's are
- // JIS X0201:1997, JIS X0208:1997, and these extensions.
- // This charset can be used for the top-level media type "text",
- // but it is of limited or specialized use (see rfc2278 ).
- // PCL Symbol Set id: 19K
- Windows31J MIB = 2024
-
- // GB2312 is the MIB identifier with IANA name GB2312 (MIME: GB2312).
- //
- // Chinese for People's Republic of China (PRC) mixed one byte,
- // two byte set:
- // 20-7E = one byte ASCII
- // A1-FE = two byte PRC Kanji
- // See GB 2312-80
- // PCL Symbol Set Id: 18C
- GB2312 MIB = 2025
-
- // Big5 is the MIB identifier with IANA name Big5 (MIME: Big5).
- //
- // Chinese for Taiwan Multi-byte set.
- // PCL Symbol Set Id: 18T
- Big5 MIB = 2026
-
- // Macintosh is the MIB identifier with IANA name macintosh.
- //
- // The Unicode Standard ver1.0, ISBN 0-201-56788-1, Oct 1991
- // Reference: RFC1345
- Macintosh MIB = 2027
-
- // IBM037 is the MIB identifier with IANA name IBM037.
- //
- // IBM NLS RM Vol2 SE09-8002-01, March 1990
- // Reference: RFC1345
- IBM037 MIB = 2028
-
- // IBM038 is the MIB identifier with IANA name IBM038.
- //
- // IBM 3174 Character Set Ref, GA27-3831-02, March 1990
- // Reference: RFC1345
- IBM038 MIB = 2029
-
- // IBM273 is the MIB identifier with IANA name IBM273.
- //
- // IBM NLS RM Vol2 SE09-8002-01, March 1990
- // Reference: RFC1345
- IBM273 MIB = 2030
-
- // IBM274 is the MIB identifier with IANA name IBM274.
- //
- // IBM 3174 Character Set Ref, GA27-3831-02, March 1990
- // Reference: RFC1345
- IBM274 MIB = 2031
-
- // IBM275 is the MIB identifier with IANA name IBM275.
- //
- // IBM NLS RM Vol2 SE09-8002-01, March 1990
- // Reference: RFC1345
- IBM275 MIB = 2032
-
- // IBM277 is the MIB identifier with IANA name IBM277.
- //
- // IBM NLS RM Vol2 SE09-8002-01, March 1990
- // Reference: RFC1345
- IBM277 MIB = 2033
-
- // IBM278 is the MIB identifier with IANA name IBM278.
- //
- // IBM NLS RM Vol2 SE09-8002-01, March 1990
- // Reference: RFC1345
- IBM278 MIB = 2034
-
- // IBM280 is the MIB identifier with IANA name IBM280.
- //
- // IBM NLS RM Vol2 SE09-8002-01, March 1990
- // Reference: RFC1345
- IBM280 MIB = 2035
-
- // IBM281 is the MIB identifier with IANA name IBM281.
- //
- // IBM 3174 Character Set Ref, GA27-3831-02, March 1990
- // Reference: RFC1345
- IBM281 MIB = 2036
-
- // IBM284 is the MIB identifier with IANA name IBM284.
- //
- // IBM NLS RM Vol2 SE09-8002-01, March 1990
- // Reference: RFC1345
- IBM284 MIB = 2037
-
- // IBM285 is the MIB identifier with IANA name IBM285.
- //
- // IBM NLS RM Vol2 SE09-8002-01, March 1990
- // Reference: RFC1345
- IBM285 MIB = 2038
-
- // IBM290 is the MIB identifier with IANA name IBM290.
- //
- // IBM 3174 Character Set Ref, GA27-3831-02, March 1990
- // Reference: RFC1345
- IBM290 MIB = 2039
-
- // IBM297 is the MIB identifier with IANA name IBM297.
- //
- // IBM NLS RM Vol2 SE09-8002-01, March 1990
- // Reference: RFC1345
- IBM297 MIB = 2040
-
- // IBM420 is the MIB identifier with IANA name IBM420.
- //
- // IBM NLS RM Vol2 SE09-8002-01, March 1990,
- // IBM NLS RM p 11-11
- // Reference: RFC1345
- IBM420 MIB = 2041
-
- // IBM423 is the MIB identifier with IANA name IBM423.
- //
- // IBM NLS RM Vol2 SE09-8002-01, March 1990
- // Reference: RFC1345
- IBM423 MIB = 2042
-
- // IBM424 is the MIB identifier with IANA name IBM424.
- //
- // IBM NLS RM Vol2 SE09-8002-01, March 1990
- // Reference: RFC1345
- IBM424 MIB = 2043
-
- // PC8CodePage437 is the MIB identifier with IANA name IBM437.
- //
- // IBM NLS RM Vol2 SE09-8002-01, March 1990
- // Reference: RFC1345
- PC8CodePage437 MIB = 2011
-
- // IBM500 is the MIB identifier with IANA name IBM500.
- //
- // IBM NLS RM Vol2 SE09-8002-01, March 1990
- // Reference: RFC1345
- IBM500 MIB = 2044
-
- // IBM851 is the MIB identifier with IANA name IBM851.
- //
- // IBM NLS RM Vol2 SE09-8002-01, March 1990
- // Reference: RFC1345
- IBM851 MIB = 2045
-
- // PCp852 is the MIB identifier with IANA name IBM852.
- //
- // IBM NLS RM Vol2 SE09-8002-01, March 1990
- // Reference: RFC1345
- PCp852 MIB = 2010
-
- // IBM855 is the MIB identifier with IANA name IBM855.
- //
- // IBM NLS RM Vol2 SE09-8002-01, March 1990
- // Reference: RFC1345
- IBM855 MIB = 2046
-
- // IBM857 is the MIB identifier with IANA name IBM857.
- //
- // IBM NLS RM Vol2 SE09-8002-01, March 1990
- // Reference: RFC1345
- IBM857 MIB = 2047
-
- // IBM860 is the MIB identifier with IANA name IBM860.
- //
- // IBM NLS RM Vol2 SE09-8002-01, March 1990
- // Reference: RFC1345
- IBM860 MIB = 2048
-
- // IBM861 is the MIB identifier with IANA name IBM861.
- //
- // IBM NLS RM Vol2 SE09-8002-01, March 1990
- // Reference: RFC1345
- IBM861 MIB = 2049
-
- // IBM863 is the MIB identifier with IANA name IBM863.
- //
- // IBM Keyboard layouts and code pages, PN 07G4586 June 1991
- // Reference: RFC1345
- IBM863 MIB = 2050
-
- // IBM864 is the MIB identifier with IANA name IBM864.
- //
- // IBM Keyboard layouts and code pages, PN 07G4586 June 1991
- // Reference: RFC1345
- IBM864 MIB = 2051
-
- // IBM865 is the MIB identifier with IANA name IBM865.
- //
- // IBM DOS 3.3 Ref (Abridged), 94X9575 (Feb 1987)
- // Reference: RFC1345
- IBM865 MIB = 2052
-
- // IBM868 is the MIB identifier with IANA name IBM868.
- //
- // IBM NLS RM Vol2 SE09-8002-01, March 1990
- // Reference: RFC1345
- IBM868 MIB = 2053
-
- // IBM869 is the MIB identifier with IANA name IBM869.
- //
- // IBM Keyboard layouts and code pages, PN 07G4586 June 1991
- // Reference: RFC1345
- IBM869 MIB = 2054
-
- // IBM870 is the MIB identifier with IANA name IBM870.
- //
- // IBM NLS RM Vol2 SE09-8002-01, March 1990
- // Reference: RFC1345
- IBM870 MIB = 2055
-
- // IBM871 is the MIB identifier with IANA name IBM871.
- //
- // IBM NLS RM Vol2 SE09-8002-01, March 1990
- // Reference: RFC1345
- IBM871 MIB = 2056
-
- // IBM880 is the MIB identifier with IANA name IBM880.
- //
- // IBM NLS RM Vol2 SE09-8002-01, March 1990
- // Reference: RFC1345
- IBM880 MIB = 2057
-
- // IBM891 is the MIB identifier with IANA name IBM891.
- //
- // IBM NLS RM Vol2 SE09-8002-01, March 1990
- // Reference: RFC1345
- IBM891 MIB = 2058
-
- // IBM903 is the MIB identifier with IANA name IBM903.
- //
- // IBM NLS RM Vol2 SE09-8002-01, March 1990
- // Reference: RFC1345
- IBM903 MIB = 2059
-
- // IBBM904 is the MIB identifier with IANA name IBM904.
- //
- // IBM NLS RM Vol2 SE09-8002-01, March 1990
- // Reference: RFC1345
- IBBM904 MIB = 2060
-
- // IBM905 is the MIB identifier with IANA name IBM905.
- //
- // IBM 3174 Character Set Ref, GA27-3831-02, March 1990
- // Reference: RFC1345
- IBM905 MIB = 2061
-
- // IBM918 is the MIB identifier with IANA name IBM918.
- //
- // IBM NLS RM Vol2 SE09-8002-01, March 1990
- // Reference: RFC1345
- IBM918 MIB = 2062
-
- // IBM1026 is the MIB identifier with IANA name IBM1026.
- //
- // IBM NLS RM Vol2 SE09-8002-01, March 1990
- // Reference: RFC1345
- IBM1026 MIB = 2063
-
- // IBMEBCDICATDE is the MIB identifier with IANA name EBCDIC-AT-DE.
- //
- // IBM 3270 Char Set Ref Ch 10, GA27-2837-9, April 1987
- // Reference: RFC1345
- IBMEBCDICATDE MIB = 2064
-
- // EBCDICATDEA is the MIB identifier with IANA name EBCDIC-AT-DE-A.
- //
- // IBM 3270 Char Set Ref Ch 10, GA27-2837-9, April 1987
- // Reference: RFC1345
- EBCDICATDEA MIB = 2065
-
- // EBCDICCAFR is the MIB identifier with IANA name EBCDIC-CA-FR.
- //
- // IBM 3270 Char Set Ref Ch 10, GA27-2837-9, April 1987
- // Reference: RFC1345
- EBCDICCAFR MIB = 2066
-
- // EBCDICDKNO is the MIB identifier with IANA name EBCDIC-DK-NO.
- //
- // IBM 3270 Char Set Ref Ch 10, GA27-2837-9, April 1987
- // Reference: RFC1345
- EBCDICDKNO MIB = 2067
-
- // EBCDICDKNOA is the MIB identifier with IANA name EBCDIC-DK-NO-A.
- //
- // IBM 3270 Char Set Ref Ch 10, GA27-2837-9, April 1987
- // Reference: RFC1345
- EBCDICDKNOA MIB = 2068
-
- // EBCDICFISE is the MIB identifier with IANA name EBCDIC-FI-SE.
- //
- // IBM 3270 Char Set Ref Ch 10, GA27-2837-9, April 1987
- // Reference: RFC1345
- EBCDICFISE MIB = 2069
-
- // EBCDICFISEA is the MIB identifier with IANA name EBCDIC-FI-SE-A.
- //
- // IBM 3270 Char Set Ref Ch 10, GA27-2837-9, April 1987
- // Reference: RFC1345
- EBCDICFISEA MIB = 2070
-
- // EBCDICFR is the MIB identifier with IANA name EBCDIC-FR.
- //
- // IBM 3270 Char Set Ref Ch 10, GA27-2837-9, April 1987
- // Reference: RFC1345
- EBCDICFR MIB = 2071
-
- // EBCDICIT is the MIB identifier with IANA name EBCDIC-IT.
- //
- // IBM 3270 Char Set Ref Ch 10, GA27-2837-9, April 1987
- // Reference: RFC1345
- EBCDICIT MIB = 2072
-
- // EBCDICPT is the MIB identifier with IANA name EBCDIC-PT.
- //
- // IBM 3270 Char Set Ref Ch 10, GA27-2837-9, April 1987
- // Reference: RFC1345
- EBCDICPT MIB = 2073
-
- // EBCDICES is the MIB identifier with IANA name EBCDIC-ES.
- //
- // IBM 3270 Char Set Ref Ch 10, GA27-2837-9, April 1987
- // Reference: RFC1345
- EBCDICES MIB = 2074
-
- // EBCDICESA is the MIB identifier with IANA name EBCDIC-ES-A.
- //
- // IBM 3270 Char Set Ref Ch 10, GA27-2837-9, April 1987
- // Reference: RFC1345
- EBCDICESA MIB = 2075
-
- // EBCDICESS is the MIB identifier with IANA name EBCDIC-ES-S.
- //
- // IBM 3270 Char Set Ref Ch 10, GA27-2837-9, April 1987
- // Reference: RFC1345
- EBCDICESS MIB = 2076
-
- // EBCDICUK is the MIB identifier with IANA name EBCDIC-UK.
- //
- // IBM 3270 Char Set Ref Ch 10, GA27-2837-9, April 1987
- // Reference: RFC1345
- EBCDICUK MIB = 2077
-
- // EBCDICUS is the MIB identifier with IANA name EBCDIC-US.
- //
- // IBM 3270 Char Set Ref Ch 10, GA27-2837-9, April 1987
- // Reference: RFC1345
- EBCDICUS MIB = 2078
-
- // Unknown8BiT is the MIB identifier with IANA name UNKNOWN-8BIT.
- //
- // Reference: RFC1428
- Unknown8BiT MIB = 2079
-
- // Mnemonic is the MIB identifier with IANA name MNEMONIC.
- //
- // rfc1345 , also known as "mnemonic+ascii+38"
- // Reference: RFC1345
- Mnemonic MIB = 2080
-
- // Mnem is the MIB identifier with IANA name MNEM.
- //
- // rfc1345 , also known as "mnemonic+ascii+8200"
- // Reference: RFC1345
- Mnem MIB = 2081
-
- // VISCII is the MIB identifier with IANA name VISCII.
- //
- // rfc1456
- // Reference: RFC1456
- VISCII MIB = 2082
-
- // VIQR is the MIB identifier with IANA name VIQR.
- //
- // rfc1456
- // Reference: RFC1456
- VIQR MIB = 2083
-
- // KOI8R is the MIB identifier with IANA name KOI8-R (MIME: KOI8-R).
- //
- // rfc1489 , based on GOST-19768-74, ISO-6937/8,
- // INIS-Cyrillic, ISO-5427.
- // Reference: RFC1489
- KOI8R MIB = 2084
-
- // HZGB2312 is the MIB identifier with IANA name HZ-GB-2312.
- //
- // rfc1842 , rfc1843 rfc1843 rfc1842
- HZGB2312 MIB = 2085
-
- // IBM866 is the MIB identifier with IANA name IBM866.
- //
- // IBM NLDG Volume 2 (SE09-8002-03) August 1994
- IBM866 MIB = 2086
-
- // PC775Baltic is the MIB identifier with IANA name IBM775.
- //
- // HP PCL 5 Comparison Guide (P/N 5021-0329) pp B-13, 1996
- PC775Baltic MIB = 2087
-
- // KOI8U is the MIB identifier with IANA name KOI8-U.
- //
- // rfc2319
- // Reference: RFC2319
- KOI8U MIB = 2088
-
- // IBM00858 is the MIB identifier with IANA name IBM00858.
- //
- // IBM See http://www.iana.org/assignments/charset-reg/IBM00858
- IBM00858 MIB = 2089
-
- // IBM00924 is the MIB identifier with IANA name IBM00924.
- //
- // IBM See http://www.iana.org/assignments/charset-reg/IBM00924
- IBM00924 MIB = 2090
-
- // IBM01140 is the MIB identifier with IANA name IBM01140.
- //
- // IBM See http://www.iana.org/assignments/charset-reg/IBM01140
- IBM01140 MIB = 2091
-
- // IBM01141 is the MIB identifier with IANA name IBM01141.
- //
- // IBM See http://www.iana.org/assignments/charset-reg/IBM01141
- IBM01141 MIB = 2092
-
- // IBM01142 is the MIB identifier with IANA name IBM01142.
- //
- // IBM See http://www.iana.org/assignments/charset-reg/IBM01142
- IBM01142 MIB = 2093
-
- // IBM01143 is the MIB identifier with IANA name IBM01143.
- //
- // IBM See http://www.iana.org/assignments/charset-reg/IBM01143
- IBM01143 MIB = 2094
-
- // IBM01144 is the MIB identifier with IANA name IBM01144.
- //
- // IBM See http://www.iana.org/assignments/charset-reg/IBM01144
- IBM01144 MIB = 2095
-
- // IBM01145 is the MIB identifier with IANA name IBM01145.
- //
- // IBM See http://www.iana.org/assignments/charset-reg/IBM01145
- IBM01145 MIB = 2096
-
- // IBM01146 is the MIB identifier with IANA name IBM01146.
- //
- // IBM See http://www.iana.org/assignments/charset-reg/IBM01146
- IBM01146 MIB = 2097
-
- // IBM01147 is the MIB identifier with IANA name IBM01147.
- //
- // IBM See http://www.iana.org/assignments/charset-reg/IBM01147
- IBM01147 MIB = 2098
-
- // IBM01148 is the MIB identifier with IANA name IBM01148.
- //
- // IBM See http://www.iana.org/assignments/charset-reg/IBM01148
- IBM01148 MIB = 2099
-
- // IBM01149 is the MIB identifier with IANA name IBM01149.
- //
- // IBM See http://www.iana.org/assignments/charset-reg/IBM01149
- IBM01149 MIB = 2100
-
- // Big5HKSCS is the MIB identifier with IANA name Big5-HKSCS.
- //
- // See http://www.iana.org/assignments/charset-reg/Big5-HKSCS
- Big5HKSCS MIB = 2101
-
- // IBM1047 is the MIB identifier with IANA name IBM1047.
- //
- // IBM1047 (EBCDIC Latin 1/Open Systems) http://www-1.ibm.com/servers/eserver/iseries/software/globalization/pdf/cp01047z.pdf
- IBM1047 MIB = 2102
-
- // PTCP154 is the MIB identifier with IANA name PTCP154.
- //
- // See http://www.iana.org/assignments/charset-reg/PTCP154
- PTCP154 MIB = 2103
-
- // Amiga1251 is the MIB identifier with IANA name Amiga-1251.
- //
- // See http://www.amiga.ultranet.ru/Amiga-1251.html
- Amiga1251 MIB = 2104
-
- // KOI7switched is the MIB identifier with IANA name KOI7-switched.
- //
- // See http://www.iana.org/assignments/charset-reg/KOI7-switched
- KOI7switched MIB = 2105
-
- // BRF is the MIB identifier with IANA name BRF.
- //
- // See http://www.iana.org/assignments/charset-reg/BRF
- BRF MIB = 2106
-
- // TSCII is the MIB identifier with IANA name TSCII.
- //
- // See http://www.iana.org/assignments/charset-reg/TSCII
- TSCII MIB = 2107
-
- // CP51932 is the MIB identifier with IANA name CP51932.
- //
- // See http://www.iana.org/assignments/charset-reg/CP51932
- CP51932 MIB = 2108
-
- // Windows874 is the MIB identifier with IANA name windows-874.
- //
- // See http://www.iana.org/assignments/charset-reg/windows-874
- Windows874 MIB = 2109
-
- // Windows1250 is the MIB identifier with IANA name windows-1250.
- //
- // Microsoft http://www.iana.org/assignments/charset-reg/windows-1250
- Windows1250 MIB = 2250
-
- // Windows1251 is the MIB identifier with IANA name windows-1251.
- //
- // Microsoft http://www.iana.org/assignments/charset-reg/windows-1251
- Windows1251 MIB = 2251
-
- // Windows1252 is the MIB identifier with IANA name windows-1252.
- //
- // Microsoft http://www.iana.org/assignments/charset-reg/windows-1252
- Windows1252 MIB = 2252
-
- // Windows1253 is the MIB identifier with IANA name windows-1253.
- //
- // Microsoft http://www.iana.org/assignments/charset-reg/windows-1253
- Windows1253 MIB = 2253
-
- // Windows1254 is the MIB identifier with IANA name windows-1254.
- //
- // Microsoft http://www.iana.org/assignments/charset-reg/windows-1254
- Windows1254 MIB = 2254
-
- // Windows1255 is the MIB identifier with IANA name windows-1255.
- //
- // Microsoft http://www.iana.org/assignments/charset-reg/windows-1255
- Windows1255 MIB = 2255
-
- // Windows1256 is the MIB identifier with IANA name windows-1256.
- //
- // Microsoft http://www.iana.org/assignments/charset-reg/windows-1256
- Windows1256 MIB = 2256
-
- // Windows1257 is the MIB identifier with IANA name windows-1257.
- //
- // Microsoft http://www.iana.org/assignments/charset-reg/windows-1257
- Windows1257 MIB = 2257
-
- // Windows1258 is the MIB identifier with IANA name windows-1258.
- //
- // Microsoft http://www.iana.org/assignments/charset-reg/windows-1258
- Windows1258 MIB = 2258
-
- // TIS620 is the MIB identifier with IANA name TIS-620.
- //
- // Thai Industrial Standards Institute (TISI)
- TIS620 MIB = 2259
-
- // CP50220 is the MIB identifier with IANA name CP50220.
- //
- // See http://www.iana.org/assignments/charset-reg/CP50220
- CP50220 MIB = 2260
-)
diff --git a/vendor/golang.org/x/text/encoding/internal/internal.go b/vendor/golang.org/x/text/encoding/internal/internal.go
deleted file mode 100644
index 75a5fd1658..0000000000
--- a/vendor/golang.org/x/text/encoding/internal/internal.go
+++ /dev/null
@@ -1,75 +0,0 @@
-// Copyright 2015 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// Package internal contains code that is shared among encoding implementations.
-package internal
-
-import (
- "golang.org/x/text/encoding"
- "golang.org/x/text/encoding/internal/identifier"
- "golang.org/x/text/transform"
-)
-
-// Encoding is an implementation of the Encoding interface that adds the String
-// and ID methods to an existing encoding.
-type Encoding struct {
- encoding.Encoding
- Name string
- MIB identifier.MIB
-}
-
-// _ verifies that Encoding implements identifier.Interface.
-var _ identifier.Interface = (*Encoding)(nil)
-
-func (e *Encoding) String() string {
- return e.Name
-}
-
-func (e *Encoding) ID() (mib identifier.MIB, other string) {
- return e.MIB, ""
-}
-
-// SimpleEncoding is an Encoding that combines two Transformers.
-type SimpleEncoding struct {
- Decoder transform.Transformer
- Encoder transform.Transformer
-}
-
-func (e *SimpleEncoding) NewDecoder() *encoding.Decoder {
- return &encoding.Decoder{Transformer: e.Decoder}
-}
-
-func (e *SimpleEncoding) NewEncoder() *encoding.Encoder {
- return &encoding.Encoder{Transformer: e.Encoder}
-}
-
-// FuncEncoding is an Encoding that combines two functions returning a new
-// Transformer.
-type FuncEncoding struct {
- Decoder func() transform.Transformer
- Encoder func() transform.Transformer
-}
-
-func (e FuncEncoding) NewDecoder() *encoding.Decoder {
- return &encoding.Decoder{Transformer: e.Decoder()}
-}
-
-func (e FuncEncoding) NewEncoder() *encoding.Encoder {
- return &encoding.Encoder{Transformer: e.Encoder()}
-}
-
-// A RepertoireError indicates a rune is not in the repertoire of a destination
-// encoding. It is associated with an encoding-specific suggested replacement
-// byte.
-type RepertoireError byte
-
-// Error implements the error interrface.
-func (r RepertoireError) Error() string {
- return "encoding: rune not supported by encoding."
-}
-
-// Replacement returns the replacement string associated with this error.
-func (r RepertoireError) Replacement() byte { return byte(r) }
-
-var ErrASCIIReplacement = RepertoireError(encoding.ASCIISub)
diff --git a/vendor/golang.org/x/text/encoding/unicode/override.go b/vendor/golang.org/x/text/encoding/unicode/override.go
deleted file mode 100644
index 35d62fcc99..0000000000
--- a/vendor/golang.org/x/text/encoding/unicode/override.go
+++ /dev/null
@@ -1,82 +0,0 @@
-// Copyright 2015 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package unicode
-
-import (
- "golang.org/x/text/transform"
-)
-
-// BOMOverride returns a new decoder transformer that is identical to fallback,
-// except that the presence of a Byte Order Mark at the start of the input
-// causes it to switch to the corresponding Unicode decoding. It will only
-// consider BOMs for UTF-8, UTF-16BE, and UTF-16LE.
-//
-// This differs from using ExpectBOM by allowing a BOM to switch to UTF-8, not
-// just UTF-16 variants, and allowing falling back to any encoding scheme.
-//
-// This technique is recommended by the W3C for use in HTML 5: "For
-// compatibility with deployed content, the byte order mark (also known as BOM)
-// is considered more authoritative than anything else."
-// http://www.w3.org/TR/encoding/#specification-hooks
-//
-// Using BOMOverride is mostly intended for use cases where the first characters
-// of a fallback encoding are known to not be a BOM, for example, for valid HTML
-// and most encodings.
-func BOMOverride(fallback transform.Transformer) transform.Transformer {
- // TODO: possibly allow a variadic argument of unicode encodings to allow
- // specifying details of which fallbacks are supported as well as
- // specifying the details of the implementations. This would also allow for
- // support for UTF-32, which should not be supported by default.
- return &bomOverride{fallback: fallback}
-}
-
-type bomOverride struct {
- fallback transform.Transformer
- current transform.Transformer
-}
-
-func (d *bomOverride) Reset() {
- d.current = nil
- d.fallback.Reset()
-}
-
-var (
- // TODO: we could use decode functions here, instead of allocating a new
- // decoder on every NewDecoder as IgnoreBOM decoders can be stateless.
- utf16le = UTF16(LittleEndian, IgnoreBOM)
- utf16be = UTF16(BigEndian, IgnoreBOM)
-)
-
-const utf8BOM = "\ufeff"
-
-func (d *bomOverride) Transform(dst, src []byte, atEOF bool) (nDst, nSrc int, err error) {
- if d.current != nil {
- return d.current.Transform(dst, src, atEOF)
- }
- if len(src) < 3 && !atEOF {
- return 0, 0, transform.ErrShortSrc
- }
- d.current = d.fallback
- bomSize := 0
- if len(src) >= 2 {
- if src[0] == 0xFF && src[1] == 0xFE {
- d.current = utf16le.NewDecoder()
- bomSize = 2
- } else if src[0] == 0xFE && src[1] == 0xFF {
- d.current = utf16be.NewDecoder()
- bomSize = 2
- } else if len(src) >= 3 &&
- src[0] == utf8BOM[0] &&
- src[1] == utf8BOM[1] &&
- src[2] == utf8BOM[2] {
- d.current = transform.Nop
- bomSize = 3
- }
- }
- if bomSize < len(src) {
- nDst, nSrc, err = d.current.Transform(dst, src[bomSize:], atEOF)
- }
- return nDst, nSrc + bomSize, err
-}
diff --git a/vendor/golang.org/x/text/encoding/unicode/unicode.go b/vendor/golang.org/x/text/encoding/unicode/unicode.go
deleted file mode 100644
index 4850ff365b..0000000000
--- a/vendor/golang.org/x/text/encoding/unicode/unicode.go
+++ /dev/null
@@ -1,434 +0,0 @@
-// Copyright 2013 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// Package unicode provides Unicode encodings such as UTF-16.
-package unicode // import "golang.org/x/text/encoding/unicode"
-
-import (
- "errors"
- "unicode/utf16"
- "unicode/utf8"
-
- "golang.org/x/text/encoding"
- "golang.org/x/text/encoding/internal"
- "golang.org/x/text/encoding/internal/identifier"
- "golang.org/x/text/internal/utf8internal"
- "golang.org/x/text/runes"
- "golang.org/x/text/transform"
-)
-
-// TODO: I think the Transformers really should return errors on unmatched
-// surrogate pairs and odd numbers of bytes. This is not required by RFC 2781,
-// which leaves it open, but is suggested by WhatWG. It will allow for all error
-// modes as defined by WhatWG: fatal, HTML and Replacement. This would require
-// the introduction of some kind of error type for conveying the erroneous code
-// point.
-
-// UTF8 is the UTF-8 encoding.
-var UTF8 encoding.Encoding = utf8enc
-
-var utf8enc = &internal.Encoding{
- &internal.SimpleEncoding{utf8Decoder{}, runes.ReplaceIllFormed()},
- "UTF-8",
- identifier.UTF8,
-}
-
-type utf8Decoder struct{ transform.NopResetter }
-
-func (utf8Decoder) Transform(dst, src []byte, atEOF bool) (nDst, nSrc int, err error) {
- var pSrc int // point from which to start copy in src
- var accept utf8internal.AcceptRange
-
- // The decoder can only make the input larger, not smaller.
- n := len(src)
- if len(dst) < n {
- err = transform.ErrShortDst
- n = len(dst)
- atEOF = false
- }
- for nSrc < n {
- c := src[nSrc]
- if c < utf8.RuneSelf {
- nSrc++
- continue
- }
- first := utf8internal.First[c]
- size := int(first & utf8internal.SizeMask)
- if first == utf8internal.FirstInvalid {
- goto handleInvalid // invalid starter byte
- }
- accept = utf8internal.AcceptRanges[first>>utf8internal.AcceptShift]
- if nSrc+size > n {
- if !atEOF {
- // We may stop earlier than necessary here if the short sequence
- // has invalid bytes. Not checking for this simplifies the code
- // and may avoid duplicate computations in certain conditions.
- if err == nil {
- err = transform.ErrShortSrc
- }
- break
- }
- // Determine the maximal subpart of an ill-formed subsequence.
- switch {
- case nSrc+1 >= n || src[nSrc+1] < accept.Lo || accept.Hi < src[nSrc+1]:
- size = 1
- case nSrc+2 >= n || src[nSrc+2] < utf8internal.LoCB || utf8internal.HiCB < src[nSrc+2]:
- size = 2
- default:
- size = 3 // As we are short, the maximum is 3.
- }
- goto handleInvalid
- }
- if c = src[nSrc+1]; c < accept.Lo || accept.Hi < c {
- size = 1
- goto handleInvalid // invalid continuation byte
- } else if size == 2 {
- } else if c = src[nSrc+2]; c < utf8internal.LoCB || utf8internal.HiCB < c {
- size = 2
- goto handleInvalid // invalid continuation byte
- } else if size == 3 {
- } else if c = src[nSrc+3]; c < utf8internal.LoCB || utf8internal.HiCB < c {
- size = 3
- goto handleInvalid // invalid continuation byte
- }
- nSrc += size
- continue
-
- handleInvalid:
- // Copy the scanned input so far.
- nDst += copy(dst[nDst:], src[pSrc:nSrc])
-
- // Append RuneError to the destination.
- const runeError = "\ufffd"
- if nDst+len(runeError) > len(dst) {
- return nDst, nSrc, transform.ErrShortDst
- }
- nDst += copy(dst[nDst:], runeError)
-
- // Skip the maximal subpart of an ill-formed subsequence according to
- // the W3C standard way instead of the Go way. This Transform is
- // probably the only place in the text repo where it is warranted.
- nSrc += size
- pSrc = nSrc
-
- // Recompute the maximum source length.
- if sz := len(dst) - nDst; sz < len(src)-nSrc {
- err = transform.ErrShortDst
- n = nSrc + sz
- atEOF = false
- }
- }
- return nDst + copy(dst[nDst:], src[pSrc:nSrc]), nSrc, err
-}
-
-// UTF16 returns a UTF-16 Encoding for the given default endianness and byte
-// order mark (BOM) policy.
-//
-// When decoding from UTF-16 to UTF-8, if the BOMPolicy is IgnoreBOM then
-// neither BOMs U+FEFF nor noncharacters U+FFFE in the input stream will affect
-// the endianness used for decoding, and will instead be output as their
-// standard UTF-8 encodings: "\xef\xbb\xbf" and "\xef\xbf\xbe". If the BOMPolicy
-// is UseBOM or ExpectBOM a staring BOM is not written to the UTF-8 output.
-// Instead, it overrides the default endianness e for the remainder of the
-// transformation. Any subsequent BOMs U+FEFF or noncharacters U+FFFE will not
-// affect the endianness used, and will instead be output as their standard
-// UTF-8 encodings. For UseBOM, if there is no starting BOM, it will proceed
-// with the default Endianness. For ExpectBOM, in that case, the transformation
-// will return early with an ErrMissingBOM error.
-//
-// When encoding from UTF-8 to UTF-16, a BOM will be inserted at the start of
-// the output if the BOMPolicy is UseBOM or ExpectBOM. Otherwise, a BOM will not
-// be inserted. The UTF-8 input does not need to contain a BOM.
-//
-// There is no concept of a 'native' endianness. If the UTF-16 data is produced
-// and consumed in a greater context that implies a certain endianness, use
-// IgnoreBOM. Otherwise, use ExpectBOM and always produce and consume a BOM.
-//
-// In the language of https://www.unicode.org/faq/utf_bom.html#bom10, IgnoreBOM
-// corresponds to "Where the precise type of the data stream is known... the
-// BOM should not be used" and ExpectBOM corresponds to "A particular
-// protocol... may require use of the BOM".
-func UTF16(e Endianness, b BOMPolicy) encoding.Encoding {
- return utf16Encoding{config{e, b}, mibValue[e][b&bomMask]}
-}
-
-// mibValue maps Endianness and BOMPolicy settings to MIB constants. Note that
-// some configurations map to the same MIB identifier. RFC 2781 has requirements
-// and recommendations. Some of the "configurations" are merely recommendations,
-// so multiple configurations could match.
-var mibValue = map[Endianness][numBOMValues]identifier.MIB{
- BigEndian: [numBOMValues]identifier.MIB{
- IgnoreBOM: identifier.UTF16BE,
- UseBOM: identifier.UTF16, // BigEnding default is preferred by RFC 2781.
- // TODO: acceptBOM | strictBOM would map to UTF16BE as well.
- },
- LittleEndian: [numBOMValues]identifier.MIB{
- IgnoreBOM: identifier.UTF16LE,
- UseBOM: identifier.UTF16, // LittleEndian default is allowed and preferred on Windows.
- // TODO: acceptBOM | strictBOM would map to UTF16LE as well.
- },
- // ExpectBOM is not widely used and has no valid MIB identifier.
-}
-
-// All lists a configuration for each IANA-defined UTF-16 variant.
-var All = []encoding.Encoding{
- UTF8,
- UTF16(BigEndian, UseBOM),
- UTF16(BigEndian, IgnoreBOM),
- UTF16(LittleEndian, IgnoreBOM),
-}
-
-// BOMPolicy is a UTF-16 encoding's byte order mark policy.
-type BOMPolicy uint8
-
-const (
- writeBOM BOMPolicy = 0x01
- acceptBOM BOMPolicy = 0x02
- requireBOM BOMPolicy = 0x04
- bomMask BOMPolicy = 0x07
-
- // HACK: numBOMValues == 8 triggers a bug in the 1.4 compiler (cannot have a
- // map of an array of length 8 of a type that is also used as a key or value
- // in another map). See golang.org/issue/11354.
- // TODO: consider changing this value back to 8 if the use of 1.4.* has
- // been minimized.
- numBOMValues = 8 + 1
-
- // IgnoreBOM means to ignore any byte order marks.
- IgnoreBOM BOMPolicy = 0
- // Common and RFC 2781-compliant interpretation for UTF-16BE/LE.
-
- // UseBOM means that the UTF-16 form may start with a byte order mark, which
- // will be used to override the default encoding.
- UseBOM BOMPolicy = writeBOM | acceptBOM
- // Common and RFC 2781-compliant interpretation for UTF-16.
-
- // ExpectBOM means that the UTF-16 form must start with a byte order mark,
- // which will be used to override the default encoding.
- ExpectBOM BOMPolicy = writeBOM | acceptBOM | requireBOM
- // Used in Java as Unicode (not to be confused with Java's UTF-16) and
- // ICU's UTF-16,version=1. Not compliant with RFC 2781.
-
- // TODO (maybe): strictBOM: BOM must match Endianness. This would allow:
- // - UTF-16(B|L)E,version=1: writeBOM | acceptBOM | requireBOM | strictBOM
- // (UnicodeBig and UnicodeLittle in Java)
- // - RFC 2781-compliant, but less common interpretation for UTF-16(B|L)E:
- // acceptBOM | strictBOM (e.g. assigned to CheckBOM).
- // This addition would be consistent with supporting ExpectBOM.
-)
-
-// Endianness is a UTF-16 encoding's default endianness.
-type Endianness bool
-
-const (
- // BigEndian is UTF-16BE.
- BigEndian Endianness = false
- // LittleEndian is UTF-16LE.
- LittleEndian Endianness = true
-)
-
-// ErrMissingBOM means that decoding UTF-16 input with ExpectBOM did not find a
-// starting byte order mark.
-var ErrMissingBOM = errors.New("encoding: missing byte order mark")
-
-type utf16Encoding struct {
- config
- mib identifier.MIB
-}
-
-type config struct {
- endianness Endianness
- bomPolicy BOMPolicy
-}
-
-func (u utf16Encoding) NewDecoder() *encoding.Decoder {
- return &encoding.Decoder{Transformer: &utf16Decoder{
- initial: u.config,
- current: u.config,
- }}
-}
-
-func (u utf16Encoding) NewEncoder() *encoding.Encoder {
- return &encoding.Encoder{Transformer: &utf16Encoder{
- endianness: u.endianness,
- initialBOMPolicy: u.bomPolicy,
- currentBOMPolicy: u.bomPolicy,
- }}
-}
-
-func (u utf16Encoding) ID() (mib identifier.MIB, other string) {
- return u.mib, ""
-}
-
-func (u utf16Encoding) String() string {
- e, b := "B", ""
- if u.endianness == LittleEndian {
- e = "L"
- }
- switch u.bomPolicy {
- case ExpectBOM:
- b = "Expect"
- case UseBOM:
- b = "Use"
- case IgnoreBOM:
- b = "Ignore"
- }
- return "UTF-16" + e + "E (" + b + " BOM)"
-}
-
-type utf16Decoder struct {
- initial config
- current config
-}
-
-func (u *utf16Decoder) Reset() {
- u.current = u.initial
-}
-
-func (u *utf16Decoder) Transform(dst, src []byte, atEOF bool) (nDst, nSrc int, err error) {
- if len(src) == 0 {
- if atEOF && u.current.bomPolicy&requireBOM != 0 {
- return 0, 0, ErrMissingBOM
- }
- return 0, 0, nil
- }
- if u.current.bomPolicy&acceptBOM != 0 {
- if len(src) < 2 {
- return 0, 0, transform.ErrShortSrc
- }
- switch {
- case src[0] == 0xfe && src[1] == 0xff:
- u.current.endianness = BigEndian
- nSrc = 2
- case src[0] == 0xff && src[1] == 0xfe:
- u.current.endianness = LittleEndian
- nSrc = 2
- default:
- if u.current.bomPolicy&requireBOM != 0 {
- return 0, 0, ErrMissingBOM
- }
- }
- u.current.bomPolicy = IgnoreBOM
- }
-
- var r rune
- var dSize, sSize int
- for nSrc < len(src) {
- if nSrc+1 < len(src) {
- x := uint16(src[nSrc+0])<<8 | uint16(src[nSrc+1])
- if u.current.endianness == LittleEndian {
- x = x>>8 | x<<8
- }
- r, sSize = rune(x), 2
- if utf16.IsSurrogate(r) {
- if nSrc+3 < len(src) {
- x = uint16(src[nSrc+2])<<8 | uint16(src[nSrc+3])
- if u.current.endianness == LittleEndian {
- x = x>>8 | x<<8
- }
- // Save for next iteration if it is not a high surrogate.
- if isHighSurrogate(rune(x)) {
- r, sSize = utf16.DecodeRune(r, rune(x)), 4
- }
- } else if !atEOF {
- err = transform.ErrShortSrc
- break
- }
- }
- if dSize = utf8.RuneLen(r); dSize < 0 {
- r, dSize = utf8.RuneError, 3
- }
- } else if atEOF {
- // Single trailing byte.
- r, dSize, sSize = utf8.RuneError, 3, 1
- } else {
- err = transform.ErrShortSrc
- break
- }
- if nDst+dSize > len(dst) {
- err = transform.ErrShortDst
- break
- }
- nDst += utf8.EncodeRune(dst[nDst:], r)
- nSrc += sSize
- }
- return nDst, nSrc, err
-}
-
-func isHighSurrogate(r rune) bool {
- return 0xDC00 <= r && r <= 0xDFFF
-}
-
-type utf16Encoder struct {
- endianness Endianness
- initialBOMPolicy BOMPolicy
- currentBOMPolicy BOMPolicy
-}
-
-func (u *utf16Encoder) Reset() {
- u.currentBOMPolicy = u.initialBOMPolicy
-}
-
-func (u *utf16Encoder) Transform(dst, src []byte, atEOF bool) (nDst, nSrc int, err error) {
- if u.currentBOMPolicy&writeBOM != 0 {
- if len(dst) < 2 {
- return 0, 0, transform.ErrShortDst
- }
- dst[0], dst[1] = 0xfe, 0xff
- u.currentBOMPolicy = IgnoreBOM
- nDst = 2
- }
-
- r, size := rune(0), 0
- for nSrc < len(src) {
- r = rune(src[nSrc])
-
- // Decode a 1-byte rune.
- if r < utf8.RuneSelf {
- size = 1
-
- } else {
- // Decode a multi-byte rune.
- r, size = utf8.DecodeRune(src[nSrc:])
- if size == 1 {
- // All valid runes of size 1 (those below utf8.RuneSelf) were
- // handled above. We have invalid UTF-8 or we haven't seen the
- // full character yet.
- if !atEOF && !utf8.FullRune(src[nSrc:]) {
- err = transform.ErrShortSrc
- break
- }
- }
- }
-
- if r <= 0xffff {
- if nDst+2 > len(dst) {
- err = transform.ErrShortDst
- break
- }
- dst[nDst+0] = uint8(r >> 8)
- dst[nDst+1] = uint8(r)
- nDst += 2
- } else {
- if nDst+4 > len(dst) {
- err = transform.ErrShortDst
- break
- }
- r1, r2 := utf16.EncodeRune(r)
- dst[nDst+0] = uint8(r1 >> 8)
- dst[nDst+1] = uint8(r1)
- dst[nDst+2] = uint8(r2 >> 8)
- dst[nDst+3] = uint8(r2)
- nDst += 4
- }
- nSrc += size
- }
-
- if u.endianness == LittleEndian {
- for i := 0; i < nDst; i += 2 {
- dst[i], dst[i+1] = dst[i+1], dst[i]
- }
- }
- return nDst, nSrc, err
-}
diff --git a/vendor/golang.org/x/text/internal/utf8internal/utf8internal.go b/vendor/golang.org/x/text/internal/utf8internal/utf8internal.go
deleted file mode 100644
index 575cea8707..0000000000
--- a/vendor/golang.org/x/text/internal/utf8internal/utf8internal.go
+++ /dev/null
@@ -1,87 +0,0 @@
-// Copyright 2015 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// Package utf8internal contains low-level utf8-related constants, tables, etc.
-// that are used internally by the text package.
-package utf8internal
-
-// The default lowest and highest continuation byte.
-const (
- LoCB = 0x80 // 1000 0000
- HiCB = 0xBF // 1011 1111
-)
-
-// Constants related to getting information of first bytes of UTF-8 sequences.
-const (
- // ASCII identifies a UTF-8 byte as ASCII.
- ASCII = as
-
- // FirstInvalid indicates a byte is invalid as a first byte of a UTF-8
- // sequence.
- FirstInvalid = xx
-
- // SizeMask is a mask for the size bits. Use use x&SizeMask to get the size.
- SizeMask = 7
-
- // AcceptShift is the right-shift count for the first byte info byte to get
- // the index into the AcceptRanges table. See AcceptRanges.
- AcceptShift = 4
-
- // The names of these constants are chosen to give nice alignment in the
- // table below. The first nibble is an index into acceptRanges or F for
- // special one-byte cases. The second nibble is the Rune length or the
- // Status for the special one-byte case.
- xx = 0xF1 // invalid: size 1
- as = 0xF0 // ASCII: size 1
- s1 = 0x02 // accept 0, size 2
- s2 = 0x13 // accept 1, size 3
- s3 = 0x03 // accept 0, size 3
- s4 = 0x23 // accept 2, size 3
- s5 = 0x34 // accept 3, size 4
- s6 = 0x04 // accept 0, size 4
- s7 = 0x44 // accept 4, size 4
-)
-
-// First is information about the first byte in a UTF-8 sequence.
-var First = [256]uint8{
- // 1 2 3 4 5 6 7 8 9 A B C D E F
- as, as, as, as, as, as, as, as, as, as, as, as, as, as, as, as, // 0x00-0x0F
- as, as, as, as, as, as, as, as, as, as, as, as, as, as, as, as, // 0x10-0x1F
- as, as, as, as, as, as, as, as, as, as, as, as, as, as, as, as, // 0x20-0x2F
- as, as, as, as, as, as, as, as, as, as, as, as, as, as, as, as, // 0x30-0x3F
- as, as, as, as, as, as, as, as, as, as, as, as, as, as, as, as, // 0x40-0x4F
- as, as, as, as, as, as, as, as, as, as, as, as, as, as, as, as, // 0x50-0x5F
- as, as, as, as, as, as, as, as, as, as, as, as, as, as, as, as, // 0x60-0x6F
- as, as, as, as, as, as, as, as, as, as, as, as, as, as, as, as, // 0x70-0x7F
- // 1 2 3 4 5 6 7 8 9 A B C D E F
- xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, // 0x80-0x8F
- xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, // 0x90-0x9F
- xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, // 0xA0-0xAF
- xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, // 0xB0-0xBF
- xx, xx, s1, s1, s1, s1, s1, s1, s1, s1, s1, s1, s1, s1, s1, s1, // 0xC0-0xCF
- s1, s1, s1, s1, s1, s1, s1, s1, s1, s1, s1, s1, s1, s1, s1, s1, // 0xD0-0xDF
- s2, s3, s3, s3, s3, s3, s3, s3, s3, s3, s3, s3, s3, s4, s3, s3, // 0xE0-0xEF
- s5, s6, s6, s6, s7, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, // 0xF0-0xFF
-}
-
-// AcceptRange gives the range of valid values for the second byte in a UTF-8
-// sequence for any value for First that is not ASCII or FirstInvalid.
-type AcceptRange struct {
- Lo uint8 // lowest value for second byte.
- Hi uint8 // highest value for second byte.
-}
-
-// AcceptRanges is a slice of AcceptRange values. For a given byte sequence b
-//
-// AcceptRanges[First[b[0]]>>AcceptShift]
-//
-// will give the value of AcceptRange for the multi-byte UTF-8 sequence starting
-// at b[0].
-var AcceptRanges = [...]AcceptRange{
- 0: {LoCB, HiCB},
- 1: {0xA0, HiCB},
- 2: {LoCB, 0x9F},
- 3: {0x90, HiCB},
- 4: {LoCB, 0x8F},
-}
diff --git a/vendor/golang.org/x/text/runes/cond.go b/vendor/golang.org/x/text/runes/cond.go
deleted file mode 100644
index df7aa02db6..0000000000
--- a/vendor/golang.org/x/text/runes/cond.go
+++ /dev/null
@@ -1,187 +0,0 @@
-// Copyright 2015 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package runes
-
-import (
- "unicode/utf8"
-
- "golang.org/x/text/transform"
-)
-
-// Note: below we pass invalid UTF-8 to the tIn and tNotIn transformers as is.
-// This is done for various reasons:
-// - To retain the semantics of the Nop transformer: if input is passed to a Nop
-// one would expect it to be unchanged.
-// - It would be very expensive to pass a converted RuneError to a transformer:
-// a transformer might need more source bytes after RuneError, meaning that
-// the only way to pass it safely is to create a new buffer and manage the
-// intermingling of RuneErrors and normal input.
-// - Many transformers leave ill-formed UTF-8 as is, so this is not
-// inconsistent. Generally ill-formed UTF-8 is only replaced if it is a
-// logical consequence of the operation (as for Map) or if it otherwise would
-// pose security concerns (as for Remove).
-// - An alternative would be to return an error on ill-formed UTF-8, but this
-// would be inconsistent with other operations.
-
-// If returns a transformer that applies tIn to consecutive runes for which
-// s.Contains(r) and tNotIn to consecutive runes for which !s.Contains(r). Reset
-// is called on tIn and tNotIn at the start of each run. A Nop transformer will
-// substitute a nil value passed to tIn or tNotIn. Invalid UTF-8 is translated
-// to RuneError to determine which transformer to apply, but is passed as is to
-// the respective transformer.
-func If(s Set, tIn, tNotIn transform.Transformer) Transformer {
- if tIn == nil && tNotIn == nil {
- return Transformer{transform.Nop}
- }
- if tIn == nil {
- tIn = transform.Nop
- }
- if tNotIn == nil {
- tNotIn = transform.Nop
- }
- sIn, ok := tIn.(transform.SpanningTransformer)
- if !ok {
- sIn = dummySpan{tIn}
- }
- sNotIn, ok := tNotIn.(transform.SpanningTransformer)
- if !ok {
- sNotIn = dummySpan{tNotIn}
- }
-
- a := &cond{
- tIn: sIn,
- tNotIn: sNotIn,
- f: s.Contains,
- }
- a.Reset()
- return Transformer{a}
-}
-
-type dummySpan struct{ transform.Transformer }
-
-func (d dummySpan) Span(src []byte, atEOF bool) (n int, err error) {
- return 0, transform.ErrEndOfSpan
-}
-
-type cond struct {
- tIn, tNotIn transform.SpanningTransformer
- f func(rune) bool
- check func(rune) bool // current check to perform
- t transform.SpanningTransformer // current transformer to use
-}
-
-// Reset implements transform.Transformer.
-func (t *cond) Reset() {
- t.check = t.is
- t.t = t.tIn
- t.t.Reset() // notIn will be reset on first usage.
-}
-
-func (t *cond) is(r rune) bool {
- if t.f(r) {
- return true
- }
- t.check = t.isNot
- t.t = t.tNotIn
- t.tNotIn.Reset()
- return false
-}
-
-func (t *cond) isNot(r rune) bool {
- if !t.f(r) {
- return true
- }
- t.check = t.is
- t.t = t.tIn
- t.tIn.Reset()
- return false
-}
-
-// This implementation of Span doesn't help all too much, but it needs to be
-// there to satisfy this package's Transformer interface.
-// TODO: there are certainly room for improvements, though. For example, if
-// t.t == transform.Nop (which will a common occurrence) it will save a bundle
-// to special-case that loop.
-func (t *cond) Span(src []byte, atEOF bool) (n int, err error) {
- p := 0
- for n < len(src) && err == nil {
- // Don't process too much at a time as the Spanner that will be
- // called on this block may terminate early.
- const maxChunk = 4096
- max := len(src)
- if v := n + maxChunk; v < max {
- max = v
- }
- atEnd := false
- size := 0
- current := t.t
- for ; p < max; p += size {
- r := rune(src[p])
- if r < utf8.RuneSelf {
- size = 1
- } else if r, size = utf8.DecodeRune(src[p:]); size == 1 {
- if !atEOF && !utf8.FullRune(src[p:]) {
- err = transform.ErrShortSrc
- break
- }
- }
- if !t.check(r) {
- // The next rune will be the start of a new run.
- atEnd = true
- break
- }
- }
- n2, err2 := current.Span(src[n:p], atEnd || (atEOF && p == len(src)))
- n += n2
- if err2 != nil {
- return n, err2
- }
- // At this point either err != nil or t.check will pass for the rune at p.
- p = n + size
- }
- return n, err
-}
-
-func (t *cond) Transform(dst, src []byte, atEOF bool) (nDst, nSrc int, err error) {
- p := 0
- for nSrc < len(src) && err == nil {
- // Don't process too much at a time, as the work might be wasted if the
- // destination buffer isn't large enough to hold the result or a
- // transform returns an error early.
- const maxChunk = 4096
- max := len(src)
- if n := nSrc + maxChunk; n < len(src) {
- max = n
- }
- atEnd := false
- size := 0
- current := t.t
- for ; p < max; p += size {
- r := rune(src[p])
- if r < utf8.RuneSelf {
- size = 1
- } else if r, size = utf8.DecodeRune(src[p:]); size == 1 {
- if !atEOF && !utf8.FullRune(src[p:]) {
- err = transform.ErrShortSrc
- break
- }
- }
- if !t.check(r) {
- // The next rune will be the start of a new run.
- atEnd = true
- break
- }
- }
- nDst2, nSrc2, err2 := current.Transform(dst[nDst:], src[nSrc:p], atEnd || (atEOF && p == len(src)))
- nDst += nDst2
- nSrc += nSrc2
- if err2 != nil {
- return nDst, nSrc, err2
- }
- // At this point either err != nil or t.check will pass for the rune at p.
- p = nSrc + size
- }
- return nDst, nSrc, err
-}
diff --git a/vendor/golang.org/x/text/runes/runes.go b/vendor/golang.org/x/text/runes/runes.go
deleted file mode 100644
index 71933696f5..0000000000
--- a/vendor/golang.org/x/text/runes/runes.go
+++ /dev/null
@@ -1,355 +0,0 @@
-// Copyright 2014 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// Package runes provide transforms for UTF-8 encoded text.
-package runes // import "golang.org/x/text/runes"
-
-import (
- "unicode"
- "unicode/utf8"
-
- "golang.org/x/text/transform"
-)
-
-// A Set is a collection of runes.
-type Set interface {
- // Contains returns true if r is contained in the set.
- Contains(r rune) bool
-}
-
-type setFunc func(rune) bool
-
-func (s setFunc) Contains(r rune) bool {
- return s(r)
-}
-
-// Note: using funcs here instead of wrapping types result in cleaner
-// documentation and a smaller API.
-
-// In creates a Set with a Contains method that returns true for all runes in
-// the given RangeTable.
-func In(rt *unicode.RangeTable) Set {
- return setFunc(func(r rune) bool { return unicode.Is(rt, r) })
-}
-
-// In creates a Set with a Contains method that returns true for all runes not
-// in the given RangeTable.
-func NotIn(rt *unicode.RangeTable) Set {
- return setFunc(func(r rune) bool { return !unicode.Is(rt, r) })
-}
-
-// Predicate creates a Set with a Contains method that returns f(r).
-func Predicate(f func(rune) bool) Set {
- return setFunc(f)
-}
-
-// Transformer implements the transform.Transformer interface.
-type Transformer struct {
- t transform.SpanningTransformer
-}
-
-func (t Transformer) Transform(dst, src []byte, atEOF bool) (nDst, nSrc int, err error) {
- return t.t.Transform(dst, src, atEOF)
-}
-
-func (t Transformer) Span(b []byte, atEOF bool) (n int, err error) {
- return t.t.Span(b, atEOF)
-}
-
-func (t Transformer) Reset() { t.t.Reset() }
-
-// Bytes returns a new byte slice with the result of converting b using t. It
-// calls Reset on t. It returns nil if any error was found. This can only happen
-// if an error-producing Transformer is passed to If.
-func (t Transformer) Bytes(b []byte) []byte {
- b, _, err := transform.Bytes(t, b)
- if err != nil {
- return nil
- }
- return b
-}
-
-// String returns a string with the result of converting s using t. It calls
-// Reset on t. It returns the empty string if any error was found. This can only
-// happen if an error-producing Transformer is passed to If.
-func (t Transformer) String(s string) string {
- s, _, err := transform.String(t, s)
- if err != nil {
- return ""
- }
- return s
-}
-
-// TODO:
-// - Copy: copying strings and bytes in whole-rune units.
-// - Validation (maybe)
-// - Well-formed-ness (maybe)
-
-const runeErrorString = string(utf8.RuneError)
-
-// Remove returns a Transformer that removes runes r for which s.Contains(r).
-// Illegal input bytes are replaced by RuneError before being passed to f.
-func Remove(s Set) Transformer {
- if f, ok := s.(setFunc); ok {
- // This little trick cuts the running time of BenchmarkRemove for sets
- // created by Predicate roughly in half.
- // TODO: special-case RangeTables as well.
- return Transformer{remove(f)}
- }
- return Transformer{remove(s.Contains)}
-}
-
-// TODO: remove transform.RemoveFunc.
-
-type remove func(r rune) bool
-
-func (remove) Reset() {}
-
-// Span implements transform.Spanner.
-func (t remove) Span(src []byte, atEOF bool) (n int, err error) {
- for r, size := rune(0), 0; n < len(src); {
- if r = rune(src[n]); r < utf8.RuneSelf {
- size = 1
- } else if r, size = utf8.DecodeRune(src[n:]); size == 1 {
- // Invalid rune.
- if !atEOF && !utf8.FullRune(src[n:]) {
- err = transform.ErrShortSrc
- } else {
- err = transform.ErrEndOfSpan
- }
- break
- }
- if t(r) {
- err = transform.ErrEndOfSpan
- break
- }
- n += size
- }
- return
-}
-
-// Transform implements transform.Transformer.
-func (t remove) Transform(dst, src []byte, atEOF bool) (nDst, nSrc int, err error) {
- for r, size := rune(0), 0; nSrc < len(src); {
- if r = rune(src[nSrc]); r < utf8.RuneSelf {
- size = 1
- } else if r, size = utf8.DecodeRune(src[nSrc:]); size == 1 {
- // Invalid rune.
- if !atEOF && !utf8.FullRune(src[nSrc:]) {
- err = transform.ErrShortSrc
- break
- }
- // We replace illegal bytes with RuneError. Not doing so might
- // otherwise turn a sequence of invalid UTF-8 into valid UTF-8.
- // The resulting byte sequence may subsequently contain runes
- // for which t(r) is true that were passed unnoticed.
- if !t(utf8.RuneError) {
- if nDst+3 > len(dst) {
- err = transform.ErrShortDst
- break
- }
- dst[nDst+0] = runeErrorString[0]
- dst[nDst+1] = runeErrorString[1]
- dst[nDst+2] = runeErrorString[2]
- nDst += 3
- }
- nSrc++
- continue
- }
- if t(r) {
- nSrc += size
- continue
- }
- if nDst+size > len(dst) {
- err = transform.ErrShortDst
- break
- }
- for i := 0; i < size; i++ {
- dst[nDst] = src[nSrc]
- nDst++
- nSrc++
- }
- }
- return
-}
-
-// Map returns a Transformer that maps the runes in the input using the given
-// mapping. Illegal bytes in the input are converted to utf8.RuneError before
-// being passed to the mapping func.
-func Map(mapping func(rune) rune) Transformer {
- return Transformer{mapper(mapping)}
-}
-
-type mapper func(rune) rune
-
-func (mapper) Reset() {}
-
-// Span implements transform.Spanner.
-func (t mapper) Span(src []byte, atEOF bool) (n int, err error) {
- for r, size := rune(0), 0; n < len(src); n += size {
- if r = rune(src[n]); r < utf8.RuneSelf {
- size = 1
- } else if r, size = utf8.DecodeRune(src[n:]); size == 1 {
- // Invalid rune.
- if !atEOF && !utf8.FullRune(src[n:]) {
- err = transform.ErrShortSrc
- } else {
- err = transform.ErrEndOfSpan
- }
- break
- }
- if t(r) != r {
- err = transform.ErrEndOfSpan
- break
- }
- }
- return n, err
-}
-
-// Transform implements transform.Transformer.
-func (t mapper) Transform(dst, src []byte, atEOF bool) (nDst, nSrc int, err error) {
- var replacement rune
- var b [utf8.UTFMax]byte
-
- for r, size := rune(0), 0; nSrc < len(src); {
- if r = rune(src[nSrc]); r < utf8.RuneSelf {
- if replacement = t(r); replacement < utf8.RuneSelf {
- if nDst == len(dst) {
- err = transform.ErrShortDst
- break
- }
- dst[nDst] = byte(replacement)
- nDst++
- nSrc++
- continue
- }
- size = 1
- } else if r, size = utf8.DecodeRune(src[nSrc:]); size == 1 {
- // Invalid rune.
- if !atEOF && !utf8.FullRune(src[nSrc:]) {
- err = transform.ErrShortSrc
- break
- }
-
- if replacement = t(utf8.RuneError); replacement == utf8.RuneError {
- if nDst+3 > len(dst) {
- err = transform.ErrShortDst
- break
- }
- dst[nDst+0] = runeErrorString[0]
- dst[nDst+1] = runeErrorString[1]
- dst[nDst+2] = runeErrorString[2]
- nDst += 3
- nSrc++
- continue
- }
- } else if replacement = t(r); replacement == r {
- if nDst+size > len(dst) {
- err = transform.ErrShortDst
- break
- }
- for i := 0; i < size; i++ {
- dst[nDst] = src[nSrc]
- nDst++
- nSrc++
- }
- continue
- }
-
- n := utf8.EncodeRune(b[:], replacement)
-
- if nDst+n > len(dst) {
- err = transform.ErrShortDst
- break
- }
- for i := 0; i < n; i++ {
- dst[nDst] = b[i]
- nDst++
- }
- nSrc += size
- }
- return
-}
-
-// ReplaceIllFormed returns a transformer that replaces all input bytes that are
-// not part of a well-formed UTF-8 code sequence with utf8.RuneError.
-func ReplaceIllFormed() Transformer {
- return Transformer{&replaceIllFormed{}}
-}
-
-type replaceIllFormed struct{ transform.NopResetter }
-
-func (t replaceIllFormed) Span(src []byte, atEOF bool) (n int, err error) {
- for n < len(src) {
- // ASCII fast path.
- if src[n] < utf8.RuneSelf {
- n++
- continue
- }
-
- r, size := utf8.DecodeRune(src[n:])
-
- // Look for a valid non-ASCII rune.
- if r != utf8.RuneError || size != 1 {
- n += size
- continue
- }
-
- // Look for short source data.
- if !atEOF && !utf8.FullRune(src[n:]) {
- err = transform.ErrShortSrc
- break
- }
-
- // We have an invalid rune.
- err = transform.ErrEndOfSpan
- break
- }
- return n, err
-}
-
-func (t replaceIllFormed) Transform(dst, src []byte, atEOF bool) (nDst, nSrc int, err error) {
- for nSrc < len(src) {
- // ASCII fast path.
- if r := src[nSrc]; r < utf8.RuneSelf {
- if nDst == len(dst) {
- err = transform.ErrShortDst
- break
- }
- dst[nDst] = r
- nDst++
- nSrc++
- continue
- }
-
- // Look for a valid non-ASCII rune.
- if _, size := utf8.DecodeRune(src[nSrc:]); size != 1 {
- if size != copy(dst[nDst:], src[nSrc:nSrc+size]) {
- err = transform.ErrShortDst
- break
- }
- nDst += size
- nSrc += size
- continue
- }
-
- // Look for short source data.
- if !atEOF && !utf8.FullRune(src[nSrc:]) {
- err = transform.ErrShortSrc
- break
- }
-
- // We have an invalid rune.
- if nDst+3 > len(dst) {
- err = transform.ErrShortDst
- break
- }
- dst[nDst+0] = runeErrorString[0]
- dst[nDst+1] = runeErrorString[1]
- dst[nDst+2] = runeErrorString[2]
- nDst += 3
- nSrc++
- }
- return nDst, nSrc, err
-}
diff --git a/vendor/k8s.io/api/imagepolicy/v1alpha1/doc.go b/vendor/k8s.io/api/imagepolicy/v1alpha1/doc.go
deleted file mode 100644
index 3b4840ad64..0000000000
--- a/vendor/k8s.io/api/imagepolicy/v1alpha1/doc.go
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
-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
-
-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.
-*/
-
-// +k8s:deepcopy-gen=package
-// +k8s:openapi-gen=true
-
-// +groupName=imagepolicy.k8s.io
-package v1alpha1 // import "k8s.io/api/imagepolicy/v1alpha1"
diff --git a/vendor/k8s.io/api/imagepolicy/v1alpha1/generated.pb.go b/vendor/k8s.io/api/imagepolicy/v1alpha1/generated.pb.go
deleted file mode 100644
index 6e08dcca84..0000000000
--- a/vendor/k8s.io/api/imagepolicy/v1alpha1/generated.pb.go
+++ /dev/null
@@ -1,1235 +0,0 @@
-/*
-Copyright 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
-
-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.
-*/
-
-// Code generated by protoc-gen-gogo.
-// source: k8s.io/kubernetes/vendor/k8s.io/api/imagepolicy/v1alpha1/generated.proto
-// DO NOT EDIT!
-
-/*
- Package v1alpha1 is a generated protocol buffer package.
-
- It is generated from these files:
- k8s.io/kubernetes/vendor/k8s.io/api/imagepolicy/v1alpha1/generated.proto
-
- It has these top-level messages:
- ImageReview
- ImageReviewContainerSpec
- ImageReviewSpec
- ImageReviewStatus
-*/
-package v1alpha1
-
-import proto "github.com/gogo/protobuf/proto"
-import fmt "fmt"
-import math "math"
-
-import github_com_gogo_protobuf_sortkeys "github.com/gogo/protobuf/sortkeys"
-
-import strings "strings"
-import reflect "reflect"
-
-import io "io"
-
-// Reference imports to suppress errors if they are not otherwise used.
-var _ = proto.Marshal
-var _ = fmt.Errorf
-var _ = math.Inf
-
-// This is a compile-time assertion to ensure that this generated file
-// is compatible with the proto package it is being compiled against.
-// A compilation error at this line likely means your copy of the
-// proto package needs to be updated.
-const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package
-
-func (m *ImageReview) Reset() { *m = ImageReview{} }
-func (*ImageReview) ProtoMessage() {}
-func (*ImageReview) Descriptor() ([]byte, []int) { return fileDescriptorGenerated, []int{0} }
-
-func (m *ImageReviewContainerSpec) Reset() { *m = ImageReviewContainerSpec{} }
-func (*ImageReviewContainerSpec) ProtoMessage() {}
-func (*ImageReviewContainerSpec) Descriptor() ([]byte, []int) {
- return fileDescriptorGenerated, []int{1}
-}
-
-func (m *ImageReviewSpec) Reset() { *m = ImageReviewSpec{} }
-func (*ImageReviewSpec) ProtoMessage() {}
-func (*ImageReviewSpec) Descriptor() ([]byte, []int) { return fileDescriptorGenerated, []int{2} }
-
-func (m *ImageReviewStatus) Reset() { *m = ImageReviewStatus{} }
-func (*ImageReviewStatus) ProtoMessage() {}
-func (*ImageReviewStatus) Descriptor() ([]byte, []int) { return fileDescriptorGenerated, []int{3} }
-
-func init() {
- proto.RegisterType((*ImageReview)(nil), "k8s.io.api.imagepolicy.v1alpha1.ImageReview")
- proto.RegisterType((*ImageReviewContainerSpec)(nil), "k8s.io.api.imagepolicy.v1alpha1.ImageReviewContainerSpec")
- proto.RegisterType((*ImageReviewSpec)(nil), "k8s.io.api.imagepolicy.v1alpha1.ImageReviewSpec")
- proto.RegisterType((*ImageReviewStatus)(nil), "k8s.io.api.imagepolicy.v1alpha1.ImageReviewStatus")
-}
-func (m *ImageReview) Marshal() (dAtA []byte, err error) {
- size := m.Size()
- dAtA = make([]byte, size)
- n, err := m.MarshalTo(dAtA)
- if err != nil {
- return nil, err
- }
- return dAtA[:n], nil
-}
-
-func (m *ImageReview) MarshalTo(dAtA []byte) (int, error) {
- var i int
- _ = i
- var l int
- _ = l
- dAtA[i] = 0xa
- i++
- i = encodeVarintGenerated(dAtA, i, uint64(m.ObjectMeta.Size()))
- n1, err := m.ObjectMeta.MarshalTo(dAtA[i:])
- if err != nil {
- return 0, err
- }
- i += n1
- dAtA[i] = 0x12
- i++
- i = encodeVarintGenerated(dAtA, i, uint64(m.Spec.Size()))
- n2, err := m.Spec.MarshalTo(dAtA[i:])
- if err != nil {
- return 0, err
- }
- i += n2
- dAtA[i] = 0x1a
- i++
- i = encodeVarintGenerated(dAtA, i, uint64(m.Status.Size()))
- n3, err := m.Status.MarshalTo(dAtA[i:])
- if err != nil {
- return 0, err
- }
- i += n3
- return i, nil
-}
-
-func (m *ImageReviewContainerSpec) Marshal() (dAtA []byte, err error) {
- size := m.Size()
- dAtA = make([]byte, size)
- n, err := m.MarshalTo(dAtA)
- if err != nil {
- return nil, err
- }
- return dAtA[:n], nil
-}
-
-func (m *ImageReviewContainerSpec) MarshalTo(dAtA []byte) (int, error) {
- var i int
- _ = i
- var l int
- _ = l
- dAtA[i] = 0xa
- i++
- i = encodeVarintGenerated(dAtA, i, uint64(len(m.Image)))
- i += copy(dAtA[i:], m.Image)
- return i, nil
-}
-
-func (m *ImageReviewSpec) Marshal() (dAtA []byte, err error) {
- size := m.Size()
- dAtA = make([]byte, size)
- n, err := m.MarshalTo(dAtA)
- if err != nil {
- return nil, err
- }
- return dAtA[:n], nil
-}
-
-func (m *ImageReviewSpec) MarshalTo(dAtA []byte) (int, error) {
- var i int
- _ = i
- var l int
- _ = l
- if len(m.Containers) > 0 {
- for _, msg := range m.Containers {
- dAtA[i] = 0xa
- i++
- i = encodeVarintGenerated(dAtA, i, uint64(msg.Size()))
- n, err := msg.MarshalTo(dAtA[i:])
- if err != nil {
- return 0, err
- }
- i += n
- }
- }
- if len(m.Annotations) > 0 {
- keysForAnnotations := make([]string, 0, len(m.Annotations))
- for k := range m.Annotations {
- keysForAnnotations = append(keysForAnnotations, string(k))
- }
- github_com_gogo_protobuf_sortkeys.Strings(keysForAnnotations)
- for _, k := range keysForAnnotations {
- dAtA[i] = 0x12
- i++
- v := m.Annotations[string(k)]
- mapSize := 1 + len(k) + sovGenerated(uint64(len(k))) + 1 + len(v) + sovGenerated(uint64(len(v)))
- i = encodeVarintGenerated(dAtA, i, uint64(mapSize))
- dAtA[i] = 0xa
- i++
- i = encodeVarintGenerated(dAtA, i, uint64(len(k)))
- i += copy(dAtA[i:], k)
- dAtA[i] = 0x12
- i++
- i = encodeVarintGenerated(dAtA, i, uint64(len(v)))
- i += copy(dAtA[i:], v)
- }
- }
- dAtA[i] = 0x1a
- i++
- i = encodeVarintGenerated(dAtA, i, uint64(len(m.Namespace)))
- i += copy(dAtA[i:], m.Namespace)
- return i, nil
-}
-
-func (m *ImageReviewStatus) Marshal() (dAtA []byte, err error) {
- size := m.Size()
- dAtA = make([]byte, size)
- n, err := m.MarshalTo(dAtA)
- if err != nil {
- return nil, err
- }
- return dAtA[:n], nil
-}
-
-func (m *ImageReviewStatus) MarshalTo(dAtA []byte) (int, error) {
- var i int
- _ = i
- var l int
- _ = l
- dAtA[i] = 0x8
- i++
- if m.Allowed {
- dAtA[i] = 1
- } else {
- dAtA[i] = 0
- }
- i++
- dAtA[i] = 0x12
- i++
- i = encodeVarintGenerated(dAtA, i, uint64(len(m.Reason)))
- i += copy(dAtA[i:], m.Reason)
- if len(m.AuditAnnotations) > 0 {
- keysForAuditAnnotations := make([]string, 0, len(m.AuditAnnotations))
- for k := range m.AuditAnnotations {
- keysForAuditAnnotations = append(keysForAuditAnnotations, string(k))
- }
- github_com_gogo_protobuf_sortkeys.Strings(keysForAuditAnnotations)
- for _, k := range keysForAuditAnnotations {
- dAtA[i] = 0x1a
- i++
- v := m.AuditAnnotations[string(k)]
- mapSize := 1 + len(k) + sovGenerated(uint64(len(k))) + 1 + len(v) + sovGenerated(uint64(len(v)))
- i = encodeVarintGenerated(dAtA, i, uint64(mapSize))
- dAtA[i] = 0xa
- i++
- i = encodeVarintGenerated(dAtA, i, uint64(len(k)))
- i += copy(dAtA[i:], k)
- dAtA[i] = 0x12
- i++
- i = encodeVarintGenerated(dAtA, i, uint64(len(v)))
- i += copy(dAtA[i:], v)
- }
- }
- return i, nil
-}
-
-func encodeFixed64Generated(dAtA []byte, offset int, v uint64) int {
- dAtA[offset] = uint8(v)
- dAtA[offset+1] = uint8(v >> 8)
- dAtA[offset+2] = uint8(v >> 16)
- dAtA[offset+3] = uint8(v >> 24)
- dAtA[offset+4] = uint8(v >> 32)
- dAtA[offset+5] = uint8(v >> 40)
- dAtA[offset+6] = uint8(v >> 48)
- dAtA[offset+7] = uint8(v >> 56)
- return offset + 8
-}
-func encodeFixed32Generated(dAtA []byte, offset int, v uint32) int {
- dAtA[offset] = uint8(v)
- dAtA[offset+1] = uint8(v >> 8)
- dAtA[offset+2] = uint8(v >> 16)
- dAtA[offset+3] = uint8(v >> 24)
- return offset + 4
-}
-func encodeVarintGenerated(dAtA []byte, offset int, v uint64) int {
- for v >= 1<<7 {
- dAtA[offset] = uint8(v&0x7f | 0x80)
- v >>= 7
- offset++
- }
- dAtA[offset] = uint8(v)
- return offset + 1
-}
-func (m *ImageReview) Size() (n int) {
- var l int
- _ = l
- l = m.ObjectMeta.Size()
- n += 1 + l + sovGenerated(uint64(l))
- l = m.Spec.Size()
- n += 1 + l + sovGenerated(uint64(l))
- l = m.Status.Size()
- n += 1 + l + sovGenerated(uint64(l))
- return n
-}
-
-func (m *ImageReviewContainerSpec) Size() (n int) {
- var l int
- _ = l
- l = len(m.Image)
- n += 1 + l + sovGenerated(uint64(l))
- return n
-}
-
-func (m *ImageReviewSpec) Size() (n int) {
- var l int
- _ = l
- if len(m.Containers) > 0 {
- for _, e := range m.Containers {
- l = e.Size()
- n += 1 + l + sovGenerated(uint64(l))
- }
- }
- if len(m.Annotations) > 0 {
- for k, v := range m.Annotations {
- _ = k
- _ = v
- mapEntrySize := 1 + len(k) + sovGenerated(uint64(len(k))) + 1 + len(v) + sovGenerated(uint64(len(v)))
- n += mapEntrySize + 1 + sovGenerated(uint64(mapEntrySize))
- }
- }
- l = len(m.Namespace)
- n += 1 + l + sovGenerated(uint64(l))
- return n
-}
-
-func (m *ImageReviewStatus) Size() (n int) {
- var l int
- _ = l
- n += 2
- l = len(m.Reason)
- n += 1 + l + sovGenerated(uint64(l))
- if len(m.AuditAnnotations) > 0 {
- for k, v := range m.AuditAnnotations {
- _ = k
- _ = v
- mapEntrySize := 1 + len(k) + sovGenerated(uint64(len(k))) + 1 + len(v) + sovGenerated(uint64(len(v)))
- n += mapEntrySize + 1 + sovGenerated(uint64(mapEntrySize))
- }
- }
- return n
-}
-
-func sovGenerated(x uint64) (n int) {
- for {
- n++
- x >>= 7
- if x == 0 {
- break
- }
- }
- return n
-}
-func sozGenerated(x uint64) (n int) {
- return sovGenerated(uint64((x << 1) ^ uint64((int64(x) >> 63))))
-}
-func (this *ImageReview) String() string {
- if this == nil {
- return "nil"
- }
- s := strings.Join([]string{`&ImageReview{`,
- `ObjectMeta:` + strings.Replace(strings.Replace(this.ObjectMeta.String(), "ObjectMeta", "k8s_io_apimachinery_pkg_apis_meta_v1.ObjectMeta", 1), `&`, ``, 1) + `,`,
- `Spec:` + strings.Replace(strings.Replace(this.Spec.String(), "ImageReviewSpec", "ImageReviewSpec", 1), `&`, ``, 1) + `,`,
- `Status:` + strings.Replace(strings.Replace(this.Status.String(), "ImageReviewStatus", "ImageReviewStatus", 1), `&`, ``, 1) + `,`,
- `}`,
- }, "")
- return s
-}
-func (this *ImageReviewContainerSpec) String() string {
- if this == nil {
- return "nil"
- }
- s := strings.Join([]string{`&ImageReviewContainerSpec{`,
- `Image:` + fmt.Sprintf("%v", this.Image) + `,`,
- `}`,
- }, "")
- return s
-}
-func (this *ImageReviewSpec) String() string {
- if this == nil {
- return "nil"
- }
- keysForAnnotations := make([]string, 0, len(this.Annotations))
- for k := range this.Annotations {
- keysForAnnotations = append(keysForAnnotations, k)
- }
- github_com_gogo_protobuf_sortkeys.Strings(keysForAnnotations)
- mapStringForAnnotations := "map[string]string{"
- for _, k := range keysForAnnotations {
- mapStringForAnnotations += fmt.Sprintf("%v: %v,", k, this.Annotations[k])
- }
- mapStringForAnnotations += "}"
- s := strings.Join([]string{`&ImageReviewSpec{`,
- `Containers:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.Containers), "ImageReviewContainerSpec", "ImageReviewContainerSpec", 1), `&`, ``, 1) + `,`,
- `Annotations:` + mapStringForAnnotations + `,`,
- `Namespace:` + fmt.Sprintf("%v", this.Namespace) + `,`,
- `}`,
- }, "")
- return s
-}
-func (this *ImageReviewStatus) String() string {
- if this == nil {
- return "nil"
- }
- keysForAuditAnnotations := make([]string, 0, len(this.AuditAnnotations))
- for k := range this.AuditAnnotations {
- keysForAuditAnnotations = append(keysForAuditAnnotations, k)
- }
- github_com_gogo_protobuf_sortkeys.Strings(keysForAuditAnnotations)
- mapStringForAuditAnnotations := "map[string]string{"
- for _, k := range keysForAuditAnnotations {
- mapStringForAuditAnnotations += fmt.Sprintf("%v: %v,", k, this.AuditAnnotations[k])
- }
- mapStringForAuditAnnotations += "}"
- s := strings.Join([]string{`&ImageReviewStatus{`,
- `Allowed:` + fmt.Sprintf("%v", this.Allowed) + `,`,
- `Reason:` + fmt.Sprintf("%v", this.Reason) + `,`,
- `AuditAnnotations:` + mapStringForAuditAnnotations + `,`,
- `}`,
- }, "")
- return s
-}
-func valueToStringGenerated(v interface{}) string {
- rv := reflect.ValueOf(v)
- if rv.IsNil() {
- return "nil"
- }
- pv := reflect.Indirect(rv).Interface()
- return fmt.Sprintf("*%v", pv)
-}
-func (m *ImageReview) Unmarshal(dAtA []byte) error {
- l := len(dAtA)
- iNdEx := 0
- for iNdEx < l {
- preIndex := iNdEx
- var wire uint64
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowGenerated
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := dAtA[iNdEx]
- iNdEx++
- wire |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- fieldNum := int32(wire >> 3)
- wireType := int(wire & 0x7)
- if wireType == 4 {
- return fmt.Errorf("proto: ImageReview: wiretype end group for non-group")
- }
- if fieldNum <= 0 {
- return fmt.Errorf("proto: ImageReview: illegal tag %d (wire type %d)", fieldNum, wire)
- }
- switch fieldNum {
- case 1:
- if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field ObjectMeta", wireType)
- }
- var msglen int
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowGenerated
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := dAtA[iNdEx]
- iNdEx++
- msglen |= (int(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- if msglen < 0 {
- return ErrInvalidLengthGenerated
- }
- postIndex := iNdEx + msglen
- if postIndex > l {
- return io.ErrUnexpectedEOF
- }
- if err := m.ObjectMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
- return err
- }
- iNdEx = postIndex
- case 2:
- if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field Spec", wireType)
- }
- var msglen int
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowGenerated
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := dAtA[iNdEx]
- iNdEx++
- msglen |= (int(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- if msglen < 0 {
- return ErrInvalidLengthGenerated
- }
- postIndex := iNdEx + msglen
- if postIndex > l {
- return io.ErrUnexpectedEOF
- }
- if err := m.Spec.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
- return err
- }
- iNdEx = postIndex
- case 3:
- if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType)
- }
- var msglen int
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowGenerated
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := dAtA[iNdEx]
- iNdEx++
- msglen |= (int(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- if msglen < 0 {
- return ErrInvalidLengthGenerated
- }
- postIndex := iNdEx + msglen
- if postIndex > l {
- return io.ErrUnexpectedEOF
- }
- if err := m.Status.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
- return err
- }
- iNdEx = postIndex
- default:
- iNdEx = preIndex
- skippy, err := skipGenerated(dAtA[iNdEx:])
- if err != nil {
- return err
- }
- if skippy < 0 {
- return ErrInvalidLengthGenerated
- }
- if (iNdEx + skippy) > l {
- return io.ErrUnexpectedEOF
- }
- iNdEx += skippy
- }
- }
-
- if iNdEx > l {
- return io.ErrUnexpectedEOF
- }
- return nil
-}
-func (m *ImageReviewContainerSpec) Unmarshal(dAtA []byte) error {
- l := len(dAtA)
- iNdEx := 0
- for iNdEx < l {
- preIndex := iNdEx
- var wire uint64
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowGenerated
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := dAtA[iNdEx]
- iNdEx++
- wire |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- fieldNum := int32(wire >> 3)
- wireType := int(wire & 0x7)
- if wireType == 4 {
- return fmt.Errorf("proto: ImageReviewContainerSpec: wiretype end group for non-group")
- }
- if fieldNum <= 0 {
- return fmt.Errorf("proto: ImageReviewContainerSpec: illegal tag %d (wire type %d)", fieldNum, wire)
- }
- switch fieldNum {
- case 1:
- if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field Image", wireType)
- }
- var stringLen uint64
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowGenerated
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := dAtA[iNdEx]
- iNdEx++
- stringLen |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- intStringLen := int(stringLen)
- if intStringLen < 0 {
- return ErrInvalidLengthGenerated
- }
- postIndex := iNdEx + intStringLen
- if postIndex > l {
- return io.ErrUnexpectedEOF
- }
- m.Image = string(dAtA[iNdEx:postIndex])
- iNdEx = postIndex
- default:
- iNdEx = preIndex
- skippy, err := skipGenerated(dAtA[iNdEx:])
- if err != nil {
- return err
- }
- if skippy < 0 {
- return ErrInvalidLengthGenerated
- }
- if (iNdEx + skippy) > l {
- return io.ErrUnexpectedEOF
- }
- iNdEx += skippy
- }
- }
-
- if iNdEx > l {
- return io.ErrUnexpectedEOF
- }
- return nil
-}
-func (m *ImageReviewSpec) Unmarshal(dAtA []byte) error {
- l := len(dAtA)
- iNdEx := 0
- for iNdEx < l {
- preIndex := iNdEx
- var wire uint64
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowGenerated
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := dAtA[iNdEx]
- iNdEx++
- wire |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- fieldNum := int32(wire >> 3)
- wireType := int(wire & 0x7)
- if wireType == 4 {
- return fmt.Errorf("proto: ImageReviewSpec: wiretype end group for non-group")
- }
- if fieldNum <= 0 {
- return fmt.Errorf("proto: ImageReviewSpec: illegal tag %d (wire type %d)", fieldNum, wire)
- }
- switch fieldNum {
- case 1:
- if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field Containers", wireType)
- }
- var msglen int
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowGenerated
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := dAtA[iNdEx]
- iNdEx++
- msglen |= (int(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- if msglen < 0 {
- return ErrInvalidLengthGenerated
- }
- postIndex := iNdEx + msglen
- if postIndex > l {
- return io.ErrUnexpectedEOF
- }
- m.Containers = append(m.Containers, ImageReviewContainerSpec{})
- if err := m.Containers[len(m.Containers)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
- return err
- }
- iNdEx = postIndex
- case 2:
- if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field Annotations", wireType)
- }
- var msglen int
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowGenerated
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := dAtA[iNdEx]
- iNdEx++
- msglen |= (int(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- if msglen < 0 {
- return ErrInvalidLengthGenerated
- }
- postIndex := iNdEx + msglen
- if postIndex > l {
- return io.ErrUnexpectedEOF
- }
- var keykey uint64
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowGenerated
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := dAtA[iNdEx]
- iNdEx++
- keykey |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- var stringLenmapkey uint64
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowGenerated
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := dAtA[iNdEx]
- iNdEx++
- stringLenmapkey |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- intStringLenmapkey := int(stringLenmapkey)
- if intStringLenmapkey < 0 {
- return ErrInvalidLengthGenerated
- }
- postStringIndexmapkey := iNdEx + intStringLenmapkey
- if postStringIndexmapkey > l {
- return io.ErrUnexpectedEOF
- }
- mapkey := string(dAtA[iNdEx:postStringIndexmapkey])
- iNdEx = postStringIndexmapkey
- if m.Annotations == nil {
- m.Annotations = make(map[string]string)
- }
- if iNdEx < postIndex {
- var valuekey uint64
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowGenerated
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := dAtA[iNdEx]
- iNdEx++
- valuekey |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- var stringLenmapvalue uint64
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowGenerated
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := dAtA[iNdEx]
- iNdEx++
- stringLenmapvalue |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- intStringLenmapvalue := int(stringLenmapvalue)
- if intStringLenmapvalue < 0 {
- return ErrInvalidLengthGenerated
- }
- postStringIndexmapvalue := iNdEx + intStringLenmapvalue
- if postStringIndexmapvalue > l {
- return io.ErrUnexpectedEOF
- }
- mapvalue := string(dAtA[iNdEx:postStringIndexmapvalue])
- iNdEx = postStringIndexmapvalue
- m.Annotations[mapkey] = mapvalue
- } else {
- var mapvalue string
- m.Annotations[mapkey] = mapvalue
- }
- iNdEx = postIndex
- case 3:
- if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field Namespace", wireType)
- }
- var stringLen uint64
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowGenerated
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := dAtA[iNdEx]
- iNdEx++
- stringLen |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- intStringLen := int(stringLen)
- if intStringLen < 0 {
- return ErrInvalidLengthGenerated
- }
- postIndex := iNdEx + intStringLen
- if postIndex > l {
- return io.ErrUnexpectedEOF
- }
- m.Namespace = string(dAtA[iNdEx:postIndex])
- iNdEx = postIndex
- default:
- iNdEx = preIndex
- skippy, err := skipGenerated(dAtA[iNdEx:])
- if err != nil {
- return err
- }
- if skippy < 0 {
- return ErrInvalidLengthGenerated
- }
- if (iNdEx + skippy) > l {
- return io.ErrUnexpectedEOF
- }
- iNdEx += skippy
- }
- }
-
- if iNdEx > l {
- return io.ErrUnexpectedEOF
- }
- return nil
-}
-func (m *ImageReviewStatus) Unmarshal(dAtA []byte) error {
- l := len(dAtA)
- iNdEx := 0
- for iNdEx < l {
- preIndex := iNdEx
- var wire uint64
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowGenerated
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := dAtA[iNdEx]
- iNdEx++
- wire |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- fieldNum := int32(wire >> 3)
- wireType := int(wire & 0x7)
- if wireType == 4 {
- return fmt.Errorf("proto: ImageReviewStatus: wiretype end group for non-group")
- }
- if fieldNum <= 0 {
- return fmt.Errorf("proto: ImageReviewStatus: illegal tag %d (wire type %d)", fieldNum, wire)
- }
- switch fieldNum {
- case 1:
- if wireType != 0 {
- return fmt.Errorf("proto: wrong wireType = %d for field Allowed", wireType)
- }
- var v int
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowGenerated
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := dAtA[iNdEx]
- iNdEx++
- v |= (int(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- m.Allowed = bool(v != 0)
- case 2:
- if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field Reason", wireType)
- }
- var stringLen uint64
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowGenerated
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := dAtA[iNdEx]
- iNdEx++
- stringLen |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- intStringLen := int(stringLen)
- if intStringLen < 0 {
- return ErrInvalidLengthGenerated
- }
- postIndex := iNdEx + intStringLen
- if postIndex > l {
- return io.ErrUnexpectedEOF
- }
- m.Reason = string(dAtA[iNdEx:postIndex])
- iNdEx = postIndex
- case 3:
- if wireType != 2 {
- return fmt.Errorf("proto: wrong wireType = %d for field AuditAnnotations", wireType)
- }
- var msglen int
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowGenerated
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := dAtA[iNdEx]
- iNdEx++
- msglen |= (int(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- if msglen < 0 {
- return ErrInvalidLengthGenerated
- }
- postIndex := iNdEx + msglen
- if postIndex > l {
- return io.ErrUnexpectedEOF
- }
- var keykey uint64
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowGenerated
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := dAtA[iNdEx]
- iNdEx++
- keykey |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- var stringLenmapkey uint64
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowGenerated
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := dAtA[iNdEx]
- iNdEx++
- stringLenmapkey |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- intStringLenmapkey := int(stringLenmapkey)
- if intStringLenmapkey < 0 {
- return ErrInvalidLengthGenerated
- }
- postStringIndexmapkey := iNdEx + intStringLenmapkey
- if postStringIndexmapkey > l {
- return io.ErrUnexpectedEOF
- }
- mapkey := string(dAtA[iNdEx:postStringIndexmapkey])
- iNdEx = postStringIndexmapkey
- if m.AuditAnnotations == nil {
- m.AuditAnnotations = make(map[string]string)
- }
- if iNdEx < postIndex {
- var valuekey uint64
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowGenerated
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := dAtA[iNdEx]
- iNdEx++
- valuekey |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- var stringLenmapvalue uint64
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return ErrIntOverflowGenerated
- }
- if iNdEx >= l {
- return io.ErrUnexpectedEOF
- }
- b := dAtA[iNdEx]
- iNdEx++
- stringLenmapvalue |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- intStringLenmapvalue := int(stringLenmapvalue)
- if intStringLenmapvalue < 0 {
- return ErrInvalidLengthGenerated
- }
- postStringIndexmapvalue := iNdEx + intStringLenmapvalue
- if postStringIndexmapvalue > l {
- return io.ErrUnexpectedEOF
- }
- mapvalue := string(dAtA[iNdEx:postStringIndexmapvalue])
- iNdEx = postStringIndexmapvalue
- m.AuditAnnotations[mapkey] = mapvalue
- } else {
- var mapvalue string
- m.AuditAnnotations[mapkey] = mapvalue
- }
- iNdEx = postIndex
- default:
- iNdEx = preIndex
- skippy, err := skipGenerated(dAtA[iNdEx:])
- if err != nil {
- return err
- }
- if skippy < 0 {
- return ErrInvalidLengthGenerated
- }
- if (iNdEx + skippy) > l {
- return io.ErrUnexpectedEOF
- }
- iNdEx += skippy
- }
- }
-
- if iNdEx > l {
- return io.ErrUnexpectedEOF
- }
- return nil
-}
-func skipGenerated(dAtA []byte) (n int, err error) {
- l := len(dAtA)
- iNdEx := 0
- for iNdEx < l {
- var wire uint64
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return 0, ErrIntOverflowGenerated
- }
- if iNdEx >= l {
- return 0, io.ErrUnexpectedEOF
- }
- b := dAtA[iNdEx]
- iNdEx++
- wire |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- wireType := int(wire & 0x7)
- switch wireType {
- case 0:
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return 0, ErrIntOverflowGenerated
- }
- if iNdEx >= l {
- return 0, io.ErrUnexpectedEOF
- }
- iNdEx++
- if dAtA[iNdEx-1] < 0x80 {
- break
- }
- }
- return iNdEx, nil
- case 1:
- iNdEx += 8
- return iNdEx, nil
- case 2:
- var length int
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return 0, ErrIntOverflowGenerated
- }
- if iNdEx >= l {
- return 0, io.ErrUnexpectedEOF
- }
- b := dAtA[iNdEx]
- iNdEx++
- length |= (int(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- iNdEx += length
- if length < 0 {
- return 0, ErrInvalidLengthGenerated
- }
- return iNdEx, nil
- case 3:
- for {
- var innerWire uint64
- var start int = iNdEx
- for shift := uint(0); ; shift += 7 {
- if shift >= 64 {
- return 0, ErrIntOverflowGenerated
- }
- if iNdEx >= l {
- return 0, io.ErrUnexpectedEOF
- }
- b := dAtA[iNdEx]
- iNdEx++
- innerWire |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- break
- }
- }
- innerWireType := int(innerWire & 0x7)
- if innerWireType == 4 {
- break
- }
- next, err := skipGenerated(dAtA[start:])
- if err != nil {
- return 0, err
- }
- iNdEx = start + next
- }
- return iNdEx, nil
- case 4:
- return iNdEx, nil
- case 5:
- iNdEx += 4
- return iNdEx, nil
- default:
- return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
- }
- }
- panic("unreachable")
-}
-
-var (
- ErrInvalidLengthGenerated = fmt.Errorf("proto: negative length found during unmarshaling")
- ErrIntOverflowGenerated = fmt.Errorf("proto: integer overflow")
-)
-
-func init() {
- proto.RegisterFile("k8s.io/kubernetes/vendor/k8s.io/api/imagepolicy/v1alpha1/generated.proto", fileDescriptorGenerated)
-}
-
-var fileDescriptorGenerated = []byte{
- // 607 bytes of a gzipped FileDescriptorProto
- 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x92, 0xcf, 0x6e, 0xd3, 0x4c,
- 0x14, 0xc5, 0xe3, 0xa4, 0xff, 0x32, 0xf9, 0x3e, 0x9a, 0x0e, 0x20, 0x59, 0x59, 0xb8, 0x55, 0x90,
- 0x50, 0x59, 0x30, 0x43, 0x2b, 0x84, 0x0a, 0x0b, 0x50, 0x5c, 0x21, 0x95, 0x05, 0x20, 0x0d, 0xbb,
- 0xae, 0x98, 0x38, 0x17, 0xc7, 0x24, 0x9e, 0xb1, 0x3c, 0xe3, 0x94, 0xec, 0x78, 0x02, 0xc4, 0x1b,
- 0xf0, 0x22, 0x3c, 0x40, 0x97, 0x5d, 0x76, 0x55, 0x51, 0xb3, 0xe4, 0x25, 0x90, 0xc7, 0x4e, 0x6c,
- 0x92, 0x22, 0x94, 0x9d, 0xef, 0xbd, 0x73, 0x7e, 0xf7, 0xcc, 0xf1, 0xa0, 0x93, 0xd1, 0x91, 0x22,
- 0x81, 0xa4, 0xa3, 0xa4, 0x0f, 0xb1, 0x00, 0x0d, 0x8a, 0x4e, 0x40, 0x0c, 0x64, 0x4c, 0x8b, 0x01,
- 0x8f, 0x02, 0x1a, 0x84, 0xdc, 0x87, 0x48, 0x8e, 0x03, 0x6f, 0x4a, 0x27, 0x07, 0x7c, 0x1c, 0x0d,
- 0xf9, 0x01, 0xf5, 0x41, 0x40, 0xcc, 0x35, 0x0c, 0x48, 0x14, 0x4b, 0x2d, 0xf1, 0x6e, 0x2e, 0x20,
- 0x3c, 0x0a, 0x48, 0x45, 0x40, 0x66, 0x82, 0xce, 0x43, 0x3f, 0xd0, 0xc3, 0xa4, 0x4f, 0x3c, 0x19,
- 0x52, 0x5f, 0xfa, 0x92, 0x1a, 0x5d, 0x3f, 0xf9, 0x60, 0x2a, 0x53, 0x98, 0xaf, 0x9c, 0xd7, 0x79,
- 0x5c, 0x1a, 0x08, 0xb9, 0x37, 0x0c, 0x04, 0xc4, 0x53, 0x1a, 0x8d, 0xfc, 0xac, 0xa1, 0x68, 0x08,
- 0x9a, 0xd3, 0xc9, 0x92, 0x8b, 0x0e, 0xfd, 0x9b, 0x2a, 0x4e, 0x84, 0x0e, 0x42, 0x58, 0x12, 0x3c,
- 0xf9, 0x97, 0x40, 0x79, 0x43, 0x08, 0xf9, 0xa2, 0xae, 0xfb, 0xad, 0x8e, 0x5a, 0xaf, 0xb2, 0x6b,
- 0x32, 0x98, 0x04, 0x70, 0x86, 0xdf, 0xa3, 0xad, 0xcc, 0xd3, 0x80, 0x6b, 0x6e, 0x5b, 0x7b, 0xd6,
- 0x7e, 0xeb, 0xf0, 0x11, 0x29, 0x13, 0x99, 0xa3, 0x49, 0x34, 0xf2, 0xb3, 0x86, 0x22, 0xd9, 0x69,
- 0x32, 0x39, 0x20, 0x6f, 0xfb, 0x1f, 0xc1, 0xd3, 0xaf, 0x41, 0x73, 0x17, 0x9f, 0x5f, 0xed, 0xd6,
- 0xd2, 0xab, 0x5d, 0x54, 0xf6, 0xd8, 0x9c, 0x8a, 0x19, 0x5a, 0x53, 0x11, 0x78, 0x76, 0x7d, 0x89,
- 0x7e, 0x63, 0xde, 0xa4, 0xe2, 0xee, 0x5d, 0x04, 0x9e, 0xfb, 0x5f, 0x41, 0x5f, 0xcb, 0x2a, 0x66,
- 0x58, 0xf8, 0x14, 0x6d, 0x28, 0xcd, 0x75, 0xa2, 0xec, 0x86, 0xa1, 0x1e, 0xae, 0x44, 0x35, 0x4a,
- 0xf7, 0x56, 0xc1, 0xdd, 0xc8, 0x6b, 0x56, 0x10, 0xbb, 0x2f, 0x90, 0x5d, 0x39, 0x7c, 0x2c, 0x85,
- 0xe6, 0x59, 0x04, 0xd9, 0x76, 0x7c, 0x0f, 0xad, 0x1b, 0xba, 0x89, 0xaa, 0xe9, 0xfe, 0x5f, 0x20,
- 0xd6, 0x73, 0x41, 0x3e, 0xeb, 0xfe, 0xaa, 0xa3, 0xed, 0x85, 0x4b, 0xe0, 0x10, 0x21, 0x6f, 0x46,
- 0x52, 0xb6, 0xb5, 0xd7, 0xd8, 0x6f, 0x1d, 0x3e, 0x5d, 0xc5, 0xf4, 0x1f, 0x3e, 0xca, 0xc4, 0xe7,
- 0x6d, 0xc5, 0x2a, 0x0b, 0xf0, 0x27, 0xd4, 0xe2, 0x42, 0x48, 0xcd, 0x75, 0x20, 0x85, 0xb2, 0xeb,
- 0x66, 0x5f, 0x6f, 0xd5, 0xe8, 0x49, 0xaf, 0x64, 0xbc, 0x14, 0x3a, 0x9e, 0xba, 0xb7, 0x8b, 0xbd,
- 0xad, 0xca, 0x84, 0x55, 0x57, 0x61, 0x8a, 0x9a, 0x82, 0x87, 0xa0, 0x22, 0xee, 0x81, 0xf9, 0x39,
- 0x4d, 0x77, 0xa7, 0x10, 0x35, 0xdf, 0xcc, 0x06, 0xac, 0x3c, 0xd3, 0x79, 0x8e, 0xda, 0x8b, 0x6b,
- 0x70, 0x1b, 0x35, 0x46, 0x30, 0xcd, 0x43, 0x66, 0xd9, 0x27, 0xbe, 0x83, 0xd6, 0x27, 0x7c, 0x9c,
- 0x80, 0x79, 0x45, 0x4d, 0x96, 0x17, 0xcf, 0xea, 0x47, 0x56, 0xf7, 0x7b, 0x1d, 0xed, 0x2c, 0xfd,
- 0x5c, 0xfc, 0x00, 0x6d, 0xf2, 0xf1, 0x58, 0x9e, 0xc1, 0xc0, 0x50, 0xb6, 0xdc, 0xed, 0xc2, 0xc4,
- 0x66, 0x2f, 0x6f, 0xb3, 0xd9, 0x1c, 0xdf, 0x47, 0x1b, 0x31, 0x70, 0x25, 0x45, 0xce, 0x2e, 0xdf,
- 0x05, 0x33, 0x5d, 0x56, 0x4c, 0xf1, 0x17, 0x0b, 0xb5, 0x79, 0x32, 0x08, 0x74, 0xc5, 0xae, 0xdd,
- 0x30, 0xc9, 0x9e, 0xac, 0xfe, 0xfc, 0x48, 0x6f, 0x01, 0x95, 0x07, 0x6c, 0x17, 0xcb, 0xdb, 0x8b,
- 0x63, 0xb6, 0xb4, 0xbb, 0x73, 0x8c, 0xee, 0xde, 0x08, 0x59, 0x25, 0x3e, 0x97, 0x9c, 0x5f, 0x3b,
- 0xb5, 0x8b, 0x6b, 0xa7, 0x76, 0x79, 0xed, 0xd4, 0x3e, 0xa7, 0x8e, 0x75, 0x9e, 0x3a, 0xd6, 0x45,
- 0xea, 0x58, 0x97, 0xa9, 0x63, 0xfd, 0x48, 0x1d, 0xeb, 0xeb, 0x4f, 0xa7, 0x76, 0xba, 0x35, 0xbb,
- 0xc8, 0xef, 0x00, 0x00, 0x00, 0xff, 0xff, 0x44, 0x16, 0x48, 0xa2, 0x79, 0x05, 0x00, 0x00,
-}
diff --git a/vendor/k8s.io/api/imagepolicy/v1alpha1/generated.proto b/vendor/k8s.io/api/imagepolicy/v1alpha1/generated.proto
deleted file mode 100644
index 381d0091bd..0000000000
--- a/vendor/k8s.io/api/imagepolicy/v1alpha1/generated.proto
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
-Copyright 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
-
-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.
-*/
-
-
-// This file was autogenerated by go-to-protobuf. Do not edit it manually!
-
-syntax = 'proto2';
-
-package k8s.io.api.imagepolicy.v1alpha1;
-
-import "k8s.io/apimachinery/pkg/apis/meta/v1/generated.proto";
-import "k8s.io/apimachinery/pkg/runtime/generated.proto";
-import "k8s.io/apimachinery/pkg/runtime/schema/generated.proto";
-
-// Package-wide variables from generator "generated".
-option go_package = "v1alpha1";
-
-// ImageReview checks if the set of images in a pod are allowed.
-message ImageReview {
- // +optional
- optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1;
-
- // Spec holds information about the pod being evaluated
- optional ImageReviewSpec spec = 2;
-
- // Status is filled in by the backend and indicates whether the pod should be allowed.
- // +optional
- optional ImageReviewStatus status = 3;
-}
-
-// ImageReviewContainerSpec is a description of a container within the pod creation request.
-message ImageReviewContainerSpec {
- // This can be in the form image:tag or image@SHA:012345679abcdef.
- // +optional
- optional string image = 1;
-}
-
-// ImageReviewSpec is a description of the pod creation request.
-message ImageReviewSpec {
- // Containers is a list of a subset of the information in each container of the Pod being created.
- // +optional
- repeated ImageReviewContainerSpec containers = 1;
-
- // Annotations is a list of key-value pairs extracted from the Pod's annotations.
- // It only includes keys which match the pattern `*.image-policy.k8s.io/*`.
- // It is up to each webhook backend to determine how to interpret these annotations, if at all.
- // +optional
- map annotations = 2;
-
- // Namespace is the namespace the pod is being created in.
- // +optional
- optional string namespace = 3;
-}
-
-// ImageReviewStatus is the result of the review for the pod creation request.
-message ImageReviewStatus {
- // Allowed indicates that all images were allowed to be run.
- optional bool allowed = 1;
-
- // Reason should be empty unless Allowed is false in which case it
- // may contain a short description of what is wrong. Kubernetes
- // may truncate excessively long errors when displaying to the user.
- // +optional
- optional string reason = 2;
-
- // AuditAnnotations will be added to the attributes object of the
- // admission controller request using 'AddAnnotation'. The keys should
- // be prefix-less (i.e., the admission controller will add an
- // appropriate prefix).
- // +optional
- map auditAnnotations = 3;
-}
-
diff --git a/vendor/k8s.io/api/imagepolicy/v1alpha1/register.go b/vendor/k8s.io/api/imagepolicy/v1alpha1/register.go
deleted file mode 100644
index 477571bbb2..0000000000
--- a/vendor/k8s.io/api/imagepolicy/v1alpha1/register.go
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
-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
-
-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.
-*/
-
-package v1alpha1
-
-import (
- metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
- "k8s.io/apimachinery/pkg/runtime"
- "k8s.io/apimachinery/pkg/runtime/schema"
-)
-
-// GroupName is the group name for this API.
-const GroupName = "imagepolicy.k8s.io"
-
-// SchemeGroupVersion is group version used to register these objects
-var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1alpha1"}
-
-// Resource takes an unqualified resource and returns a Group qualified GroupResource
-func Resource(resource string) schema.GroupResource {
- return SchemeGroupVersion.WithResource(resource).GroupResource()
-}
-
-var (
- // TODO: move SchemeBuilder with zz_generated.deepcopy.go to k8s.io/api.
- // localSchemeBuilder and AddToScheme will stay in k8s.io/kubernetes.
- SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes)
- localSchemeBuilder = &SchemeBuilder
- AddToScheme = localSchemeBuilder.AddToScheme
-)
-
-// Adds the list of known types to the given scheme.
-func addKnownTypes(scheme *runtime.Scheme) error {
- scheme.AddKnownTypes(SchemeGroupVersion,
- &ImageReview{},
- )
- metav1.AddToGroupVersion(scheme, SchemeGroupVersion)
- return nil
-}
diff --git a/vendor/k8s.io/api/imagepolicy/v1alpha1/types.go b/vendor/k8s.io/api/imagepolicy/v1alpha1/types.go
deleted file mode 100644
index fd689e638d..0000000000
--- a/vendor/k8s.io/api/imagepolicy/v1alpha1/types.go
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
-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
-
-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.
-*/
-
-package v1alpha1
-
-import (
- metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
-)
-
-// +genclient
-// +genclient:nonNamespaced
-// +genclient:noVerbs
-// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
-
-// ImageReview checks if the set of images in a pod are allowed.
-type ImageReview struct {
- metav1.TypeMeta `json:",inline"`
- // +optional
- metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
-
- // Spec holds information about the pod being evaluated
- Spec ImageReviewSpec `json:"spec" protobuf:"bytes,2,opt,name=spec"`
-
- // Status is filled in by the backend and indicates whether the pod should be allowed.
- // +optional
- Status ImageReviewStatus `json:"status,omitempty" protobuf:"bytes,3,opt,name=status"`
-}
-
-// ImageReviewSpec is a description of the pod creation request.
-type ImageReviewSpec struct {
- // Containers is a list of a subset of the information in each container of the Pod being created.
- // +optional
- Containers []ImageReviewContainerSpec `json:"containers,omitempty" protobuf:"bytes,1,rep,name=containers"`
- // Annotations is a list of key-value pairs extracted from the Pod's annotations.
- // It only includes keys which match the pattern `*.image-policy.k8s.io/*`.
- // It is up to each webhook backend to determine how to interpret these annotations, if at all.
- // +optional
- Annotations map[string]string `json:"annotations,omitempty" protobuf:"bytes,2,rep,name=annotations"`
- // Namespace is the namespace the pod is being created in.
- // +optional
- Namespace string `json:"namespace,omitempty" protobuf:"bytes,3,opt,name=namespace"`
-}
-
-// ImageReviewContainerSpec is a description of a container within the pod creation request.
-type ImageReviewContainerSpec struct {
- // This can be in the form image:tag or image@SHA:012345679abcdef.
- // +optional
- Image string `json:"image,omitempty" protobuf:"bytes,1,opt,name=image"`
- // In future, we may add command line overrides, exec health check command lines, and so on.
-}
-
-// ImageReviewStatus is the result of the review for the pod creation request.
-type ImageReviewStatus struct {
- // Allowed indicates that all images were allowed to be run.
- Allowed bool `json:"allowed" protobuf:"varint,1,opt,name=allowed"`
- // Reason should be empty unless Allowed is false in which case it
- // may contain a short description of what is wrong. Kubernetes
- // may truncate excessively long errors when displaying to the user.
- // +optional
- Reason string `json:"reason,omitempty" protobuf:"bytes,2,opt,name=reason"`
- // AuditAnnotations will be added to the attributes object of the
- // admission controller request using 'AddAnnotation'. The keys should
- // be prefix-less (i.e., the admission controller will add an
- // appropriate prefix).
- // +optional
- AuditAnnotations map[string]string `json:"auditAnnotations,omitempty" protobuf:"bytes,3,rep,name=auditAnnotations"`
-}
diff --git a/vendor/k8s.io/api/imagepolicy/v1alpha1/types_swagger_doc_generated.go b/vendor/k8s.io/api/imagepolicy/v1alpha1/types_swagger_doc_generated.go
deleted file mode 100644
index 0211d94af0..0000000000
--- a/vendor/k8s.io/api/imagepolicy/v1alpha1/types_swagger_doc_generated.go
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
-Copyright 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
-
-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.
-*/
-
-package v1alpha1
-
-// This file contains a collection of methods that can be used from go-restful to
-// generate Swagger API documentation for its models. Please read this PR for more
-// information on the implementation: https://github.com/emicklei/go-restful/pull/215
-//
-// TODOs are ignored from the parser (e.g. TODO(andronat):... || TODO:...) if and only if
-// they are on one line! For multiple line or blocks that you want to ignore use ---.
-// Any context after a --- is ignored.
-//
-// Those methods can be generated by using hack/update-generated-swagger-docs.sh
-
-// AUTO-GENERATED FUNCTIONS START HERE. DO NOT EDIT.
-var map_ImageReview = map[string]string{
- "": "ImageReview checks if the set of images in a pod are allowed.",
- "spec": "Spec holds information about the pod being evaluated",
- "status": "Status is filled in by the backend and indicates whether the pod should be allowed.",
-}
-
-func (ImageReview) SwaggerDoc() map[string]string {
- return map_ImageReview
-}
-
-var map_ImageReviewContainerSpec = map[string]string{
- "": "ImageReviewContainerSpec is a description of a container within the pod creation request.",
- "image": "This can be in the form image:tag or image@SHA:012345679abcdef.",
-}
-
-func (ImageReviewContainerSpec) SwaggerDoc() map[string]string {
- return map_ImageReviewContainerSpec
-}
-
-var map_ImageReviewSpec = map[string]string{
- "": "ImageReviewSpec is a description of the pod creation request.",
- "containers": "Containers is a list of a subset of the information in each container of the Pod being created.",
- "annotations": "Annotations is a list of key-value pairs extracted from the Pod's annotations. It only includes keys which match the pattern `*.image-policy.k8s.io/*`. It is up to each webhook backend to determine how to interpret these annotations, if at all.",
- "namespace": "Namespace is the namespace the pod is being created in.",
-}
-
-func (ImageReviewSpec) SwaggerDoc() map[string]string {
- return map_ImageReviewSpec
-}
-
-var map_ImageReviewStatus = map[string]string{
- "": "ImageReviewStatus is the result of the review for the pod creation request.",
- "allowed": "Allowed indicates that all images were allowed to be run.",
- "reason": "Reason should be empty unless Allowed is false in which case it may contain a short description of what is wrong. Kubernetes may truncate excessively long errors when displaying to the user.",
- "auditAnnotations": "AuditAnnotations will be added to the attributes object of the admission controller request using 'AddAnnotation'. The keys should be prefix-less (i.e., the admission controller will add an appropriate prefix).",
-}
-
-func (ImageReviewStatus) SwaggerDoc() map[string]string {
- return map_ImageReviewStatus
-}
-
-// AUTO-GENERATED FUNCTIONS END HERE
diff --git a/vendor/k8s.io/api/imagepolicy/v1alpha1/zz_generated.deepcopy.go b/vendor/k8s.io/api/imagepolicy/v1alpha1/zz_generated.deepcopy.go
deleted file mode 100644
index 83d47b7919..0000000000
--- a/vendor/k8s.io/api/imagepolicy/v1alpha1/zz_generated.deepcopy.go
+++ /dev/null
@@ -1,120 +0,0 @@
-// +build !ignore_autogenerated
-
-/*
-Copyright 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
-
-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.
-*/
-
-// Code generated by deepcopy-gen. DO NOT EDIT.
-
-package v1alpha1
-
-import (
- runtime "k8s.io/apimachinery/pkg/runtime"
-)
-
-// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
-func (in *ImageReview) DeepCopyInto(out *ImageReview) {
- *out = *in
- out.TypeMeta = in.TypeMeta
- in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
- in.Spec.DeepCopyInto(&out.Spec)
- in.Status.DeepCopyInto(&out.Status)
- return
-}
-
-// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ImageReview.
-func (in *ImageReview) DeepCopy() *ImageReview {
- if in == nil {
- return nil
- }
- out := new(ImageReview)
- in.DeepCopyInto(out)
- return out
-}
-
-// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
-func (in *ImageReview) DeepCopyObject() runtime.Object {
- if c := in.DeepCopy(); c != nil {
- return c
- }
- return nil
-}
-
-// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
-func (in *ImageReviewContainerSpec) DeepCopyInto(out *ImageReviewContainerSpec) {
- *out = *in
- return
-}
-
-// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ImageReviewContainerSpec.
-func (in *ImageReviewContainerSpec) DeepCopy() *ImageReviewContainerSpec {
- if in == nil {
- return nil
- }
- out := new(ImageReviewContainerSpec)
- in.DeepCopyInto(out)
- return out
-}
-
-// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
-func (in *ImageReviewSpec) DeepCopyInto(out *ImageReviewSpec) {
- *out = *in
- if in.Containers != nil {
- in, out := &in.Containers, &out.Containers
- *out = make([]ImageReviewContainerSpec, len(*in))
- copy(*out, *in)
- }
- if in.Annotations != nil {
- in, out := &in.Annotations, &out.Annotations
- *out = make(map[string]string, len(*in))
- for key, val := range *in {
- (*out)[key] = val
- }
- }
- return
-}
-
-// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ImageReviewSpec.
-func (in *ImageReviewSpec) DeepCopy() *ImageReviewSpec {
- if in == nil {
- return nil
- }
- out := new(ImageReviewSpec)
- in.DeepCopyInto(out)
- return out
-}
-
-// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
-func (in *ImageReviewStatus) DeepCopyInto(out *ImageReviewStatus) {
- *out = *in
- if in.AuditAnnotations != nil {
- in, out := &in.AuditAnnotations, &out.AuditAnnotations
- *out = make(map[string]string, len(*in))
- for key, val := range *in {
- (*out)[key] = val
- }
- }
- return
-}
-
-// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ImageReviewStatus.
-func (in *ImageReviewStatus) DeepCopy() *ImageReviewStatus {
- if in == nil {
- return nil
- }
- out := new(ImageReviewStatus)
- in.DeepCopyInto(out)
- return out
-}
diff --git a/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured/unstructuredscheme/scheme.go b/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured/unstructuredscheme/scheme.go
deleted file mode 100644
index ab2574e828..0000000000
--- a/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured/unstructuredscheme/scheme.go
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
-Copyright 2018 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
-
-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.
-*/
-
-package unstructuredscheme
-
-import (
- "fmt"
-
- "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
- "k8s.io/apimachinery/pkg/runtime"
- "k8s.io/apimachinery/pkg/runtime/schema"
- "k8s.io/apimachinery/pkg/runtime/serializer"
- "k8s.io/apimachinery/pkg/runtime/serializer/json"
- "k8s.io/apimachinery/pkg/runtime/serializer/versioning"
-)
-
-var (
- scheme = runtime.NewScheme()
- codecs = serializer.NewCodecFactory(scheme)
-)
-
-// NewUnstructuredNegotiatedSerializer returns a simple, negotiated serializer
-func NewUnstructuredNegotiatedSerializer() runtime.NegotiatedSerializer {
- return unstructuredNegotiatedSerializer{
- scheme: scheme,
- typer: NewUnstructuredObjectTyper(),
- creator: NewUnstructuredCreator(),
- }
-}
-
-type unstructuredNegotiatedSerializer struct {
- scheme *runtime.Scheme
- typer runtime.ObjectTyper
- creator runtime.ObjectCreater
-}
-
-func (s unstructuredNegotiatedSerializer) SupportedMediaTypes() []runtime.SerializerInfo {
- return []runtime.SerializerInfo{
- {
- MediaType: "application/json",
- EncodesAsText: true,
- Serializer: json.NewSerializer(json.DefaultMetaFactory, s.creator, s.typer, false),
- PrettySerializer: json.NewSerializer(json.DefaultMetaFactory, s.creator, s.typer, true),
- StreamSerializer: &runtime.StreamSerializerInfo{
- EncodesAsText: true,
- Serializer: json.NewSerializer(json.DefaultMetaFactory, s.creator, s.typer, false),
- Framer: json.Framer,
- },
- },
- {
- MediaType: "application/yaml",
- EncodesAsText: true,
- Serializer: json.NewYAMLSerializer(json.DefaultMetaFactory, s.creator, s.typer),
- },
- }
-}
-
-func (s unstructuredNegotiatedSerializer) EncoderForVersion(encoder runtime.Encoder, gv runtime.GroupVersioner) runtime.Encoder {
- return versioning.NewDefaultingCodecForScheme(s.scheme, encoder, nil, gv, nil)
-}
-
-func (s unstructuredNegotiatedSerializer) DecoderToVersion(decoder runtime.Decoder, gv runtime.GroupVersioner) runtime.Decoder {
- return versioning.NewDefaultingCodecForScheme(s.scheme, nil, decoder, nil, gv)
-}
-
-type unstructuredObjectTyper struct {
-}
-
-// NewUnstructuredObjectTyper returns an object typer that can deal with unstructured things
-func NewUnstructuredObjectTyper() runtime.ObjectTyper {
- return unstructuredObjectTyper{}
-}
-
-func (t unstructuredObjectTyper) ObjectKinds(obj runtime.Object) ([]schema.GroupVersionKind, bool, error) {
- // Delegate for things other than Unstructured.
- if _, ok := obj.(runtime.Unstructured); !ok {
- return nil, false, fmt.Errorf("cannot type %T", obj)
- }
- gvk := obj.GetObjectKind().GroupVersionKind()
- if len(gvk.Kind) == 0 {
- return nil, false, runtime.NewMissingKindErr("object has no kind field ")
- }
- if len(gvk.Version) == 0 {
- return nil, false, runtime.NewMissingVersionErr("object has no apiVersion field")
- }
-
- return []schema.GroupVersionKind{obj.GetObjectKind().GroupVersionKind()}, false, nil
-}
-
-func (t unstructuredObjectTyper) Recognizes(gvk schema.GroupVersionKind) bool {
- return true
-}
-
-type unstructuredCreator struct{}
-
-// NewUnstructuredCreator returns a simple object creator that always returns an unstructured
-func NewUnstructuredCreator() runtime.ObjectCreater {
- return unstructuredCreator{}
-}
-
-func (c unstructuredCreator) New(kind schema.GroupVersionKind) (runtime.Object, error) {
- ret := &unstructured.Unstructured{}
- ret.SetGroupVersionKind(kind)
- return ret, nil
-}
-
-type unstructuredDefaulter struct {
-}
-
-// NewUnstructuredDefaulter returns defaulter suitable for unstructured types that doesn't default anything
-func NewUnstructuredDefaulter() runtime.ObjectDefaulter {
- return unstructuredDefaulter{}
-}
-
-func (d unstructuredDefaulter) Default(in runtime.Object) {
-}
diff --git a/vendor/k8s.io/cli-runtime/LICENSE b/vendor/k8s.io/cli-runtime/LICENSE
deleted file mode 100644
index d645695673..0000000000
--- a/vendor/k8s.io/cli-runtime/LICENSE
+++ /dev/null
@@ -1,202 +0,0 @@
-
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- 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.
diff --git a/vendor/k8s.io/cli-runtime/pkg/genericclioptions/builder_flags.go b/vendor/k8s.io/cli-runtime/pkg/genericclioptions/builder_flags.go
deleted file mode 100644
index f6686edd49..0000000000
--- a/vendor/k8s.io/cli-runtime/pkg/genericclioptions/builder_flags.go
+++ /dev/null
@@ -1,234 +0,0 @@
-/*
-Copyright 2018 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
-
-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.
-*/
-
-package genericclioptions
-
-import (
- "github.com/spf13/pflag"
-
- "k8s.io/apimachinery/pkg/runtime"
- "k8s.io/cli-runtime/pkg/genericclioptions/resource"
-)
-
-// ResourceBuilderFlags are flags for finding resources
-// TODO(juanvallejo): wire --local flag from commands through
-type ResourceBuilderFlags struct {
- FileNameFlags *FileNameFlags
-
- LabelSelector *string
- FieldSelector *string
- AllNamespaces *bool
- All *bool
- Local *bool
- IncludeUninitialized *bool
-
- Scheme *runtime.Scheme
- Latest bool
- StopOnFirstError bool
-}
-
-// NewResourceBuilderFlags returns a default ResourceBuilderFlags
-func NewResourceBuilderFlags() *ResourceBuilderFlags {
- filenames := []string{}
-
- return &ResourceBuilderFlags{
- FileNameFlags: &FileNameFlags{
- Usage: "identifying the resource.",
- Filenames: &filenames,
- Recursive: boolPtr(true),
- },
- }
-}
-
-func (o *ResourceBuilderFlags) WithFile(recurse bool, files ...string) *ResourceBuilderFlags {
- o.FileNameFlags = &FileNameFlags{
- Usage: "identifying the resource.",
- Filenames: &files,
- Recursive: boolPtr(recurse),
- }
-
- return o
-}
-
-func (o *ResourceBuilderFlags) WithLabelSelector(selector string) *ResourceBuilderFlags {
- o.LabelSelector = &selector
- return o
-}
-
-func (o *ResourceBuilderFlags) WithFieldSelector(selector string) *ResourceBuilderFlags {
- o.FieldSelector = &selector
- return o
-}
-
-func (o *ResourceBuilderFlags) WithAllNamespaces(defaultVal bool) *ResourceBuilderFlags {
- o.AllNamespaces = &defaultVal
- return o
-}
-
-func (o *ResourceBuilderFlags) WithAll(defaultVal bool) *ResourceBuilderFlags {
- o.All = &defaultVal
- return o
-}
-
-func (o *ResourceBuilderFlags) WithLocal(defaultVal bool) *ResourceBuilderFlags {
- o.Local = &defaultVal
- return o
-}
-
-// WithUninitialized is using an alpha feature and may be dropped
-func (o *ResourceBuilderFlags) WithUninitialized(defaultVal bool) *ResourceBuilderFlags {
- o.IncludeUninitialized = &defaultVal
- return o
-}
-
-func (o *ResourceBuilderFlags) WithScheme(scheme *runtime.Scheme) *ResourceBuilderFlags {
- o.Scheme = scheme
- return o
-}
-
-func (o *ResourceBuilderFlags) WithLatest() *ResourceBuilderFlags {
- o.Latest = true
- return o
-}
-
-func (o *ResourceBuilderFlags) StopOnError() *ResourceBuilderFlags {
- o.StopOnFirstError = true
- return o
-}
-
-// AddFlags registers flags for finding resources
-func (o *ResourceBuilderFlags) AddFlags(flagset *pflag.FlagSet) {
- o.FileNameFlags.AddFlags(flagset)
-
- if o.LabelSelector != nil {
- flagset.StringVarP(o.LabelSelector, "selector", "l", *o.LabelSelector, "Selector (label query) to filter on, supports '=', '==', and '!='.(e.g. -l key1=value1,key2=value2)")
- }
- if o.FieldSelector != nil {
- flagset.StringVar(o.FieldSelector, "field-selector", *o.FieldSelector, "Selector (field query) to filter on, supports '=', '==', and '!='.(e.g. --field-selector key1=value1,key2=value2). The server only supports a limited number of field queries per type.")
- }
- if o.AllNamespaces != nil {
- flagset.BoolVar(o.AllNamespaces, "all-namespaces", *o.AllNamespaces, "If present, list the requested object(s) across all namespaces. Namespace in current context is ignored even if specified with --namespace.")
- }
- if o.All != nil {
- flagset.BoolVar(o.All, "all", *o.All, "Select all resources in the namespace of the specified resource types")
- }
- if o.Local != nil {
- flagset.BoolVar(o.Local, "local", *o.Local, "If true, annotation will NOT contact api-server but run locally.")
- }
- if o.IncludeUninitialized != nil {
- flagset.BoolVar(o.IncludeUninitialized, "include-uninitialized", *o.IncludeUninitialized, `If true, the kubectl command applies to uninitialized objects. If explicitly set to false, this flag overrides other flags that make the kubectl commands apply to uninitialized objects, e.g., "--all". Objects with empty metadata.initializers are regarded as initialized.`)
- }
-}
-
-// ToBuilder gives you back a resource finder to visit resources that are located
-func (o *ResourceBuilderFlags) ToBuilder(restClientGetter RESTClientGetter, resources []string) ResourceFinder {
- namespace, enforceNamespace, namespaceErr := restClientGetter.ToRawKubeConfigLoader().Namespace()
-
- builder := resource.NewBuilder(restClientGetter).
- NamespaceParam(namespace).DefaultNamespace()
-
- if o.Scheme != nil {
- builder.WithScheme(o.Scheme, o.Scheme.PrioritizedVersionsAllGroups()...)
- } else {
- builder.Unstructured()
- }
-
- if o.FileNameFlags != nil {
- opts := o.FileNameFlags.ToOptions()
- builder.FilenameParam(enforceNamespace, &opts)
- }
-
- if o.Local == nil || !*o.Local {
- // resource type/name tuples only work non-local
- if o.All != nil {
- builder.ResourceTypeOrNameArgs(*o.All, resources...)
- } else {
- builder.ResourceTypeOrNameArgs(false, resources...)
- }
- // label selectors only work non-local (for now)
- if o.LabelSelector != nil {
- builder.LabelSelectorParam(*o.LabelSelector)
- }
- // field selectors only work non-local (forever)
- if o.FieldSelector != nil {
- builder.FieldSelectorParam(*o.FieldSelector)
- }
- // latest only works non-local (forever)
- if o.Latest {
- builder.Latest()
- }
-
- } else {
- builder.Local()
-
- if len(resources) > 0 {
- builder.AddError(resource.LocalResourceError)
- }
- }
-
- if o.IncludeUninitialized != nil {
- builder.IncludeUninitialized(*o.IncludeUninitialized)
- }
-
- if !o.StopOnFirstError {
- builder.ContinueOnError()
- }
-
- return &ResourceFindBuilderWrapper{
- builder: builder.
- Flatten(). // I think we're going to recommend this everywhere
- AddError(namespaceErr),
- }
-}
-
-// ResourceFindBuilderWrapper wraps a builder in an interface
-type ResourceFindBuilderWrapper struct {
- builder *resource.Builder
-}
-
-// Do finds you resources to check
-func (b *ResourceFindBuilderWrapper) Do() resource.Visitor {
- return b.builder.Do()
-}
-
-// ResourceFinder allows mocking the resource builder
-// TODO resource builders needs to become more interfacey
-type ResourceFinder interface {
- Do() resource.Visitor
-}
-
-// ResourceFinderFunc is a handy way to make a ResourceFinder
-type ResourceFinderFunc func() resource.Visitor
-
-// Do implements ResourceFinder
-func (fn ResourceFinderFunc) Do() resource.Visitor {
- return fn()
-}
-
-// ResourceFinderForResult skins a visitor for re-use as a ResourceFinder
-func ResourceFinderForResult(result resource.Visitor) ResourceFinder {
- return ResourceFinderFunc(func() resource.Visitor {
- return result
- })
-}
-
-func strPtr(val string) *string {
- return &val
-}
-
-func boolPtr(val bool) *bool {
- return &val
-}
diff --git a/vendor/k8s.io/cli-runtime/pkg/genericclioptions/builder_flags_fake.go b/vendor/k8s.io/cli-runtime/pkg/genericclioptions/builder_flags_fake.go
deleted file mode 100644
index ca87d1e4c5..0000000000
--- a/vendor/k8s.io/cli-runtime/pkg/genericclioptions/builder_flags_fake.go
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
-Copyright 2018 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
-
-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.
-*/
-
-package genericclioptions
-
-import (
- "k8s.io/cli-runtime/pkg/genericclioptions/resource"
-)
-
-// NewSimpleResourceFinder builds a super simple ResourceFinder that just iterates over the objects you provided
-func NewSimpleFakeResourceFinder(infos ...*resource.Info) ResourceFinder {
- return &fakeResourceFinder{
- Infos: infos,
- }
-}
-
-type fakeResourceFinder struct {
- Infos []*resource.Info
-}
-
-// Do implements the interface
-func (f *fakeResourceFinder) Do() resource.Visitor {
- return &fakeResourceResult{
- Infos: f.Infos,
- }
-}
-
-type fakeResourceResult struct {
- Infos []*resource.Info
-}
-
-// Visit just iterates over info
-func (r *fakeResourceResult) Visit(fn resource.VisitorFunc) error {
- for _, info := range r.Infos {
- err := fn(info, nil)
- if err != nil {
- return err
- }
- }
- return nil
-}
diff --git a/vendor/k8s.io/cli-runtime/pkg/genericclioptions/config_flags.go b/vendor/k8s.io/cli-runtime/pkg/genericclioptions/config_flags.go
deleted file mode 100644
index e32e1eee77..0000000000
--- a/vendor/k8s.io/cli-runtime/pkg/genericclioptions/config_flags.go
+++ /dev/null
@@ -1,326 +0,0 @@
-/*
-Copyright 2018 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
-
-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.
-*/
-
-package genericclioptions
-
-import (
- "os"
- "path/filepath"
- "regexp"
- "strings"
- "time"
-
- "github.com/spf13/pflag"
-
- "k8s.io/apimachinery/pkg/api/meta"
- "k8s.io/client-go/discovery"
- "k8s.io/client-go/rest"
- "k8s.io/client-go/restmapper"
- "k8s.io/client-go/tools/clientcmd"
- "k8s.io/client-go/util/homedir"
-)
-
-const (
- flagClusterName = "cluster"
- flagAuthInfoName = "user"
- flagContext = "context"
- flagNamespace = "namespace"
- flagAPIServer = "server"
- flagInsecure = "insecure-skip-tls-verify"
- flagCertFile = "client-certificate"
- flagKeyFile = "client-key"
- flagCAFile = "certificate-authority"
- flagBearerToken = "token"
- flagImpersonate = "as"
- flagImpersonateGroup = "as-group"
- flagUsername = "username"
- flagPassword = "password"
- flagTimeout = "request-timeout"
- flagHTTPCacheDir = "cache-dir"
-)
-
-var defaultCacheDir = filepath.Join(homedir.HomeDir(), ".kube", "http-cache")
-
-// RESTClientGetter is an interface that the ConfigFlags describe to provide an easier way to mock for commands
-// and eliminate the direct coupling to a struct type. Users may wish to duplicate this type in their own packages
-// as per the golang type overlapping.
-type RESTClientGetter interface {
- // ToRESTConfig returns restconfig
- ToRESTConfig() (*rest.Config, error)
- // ToDiscoveryClient returns discovery client
- ToDiscoveryClient() (discovery.CachedDiscoveryInterface, error)
- // ToRESTMapper returns a restmapper
- ToRESTMapper() (meta.RESTMapper, error)
- // ToRawKubeConfigLoader return kubeconfig loader as-is
- ToRawKubeConfigLoader() clientcmd.ClientConfig
-}
-
-var _ RESTClientGetter = &ConfigFlags{}
-
-// ConfigFlags composes the set of values necessary
-// for obtaining a REST client config
-type ConfigFlags struct {
- CacheDir *string
- KubeConfig *string
-
- // config flags
- ClusterName *string
- AuthInfoName *string
- Context *string
- Namespace *string
- APIServer *string
- Insecure *bool
- CertFile *string
- KeyFile *string
- CAFile *string
- BearerToken *string
- Impersonate *string
- ImpersonateGroup *[]string
- Username *string
- Password *string
- Timeout *string
-}
-
-// ToRESTConfig implements RESTClientGetter.
-// Returns a REST client configuration based on a provided path
-// to a .kubeconfig file, loading rules, and config flag overrides.
-// Expects the AddFlags method to have been called.
-func (f *ConfigFlags) ToRESTConfig() (*rest.Config, error) {
- return f.ToRawKubeConfigLoader().ClientConfig()
-}
-
-// ToRawKubeConfigLoader binds config flag values to config overrides
-// Returns an interactive clientConfig if the password flag is enabled,
-// or a non-interactive clientConfig otherwise.
-func (f *ConfigFlags) ToRawKubeConfigLoader() clientcmd.ClientConfig {
- loadingRules := clientcmd.NewDefaultClientConfigLoadingRules()
- // use the standard defaults for this client command
- // DEPRECATED: remove and replace with something more accurate
- loadingRules.DefaultClientConfig = &clientcmd.DefaultClientConfig
-
- if f.KubeConfig != nil {
- loadingRules.ExplicitPath = *f.KubeConfig
- }
-
- overrides := &clientcmd.ConfigOverrides{ClusterDefaults: clientcmd.ClusterDefaults}
-
- // bind auth info flag values to overrides
- if f.CertFile != nil {
- overrides.AuthInfo.ClientCertificate = *f.CertFile
- }
- if f.KeyFile != nil {
- overrides.AuthInfo.ClientKey = *f.KeyFile
- }
- if f.BearerToken != nil {
- overrides.AuthInfo.Token = *f.BearerToken
- }
- if f.Impersonate != nil {
- overrides.AuthInfo.Impersonate = *f.Impersonate
- }
- if f.ImpersonateGroup != nil {
- overrides.AuthInfo.ImpersonateGroups = *f.ImpersonateGroup
- }
- if f.Username != nil {
- overrides.AuthInfo.Username = *f.Username
- }
- if f.Password != nil {
- overrides.AuthInfo.Password = *f.Password
- }
-
- // bind cluster flags
- if f.APIServer != nil {
- overrides.ClusterInfo.Server = *f.APIServer
- }
- if f.CAFile != nil {
- overrides.ClusterInfo.CertificateAuthority = *f.CAFile
- }
- if f.Insecure != nil {
- overrides.ClusterInfo.InsecureSkipTLSVerify = *f.Insecure
- }
-
- // bind context flags
- if f.Context != nil {
- overrides.CurrentContext = *f.Context
- }
- if f.ClusterName != nil {
- overrides.Context.Cluster = *f.ClusterName
- }
- if f.AuthInfoName != nil {
- overrides.Context.AuthInfo = *f.AuthInfoName
- }
- if f.Namespace != nil {
- overrides.Context.Namespace = *f.Namespace
- }
-
- if f.Timeout != nil {
- overrides.Timeout = *f.Timeout
- }
-
- var clientConfig clientcmd.ClientConfig
-
- // we only have an interactive prompt when a password is allowed
- if f.Password == nil {
- clientConfig = clientcmd.NewNonInteractiveDeferredLoadingClientConfig(loadingRules, overrides)
- } else {
- clientConfig = clientcmd.NewInteractiveDeferredLoadingClientConfig(loadingRules, overrides, os.Stdin)
- }
-
- return clientConfig
-}
-
-// ToDiscoveryClient implements RESTClientGetter.
-// Expects the AddFlags method to have been called.
-// Returns a CachedDiscoveryInterface using a computed RESTConfig.
-func (f *ConfigFlags) ToDiscoveryClient() (discovery.CachedDiscoveryInterface, error) {
- config, err := f.ToRESTConfig()
- if err != nil {
- return nil, err
- }
-
- // The more groups you have, the more discovery requests you need to make.
- // given 25 groups (our groups + a few custom resources) with one-ish version each, discovery needs to make 50 requests
- // double it just so we don't end up here again for a while. This config is only used for discovery.
- config.Burst = 100
-
- // retrieve a user-provided value for the "cache-dir"
- // defaulting to ~/.kube/http-cache if no user-value is given.
- httpCacheDir := defaultCacheDir
- if f.CacheDir != nil {
- httpCacheDir = *f.CacheDir
- }
-
- discoveryCacheDir := computeDiscoverCacheDir(filepath.Join(homedir.HomeDir(), ".kube", "cache", "discovery"), config.Host)
- return discovery.NewCachedDiscoveryClientForConfig(config, discoveryCacheDir, httpCacheDir, time.Duration(10*time.Minute))
-}
-
-// ToRESTMapper returns a mapper.
-func (f *ConfigFlags) ToRESTMapper() (meta.RESTMapper, error) {
- discoveryClient, err := f.ToDiscoveryClient()
- if err != nil {
- return nil, err
- }
-
- mapper := restmapper.NewDeferredDiscoveryRESTMapper(discoveryClient)
- expander := restmapper.NewShortcutExpander(mapper, discoveryClient)
- return expander, nil
-}
-
-// AddFlags binds client configuration flags to a given flagset
-func (f *ConfigFlags) AddFlags(flags *pflag.FlagSet) {
- if f.KubeConfig != nil {
- flags.StringVar(f.KubeConfig, "kubeconfig", *f.KubeConfig, "Path to the kubeconfig file to use for CLI requests.")
- }
- if f.CacheDir != nil {
- flags.StringVar(f.CacheDir, flagHTTPCacheDir, *f.CacheDir, "Default HTTP cache directory")
- }
-
- // add config options
- if f.CertFile != nil {
- flags.StringVar(f.CertFile, flagCertFile, *f.CertFile, "Path to a client certificate file for TLS")
- }
- if f.KeyFile != nil {
- flags.StringVar(f.KeyFile, flagKeyFile, *f.KeyFile, "Path to a client key file for TLS")
- }
- if f.BearerToken != nil {
- flags.StringVar(f.BearerToken, flagBearerToken, *f.BearerToken, "Bearer token for authentication to the API server")
- }
- if f.Impersonate != nil {
- flags.StringVar(f.Impersonate, flagImpersonate, *f.Impersonate, "Username to impersonate for the operation")
- }
- if f.ImpersonateGroup != nil {
- flags.StringArrayVar(f.ImpersonateGroup, flagImpersonateGroup, *f.ImpersonateGroup, "Group to impersonate for the operation, this flag can be repeated to specify multiple groups.")
- }
- if f.Username != nil {
- flags.StringVar(f.Username, flagUsername, *f.Username, "Username for basic authentication to the API server")
- }
- if f.Password != nil {
- flags.StringVar(f.Password, flagPassword, *f.Password, "Password for basic authentication to the API server")
- }
- if f.ClusterName != nil {
- flags.StringVar(f.ClusterName, flagClusterName, *f.ClusterName, "The name of the kubeconfig cluster to use")
- }
- if f.AuthInfoName != nil {
- flags.StringVar(f.AuthInfoName, flagAuthInfoName, *f.AuthInfoName, "The name of the kubeconfig user to use")
- }
- if f.Namespace != nil {
- flags.StringVarP(f.Namespace, flagNamespace, "n", *f.Namespace, "If present, the namespace scope for this CLI request")
- }
- if f.Context != nil {
- flags.StringVar(f.Context, flagContext, *f.Context, "The name of the kubeconfig context to use")
- }
-
- if f.APIServer != nil {
- flags.StringVarP(f.APIServer, flagAPIServer, "s", *f.APIServer, "The address and port of the Kubernetes API server")
- }
- if f.Insecure != nil {
- flags.BoolVar(f.Insecure, flagInsecure, *f.Insecure, "If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure")
- }
- if f.CAFile != nil {
- flags.StringVar(f.CAFile, flagCAFile, *f.CAFile, "Path to a cert file for the certificate authority")
- }
- if f.Timeout != nil {
- flags.StringVar(f.Timeout, flagTimeout, *f.Timeout, "The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests.")
- }
-
-}
-
-// WithDeprecatedPasswordFlag enables the username and password config flags
-func (f *ConfigFlags) WithDeprecatedPasswordFlag() *ConfigFlags {
- f.Username = stringptr("")
- f.Password = stringptr("")
- return f
-}
-
-// NewConfigFlags returns ConfigFlags with default values set
-func NewConfigFlags() *ConfigFlags {
- impersonateGroup := []string{}
- insecure := false
-
- return &ConfigFlags{
- Insecure: &insecure,
- Timeout: stringptr("0"),
- KubeConfig: stringptr(""),
-
- CacheDir: stringptr(defaultCacheDir),
- ClusterName: stringptr(""),
- AuthInfoName: stringptr(""),
- Context: stringptr(""),
- Namespace: stringptr(""),
- APIServer: stringptr(""),
- CertFile: stringptr(""),
- KeyFile: stringptr(""),
- CAFile: stringptr(""),
- BearerToken: stringptr(""),
- Impersonate: stringptr(""),
- ImpersonateGroup: &impersonateGroup,
- }
-}
-
-func stringptr(val string) *string {
- return &val
-}
-
-// overlyCautiousIllegalFileCharacters matches characters that *might* not be supported. Windows is really restrictive, so this is really restrictive
-var overlyCautiousIllegalFileCharacters = regexp.MustCompile(`[^(\w/\.)]`)
-
-// computeDiscoverCacheDir takes the parentDir and the host and comes up with a "usually non-colliding" name.
-func computeDiscoverCacheDir(parentDir, host string) string {
- // strip the optional scheme from host if its there:
- schemelessHost := strings.Replace(strings.Replace(host, "https://", "", 1), "http://", "", 1)
- // now do a simple collapse of non-AZ09 characters. Collisions are possible but unlikely. Even if we do collide the problem is short lived
- safeHost := overlyCautiousIllegalFileCharacters.ReplaceAllString(schemelessHost, "_")
- return filepath.Join(parentDir, safeHost)
-}
diff --git a/vendor/k8s.io/cli-runtime/pkg/genericclioptions/config_flags_fake.go b/vendor/k8s.io/cli-runtime/pkg/genericclioptions/config_flags_fake.go
deleted file mode 100644
index 64e9a68833..0000000000
--- a/vendor/k8s.io/cli-runtime/pkg/genericclioptions/config_flags_fake.go
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
-Copyright 2018 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
-
-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.
-*/
-
-package genericclioptions
-
-import (
- "fmt"
-
- "k8s.io/apimachinery/pkg/api/meta"
- "k8s.io/client-go/discovery"
- "k8s.io/client-go/rest"
- "k8s.io/client-go/restmapper"
- "k8s.io/client-go/tools/clientcmd"
- clientcmdapi "k8s.io/client-go/tools/clientcmd/api"
-)
-
-type TestConfigFlags struct {
- clientConfig clientcmd.ClientConfig
- discoveryClient discovery.CachedDiscoveryInterface
- restMapper meta.RESTMapper
-}
-
-func (f *TestConfigFlags) ToRawKubeConfigLoader() clientcmd.ClientConfig {
- if f.clientConfig == nil {
- panic("attempt to obtain a test RawKubeConfigLoader with no clientConfig specified")
- }
- return f.clientConfig
-}
-
-func (f *TestConfigFlags) ToRESTConfig() (*rest.Config, error) {
- return f.ToRawKubeConfigLoader().ClientConfig()
-}
-
-func (f *TestConfigFlags) ToDiscoveryClient() (discovery.CachedDiscoveryInterface, error) {
- return f.discoveryClient, nil
-}
-
-func (f *TestConfigFlags) ToRESTMapper() (meta.RESTMapper, error) {
- if f.restMapper != nil {
- return f.restMapper, nil
- }
- if f.discoveryClient != nil {
- mapper := restmapper.NewDeferredDiscoveryRESTMapper(f.discoveryClient)
- expander := restmapper.NewShortcutExpander(mapper, f.discoveryClient)
- return expander, nil
- }
- return nil, fmt.Errorf("no restmapper")
-}
-
-func (f *TestConfigFlags) WithClientConfig(clientConfig clientcmd.ClientConfig) *TestConfigFlags {
- f.clientConfig = clientConfig
- return f
-}
-
-func (f *TestConfigFlags) WithRESTMapper(mapper meta.RESTMapper) *TestConfigFlags {
- f.restMapper = mapper
- return f
-}
-
-func (f *TestConfigFlags) WithDiscoveryClient(c discovery.CachedDiscoveryInterface) *TestConfigFlags {
- f.discoveryClient = c
- return f
-}
-
-func (f *TestConfigFlags) WithNamespace(ns string) *TestConfigFlags {
- if f.clientConfig == nil {
- panic("attempt to obtain a test RawKubeConfigLoader with no clientConfig specified")
- }
- f.clientConfig = &namespacedClientConfig{
- delegate: f.clientConfig,
- namespace: ns,
- }
- return f
-}
-
-func NewTestConfigFlags() *TestConfigFlags {
- return &TestConfigFlags{}
-}
-
-type namespacedClientConfig struct {
- delegate clientcmd.ClientConfig
- namespace string
-}
-
-func (c *namespacedClientConfig) Namespace() (string, bool, error) {
- return c.namespace, false, nil
-}
-
-func (c *namespacedClientConfig) RawConfig() (clientcmdapi.Config, error) {
- return c.delegate.RawConfig()
-}
-func (c *namespacedClientConfig) ClientConfig() (*rest.Config, error) {
- return c.delegate.ClientConfig()
-}
-func (c *namespacedClientConfig) ConfigAccess() clientcmd.ConfigAccess {
- return c.delegate.ConfigAccess()
-}
diff --git a/vendor/k8s.io/cli-runtime/pkg/genericclioptions/doc.go b/vendor/k8s.io/cli-runtime/pkg/genericclioptions/doc.go
deleted file mode 100644
index 2bf32d2561..0000000000
--- a/vendor/k8s.io/cli-runtime/pkg/genericclioptions/doc.go
+++ /dev/null
@@ -1,19 +0,0 @@
-/*
-Copyright 2018 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
-
-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.
-*/
-
-// Package genericclioptions contains flags which can be added to you command, bound, completed, and produce
-// useful helper functions. Nothing in this package can depend on kube/kube
-package genericclioptions
diff --git a/vendor/k8s.io/cli-runtime/pkg/genericclioptions/filename_flags.go b/vendor/k8s.io/cli-runtime/pkg/genericclioptions/filename_flags.go
deleted file mode 100644
index 348a9c6368..0000000000
--- a/vendor/k8s.io/cli-runtime/pkg/genericclioptions/filename_flags.go
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
-Copyright 2018 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
-
-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.
-*/
-
-package genericclioptions
-
-import (
- "strings"
-
- "github.com/spf13/cobra"
- "github.com/spf13/pflag"
-
- "k8s.io/cli-runtime/pkg/genericclioptions/resource"
-)
-
-// Usage of this struct by itself is discouraged.
-// These flags are composed by ResourceBuilderFlags
-// which should be used instead.
-type FileNameFlags struct {
- Usage string
-
- Filenames *[]string
- Recursive *bool
-}
-
-func (o *FileNameFlags) ToOptions() resource.FilenameOptions {
- options := resource.FilenameOptions{}
-
- if o == nil {
- return options
- }
-
- if o.Recursive != nil {
- options.Recursive = *o.Recursive
- }
- if o.Filenames != nil {
- options.Filenames = *o.Filenames
- }
-
- return options
-}
-
-func (o *FileNameFlags) AddFlags(flags *pflag.FlagSet) {
- if o == nil {
- return
- }
-
- if o.Recursive != nil {
- flags.BoolVarP(o.Recursive, "recursive", "R", *o.Recursive, "Process the directory used in -f, --filename recursively. Useful when you want to manage related manifests organized within the same directory.")
- }
- if o.Filenames != nil {
- flags.StringSliceVarP(o.Filenames, "filename", "f", *o.Filenames, o.Usage)
- annotations := make([]string, 0, len(resource.FileExtensions))
- for _, ext := range resource.FileExtensions {
- annotations = append(annotations, strings.TrimLeft(ext, "."))
- }
- flags.SetAnnotation("filename", cobra.BashCompFilenameExt, annotations)
- }
-}
diff --git a/vendor/k8s.io/cli-runtime/pkg/genericclioptions/io_options.go b/vendor/k8s.io/cli-runtime/pkg/genericclioptions/io_options.go
deleted file mode 100644
index 4fc3a77b0c..0000000000
--- a/vendor/k8s.io/cli-runtime/pkg/genericclioptions/io_options.go
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
-Copyright 2018 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
-
-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.
-*/
-
-package genericclioptions
-
-import (
- "bytes"
- "io"
- "io/ioutil"
-)
-
-// IOStreams provides the standard names for iostreams. This is useful for embedding and for unit testing.
-// Inconsistent and different names make it hard to read and review code
-type IOStreams struct {
- // In think, os.Stdin
- In io.Reader
- // Out think, os.Stdout
- Out io.Writer
- // ErrOut think, os.Stderr
- ErrOut io.Writer
-}
-
-// NewTestIOStreams returns a valid IOStreams and in, out, errout buffers for unit tests
-func NewTestIOStreams() (IOStreams, *bytes.Buffer, *bytes.Buffer, *bytes.Buffer) {
- in := &bytes.Buffer{}
- out := &bytes.Buffer{}
- errOut := &bytes.Buffer{}
-
- return IOStreams{
- In: in,
- Out: out,
- ErrOut: errOut,
- }, in, out, errOut
-}
-
-// NewTestIOStreamsDiscard returns a valid IOStreams that just discards
-func NewTestIOStreamsDiscard() IOStreams {
- in := &bytes.Buffer{}
- return IOStreams{
- In: in,
- Out: ioutil.Discard,
- ErrOut: ioutil.Discard,
- }
-}
diff --git a/vendor/k8s.io/cli-runtime/pkg/genericclioptions/json_yaml_flags.go b/vendor/k8s.io/cli-runtime/pkg/genericclioptions/json_yaml_flags.go
deleted file mode 100644
index d9b5812737..0000000000
--- a/vendor/k8s.io/cli-runtime/pkg/genericclioptions/json_yaml_flags.go
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
-Copyright 2018 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
-
-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.
-*/
-
-package genericclioptions
-
-import (
- "strings"
-
- "github.com/spf13/cobra"
-
- "k8s.io/cli-runtime/pkg/genericclioptions/printers"
-)
-
-func (f *JSONYamlPrintFlags) AllowedFormats() []string {
- if f == nil {
- return []string{}
- }
- return []string{"json", "yaml"}
-}
-
-// JSONYamlPrintFlags provides default flags necessary for json/yaml printing.
-// Given the following flag values, a printer can be requested that knows
-// how to handle printing based on these values.
-type JSONYamlPrintFlags struct {
-}
-
-// ToPrinter receives an outputFormat and returns a printer capable of
-// handling --output=(yaml|json) printing.
-// Returns false if the specified outputFormat does not match a supported format.
-// Supported Format types can be found in pkg/printers/printers.go
-func (f *JSONYamlPrintFlags) ToPrinter(outputFormat string) (printers.ResourcePrinter, error) {
- var printer printers.ResourcePrinter
-
- outputFormat = strings.ToLower(outputFormat)
- switch outputFormat {
- case "json":
- printer = &printers.JSONPrinter{}
- case "yaml":
- printer = &printers.YAMLPrinter{}
- default:
- return nil, NoCompatiblePrinterError{OutputFormat: &outputFormat, AllowedFormats: f.AllowedFormats()}
- }
-
- return printer, nil
-}
-
-// AddFlags receives a *cobra.Command reference and binds
-// flags related to JSON or Yaml printing to it
-func (f *JSONYamlPrintFlags) AddFlags(c *cobra.Command) {}
-
-// NewJSONYamlPrintFlags returns flags associated with
-// yaml or json printing, with default values set.
-func NewJSONYamlPrintFlags() *JSONYamlPrintFlags {
- return &JSONYamlPrintFlags{}
-}
diff --git a/vendor/k8s.io/cli-runtime/pkg/genericclioptions/jsonpath_flags.go b/vendor/k8s.io/cli-runtime/pkg/genericclioptions/jsonpath_flags.go
deleted file mode 100644
index 6f75af91b4..0000000000
--- a/vendor/k8s.io/cli-runtime/pkg/genericclioptions/jsonpath_flags.go
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
-Copyright 2018 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
-
-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.
-*/
-
-package genericclioptions
-
-import (
- "fmt"
- "io/ioutil"
- "strings"
-
- "github.com/spf13/cobra"
-
- "k8s.io/cli-runtime/pkg/genericclioptions/printers"
-)
-
-// templates are logically optional for specifying a format.
-// this allows a user to specify a template format value
-// as --output=jsonpath=
-var jsonFormats = map[string]bool{
- "jsonpath": true,
- "jsonpath-file": true,
-}
-
-// JSONPathPrintFlags provides default flags necessary for template printing.
-// Given the following flag values, a printer can be requested that knows
-// how to handle printing based on these values.
-type JSONPathPrintFlags struct {
- // indicates if it is OK to ignore missing keys for rendering
- // an output template.
- AllowMissingKeys *bool
- TemplateArgument *string
-}
-
-func (f *JSONPathPrintFlags) AllowedFormats() []string {
- formats := make([]string, 0, len(jsonFormats))
- for format := range jsonFormats {
- formats = append(formats, format)
- }
- return formats
-}
-
-// ToPrinter receives an templateFormat and returns a printer capable of
-// handling --template format printing.
-// Returns false if the specified templateFormat does not match a template format.
-func (f *JSONPathPrintFlags) ToPrinter(templateFormat string) (printers.ResourcePrinter, error) {
- if (f.TemplateArgument == nil || len(*f.TemplateArgument) == 0) && len(templateFormat) == 0 {
- return nil, NoCompatiblePrinterError{Options: f, OutputFormat: &templateFormat}
- }
-
- templateValue := ""
-
- if f.TemplateArgument == nil || len(*f.TemplateArgument) == 0 {
- for format := range jsonFormats {
- format = format + "="
- if strings.HasPrefix(templateFormat, format) {
- templateValue = templateFormat[len(format):]
- templateFormat = format[:len(format)-1]
- break
- }
- }
- } else {
- templateValue = *f.TemplateArgument
- }
-
- if _, supportedFormat := jsonFormats[templateFormat]; !supportedFormat {
- return nil, NoCompatiblePrinterError{OutputFormat: &templateFormat, AllowedFormats: f.AllowedFormats()}
- }
-
- if len(templateValue) == 0 {
- return nil, fmt.Errorf("template format specified but no template given")
- }
-
- if templateFormat == "jsonpath-file" {
- data, err := ioutil.ReadFile(templateValue)
- if err != nil {
- return nil, fmt.Errorf("error reading --template %s, %v\n", templateValue, err)
- }
-
- templateValue = string(data)
- }
-
- p, err := printers.NewJSONPathPrinter(templateValue)
- if err != nil {
- return nil, fmt.Errorf("error parsing jsonpath %s, %v\n", templateValue, err)
- }
-
- allowMissingKeys := true
- if f.AllowMissingKeys != nil {
- allowMissingKeys = *f.AllowMissingKeys
- }
-
- p.AllowMissingKeys(allowMissingKeys)
- return p, nil
-}
-
-// AddFlags receives a *cobra.Command reference and binds
-// flags related to template printing to it
-func (f *JSONPathPrintFlags) AddFlags(c *cobra.Command) {
- if f.TemplateArgument != nil {
- c.Flags().StringVar(f.TemplateArgument, "template", *f.TemplateArgument, "Template string or path to template file to use when --output=jsonpath, --output=jsonpath-file.")
- c.MarkFlagFilename("template")
- }
- if f.AllowMissingKeys != nil {
- c.Flags().BoolVar(f.AllowMissingKeys, "allow-missing-template-keys", *f.AllowMissingKeys, "If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.")
- }
-}
-
-// NewJSONPathPrintFlags returns flags associated with
-// --template printing, with default values set.
-func NewJSONPathPrintFlags(templateValue string, allowMissingKeys bool) *JSONPathPrintFlags {
- return &JSONPathPrintFlags{
- TemplateArgument: &templateValue,
- AllowMissingKeys: &allowMissingKeys,
- }
-}
diff --git a/vendor/k8s.io/cli-runtime/pkg/genericclioptions/kube_template_flags.go b/vendor/k8s.io/cli-runtime/pkg/genericclioptions/kube_template_flags.go
deleted file mode 100644
index d35384c2ca..0000000000
--- a/vendor/k8s.io/cli-runtime/pkg/genericclioptions/kube_template_flags.go
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
-Copyright 2018 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
-
-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.
-*/
-
-package genericclioptions
-
-import (
- "github.com/spf13/cobra"
-
- "k8s.io/cli-runtime/pkg/genericclioptions/printers"
-)
-
-// KubeTemplatePrintFlags composes print flags that provide both a JSONPath and a go-template printer.
-// This is necessary if dealing with cases that require support both both printers, since both sets of flags
-// require overlapping flags.
-type KubeTemplatePrintFlags struct {
- GoTemplatePrintFlags *GoTemplatePrintFlags
- JSONPathPrintFlags *JSONPathPrintFlags
-
- AllowMissingKeys *bool
- TemplateArgument *string
-}
-
-func (f *KubeTemplatePrintFlags) AllowedFormats() []string {
- if f == nil {
- return []string{}
- }
- return append(f.GoTemplatePrintFlags.AllowedFormats(), f.JSONPathPrintFlags.AllowedFormats()...)
-}
-
-func (f *KubeTemplatePrintFlags) ToPrinter(outputFormat string) (printers.ResourcePrinter, error) {
- if f == nil {
- return nil, NoCompatiblePrinterError{}
- }
-
- if p, err := f.JSONPathPrintFlags.ToPrinter(outputFormat); !IsNoCompatiblePrinterError(err) {
- return p, err
- }
- return f.GoTemplatePrintFlags.ToPrinter(outputFormat)
-}
-
-// AddFlags receives a *cobra.Command reference and binds
-// flags related to template printing to it
-func (f *KubeTemplatePrintFlags) AddFlags(c *cobra.Command) {
- if f == nil {
- return
- }
-
- if f.TemplateArgument != nil {
- c.Flags().StringVar(f.TemplateArgument, "template", *f.TemplateArgument, "Template string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [http://golang.org/pkg/text/template/#pkg-overview].")
- c.MarkFlagFilename("template")
- }
- if f.AllowMissingKeys != nil {
- c.Flags().BoolVar(f.AllowMissingKeys, "allow-missing-template-keys", *f.AllowMissingKeys, "If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.")
- }
-}
-
-// NewKubeTemplatePrintFlags returns flags associated with
-// --template printing, with default values set.
-func NewKubeTemplatePrintFlags() *KubeTemplatePrintFlags {
- allowMissingKeysPtr := true
- templateArgPtr := ""
-
- return &KubeTemplatePrintFlags{
- GoTemplatePrintFlags: &GoTemplatePrintFlags{
- TemplateArgument: &templateArgPtr,
- AllowMissingKeys: &allowMissingKeysPtr,
- },
- JSONPathPrintFlags: &JSONPathPrintFlags{
- TemplateArgument: &templateArgPtr,
- AllowMissingKeys: &allowMissingKeysPtr,
- },
-
- TemplateArgument: &templateArgPtr,
- AllowMissingKeys: &allowMissingKeysPtr,
- }
-}
diff --git a/vendor/k8s.io/cli-runtime/pkg/genericclioptions/name_flags.go b/vendor/k8s.io/cli-runtime/pkg/genericclioptions/name_flags.go
deleted file mode 100644
index 3a1f4f3f51..0000000000
--- a/vendor/k8s.io/cli-runtime/pkg/genericclioptions/name_flags.go
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
-Copyright 2018 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
-
-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.
-*/
-
-package genericclioptions
-
-import (
- "fmt"
- "strings"
-
- "github.com/spf13/cobra"
-
- "k8s.io/cli-runtime/pkg/genericclioptions/printers"
-)
-
-// NamePrintFlags provides default flags necessary for printing
-// a resource's fully-qualified Kind.group/name, or a successful
-// message about that resource if an Operation is provided.
-type NamePrintFlags struct {
- // Operation describes the name of the action that
- // took place on an object, to be included in the
- // finalized "successful" message.
- Operation string
-}
-
-func (f *NamePrintFlags) Complete(successTemplate string) error {
- f.Operation = fmt.Sprintf(successTemplate, f.Operation)
- return nil
-}
-
-func (f *NamePrintFlags) AllowedFormats() []string {
- if f == nil {
- return []string{}
- }
- return []string{"name"}
-}
-
-// ToPrinter receives an outputFormat and returns a printer capable of
-// handling --output=name printing.
-// Returns false if the specified outputFormat does not match a supported format.
-// Supported format types can be found in pkg/printers/printers.go
-func (f *NamePrintFlags) ToPrinter(outputFormat string) (printers.ResourcePrinter, error) {
- namePrinter := &printers.NamePrinter{
- Operation: f.Operation,
- }
-
- outputFormat = strings.ToLower(outputFormat)
- switch outputFormat {
- case "name":
- namePrinter.ShortOutput = true
- fallthrough
- case "":
- return namePrinter, nil
- default:
- return nil, NoCompatiblePrinterError{OutputFormat: &outputFormat, AllowedFormats: f.AllowedFormats()}
- }
-}
-
-// AddFlags receives a *cobra.Command reference and binds
-// flags related to name printing to it
-func (f *NamePrintFlags) AddFlags(c *cobra.Command) {}
-
-// NewNamePrintFlags returns flags associated with
-// --name printing, with default values set.
-func NewNamePrintFlags(operation string) *NamePrintFlags {
- return &NamePrintFlags{
- Operation: operation,
- }
-}
diff --git a/vendor/k8s.io/cli-runtime/pkg/genericclioptions/print_flags.go b/vendor/k8s.io/cli-runtime/pkg/genericclioptions/print_flags.go
deleted file mode 100644
index 3f59dab4b9..0000000000
--- a/vendor/k8s.io/cli-runtime/pkg/genericclioptions/print_flags.go
+++ /dev/null
@@ -1,158 +0,0 @@
-/*
-Copyright 2018 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
-
-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.
-*/
-
-package genericclioptions
-
-import (
- "fmt"
- "sort"
- "strings"
-
- "github.com/spf13/cobra"
-
- "k8s.io/apimachinery/pkg/runtime"
- "k8s.io/cli-runtime/pkg/genericclioptions/printers"
-)
-
-type NoCompatiblePrinterError struct {
- OutputFormat *string
- AllowedFormats []string
- Options interface{}
-}
-
-func (e NoCompatiblePrinterError) Error() string {
- output := ""
- if e.OutputFormat != nil {
- output = *e.OutputFormat
- }
-
- sort.Strings(e.AllowedFormats)
- return fmt.Sprintf("unable to match a printer suitable for the output format %q, allowed formats are: %s", output, strings.Join(e.AllowedFormats, ","))
-}
-
-func IsNoCompatiblePrinterError(err error) bool {
- if err == nil {
- return false
- }
-
- _, ok := err.(NoCompatiblePrinterError)
- return ok
-}
-
-// PrintFlags composes common printer flag structs
-// used across all commands, and provides a method
-// of retrieving a known printer based on flag values provided.
-type PrintFlags struct {
- JSONYamlPrintFlags *JSONYamlPrintFlags
- NamePrintFlags *NamePrintFlags
- TemplatePrinterFlags *KubeTemplatePrintFlags
-
- TypeSetterPrinter *printers.TypeSetterPrinter
-
- OutputFormat *string
-
- // OutputFlagSpecified indicates whether the user specifically requested a certain kind of output.
- // Using this function allows a sophisticated caller to change the flag binding logic if they so desire.
- OutputFlagSpecified func() bool
-}
-
-func (f *PrintFlags) Complete(successTemplate string) error {
- return f.NamePrintFlags.Complete(successTemplate)
-}
-
-func (f *PrintFlags) AllowedFormats() []string {
- ret := []string{}
- ret = append(ret, f.JSONYamlPrintFlags.AllowedFormats()...)
- ret = append(ret, f.NamePrintFlags.AllowedFormats()...)
- ret = append(ret, f.TemplatePrinterFlags.AllowedFormats()...)
- return ret
-}
-
-func (f *PrintFlags) ToPrinter() (printers.ResourcePrinter, error) {
- outputFormat := ""
- if f.OutputFormat != nil {
- outputFormat = *f.OutputFormat
- }
- // For backwards compatibility we want to support a --template argument given, even when no --output format is provided.
- // If no explicit output format has been provided via the --output flag, fallback
- // to honoring the --template argument.
- templateFlagSpecified := f.TemplatePrinterFlags != nil &&
- f.TemplatePrinterFlags.TemplateArgument != nil &&
- len(*f.TemplatePrinterFlags.TemplateArgument) > 0
- outputFlagSpecified := f.OutputFlagSpecified != nil && f.OutputFlagSpecified()
- if templateFlagSpecified && !outputFlagSpecified {
- outputFormat = "go-template"
- }
-
- if f.JSONYamlPrintFlags != nil {
- if p, err := f.JSONYamlPrintFlags.ToPrinter(outputFormat); !IsNoCompatiblePrinterError(err) {
- return f.TypeSetterPrinter.WrapToPrinter(p, err)
- }
- }
-
- if f.NamePrintFlags != nil {
- if p, err := f.NamePrintFlags.ToPrinter(outputFormat); !IsNoCompatiblePrinterError(err) {
- return f.TypeSetterPrinter.WrapToPrinter(p, err)
- }
- }
-
- if f.TemplatePrinterFlags != nil {
- if p, err := f.TemplatePrinterFlags.ToPrinter(outputFormat); !IsNoCompatiblePrinterError(err) {
- return f.TypeSetterPrinter.WrapToPrinter(p, err)
- }
- }
-
- return nil, NoCompatiblePrinterError{OutputFormat: f.OutputFormat, AllowedFormats: f.AllowedFormats()}
-}
-
-func (f *PrintFlags) AddFlags(cmd *cobra.Command) {
- f.JSONYamlPrintFlags.AddFlags(cmd)
- f.NamePrintFlags.AddFlags(cmd)
- f.TemplatePrinterFlags.AddFlags(cmd)
-
- if f.OutputFormat != nil {
- cmd.Flags().StringVarP(f.OutputFormat, "output", "o", *f.OutputFormat, fmt.Sprintf("Output format. One of: %s.", strings.Join(f.AllowedFormats(), "|")))
- if f.OutputFlagSpecified == nil {
- f.OutputFlagSpecified = func() bool {
- return cmd.Flag("output").Changed
- }
- }
- }
-}
-
-// WithDefaultOutput sets a default output format if one is not provided through a flag value
-func (f *PrintFlags) WithDefaultOutput(output string) *PrintFlags {
- f.OutputFormat = &output
- return f
-}
-
-// WithTypeSetter sets a wrapper than will surround the returned printer with a printer to type resources
-func (f *PrintFlags) WithTypeSetter(scheme *runtime.Scheme) *PrintFlags {
- f.TypeSetterPrinter = printers.NewTypeSetter(scheme)
- return f
-}
-
-func NewPrintFlags(operation string) *PrintFlags {
- outputFormat := ""
-
- return &PrintFlags{
- OutputFormat: &outputFormat,
-
- JSONYamlPrintFlags: NewJSONYamlPrintFlags(),
- NamePrintFlags: NewNamePrintFlags(operation),
- TemplatePrinterFlags: NewKubeTemplatePrintFlags(),
- }
-}
diff --git a/vendor/k8s.io/cli-runtime/pkg/genericclioptions/printers/discard.go b/vendor/k8s.io/cli-runtime/pkg/genericclioptions/printers/discard.go
deleted file mode 100644
index cd934976da..0000000000
--- a/vendor/k8s.io/cli-runtime/pkg/genericclioptions/printers/discard.go
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
-Copyright 2018 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
-
-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.
-*/
-
-package printers
-
-import (
- "io"
-
- "k8s.io/apimachinery/pkg/runtime"
-)
-
-// NewDiscardingPrinter is a printer that discards all objects
-func NewDiscardingPrinter() ResourcePrinterFunc {
- return ResourcePrinterFunc(func(runtime.Object, io.Writer) error {
- return nil
- })
-}
diff --git a/vendor/k8s.io/cli-runtime/pkg/genericclioptions/printers/interface.go b/vendor/k8s.io/cli-runtime/pkg/genericclioptions/printers/interface.go
deleted file mode 100644
index b59a935fca..0000000000
--- a/vendor/k8s.io/cli-runtime/pkg/genericclioptions/printers/interface.go
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
-Copyright 2018 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
-
-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.
-*/
-
-package printers
-
-import (
- "io"
-
- "k8s.io/apimachinery/pkg/runtime"
-)
-
-// ResourcePrinterFunc is a function that can print objects
-type ResourcePrinterFunc func(runtime.Object, io.Writer) error
-
-// PrintObj implements ResourcePrinter
-func (fn ResourcePrinterFunc) PrintObj(obj runtime.Object, w io.Writer) error {
- return fn(obj, w)
-}
-
-// ResourcePrinter is an interface that knows how to print runtime objects.
-type ResourcePrinter interface {
- // Print receives a runtime object, formats it and prints it to a writer.
- PrintObj(runtime.Object, io.Writer) error
-}
diff --git a/vendor/k8s.io/cli-runtime/pkg/genericclioptions/printers/json.go b/vendor/k8s.io/cli-runtime/pkg/genericclioptions/printers/json.go
deleted file mode 100644
index 1df9a86466..0000000000
--- a/vendor/k8s.io/cli-runtime/pkg/genericclioptions/printers/json.go
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
-Copyright 2017 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
-
-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.
-*/
-
-package printers
-
-import (
- "bytes"
- "encoding/json"
- "fmt"
- "io"
- "reflect"
-
- "k8s.io/apimachinery/pkg/runtime"
-
- "github.com/ghodss/yaml"
-)
-
-// JSONPrinter is an implementation of ResourcePrinter which outputs an object as JSON.
-type JSONPrinter struct{}
-
-// PrintObj is an implementation of ResourcePrinter.PrintObj which simply writes the object to the Writer.
-func (p *JSONPrinter) PrintObj(obj runtime.Object, w io.Writer) error {
- // we use reflect.Indirect here in order to obtain the actual value from a pointer.
- // we need an actual value in order to retrieve the package path for an object.
- // using reflect.Indirect indiscriminately is valid here, as all runtime.Objects are supposed to be pointers.
- if InternalObjectPreventer.IsForbidden(reflect.Indirect(reflect.ValueOf(obj)).Type().PkgPath()) {
- return fmt.Errorf(InternalObjectPrinterErr)
- }
-
- switch obj := obj.(type) {
- case *runtime.Unknown:
- var buf bytes.Buffer
- err := json.Indent(&buf, obj.Raw, "", " ")
- if err != nil {
- return err
- }
- buf.WriteRune('\n')
- _, err = buf.WriteTo(w)
- return err
- }
-
- if obj.GetObjectKind().GroupVersionKind().Empty() {
- return fmt.Errorf("missing apiVersion or kind; try GetObjectKind().SetGroupVersionKind() if you know the type")
- }
-
- data, err := json.MarshalIndent(obj, "", " ")
- if err != nil {
- return err
- }
- data = append(data, '\n')
- _, err = w.Write(data)
- return err
-}
-
-// YAMLPrinter is an implementation of ResourcePrinter which outputs an object as YAML.
-// The input object is assumed to be in the internal version of an API and is converted
-// to the given version first.
-type YAMLPrinter struct {
- version string
- converter runtime.ObjectConvertor
-}
-
-// PrintObj prints the data as YAML.
-func (p *YAMLPrinter) PrintObj(obj runtime.Object, w io.Writer) error {
- // we use reflect.Indirect here in order to obtain the actual value from a pointer.
- // we need an actual value in order to retrieve the package path for an object.
- // using reflect.Indirect indiscriminately is valid here, as all runtime.Objects are supposed to be pointers.
- if InternalObjectPreventer.IsForbidden(reflect.Indirect(reflect.ValueOf(obj)).Type().PkgPath()) {
- return fmt.Errorf(InternalObjectPrinterErr)
- }
-
- switch obj := obj.(type) {
- case *runtime.Unknown:
- data, err := yaml.JSONToYAML(obj.Raw)
- if err != nil {
- return err
- }
- _, err = w.Write(data)
- return err
- }
-
- if obj.GetObjectKind().GroupVersionKind().Empty() {
- return fmt.Errorf("missing apiVersion or kind; try GetObjectKind().SetGroupVersionKind() if you know the type")
- }
-
- output, err := yaml.Marshal(obj)
- if err != nil {
- return err
- }
- _, err = fmt.Fprint(w, string(output))
- return err
-}
diff --git a/vendor/k8s.io/cli-runtime/pkg/genericclioptions/printers/jsonpath.go b/vendor/k8s.io/cli-runtime/pkg/genericclioptions/printers/jsonpath.go
deleted file mode 100644
index 0bdb3511f1..0000000000
--- a/vendor/k8s.io/cli-runtime/pkg/genericclioptions/printers/jsonpath.go
+++ /dev/null
@@ -1,145 +0,0 @@
-/*
-Copyright 2017 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
-
-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.
-*/
-
-package printers
-
-import (
- "encoding/json"
- "fmt"
- "io"
- "reflect"
-
- "k8s.io/apimachinery/pkg/runtime"
- "k8s.io/client-go/util/jsonpath"
-)
-
-// exists returns true if it would be possible to call the index function
-// with these arguments.
-//
-// TODO: how to document this for users?
-//
-// index returns the result of indexing its first argument by the following
-// arguments. Thus "index x 1 2 3" is, in Go syntax, x[1][2][3]. Each
-// indexed item must be a map, slice, or array.
-func exists(item interface{}, indices ...interface{}) bool {
- v := reflect.ValueOf(item)
- for _, i := range indices {
- index := reflect.ValueOf(i)
- var isNil bool
- if v, isNil = indirect(v); isNil {
- return false
- }
- switch v.Kind() {
- case reflect.Array, reflect.Slice, reflect.String:
- var x int64
- switch index.Kind() {
- case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
- x = index.Int()
- case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr:
- x = int64(index.Uint())
- default:
- return false
- }
- if x < 0 || x >= int64(v.Len()) {
- return false
- }
- v = v.Index(int(x))
- case reflect.Map:
- if !index.IsValid() {
- index = reflect.Zero(v.Type().Key())
- }
- if !index.Type().AssignableTo(v.Type().Key()) {
- return false
- }
- if x := v.MapIndex(index); x.IsValid() {
- v = x
- } else {
- v = reflect.Zero(v.Type().Elem())
- }
- default:
- return false
- }
- }
- if _, isNil := indirect(v); isNil {
- return false
- }
- return true
-}
-
-// stolen from text/template
-// indirect returns the item at the end of indirection, and a bool to indicate if it's nil.
-// We indirect through pointers and empty interfaces (only) because
-// non-empty interfaces have methods we might need.
-func indirect(v reflect.Value) (rv reflect.Value, isNil bool) {
- for ; v.Kind() == reflect.Ptr || v.Kind() == reflect.Interface; v = v.Elem() {
- if v.IsNil() {
- return v, true
- }
- if v.Kind() == reflect.Interface && v.NumMethod() > 0 {
- break
- }
- }
- return v, false
-}
-
-// JSONPathPrinter is an implementation of ResourcePrinter which formats data with jsonpath expression.
-type JSONPathPrinter struct {
- rawTemplate string
- *jsonpath.JSONPath
-}
-
-func NewJSONPathPrinter(tmpl string) (*JSONPathPrinter, error) {
- j := jsonpath.New("out")
- if err := j.Parse(tmpl); err != nil {
- return nil, err
- }
- return &JSONPathPrinter{
- rawTemplate: tmpl,
- JSONPath: j,
- }, nil
-}
-
-// PrintObj formats the obj with the JSONPath Template.
-func (j *JSONPathPrinter) PrintObj(obj runtime.Object, w io.Writer) error {
- // we use reflect.Indirect here in order to obtain the actual value from a pointer.
- // we need an actual value in order to retrieve the package path for an object.
- // using reflect.Indirect indiscriminately is valid here, as all runtime.Objects are supposed to be pointers.
- if InternalObjectPreventer.IsForbidden(reflect.Indirect(reflect.ValueOf(obj)).Type().PkgPath()) {
- return fmt.Errorf(InternalObjectPrinterErr)
- }
-
- var queryObj interface{} = obj
- if unstructured, ok := obj.(runtime.Unstructured); ok {
- queryObj = unstructured.UnstructuredContent()
- } else {
- data, err := json.Marshal(obj)
- if err != nil {
- return err
- }
- queryObj = map[string]interface{}{}
- if err := json.Unmarshal(data, &queryObj); err != nil {
- return err
- }
- }
-
- if err := j.JSONPath.Execute(w, queryObj); err != nil {
- fmt.Fprintf(w, "Error executing template: %v. Printing more information for debugging the template:\n", err)
- fmt.Fprintf(w, "\ttemplate was:\n\t\t%v\n", j.rawTemplate)
- fmt.Fprintf(w, "\tobject given to jsonpath engine was:\n\t\t%#v\n\n", queryObj)
- return fmt.Errorf("error executing jsonpath %q: %v\n", j.rawTemplate, err)
- }
- return nil
-}
diff --git a/vendor/k8s.io/cli-runtime/pkg/genericclioptions/printers/name.go b/vendor/k8s.io/cli-runtime/pkg/genericclioptions/printers/name.go
deleted file mode 100644
index d04c5c6bbc..0000000000
--- a/vendor/k8s.io/cli-runtime/pkg/genericclioptions/printers/name.go
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
-Copyright 2017 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
-
-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.
-*/
-
-package printers
-
-import (
- "fmt"
- "io"
- "reflect"
- "strings"
-
- "k8s.io/apimachinery/pkg/api/meta"
- "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
- "k8s.io/apimachinery/pkg/runtime"
- "k8s.io/apimachinery/pkg/runtime/schema"
-)
-
-// NamePrinter is an implementation of ResourcePrinter which outputs "resource/name" pair of an object.
-type NamePrinter struct {
- // ShortOutput indicates whether an operation should be
- // printed along side the "resource/name" pair for an object.
- ShortOutput bool
- // Operation describes the name of the action that
- // took place on an object, to be included in the
- // finalized "successful" message.
- Operation string
-}
-
-// PrintObj is an implementation of ResourcePrinter.PrintObj which decodes the object
-// and print "resource/name" pair. If the object is a List, print all items in it.
-func (p *NamePrinter) PrintObj(obj runtime.Object, w io.Writer) error {
- // we use reflect.Indirect here in order to obtain the actual value from a pointer.
- // using reflect.Indirect indiscriminately is valid here, as all runtime.Objects are supposed to be pointers.
- // we need an actual value in order to retrieve the package path for an object.
- if InternalObjectPreventer.IsForbidden(reflect.Indirect(reflect.ValueOf(obj)).Type().PkgPath()) {
- return fmt.Errorf(InternalObjectPrinterErr)
- }
-
- if meta.IsListType(obj) {
- // we allow unstructured lists for now because they always contain the GVK information. We should chase down
- // callers and stop them from passing unflattened lists
- // TODO chase the caller that is setting this and remove it.
- if _, ok := obj.(*unstructured.UnstructuredList); !ok {
- return fmt.Errorf("list types are not supported by name printing: %T", obj)
- }
-
- items, err := meta.ExtractList(obj)
- if err != nil {
- return err
- }
- for _, obj := range items {
- if err := p.PrintObj(obj, w); err != nil {
- return err
- }
- }
- return nil
- }
-
- if obj.GetObjectKind().GroupVersionKind().Empty() {
- return fmt.Errorf("missing apiVersion or kind; try GetObjectKind().SetGroupVersionKind() if you know the type")
- }
-
- name := ""
- if acc, err := meta.Accessor(obj); err == nil {
- if n := acc.GetName(); len(n) > 0 {
- name = n
- }
- }
-
- return printObj(w, name, p.Operation, p.ShortOutput, GetObjectGroupKind(obj))
-}
-
-func GetObjectGroupKind(obj runtime.Object) schema.GroupKind {
- if obj == nil {
- return schema.GroupKind{Kind: ""}
- }
- groupVersionKind := obj.GetObjectKind().GroupVersionKind()
- if len(groupVersionKind.Kind) > 0 {
- return groupVersionKind.GroupKind()
- }
-
- if uns, ok := obj.(*unstructured.Unstructured); ok {
- if len(uns.GroupVersionKind().Kind) > 0 {
- return uns.GroupVersionKind().GroupKind()
- }
- }
-
- return schema.GroupKind{Kind: ""}
-}
-
-func printObj(w io.Writer, name string, operation string, shortOutput bool, groupKind schema.GroupKind) error {
- if len(groupKind.Kind) == 0 {
- return fmt.Errorf("missing kind for resource with name %v", name)
- }
-
- if len(operation) > 0 {
- operation = " " + operation
- }
-
- if shortOutput {
- operation = ""
- }
-
- if len(groupKind.Group) == 0 {
- fmt.Fprintf(w, "%s/%s%s\n", strings.ToLower(groupKind.Kind), name, operation)
- return nil
- }
-
- fmt.Fprintf(w, "%s.%s/%s%s\n", strings.ToLower(groupKind.Kind), groupKind.Group, name, operation)
- return nil
-}
diff --git a/vendor/k8s.io/cli-runtime/pkg/genericclioptions/printers/sourcechecker.go b/vendor/k8s.io/cli-runtime/pkg/genericclioptions/printers/sourcechecker.go
deleted file mode 100644
index e360c8fe0b..0000000000
--- a/vendor/k8s.io/cli-runtime/pkg/genericclioptions/printers/sourcechecker.go
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
-Copyright 2018 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
-
-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.
-*/
-
-package printers
-
-import (
- "strings"
-)
-
-var (
- InternalObjectPrinterErr = "a versioned object must be passed to a printer"
-
- // disallowedPackagePrefixes contains regular expression templates
- // for object package paths that are not allowed by printers.
- disallowedPackagePrefixes = []string{
- "k8s.io/kubernetes/pkg/apis/",
- }
-)
-
-var InternalObjectPreventer = &illegalPackageSourceChecker{disallowedPackagePrefixes}
-
-func IsInternalObjectError(err error) bool {
- if err == nil {
- return false
- }
-
- return err.Error() == InternalObjectPrinterErr
-}
-
-// illegalPackageSourceChecker compares a given
-// object's package path, and determines if the
-// object originates from a disallowed source.
-type illegalPackageSourceChecker struct {
- // disallowedPrefixes is a slice of disallowed package path
- // prefixes for a given runtime.Object that we are printing.
- disallowedPrefixes []string
-}
-
-func (c *illegalPackageSourceChecker) IsForbidden(pkgPath string) bool {
- for _, forbiddenPrefix := range c.disallowedPrefixes {
- if strings.HasPrefix(pkgPath, forbiddenPrefix) || strings.Contains(pkgPath, "/vendor/"+forbiddenPrefix) {
- return true
- }
- }
-
- return false
-}
diff --git a/vendor/k8s.io/cli-runtime/pkg/genericclioptions/printers/template.go b/vendor/k8s.io/cli-runtime/pkg/genericclioptions/printers/template.go
deleted file mode 100644
index 5dd807dad9..0000000000
--- a/vendor/k8s.io/cli-runtime/pkg/genericclioptions/printers/template.go
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
-Copyright 2017 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
-
-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.
-*/
-
-package printers
-
-import (
- "encoding/base64"
- "encoding/json"
- "fmt"
- "io"
- "reflect"
- "text/template"
-
- "k8s.io/apimachinery/pkg/runtime"
-)
-
-// GoTemplatePrinter is an implementation of ResourcePrinter which formats data with a Go Template.
-type GoTemplatePrinter struct {
- rawTemplate string
- template *template.Template
-}
-
-func NewGoTemplatePrinter(tmpl []byte) (*GoTemplatePrinter, error) {
- t, err := template.New("output").
- Funcs(template.FuncMap{
- "exists": exists,
- "base64decode": base64decode,
- }).
- Parse(string(tmpl))
- if err != nil {
- return nil, err
- }
- return &GoTemplatePrinter{
- rawTemplate: string(tmpl),
- template: t,
- }, nil
-}
-
-// AllowMissingKeys tells the template engine if missing keys are allowed.
-func (p *GoTemplatePrinter) AllowMissingKeys(allow bool) {
- if allow {
- p.template.Option("missingkey=default")
- } else {
- p.template.Option("missingkey=error")
- }
-}
-
-// PrintObj formats the obj with the Go Template.
-func (p *GoTemplatePrinter) PrintObj(obj runtime.Object, w io.Writer) error {
- if InternalObjectPreventer.IsForbidden(reflect.Indirect(reflect.ValueOf(obj)).Type().PkgPath()) {
- return fmt.Errorf(InternalObjectPrinterErr)
- }
-
- var data []byte
- var err error
- data, err = json.Marshal(obj)
- if err != nil {
- return err
- }
-
- out := map[string]interface{}{}
- if err := json.Unmarshal(data, &out); err != nil {
- return err
- }
- if err = p.safeExecute(w, out); err != nil {
- // It is way easier to debug this stuff when it shows up in
- // stdout instead of just stdin. So in addition to returning
- // a nice error, also print useful stuff with the writer.
- fmt.Fprintf(w, "Error executing template: %v. Printing more information for debugging the template:\n", err)
- fmt.Fprintf(w, "\ttemplate was:\n\t\t%v\n", p.rawTemplate)
- fmt.Fprintf(w, "\traw data was:\n\t\t%v\n", string(data))
- fmt.Fprintf(w, "\tobject given to template engine was:\n\t\t%+v\n\n", out)
- return fmt.Errorf("error executing template %q: %v", p.rawTemplate, err)
- }
- return nil
-}
-
-// safeExecute tries to execute the template, but catches panics and returns an error
-// should the template engine panic.
-func (p *GoTemplatePrinter) safeExecute(w io.Writer, obj interface{}) error {
- var panicErr error
- // Sorry for the double anonymous function. There's probably a clever way
- // to do this that has the defer'd func setting the value to be returned, but
- // that would be even less obvious.
- retErr := func() error {
- defer func() {
- if x := recover(); x != nil {
- panicErr = fmt.Errorf("caught panic: %+v", x)
- }
- }()
- return p.template.Execute(w, obj)
- }()
- if panicErr != nil {
- return panicErr
- }
- return retErr
-}
-
-func base64decode(v string) (string, error) {
- data, err := base64.StdEncoding.DecodeString(v)
- if err != nil {
- return "", fmt.Errorf("base64 decode failed: %v", err)
- }
- return string(data), nil
-}
diff --git a/vendor/k8s.io/cli-runtime/pkg/genericclioptions/printers/typesetter.go b/vendor/k8s.io/cli-runtime/pkg/genericclioptions/printers/typesetter.go
deleted file mode 100644
index 8d2d9b56ec..0000000000
--- a/vendor/k8s.io/cli-runtime/pkg/genericclioptions/printers/typesetter.go
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
-Copyright 2018 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
-
-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.
-*/
-
-package printers
-
-import (
- "fmt"
- "io"
-
- "k8s.io/apimachinery/pkg/runtime"
- "k8s.io/apimachinery/pkg/runtime/schema"
-)
-
-// TypeSetterPrinter is an implementation of ResourcePrinter wraps another printer with types set on the objects
-type TypeSetterPrinter struct {
- Delegate ResourcePrinter
-
- Typer runtime.ObjectTyper
-}
-
-// NewTypeSetter constructs a wrapping printer with required params
-func NewTypeSetter(typer runtime.ObjectTyper) *TypeSetterPrinter {
- return &TypeSetterPrinter{Typer: typer}
-}
-
-// PrintObj is an implementation of ResourcePrinter.PrintObj which sets type information on the obj for the duration
-// of printing. It is NOT threadsafe.
-func (p *TypeSetterPrinter) PrintObj(obj runtime.Object, w io.Writer) error {
- if obj == nil {
- return p.Delegate.PrintObj(obj, w)
- }
- if !obj.GetObjectKind().GroupVersionKind().Empty() {
- return p.Delegate.PrintObj(obj, w)
- }
-
- // we were empty coming in, make sure we're empty going out. This makes the call thread-unsafe
- defer func() {
- obj.GetObjectKind().SetGroupVersionKind(schema.GroupVersionKind{})
- }()
-
- gvks, _, err := p.Typer.ObjectKinds(obj)
- if err != nil {
- // printers wrapped by us expect to find the type information present
- return fmt.Errorf("missing apiVersion or kind and cannot assign it; %v", err)
- }
-
- for _, gvk := range gvks {
- if len(gvk.Kind) == 0 {
- continue
- }
- if len(gvk.Version) == 0 || gvk.Version == runtime.APIVersionInternal {
- continue
- }
- obj.GetObjectKind().SetGroupVersionKind(gvk)
- break
- }
-
- return p.Delegate.PrintObj(obj, w)
-}
-
-// ToPrinter returns a printer (not threadsafe!) that has been wrapped
-func (p *TypeSetterPrinter) ToPrinter(delegate ResourcePrinter) ResourcePrinter {
- if p == nil {
- return delegate
- }
-
- p.Delegate = delegate
- return p
-}
-
-// WrapToPrinter wraps the common ToPrinter method
-func (p *TypeSetterPrinter) WrapToPrinter(delegate ResourcePrinter, err error) (ResourcePrinter, error) {
- if err != nil {
- return delegate, err
- }
- if p == nil {
- return delegate, nil
- }
-
- p.Delegate = delegate
- return p, nil
-}
diff --git a/vendor/k8s.io/cli-runtime/pkg/genericclioptions/record_flags.go b/vendor/k8s.io/cli-runtime/pkg/genericclioptions/record_flags.go
deleted file mode 100644
index faf250d53c..0000000000
--- a/vendor/k8s.io/cli-runtime/pkg/genericclioptions/record_flags.go
+++ /dev/null
@@ -1,199 +0,0 @@
-/*
-Copyright 2018 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
-
-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.
-*/
-
-package genericclioptions
-
-import (
- "os"
- "path/filepath"
- "strings"
-
- "github.com/evanphx/json-patch"
- "github.com/spf13/cobra"
- "github.com/spf13/pflag"
-
- "k8s.io/apimachinery/pkg/api/meta"
- "k8s.io/apimachinery/pkg/runtime"
- "k8s.io/apimachinery/pkg/util/json"
-)
-
-// ChangeCauseAnnotation is the annotation indicating a guess at "why" something was changed
-const ChangeCauseAnnotation = "kubernetes.io/change-cause"
-
-// RecordFlags contains all flags associated with the "--record" operation
-type RecordFlags struct {
- // Record indicates the state of the recording flag. It is a pointer so a caller can opt out or rebind
- Record *bool
-
- changeCause string
-}
-
-// ToRecorder returns a ChangeCause recorder if --record=false was not
-// explicitly given by the user
-func (f *RecordFlags) ToRecorder() (Recorder, error) {
- if f == nil {
- return NoopRecorder{}, nil
- }
-
- shouldRecord := false
- if f.Record != nil {
- shouldRecord = *f.Record
- }
-
- // if flag was explicitly set to false by the user,
- // do not record
- if !shouldRecord {
- return NoopRecorder{}, nil
- }
-
- return &ChangeCauseRecorder{
- changeCause: f.changeCause,
- }, nil
-}
-
-// Complete is called before the command is run, but after it is invoked to finish the state of the struct before use.
-func (f *RecordFlags) Complete(cmd *cobra.Command) error {
- if f == nil {
- return nil
- }
-
- f.changeCause = parseCommandArguments(cmd)
- return nil
-}
-
-func (f *RecordFlags) CompleteWithChangeCause(cause string) error {
- if f == nil {
- return nil
- }
-
- f.changeCause = cause
- return nil
-}
-
-// AddFlags binds the requested flags to the provided flagset
-// TODO have this only take a flagset
-func (f *RecordFlags) AddFlags(cmd *cobra.Command) {
- if f == nil {
- return
- }
-
- if f.Record != nil {
- cmd.Flags().BoolVar(f.Record, "record", *f.Record, "Record current kubectl command in the resource annotation. If set to false, do not record the command. If set to true, record the command. If not set, default to updating the existing annotation value only if one already exists.")
- }
-}
-
-// NewRecordFlags provides a RecordFlags with reasonable default values set for use
-func NewRecordFlags() *RecordFlags {
- record := false
-
- return &RecordFlags{
- Record: &record,
- }
-}
-
-// Recorder is used to record why a runtime.Object was changed in an annotation.
-type Recorder interface {
- // Record records why a runtime.Object was changed in an annotation.
- Record(runtime.Object) error
- MakeRecordMergePatch(runtime.Object) ([]byte, error)
-}
-
-// NoopRecorder does nothing. It is a "do nothing" that can be returned so code doesn't switch on it.
-type NoopRecorder struct{}
-
-// Record implements Recorder
-func (r NoopRecorder) Record(obj runtime.Object) error {
- return nil
-}
-
-// MakeRecordMergePatch implements Recorder
-func (r NoopRecorder) MakeRecordMergePatch(obj runtime.Object) ([]byte, error) {
- return nil, nil
-}
-
-// ChangeCauseRecorder annotates a "change-cause" to an input runtime object
-type ChangeCauseRecorder struct {
- changeCause string
-}
-
-// Record annotates a "change-cause" to a given info if either "shouldRecord" is true,
-// or the resource info previously contained a "change-cause" annotation.
-func (r *ChangeCauseRecorder) Record(obj runtime.Object) error {
- accessor, err := meta.Accessor(obj)
- if err != nil {
- return err
- }
- annotations := accessor.GetAnnotations()
- if annotations == nil {
- annotations = make(map[string]string)
- }
- annotations[ChangeCauseAnnotation] = r.changeCause
- accessor.SetAnnotations(annotations)
- return nil
-}
-
-// MakeRecordMergePatch produces a merge patch for updating the recording annotation.
-func (r *ChangeCauseRecorder) MakeRecordMergePatch(obj runtime.Object) ([]byte, error) {
- // copy so we don't mess with the original
- objCopy := obj.DeepCopyObject()
- if err := r.Record(objCopy); err != nil {
- return nil, err
- }
-
- oldData, err := json.Marshal(obj)
- if err != nil {
- return nil, err
- }
- newData, err := json.Marshal(objCopy)
- if err != nil {
- return nil, err
- }
-
- return jsonpatch.CreateMergePatch(oldData, newData)
-}
-
-// parseCommandArguments will stringify and return all environment arguments ie. a command run by a client
-// using the factory.
-// Set showSecrets false to filter out stuff like secrets.
-func parseCommandArguments(cmd *cobra.Command) string {
- if len(os.Args) == 0 {
- return ""
- }
-
- flags := ""
- parseFunc := func(flag *pflag.Flag, value string) error {
- flags = flags + " --" + flag.Name
- if set, ok := flag.Annotations["classified"]; !ok || len(set) == 0 {
- flags = flags + "=" + value
- } else {
- flags = flags + "=CLASSIFIED"
- }
- return nil
- }
- var err error
- err = cmd.Flags().ParseAll(os.Args[1:], parseFunc)
- if err != nil || !cmd.Flags().Parsed() {
- return ""
- }
-
- args := ""
- if arguments := cmd.Flags().Args(); len(arguments) > 0 {
- args = " " + strings.Join(arguments, " ")
- }
-
- base := filepath.Base(os.Args[0])
- return base + args + flags
-}
diff --git a/vendor/k8s.io/cli-runtime/pkg/genericclioptions/resource/builder.go b/vendor/k8s.io/cli-runtime/pkg/genericclioptions/resource/builder.go
deleted file mode 100644
index 22680c517c..0000000000
--- a/vendor/k8s.io/cli-runtime/pkg/genericclioptions/resource/builder.go
+++ /dev/null
@@ -1,1166 +0,0 @@
-/*
-Copyright 2014 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
-
-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.
-*/
-
-package resource
-
-import (
- "errors"
- "fmt"
- "io"
- "net/url"
- "os"
- "strings"
- "sync"
-
- "k8s.io/apimachinery/pkg/api/meta"
- metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
- "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
- "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured/unstructuredscheme"
- "k8s.io/apimachinery/pkg/labels"
- "k8s.io/apimachinery/pkg/runtime"
- "k8s.io/apimachinery/pkg/runtime/schema"
- "k8s.io/apimachinery/pkg/runtime/serializer"
- utilerrors "k8s.io/apimachinery/pkg/util/errors"
- "k8s.io/apimachinery/pkg/util/sets"
- "k8s.io/client-go/restmapper"
-)
-
-var FileExtensions = []string{".json", ".yaml", ".yml"}
-var InputExtensions = append(FileExtensions, "stdin")
-
-const defaultHttpGetAttempts int = 3
-
-// Builder provides convenience functions for taking arguments and parameters
-// from the command line and converting them to a list of resources to iterate
-// over using the Visitor interface.
-type Builder struct {
- categoryExpanderFn CategoryExpanderFunc
-
- // mapper is set explicitly by resource builders
- mapper *mapper
-
- // clientConfigFn is a function to produce a client, *if* you need one
- clientConfigFn ClientConfigFunc
-
- restMapperFn RESTMapperFunc
-
- // objectTyper is statically determinant per-command invocation based on your internal or unstructured choice
- // it does not ever need to rely upon discovery.
- objectTyper runtime.ObjectTyper
-
- // codecFactory describes which codecs you want to use
- negotiatedSerializer runtime.NegotiatedSerializer
-
- // local indicates that we cannot make server calls
- local bool
-
- errs []error
-
- paths []Visitor
- stream bool
- dir bool
-
- labelSelector *string
- fieldSelector *string
- selectAll bool
- includeUninitialized bool
- limitChunks int64
- requestTransforms []RequestTransform
-
- resources []string
-
- namespace string
- allNamespace bool
- names []string
-
- resourceTuples []resourceTuple
-
- defaultNamespace bool
- requireNamespace bool
-
- flatten bool
- latest bool
-
- requireObject bool
-
- singleResourceType bool
- continueOnError bool
-
- singleItemImplied bool
-
- export bool
-
- schema ContentValidator
-
- // fakeClientFn is used for testing
- fakeClientFn FakeClientFunc
-}
-
-var missingResourceError = fmt.Errorf(`You must provide one or more resources by argument or filename.
-Example resource specifications include:
- '-f rsrc.yaml'
- '--filename=rsrc.json'
- ' '
- ''`)
-
-var LocalResourceError = errors.New(`error: you must specify resources by --filename when --local is set.
-Example resource specifications include:
- '-f rsrc.yaml'
- '--filename=rsrc.json'`)
-
-// TODO: expand this to include other errors.
-func IsUsageError(err error) bool {
- if err == nil {
- return false
- }
- return err == missingResourceError
-}
-
-type FilenameOptions struct {
- Filenames []string
- Recursive bool
-}
-
-type resourceTuple struct {
- Resource string
- Name string
-}
-
-type FakeClientFunc func(version schema.GroupVersion) (RESTClient, error)
-
-func NewFakeBuilder(fakeClientFn FakeClientFunc, restMapper RESTMapperFunc, categoryExpander CategoryExpanderFunc) *Builder {
- ret := newBuilder(nil, restMapper, categoryExpander)
- ret.fakeClientFn = fakeClientFn
- return ret
-}
-
-// NewBuilder creates a builder that operates on generic objects. At least one of
-// internal or unstructured must be specified.
-// TODO: Add versioned client (although versioned is still lossy)
-// TODO remove internal and unstructured mapper and instead have them set the negotiated serializer for use in the client
-func newBuilder(clientConfigFn ClientConfigFunc, restMapper RESTMapperFunc, categoryExpander CategoryExpanderFunc) *Builder {
- return &Builder{
- clientConfigFn: clientConfigFn,
- restMapperFn: restMapper,
- categoryExpanderFn: categoryExpander,
- requireObject: true,
- }
-}
-
-func NewBuilder(restClientGetter RESTClientGetter) *Builder {
- categoryExpanderFn := func() (restmapper.CategoryExpander, error) {
- discoveryClient, err := restClientGetter.ToDiscoveryClient()
- if err != nil {
- return nil, err
- }
- return restmapper.NewDiscoveryCategoryExpander(discoveryClient), err
- }
-
- return newBuilder(
- restClientGetter.ToRESTConfig,
- (&cachingRESTMapperFunc{delegate: restClientGetter.ToRESTMapper}).ToRESTMapper,
- (&cachingCategoryExpanderFunc{delegate: categoryExpanderFn}).ToCategoryExpander,
- )
-}
-
-func (b *Builder) Schema(schema ContentValidator) *Builder {
- b.schema = schema
- return b
-}
-
-func (b *Builder) AddError(err error) *Builder {
- if err == nil {
- return b
- }
- b.errs = append(b.errs, err)
- return b
-}
-
-// FilenameParam groups input in two categories: URLs and files (files, directories, STDIN)
-// If enforceNamespace is false, namespaces in the specs will be allowed to
-// override the default namespace. If it is true, namespaces that don't match
-// will cause an error.
-// If ContinueOnError() is set prior to this method, objects on the path that are not
-// recognized will be ignored (but logged at V(2)).
-func (b *Builder) FilenameParam(enforceNamespace bool, filenameOptions *FilenameOptions) *Builder {
- recursive := filenameOptions.Recursive
- paths := filenameOptions.Filenames
- for _, s := range paths {
- switch {
- case s == "-":
- b.Stdin()
- case strings.Index(s, "http://") == 0 || strings.Index(s, "https://") == 0:
- url, err := url.Parse(s)
- if err != nil {
- b.errs = append(b.errs, fmt.Errorf("the URL passed to filename %q is not valid: %v", s, err))
- continue
- }
- b.URL(defaultHttpGetAttempts, url)
- default:
- if !recursive {
- b.singleItemImplied = true
- }
- b.Path(recursive, s)
- }
- }
-
- if enforceNamespace {
- b.RequireNamespace()
- }
-
- return b
-}
-
-// Unstructured updates the builder so that it will request and send unstructured
-// objects. Unstructured objects preserve all fields sent by the server in a map format
-// based on the object's JSON structure which means no data is lost when the client
-// reads and then writes an object. Use this mode in preference to Internal unless you
-// are working with Go types directly.
-func (b *Builder) Unstructured() *Builder {
- if b.mapper != nil {
- b.errs = append(b.errs, fmt.Errorf("another mapper was already selected, cannot use unstructured types"))
- return b
- }
- b.objectTyper = unstructuredscheme.NewUnstructuredObjectTyper()
- b.mapper = &mapper{
- localFn: b.isLocal,
- restMapperFn: b.restMapperFn,
- clientFn: b.getClient,
- decoder: unstructured.UnstructuredJSONScheme,
- }
-
- return b
-}
-
-// WithScheme uses the scheme to manage typing, conversion (optional), and decoding. If decodingVersions
-// is empty, then you can end up with internal types. You have been warned.
-func (b *Builder) WithScheme(scheme *runtime.Scheme, decodingVersions ...schema.GroupVersion) *Builder {
- if b.mapper != nil {
- b.errs = append(b.errs, fmt.Errorf("another mapper was already selected, cannot use internal types"))
- return b
- }
- b.objectTyper = scheme
- codecFactory := serializer.NewCodecFactory(scheme)
- negotiatedSerializer := runtime.NegotiatedSerializer(codecFactory)
- // if you specified versions, you're specifying a desire for external types, which you don't want to round-trip through
- // internal types
- if len(decodingVersions) > 0 {
- negotiatedSerializer = &serializer.DirectCodecFactory{CodecFactory: codecFactory}
- }
- b.negotiatedSerializer = negotiatedSerializer
-
- b.mapper = &mapper{
- localFn: b.isLocal,
- restMapperFn: b.restMapperFn,
- clientFn: b.getClient,
- decoder: codecFactory.UniversalDecoder(decodingVersions...),
- }
-
- return b
-}
-
-// LocalParam calls Local() if local is true.
-func (b *Builder) LocalParam(local bool) *Builder {
- if local {
- b.Local()
- }
- return b
-}
-
-// Local will avoid asking the server for results.
-func (b *Builder) Local() *Builder {
- b.local = true
- return b
-}
-
-func (b *Builder) isLocal() bool {
- return b.local
-}
-
-// Mapper returns a copy of the current mapper.
-func (b *Builder) Mapper() *mapper {
- mapper := *b.mapper
- return &mapper
-}
-
-// URL accepts a number of URLs directly.
-func (b *Builder) URL(httpAttemptCount int, urls ...*url.URL) *Builder {
- for _, u := range urls {
- b.paths = append(b.paths, &URLVisitor{
- URL: u,
- StreamVisitor: NewStreamVisitor(nil, b.mapper, u.String(), b.schema),
- HttpAttemptCount: httpAttemptCount,
- })
- }
- return b
-}
-
-// Stdin will read objects from the standard input. If ContinueOnError() is set
-// prior to this method being called, objects in the stream that are unrecognized
-// will be ignored (but logged at V(2)).
-func (b *Builder) Stdin() *Builder {
- b.stream = true
- b.paths = append(b.paths, FileVisitorForSTDIN(b.mapper, b.schema))
- return b
-}
-
-// Stream will read objects from the provided reader, and if an error occurs will
-// include the name string in the error message. If ContinueOnError() is set
-// prior to this method being called, objects in the stream that are unrecognized
-// will be ignored (but logged at V(2)).
-func (b *Builder) Stream(r io.Reader, name string) *Builder {
- b.stream = true
- b.paths = append(b.paths, NewStreamVisitor(r, b.mapper, name, b.schema))
- return b
-}
-
-// Path accepts a set of paths that may be files, directories (all can containing
-// one or more resources). Creates a FileVisitor for each file and then each
-// FileVisitor is streaming the content to a StreamVisitor. If ContinueOnError() is set
-// prior to this method being called, objects on the path that are unrecognized will be
-// ignored (but logged at V(2)).
-func (b *Builder) Path(recursive bool, paths ...string) *Builder {
- for _, p := range paths {
- _, err := os.Stat(p)
- if os.IsNotExist(err) {
- b.errs = append(b.errs, fmt.Errorf("the path %q does not exist", p))
- continue
- }
- if err != nil {
- b.errs = append(b.errs, fmt.Errorf("the path %q cannot be accessed: %v", p, err))
- continue
- }
-
- visitors, err := ExpandPathsToFileVisitors(b.mapper, p, recursive, FileExtensions, b.schema)
- if err != nil {
- b.errs = append(b.errs, fmt.Errorf("error reading %q: %v", p, err))
- }
- if len(visitors) > 1 {
- b.dir = true
- }
-
- b.paths = append(b.paths, visitors...)
- }
- if len(b.paths) == 0 && len(b.errs) == 0 {
- b.errs = append(b.errs, fmt.Errorf("error reading %v: recognized file extensions are %v", paths, FileExtensions))
- }
- return b
-}
-
-// ResourceTypes is a list of types of resources to operate on, when listing objects on
-// the server or retrieving objects that match a selector.
-func (b *Builder) ResourceTypes(types ...string) *Builder {
- b.resources = append(b.resources, types...)
- return b
-}
-
-// ResourceNames accepts a default type and one or more names, and creates tuples of
-// resources
-func (b *Builder) ResourceNames(resource string, names ...string) *Builder {
- for _, name := range names {
- // See if this input string is of type/name format
- tuple, ok, err := splitResourceTypeName(name)
- if err != nil {
- b.errs = append(b.errs, err)
- return b
- }
-
- if ok {
- b.resourceTuples = append(b.resourceTuples, tuple)
- continue
- }
- if len(resource) == 0 {
- b.errs = append(b.errs, fmt.Errorf("the argument %q must be RESOURCE/NAME", name))
- continue
- }
-
- // Use the given default type to create a resource tuple
- b.resourceTuples = append(b.resourceTuples, resourceTuple{Resource: resource, Name: name})
- }
- return b
-}
-
-// LabelSelectorParam defines a selector that should be applied to the object types to load.
-// This will not affect files loaded from disk or URL. If the parameter is empty it is
-// a no-op - to select all resources invoke `b.LabelSelector(labels.Everything.String)`.
-func (b *Builder) LabelSelectorParam(s string) *Builder {
- selector := strings.TrimSpace(s)
- if len(selector) == 0 {
- return b
- }
- if b.selectAll {
- b.errs = append(b.errs, fmt.Errorf("found non-empty label selector %q with previously set 'all' parameter. ", s))
- return b
- }
- return b.LabelSelector(selector)
-}
-
-// LabelSelector accepts a selector directly and will filter the resulting list by that object.
-// Use LabelSelectorParam instead for user input.
-func (b *Builder) LabelSelector(selector string) *Builder {
- if len(selector) == 0 {
- return b
- }
-
- b.labelSelector = &selector
- return b
-}
-
-// FieldSelectorParam defines a selector that should be applied to the object types to load.
-// This will not affect files loaded from disk or URL. If the parameter is empty it is
-// a no-op - to select all resources.
-func (b *Builder) FieldSelectorParam(s string) *Builder {
- s = strings.TrimSpace(s)
- if len(s) == 0 {
- return b
- }
- if b.selectAll {
- b.errs = append(b.errs, fmt.Errorf("found non-empty field selector %q with previously set 'all' parameter. ", s))
- return b
- }
- b.fieldSelector = &s
- return b
-}
-
-// ExportParam accepts the export boolean for these resources
-func (b *Builder) ExportParam(export bool) *Builder {
- b.export = export
- return b
-}
-
-// IncludeUninitialized accepts the include-uninitialized boolean for these resources
-func (b *Builder) IncludeUninitialized(includeUninitialized bool) *Builder {
- b.includeUninitialized = includeUninitialized
- return b
-}
-
-// NamespaceParam accepts the namespace that these resources should be
-// considered under from - used by DefaultNamespace() and RequireNamespace()
-func (b *Builder) NamespaceParam(namespace string) *Builder {
- b.namespace = namespace
- return b
-}
-
-// DefaultNamespace instructs the builder to set the namespace value for any object found
-// to NamespaceParam() if empty.
-func (b *Builder) DefaultNamespace() *Builder {
- b.defaultNamespace = true
- return b
-}
-
-// AllNamespaces instructs the builder to metav1.NamespaceAll as a namespace to request resources
-// across all of the namespace. This overrides the namespace set by NamespaceParam().
-func (b *Builder) AllNamespaces(allNamespace bool) *Builder {
- if allNamespace {
- b.namespace = metav1.NamespaceAll
- }
- b.allNamespace = allNamespace
- return b
-}
-
-// RequireNamespace instructs the builder to set the namespace value for any object found
-// to NamespaceParam() if empty, and if the value on the resource does not match
-// NamespaceParam() an error will be returned.
-func (b *Builder) RequireNamespace() *Builder {
- b.requireNamespace = true
- return b
-}
-
-// RequestChunksOf attempts to load responses from the server in batches of size limit
-// to avoid long delays loading and transferring very large lists. If unset defaults to
-// no chunking.
-func (b *Builder) RequestChunksOf(chunkSize int64) *Builder {
- b.limitChunks = chunkSize
- return b
-}
-
-// TransformRequests alters API calls made by clients requested from this builder. Pass
-// an empty list to clear modifiers.
-func (b *Builder) TransformRequests(opts ...RequestTransform) *Builder {
- b.requestTransforms = opts
- return b
-}
-
-// SelectEverythingParam
-func (b *Builder) SelectAllParam(selectAll bool) *Builder {
- if selectAll && (b.labelSelector != nil || b.fieldSelector != nil) {
- b.errs = append(b.errs, fmt.Errorf("setting 'all' parameter but found a non empty selector. "))
- return b
- }
- b.selectAll = selectAll
- return b
-}
-
-// ResourceTypeOrNameArgs indicates that the builder should accept arguments
-// of the form `([,,...]| [,,...])`. When one argument is
-// received, the types provided will be retrieved from the server (and be comma delimited).
-// When two or more arguments are received, they must be a single type and resource name(s).
-// The allowEmptySelector permits to select all the resources (via Everything func).
-func (b *Builder) ResourceTypeOrNameArgs(allowEmptySelector bool, args ...string) *Builder {
- args = normalizeMultipleResourcesArgs(args)
- if ok, err := hasCombinedTypeArgs(args); ok {
- if err != nil {
- b.errs = append(b.errs, err)
- return b
- }
- for _, s := range args {
- tuple, ok, err := splitResourceTypeName(s)
- if err != nil {
- b.errs = append(b.errs, err)
- return b
- }
- if ok {
- b.resourceTuples = append(b.resourceTuples, tuple)
- }
- }
- return b
- }
- if len(args) > 0 {
- // Try replacing aliases only in types
- args[0] = b.ReplaceAliases(args[0])
- }
- switch {
- case len(args) > 2:
- b.names = append(b.names, args[1:]...)
- b.ResourceTypes(SplitResourceArgument(args[0])...)
- case len(args) == 2:
- b.names = append(b.names, args[1])
- b.ResourceTypes(SplitResourceArgument(args[0])...)
- case len(args) == 1:
- b.ResourceTypes(SplitResourceArgument(args[0])...)
- if b.labelSelector == nil && allowEmptySelector {
- selector := labels.Everything().String()
- b.labelSelector = &selector
- }
- case len(args) == 0:
- default:
- b.errs = append(b.errs, fmt.Errorf("arguments must consist of a resource or a resource and name"))
- }
- return b
-}
-
-// ReplaceAliases accepts an argument and tries to expand any existing
-// aliases found in it
-func (b *Builder) ReplaceAliases(input string) string {
- replaced := []string{}
- for _, arg := range strings.Split(input, ",") {
- if b.categoryExpanderFn == nil {
- continue
- }
- categoryExpander, err := b.categoryExpanderFn()
- if err != nil {
- b.AddError(err)
- continue
- }
-
- if resources, ok := categoryExpander.Expand(arg); ok {
- asStrings := []string{}
- for _, resource := range resources {
- if len(resource.Group) == 0 {
- asStrings = append(asStrings, resource.Resource)
- continue
- }
- asStrings = append(asStrings, resource.Resource+"."+resource.Group)
- }
- arg = strings.Join(asStrings, ",")
- }
- replaced = append(replaced, arg)
- }
- return strings.Join(replaced, ",")
-}
-
-func hasCombinedTypeArgs(args []string) (bool, error) {
- hasSlash := 0
- for _, s := range args {
- if strings.Contains(s, "/") {
- hasSlash++
- }
- }
- switch {
- case hasSlash > 0 && hasSlash == len(args):
- return true, nil
- case hasSlash > 0 && hasSlash != len(args):
- baseCmd := "cmd"
- if len(os.Args) > 0 {
- baseCmdSlice := strings.Split(os.Args[0], "/")
- baseCmd = baseCmdSlice[len(baseCmdSlice)-1]
- }
- return true, fmt.Errorf("there is no need to specify a resource type as a separate argument when passing arguments in resource/name form (e.g. '%s get resource/' instead of '%s get resource resource/'", baseCmd, baseCmd)
- default:
- return false, nil
- }
-}
-
-// Normalize args convert multiple resources to resource tuples, a,b,c d
-// as a transform to a/d b/d c/d
-func normalizeMultipleResourcesArgs(args []string) []string {
- if len(args) >= 2 {
- resources := []string{}
- resources = append(resources, SplitResourceArgument(args[0])...)
- if len(resources) > 1 {
- names := []string{}
- names = append(names, args[1:]...)
- newArgs := []string{}
- for _, resource := range resources {
- for _, name := range names {
- newArgs = append(newArgs, strings.Join([]string{resource, name}, "/"))
- }
- }
- return newArgs
- }
- }
- return args
-}
-
-// splitResourceTypeName handles type/name resource formats and returns a resource tuple
-// (empty or not), whether it successfully found one, and an error
-func splitResourceTypeName(s string) (resourceTuple, bool, error) {
- if !strings.Contains(s, "/") {
- return resourceTuple{}, false, nil
- }
- seg := strings.Split(s, "/")
- if len(seg) != 2 {
- return resourceTuple{}, false, fmt.Errorf("arguments in resource/name form may not have more than one slash")
- }
- resource, name := seg[0], seg[1]
- if len(resource) == 0 || len(name) == 0 || len(SplitResourceArgument(resource)) != 1 {
- return resourceTuple{}, false, fmt.Errorf("arguments in resource/name form must have a single resource and name")
- }
- return resourceTuple{Resource: resource, Name: name}, true, nil
-}
-
-// Flatten will convert any objects with a field named "Items" that is an array of runtime.Object
-// compatible types into individual entries and give them their own items. The original object
-// is not passed to any visitors.
-func (b *Builder) Flatten() *Builder {
- b.flatten = true
- return b
-}
-
-// Latest will fetch the latest copy of any objects loaded from URLs or files from the server.
-func (b *Builder) Latest() *Builder {
- b.latest = true
- return b
-}
-
-// RequireObject ensures that resulting infos have an object set. If false, resulting info may not have an object set.
-func (b *Builder) RequireObject(require bool) *Builder {
- b.requireObject = require
- return b
-}
-
-// ContinueOnError will attempt to load and visit as many objects as possible, even if some visits
-// return errors or some objects cannot be loaded. The default behavior is to terminate after
-// the first error is returned from a VisitorFunc.
-func (b *Builder) ContinueOnError() *Builder {
- b.continueOnError = true
- return b
-}
-
-// SingleResourceType will cause the builder to error if the user specifies more than a single type
-// of resource.
-func (b *Builder) SingleResourceType() *Builder {
- b.singleResourceType = true
- return b
-}
-
-// mappingFor returns the RESTMapping for the Kind given, or the Kind referenced by the resource.
-// Prefers a fully specified GroupVersionResource match. If one is not found, we match on a fully
-// specified GroupVersionKind, or fallback to a match on GroupKind.
-func (b *Builder) mappingFor(resourceOrKindArg string) (*meta.RESTMapping, error) {
- fullySpecifiedGVR, groupResource := schema.ParseResourceArg(resourceOrKindArg)
- gvk := schema.GroupVersionKind{}
- restMapper, err := b.restMapperFn()
- if err != nil {
- return nil, err
- }
-
- if fullySpecifiedGVR != nil {
- gvk, _ = restMapper.KindFor(*fullySpecifiedGVR)
- }
- if gvk.Empty() {
- gvk, _ = restMapper.KindFor(groupResource.WithVersion(""))
- }
- if !gvk.Empty() {
- return restMapper.RESTMapping(gvk.GroupKind(), gvk.Version)
- }
-
- fullySpecifiedGVK, groupKind := schema.ParseKindArg(resourceOrKindArg)
- if fullySpecifiedGVK == nil {
- gvk := groupKind.WithVersion("")
- fullySpecifiedGVK = &gvk
- }
-
- if !fullySpecifiedGVK.Empty() {
- if mapping, err := restMapper.RESTMapping(fullySpecifiedGVK.GroupKind(), fullySpecifiedGVK.Version); err == nil {
- return mapping, nil
- }
- }
-
- mapping, err := restMapper.RESTMapping(groupKind, gvk.Version)
- if err != nil {
- // if we error out here, it is because we could not match a resource or a kind
- // for the given argument. To maintain consistency with previous behavior,
- // announce that a resource type could not be found.
- // if the error is a URL error, then we had trouble doing discovery, so we should return the original
- // error since it may help a user diagnose what is actually wrong
- if _, ok := err.(*url.Error); ok {
- return nil, err
- }
- return nil, fmt.Errorf("the server doesn't have a resource type %q", groupResource.Resource)
- }
-
- return mapping, nil
-}
-
-func (b *Builder) resourceMappings() ([]*meta.RESTMapping, error) {
- if len(b.resources) > 1 && b.singleResourceType {
- return nil, fmt.Errorf("you may only specify a single resource type")
- }
- mappings := []*meta.RESTMapping{}
- seen := map[schema.GroupVersionKind]bool{}
- for _, r := range b.resources {
- mapping, err := b.mappingFor(r)
- if err != nil {
- return nil, err
- }
- // This ensures the mappings for resources(shortcuts, plural) unique
- if seen[mapping.GroupVersionKind] {
- continue
- }
- seen[mapping.GroupVersionKind] = true
-
- mappings = append(mappings, mapping)
- }
- return mappings, nil
-}
-
-func (b *Builder) resourceTupleMappings() (map[string]*meta.RESTMapping, error) {
- mappings := make(map[string]*meta.RESTMapping)
- canonical := make(map[schema.GroupVersionResource]struct{})
- for _, r := range b.resourceTuples {
- if _, ok := mappings[r.Resource]; ok {
- continue
- }
- mapping, err := b.mappingFor(r.Resource)
- if err != nil {
- return nil, err
- }
-
- mappings[r.Resource] = mapping
- canonical[mapping.Resource] = struct{}{}
- }
- if len(canonical) > 1 && b.singleResourceType {
- return nil, fmt.Errorf("you may only specify a single resource type")
- }
- return mappings, nil
-}
-
-func (b *Builder) visitorResult() *Result {
- if len(b.errs) > 0 {
- return &Result{err: utilerrors.NewAggregate(b.errs)}
- }
-
- if b.selectAll {
- selector := labels.Everything().String()
- b.labelSelector = &selector
- }
-
- // visit items specified by paths
- if len(b.paths) != 0 {
- return b.visitByPaths()
- }
-
- // visit selectors
- if b.labelSelector != nil || b.fieldSelector != nil {
- return b.visitBySelector()
- }
-
- // visit items specified by resource and name
- if len(b.resourceTuples) != 0 {
- return b.visitByResource()
- }
-
- // visit items specified by name
- if len(b.names) != 0 {
- return b.visitByName()
- }
-
- if len(b.resources) != 0 {
- return &Result{err: fmt.Errorf("resource(s) were provided, but no name, label selector, or --all flag specified")}
- }
- return &Result{err: missingResourceError}
-}
-
-func (b *Builder) visitBySelector() *Result {
- result := &Result{
- targetsSingleItems: false,
- }
-
- if len(b.names) != 0 {
- return result.withError(fmt.Errorf("name cannot be provided when a selector is specified"))
- }
- if len(b.resourceTuples) != 0 {
- return result.withError(fmt.Errorf("selectors and the all flag cannot be used when passing resource/name arguments"))
- }
- if len(b.resources) == 0 {
- return result.withError(fmt.Errorf("at least one resource must be specified to use a selector"))
- }
- mappings, err := b.resourceMappings()
- if err != nil {
- result.err = err
- return result
- }
-
- var labelSelector, fieldSelector string
- if b.labelSelector != nil {
- labelSelector = *b.labelSelector
- }
- if b.fieldSelector != nil {
- fieldSelector = *b.fieldSelector
- }
-
- visitors := []Visitor{}
- for _, mapping := range mappings {
- client, err := b.getClient(mapping.GroupVersionKind.GroupVersion())
- if err != nil {
- result.err = err
- return result
- }
- selectorNamespace := b.namespace
- if mapping.Scope.Name() != meta.RESTScopeNameNamespace {
- selectorNamespace = ""
- }
- visitors = append(visitors, NewSelector(client, mapping, selectorNamespace, labelSelector, fieldSelector, b.export, b.includeUninitialized, b.limitChunks))
- }
- if b.continueOnError {
- result.visitor = EagerVisitorList(visitors)
- } else {
- result.visitor = VisitorList(visitors)
- }
- result.sources = visitors
- return result
-}
-
-func (b *Builder) getClient(gv schema.GroupVersion) (RESTClient, error) {
- var (
- client RESTClient
- err error
- )
-
- switch {
- case b.fakeClientFn != nil:
- client, err = b.fakeClientFn(gv)
- case b.negotiatedSerializer != nil:
- client, err = b.clientConfigFn.clientForGroupVersion(gv, b.negotiatedSerializer)
- default:
- client, err = b.clientConfigFn.unstructuredClientForGroupVersion(gv)
- }
-
- if err != nil {
- return nil, err
- }
-
- return NewClientWithOptions(client, b.requestTransforms...), nil
-}
-
-func (b *Builder) visitByResource() *Result {
- // if b.singleItemImplied is false, this could be by default, so double-check length
- // of resourceTuples to determine if in fact it is singleItemImplied or not
- isSingleItemImplied := b.singleItemImplied
- if !isSingleItemImplied {
- isSingleItemImplied = len(b.resourceTuples) == 1
- }
-
- result := &Result{
- singleItemImplied: isSingleItemImplied,
- targetsSingleItems: true,
- }
-
- if len(b.resources) != 0 {
- return result.withError(fmt.Errorf("you may not specify individual resources and bulk resources in the same call"))
- }
-
- // retrieve one client for each resource
- mappings, err := b.resourceTupleMappings()
- if err != nil {
- result.err = err
- return result
- }
- clients := make(map[string]RESTClient)
- for _, mapping := range mappings {
- s := fmt.Sprintf("%s/%s", mapping.GroupVersionKind.GroupVersion().String(), mapping.Resource.Resource)
- if _, ok := clients[s]; ok {
- continue
- }
- client, err := b.getClient(mapping.GroupVersionKind.GroupVersion())
- if err != nil {
- result.err = err
- return result
- }
- clients[s] = client
- }
-
- items := []Visitor{}
- for _, tuple := range b.resourceTuples {
- mapping, ok := mappings[tuple.Resource]
- if !ok {
- return result.withError(fmt.Errorf("resource %q is not recognized: %v", tuple.Resource, mappings))
- }
- s := fmt.Sprintf("%s/%s", mapping.GroupVersionKind.GroupVersion().String(), mapping.Resource.Resource)
- client, ok := clients[s]
- if !ok {
- return result.withError(fmt.Errorf("could not find a client for resource %q", tuple.Resource))
- }
-
- selectorNamespace := b.namespace
- if mapping.Scope.Name() != meta.RESTScopeNameNamespace {
- selectorNamespace = ""
- } else {
- if len(b.namespace) == 0 {
- errMsg := "namespace may not be empty when retrieving a resource by name"
- if b.allNamespace {
- errMsg = "a resource cannot be retrieved by name across all namespaces"
- }
- return result.withError(fmt.Errorf(errMsg))
- }
- }
-
- info := &Info{
- Client: client,
- Mapping: mapping,
- Namespace: selectorNamespace,
- Name: tuple.Name,
- Export: b.export,
- }
- items = append(items, info)
- }
-
- var visitors Visitor
- if b.continueOnError {
- visitors = EagerVisitorList(items)
- } else {
- visitors = VisitorList(items)
- }
- result.visitor = visitors
- result.sources = items
- return result
-}
-
-func (b *Builder) visitByName() *Result {
- result := &Result{
- singleItemImplied: len(b.names) == 1,
- targetsSingleItems: true,
- }
-
- if len(b.paths) != 0 {
- return result.withError(fmt.Errorf("when paths, URLs, or stdin is provided as input, you may not specify a resource by arguments as well"))
- }
- if len(b.resources) == 0 {
- return result.withError(fmt.Errorf("you must provide a resource and a resource name together"))
- }
- if len(b.resources) > 1 {
- return result.withError(fmt.Errorf("you must specify only one resource"))
- }
-
- mappings, err := b.resourceMappings()
- if err != nil {
- result.err = err
- return result
- }
- mapping := mappings[0]
-
- client, err := b.getClient(mapping.GroupVersionKind.GroupVersion())
- if err != nil {
- result.err = err
- return result
- }
-
- selectorNamespace := b.namespace
- if mapping.Scope.Name() != meta.RESTScopeNameNamespace {
- selectorNamespace = ""
- } else {
- if len(b.namespace) == 0 {
- errMsg := "namespace may not be empty when retrieving a resource by name"
- if b.allNamespace {
- errMsg = "a resource cannot be retrieved by name across all namespaces"
- }
- return result.withError(fmt.Errorf(errMsg))
- }
- }
-
- visitors := []Visitor{}
- for _, name := range b.names {
- info := &Info{
- Client: client,
- Mapping: mapping,
- Namespace: selectorNamespace,
- Name: name,
- Export: b.export,
- }
- visitors = append(visitors, info)
- }
- result.visitor = VisitorList(visitors)
- result.sources = visitors
- return result
-}
-
-func (b *Builder) visitByPaths() *Result {
- result := &Result{
- singleItemImplied: !b.dir && !b.stream && len(b.paths) == 1,
- targetsSingleItems: true,
- }
-
- if len(b.resources) != 0 {
- return result.withError(fmt.Errorf("when paths, URLs, or stdin is provided as input, you may not specify resource arguments as well"))
- }
- if len(b.names) != 0 {
- return result.withError(fmt.Errorf("name cannot be provided when a path is specified"))
- }
- if len(b.resourceTuples) != 0 {
- return result.withError(fmt.Errorf("resource/name arguments cannot be provided when a path is specified"))
- }
-
- var visitors Visitor
- if b.continueOnError {
- visitors = EagerVisitorList(b.paths)
- } else {
- visitors = VisitorList(b.paths)
- }
-
- if b.flatten {
- visitors = NewFlattenListVisitor(visitors, b.objectTyper, b.mapper)
- }
-
- // only items from disk can be refetched
- if b.latest {
- // must set namespace prior to fetching
- if b.defaultNamespace {
- visitors = NewDecoratedVisitor(visitors, SetNamespace(b.namespace))
- }
- visitors = NewDecoratedVisitor(visitors, RetrieveLatest)
- }
- if b.labelSelector != nil {
- selector, err := labels.Parse(*b.labelSelector)
- if err != nil {
- return result.withError(fmt.Errorf("the provided selector %q is not valid: %v", b.labelSelector, err))
- }
- visitors = NewFilteredVisitor(visitors, FilterByLabelSelector(selector))
- }
- result.visitor = visitors
- result.sources = b.paths
- return result
-}
-
-// Do returns a Result object with a Visitor for the resources identified by the Builder.
-// The visitor will respect the error behavior specified by ContinueOnError. Note that stream
-// inputs are consumed by the first execution - use Infos() or Object() on the Result to capture a list
-// for further iteration.
-func (b *Builder) Do() *Result {
- r := b.visitorResult()
- r.mapper = b.Mapper()
- if r.err != nil {
- return r
- }
- if b.flatten {
- r.visitor = NewFlattenListVisitor(r.visitor, b.objectTyper, b.mapper)
- }
- helpers := []VisitorFunc{}
- if b.defaultNamespace {
- helpers = append(helpers, SetNamespace(b.namespace))
- }
- if b.requireNamespace {
- helpers = append(helpers, RequireNamespace(b.namespace))
- }
- helpers = append(helpers, FilterNamespace)
- if b.requireObject {
- helpers = append(helpers, RetrieveLazy)
- }
- r.visitor = NewDecoratedVisitor(r.visitor, helpers...)
- if b.continueOnError {
- r.visitor = ContinueOnErrorVisitor{r.visitor}
- }
- return r
-}
-
-// SplitResourceArgument splits the argument with commas and returns unique
-// strings in the original order.
-func SplitResourceArgument(arg string) []string {
- out := []string{}
- set := sets.NewString()
- for _, s := range strings.Split(arg, ",") {
- if set.Has(s) {
- continue
- }
- set.Insert(s)
- out = append(out, s)
- }
- return out
-}
-
-// HasNames returns true if the provided args contain resource names
-func HasNames(args []string) (bool, error) {
- args = normalizeMultipleResourcesArgs(args)
- hasCombinedTypes, err := hasCombinedTypeArgs(args)
- if err != nil {
- return false, err
- }
- return hasCombinedTypes || len(args) > 1, nil
-}
-
-type cachingRESTMapperFunc struct {
- delegate RESTMapperFunc
-
- lock sync.Mutex
- cached meta.RESTMapper
-}
-
-func (c *cachingRESTMapperFunc) ToRESTMapper() (meta.RESTMapper, error) {
- c.lock.Lock()
- defer c.lock.Unlock()
- if c.cached != nil {
- return c.cached, nil
- }
-
- ret, err := c.delegate()
- if err != nil {
- return nil, err
- }
- c.cached = ret
- return c.cached, nil
-}
-
-type cachingCategoryExpanderFunc struct {
- delegate CategoryExpanderFunc
-
- lock sync.Mutex
- cached restmapper.CategoryExpander
-}
-
-func (c *cachingCategoryExpanderFunc) ToCategoryExpander() (restmapper.CategoryExpander, error) {
- c.lock.Lock()
- defer c.lock.Unlock()
- if c.cached != nil {
- return c.cached, nil
- }
-
- ret, err := c.delegate()
- if err != nil {
- return nil, err
- }
- c.cached = ret
- return c.cached, nil
-}
diff --git a/vendor/k8s.io/cli-runtime/pkg/genericclioptions/resource/client.go b/vendor/k8s.io/cli-runtime/pkg/genericclioptions/resource/client.go
deleted file mode 100644
index 46380207f3..0000000000
--- a/vendor/k8s.io/cli-runtime/pkg/genericclioptions/resource/client.go
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
-Copyright 2018 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
-
-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.
-*/
-
-package resource
-
-import (
- "k8s.io/apimachinery/pkg/runtime"
- "k8s.io/apimachinery/pkg/runtime/schema"
- "k8s.io/client-go/rest"
-)
-
-// TODO require negotiatedSerializer. leaving it optional lets us plumb current behavior and deal with the difference after major plumbing is complete
-func (clientConfigFn ClientConfigFunc) clientForGroupVersion(gv schema.GroupVersion, negotiatedSerializer runtime.NegotiatedSerializer) (RESTClient, error) {
- cfg, err := clientConfigFn()
- if err != nil {
- return nil, err
- }
- if negotiatedSerializer != nil {
- cfg.ContentConfig.NegotiatedSerializer = negotiatedSerializer
- }
- cfg.GroupVersion = &gv
- if len(gv.Group) == 0 {
- cfg.APIPath = "/api"
- } else {
- cfg.APIPath = "/apis"
- }
-
- return rest.RESTClientFor(cfg)
-}
-
-func (clientConfigFn ClientConfigFunc) unstructuredClientForGroupVersion(gv schema.GroupVersion) (RESTClient, error) {
- cfg, err := clientConfigFn()
- if err != nil {
- return nil, err
- }
- cfg.ContentConfig = UnstructuredPlusDefaultContentConfig()
- cfg.GroupVersion = &gv
- if len(gv.Group) == 0 {
- cfg.APIPath = "/api"
- } else {
- cfg.APIPath = "/apis"
- }
-
- return rest.RESTClientFor(cfg)
-}
diff --git a/vendor/k8s.io/cli-runtime/pkg/genericclioptions/resource/doc.go b/vendor/k8s.io/cli-runtime/pkg/genericclioptions/resource/doc.go
deleted file mode 100644
index a0e22e7cf7..0000000000
--- a/vendor/k8s.io/cli-runtime/pkg/genericclioptions/resource/doc.go
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
-Copyright 2014 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
-
-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.
-*/
-
-// Package resource assists clients in dealing with RESTful objects that match the
-// Kubernetes API conventions. The Helper object provides simple CRUD operations
-// on resources. The Visitor interface makes it easy to deal with multiple resources
-// in bulk for retrieval and operation. The Builder object simplifies converting
-// standard command line arguments and parameters into a Visitor that can iterate
-// over all of the identified resources, whether on the server or on the local
-// filesystem.
-package resource
diff --git a/vendor/k8s.io/cli-runtime/pkg/genericclioptions/resource/fake.go b/vendor/k8s.io/cli-runtime/pkg/genericclioptions/resource/fake.go
deleted file mode 100644
index 276c343e21..0000000000
--- a/vendor/k8s.io/cli-runtime/pkg/genericclioptions/resource/fake.go
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
-Copyright 2017 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
-
-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.
-*/
-
-package resource
-
-import (
- "k8s.io/apimachinery/pkg/runtime/schema"
- "k8s.io/client-go/restmapper"
-)
-
-// FakeCategoryExpander is for testing only
-var FakeCategoryExpander restmapper.CategoryExpander = restmapper.SimpleCategoryExpander{
- Expansions: map[string][]schema.GroupResource{
- "all": {
- {Group: "", Resource: "pods"},
- {Group: "", Resource: "replicationcontrollers"},
- {Group: "", Resource: "services"},
- {Group: "apps", Resource: "statefulsets"},
- {Group: "autoscaling", Resource: "horizontalpodautoscalers"},
- {Group: "batch", Resource: "jobs"},
- {Group: "batch", Resource: "cronjobs"},
- {Group: "extensions", Resource: "daemonsets"},
- {Group: "extensions", Resource: "deployments"},
- {Group: "extensions", Resource: "replicasets"},
- },
- },
-}
diff --git a/vendor/k8s.io/cli-runtime/pkg/genericclioptions/resource/helper.go b/vendor/k8s.io/cli-runtime/pkg/genericclioptions/resource/helper.go
deleted file mode 100644
index 059d518af2..0000000000
--- a/vendor/k8s.io/cli-runtime/pkg/genericclioptions/resource/helper.go
+++ /dev/null
@@ -1,185 +0,0 @@
-/*
-Copyright 2014 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
-
-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.
-*/
-
-package resource
-
-import (
- "strconv"
-
- "k8s.io/apimachinery/pkg/api/meta"
- metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
- "k8s.io/apimachinery/pkg/fields"
- "k8s.io/apimachinery/pkg/runtime"
- "k8s.io/apimachinery/pkg/types"
- "k8s.io/apimachinery/pkg/watch"
-)
-
-var metadataAccessor = meta.NewAccessor()
-
-// Helper provides methods for retrieving or mutating a RESTful
-// resource.
-type Helper struct {
- // The name of this resource as the server would recognize it
- Resource string
- // A RESTClient capable of mutating this resource.
- RESTClient RESTClient
- // True if the resource type is scoped to namespaces
- NamespaceScoped bool
-}
-
-// NewHelper creates a Helper from a ResourceMapping
-func NewHelper(client RESTClient, mapping *meta.RESTMapping) *Helper {
- return &Helper{
- Resource: mapping.Resource.Resource,
- RESTClient: client,
- NamespaceScoped: mapping.Scope.Name() == meta.RESTScopeNameNamespace,
- }
-}
-
-func (m *Helper) Get(namespace, name string, export bool) (runtime.Object, error) {
- req := m.RESTClient.Get().
- NamespaceIfScoped(namespace, m.NamespaceScoped).
- Resource(m.Resource).
- Name(name)
- if export {
- // TODO: I should be part of GetOptions
- req.Param("export", strconv.FormatBool(export))
- }
- return req.Do().Get()
-}
-
-func (m *Helper) List(namespace, apiVersion string, export bool, options *metav1.ListOptions) (runtime.Object, error) {
- req := m.RESTClient.Get().
- NamespaceIfScoped(namespace, m.NamespaceScoped).
- Resource(m.Resource).
- VersionedParams(options, metav1.ParameterCodec)
- if export {
- // TODO: I should be part of ListOptions
- req.Param("export", strconv.FormatBool(export))
- }
- return req.Do().Get()
-}
-
-func (m *Helper) Watch(namespace, apiVersion string, options *metav1.ListOptions) (watch.Interface, error) {
- options.Watch = true
- return m.RESTClient.Get().
- NamespaceIfScoped(namespace, m.NamespaceScoped).
- Resource(m.Resource).
- VersionedParams(options, metav1.ParameterCodec).
- Watch()
-}
-
-func (m *Helper) WatchSingle(namespace, name, resourceVersion string) (watch.Interface, error) {
- return m.RESTClient.Get().
- NamespaceIfScoped(namespace, m.NamespaceScoped).
- Resource(m.Resource).
- VersionedParams(&metav1.ListOptions{
- ResourceVersion: resourceVersion,
- Watch: true,
- FieldSelector: fields.OneTermEqualSelector("metadata.name", name).String(),
- }, metav1.ParameterCodec).
- Watch()
-}
-
-func (m *Helper) Delete(namespace, name string) (runtime.Object, error) {
- return m.DeleteWithOptions(namespace, name, nil)
-}
-
-func (m *Helper) DeleteWithOptions(namespace, name string, options *metav1.DeleteOptions) (runtime.Object, error) {
- return m.RESTClient.Delete().
- NamespaceIfScoped(namespace, m.NamespaceScoped).
- Resource(m.Resource).
- Name(name).
- Body(options).
- Do().
- Get()
-}
-
-func (m *Helper) Create(namespace string, modify bool, obj runtime.Object, options *metav1.CreateOptions) (runtime.Object, error) {
- if options == nil {
- options = &metav1.CreateOptions{}
- }
- if modify {
- // Attempt to version the object based on client logic.
- version, err := metadataAccessor.ResourceVersion(obj)
- if err != nil {
- // We don't know how to clear the version on this object, so send it to the server as is
- return m.createResource(m.RESTClient, m.Resource, namespace, obj, options)
- }
- if version != "" {
- if err := metadataAccessor.SetResourceVersion(obj, ""); err != nil {
- return nil, err
- }
- }
- }
-
- return m.createResource(m.RESTClient, m.Resource, namespace, obj, options)
-}
-
-func (m *Helper) createResource(c RESTClient, resource, namespace string, obj runtime.Object, options *metav1.CreateOptions) (runtime.Object, error) {
- return c.Post().
- NamespaceIfScoped(namespace, m.NamespaceScoped).
- Resource(resource).
- VersionedParams(options, metav1.ParameterCodec).
- Body(obj).
- Do().
- Get()
-}
-func (m *Helper) Patch(namespace, name string, pt types.PatchType, data []byte, options *metav1.UpdateOptions) (runtime.Object, error) {
- if options == nil {
- options = &metav1.UpdateOptions{}
- }
- return m.RESTClient.Patch(pt).
- NamespaceIfScoped(namespace, m.NamespaceScoped).
- Resource(m.Resource).
- Name(name).
- VersionedParams(options, metav1.ParameterCodec).
- Body(data).
- Do().
- Get()
-}
-
-func (m *Helper) Replace(namespace, name string, overwrite bool, obj runtime.Object) (runtime.Object, error) {
- c := m.RESTClient
-
- // Attempt to version the object based on client logic.
- version, err := metadataAccessor.ResourceVersion(obj)
- if err != nil {
- // We don't know how to version this object, so send it to the server as is
- return m.replaceResource(c, m.Resource, namespace, name, obj)
- }
- if version == "" && overwrite {
- // Retrieve the current version of the object to overwrite the server object
- serverObj, err := c.Get().NamespaceIfScoped(namespace, m.NamespaceScoped).Resource(m.Resource).Name(name).Do().Get()
- if err != nil {
- // The object does not exist, but we want it to be created
- return m.replaceResource(c, m.Resource, namespace, name, obj)
- }
- serverVersion, err := metadataAccessor.ResourceVersion(serverObj)
- if err != nil {
- return nil, err
- }
- if err := metadataAccessor.SetResourceVersion(obj, serverVersion); err != nil {
- return nil, err
- }
- }
-
- return m.replaceResource(c, m.Resource, namespace, name, obj)
-}
-
-func (m *Helper) replaceResource(c RESTClient, resource, namespace, name string, obj runtime.Object) (runtime.Object, error) {
- return c.Put().NamespaceIfScoped(namespace, m.NamespaceScoped).Resource(resource).Name(name).Body(obj).Do().Get()
-}
diff --git a/vendor/k8s.io/cli-runtime/pkg/genericclioptions/resource/interfaces.go b/vendor/k8s.io/cli-runtime/pkg/genericclioptions/resource/interfaces.go
deleted file mode 100644
index 29d7b34ab6..0000000000
--- a/vendor/k8s.io/cli-runtime/pkg/genericclioptions/resource/interfaces.go
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
-Copyright 2014 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
-
-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.
-*/
-
-package resource
-
-import (
- "k8s.io/apimachinery/pkg/api/meta"
- "k8s.io/apimachinery/pkg/types"
- "k8s.io/client-go/discovery"
- "k8s.io/client-go/rest"
- "k8s.io/client-go/restmapper"
-)
-
-type RESTClientGetter interface {
- ToRESTConfig() (*rest.Config, error)
- ToDiscoveryClient() (discovery.CachedDiscoveryInterface, error)
- ToRESTMapper() (meta.RESTMapper, error)
-}
-
-type ClientConfigFunc func() (*rest.Config, error)
-type RESTMapperFunc func() (meta.RESTMapper, error)
-type CategoryExpanderFunc func() (restmapper.CategoryExpander, error)
-
-// RESTClient is a client helper for dealing with RESTful resources
-// in a generic way.
-type RESTClient interface {
- Get() *rest.Request
- Post() *rest.Request
- Patch(types.PatchType) *rest.Request
- Delete() *rest.Request
- Put() *rest.Request
-}
-
-// RequestTransform is a function that is given a chance to modify the outgoing request.
-type RequestTransform func(*rest.Request)
-
-// NewClientWithOptions wraps the provided RESTClient and invokes each transform on each
-// newly created request.
-func NewClientWithOptions(c RESTClient, transforms ...RequestTransform) RESTClient {
- if len(transforms) == 0 {
- return c
- }
- return &clientOptions{c: c, transforms: transforms}
-}
-
-type clientOptions struct {
- c RESTClient
- transforms []RequestTransform
-}
-
-func (c *clientOptions) modify(req *rest.Request) *rest.Request {
- for _, transform := range c.transforms {
- transform(req)
- }
- return req
-}
-
-func (c *clientOptions) Get() *rest.Request {
- return c.modify(c.c.Get())
-}
-
-func (c *clientOptions) Post() *rest.Request {
- return c.modify(c.c.Post())
-}
-func (c *clientOptions) Patch(t types.PatchType) *rest.Request {
- return c.modify(c.c.Patch(t))
-}
-func (c *clientOptions) Delete() *rest.Request {
- return c.modify(c.c.Delete())
-}
-func (c *clientOptions) Put() *rest.Request {
- return c.modify(c.c.Put())
-}
-
-// ContentValidator is an interface that knows how to validate an API object serialized to a byte array.
-type ContentValidator interface {
- ValidateBytes(data []byte) error
-}
-
-// Visitor lets clients walk a list of resources.
-type Visitor interface {
- Visit(VisitorFunc) error
-}
-
-// VisitorFunc implements the Visitor interface for a matching function.
-// If there was a problem walking a list of resources, the incoming error
-// will describe the problem and the function can decide how to handle that error.
-// A nil returned indicates to accept an error to continue loops even when errors happen.
-// This is useful for ignoring certain kinds of errors or aggregating errors in some way.
-type VisitorFunc func(*Info, error) error
diff --git a/vendor/k8s.io/cli-runtime/pkg/genericclioptions/resource/mapper.go b/vendor/k8s.io/cli-runtime/pkg/genericclioptions/resource/mapper.go
deleted file mode 100644
index 962f37711f..0000000000
--- a/vendor/k8s.io/cli-runtime/pkg/genericclioptions/resource/mapper.go
+++ /dev/null
@@ -1,161 +0,0 @@
-/*
-Copyright 2014 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
-
-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.
-*/
-
-package resource
-
-import (
- "fmt"
- "reflect"
-
- "k8s.io/apimachinery/pkg/runtime"
- "k8s.io/apimachinery/pkg/runtime/schema"
-)
-
-// Mapper is a convenience struct for holding references to the interfaces
-// needed to create Info for arbitrary objects.
-type mapper struct {
- // localFn indicates the call can't make server requests
- localFn func() bool
-
- restMapperFn RESTMapperFunc
- clientFn func(version schema.GroupVersion) (RESTClient, error)
- decoder runtime.Decoder
-}
-
-// InfoForData creates an Info object for the given data. An error is returned
-// if any of the decoding or client lookup steps fail. Name and namespace will be
-// set into Info if the mapping's MetadataAccessor can retrieve them.
-func (m *mapper) infoForData(data []byte, source string) (*Info, error) {
- obj, gvk, err := m.decoder.Decode(data, nil, nil)
- if err != nil {
- return nil, fmt.Errorf("unable to decode %q: %v", source, err)
- }
-
- name, _ := metadataAccessor.Name(obj)
- namespace, _ := metadataAccessor.Namespace(obj)
- resourceVersion, _ := metadataAccessor.ResourceVersion(obj)
-
- ret := &Info{
- Source: source,
- Namespace: namespace,
- Name: name,
- ResourceVersion: resourceVersion,
-
- Object: obj,
- }
-
- if m.localFn == nil || !m.localFn() {
- restMapper, err := m.restMapperFn()
- if err != nil {
- return nil, err
- }
- mapping, err := restMapper.RESTMapping(gvk.GroupKind(), gvk.Version)
- if err != nil {
- return nil, fmt.Errorf("unable to recognize %q: %v", source, err)
- }
- ret.Mapping = mapping
-
- client, err := m.clientFn(gvk.GroupVersion())
- if err != nil {
- return nil, fmt.Errorf("unable to connect to a server to handle %q: %v", mapping.Resource, err)
- }
- ret.Client = client
- }
-
- return ret, nil
-}
-
-// InfoForObject creates an Info object for the given Object. An error is returned
-// if the object cannot be introspected. Name and namespace will be set into Info
-// if the mapping's MetadataAccessor can retrieve them.
-func (m *mapper) infoForObject(obj runtime.Object, typer runtime.ObjectTyper, preferredGVKs []schema.GroupVersionKind) (*Info, error) {
- groupVersionKinds, _, err := typer.ObjectKinds(obj)
- if err != nil {
- return nil, fmt.Errorf("unable to get type info from the object %q: %v", reflect.TypeOf(obj), err)
- }
-
- gvk := groupVersionKinds[0]
- if len(groupVersionKinds) > 1 && len(preferredGVKs) > 0 {
- gvk = preferredObjectKind(groupVersionKinds, preferredGVKs)
- }
-
- name, _ := metadataAccessor.Name(obj)
- namespace, _ := metadataAccessor.Namespace(obj)
- resourceVersion, _ := metadataAccessor.ResourceVersion(obj)
- ret := &Info{
- Namespace: namespace,
- Name: name,
- ResourceVersion: resourceVersion,
-
- Object: obj,
- }
-
- if m.localFn == nil || !m.localFn() {
- restMapper, err := m.restMapperFn()
- if err != nil {
- return nil, err
- }
- mapping, err := restMapper.RESTMapping(gvk.GroupKind(), gvk.Version)
- if err != nil {
- return nil, fmt.Errorf("unable to recognize %v", err)
- }
- ret.Mapping = mapping
-
- client, err := m.clientFn(gvk.GroupVersion())
- if err != nil {
- return nil, fmt.Errorf("unable to connect to a server to handle %q: %v", mapping.Resource, err)
- }
- ret.Client = client
- }
-
- return ret, nil
-}
-
-// preferredObjectKind picks the possibility that most closely matches the priority list in this order:
-// GroupVersionKind matches (exact match)
-// GroupKind matches
-// Group matches
-func preferredObjectKind(possibilities []schema.GroupVersionKind, preferences []schema.GroupVersionKind) schema.GroupVersionKind {
- // Exact match
- for _, priority := range preferences {
- for _, possibility := range possibilities {
- if possibility == priority {
- return possibility
- }
- }
- }
-
- // GroupKind match
- for _, priority := range preferences {
- for _, possibility := range possibilities {
- if possibility.GroupKind() == priority.GroupKind() {
- return possibility
- }
- }
- }
-
- // Group match
- for _, priority := range preferences {
- for _, possibility := range possibilities {
- if possibility.Group == priority.Group {
- return possibility
- }
- }
- }
-
- // Just pick the first
- return possibilities[0]
-}
diff --git a/vendor/k8s.io/cli-runtime/pkg/genericclioptions/resource/result.go b/vendor/k8s.io/cli-runtime/pkg/genericclioptions/resource/result.go
deleted file mode 100644
index b8722afe69..0000000000
--- a/vendor/k8s.io/cli-runtime/pkg/genericclioptions/resource/result.go
+++ /dev/null
@@ -1,242 +0,0 @@
-/*
-Copyright 2014 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
-
-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.
-*/
-
-package resource
-
-import (
- "fmt"
- "reflect"
-
- "k8s.io/api/core/v1"
- "k8s.io/apimachinery/pkg/api/meta"
- metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
- "k8s.io/apimachinery/pkg/runtime"
- "k8s.io/apimachinery/pkg/runtime/schema"
- utilerrors "k8s.io/apimachinery/pkg/util/errors"
- "k8s.io/apimachinery/pkg/util/sets"
- "k8s.io/apimachinery/pkg/watch"
-)
-
-// ErrMatchFunc can be used to filter errors that may not be true failures.
-type ErrMatchFunc func(error) bool
-
-// Result contains helper methods for dealing with the outcome of a Builder.
-type Result struct {
- err error
- visitor Visitor
-
- sources []Visitor
- singleItemImplied bool
- targetsSingleItems bool
-
- mapper *mapper
- ignoreErrors []utilerrors.Matcher
-
- // populated by a call to Infos
- info []*Info
-}
-
-// withError allows a fluent style for internal result code.
-func (r *Result) withError(err error) *Result {
- r.err = err
- return r
-}
-
-// TargetsSingleItems returns true if any of the builder arguments pointed
-// to non-list calls (if the user explicitly asked for any object by name).
-// This includes directories, streams, URLs, and resource name tuples.
-func (r *Result) TargetsSingleItems() bool {
- return r.targetsSingleItems
-}
-
-// IgnoreErrors will filter errors that occur when by visiting the result
-// (but not errors that occur by creating the result in the first place),
-// eliminating any that match fns. This is best used in combination with
-// Builder.ContinueOnError(), where the visitors accumulate errors and return
-// them after visiting as a slice of errors. If no errors remain after
-// filtering, the various visitor methods on Result will return nil for
-// err.
-func (r *Result) IgnoreErrors(fns ...ErrMatchFunc) *Result {
- for _, fn := range fns {
- r.ignoreErrors = append(r.ignoreErrors, utilerrors.Matcher(fn))
- }
- return r
-}
-
-// Mapper returns a copy of the builder's mapper.
-func (r *Result) Mapper() *mapper {
- return r.mapper
-}
-
-// Err returns one or more errors (via a util.ErrorList) that occurred prior
-// to visiting the elements in the visitor. To see all errors including those
-// that occur during visitation, invoke Infos().
-func (r *Result) Err() error {
- return r.err
-}
-
-// Visit implements the Visitor interface on the items described in the Builder.
-// Note that some visitor sources are not traversable more than once, or may
-// return different results. If you wish to operate on the same set of resources
-// multiple times, use the Infos() method.
-func (r *Result) Visit(fn VisitorFunc) error {
- if r.err != nil {
- return r.err
- }
- err := r.visitor.Visit(fn)
- return utilerrors.FilterOut(err, r.ignoreErrors...)
-}
-
-// IntoSingleItemImplied sets the provided boolean pointer to true if the Builder input
-// implies a single item, or multiple.
-func (r *Result) IntoSingleItemImplied(b *bool) *Result {
- *b = r.singleItemImplied
- return r
-}
-
-// Infos returns an array of all of the resource infos retrieved via traversal.
-// Will attempt to traverse the entire set of visitors only once, and will return
-// a cached list on subsequent calls.
-func (r *Result) Infos() ([]*Info, error) {
- if r.err != nil {
- return nil, r.err
- }
- if r.info != nil {
- return r.info, nil
- }
-
- infos := []*Info{}
- err := r.visitor.Visit(func(info *Info, err error) error {
- if err != nil {
- return err
- }
- infos = append(infos, info)
- return nil
- })
- err = utilerrors.FilterOut(err, r.ignoreErrors...)
-
- r.info, r.err = infos, err
- return infos, err
-}
-
-// Object returns a single object representing the output of a single visit to all
-// found resources. If the Builder was a singular context (expected to return a
-// single resource by user input) and only a single resource was found, the resource
-// will be returned as is. Otherwise, the returned resources will be part of an
-// v1.List. The ResourceVersion of the v1.List will be set only if it is identical
-// across all infos returned.
-func (r *Result) Object() (runtime.Object, error) {
- infos, err := r.Infos()
- if err != nil {
- return nil, err
- }
-
- versions := sets.String{}
- objects := []runtime.Object{}
- for _, info := range infos {
- if info.Object != nil {
- objects = append(objects, info.Object)
- versions.Insert(info.ResourceVersion)
- }
- }
-
- if len(objects) == 1 {
- if r.singleItemImplied {
- return objects[0], nil
- }
- // if the item is a list already, don't create another list
- if meta.IsListType(objects[0]) {
- return objects[0], nil
- }
- }
-
- version := ""
- if len(versions) == 1 {
- version = versions.List()[0]
- }
-
- return toV1List(objects, version), err
-}
-
-// Compile time check to enforce that list implements the necessary interface
-var _ metav1.ListInterface = &v1.List{}
-var _ metav1.ListMetaAccessor = &v1.List{}
-
-// toV1List takes a slice of Objects + their version, and returns
-// a v1.List Object containing the objects in the Items field
-func toV1List(objects []runtime.Object, version string) runtime.Object {
- raw := []runtime.RawExtension{}
- for _, o := range objects {
- raw = append(raw, runtime.RawExtension{Object: o})
- }
- return &v1.List{
- ListMeta: metav1.ListMeta{
- ResourceVersion: version,
- },
- Items: raw,
- }
-}
-
-// ResourceMapping returns a single meta.RESTMapping representing the
-// resources located by the builder, or an error if more than one
-// mapping was found.
-func (r *Result) ResourceMapping() (*meta.RESTMapping, error) {
- if r.err != nil {
- return nil, r.err
- }
- mappings := map[schema.GroupVersionResource]*meta.RESTMapping{}
- for i := range r.sources {
- m, ok := r.sources[i].(ResourceMapping)
- if !ok {
- return nil, fmt.Errorf("a resource mapping could not be loaded from %v", reflect.TypeOf(r.sources[i]))
- }
- mapping := m.ResourceMapping()
- mappings[mapping.Resource] = mapping
- }
- if len(mappings) != 1 {
- return nil, fmt.Errorf("expected only a single resource type")
- }
- for _, mapping := range mappings {
- return mapping, nil
- }
- return nil, nil
-}
-
-// Watch retrieves changes that occur on the server to the specified resource.
-// It currently supports watching a single source - if the resource source
-// (selectors or pure types) can be watched, they will be, otherwise the list
-// will be visited (equivalent to the Infos() call) and if there is a single
-// resource present, it will be watched, otherwise an error will be returned.
-func (r *Result) Watch(resourceVersion string) (watch.Interface, error) {
- if r.err != nil {
- return nil, r.err
- }
- if len(r.sources) != 1 {
- return nil, fmt.Errorf("you may only watch a single resource or type of resource at a time")
- }
- w, ok := r.sources[0].(Watchable)
- if !ok {
- info, err := r.Infos()
- if err != nil {
- return nil, err
- }
- if len(info) != 1 {
- return nil, fmt.Errorf("watch is only supported on individual resources and resource collections - %d resources were found", len(info))
- }
- return info[0].Watch(resourceVersion)
- }
- return w.Watch(resourceVersion)
-}
diff --git a/vendor/k8s.io/cli-runtime/pkg/genericclioptions/resource/scheme.go b/vendor/k8s.io/cli-runtime/pkg/genericclioptions/resource/scheme.go
deleted file mode 100644
index fef6edfc1b..0000000000
--- a/vendor/k8s.io/cli-runtime/pkg/genericclioptions/resource/scheme.go
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
-Copyright 2018 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
-
-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.
-*/
-
-package resource
-
-import (
- "encoding/json"
- "io"
- "strings"
-
- metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
- "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
- "k8s.io/apimachinery/pkg/runtime"
- "k8s.io/apimachinery/pkg/runtime/schema"
- "k8s.io/apimachinery/pkg/runtime/serializer"
- "k8s.io/client-go/kubernetes/scheme"
- "k8s.io/client-go/rest"
-)
-
-// dynamicCodec is a codec that wraps the standard unstructured codec
-// with special handling for Status objects.
-// Deprecated only used by test code and its wrong
-type dynamicCodec struct{}
-
-func (dynamicCodec) Decode(data []byte, gvk *schema.GroupVersionKind, obj runtime.Object) (runtime.Object, *schema.GroupVersionKind, error) {
- obj, gvk, err := unstructured.UnstructuredJSONScheme.Decode(data, gvk, obj)
- if err != nil {
- return nil, nil, err
- }
-
- if _, ok := obj.(*metav1.Status); !ok && strings.ToLower(gvk.Kind) == "status" {
- obj = &metav1.Status{}
- err := json.Unmarshal(data, obj)
- if err != nil {
- return nil, nil, err
- }
- }
-
- return obj, gvk, nil
-}
-
-func (dynamicCodec) Encode(obj runtime.Object, w io.Writer) error {
- return unstructured.UnstructuredJSONScheme.Encode(obj, w)
-}
-
-// ContentConfig returns a rest.ContentConfig for dynamic types. It includes enough codecs to act as a "normal"
-// serializer for the rest.client with options, status and the like.
-func UnstructuredPlusDefaultContentConfig() rest.ContentConfig {
- var jsonInfo runtime.SerializerInfo
- // TODO: scheme.Codecs here should become "pkg/apis/server/scheme" which is the minimal core you need
- // to talk to a kubernetes server
- for _, info := range scheme.Codecs.SupportedMediaTypes() {
- if info.MediaType == runtime.ContentTypeJSON {
- jsonInfo = info
- break
- }
- }
-
- jsonInfo.Serializer = dynamicCodec{}
- jsonInfo.PrettySerializer = nil
- return rest.ContentConfig{
- AcceptContentTypes: runtime.ContentTypeJSON,
- ContentType: runtime.ContentTypeJSON,
- NegotiatedSerializer: serializer.NegotiatedSerializerWrapper(jsonInfo),
- }
-}
diff --git a/vendor/k8s.io/cli-runtime/pkg/genericclioptions/resource/selector.go b/vendor/k8s.io/cli-runtime/pkg/genericclioptions/resource/selector.go
deleted file mode 100644
index f36508bd4a..0000000000
--- a/vendor/k8s.io/cli-runtime/pkg/genericclioptions/resource/selector.go
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
-Copyright 2014 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
-
-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.
-*/
-
-package resource
-
-import (
- "fmt"
-
- "k8s.io/apimachinery/pkg/api/errors"
- "k8s.io/apimachinery/pkg/api/meta"
- metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
- "k8s.io/apimachinery/pkg/watch"
-)
-
-// Selector is a Visitor for resources that match a label selector.
-type Selector struct {
- Client RESTClient
- Mapping *meta.RESTMapping
- Namespace string
- LabelSelector string
- FieldSelector string
- Export bool
- IncludeUninitialized bool
- LimitChunks int64
-}
-
-// NewSelector creates a resource selector which hides details of getting items by their label selector.
-func NewSelector(client RESTClient, mapping *meta.RESTMapping, namespace, labelSelector, fieldSelector string, export, includeUninitialized bool, limitChunks int64) *Selector {
- return &Selector{
- Client: client,
- Mapping: mapping,
- Namespace: namespace,
- LabelSelector: labelSelector,
- FieldSelector: fieldSelector,
- Export: export,
- IncludeUninitialized: includeUninitialized,
- LimitChunks: limitChunks,
- }
-}
-
-// Visit implements Visitor and uses request chunking by default.
-func (r *Selector) Visit(fn VisitorFunc) error {
- var continueToken string
- for {
- list, err := NewHelper(r.Client, r.Mapping).List(
- r.Namespace,
- r.ResourceMapping().GroupVersionKind.GroupVersion().String(),
- r.Export,
- &metav1.ListOptions{
- LabelSelector: r.LabelSelector,
- FieldSelector: r.FieldSelector,
- IncludeUninitialized: r.IncludeUninitialized,
- Limit: r.LimitChunks,
- Continue: continueToken,
- },
- )
- if err != nil {
- if errors.IsResourceExpired(err) {
- return err
- }
- if errors.IsBadRequest(err) || errors.IsNotFound(err) {
- if se, ok := err.(*errors.StatusError); ok {
- // modify the message without hiding this is an API error
- if len(r.LabelSelector) == 0 && len(r.FieldSelector) == 0 {
- se.ErrStatus.Message = fmt.Sprintf("Unable to list %q: %v", r.Mapping.Resource, se.ErrStatus.Message)
- } else {
- se.ErrStatus.Message = fmt.Sprintf("Unable to find %q that match label selector %q, field selector %q: %v", r.Mapping.Resource, r.LabelSelector, r.FieldSelector, se.ErrStatus.Message)
- }
- return se
- }
- if len(r.LabelSelector) == 0 && len(r.FieldSelector) == 0 {
- return fmt.Errorf("Unable to list %q: %v", r.Mapping.Resource, err)
- }
- return fmt.Errorf("Unable to find %q that match label selector %q, field selector %q: %v", r.Mapping.Resource, r.LabelSelector, r.FieldSelector, err)
- }
- return err
- }
- resourceVersion, _ := metadataAccessor.ResourceVersion(list)
- nextContinueToken, _ := metadataAccessor.Continue(list)
- info := &Info{
- Client: r.Client,
- Mapping: r.Mapping,
-
- Namespace: r.Namespace,
- ResourceVersion: resourceVersion,
-
- Object: list,
- }
-
- if err := fn(info, nil); err != nil {
- return err
- }
- if len(nextContinueToken) == 0 {
- return nil
- }
- continueToken = nextContinueToken
- }
-}
-
-func (r *Selector) Watch(resourceVersion string) (watch.Interface, error) {
- return NewHelper(r.Client, r.Mapping).Watch(r.Namespace, r.ResourceMapping().GroupVersionKind.GroupVersion().String(),
- &metav1.ListOptions{ResourceVersion: resourceVersion, LabelSelector: r.LabelSelector, FieldSelector: r.FieldSelector})
-}
-
-// ResourceMapping returns the mapping for this resource and implements ResourceMapping
-func (r *Selector) ResourceMapping() *meta.RESTMapping {
- return r.Mapping
-}
diff --git a/vendor/k8s.io/cli-runtime/pkg/genericclioptions/resource/visitor.go b/vendor/k8s.io/cli-runtime/pkg/genericclioptions/resource/visitor.go
deleted file mode 100644
index 32c1a691a5..0000000000
--- a/vendor/k8s.io/cli-runtime/pkg/genericclioptions/resource/visitor.go
+++ /dev/null
@@ -1,723 +0,0 @@
-/*
-Copyright 2014 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
-
-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.
-*/
-
-package resource
-
-import (
- "bytes"
- "fmt"
- "io"
- "net/http"
- "net/url"
- "os"
- "path/filepath"
- "time"
-
- "golang.org/x/text/encoding/unicode"
- "golang.org/x/text/transform"
-
- "k8s.io/apimachinery/pkg/api/errors"
- "k8s.io/apimachinery/pkg/api/meta"
- metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
- "k8s.io/apimachinery/pkg/labels"
- "k8s.io/apimachinery/pkg/runtime"
- "k8s.io/apimachinery/pkg/runtime/schema"
- utilerrors "k8s.io/apimachinery/pkg/util/errors"
- "k8s.io/apimachinery/pkg/util/yaml"
- "k8s.io/apimachinery/pkg/watch"
-)
-
-const (
- constSTDINstr string = "STDIN"
- stopValidateMessage = "if you choose to ignore these errors, turn validation off with --validate=false"
-)
-
-// Watchable describes a resource that can be watched for changes that occur on the server,
-// beginning after the provided resource version.
-type Watchable interface {
- Watch(resourceVersion string) (watch.Interface, error)
-}
-
-// ResourceMapping allows an object to return the resource mapping associated with
-// the resource or resources it represents.
-type ResourceMapping interface {
- ResourceMapping() *meta.RESTMapping
-}
-
-// Info contains temporary info to execute a REST call, or show the results
-// of an already completed REST call.
-type Info struct {
- // Client will only be present if this builder was not local
- Client RESTClient
- // Mapping will only be present if this builder was not local
- Mapping *meta.RESTMapping
-
- // Namespace will be set if the object is namespaced and has a specified value.
- Namespace string
- Name string
-
- // Optional, Source is the filename or URL to template file (.json or .yaml),
- // or stdin to use to handle the resource
- Source string
- // Optional, this is the most recent value returned by the server if available. It will
- // typically be in unstructured or internal forms, depending on how the Builder was
- // defined. If retrieved from the server, the Builder expects the mapping client to
- // decide the final form. Use the AsVersioned, AsUnstructured, and AsInternal helpers
- // to alter the object versions.
- Object runtime.Object
- // Optional, this is the most recent resource version the server knows about for
- // this type of resource. It may not match the resource version of the object,
- // but if set it should be equal to or newer than the resource version of the
- // object (however the server defines resource version).
- ResourceVersion string
- // Optional, should this resource be exported, stripped of cluster-specific and instance specific fields
- Export bool
-}
-
-// Visit implements Visitor
-func (i *Info) Visit(fn VisitorFunc) error {
- return fn(i, nil)
-}
-
-// Get retrieves the object from the Namespace and Name fields
-func (i *Info) Get() (err error) {
- obj, err := NewHelper(i.Client, i.Mapping).Get(i.Namespace, i.Name, i.Export)
- if err != nil {
- if errors.IsNotFound(err) && len(i.Namespace) > 0 && i.Namespace != metav1.NamespaceDefault && i.Namespace != metav1.NamespaceAll {
- err2 := i.Client.Get().AbsPath("api", "v1", "namespaces", i.Namespace).Do().Error()
- if err2 != nil && errors.IsNotFound(err2) {
- return err2
- }
- }
- return err
- }
- i.Object = obj
- i.ResourceVersion, _ = metadataAccessor.ResourceVersion(obj)
- return nil
-}
-
-// Refresh updates the object with another object. If ignoreError is set
-// the Object will be updated even if name, namespace, or resourceVersion
-// attributes cannot be loaded from the object.
-func (i *Info) Refresh(obj runtime.Object, ignoreError bool) error {
- name, err := metadataAccessor.Name(obj)
- if err != nil {
- if !ignoreError {
- return err
- }
- } else {
- i.Name = name
- }
- namespace, err := metadataAccessor.Namespace(obj)
- if err != nil {
- if !ignoreError {
- return err
- }
- } else {
- i.Namespace = namespace
- }
- version, err := metadataAccessor.ResourceVersion(obj)
- if err != nil {
- if !ignoreError {
- return err
- }
- } else {
- i.ResourceVersion = version
- }
- i.Object = obj
- return nil
-}
-
-// String returns the general purpose string representation
-func (i *Info) String() string {
- basicInfo := fmt.Sprintf("Name: %q, Namespace: %q\nObject: %+q", i.Name, i.Namespace, i.Object)
- if i.Mapping != nil {
- mappingInfo := fmt.Sprintf("Resource: %q, GroupVersionKind: %q", i.Mapping.Resource.String(),
- i.Mapping.GroupVersionKind.String())
- return fmt.Sprint(mappingInfo, "\n", basicInfo)
- }
- return basicInfo
-}
-
-// Namespaced returns true if the object belongs to a namespace
-func (i *Info) Namespaced() bool {
- return i.Mapping != nil && i.Mapping.Scope.Name() == meta.RESTScopeNameNamespace
-}
-
-// Watch returns server changes to this object after it was retrieved.
-func (i *Info) Watch(resourceVersion string) (watch.Interface, error) {
- return NewHelper(i.Client, i.Mapping).WatchSingle(i.Namespace, i.Name, resourceVersion)
-}
-
-// ResourceMapping returns the mapping for this resource and implements ResourceMapping
-func (i *Info) ResourceMapping() *meta.RESTMapping {
- return i.Mapping
-}
-
-// VisitorList implements Visit for the sub visitors it contains. The first error
-// returned from a child Visitor will terminate iteration.
-type VisitorList []Visitor
-
-// Visit implements Visitor
-func (l VisitorList) Visit(fn VisitorFunc) error {
- for i := range l {
- if err := l[i].Visit(fn); err != nil {
- return err
- }
- }
- return nil
-}
-
-// EagerVisitorList implements Visit for the sub visitors it contains. All errors
-// will be captured and returned at the end of iteration.
-type EagerVisitorList []Visitor
-
-// Visit implements Visitor, and gathers errors that occur during processing until
-// all sub visitors have been visited.
-func (l EagerVisitorList) Visit(fn VisitorFunc) error {
- errs := []error(nil)
- for i := range l {
- if err := l[i].Visit(func(info *Info, err error) error {
- if err != nil {
- errs = append(errs, err)
- return nil
- }
- if err := fn(info, nil); err != nil {
- errs = append(errs, err)
- }
- return nil
- }); err != nil {
- errs = append(errs, err)
- }
- }
- return utilerrors.NewAggregate(errs)
-}
-
-func ValidateSchema(data []byte, schema ContentValidator) error {
- if schema == nil {
- return nil
- }
- if err := schema.ValidateBytes(data); err != nil {
- return fmt.Errorf("error validating data: %v; %s", err, stopValidateMessage)
- }
- return nil
-}
-
-// URLVisitor downloads the contents of a URL, and if successful, returns
-// an info object representing the downloaded object.
-type URLVisitor struct {
- URL *url.URL
- *StreamVisitor
- HttpAttemptCount int
-}
-
-func (v *URLVisitor) Visit(fn VisitorFunc) error {
- body, err := readHttpWithRetries(httpgetImpl, time.Second, v.URL.String(), v.HttpAttemptCount)
- if err != nil {
- return err
- }
- defer body.Close()
- v.StreamVisitor.Reader = body
- return v.StreamVisitor.Visit(fn)
-}
-
-// readHttpWithRetries tries to http.Get the v.URL retries times before giving up.
-func readHttpWithRetries(get httpget, duration time.Duration, u string, attempts int) (io.ReadCloser, error) {
- var err error
- var body io.ReadCloser
- if attempts <= 0 {
- return nil, fmt.Errorf("http attempts must be greater than 0, was %d", attempts)
- }
- for i := 0; i < attempts; i++ {
- var statusCode int
- var status string
- if i > 0 {
- time.Sleep(duration)
- }
-
- // Try to get the URL
- statusCode, status, body, err = get(u)
-
- // Retry Errors
- if err != nil {
- continue
- }
-
- // Error - Set the error condition from the StatusCode
- if statusCode != http.StatusOK {
- err = fmt.Errorf("unable to read URL %q, server reported %s, status code=%d", u, status, statusCode)
- }
-
- if statusCode >= 500 && statusCode < 600 {
- // Retry 500's
- continue
- } else {
- // Don't retry other StatusCodes
- break
- }
- }
- return body, err
-}
-
-// httpget Defines function to retrieve a url and return the results. Exists for unit test stubbing.
-type httpget func(url string) (int, string, io.ReadCloser, error)
-
-// httpgetImpl Implements a function to retrieve a url and return the results.
-func httpgetImpl(url string) (int, string, io.ReadCloser, error) {
- resp, err := http.Get(url)
- if err != nil {
- return 0, "", nil, err
- }
- return resp.StatusCode, resp.Status, resp.Body, nil
-}
-
-// DecoratedVisitor will invoke the decorators in order prior to invoking the visitor function
-// passed to Visit. An error will terminate the visit.
-type DecoratedVisitor struct {
- visitor Visitor
- decorators []VisitorFunc
-}
-
-// NewDecoratedVisitor will create a visitor that invokes the provided visitor functions before
-// the user supplied visitor function is invoked, giving them the opportunity to mutate the Info
-// object or terminate early with an error.
-func NewDecoratedVisitor(v Visitor, fn ...VisitorFunc) Visitor {
- if len(fn) == 0 {
- return v
- }
- return DecoratedVisitor{v, fn}
-}
-
-// Visit implements Visitor
-func (v DecoratedVisitor) Visit(fn VisitorFunc) error {
- return v.visitor.Visit(func(info *Info, err error) error {
- if err != nil {
- return err
- }
- for i := range v.decorators {
- if err := v.decorators[i](info, nil); err != nil {
- return err
- }
- }
- return fn(info, nil)
- })
-}
-
-// ContinueOnErrorVisitor visits each item and, if an error occurs on
-// any individual item, returns an aggregate error after all items
-// are visited.
-type ContinueOnErrorVisitor struct {
- Visitor
-}
-
-// Visit returns nil if no error occurs during traversal, a regular
-// error if one occurs, or if multiple errors occur, an aggregate
-// error. If the provided visitor fails on any individual item it
-// will not prevent the remaining items from being visited. An error
-// returned by the visitor directly may still result in some items
-// not being visited.
-func (v ContinueOnErrorVisitor) Visit(fn VisitorFunc) error {
- errs := []error{}
- err := v.Visitor.Visit(func(info *Info, err error) error {
- if err != nil {
- errs = append(errs, err)
- return nil
- }
- if err := fn(info, nil); err != nil {
- errs = append(errs, err)
- }
- return nil
- })
- if err != nil {
- errs = append(errs, err)
- }
- if len(errs) == 1 {
- return errs[0]
- }
- return utilerrors.NewAggregate(errs)
-}
-
-// FlattenListVisitor flattens any objects that runtime.ExtractList recognizes as a list
-// - has an "Items" public field that is a slice of runtime.Objects or objects satisfying
-// that interface - into multiple Infos. An error on any sub item (for instance, if a List
-// contains an object that does not have a registered client or resource) will terminate
-// the visit.
-// TODO: allow errors to be aggregated?
-type FlattenListVisitor struct {
- visitor Visitor
- typer runtime.ObjectTyper
- mapper *mapper
-}
-
-// NewFlattenListVisitor creates a visitor that will expand list style runtime.Objects
-// into individual items and then visit them individually.
-func NewFlattenListVisitor(v Visitor, typer runtime.ObjectTyper, mapper *mapper) Visitor {
- return FlattenListVisitor{v, typer, mapper}
-}
-
-func (v FlattenListVisitor) Visit(fn VisitorFunc) error {
- return v.visitor.Visit(func(info *Info, err error) error {
- if err != nil {
- return err
- }
- if info.Object == nil {
- return fn(info, nil)
- }
- if !meta.IsListType(info.Object) {
- return fn(info, nil)
- }
-
- items := []runtime.Object{}
- itemsToProcess := []runtime.Object{info.Object}
-
- for i := 0; i < len(itemsToProcess); i++ {
- currObj := itemsToProcess[i]
- if !meta.IsListType(currObj) {
- items = append(items, currObj)
- continue
- }
-
- currItems, err := meta.ExtractList(currObj)
- if err != nil {
- return err
- }
- if errs := runtime.DecodeList(currItems, v.mapper.decoder); len(errs) > 0 {
- return utilerrors.NewAggregate(errs)
- }
- itemsToProcess = append(itemsToProcess, currItems...)
- }
-
- // If we have a GroupVersionKind on the list, prioritize that when asking for info on the objects contained in the list
- var preferredGVKs []schema.GroupVersionKind
- if info.Mapping != nil && !info.Mapping.GroupVersionKind.Empty() {
- preferredGVKs = append(preferredGVKs, info.Mapping.GroupVersionKind)
- }
-
- for i := range items {
- item, err := v.mapper.infoForObject(items[i], v.typer, preferredGVKs)
- if err != nil {
- return err
- }
- if len(info.ResourceVersion) != 0 {
- item.ResourceVersion = info.ResourceVersion
- }
- if err := fn(item, nil); err != nil {
- return err
- }
- }
- return nil
- })
-}
-
-func ignoreFile(path string, extensions []string) bool {
- if len(extensions) == 0 {
- return false
- }
- ext := filepath.Ext(path)
- for _, s := range extensions {
- if s == ext {
- return false
- }
- }
- return true
-}
-
-// FileVisitorForSTDIN return a special FileVisitor just for STDIN
-func FileVisitorForSTDIN(mapper *mapper, schema ContentValidator) Visitor {
- return &FileVisitor{
- Path: constSTDINstr,
- StreamVisitor: NewStreamVisitor(nil, mapper, constSTDINstr, schema),
- }
-}
-
-// ExpandPathsToFileVisitors will return a slice of FileVisitors that will handle files from the provided path.
-// After FileVisitors open the files, they will pass an io.Reader to a StreamVisitor to do the reading. (stdin
-// is also taken care of). Paths argument also accepts a single file, and will return a single visitor
-func ExpandPathsToFileVisitors(mapper *mapper, paths string, recursive bool, extensions []string, schema ContentValidator) ([]Visitor, error) {
- var visitors []Visitor
- err := filepath.Walk(paths, func(path string, fi os.FileInfo, err error) error {
- if err != nil {
- return err
- }
-
- if fi.IsDir() {
- if path != paths && !recursive {
- return filepath.SkipDir
- }
- return nil
- }
- // Don't check extension if the filepath was passed explicitly
- if path != paths && ignoreFile(path, extensions) {
- return nil
- }
-
- visitor := &FileVisitor{
- Path: path,
- StreamVisitor: NewStreamVisitor(nil, mapper, path, schema),
- }
-
- visitors = append(visitors, visitor)
- return nil
- })
-
- if err != nil {
- return nil, err
- }
- return visitors, nil
-}
-
-// FileVisitor is wrapping around a StreamVisitor, to handle open/close files
-type FileVisitor struct {
- Path string
- *StreamVisitor
-}
-
-// Visit in a FileVisitor is just taking care of opening/closing files
-func (v *FileVisitor) Visit(fn VisitorFunc) error {
- var f *os.File
- if v.Path == constSTDINstr {
- f = os.Stdin
- } else {
- var err error
- f, err = os.Open(v.Path)
- if err != nil {
- return err
- }
- defer f.Close()
- }
-
- // TODO: Consider adding a flag to force to UTF16, apparently some
- // Windows tools don't write the BOM
- utf16bom := unicode.BOMOverride(unicode.UTF8.NewDecoder())
- v.StreamVisitor.Reader = transform.NewReader(f, utf16bom)
-
- return v.StreamVisitor.Visit(fn)
-}
-
-// StreamVisitor reads objects from an io.Reader and walks them. A stream visitor can only be
-// visited once.
-// TODO: depends on objects being in JSON format before being passed to decode - need to implement
-// a stream decoder method on runtime.Codec to properly handle this.
-type StreamVisitor struct {
- io.Reader
- *mapper
-
- Source string
- Schema ContentValidator
-}
-
-// NewStreamVisitor is a helper function that is useful when we want to change the fields of the struct but keep calls the same.
-func NewStreamVisitor(r io.Reader, mapper *mapper, source string, schema ContentValidator) *StreamVisitor {
- return &StreamVisitor{
- Reader: r,
- mapper: mapper,
- Source: source,
- Schema: schema,
- }
-}
-
-// Visit implements Visitor over a stream. StreamVisitor is able to distinct multiple resources in one stream.
-func (v *StreamVisitor) Visit(fn VisitorFunc) error {
- d := yaml.NewYAMLOrJSONDecoder(v.Reader, 4096)
- for {
- ext := runtime.RawExtension{}
- if err := d.Decode(&ext); err != nil {
- if err == io.EOF {
- return nil
- }
- return fmt.Errorf("error parsing %s: %v", v.Source, err)
- }
- // TODO: This needs to be able to handle object in other encodings and schemas.
- ext.Raw = bytes.TrimSpace(ext.Raw)
- if len(ext.Raw) == 0 || bytes.Equal(ext.Raw, []byte("null")) {
- continue
- }
- if err := ValidateSchema(ext.Raw, v.Schema); err != nil {
- return fmt.Errorf("error validating %q: %v", v.Source, err)
- }
- info, err := v.infoForData(ext.Raw, v.Source)
- if err != nil {
- if fnErr := fn(info, err); fnErr != nil {
- return fnErr
- }
- continue
- }
- if err := fn(info, nil); err != nil {
- return err
- }
- }
-}
-
-func UpdateObjectNamespace(info *Info, err error) error {
- if err != nil {
- return err
- }
- if info.Object != nil {
- return metadataAccessor.SetNamespace(info.Object, info.Namespace)
- }
- return nil
-}
-
-// FilterNamespace omits the namespace if the object is not namespace scoped
-func FilterNamespace(info *Info, err error) error {
- if err != nil {
- return err
- }
- if !info.Namespaced() {
- info.Namespace = ""
- UpdateObjectNamespace(info, nil)
- }
- return nil
-}
-
-// SetNamespace ensures that every Info object visited will have a namespace
-// set. If info.Object is set, it will be mutated as well.
-func SetNamespace(namespace string) VisitorFunc {
- return func(info *Info, err error) error {
- if err != nil {
- return err
- }
- if !info.Namespaced() {
- return nil
- }
- if len(info.Namespace) == 0 {
- info.Namespace = namespace
- UpdateObjectNamespace(info, nil)
- }
- return nil
- }
-}
-
-// RequireNamespace will either set a namespace if none is provided on the
-// Info object, or if the namespace is set and does not match the provided
-// value, returns an error. This is intended to guard against administrators
-// accidentally operating on resources outside their namespace.
-func RequireNamespace(namespace string) VisitorFunc {
- return func(info *Info, err error) error {
- if err != nil {
- return err
- }
- if !info.Namespaced() {
- return nil
- }
- if len(info.Namespace) == 0 {
- info.Namespace = namespace
- UpdateObjectNamespace(info, nil)
- return nil
- }
- if info.Namespace != namespace {
- return fmt.Errorf("the namespace from the provided object %q does not match the namespace %q. You must pass '--namespace=%s' to perform this operation.", info.Namespace, namespace, info.Namespace)
- }
- return nil
- }
-}
-
-// RetrieveLatest updates the Object on each Info by invoking a standard client
-// Get.
-func RetrieveLatest(info *Info, err error) error {
- if err != nil {
- return err
- }
- if meta.IsListType(info.Object) {
- return fmt.Errorf("watch is only supported on individual resources and resource collections, but a list of resources is found")
- }
- if len(info.Name) == 0 {
- return nil
- }
- if info.Namespaced() && len(info.Namespace) == 0 {
- return fmt.Errorf("no namespace set on resource %s %q", info.Mapping.Resource, info.Name)
- }
- return info.Get()
-}
-
-// RetrieveLazy updates the object if it has not been loaded yet.
-func RetrieveLazy(info *Info, err error) error {
- if err != nil {
- return err
- }
- if info.Object == nil {
- return info.Get()
- }
- return nil
-}
-
-// CreateAndRefresh creates an object from input info and refreshes info with that object
-func CreateAndRefresh(info *Info) error {
- obj, err := NewHelper(info.Client, info.Mapping).Create(info.Namespace, true, info.Object, nil)
- if err != nil {
- return err
- }
- info.Refresh(obj, true)
- return nil
-}
-
-type FilterFunc func(info *Info, err error) (bool, error)
-
-type FilteredVisitor struct {
- visitor Visitor
- filters []FilterFunc
-}
-
-func NewFilteredVisitor(v Visitor, fn ...FilterFunc) Visitor {
- if len(fn) == 0 {
- return v
- }
- return FilteredVisitor{v, fn}
-}
-
-func (v FilteredVisitor) Visit(fn VisitorFunc) error {
- return v.visitor.Visit(func(info *Info, err error) error {
- if err != nil {
- return err
- }
- for _, filter := range v.filters {
- ok, err := filter(info, nil)
- if err != nil {
- return err
- }
- if !ok {
- return nil
- }
- }
- return fn(info, nil)
- })
-}
-
-func FilterByLabelSelector(s labels.Selector) FilterFunc {
- return func(info *Info, err error) (bool, error) {
- if err != nil {
- return false, err
- }
- a, err := meta.Accessor(info.Object)
- if err != nil {
- return false, err
- }
- if !s.Matches(labels.Set(a.GetLabels())) {
- return false, nil
- }
- return true, nil
- }
-}
-
-type InfoListVisitor []*Info
-
-func (infos InfoListVisitor) Visit(fn VisitorFunc) error {
- var err error
- for _, i := range infos {
- err = fn(i, err)
- }
- return err
-}
diff --git a/vendor/k8s.io/cli-runtime/pkg/genericclioptions/template_flags.go b/vendor/k8s.io/cli-runtime/pkg/genericclioptions/template_flags.go
deleted file mode 100644
index eeae7ac7d6..0000000000
--- a/vendor/k8s.io/cli-runtime/pkg/genericclioptions/template_flags.go
+++ /dev/null
@@ -1,133 +0,0 @@
-/*
-Copyright 2018 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
-
-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.
-*/
-
-package genericclioptions
-
-import (
- "fmt"
- "io/ioutil"
- "strings"
-
- "github.com/spf13/cobra"
-
- "k8s.io/cli-runtime/pkg/genericclioptions/printers"
-)
-
-// templates are logically optional for specifying a format.
-// this allows a user to specify a template format value
-// as --output=go-template=
-var templateFormats = map[string]bool{
- "template": true,
- "go-template": true,
- "go-template-file": true,
- "templatefile": true,
-}
-
-// GoTemplatePrintFlags provides default flags necessary for template printing.
-// Given the following flag values, a printer can be requested that knows
-// how to handle printing based on these values.
-type GoTemplatePrintFlags struct {
- // indicates if it is OK to ignore missing keys for rendering
- // an output template.
- AllowMissingKeys *bool
- TemplateArgument *string
-}
-
-func (f *GoTemplatePrintFlags) AllowedFormats() []string {
- formats := make([]string, 0, len(templateFormats))
- for format := range templateFormats {
- formats = append(formats, format)
- }
- return formats
-}
-
-// ToPrinter receives an templateFormat and returns a printer capable of
-// handling --template format printing.
-// Returns false if the specified templateFormat does not match a template format.
-func (f *GoTemplatePrintFlags) ToPrinter(templateFormat string) (printers.ResourcePrinter, error) {
- if (f.TemplateArgument == nil || len(*f.TemplateArgument) == 0) && len(templateFormat) == 0 {
- return nil, NoCompatiblePrinterError{Options: f, OutputFormat: &templateFormat}
- }
-
- templateValue := ""
-
- if f.TemplateArgument == nil || len(*f.TemplateArgument) == 0 {
- for format := range templateFormats {
- format = format + "="
- if strings.HasPrefix(templateFormat, format) {
- templateValue = templateFormat[len(format):]
- templateFormat = format[:len(format)-1]
- break
- }
- }
- } else {
- templateValue = *f.TemplateArgument
- }
-
- if _, supportedFormat := templateFormats[templateFormat]; !supportedFormat {
- return nil, NoCompatiblePrinterError{OutputFormat: &templateFormat, AllowedFormats: f.AllowedFormats()}
- }
-
- if len(templateValue) == 0 {
- return nil, fmt.Errorf("template format specified but no template given")
- }
-
- if templateFormat == "templatefile" || templateFormat == "go-template-file" {
- data, err := ioutil.ReadFile(templateValue)
- if err != nil {
- return nil, fmt.Errorf("error reading --template %s, %v\n", templateValue, err)
- }
-
- templateValue = string(data)
- }
-
- p, err := printers.NewGoTemplatePrinter([]byte(templateValue))
- if err != nil {
- return nil, fmt.Errorf("error parsing template %s, %v\n", templateValue, err)
- }
-
- allowMissingKeys := true
- if f.AllowMissingKeys != nil {
- allowMissingKeys = *f.AllowMissingKeys
- }
-
- p.AllowMissingKeys(allowMissingKeys)
- return p, nil
-}
-
-// AddFlags receives a *cobra.Command reference and binds
-// flags related to template printing to it
-func (f *GoTemplatePrintFlags) AddFlags(c *cobra.Command) {
- if f.TemplateArgument != nil {
- c.Flags().StringVar(f.TemplateArgument, "template", *f.TemplateArgument, "Template string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [http://golang.org/pkg/text/template/#pkg-overview].")
- c.MarkFlagFilename("template")
- }
- if f.AllowMissingKeys != nil {
- c.Flags().BoolVar(f.AllowMissingKeys, "allow-missing-template-keys", *f.AllowMissingKeys, "If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.")
- }
-}
-
-// NewGoTemplatePrintFlags returns flags associated with
-// --template printing, with default values set.
-func NewGoTemplatePrintFlags() *GoTemplatePrintFlags {
- allowMissingKeysPtr := true
- templateValuePtr := ""
-
- return &GoTemplatePrintFlags{
- TemplateArgument: &templateValuePtr,
- AllowMissingKeys: &allowMissingKeysPtr,
- }
-}
diff --git a/vendor/k8s.io/client-go/restmapper/category_expansion.go b/vendor/k8s.io/client-go/restmapper/category_expansion.go
deleted file mode 100644
index 1620bbcf81..0000000000
--- a/vendor/k8s.io/client-go/restmapper/category_expansion.go
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
-Copyright 2017 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
-
-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.
-*/
-
-package restmapper
-
-import (
- "k8s.io/apimachinery/pkg/runtime/schema"
- "k8s.io/client-go/discovery"
-)
-
-// CategoryExpander maps category strings to GroupResouces.
-// Categories are classification or 'tag' of a group of resources.
-type CategoryExpander interface {
- Expand(category string) ([]schema.GroupResource, bool)
-}
-
-// SimpleCategoryExpander implements CategoryExpander interface
-// using a static mapping of categories to GroupResource mapping.
-type SimpleCategoryExpander struct {
- Expansions map[string][]schema.GroupResource
-}
-
-// Expand fulfills CategoryExpander
-func (e SimpleCategoryExpander) Expand(category string) ([]schema.GroupResource, bool) {
- ret, ok := e.Expansions[category]
- return ret, ok
-}
-
-// discoveryCategoryExpander struct lets a REST Client wrapper (discoveryClient) to retrieve list of APIResourceList,
-// and then convert to fallbackExpander
-type discoveryCategoryExpander struct {
- discoveryClient discovery.DiscoveryInterface
-}
-
-// NewDiscoveryCategoryExpander returns a category expander that makes use of the "categories" fields from
-// the API, found through the discovery client. In case of any error or no category found (which likely
-// means we're at a cluster prior to categories support, fallback to the expander provided.
-func NewDiscoveryCategoryExpander(client discovery.DiscoveryInterface) CategoryExpander {
- if client == nil {
- panic("Please provide discovery client to shortcut expander")
- }
- return discoveryCategoryExpander{discoveryClient: client}
-}
-
-// Expand fulfills CategoryExpander
-func (e discoveryCategoryExpander) Expand(category string) ([]schema.GroupResource, bool) {
- // Get all supported resources for groups and versions from server, if no resource found, fallback anyway.
- apiResourceLists, _ := e.discoveryClient.ServerResources()
- if len(apiResourceLists) == 0 {
- return nil, false
- }
-
- discoveredExpansions := map[string][]schema.GroupResource{}
- for _, apiResourceList := range apiResourceLists {
- gv, err := schema.ParseGroupVersion(apiResourceList.GroupVersion)
- if err != nil {
- continue
- }
- // Collect GroupVersions by categories
- for _, apiResource := range apiResourceList.APIResources {
- if categories := apiResource.Categories; len(categories) > 0 {
- for _, category := range categories {
- groupResource := schema.GroupResource{
- Group: gv.Group,
- Resource: apiResource.Name,
- }
- discoveredExpansions[category] = append(discoveredExpansions[category], groupResource)
- }
- }
- }
- }
-
- ret, ok := discoveredExpansions[category]
- return ret, ok
-}
-
-// UnionCategoryExpander implements CategoryExpander interface.
-// It maps given category string to union of expansions returned by all the CategoryExpanders in the list.
-type UnionCategoryExpander []CategoryExpander
-
-// Expand fulfills CategoryExpander
-func (u UnionCategoryExpander) Expand(category string) ([]schema.GroupResource, bool) {
- ret := []schema.GroupResource{}
- ok := false
-
- // Expand the category for each CategoryExpander in the list and merge/combine the results.
- for _, expansion := range u {
- curr, currOk := expansion.Expand(category)
-
- for _, currGR := range curr {
- found := false
- for _, existing := range ret {
- if existing == currGR {
- found = true
- break
- }
- }
- if !found {
- ret = append(ret, currGR)
- }
- }
- ok = ok || currOk
- }
-
- return ret, ok
-}
diff --git a/vendor/k8s.io/client-go/restmapper/discovery.go b/vendor/k8s.io/client-go/restmapper/discovery.go
deleted file mode 100644
index aa158626af..0000000000
--- a/vendor/k8s.io/client-go/restmapper/discovery.go
+++ /dev/null
@@ -1,339 +0,0 @@
-/*
-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
-
-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.
-*/
-
-package restmapper
-
-import (
- "fmt"
- "strings"
- "sync"
-
- "k8s.io/apimachinery/pkg/api/meta"
- metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
- "k8s.io/apimachinery/pkg/runtime/schema"
- "k8s.io/client-go/discovery"
-
- "github.com/golang/glog"
-)
-
-// APIGroupResources is an API group with a mapping of versions to
-// resources.
-type APIGroupResources struct {
- Group metav1.APIGroup
- // A mapping of version string to a slice of APIResources for
- // that version.
- VersionedResources map[string][]metav1.APIResource
-}
-
-// NewDiscoveryRESTMapper returns a PriorityRESTMapper based on the discovered
-// groups and resources passed in.
-func NewDiscoveryRESTMapper(groupResources []*APIGroupResources) meta.RESTMapper {
- unionMapper := meta.MultiRESTMapper{}
-
- var groupPriority []string
- // /v1 is special. It should always come first
- resourcePriority := []schema.GroupVersionResource{{Group: "", Version: "v1", Resource: meta.AnyResource}}
- kindPriority := []schema.GroupVersionKind{{Group: "", Version: "v1", Kind: meta.AnyKind}}
-
- for _, group := range groupResources {
- groupPriority = append(groupPriority, group.Group.Name)
-
- // Make sure the preferred version comes first
- if len(group.Group.PreferredVersion.Version) != 0 {
- preferred := group.Group.PreferredVersion.Version
- if _, ok := group.VersionedResources[preferred]; ok {
- resourcePriority = append(resourcePriority, schema.GroupVersionResource{
- Group: group.Group.Name,
- Version: group.Group.PreferredVersion.Version,
- Resource: meta.AnyResource,
- })
-
- kindPriority = append(kindPriority, schema.GroupVersionKind{
- Group: group.Group.Name,
- Version: group.Group.PreferredVersion.Version,
- Kind: meta.AnyKind,
- })
- }
- }
-
- for _, discoveryVersion := range group.Group.Versions {
- resources, ok := group.VersionedResources[discoveryVersion.Version]
- if !ok {
- continue
- }
-
- // Add non-preferred versions after the preferred version, in case there are resources that only exist in those versions
- if discoveryVersion.Version != group.Group.PreferredVersion.Version {
- resourcePriority = append(resourcePriority, schema.GroupVersionResource{
- Group: group.Group.Name,
- Version: discoveryVersion.Version,
- Resource: meta.AnyResource,
- })
-
- kindPriority = append(kindPriority, schema.GroupVersionKind{
- Group: group.Group.Name,
- Version: discoveryVersion.Version,
- Kind: meta.AnyKind,
- })
- }
-
- gv := schema.GroupVersion{Group: group.Group.Name, Version: discoveryVersion.Version}
- versionMapper := meta.NewDefaultRESTMapper([]schema.GroupVersion{gv})
-
- for _, resource := range resources {
- scope := meta.RESTScopeNamespace
- if !resource.Namespaced {
- scope = meta.RESTScopeRoot
- }
-
- // if we have a slash, then this is a subresource and we shouldn't create mappings for those.
- if strings.Contains(resource.Name, "/") {
- continue
- }
-
- plural := gv.WithResource(resource.Name)
- singular := gv.WithResource(resource.SingularName)
- // this is for legacy resources and servers which don't list singular forms. For those we must still guess.
- if len(resource.SingularName) == 0 {
- _, singular = meta.UnsafeGuessKindToResource(gv.WithKind(resource.Kind))
- }
-
- versionMapper.AddSpecific(gv.WithKind(strings.ToLower(resource.Kind)), plural, singular, scope)
- versionMapper.AddSpecific(gv.WithKind(resource.Kind), plural, singular, scope)
- // TODO this is producing unsafe guesses that don't actually work, but it matches previous behavior
- versionMapper.Add(gv.WithKind(resource.Kind+"List"), scope)
- }
- // TODO why is this type not in discovery (at least for "v1")
- versionMapper.Add(gv.WithKind("List"), meta.RESTScopeRoot)
- unionMapper = append(unionMapper, versionMapper)
- }
- }
-
- for _, group := range groupPriority {
- resourcePriority = append(resourcePriority, schema.GroupVersionResource{
- Group: group,
- Version: meta.AnyVersion,
- Resource: meta.AnyResource,
- })
- kindPriority = append(kindPriority, schema.GroupVersionKind{
- Group: group,
- Version: meta.AnyVersion,
- Kind: meta.AnyKind,
- })
- }
-
- return meta.PriorityRESTMapper{
- Delegate: unionMapper,
- ResourcePriority: resourcePriority,
- KindPriority: kindPriority,
- }
-}
-
-// GetAPIGroupResources uses the provided discovery client to gather
-// discovery information and populate a slice of APIGroupResources.
-func GetAPIGroupResources(cl discovery.DiscoveryInterface) ([]*APIGroupResources, error) {
- apiGroups, err := cl.ServerGroups()
- if err != nil {
- if apiGroups == nil || len(apiGroups.Groups) == 0 {
- return nil, err
- }
- // TODO track the errors and update callers to handle partial errors.
- }
- var result []*APIGroupResources
- for _, group := range apiGroups.Groups {
- groupResources := &APIGroupResources{
- Group: group,
- VersionedResources: make(map[string][]metav1.APIResource),
- }
- for _, version := range group.Versions {
- resources, err := cl.ServerResourcesForGroupVersion(version.GroupVersion)
- if err != nil {
- // continue as best we can
- // TODO track the errors and update callers to handle partial errors.
- if resources == nil || len(resources.APIResources) == 0 {
- continue
- }
- }
- groupResources.VersionedResources[version.Version] = resources.APIResources
- }
- result = append(result, groupResources)
- }
- return result, nil
-}
-
-// DeferredDiscoveryRESTMapper is a RESTMapper that will defer
-// initialization of the RESTMapper until the first mapping is
-// requested.
-type DeferredDiscoveryRESTMapper struct {
- initMu sync.Mutex
- delegate meta.RESTMapper
- cl discovery.CachedDiscoveryInterface
-}
-
-// NewDeferredDiscoveryRESTMapper returns a
-// DeferredDiscoveryRESTMapper that will lazily query the provided
-// client for discovery information to do REST mappings.
-func NewDeferredDiscoveryRESTMapper(cl discovery.CachedDiscoveryInterface) *DeferredDiscoveryRESTMapper {
- return &DeferredDiscoveryRESTMapper{
- cl: cl,
- }
-}
-
-func (d *DeferredDiscoveryRESTMapper) getDelegate() (meta.RESTMapper, error) {
- d.initMu.Lock()
- defer d.initMu.Unlock()
-
- if d.delegate != nil {
- return d.delegate, nil
- }
-
- groupResources, err := GetAPIGroupResources(d.cl)
- if err != nil {
- return nil, err
- }
-
- d.delegate = NewDiscoveryRESTMapper(groupResources)
- return d.delegate, err
-}
-
-// Reset resets the internally cached Discovery information and will
-// cause the next mapping request to re-discover.
-func (d *DeferredDiscoveryRESTMapper) Reset() {
- glog.V(5).Info("Invalidating discovery information")
-
- d.initMu.Lock()
- defer d.initMu.Unlock()
-
- d.cl.Invalidate()
- d.delegate = nil
-}
-
-// KindFor takes a partial resource and returns back the single match.
-// It returns an error if there are multiple matches.
-func (d *DeferredDiscoveryRESTMapper) KindFor(resource schema.GroupVersionResource) (gvk schema.GroupVersionKind, err error) {
- del, err := d.getDelegate()
- if err != nil {
- return schema.GroupVersionKind{}, err
- }
- gvk, err = del.KindFor(resource)
- if err != nil && !d.cl.Fresh() {
- d.Reset()
- gvk, err = d.KindFor(resource)
- }
- return
-}
-
-// KindsFor takes a partial resource and returns back the list of
-// potential kinds in priority order.
-func (d *DeferredDiscoveryRESTMapper) KindsFor(resource schema.GroupVersionResource) (gvks []schema.GroupVersionKind, err error) {
- del, err := d.getDelegate()
- if err != nil {
- return nil, err
- }
- gvks, err = del.KindsFor(resource)
- if len(gvks) == 0 && !d.cl.Fresh() {
- d.Reset()
- gvks, err = d.KindsFor(resource)
- }
- return
-}
-
-// ResourceFor takes a partial resource and returns back the single
-// match. It returns an error if there are multiple matches.
-func (d *DeferredDiscoveryRESTMapper) ResourceFor(input schema.GroupVersionResource) (gvr schema.GroupVersionResource, err error) {
- del, err := d.getDelegate()
- if err != nil {
- return schema.GroupVersionResource{}, err
- }
- gvr, err = del.ResourceFor(input)
- if err != nil && !d.cl.Fresh() {
- d.Reset()
- gvr, err = d.ResourceFor(input)
- }
- return
-}
-
-// ResourcesFor takes a partial resource and returns back the list of
-// potential resource in priority order.
-func (d *DeferredDiscoveryRESTMapper) ResourcesFor(input schema.GroupVersionResource) (gvrs []schema.GroupVersionResource, err error) {
- del, err := d.getDelegate()
- if err != nil {
- return nil, err
- }
- gvrs, err = del.ResourcesFor(input)
- if len(gvrs) == 0 && !d.cl.Fresh() {
- d.Reset()
- gvrs, err = d.ResourcesFor(input)
- }
- return
-}
-
-// RESTMapping identifies a preferred resource mapping for the
-// provided group kind.
-func (d *DeferredDiscoveryRESTMapper) RESTMapping(gk schema.GroupKind, versions ...string) (m *meta.RESTMapping, err error) {
- del, err := d.getDelegate()
- if err != nil {
- return nil, err
- }
- m, err = del.RESTMapping(gk, versions...)
- if err != nil && !d.cl.Fresh() {
- d.Reset()
- m, err = d.RESTMapping(gk, versions...)
- }
- return
-}
-
-// RESTMappings returns the RESTMappings for the provided group kind
-// in a rough internal preferred order. If no kind is found, it will
-// return a NoResourceMatchError.
-func (d *DeferredDiscoveryRESTMapper) RESTMappings(gk schema.GroupKind, versions ...string) (ms []*meta.RESTMapping, err error) {
- del, err := d.getDelegate()
- if err != nil {
- return nil, err
- }
- ms, err = del.RESTMappings(gk, versions...)
- if len(ms) == 0 && !d.cl.Fresh() {
- d.Reset()
- ms, err = d.RESTMappings(gk, versions...)
- }
- return
-}
-
-// ResourceSingularizer converts a resource name from plural to
-// singular (e.g., from pods to pod).
-func (d *DeferredDiscoveryRESTMapper) ResourceSingularizer(resource string) (singular string, err error) {
- del, err := d.getDelegate()
- if err != nil {
- return resource, err
- }
- singular, err = del.ResourceSingularizer(resource)
- if err != nil && !d.cl.Fresh() {
- d.Reset()
- singular, err = d.ResourceSingularizer(resource)
- }
- return
-}
-
-func (d *DeferredDiscoveryRESTMapper) String() string {
- del, err := d.getDelegate()
- if err != nil {
- return fmt.Sprintf("DeferredDiscoveryRESTMapper{%v}", err)
- }
- return fmt.Sprintf("DeferredDiscoveryRESTMapper{\n\t%v\n}", del)
-}
-
-// Make sure it satisfies the interface
-var _ meta.RESTMapper = &DeferredDiscoveryRESTMapper{}
diff --git a/vendor/k8s.io/client-go/restmapper/shortcut.go b/vendor/k8s.io/client-go/restmapper/shortcut.go
deleted file mode 100644
index d9f4be0b6b..0000000000
--- a/vendor/k8s.io/client-go/restmapper/shortcut.go
+++ /dev/null
@@ -1,172 +0,0 @@
-/*
-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
-
-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.
-*/
-
-package restmapper
-
-import (
- "strings"
-
- "github.com/golang/glog"
-
- "k8s.io/apimachinery/pkg/api/meta"
- metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
- "k8s.io/apimachinery/pkg/runtime/schema"
- "k8s.io/client-go/discovery"
-)
-
-// shortcutExpander is a RESTMapper that can be used for Kubernetes resources. It expands the resource first, then invokes the wrapped
-type shortcutExpander struct {
- RESTMapper meta.RESTMapper
-
- discoveryClient discovery.DiscoveryInterface
-}
-
-var _ meta.RESTMapper = &shortcutExpander{}
-
-// NewShortcutExpander wraps a restmapper in a layer that expands shortcuts found via discovery
-func NewShortcutExpander(delegate meta.RESTMapper, client discovery.DiscoveryInterface) meta.RESTMapper {
- return shortcutExpander{RESTMapper: delegate, discoveryClient: client}
-}
-
-// KindFor fulfills meta.RESTMapper
-func (e shortcutExpander) KindFor(resource schema.GroupVersionResource) (schema.GroupVersionKind, error) {
- return e.RESTMapper.KindFor(e.expandResourceShortcut(resource))
-}
-
-// KindsFor fulfills meta.RESTMapper
-func (e shortcutExpander) KindsFor(resource schema.GroupVersionResource) ([]schema.GroupVersionKind, error) {
- return e.RESTMapper.KindsFor(e.expandResourceShortcut(resource))
-}
-
-// ResourcesFor fulfills meta.RESTMapper
-func (e shortcutExpander) ResourcesFor(resource schema.GroupVersionResource) ([]schema.GroupVersionResource, error) {
- return e.RESTMapper.ResourcesFor(e.expandResourceShortcut(resource))
-}
-
-// ResourceFor fulfills meta.RESTMapper
-func (e shortcutExpander) ResourceFor(resource schema.GroupVersionResource) (schema.GroupVersionResource, error) {
- return e.RESTMapper.ResourceFor(e.expandResourceShortcut(resource))
-}
-
-// ResourceSingularizer fulfills meta.RESTMapper
-func (e shortcutExpander) ResourceSingularizer(resource string) (string, error) {
- return e.RESTMapper.ResourceSingularizer(e.expandResourceShortcut(schema.GroupVersionResource{Resource: resource}).Resource)
-}
-
-// RESTMapping fulfills meta.RESTMapper
-func (e shortcutExpander) RESTMapping(gk schema.GroupKind, versions ...string) (*meta.RESTMapping, error) {
- return e.RESTMapper.RESTMapping(gk, versions...)
-}
-
-// RESTMappings fulfills meta.RESTMapper
-func (e shortcutExpander) RESTMappings(gk schema.GroupKind, versions ...string) ([]*meta.RESTMapping, error) {
- return e.RESTMapper.RESTMappings(gk, versions...)
-}
-
-// getShortcutMappings returns a set of tuples which holds short names for resources.
-// First the list of potential resources will be taken from the API server.
-// Next we will append the hardcoded list of resources - to be backward compatible with old servers.
-// NOTE that the list is ordered by group priority.
-func (e shortcutExpander) getShortcutMappings() ([]*metav1.APIResourceList, []resourceShortcuts, error) {
- res := []resourceShortcuts{}
- // get server resources
- // This can return an error *and* the results it was able to find. We don't need to fail on the error.
- apiResList, err := e.discoveryClient.ServerResources()
- if err != nil {
- glog.V(1).Infof("Error loading discovery information: %v", err)
- }
- for _, apiResources := range apiResList {
- gv, err := schema.ParseGroupVersion(apiResources.GroupVersion)
- if err != nil {
- glog.V(1).Infof("Unable to parse groupversion = %s due to = %s", apiResources.GroupVersion, err.Error())
- continue
- }
- for _, apiRes := range apiResources.APIResources {
- for _, shortName := range apiRes.ShortNames {
- rs := resourceShortcuts{
- ShortForm: schema.GroupResource{Group: gv.Group, Resource: shortName},
- LongForm: schema.GroupResource{Group: gv.Group, Resource: apiRes.Name},
- }
- res = append(res, rs)
- }
- }
- }
-
- return apiResList, res, nil
-}
-
-// expandResourceShortcut will return the expanded version of resource
-// (something that a pkg/api/meta.RESTMapper can understand), if it is
-// indeed a shortcut. If no match has been found, we will match on group prefixing.
-// Lastly we will return resource unmodified.
-func (e shortcutExpander) expandResourceShortcut(resource schema.GroupVersionResource) schema.GroupVersionResource {
- // get the shortcut mappings and return on first match.
- if allResources, shortcutResources, err := e.getShortcutMappings(); err == nil {
- // avoid expanding if there's an exact match to a full resource name
- for _, apiResources := range allResources {
- gv, err := schema.ParseGroupVersion(apiResources.GroupVersion)
- if err != nil {
- continue
- }
- if len(resource.Group) != 0 && resource.Group != gv.Group {
- continue
- }
- for _, apiRes := range apiResources.APIResources {
- if resource.Resource == apiRes.Name {
- return resource
- }
- if resource.Resource == apiRes.SingularName {
- return resource
- }
- }
- }
-
- for _, item := range shortcutResources {
- if len(resource.Group) != 0 && resource.Group != item.ShortForm.Group {
- continue
- }
- if resource.Resource == item.ShortForm.Resource {
- resource.Resource = item.LongForm.Resource
- resource.Group = item.LongForm.Group
- return resource
- }
- }
-
- // we didn't find exact match so match on group prefixing. This allows autoscal to match autoscaling
- if len(resource.Group) == 0 {
- return resource
- }
- for _, item := range shortcutResources {
- if !strings.HasPrefix(item.ShortForm.Group, resource.Group) {
- continue
- }
- if resource.Resource == item.ShortForm.Resource {
- resource.Resource = item.LongForm.Resource
- resource.Group = item.LongForm.Group
- return resource
- }
- }
- }
-
- return resource
-}
-
-// ResourceShortcuts represents a structure that holds the information how to
-// transition from resource's shortcut to its full name.
-type resourceShortcuts struct {
- ShortForm schema.GroupResource
- LongForm schema.GroupResource
-}
diff --git a/vendor/k8s.io/client-go/third_party/forked/golang/template/exec.go b/vendor/k8s.io/client-go/third_party/forked/golang/template/exec.go
deleted file mode 100644
index 739fd3509c..0000000000
--- a/vendor/k8s.io/client-go/third_party/forked/golang/template/exec.go
+++ /dev/null
@@ -1,94 +0,0 @@
-//This package is copied from Go library text/template.
-//The original private functions indirect and printableValue
-//are exported as public functions.
-package template
-
-import (
- "fmt"
- "reflect"
-)
-
-var Indirect = indirect
-var PrintableValue = printableValue
-
-var (
- errorType = reflect.TypeOf((*error)(nil)).Elem()
- fmtStringerType = reflect.TypeOf((*fmt.Stringer)(nil)).Elem()
-)
-
-// indirect returns the item at the end of indirection, and a bool to indicate if it's nil.
-// We indirect through pointers and empty interfaces (only) because
-// non-empty interfaces have methods we might need.
-func indirect(v reflect.Value) (rv reflect.Value, isNil bool) {
- for ; v.Kind() == reflect.Ptr || v.Kind() == reflect.Interface; v = v.Elem() {
- if v.IsNil() {
- return v, true
- }
- if v.Kind() == reflect.Interface && v.NumMethod() > 0 {
- break
- }
- }
- return v, false
-}
-
-// printableValue returns the, possibly indirected, interface value inside v that
-// is best for a call to formatted printer.
-func printableValue(v reflect.Value) (interface{}, bool) {
- if v.Kind() == reflect.Ptr {
- v, _ = indirect(v) // fmt.Fprint handles nil.
- }
- if !v.IsValid() {
- return "", true
- }
-
- if !v.Type().Implements(errorType) && !v.Type().Implements(fmtStringerType) {
- if v.CanAddr() && (reflect.PtrTo(v.Type()).Implements(errorType) || reflect.PtrTo(v.Type()).Implements(fmtStringerType)) {
- v = v.Addr()
- } else {
- switch v.Kind() {
- case reflect.Chan, reflect.Func:
- return nil, false
- }
- }
- }
- return v.Interface(), true
-}
-
-// canBeNil reports whether an untyped nil can be assigned to the type. See reflect.Zero.
-func canBeNil(typ reflect.Type) bool {
- switch typ.Kind() {
- case reflect.Chan, reflect.Func, reflect.Interface, reflect.Map, reflect.Ptr, reflect.Slice:
- return true
- }
- return false
-}
-
-// isTrue reports whether the value is 'true', in the sense of not the zero of its type,
-// and whether the value has a meaningful truth value.
-func isTrue(val reflect.Value) (truth, ok bool) {
- if !val.IsValid() {
- // Something like var x interface{}, never set. It's a form of nil.
- return false, true
- }
- switch val.Kind() {
- case reflect.Array, reflect.Map, reflect.Slice, reflect.String:
- truth = val.Len() > 0
- case reflect.Bool:
- truth = val.Bool()
- case reflect.Complex64, reflect.Complex128:
- truth = val.Complex() != 0
- case reflect.Chan, reflect.Func, reflect.Ptr, reflect.Interface:
- truth = !val.IsNil()
- case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
- truth = val.Int() != 0
- case reflect.Float32, reflect.Float64:
- truth = val.Float() != 0
- case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr:
- truth = val.Uint() != 0
- case reflect.Struct:
- truth = true // Struct values are always true.
- default:
- return
- }
- return truth, true
-}
diff --git a/vendor/k8s.io/client-go/third_party/forked/golang/template/funcs.go b/vendor/k8s.io/client-go/third_party/forked/golang/template/funcs.go
deleted file mode 100644
index 27a008b0a7..0000000000
--- a/vendor/k8s.io/client-go/third_party/forked/golang/template/funcs.go
+++ /dev/null
@@ -1,599 +0,0 @@
-//This package is copied from Go library text/template.
-//The original private functions eq, ge, gt, le, lt, and ne
-//are exported as public functions.
-package template
-
-import (
- "bytes"
- "errors"
- "fmt"
- "io"
- "net/url"
- "reflect"
- "strings"
- "unicode"
- "unicode/utf8"
-)
-
-var Equal = eq
-var GreaterEqual = ge
-var Greater = gt
-var LessEqual = le
-var Less = lt
-var NotEqual = ne
-
-// FuncMap is the type of the map defining the mapping from names to functions.
-// Each function must have either a single return value, or two return values of
-// which the second has type error. In that case, if the second (error)
-// return value evaluates to non-nil during execution, execution terminates and
-// Execute returns that error.
-type FuncMap map[string]interface{}
-
-var builtins = FuncMap{
- "and": and,
- "call": call,
- "html": HTMLEscaper,
- "index": index,
- "js": JSEscaper,
- "len": length,
- "not": not,
- "or": or,
- "print": fmt.Sprint,
- "printf": fmt.Sprintf,
- "println": fmt.Sprintln,
- "urlquery": URLQueryEscaper,
-
- // Comparisons
- "eq": eq, // ==
- "ge": ge, // >=
- "gt": gt, // >
- "le": le, // <=
- "lt": lt, // <
- "ne": ne, // !=
-}
-
-var builtinFuncs = createValueFuncs(builtins)
-
-// createValueFuncs turns a FuncMap into a map[string]reflect.Value
-func createValueFuncs(funcMap FuncMap) map[string]reflect.Value {
- m := make(map[string]reflect.Value)
- addValueFuncs(m, funcMap)
- return m
-}
-
-// addValueFuncs adds to values the functions in funcs, converting them to reflect.Values.
-func addValueFuncs(out map[string]reflect.Value, in FuncMap) {
- for name, fn := range in {
- v := reflect.ValueOf(fn)
- if v.Kind() != reflect.Func {
- panic("value for " + name + " not a function")
- }
- if !goodFunc(v.Type()) {
- panic(fmt.Errorf("can't install method/function %q with %d results", name, v.Type().NumOut()))
- }
- out[name] = v
- }
-}
-
-// AddFuncs adds to values the functions in funcs. It does no checking of the input -
-// call addValueFuncs first.
-func addFuncs(out, in FuncMap) {
- for name, fn := range in {
- out[name] = fn
- }
-}
-
-// goodFunc checks that the function or method has the right result signature.
-func goodFunc(typ reflect.Type) bool {
- // We allow functions with 1 result or 2 results where the second is an error.
- switch {
- case typ.NumOut() == 1:
- return true
- case typ.NumOut() == 2 && typ.Out(1) == errorType:
- return true
- }
- return false
-}
-
-// findFunction looks for a function in the template, and global map.
-func findFunction(name string) (reflect.Value, bool) {
- if fn := builtinFuncs[name]; fn.IsValid() {
- return fn, true
- }
- return reflect.Value{}, false
-}
-
-// Indexing.
-
-// index returns the result of indexing its first argument by the following
-// arguments. Thus "index x 1 2 3" is, in Go syntax, x[1][2][3]. Each
-// indexed item must be a map, slice, or array.
-func index(item interface{}, indices ...interface{}) (interface{}, error) {
- v := reflect.ValueOf(item)
- for _, i := range indices {
- index := reflect.ValueOf(i)
- var isNil bool
- if v, isNil = indirect(v); isNil {
- return nil, fmt.Errorf("index of nil pointer")
- }
- switch v.Kind() {
- case reflect.Array, reflect.Slice, reflect.String:
- var x int64
- switch index.Kind() {
- case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
- x = index.Int()
- case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr:
- x = int64(index.Uint())
- default:
- return nil, fmt.Errorf("cannot index slice/array with type %s", index.Type())
- }
- if x < 0 || x >= int64(v.Len()) {
- return nil, fmt.Errorf("index out of range: %d", x)
- }
- v = v.Index(int(x))
- case reflect.Map:
- if !index.IsValid() {
- index = reflect.Zero(v.Type().Key())
- }
- if !index.Type().AssignableTo(v.Type().Key()) {
- return nil, fmt.Errorf("%s is not index type for %s", index.Type(), v.Type())
- }
- if x := v.MapIndex(index); x.IsValid() {
- v = x
- } else {
- v = reflect.Zero(v.Type().Elem())
- }
- default:
- return nil, fmt.Errorf("can't index item of type %s", v.Type())
- }
- }
- return v.Interface(), nil
-}
-
-// Length
-
-// length returns the length of the item, with an error if it has no defined length.
-func length(item interface{}) (int, error) {
- v, isNil := indirect(reflect.ValueOf(item))
- if isNil {
- return 0, fmt.Errorf("len of nil pointer")
- }
- switch v.Kind() {
- case reflect.Array, reflect.Chan, reflect.Map, reflect.Slice, reflect.String:
- return v.Len(), nil
- }
- return 0, fmt.Errorf("len of type %s", v.Type())
-}
-
-// Function invocation
-
-// call returns the result of evaluating the first argument as a function.
-// The function must return 1 result, or 2 results, the second of which is an error.
-func call(fn interface{}, args ...interface{}) (interface{}, error) {
- v := reflect.ValueOf(fn)
- typ := v.Type()
- if typ.Kind() != reflect.Func {
- return nil, fmt.Errorf("non-function of type %s", typ)
- }
- if !goodFunc(typ) {
- return nil, fmt.Errorf("function called with %d args; should be 1 or 2", typ.NumOut())
- }
- numIn := typ.NumIn()
- var dddType reflect.Type
- if typ.IsVariadic() {
- if len(args) < numIn-1 {
- return nil, fmt.Errorf("wrong number of args: got %d want at least %d", len(args), numIn-1)
- }
- dddType = typ.In(numIn - 1).Elem()
- } else {
- if len(args) != numIn {
- return nil, fmt.Errorf("wrong number of args: got %d want %d", len(args), numIn)
- }
- }
- argv := make([]reflect.Value, len(args))
- for i, arg := range args {
- value := reflect.ValueOf(arg)
- // Compute the expected type. Clumsy because of variadics.
- var argType reflect.Type
- if !typ.IsVariadic() || i < numIn-1 {
- argType = typ.In(i)
- } else {
- argType = dddType
- }
- if !value.IsValid() && canBeNil(argType) {
- value = reflect.Zero(argType)
- }
- if !value.Type().AssignableTo(argType) {
- return nil, fmt.Errorf("arg %d has type %s; should be %s", i, value.Type(), argType)
- }
- argv[i] = value
- }
- result := v.Call(argv)
- if len(result) == 2 && !result[1].IsNil() {
- return result[0].Interface(), result[1].Interface().(error)
- }
- return result[0].Interface(), nil
-}
-
-// Boolean logic.
-
-func truth(a interface{}) bool {
- t, _ := isTrue(reflect.ValueOf(a))
- return t
-}
-
-// and computes the Boolean AND of its arguments, returning
-// the first false argument it encounters, or the last argument.
-func and(arg0 interface{}, args ...interface{}) interface{} {
- if !truth(arg0) {
- return arg0
- }
- for i := range args {
- arg0 = args[i]
- if !truth(arg0) {
- break
- }
- }
- return arg0
-}
-
-// or computes the Boolean OR of its arguments, returning
-// the first true argument it encounters, or the last argument.
-func or(arg0 interface{}, args ...interface{}) interface{} {
- if truth(arg0) {
- return arg0
- }
- for i := range args {
- arg0 = args[i]
- if truth(arg0) {
- break
- }
- }
- return arg0
-}
-
-// not returns the Boolean negation of its argument.
-func not(arg interface{}) (truth bool) {
- truth, _ = isTrue(reflect.ValueOf(arg))
- return !truth
-}
-
-// Comparison.
-
-// TODO: Perhaps allow comparison between signed and unsigned integers.
-
-var (
- errBadComparisonType = errors.New("invalid type for comparison")
- errBadComparison = errors.New("incompatible types for comparison")
- errNoComparison = errors.New("missing argument for comparison")
-)
-
-type kind int
-
-const (
- invalidKind kind = iota
- boolKind
- complexKind
- intKind
- floatKind
- integerKind
- stringKind
- uintKind
-)
-
-func basicKind(v reflect.Value) (kind, error) {
- switch v.Kind() {
- case reflect.Bool:
- return boolKind, nil
- case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
- return intKind, nil
- case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr:
- return uintKind, nil
- case reflect.Float32, reflect.Float64:
- return floatKind, nil
- case reflect.Complex64, reflect.Complex128:
- return complexKind, nil
- case reflect.String:
- return stringKind, nil
- }
- return invalidKind, errBadComparisonType
-}
-
-// eq evaluates the comparison a == b || a == c || ...
-func eq(arg1 interface{}, arg2 ...interface{}) (bool, error) {
- v1 := reflect.ValueOf(arg1)
- k1, err := basicKind(v1)
- if err != nil {
- return false, err
- }
- if len(arg2) == 0 {
- return false, errNoComparison
- }
- for _, arg := range arg2 {
- v2 := reflect.ValueOf(arg)
- k2, err := basicKind(v2)
- if err != nil {
- return false, err
- }
- truth := false
- if k1 != k2 {
- // Special case: Can compare integer values regardless of type's sign.
- switch {
- case k1 == intKind && k2 == uintKind:
- truth = v1.Int() >= 0 && uint64(v1.Int()) == v2.Uint()
- case k1 == uintKind && k2 == intKind:
- truth = v2.Int() >= 0 && v1.Uint() == uint64(v2.Int())
- default:
- return false, errBadComparison
- }
- } else {
- switch k1 {
- case boolKind:
- truth = v1.Bool() == v2.Bool()
- case complexKind:
- truth = v1.Complex() == v2.Complex()
- case floatKind:
- truth = v1.Float() == v2.Float()
- case intKind:
- truth = v1.Int() == v2.Int()
- case stringKind:
- truth = v1.String() == v2.String()
- case uintKind:
- truth = v1.Uint() == v2.Uint()
- default:
- panic("invalid kind")
- }
- }
- if truth {
- return true, nil
- }
- }
- return false, nil
-}
-
-// ne evaluates the comparison a != b.
-func ne(arg1, arg2 interface{}) (bool, error) {
- // != is the inverse of ==.
- equal, err := eq(arg1, arg2)
- return !equal, err
-}
-
-// lt evaluates the comparison a < b.
-func lt(arg1, arg2 interface{}) (bool, error) {
- v1 := reflect.ValueOf(arg1)
- k1, err := basicKind(v1)
- if err != nil {
- return false, err
- }
- v2 := reflect.ValueOf(arg2)
- k2, err := basicKind(v2)
- if err != nil {
- return false, err
- }
- truth := false
- if k1 != k2 {
- // Special case: Can compare integer values regardless of type's sign.
- switch {
- case k1 == intKind && k2 == uintKind:
- truth = v1.Int() < 0 || uint64(v1.Int()) < v2.Uint()
- case k1 == uintKind && k2 == intKind:
- truth = v2.Int() >= 0 && v1.Uint() < uint64(v2.Int())
- default:
- return false, errBadComparison
- }
- } else {
- switch k1 {
- case boolKind, complexKind:
- return false, errBadComparisonType
- case floatKind:
- truth = v1.Float() < v2.Float()
- case intKind:
- truth = v1.Int() < v2.Int()
- case stringKind:
- truth = v1.String() < v2.String()
- case uintKind:
- truth = v1.Uint() < v2.Uint()
- default:
- panic("invalid kind")
- }
- }
- return truth, nil
-}
-
-// le evaluates the comparison <= b.
-func le(arg1, arg2 interface{}) (bool, error) {
- // <= is < or ==.
- lessThan, err := lt(arg1, arg2)
- if lessThan || err != nil {
- return lessThan, err
- }
- return eq(arg1, arg2)
-}
-
-// gt evaluates the comparison a > b.
-func gt(arg1, arg2 interface{}) (bool, error) {
- // > is the inverse of <=.
- lessOrEqual, err := le(arg1, arg2)
- if err != nil {
- return false, err
- }
- return !lessOrEqual, nil
-}
-
-// ge evaluates the comparison a >= b.
-func ge(arg1, arg2 interface{}) (bool, error) {
- // >= is the inverse of <.
- lessThan, err := lt(arg1, arg2)
- if err != nil {
- return false, err
- }
- return !lessThan, nil
-}
-
-// HTML escaping.
-
-var (
- htmlQuot = []byte(""") // shorter than """
- htmlApos = []byte("'") // shorter than "'" and apos was not in HTML until HTML5
- htmlAmp = []byte("&")
- htmlLt = []byte("<")
- htmlGt = []byte(">")
-)
-
-// HTMLEscape writes to w the escaped HTML equivalent of the plain text data b.
-func HTMLEscape(w io.Writer, b []byte) {
- last := 0
- for i, c := range b {
- var html []byte
- switch c {
- case '"':
- html = htmlQuot
- case '\'':
- html = htmlApos
- case '&':
- html = htmlAmp
- case '<':
- html = htmlLt
- case '>':
- html = htmlGt
- default:
- continue
- }
- w.Write(b[last:i])
- w.Write(html)
- last = i + 1
- }
- w.Write(b[last:])
-}
-
-// HTMLEscapeString returns the escaped HTML equivalent of the plain text data s.
-func HTMLEscapeString(s string) string {
- // Avoid allocation if we can.
- if strings.IndexAny(s, `'"&<>`) < 0 {
- return s
- }
- var b bytes.Buffer
- HTMLEscape(&b, []byte(s))
- return b.String()
-}
-
-// HTMLEscaper returns the escaped HTML equivalent of the textual
-// representation of its arguments.
-func HTMLEscaper(args ...interface{}) string {
- return HTMLEscapeString(evalArgs(args))
-}
-
-// JavaScript escaping.
-
-var (
- jsLowUni = []byte(`\u00`)
- hex = []byte("0123456789ABCDEF")
-
- jsBackslash = []byte(`\\`)
- jsApos = []byte(`\'`)
- jsQuot = []byte(`\"`)
- jsLt = []byte(`\x3C`)
- jsGt = []byte(`\x3E`)
-)
-
-// JSEscape writes to w the escaped JavaScript equivalent of the plain text data b.
-func JSEscape(w io.Writer, b []byte) {
- last := 0
- for i := 0; i < len(b); i++ {
- c := b[i]
-
- if !jsIsSpecial(rune(c)) {
- // fast path: nothing to do
- continue
- }
- w.Write(b[last:i])
-
- if c < utf8.RuneSelf {
- // Quotes, slashes and angle brackets get quoted.
- // Control characters get written as \u00XX.
- switch c {
- case '\\':
- w.Write(jsBackslash)
- case '\'':
- w.Write(jsApos)
- case '"':
- w.Write(jsQuot)
- case '<':
- w.Write(jsLt)
- case '>':
- w.Write(jsGt)
- default:
- w.Write(jsLowUni)
- t, b := c>>4, c&0x0f
- w.Write(hex[t : t+1])
- w.Write(hex[b : b+1])
- }
- } else {
- // Unicode rune.
- r, size := utf8.DecodeRune(b[i:])
- if unicode.IsPrint(r) {
- w.Write(b[i : i+size])
- } else {
- fmt.Fprintf(w, "\\u%04X", r)
- }
- i += size - 1
- }
- last = i + 1
- }
- w.Write(b[last:])
-}
-
-// JSEscapeString returns the escaped JavaScript equivalent of the plain text data s.
-func JSEscapeString(s string) string {
- // Avoid allocation if we can.
- if strings.IndexFunc(s, jsIsSpecial) < 0 {
- return s
- }
- var b bytes.Buffer
- JSEscape(&b, []byte(s))
- return b.String()
-}
-
-func jsIsSpecial(r rune) bool {
- switch r {
- case '\\', '\'', '"', '<', '>':
- return true
- }
- return r < ' ' || utf8.RuneSelf <= r
-}
-
-// JSEscaper returns the escaped JavaScript equivalent of the textual
-// representation of its arguments.
-func JSEscaper(args ...interface{}) string {
- return JSEscapeString(evalArgs(args))
-}
-
-// URLQueryEscaper returns the escaped value of the textual representation of
-// its arguments in a form suitable for embedding in a URL query.
-func URLQueryEscaper(args ...interface{}) string {
- return url.QueryEscape(evalArgs(args))
-}
-
-// evalArgs formats the list of arguments into a string. It is therefore equivalent to
-// fmt.Sprint(args...)
-// except that each argument is indirected (if a pointer), as required,
-// using the same rules as the default string evaluation during template
-// execution.
-func evalArgs(args []interface{}) string {
- ok := false
- var s string
- // Fast path for simple common case.
- if len(args) == 1 {
- s, ok = args[0].(string)
- }
- if !ok {
- for i, arg := range args {
- a, ok := printableValue(reflect.ValueOf(arg))
- if ok {
- args[i] = a
- } // else left fmt do its thing
- }
- s = fmt.Sprint(args...)
- }
- return s
-}
diff --git a/vendor/k8s.io/client-go/util/jsonpath/doc.go b/vendor/k8s.io/client-go/util/jsonpath/doc.go
deleted file mode 100644
index 0effb15c41..0000000000
--- a/vendor/k8s.io/client-go/util/jsonpath/doc.go
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
-Copyright 2015 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
-
-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.
-*/
-
-// package jsonpath is a template engine using jsonpath syntax,
-// which can be seen at http://goessner.net/articles/JsonPath/.
-// In addition, it has {range} {end} function to iterate list and slice.
-package jsonpath // import "k8s.io/client-go/util/jsonpath"
diff --git a/vendor/k8s.io/client-go/util/jsonpath/jsonpath.go b/vendor/k8s.io/client-go/util/jsonpath/jsonpath.go
deleted file mode 100644
index 6633ca0d65..0000000000
--- a/vendor/k8s.io/client-go/util/jsonpath/jsonpath.go
+++ /dev/null
@@ -1,517 +0,0 @@
-/*
-Copyright 2015 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
-
-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.
-*/
-
-package jsonpath
-
-import (
- "bytes"
- "fmt"
- "io"
- "reflect"
- "strings"
-
- "k8s.io/client-go/third_party/forked/golang/template"
-)
-
-type JSONPath struct {
- name string
- parser *Parser
- stack [][]reflect.Value // push and pop values in different scopes
- cur []reflect.Value // current scope values
- beginRange int
- inRange int
- endRange int
-
- allowMissingKeys bool
-}
-
-// New creates a new JSONPath with the given name.
-func New(name string) *JSONPath {
- return &JSONPath{
- name: name,
- beginRange: 0,
- inRange: 0,
- endRange: 0,
- }
-}
-
-// AllowMissingKeys allows a caller to specify whether they want an error if a field or map key
-// cannot be located, or simply an empty result. The receiver is returned for chaining.
-func (j *JSONPath) AllowMissingKeys(allow bool) *JSONPath {
- j.allowMissingKeys = allow
- return j
-}
-
-// Parse parses the given template and returns an error.
-func (j *JSONPath) Parse(text string) error {
- var err error
- j.parser, err = Parse(j.name, text)
- return err
-}
-
-// Execute bounds data into template and writes the result.
-func (j *JSONPath) Execute(wr io.Writer, data interface{}) error {
- fullResults, err := j.FindResults(data)
- if err != nil {
- return err
- }
- for ix := range fullResults {
- if err := j.PrintResults(wr, fullResults[ix]); err != nil {
- return err
- }
- }
- return nil
-}
-
-func (j *JSONPath) FindResults(data interface{}) ([][]reflect.Value, error) {
- if j.parser == nil {
- return nil, fmt.Errorf("%s is an incomplete jsonpath template", j.name)
- }
-
- j.cur = []reflect.Value{reflect.ValueOf(data)}
- nodes := j.parser.Root.Nodes
- fullResult := [][]reflect.Value{}
- for i := 0; i < len(nodes); i++ {
- node := nodes[i]
- results, err := j.walk(j.cur, node)
- if err != nil {
- return nil, err
- }
-
- // encounter an end node, break the current block
- if j.endRange > 0 && j.endRange <= j.inRange {
- j.endRange -= 1
- break
- }
- // encounter a range node, start a range loop
- if j.beginRange > 0 {
- j.beginRange -= 1
- j.inRange += 1
- for k, value := range results {
- j.parser.Root.Nodes = nodes[i+1:]
- if k == len(results)-1 {
- j.inRange -= 1
- }
- nextResults, err := j.FindResults(value.Interface())
- if err != nil {
- return nil, err
- }
- fullResult = append(fullResult, nextResults...)
- }
- break
- }
- fullResult = append(fullResult, results)
- }
- return fullResult, nil
-}
-
-// PrintResults writes the results into writer
-func (j *JSONPath) PrintResults(wr io.Writer, results []reflect.Value) error {
- for i, r := range results {
- text, err := j.evalToText(r)
- if err != nil {
- return err
- }
- if i != len(results)-1 {
- text = append(text, ' ')
- }
- if _, err = wr.Write(text); err != nil {
- return err
- }
- }
- return nil
-}
-
-// walk visits tree rooted at the given node in DFS order
-func (j *JSONPath) walk(value []reflect.Value, node Node) ([]reflect.Value, error) {
- switch node := node.(type) {
- case *ListNode:
- return j.evalList(value, node)
- case *TextNode:
- return []reflect.Value{reflect.ValueOf(node.Text)}, nil
- case *FieldNode:
- return j.evalField(value, node)
- case *ArrayNode:
- return j.evalArray(value, node)
- case *FilterNode:
- return j.evalFilter(value, node)
- case *IntNode:
- return j.evalInt(value, node)
- case *BoolNode:
- return j.evalBool(value, node)
- case *FloatNode:
- return j.evalFloat(value, node)
- case *WildcardNode:
- return j.evalWildcard(value, node)
- case *RecursiveNode:
- return j.evalRecursive(value, node)
- case *UnionNode:
- return j.evalUnion(value, node)
- case *IdentifierNode:
- return j.evalIdentifier(value, node)
- default:
- return value, fmt.Errorf("unexpected Node %v", node)
- }
-}
-
-// evalInt evaluates IntNode
-func (j *JSONPath) evalInt(input []reflect.Value, node *IntNode) ([]reflect.Value, error) {
- result := make([]reflect.Value, len(input))
- for i := range input {
- result[i] = reflect.ValueOf(node.Value)
- }
- return result, nil
-}
-
-// evalFloat evaluates FloatNode
-func (j *JSONPath) evalFloat(input []reflect.Value, node *FloatNode) ([]reflect.Value, error) {
- result := make([]reflect.Value, len(input))
- for i := range input {
- result[i] = reflect.ValueOf(node.Value)
- }
- return result, nil
-}
-
-// evalBool evaluates BoolNode
-func (j *JSONPath) evalBool(input []reflect.Value, node *BoolNode) ([]reflect.Value, error) {
- result := make([]reflect.Value, len(input))
- for i := range input {
- result[i] = reflect.ValueOf(node.Value)
- }
- return result, nil
-}
-
-// evalList evaluates ListNode
-func (j *JSONPath) evalList(value []reflect.Value, node *ListNode) ([]reflect.Value, error) {
- var err error
- curValue := value
- for _, node := range node.Nodes {
- curValue, err = j.walk(curValue, node)
- if err != nil {
- return curValue, err
- }
- }
- return curValue, nil
-}
-
-// evalIdentifier evaluates IdentifierNode
-func (j *JSONPath) evalIdentifier(input []reflect.Value, node *IdentifierNode) ([]reflect.Value, error) {
- results := []reflect.Value{}
- switch node.Name {
- case "range":
- j.stack = append(j.stack, j.cur)
- j.beginRange += 1
- results = input
- case "end":
- if j.endRange < j.inRange { // inside a loop, break the current block
- j.endRange += 1
- break
- }
- // the loop is about to end, pop value and continue the following execution
- if len(j.stack) > 0 {
- j.cur, j.stack = j.stack[len(j.stack)-1], j.stack[:len(j.stack)-1]
- } else {
- return results, fmt.Errorf("not in range, nothing to end")
- }
- default:
- return input, fmt.Errorf("unrecognized identifier %v", node.Name)
- }
- return results, nil
-}
-
-// evalArray evaluates ArrayNode
-func (j *JSONPath) evalArray(input []reflect.Value, node *ArrayNode) ([]reflect.Value, error) {
- result := []reflect.Value{}
- for _, value := range input {
-
- value, isNil := template.Indirect(value)
- if isNil {
- continue
- }
- if value.Kind() != reflect.Array && value.Kind() != reflect.Slice {
- return input, fmt.Errorf("%v is not array or slice", value.Type())
- }
- params := node.Params
- if !params[0].Known {
- params[0].Value = 0
- }
- if params[0].Value < 0 {
- params[0].Value += value.Len()
- }
- if !params[1].Known {
- params[1].Value = value.Len()
- }
-
- if params[1].Value < 0 {
- params[1].Value += value.Len()
- }
-
- sliceLength := value.Len()
- if params[1].Value != params[0].Value { // if you're requesting zero elements, allow it through.
- if params[0].Value >= sliceLength || params[0].Value < 0 {
- return input, fmt.Errorf("array index out of bounds: index %d, length %d", params[0].Value, sliceLength)
- }
- if params[1].Value > sliceLength || params[1].Value < 0 {
- return input, fmt.Errorf("array index out of bounds: index %d, length %d", params[1].Value-1, sliceLength)
- }
- }
-
- if !params[2].Known {
- value = value.Slice(params[0].Value, params[1].Value)
- } else {
- value = value.Slice3(params[0].Value, params[1].Value, params[2].Value)
- }
- for i := 0; i < value.Len(); i++ {
- result = append(result, value.Index(i))
- }
- }
- return result, nil
-}
-
-// evalUnion evaluates UnionNode
-func (j *JSONPath) evalUnion(input []reflect.Value, node *UnionNode) ([]reflect.Value, error) {
- result := []reflect.Value{}
- for _, listNode := range node.Nodes {
- temp, err := j.evalList(input, listNode)
- if err != nil {
- return input, err
- }
- result = append(result, temp...)
- }
- return result, nil
-}
-
-func (j *JSONPath) findFieldInValue(value *reflect.Value, node *FieldNode) (reflect.Value, error) {
- t := value.Type()
- var inlineValue *reflect.Value
- for ix := 0; ix < t.NumField(); ix++ {
- f := t.Field(ix)
- jsonTag := f.Tag.Get("json")
- parts := strings.Split(jsonTag, ",")
- if len(parts) == 0 {
- continue
- }
- if parts[0] == node.Value {
- return value.Field(ix), nil
- }
- if len(parts[0]) == 0 {
- val := value.Field(ix)
- inlineValue = &val
- }
- }
- if inlineValue != nil {
- if inlineValue.Kind() == reflect.Struct {
- // handle 'inline'
- match, err := j.findFieldInValue(inlineValue, node)
- if err != nil {
- return reflect.Value{}, err
- }
- if match.IsValid() {
- return match, nil
- }
- }
- }
- return value.FieldByName(node.Value), nil
-}
-
-// evalField evaluates field of struct or key of map.
-func (j *JSONPath) evalField(input []reflect.Value, node *FieldNode) ([]reflect.Value, error) {
- results := []reflect.Value{}
- // If there's no input, there's no output
- if len(input) == 0 {
- return results, nil
- }
- for _, value := range input {
- var result reflect.Value
- value, isNil := template.Indirect(value)
- if isNil {
- continue
- }
-
- if value.Kind() == reflect.Struct {
- var err error
- if result, err = j.findFieldInValue(&value, node); err != nil {
- return nil, err
- }
- } else if value.Kind() == reflect.Map {
- mapKeyType := value.Type().Key()
- nodeValue := reflect.ValueOf(node.Value)
- // node value type must be convertible to map key type
- if !nodeValue.Type().ConvertibleTo(mapKeyType) {
- return results, fmt.Errorf("%s is not convertible to %s", nodeValue, mapKeyType)
- }
- result = value.MapIndex(nodeValue.Convert(mapKeyType))
- }
- if result.IsValid() {
- results = append(results, result)
- }
- }
- if len(results) == 0 {
- if j.allowMissingKeys {
- return results, nil
- }
- return results, fmt.Errorf("%s is not found", node.Value)
- }
- return results, nil
-}
-
-// evalWildcard extracts all contents of the given value
-func (j *JSONPath) evalWildcard(input []reflect.Value, node *WildcardNode) ([]reflect.Value, error) {
- results := []reflect.Value{}
- for _, value := range input {
- value, isNil := template.Indirect(value)
- if isNil {
- continue
- }
-
- kind := value.Kind()
- if kind == reflect.Struct {
- for i := 0; i < value.NumField(); i++ {
- results = append(results, value.Field(i))
- }
- } else if kind == reflect.Map {
- for _, key := range value.MapKeys() {
- results = append(results, value.MapIndex(key))
- }
- } else if kind == reflect.Array || kind == reflect.Slice || kind == reflect.String {
- for i := 0; i < value.Len(); i++ {
- results = append(results, value.Index(i))
- }
- }
- }
- return results, nil
-}
-
-// evalRecursive visits the given value recursively and pushes all of them to result
-func (j *JSONPath) evalRecursive(input []reflect.Value, node *RecursiveNode) ([]reflect.Value, error) {
- result := []reflect.Value{}
- for _, value := range input {
- results := []reflect.Value{}
- value, isNil := template.Indirect(value)
- if isNil {
- continue
- }
-
- kind := value.Kind()
- if kind == reflect.Struct {
- for i := 0; i < value.NumField(); i++ {
- results = append(results, value.Field(i))
- }
- } else if kind == reflect.Map {
- for _, key := range value.MapKeys() {
- results = append(results, value.MapIndex(key))
- }
- } else if kind == reflect.Array || kind == reflect.Slice || kind == reflect.String {
- for i := 0; i < value.Len(); i++ {
- results = append(results, value.Index(i))
- }
- }
- if len(results) != 0 {
- result = append(result, value)
- output, err := j.evalRecursive(results, node)
- if err != nil {
- return result, err
- }
- result = append(result, output...)
- }
- }
- return result, nil
-}
-
-// evalFilter filters array according to FilterNode
-func (j *JSONPath) evalFilter(input []reflect.Value, node *FilterNode) ([]reflect.Value, error) {
- results := []reflect.Value{}
- for _, value := range input {
- value, _ = template.Indirect(value)
-
- if value.Kind() != reflect.Array && value.Kind() != reflect.Slice {
- return input, fmt.Errorf("%v is not array or slice and cannot be filtered", value)
- }
- for i := 0; i < value.Len(); i++ {
- temp := []reflect.Value{value.Index(i)}
- lefts, err := j.evalList(temp, node.Left)
-
- //case exists
- if node.Operator == "exists" {
- if len(lefts) > 0 {
- results = append(results, value.Index(i))
- }
- continue
- }
-
- if err != nil {
- return input, err
- }
-
- var left, right interface{}
- switch {
- case len(lefts) == 0:
- continue
- case len(lefts) > 1:
- return input, fmt.Errorf("can only compare one element at a time")
- }
- left = lefts[0].Interface()
-
- rights, err := j.evalList(temp, node.Right)
- if err != nil {
- return input, err
- }
- switch {
- case len(rights) == 0:
- continue
- case len(rights) > 1:
- return input, fmt.Errorf("can only compare one element at a time")
- }
- right = rights[0].Interface()
-
- pass := false
- switch node.Operator {
- case "<":
- pass, err = template.Less(left, right)
- case ">":
- pass, err = template.Greater(left, right)
- case "==":
- pass, err = template.Equal(left, right)
- case "!=":
- pass, err = template.NotEqual(left, right)
- case "<=":
- pass, err = template.LessEqual(left, right)
- case ">=":
- pass, err = template.GreaterEqual(left, right)
- default:
- return results, fmt.Errorf("unrecognized filter operator %s", node.Operator)
- }
- if err != nil {
- return results, err
- }
- if pass {
- results = append(results, value.Index(i))
- }
- }
- }
- return results, nil
-}
-
-// evalToText translates reflect value to corresponding text
-func (j *JSONPath) evalToText(v reflect.Value) ([]byte, error) {
- iface, ok := template.PrintableValue(v)
- if !ok {
- return nil, fmt.Errorf("can't print type %s", v.Type())
- }
- var buffer bytes.Buffer
- fmt.Fprint(&buffer, iface)
- return buffer.Bytes(), nil
-}
diff --git a/vendor/k8s.io/client-go/util/jsonpath/node.go b/vendor/k8s.io/client-go/util/jsonpath/node.go
deleted file mode 100644
index 2f612b188f..0000000000
--- a/vendor/k8s.io/client-go/util/jsonpath/node.go
+++ /dev/null
@@ -1,255 +0,0 @@
-/*
-Copyright 2015 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
-
-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.
-*/
-
-package jsonpath
-
-import "fmt"
-
-// NodeType identifies the type of a parse tree node.
-type NodeType int
-
-// Type returns itself and provides an easy default implementation
-func (t NodeType) Type() NodeType {
- return t
-}
-
-func (t NodeType) String() string {
- return NodeTypeName[t]
-}
-
-const (
- NodeText NodeType = iota
- NodeArray
- NodeList
- NodeField
- NodeIdentifier
- NodeFilter
- NodeInt
- NodeFloat
- NodeWildcard
- NodeRecursive
- NodeUnion
- NodeBool
-)
-
-var NodeTypeName = map[NodeType]string{
- NodeText: "NodeText",
- NodeArray: "NodeArray",
- NodeList: "NodeList",
- NodeField: "NodeField",
- NodeIdentifier: "NodeIdentifier",
- NodeFilter: "NodeFilter",
- NodeInt: "NodeInt",
- NodeFloat: "NodeFloat",
- NodeWildcard: "NodeWildcard",
- NodeRecursive: "NodeRecursive",
- NodeUnion: "NodeUnion",
- NodeBool: "NodeBool",
-}
-
-type Node interface {
- Type() NodeType
- String() string
-}
-
-// ListNode holds a sequence of nodes.
-type ListNode struct {
- NodeType
- Nodes []Node // The element nodes in lexical order.
-}
-
-func newList() *ListNode {
- return &ListNode{NodeType: NodeList}
-}
-
-func (l *ListNode) append(n Node) {
- l.Nodes = append(l.Nodes, n)
-}
-
-func (l *ListNode) String() string {
- return l.Type().String()
-}
-
-// TextNode holds plain text.
-type TextNode struct {
- NodeType
- Text string // The text; may span newlines.
-}
-
-func newText(text string) *TextNode {
- return &TextNode{NodeType: NodeText, Text: text}
-}
-
-func (t *TextNode) String() string {
- return fmt.Sprintf("%s: %s", t.Type(), t.Text)
-}
-
-// FieldNode holds field of struct
-type FieldNode struct {
- NodeType
- Value string
-}
-
-func newField(value string) *FieldNode {
- return &FieldNode{NodeType: NodeField, Value: value}
-}
-
-func (f *FieldNode) String() string {
- return fmt.Sprintf("%s: %s", f.Type(), f.Value)
-}
-
-// IdentifierNode holds an identifier
-type IdentifierNode struct {
- NodeType
- Name string
-}
-
-func newIdentifier(value string) *IdentifierNode {
- return &IdentifierNode{
- NodeType: NodeIdentifier,
- Name: value,
- }
-}
-
-func (f *IdentifierNode) String() string {
- return fmt.Sprintf("%s: %s", f.Type(), f.Name)
-}
-
-// ParamsEntry holds param information for ArrayNode
-type ParamsEntry struct {
- Value int
- Known bool // whether the value is known when parse it
-}
-
-// ArrayNode holds start, end, step information for array index selection
-type ArrayNode struct {
- NodeType
- Params [3]ParamsEntry // start, end, step
-}
-
-func newArray(params [3]ParamsEntry) *ArrayNode {
- return &ArrayNode{
- NodeType: NodeArray,
- Params: params,
- }
-}
-
-func (a *ArrayNode) String() string {
- return fmt.Sprintf("%s: %v", a.Type(), a.Params)
-}
-
-// FilterNode holds operand and operator information for filter
-type FilterNode struct {
- NodeType
- Left *ListNode
- Right *ListNode
- Operator string
-}
-
-func newFilter(left, right *ListNode, operator string) *FilterNode {
- return &FilterNode{
- NodeType: NodeFilter,
- Left: left,
- Right: right,
- Operator: operator,
- }
-}
-
-func (f *FilterNode) String() string {
- return fmt.Sprintf("%s: %s %s %s", f.Type(), f.Left, f.Operator, f.Right)
-}
-
-// IntNode holds integer value
-type IntNode struct {
- NodeType
- Value int
-}
-
-func newInt(num int) *IntNode {
- return &IntNode{NodeType: NodeInt, Value: num}
-}
-
-func (i *IntNode) String() string {
- return fmt.Sprintf("%s: %d", i.Type(), i.Value)
-}
-
-// FloatNode holds float value
-type FloatNode struct {
- NodeType
- Value float64
-}
-
-func newFloat(num float64) *FloatNode {
- return &FloatNode{NodeType: NodeFloat, Value: num}
-}
-
-func (i *FloatNode) String() string {
- return fmt.Sprintf("%s: %f", i.Type(), i.Value)
-}
-
-// WildcardNode means a wildcard
-type WildcardNode struct {
- NodeType
-}
-
-func newWildcard() *WildcardNode {
- return &WildcardNode{NodeType: NodeWildcard}
-}
-
-func (i *WildcardNode) String() string {
- return i.Type().String()
-}
-
-// RecursiveNode means a recursive descent operator
-type RecursiveNode struct {
- NodeType
-}
-
-func newRecursive() *RecursiveNode {
- return &RecursiveNode{NodeType: NodeRecursive}
-}
-
-func (r *RecursiveNode) String() string {
- return r.Type().String()
-}
-
-// UnionNode is union of ListNode
-type UnionNode struct {
- NodeType
- Nodes []*ListNode
-}
-
-func newUnion(nodes []*ListNode) *UnionNode {
- return &UnionNode{NodeType: NodeUnion, Nodes: nodes}
-}
-
-func (u *UnionNode) String() string {
- return u.Type().String()
-}
-
-// BoolNode holds bool value
-type BoolNode struct {
- NodeType
- Value bool
-}
-
-func newBool(value bool) *BoolNode {
- return &BoolNode{NodeType: NodeBool, Value: value}
-}
-
-func (b *BoolNode) String() string {
- return fmt.Sprintf("%s: %t", b.Type(), b.Value)
-}
diff --git a/vendor/k8s.io/client-go/util/jsonpath/parser.go b/vendor/k8s.io/client-go/util/jsonpath/parser.go
deleted file mode 100644
index 99b45849c9..0000000000
--- a/vendor/k8s.io/client-go/util/jsonpath/parser.go
+++ /dev/null
@@ -1,525 +0,0 @@
-/*
-Copyright 2015 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
-
-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.
-*/
-
-package jsonpath
-
-import (
- "errors"
- "fmt"
- "regexp"
- "strconv"
- "strings"
- "unicode"
- "unicode/utf8"
-)
-
-const eof = -1
-
-const (
- leftDelim = "{"
- rightDelim = "}"
-)
-
-type Parser struct {
- Name string
- Root *ListNode
- input string
- cur *ListNode
- pos int
- start int
- width int
-}
-
-var (
- ErrSyntax = errors.New("invalid syntax")
- dictKeyRex = regexp.MustCompile(`^'([^']*)'$`)
- sliceOperatorRex = regexp.MustCompile(`^(-?[\d]*)(:-?[\d]*)?(:[\d]*)?$`)
-)
-
-// Parse parsed the given text and return a node Parser.
-// If an error is encountered, parsing stops and an empty
-// Parser is returned with the error
-func Parse(name, text string) (*Parser, error) {
- p := NewParser(name)
- err := p.Parse(text)
- if err != nil {
- p = nil
- }
- return p, err
-}
-
-func NewParser(name string) *Parser {
- return &Parser{
- Name: name,
- }
-}
-
-// parseAction parsed the expression inside delimiter
-func parseAction(name, text string) (*Parser, error) {
- p, err := Parse(name, fmt.Sprintf("%s%s%s", leftDelim, text, rightDelim))
- // when error happens, p will be nil, so we need to return here
- if err != nil {
- return p, err
- }
- p.Root = p.Root.Nodes[0].(*ListNode)
- return p, nil
-}
-
-func (p *Parser) Parse(text string) error {
- p.input = text
- p.Root = newList()
- p.pos = 0
- return p.parseText(p.Root)
-}
-
-// consumeText return the parsed text since last cosumeText
-func (p *Parser) consumeText() string {
- value := p.input[p.start:p.pos]
- p.start = p.pos
- return value
-}
-
-// next returns the next rune in the input.
-func (p *Parser) next() rune {
- if p.pos >= len(p.input) {
- p.width = 0
- return eof
- }
- r, w := utf8.DecodeRuneInString(p.input[p.pos:])
- p.width = w
- p.pos += p.width
- return r
-}
-
-// peek returns but does not consume the next rune in the input.
-func (p *Parser) peek() rune {
- r := p.next()
- p.backup()
- return r
-}
-
-// backup steps back one rune. Can only be called once per call of next.
-func (p *Parser) backup() {
- p.pos -= p.width
-}
-
-func (p *Parser) parseText(cur *ListNode) error {
- for {
- if strings.HasPrefix(p.input[p.pos:], leftDelim) {
- if p.pos > p.start {
- cur.append(newText(p.consumeText()))
- }
- return p.parseLeftDelim(cur)
- }
- if p.next() == eof {
- break
- }
- }
- // Correctly reached EOF.
- if p.pos > p.start {
- cur.append(newText(p.consumeText()))
- }
- return nil
-}
-
-// parseLeftDelim scans the left delimiter, which is known to be present.
-func (p *Parser) parseLeftDelim(cur *ListNode) error {
- p.pos += len(leftDelim)
- p.consumeText()
- newNode := newList()
- cur.append(newNode)
- cur = newNode
- return p.parseInsideAction(cur)
-}
-
-func (p *Parser) parseInsideAction(cur *ListNode) error {
- prefixMap := map[string]func(*ListNode) error{
- rightDelim: p.parseRightDelim,
- "[?(": p.parseFilter,
- "..": p.parseRecursive,
- }
- for prefix, parseFunc := range prefixMap {
- if strings.HasPrefix(p.input[p.pos:], prefix) {
- return parseFunc(cur)
- }
- }
-
- switch r := p.next(); {
- case r == eof || isEndOfLine(r):
- return fmt.Errorf("unclosed action")
- case r == ' ':
- p.consumeText()
- case r == '@' || r == '$': //the current object, just pass it
- p.consumeText()
- case r == '[':
- return p.parseArray(cur)
- case r == '"' || r == '\'':
- return p.parseQuote(cur, r)
- case r == '.':
- return p.parseField(cur)
- case r == '+' || r == '-' || unicode.IsDigit(r):
- p.backup()
- return p.parseNumber(cur)
- case isAlphaNumeric(r):
- p.backup()
- return p.parseIdentifier(cur)
- default:
- return fmt.Errorf("unrecognized character in action: %#U", r)
- }
- return p.parseInsideAction(cur)
-}
-
-// parseRightDelim scans the right delimiter, which is known to be present.
-func (p *Parser) parseRightDelim(cur *ListNode) error {
- p.pos += len(rightDelim)
- p.consumeText()
- cur = p.Root
- return p.parseText(cur)
-}
-
-// parseIdentifier scans build-in keywords, like "range" "end"
-func (p *Parser) parseIdentifier(cur *ListNode) error {
- var r rune
- for {
- r = p.next()
- if isTerminator(r) {
- p.backup()
- break
- }
- }
- value := p.consumeText()
-
- if isBool(value) {
- v, err := strconv.ParseBool(value)
- if err != nil {
- return fmt.Errorf("can not parse bool '%s': %s", value, err.Error())
- }
-
- cur.append(newBool(v))
- } else {
- cur.append(newIdentifier(value))
- }
-
- return p.parseInsideAction(cur)
-}
-
-// parseRecursive scans the recursive desent operator ..
-func (p *Parser) parseRecursive(cur *ListNode) error {
- p.pos += len("..")
- p.consumeText()
- cur.append(newRecursive())
- if r := p.peek(); isAlphaNumeric(r) {
- return p.parseField(cur)
- }
- return p.parseInsideAction(cur)
-}
-
-// parseNumber scans number
-func (p *Parser) parseNumber(cur *ListNode) error {
- r := p.peek()
- if r == '+' || r == '-' {
- r = p.next()
- }
- for {
- r = p.next()
- if r != '.' && !unicode.IsDigit(r) {
- p.backup()
- break
- }
- }
- value := p.consumeText()
- i, err := strconv.Atoi(value)
- if err == nil {
- cur.append(newInt(i))
- return p.parseInsideAction(cur)
- }
- d, err := strconv.ParseFloat(value, 64)
- if err == nil {
- cur.append(newFloat(d))
- return p.parseInsideAction(cur)
- }
- return fmt.Errorf("cannot parse number %s", value)
-}
-
-// parseArray scans array index selection
-func (p *Parser) parseArray(cur *ListNode) error {
-Loop:
- for {
- switch p.next() {
- case eof, '\n':
- return fmt.Errorf("unterminated array")
- case ']':
- break Loop
- }
- }
- text := p.consumeText()
- text = text[1 : len(text)-1]
- if text == "*" {
- text = ":"
- }
-
- //union operator
- strs := strings.Split(text, ",")
- if len(strs) > 1 {
- union := []*ListNode{}
- for _, str := range strs {
- parser, err := parseAction("union", fmt.Sprintf("[%s]", strings.Trim(str, " ")))
- if err != nil {
- return err
- }
- union = append(union, parser.Root)
- }
- cur.append(newUnion(union))
- return p.parseInsideAction(cur)
- }
-
- // dict key
- value := dictKeyRex.FindStringSubmatch(text)
- if value != nil {
- parser, err := parseAction("arraydict", fmt.Sprintf(".%s", value[1]))
- if err != nil {
- return err
- }
- for _, node := range parser.Root.Nodes {
- cur.append(node)
- }
- return p.parseInsideAction(cur)
- }
-
- //slice operator
- value = sliceOperatorRex.FindStringSubmatch(text)
- if value == nil {
- return fmt.Errorf("invalid array index %s", text)
- }
- value = value[1:]
- params := [3]ParamsEntry{}
- for i := 0; i < 3; i++ {
- if value[i] != "" {
- if i > 0 {
- value[i] = value[i][1:]
- }
- if i > 0 && value[i] == "" {
- params[i].Known = false
- } else {
- var err error
- params[i].Known = true
- params[i].Value, err = strconv.Atoi(value[i])
- if err != nil {
- return fmt.Errorf("array index %s is not a number", value[i])
- }
- }
- } else {
- if i == 1 {
- params[i].Known = true
- params[i].Value = params[0].Value + 1
- } else {
- params[i].Known = false
- params[i].Value = 0
- }
- }
- }
- cur.append(newArray(params))
- return p.parseInsideAction(cur)
-}
-
-// parseFilter scans filter inside array selection
-func (p *Parser) parseFilter(cur *ListNode) error {
- p.pos += len("[?(")
- p.consumeText()
- begin := false
- end := false
- var pair rune
-
-Loop:
- for {
- r := p.next()
- switch r {
- case eof, '\n':
- return fmt.Errorf("unterminated filter")
- case '"', '\'':
- if begin == false {
- //save the paired rune
- begin = true
- pair = r
- continue
- }
- //only add when met paired rune
- if p.input[p.pos-2] != '\\' && r == pair {
- end = true
- }
- case ')':
- //in rightParser below quotes only appear zero or once
- //and must be paired at the beginning and end
- if begin == end {
- break Loop
- }
- }
- }
- if p.next() != ']' {
- return fmt.Errorf("unclosed array expect ]")
- }
- reg := regexp.MustCompile(`^([^!<>=]+)([!<>=]+)(.+?)$`)
- text := p.consumeText()
- text = text[:len(text)-2]
- value := reg.FindStringSubmatch(text)
- if value == nil {
- parser, err := parseAction("text", text)
- if err != nil {
- return err
- }
- cur.append(newFilter(parser.Root, newList(), "exists"))
- } else {
- leftParser, err := parseAction("left", value[1])
- if err != nil {
- return err
- }
- rightParser, err := parseAction("right", value[3])
- if err != nil {
- return err
- }
- cur.append(newFilter(leftParser.Root, rightParser.Root, value[2]))
- }
- return p.parseInsideAction(cur)
-}
-
-// parseQuote unquotes string inside double or single quote
-func (p *Parser) parseQuote(cur *ListNode, end rune) error {
-Loop:
- for {
- switch p.next() {
- case eof, '\n':
- return fmt.Errorf("unterminated quoted string")
- case end:
- //if it's not escape break the Loop
- if p.input[p.pos-2] != '\\' {
- break Loop
- }
- }
- }
- value := p.consumeText()
- s, err := UnquoteExtend(value)
- if err != nil {
- return fmt.Errorf("unquote string %s error %v", value, err)
- }
- cur.append(newText(s))
- return p.parseInsideAction(cur)
-}
-
-// parseField scans a field until a terminator
-func (p *Parser) parseField(cur *ListNode) error {
- p.consumeText()
- for p.advance() {
- }
- value := p.consumeText()
- if value == "*" {
- cur.append(newWildcard())
- } else {
- cur.append(newField(strings.Replace(value, "\\", "", -1)))
- }
- return p.parseInsideAction(cur)
-}
-
-// advance scans until next non-escaped terminator
-func (p *Parser) advance() bool {
- r := p.next()
- if r == '\\' {
- p.next()
- } else if isTerminator(r) {
- p.backup()
- return false
- }
- return true
-}
-
-// isTerminator reports whether the input is at valid termination character to appear after an identifier.
-func isTerminator(r rune) bool {
- if isSpace(r) || isEndOfLine(r) {
- return true
- }
- switch r {
- case eof, '.', ',', '[', ']', '$', '@', '{', '}':
- return true
- }
- return false
-}
-
-// isSpace reports whether r is a space character.
-func isSpace(r rune) bool {
- return r == ' ' || r == '\t'
-}
-
-// isEndOfLine reports whether r is an end-of-line character.
-func isEndOfLine(r rune) bool {
- return r == '\r' || r == '\n'
-}
-
-// isAlphaNumeric reports whether r is an alphabetic, digit, or underscore.
-func isAlphaNumeric(r rune) bool {
- return r == '_' || unicode.IsLetter(r) || unicode.IsDigit(r)
-}
-
-// isBool reports whether s is a boolean value.
-func isBool(s string) bool {
- return s == "true" || s == "false"
-}
-
-//UnquoteExtend is almost same as strconv.Unquote(), but it support parse single quotes as a string
-func UnquoteExtend(s string) (string, error) {
- n := len(s)
- if n < 2 {
- return "", ErrSyntax
- }
- quote := s[0]
- if quote != s[n-1] {
- return "", ErrSyntax
- }
- s = s[1 : n-1]
-
- if quote != '"' && quote != '\'' {
- return "", ErrSyntax
- }
-
- // Is it trivial? Avoid allocation.
- if !contains(s, '\\') && !contains(s, quote) {
- return s, nil
- }
-
- var runeTmp [utf8.UTFMax]byte
- buf := make([]byte, 0, 3*len(s)/2) // Try to avoid more allocations.
- for len(s) > 0 {
- c, multibyte, ss, err := strconv.UnquoteChar(s, quote)
- if err != nil {
- return "", err
- }
- s = ss
- if c < utf8.RuneSelf || !multibyte {
- buf = append(buf, byte(c))
- } else {
- n := utf8.EncodeRune(runeTmp[:], c)
- buf = append(buf, runeTmp[:n]...)
- }
- }
- return string(buf), nil
-}
-
-func contains(s string, c byte) bool {
- for i := 0; i < len(s); i++ {
- if s[i] == c {
- return true
- }
- }
- return false
-}
diff --git a/vendor/k8s.io/kubernetes/pkg/apis/rbac/OWNERS b/vendor/k8s.io/kubernetes/pkg/apis/rbac/OWNERS
index 1aefde049a..dbc9a28c6f 100644
--- a/vendor/k8s.io/kubernetes/pkg/apis/rbac/OWNERS
+++ b/vendor/k8s.io/kubernetes/pkg/apis/rbac/OWNERS
@@ -1,17 +1,9 @@
+# See the OWNERS docs at https://go.k8s.io/owners
+
+# approval on api packages bubbles to api-approvers
reviewers:
-- thockin
-- lavalamp
-- smarterclayton
-- deads2k
-- sttts
-- ncdc
-- dims
-- krousey
-- mml
-- mbohlool
-- david-mcmahon
-- ericchiang
-- lixiaobing10051267
-- jianhuiz
-- liggitt
-- enj
+- sig-auth-authorizers-approvers
+- sig-auth-authorizers-reviewers
+labels:
+- sig/auth
+
diff --git a/vendor/k8s.io/kubernetes/pkg/apis/rbac/doc.go b/vendor/k8s.io/kubernetes/pkg/apis/rbac/doc.go
index bebcb771d1..ea2309eea7 100644
--- a/vendor/k8s.io/kubernetes/pkg/apis/rbac/doc.go
+++ b/vendor/k8s.io/kubernetes/pkg/apis/rbac/doc.go
@@ -16,4 +16,5 @@ limitations under the License.
// +k8s:deepcopy-gen=package
// +groupName=rbac.authorization.k8s.io
+
package rbac // import "k8s.io/kubernetes/pkg/apis/rbac"
diff --git a/vendor/k8s.io/kubernetes/pkg/apis/rbac/v1/doc.go b/vendor/k8s.io/kubernetes/pkg/apis/rbac/v1/doc.go
index 5608caba70..b96dc30bc5 100644
--- a/vendor/k8s.io/kubernetes/pkg/apis/rbac/v1/doc.go
+++ b/vendor/k8s.io/kubernetes/pkg/apis/rbac/v1/doc.go
@@ -21,4 +21,5 @@ limitations under the License.
// +k8s:deepcopy-gen=package
// +groupName=rbac.authorization.k8s.io
+
package v1 // import "k8s.io/kubernetes/pkg/apis/rbac/v1"
diff --git a/vendor/k8s.io/kubernetes/pkg/kubectl/scheme/BUILD b/vendor/k8s.io/kubernetes/pkg/kubectl/scheme/BUILD
deleted file mode 100644
index 67b59354c5..0000000000
--- a/vendor/k8s.io/kubernetes/pkg/kubectl/scheme/BUILD
+++ /dev/null
@@ -1,76 +0,0 @@
-load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
-
-go_library(
- name = "go_default_library",
- srcs = [
- "install.go",
- "scheme.go",
- ],
- importpath = "k8s.io/kubernetes/pkg/kubectl/scheme",
- visibility = ["//visibility:public"],
- deps = [
- "//staging/src/k8s.io/api/admission/v1beta1:go_default_library",
- "//staging/src/k8s.io/api/admissionregistration/v1alpha1:go_default_library",
- "//staging/src/k8s.io/api/admissionregistration/v1beta1:go_default_library",
- "//staging/src/k8s.io/api/apps/v1:go_default_library",
- "//staging/src/k8s.io/api/apps/v1beta1:go_default_library",
- "//staging/src/k8s.io/api/apps/v1beta2:go_default_library",
- "//staging/src/k8s.io/api/authentication/v1:go_default_library",
- "//staging/src/k8s.io/api/authentication/v1beta1:go_default_library",
- "//staging/src/k8s.io/api/authorization/v1:go_default_library",
- "//staging/src/k8s.io/api/authorization/v1beta1:go_default_library",
- "//staging/src/k8s.io/api/autoscaling/v1:go_default_library",
- "//staging/src/k8s.io/api/autoscaling/v2beta1:go_default_library",
- "//staging/src/k8s.io/api/batch/v1:go_default_library",
- "//staging/src/k8s.io/api/batch/v1beta1:go_default_library",
- "//staging/src/k8s.io/api/batch/v2alpha1:go_default_library",
- "//staging/src/k8s.io/api/certificates/v1beta1:go_default_library",
- "//staging/src/k8s.io/api/core/v1:go_default_library",
- "//staging/src/k8s.io/api/extensions/v1beta1:go_default_library",
- "//staging/src/k8s.io/api/imagepolicy/v1alpha1:go_default_library",
- "//staging/src/k8s.io/api/networking/v1:go_default_library",
- "//staging/src/k8s.io/api/policy/v1beta1:go_default_library",
- "//staging/src/k8s.io/api/rbac/v1:go_default_library",
- "//staging/src/k8s.io/api/rbac/v1alpha1:go_default_library",
- "//staging/src/k8s.io/api/rbac/v1beta1:go_default_library",
- "//staging/src/k8s.io/api/scheduling/v1alpha1:go_default_library",
- "//staging/src/k8s.io/api/settings/v1alpha1:go_default_library",
- "//staging/src/k8s.io/api/storage/v1:go_default_library",
- "//staging/src/k8s.io/api/storage/v1beta1:go_default_library",
- "//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
- "//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured:go_default_library",
- "//staging/src/k8s.io/apimachinery/pkg/runtime:go_default_library",
- "//staging/src/k8s.io/apimachinery/pkg/runtime/schema:go_default_library",
- "//staging/src/k8s.io/apimachinery/pkg/runtime/serializer:go_default_library",
- "//staging/src/k8s.io/apimachinery/pkg/util/runtime:go_default_library",
- "//staging/src/k8s.io/client-go/kubernetes/scheme:go_default_library",
- ],
-)
-
-filegroup(
- name = "package-srcs",
- srcs = glob(["**"]),
- tags = ["automanaged"],
- visibility = ["//visibility:private"],
-)
-
-filegroup(
- name = "all-srcs",
- srcs = [":package-srcs"],
- tags = ["automanaged"],
- visibility = ["//visibility:public"],
-)
-
-go_test(
- name = "go_default_test",
- srcs = ["sparse_test.go"],
- embed = [":go_default_library"],
- deps = [
- "//staging/src/k8s.io/api/batch/v1:go_default_library",
- "//staging/src/k8s.io/api/batch/v1beta1:go_default_library",
- "//staging/src/k8s.io/apimachinery/pkg/api/equality:go_default_library",
- "//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
- "//staging/src/k8s.io/apimachinery/pkg/runtime:go_default_library",
- "//staging/src/k8s.io/apimachinery/pkg/util/diff:go_default_library",
- ],
-)
diff --git a/vendor/k8s.io/kubernetes/pkg/kubectl/scheme/install.go b/vendor/k8s.io/kubernetes/pkg/kubectl/scheme/install.go
deleted file mode 100644
index d339b49c5a..0000000000
--- a/vendor/k8s.io/kubernetes/pkg/kubectl/scheme/install.go
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
-Copyright 2017 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
-
-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.
-*/
-
-package scheme
-
-import (
- admissionv1alpha1 "k8s.io/api/admission/v1beta1"
- admissionregistrationv1alpha1 "k8s.io/api/admissionregistration/v1alpha1"
- admissionregistrationv1beta1 "k8s.io/api/admissionregistration/v1beta1"
- appsv1 "k8s.io/api/apps/v1"
- appsv1beta1 "k8s.io/api/apps/v1beta1"
- appsv1beta2 "k8s.io/api/apps/v1beta2"
- authenticationv1 "k8s.io/api/authentication/v1"
- authenticationv1beta1 "k8s.io/api/authentication/v1beta1"
- authorizationv1 "k8s.io/api/authorization/v1"
- authorizationv1beta1 "k8s.io/api/authorization/v1beta1"
- autoscalingv1 "k8s.io/api/autoscaling/v1"
- autoscalingv2beta1 "k8s.io/api/autoscaling/v2beta1"
- batchv1 "k8s.io/api/batch/v1"
- batchv1beta1 "k8s.io/api/batch/v1beta1"
- batchv2alpha1 "k8s.io/api/batch/v2alpha1"
- certificatesv1beta1 "k8s.io/api/certificates/v1beta1"
- corev1 "k8s.io/api/core/v1"
- extensionsv1beta1 "k8s.io/api/extensions/v1beta1"
- imagepolicyv1alpha1 "k8s.io/api/imagepolicy/v1alpha1"
- networkingv1 "k8s.io/api/networking/v1"
- policyv1beta1 "k8s.io/api/policy/v1beta1"
- rbacv1 "k8s.io/api/rbac/v1"
- rbacv1alpha1 "k8s.io/api/rbac/v1alpha1"
- rbacv1beta1 "k8s.io/api/rbac/v1beta1"
- schedulingv1alpha1 "k8s.io/api/scheduling/v1alpha1"
- settingsv1alpha1 "k8s.io/api/settings/v1alpha1"
- storagev1 "k8s.io/api/storage/v1"
- storagev1beta1 "k8s.io/api/storage/v1beta1"
- metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
- "k8s.io/apimachinery/pkg/runtime/schema"
- utilruntime "k8s.io/apimachinery/pkg/util/runtime"
- "k8s.io/client-go/kubernetes/scheme"
-)
-
-// Register all groups in the kubectl's registry, but no componentconfig group since it's not in k8s.io/api
-// The code in this file mostly duplicate the install under k8s.io/kubernetes/pkg/api and k8s.io/kubernetes/pkg/apis,
-// but does NOT register the internal types.
-func init() {
- // Register external types for Scheme
- metav1.AddToGroupVersion(Scheme, schema.GroupVersion{Version: "v1"})
- utilruntime.Must(scheme.AddToScheme(Scheme))
-
- utilruntime.Must(Scheme.SetVersionPriority(corev1.SchemeGroupVersion))
- utilruntime.Must(Scheme.SetVersionPriority(admissionv1alpha1.SchemeGroupVersion))
- utilruntime.Must(Scheme.SetVersionPriority(admissionregistrationv1beta1.SchemeGroupVersion, admissionregistrationv1alpha1.SchemeGroupVersion))
- utilruntime.Must(Scheme.SetVersionPriority(appsv1beta1.SchemeGroupVersion, appsv1beta2.SchemeGroupVersion, appsv1.SchemeGroupVersion))
- utilruntime.Must(Scheme.SetVersionPriority(authenticationv1.SchemeGroupVersion, authenticationv1beta1.SchemeGroupVersion))
- utilruntime.Must(Scheme.SetVersionPriority(authorizationv1.SchemeGroupVersion, authorizationv1beta1.SchemeGroupVersion))
- utilruntime.Must(Scheme.SetVersionPriority(autoscalingv1.SchemeGroupVersion, autoscalingv2beta1.SchemeGroupVersion))
- utilruntime.Must(Scheme.SetVersionPriority(batchv1.SchemeGroupVersion, batchv1beta1.SchemeGroupVersion, batchv2alpha1.SchemeGroupVersion))
- utilruntime.Must(Scheme.SetVersionPriority(certificatesv1beta1.SchemeGroupVersion))
- utilruntime.Must(Scheme.SetVersionPriority(extensionsv1beta1.SchemeGroupVersion))
- utilruntime.Must(Scheme.SetVersionPriority(imagepolicyv1alpha1.SchemeGroupVersion))
- utilruntime.Must(Scheme.SetVersionPriority(networkingv1.SchemeGroupVersion))
- utilruntime.Must(Scheme.SetVersionPriority(policyv1beta1.SchemeGroupVersion))
- utilruntime.Must(Scheme.SetVersionPriority(rbacv1.SchemeGroupVersion, rbacv1beta1.SchemeGroupVersion, rbacv1alpha1.SchemeGroupVersion))
- utilruntime.Must(Scheme.SetVersionPriority(schedulingv1alpha1.SchemeGroupVersion))
- utilruntime.Must(Scheme.SetVersionPriority(settingsv1alpha1.SchemeGroupVersion))
- utilruntime.Must(Scheme.SetVersionPriority(storagev1.SchemeGroupVersion, storagev1beta1.SchemeGroupVersion))
-}
diff --git a/vendor/k8s.io/kubernetes/pkg/kubectl/scheme/scheme.go b/vendor/k8s.io/kubernetes/pkg/kubectl/scheme/scheme.go
deleted file mode 100644
index 880b115b17..0000000000
--- a/vendor/k8s.io/kubernetes/pkg/kubectl/scheme/scheme.go
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
-Copyright 2017 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
-
-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.
-*/
-
-package scheme
-
-import (
- "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
- "k8s.io/apimachinery/pkg/runtime"
- "k8s.io/apimachinery/pkg/runtime/serializer"
-)
-
-// All kubectl code should eventually switch to use this Registry and Scheme instead of the global ones.
-
-// Scheme is the default instance of runtime.Scheme to which types in the Kubernetes API are already registered.
-var Scheme = runtime.NewScheme()
-
-// Codecs provides access to encoding and decoding for the scheme
-var Codecs = serializer.NewCodecFactory(Scheme)
-
-// DefaultJSONEncoder returns a default encoder for our scheme
-func DefaultJSONEncoder() runtime.Encoder {
- return unstructured.JSONFallbackEncoder{Encoder: Codecs.LegacyCodec(Scheme.PrioritizedVersionsAllGroups()...)}
-}
diff --git a/vendor/k8s.io/kubernetes/pkg/printers/BUILD b/vendor/k8s.io/kubernetes/pkg/printers/BUILD
index 4d4ab061e8..3f1134b1b0 100644
--- a/vendor/k8s.io/kubernetes/pkg/printers/BUILD
+++ b/vendor/k8s.io/kubernetes/pkg/printers/BUILD
@@ -9,15 +9,12 @@ load(
go_library(
name = "go_default_library",
srcs = [
- "customcolumn.go",
- "customcolumn_flags.go",
"humanreadable.go",
"interface.go",
"tabwriter.go",
],
importpath = "k8s.io/kubernetes/pkg/printers",
deps = [
- "//pkg/kubectl/scheme:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/api/meta:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured:go_default_library",
@@ -26,10 +23,7 @@ go_library(
"//staging/src/k8s.io/apimachinery/pkg/runtime:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/runtime/schema:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/util/runtime:go_default_library",
- "//staging/src/k8s.io/cli-runtime/pkg/genericclioptions:go_default_library",
- "//staging/src/k8s.io/cli-runtime/pkg/genericclioptions/printers:go_default_library",
- "//staging/src/k8s.io/client-go/util/jsonpath:go_default_library",
- "//vendor/github.com/spf13/cobra:go_default_library",
+ "//vendor/github.com/liggitt/tabwriter:go_default_library",
],
)
@@ -52,19 +46,12 @@ filegroup(
go_test(
name = "go_default_test",
- srcs = [
- "customcolumn_flags_test.go",
- "customcolumn_test.go",
- "humanreadable_test.go",
- ],
+ srcs = ["humanreadable_test.go"],
embed = [":go_default_library"],
deps = [
- "//pkg/api/legacyscheme:go_default_library",
"//pkg/apis/core:go_default_library",
- "//staging/src/k8s.io/api/core/v1:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1beta1:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/runtime:go_default_library",
- "//staging/src/k8s.io/cli-runtime/pkg/genericclioptions:go_default_library",
],
)
diff --git a/vendor/k8s.io/kubernetes/pkg/printers/OWNERS b/vendor/k8s.io/kubernetes/pkg/printers/OWNERS
index a8ab5736b8..a26581944e 100644
--- a/vendor/k8s.io/kubernetes/pkg/printers/OWNERS
+++ b/vendor/k8s.io/kubernetes/pkg/printers/OWNERS
@@ -1,3 +1,5 @@
+# See the OWNERS docs at https://go.k8s.io/owners
+
approvers:
- smarterclayton
- sig-cli-maintainers
diff --git a/vendor/k8s.io/kubernetes/pkg/printers/customcolumn.go b/vendor/k8s.io/kubernetes/pkg/printers/customcolumn.go
deleted file mode 100644
index b0ab6bc239..0000000000
--- a/vendor/k8s.io/kubernetes/pkg/printers/customcolumn.go
+++ /dev/null
@@ -1,242 +0,0 @@
-/*
-Copyright 2014 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
-
-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.
-*/
-
-package printers
-
-import (
- "bufio"
- "bytes"
- "fmt"
- "io"
- "reflect"
- "regexp"
- "strings"
- "text/tabwriter"
-
- "k8s.io/apimachinery/pkg/api/meta"
- "k8s.io/apimachinery/pkg/runtime"
- "k8s.io/cli-runtime/pkg/genericclioptions/printers"
- "k8s.io/client-go/util/jsonpath"
-)
-
-var jsonRegexp = regexp.MustCompile("^\\{\\.?([^{}]+)\\}$|^\\.?([^{}]+)$")
-
-// RelaxedJSONPathExpression attempts to be flexible with JSONPath expressions, it accepts:
-// * metadata.name (no leading '.' or curly braces '{...}'
-// * {metadata.name} (no leading '.')
-// * .metadata.name (no curly braces '{...}')
-// * {.metadata.name} (complete expression)
-// And transforms them all into a valid jsonpath expression:
-// {.metadata.name}
-func RelaxedJSONPathExpression(pathExpression string) (string, error) {
- if len(pathExpression) == 0 {
- return pathExpression, nil
- }
- submatches := jsonRegexp.FindStringSubmatch(pathExpression)
- if submatches == nil {
- return "", fmt.Errorf("unexpected path string, expected a 'name1.name2' or '.name1.name2' or '{name1.name2}' or '{.name1.name2}'")
- }
- if len(submatches) != 3 {
- return "", fmt.Errorf("unexpected submatch list: %v", submatches)
- }
- var fieldSpec string
- if len(submatches[1]) != 0 {
- fieldSpec = submatches[1]
- } else {
- fieldSpec = submatches[2]
- }
- return fmt.Sprintf("{.%s}", fieldSpec), nil
-}
-
-// NewCustomColumnsPrinterFromSpec creates a custom columns printer from a comma separated list of : pairs.
-// e.g. NAME:metadata.name,API_VERSION:apiVersion creates a printer that prints:
-//
-// NAME API_VERSION
-// foo bar
-func NewCustomColumnsPrinterFromSpec(spec string, decoder runtime.Decoder, noHeaders bool) (*CustomColumnsPrinter, error) {
- if len(spec) == 0 {
- return nil, fmt.Errorf("custom-columns format specified but no custom columns given")
- }
- parts := strings.Split(spec, ",")
- columns := make([]Column, len(parts))
- for ix := range parts {
- colSpec := strings.Split(parts[ix], ":")
- if len(colSpec) != 2 {
- return nil, fmt.Errorf("unexpected custom-columns spec: %s, expected :", parts[ix])
- }
- spec, err := RelaxedJSONPathExpression(colSpec[1])
- if err != nil {
- return nil, err
- }
- columns[ix] = Column{Header: colSpec[0], FieldSpec: spec}
- }
- return &CustomColumnsPrinter{Columns: columns, Decoder: decoder, NoHeaders: noHeaders}, nil
-}
-
-func splitOnWhitespace(line string) []string {
- lineScanner := bufio.NewScanner(bytes.NewBufferString(line))
- lineScanner.Split(bufio.ScanWords)
- result := []string{}
- for lineScanner.Scan() {
- result = append(result, lineScanner.Text())
- }
- return result
-}
-
-// NewCustomColumnsPrinterFromTemplate creates a custom columns printer from a template stream. The template is expected
-// to consist of two lines, whitespace separated. The first line is the header line, the second line is the jsonpath field spec
-// For example, the template below:
-// NAME API_VERSION
-// {metadata.name} {apiVersion}
-func NewCustomColumnsPrinterFromTemplate(templateReader io.Reader, decoder runtime.Decoder) (*CustomColumnsPrinter, error) {
- scanner := bufio.NewScanner(templateReader)
- if !scanner.Scan() {
- return nil, fmt.Errorf("invalid template, missing header line. Expected format is one line of space separated headers, one line of space separated column specs.")
- }
- headers := splitOnWhitespace(scanner.Text())
-
- if !scanner.Scan() {
- return nil, fmt.Errorf("invalid template, missing spec line. Expected format is one line of space separated headers, one line of space separated column specs.")
- }
- specs := splitOnWhitespace(scanner.Text())
-
- if len(headers) != len(specs) {
- return nil, fmt.Errorf("number of headers (%d) and field specifications (%d) don't match", len(headers), len(specs))
- }
-
- columns := make([]Column, len(headers))
- for ix := range headers {
- spec, err := RelaxedJSONPathExpression(specs[ix])
- if err != nil {
- return nil, err
- }
- columns[ix] = Column{
- Header: headers[ix],
- FieldSpec: spec,
- }
- }
- return &CustomColumnsPrinter{Columns: columns, Decoder: decoder, NoHeaders: false}, nil
-}
-
-// Column represents a user specified column
-type Column struct {
- // The header to print above the column, general style is ALL_CAPS
- Header string
- // The pointer to the field in the object to print in JSONPath form
- // e.g. {.ObjectMeta.Name}, see pkg/util/jsonpath for more details.
- FieldSpec string
-}
-
-// CustomColumnPrinter is a printer that knows how to print arbitrary columns
-// of data from templates specified in the `Columns` array
-type CustomColumnsPrinter struct {
- Columns []Column
- Decoder runtime.Decoder
- NoHeaders bool
- // lastType records type of resource printed last so that we don't repeat
- // header while printing same type of resources.
- lastType reflect.Type
-}
-
-func (s *CustomColumnsPrinter) PrintObj(obj runtime.Object, out io.Writer) error {
- // we use reflect.Indirect here in order to obtain the actual value from a pointer.
- // we need an actual value in order to retrieve the package path for an object.
- // using reflect.Indirect indiscriminately is valid here, as all runtime.Objects are supposed to be pointers.
- if printers.InternalObjectPreventer.IsForbidden(reflect.Indirect(reflect.ValueOf(obj)).Type().PkgPath()) {
- return fmt.Errorf(printers.InternalObjectPrinterErr)
- }
-
- if w, found := out.(*tabwriter.Writer); !found {
- w = GetNewTabWriter(out)
- out = w
- defer w.Flush()
- }
-
- t := reflect.TypeOf(obj)
- if !s.NoHeaders && t != s.lastType {
- headers := make([]string, len(s.Columns))
- for ix := range s.Columns {
- headers[ix] = s.Columns[ix].Header
- }
- fmt.Fprintln(out, strings.Join(headers, "\t"))
- s.lastType = t
- }
- parsers := make([]*jsonpath.JSONPath, len(s.Columns))
- for ix := range s.Columns {
- parsers[ix] = jsonpath.New(fmt.Sprintf("column%d", ix)).AllowMissingKeys(true)
- if err := parsers[ix].Parse(s.Columns[ix].FieldSpec); err != nil {
- return err
- }
- }
-
- if meta.IsListType(obj) {
- objs, err := meta.ExtractList(obj)
- if err != nil {
- return err
- }
- for ix := range objs {
- if err := s.printOneObject(objs[ix], parsers, out); err != nil {
- return err
- }
- }
- } else {
- if err := s.printOneObject(obj, parsers, out); err != nil {
- return err
- }
- }
- return nil
-}
-
-func (s *CustomColumnsPrinter) printOneObject(obj runtime.Object, parsers []*jsonpath.JSONPath, out io.Writer) error {
- columns := make([]string, len(parsers))
- switch u := obj.(type) {
- case *runtime.Unknown:
- if len(u.Raw) > 0 {
- var err error
- if obj, err = runtime.Decode(s.Decoder, u.Raw); err != nil {
- return fmt.Errorf("can't decode object for printing: %v (%s)", err, u.Raw)
- }
- }
- }
-
- for ix := range parsers {
- parser := parsers[ix]
-
- var values [][]reflect.Value
- var err error
- if unstructured, ok := obj.(runtime.Unstructured); ok {
- values, err = parser.FindResults(unstructured.UnstructuredContent())
- } else {
- values, err = parser.FindResults(reflect.ValueOf(obj).Elem().Interface())
- }
-
- if err != nil {
- return err
- }
- valueStrings := []string{}
- if len(values) == 0 || len(values[0]) == 0 {
- valueStrings = append(valueStrings, "")
- }
- for arrIx := range values {
- for valIx := range values[arrIx] {
- valueStrings = append(valueStrings, fmt.Sprintf("%v", values[arrIx][valIx].Interface()))
- }
- }
- columns[ix] = strings.Join(valueStrings, ",")
- }
- fmt.Fprintln(out, strings.Join(columns, "\t"))
- return nil
-}
diff --git a/vendor/k8s.io/kubernetes/pkg/printers/customcolumn_flags.go b/vendor/k8s.io/kubernetes/pkg/printers/customcolumn_flags.go
deleted file mode 100644
index 599d91c272..0000000000
--- a/vendor/k8s.io/kubernetes/pkg/printers/customcolumn_flags.go
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
-Copyright 2018 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
-
-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.
-*/
-
-package printers
-
-import (
- "fmt"
- "os"
- "strings"
-
- "github.com/spf13/cobra"
-
- "k8s.io/cli-runtime/pkg/genericclioptions"
- "k8s.io/kubernetes/pkg/kubectl/scheme"
-)
-
-var columnsFormats = map[string]bool{
- "custom-columns-file": true,
- "custom-columns": true,
-}
-
-// CustomColumnsPrintFlags provides default flags necessary for printing
-// custom resource columns from an inline-template or file.
-type CustomColumnsPrintFlags struct {
- NoHeaders bool
- TemplateArgument string
-}
-
-func (f *CustomColumnsPrintFlags) AllowedFormats() []string {
- formats := make([]string, 0, len(columnsFormats))
- for format := range columnsFormats {
- formats = append(formats, format)
- }
- return formats
-}
-
-// ToPrinter receives an templateFormat and returns a printer capable of
-// handling custom-column printing.
-// Returns false if the specified templateFormat does not match a supported format.
-// Supported format types can be found in pkg/printers/printers.go
-func (f *CustomColumnsPrintFlags) ToPrinter(templateFormat string) (ResourcePrinter, error) {
- if len(templateFormat) == 0 {
- return nil, genericclioptions.NoCompatiblePrinterError{}
- }
-
- templateValue := ""
-
- if len(f.TemplateArgument) == 0 {
- for format := range columnsFormats {
- format = format + "="
- if strings.HasPrefix(templateFormat, format) {
- templateValue = templateFormat[len(format):]
- templateFormat = format[:len(format)-1]
- break
- }
- }
- } else {
- templateValue = f.TemplateArgument
- }
-
- if _, supportedFormat := columnsFormats[templateFormat]; !supportedFormat {
- return nil, genericclioptions.NoCompatiblePrinterError{OutputFormat: &templateFormat, AllowedFormats: f.AllowedFormats()}
- }
-
- if len(templateValue) == 0 {
- return nil, fmt.Errorf("custom-columns format specified but no custom columns given")
- }
-
- decoder := scheme.Codecs.UniversalDecoder()
-
- if templateFormat == "custom-columns-file" {
- file, err := os.Open(templateValue)
- if err != nil {
- return nil, fmt.Errorf("error reading template %s, %v\n", templateValue, err)
- }
- defer file.Close()
- p, err := NewCustomColumnsPrinterFromTemplate(file, decoder)
- return p, err
- }
-
- return NewCustomColumnsPrinterFromSpec(templateValue, decoder, f.NoHeaders)
-}
-
-// AddFlags receives a *cobra.Command reference and binds
-// flags related to custom-columns printing
-func (f *CustomColumnsPrintFlags) AddFlags(c *cobra.Command) {}
-
-// NewCustomColumnsPrintFlags returns flags associated with
-// custom-column printing, with default values set.
-// NoHeaders and TemplateArgument should be set by callers.
-func NewCustomColumnsPrintFlags() *CustomColumnsPrintFlags {
- return &CustomColumnsPrintFlags{
- NoHeaders: false,
- TemplateArgument: "",
- }
-}
diff --git a/vendor/k8s.io/kubernetes/pkg/printers/humanreadable.go b/vendor/k8s.io/kubernetes/pkg/printers/humanreadable.go
index bf4a761a4f..5e51fb335c 100644
--- a/vendor/k8s.io/kubernetes/pkg/printers/humanreadable.go
+++ b/vendor/k8s.io/kubernetes/pkg/printers/humanreadable.go
@@ -22,7 +22,8 @@ import (
"io"
"reflect"
"strings"
- "text/tabwriter"
+
+ "github.com/liggitt/tabwriter"
"k8s.io/apimachinery/pkg/api/meta"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
diff --git a/vendor/k8s.io/kubernetes/pkg/printers/interface.go b/vendor/k8s.io/kubernetes/pkg/printers/interface.go
index f528de5caa..6d40b9c0e2 100644
--- a/vendor/k8s.io/kubernetes/pkg/printers/interface.go
+++ b/vendor/k8s.io/kubernetes/pkg/printers/interface.go
@@ -17,7 +17,6 @@ limitations under the License.
package printers
import (
- "fmt"
"io"
"k8s.io/apimachinery/pkg/runtime"
@@ -47,7 +46,6 @@ type PrintOptions struct {
WithNamespace bool
WithKind bool
Wide bool
- ShowAll bool
ShowLabels bool
AbsoluteTimestamps bool
Kind schema.GroupKind
@@ -58,36 +56,3 @@ type PrintOptions struct {
// indicates if it is OK to ignore missing keys for rendering an output template.
AllowMissingKeys bool
}
-
-// Describer generates output for the named resource or an error
-// if the output could not be generated. Implementers typically
-// abstract the retrieval of the named object from a remote server.
-type Describer interface {
- Describe(namespace, name string, describerSettings DescriberSettings) (output string, err error)
-}
-
-// DescriberSettings holds display configuration for each object
-// describer to control what is printed.
-type DescriberSettings struct {
- ShowEvents bool
-}
-
-// ObjectDescriber is an interface for displaying arbitrary objects with extra
-// information. Use when an object is in hand (on disk, or already retrieved).
-// Implementers may ignore the additional information passed on extra, or use it
-// by default. ObjectDescribers may return ErrNoDescriber if no suitable describer
-// is found.
-type ObjectDescriber interface {
- DescribeObject(object interface{}, extra ...interface{}) (output string, err error)
-}
-
-// ErrNoDescriber is a structured error indicating the provided object or objects
-// cannot be described.
-type ErrNoDescriber struct {
- Types []string
-}
-
-// Error implements the error interface.
-func (e ErrNoDescriber) Error() string {
- return fmt.Sprintf("no describer has been defined for %v", e.Types)
-}
diff --git a/vendor/k8s.io/kubernetes/pkg/printers/tabwriter.go b/vendor/k8s.io/kubernetes/pkg/printers/tabwriter.go
index d1d4cb53fc..21d60e1c41 100644
--- a/vendor/k8s.io/kubernetes/pkg/printers/tabwriter.go
+++ b/vendor/k8s.io/kubernetes/pkg/printers/tabwriter.go
@@ -18,7 +18,8 @@ package printers
import (
"io"
- "text/tabwriter"
+
+ "github.com/liggitt/tabwriter"
)
const (
@@ -26,7 +27,7 @@ const (
tabwriterWidth = 4
tabwriterPadding = 3
tabwriterPadChar = ' '
- tabwriterFlags = 0
+ tabwriterFlags = tabwriter.RememberWidths
)
// GetNewTabWriter returns a tabwriter that translates tabbed columns in input into properly aligned text.
diff --git a/vendor/k8s.io/kubernetes/pkg/registry/rbac/validation/BUILD b/vendor/k8s.io/kubernetes/pkg/registry/rbac/validation/BUILD
index ad66407545..00095ac361 100644
--- a/vendor/k8s.io/kubernetes/pkg/registry/rbac/validation/BUILD
+++ b/vendor/k8s.io/kubernetes/pkg/registry/rbac/validation/BUILD
@@ -41,7 +41,7 @@ go_library(
"//staging/src/k8s.io/apiserver/pkg/authentication/serviceaccount:go_default_library",
"//staging/src/k8s.io/apiserver/pkg/authentication/user:go_default_library",
"//staging/src/k8s.io/apiserver/pkg/endpoints/request:go_default_library",
- "//vendor/github.com/golang/glog:go_default_library",
+ "//vendor/k8s.io/klog:go_default_library",
],
)
diff --git a/vendor/k8s.io/kubernetes/pkg/registry/rbac/validation/rule.go b/vendor/k8s.io/kubernetes/pkg/registry/rbac/validation/rule.go
index 833ffc1e6c..6c88791f8b 100644
--- a/vendor/k8s.io/kubernetes/pkg/registry/rbac/validation/rule.go
+++ b/vendor/k8s.io/kubernetes/pkg/registry/rbac/validation/rule.go
@@ -22,7 +22,7 @@ import (
"fmt"
"strings"
- "github.com/golang/glog"
+ "k8s.io/klog"
rbacv1 "k8s.io/api/rbac/v1"
utilerrors "k8s.io/apimachinery/pkg/util/errors"
@@ -61,7 +61,7 @@ func ConfirmNoEscalation(ctx context.Context, ruleResolver AuthorizationRuleReso
ownerRules, err := ruleResolver.RulesFor(user, namespace)
if err != nil {
// As per AuthorizationRuleResolver contract, this may return a non fatal error with an incomplete list of policies. Log the error and continue.
- glog.V(1).Infof("non-fatal error getting local rules for %v: %v", user, err)
+ klog.V(1).Infof("non-fatal error getting local rules for %v: %v", user, err)
ruleResolutionErrors = append(ruleResolutionErrors, err)
}
diff --git a/vendor/k8s.io/kubernetes/plugin/pkg/auth/authorizer/rbac/BUILD b/vendor/k8s.io/kubernetes/plugin/pkg/auth/authorizer/rbac/BUILD
index 6425852b9d..772cc13ae3 100644
--- a/vendor/k8s.io/kubernetes/plugin/pkg/auth/authorizer/rbac/BUILD
+++ b/vendor/k8s.io/kubernetes/plugin/pkg/auth/authorizer/rbac/BUILD
@@ -22,7 +22,7 @@ go_library(
"//staging/src/k8s.io/apiserver/pkg/authentication/user:go_default_library",
"//staging/src/k8s.io/apiserver/pkg/authorization/authorizer:go_default_library",
"//staging/src/k8s.io/client-go/listers/rbac/v1:go_default_library",
- "//vendor/github.com/golang/glog:go_default_library",
+ "//vendor/k8s.io/klog:go_default_library",
],
)
diff --git a/vendor/k8s.io/kubernetes/plugin/pkg/auth/authorizer/rbac/rbac.go b/vendor/k8s.io/kubernetes/plugin/pkg/auth/authorizer/rbac/rbac.go
index 1701bbc317..5cd339675b 100644
--- a/vendor/k8s.io/kubernetes/plugin/pkg/auth/authorizer/rbac/rbac.go
+++ b/vendor/k8s.io/kubernetes/plugin/pkg/auth/authorizer/rbac/rbac.go
@@ -21,7 +21,7 @@ import (
"bytes"
"fmt"
- "github.com/golang/glog"
+ "k8s.io/klog"
rbacv1 "k8s.io/api/rbac/v1"
"k8s.io/apimachinery/pkg/labels"
@@ -81,7 +81,7 @@ func (r *RBACAuthorizer) Authorize(requestAttributes authorizer.Attributes) (aut
// Build a detailed log of the denial.
// Make the whole block conditional so we don't do a lot of string-building we won't use.
- if glog.V(5) {
+ if klog.V(5) {
var operation string
if requestAttributes.IsResourceRequest() {
b := &bytes.Buffer{}
@@ -115,14 +115,12 @@ func (r *RBACAuthorizer) Authorize(requestAttributes authorizer.Attributes) (aut
scope = "cluster-wide"
}
- glog.Infof("RBAC DENY: user %q groups %q cannot %s %s", requestAttributes.GetUser().GetName(), requestAttributes.GetUser().GetGroups(), operation, scope)
+ klog.Infof("RBAC DENY: user %q groups %q cannot %s %s", requestAttributes.GetUser().GetName(), requestAttributes.GetUser().GetGroups(), operation, scope)
}
reason := ""
if len(ruleCheckingVisitor.errors) > 0 {
reason = fmt.Sprintf("RBAC: %v", utilerrors.NewAggregate(ruleCheckingVisitor.errors))
- } else {
- reason = "no RBAC policy matched"
}
return authorizer.DecisionNoOpinion, reason, nil
}
diff --git a/vendor/modules.txt b/vendor/modules.txt
index 015ed2028e..2abf1a69f6 100644
--- a/vendor/modules.txt
+++ b/vendor/modules.txt
@@ -117,6 +117,8 @@ github.com/inconshreveable/mousetrap
github.com/json-iterator/go
# github.com/konsorten/go-windows-terminal-sequences v1.0.1
github.com/konsorten/go-windows-terminal-sequences
+# github.com/liggitt/tabwriter v0.0.0-20181228230101-89fcab3d43de
+github.com/liggitt/tabwriter
# github.com/mailru/easyjson v0.0.0-20180823135443-60711f1a8329
github.com/mailru/easyjson/jlexer
github.com/mailru/easyjson/jwriter
@@ -205,13 +207,7 @@ golang.org/x/text/secure/bidirule
golang.org/x/text/unicode/bidi
golang.org/x/text/unicode/norm
golang.org/x/text/width
-golang.org/x/text/encoding/unicode
golang.org/x/text/transform
-golang.org/x/text/encoding
-golang.org/x/text/encoding/internal
-golang.org/x/text/encoding/internal/identifier
-golang.org/x/text/internal/utf8internal
-golang.org/x/text/runes
# golang.org/x/time v0.0.0-20190308202827-9d24e82272b4
golang.org/x/time/rate
# golang.org/x/tools v0.0.0-20190320215829-36c10c0a621f
@@ -276,7 +272,7 @@ gopkg.in/inf.v0
gopkg.in/natefinch/lumberjack.v2
# gopkg.in/yaml.v2 v2.2.1
gopkg.in/yaml.v2
-# k8s.io/api v0.0.0-20190118113203-912cbe2bfef3 => k8s.io/api v0.0.0-20181128191700-6db15a15d2d3
+# k8s.io/api v0.0.0-20190313235455-40a48860b5ab => k8s.io/api v0.0.0-20181128191700-6db15a15d2d3
k8s.io/api/core/v1
k8s.io/api/apps/v1
k8s.io/api/rbac/v1
@@ -285,10 +281,6 @@ k8s.io/api/admissionregistration/v1alpha1
k8s.io/api/admissionregistration/v1beta1
k8s.io/api/apps/v1beta1
k8s.io/api/apps/v1beta2
-k8s.io/api/authentication/v1
-k8s.io/api/authentication/v1beta1
-k8s.io/api/authorization/v1
-k8s.io/api/authorization/v1beta1
k8s.io/api/autoscaling/v1
k8s.io/api/autoscaling/v2beta1
k8s.io/api/autoscaling/v2beta2
@@ -308,12 +300,15 @@ k8s.io/api/settings/v1alpha1
k8s.io/api/storage/v1
k8s.io/api/storage/v1alpha1
k8s.io/api/storage/v1beta1
+k8s.io/api/authentication/v1
+k8s.io/api/authentication/v1beta1
+k8s.io/api/authorization/v1
+k8s.io/api/authorization/v1beta1
k8s.io/api/admission/v1beta1
-k8s.io/api/imagepolicy/v1alpha1
-# k8s.io/apiextensions-apiserver v0.0.0-20190221101132-cda7b6cfba78 => k8s.io/apiextensions-apiserver v0.0.0-20190221101132-cda7b6cfba78
-k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset/scheme
+# k8s.io/apiextensions-apiserver v0.0.0-20190315093550-53c4693659ed => k8s.io/apiextensions-apiserver v0.0.0-20190221101132-cda7b6cfba78
k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1
k8s.io/apiextensions-apiserver/pkg/client/informers/externalversions
+k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset/scheme
k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset
k8s.io/apiextensions-apiserver/pkg/client/listers/apiextensions/v1beta1
k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset/fake
@@ -326,12 +321,13 @@ k8s.io/apiextensions-apiserver/pkg/client/informers/externalversions/apiextensio
k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/validation
k8s.io/apiextensions-apiserver/pkg/apiserver/validation
k8s.io/apiextensions-apiserver/pkg/features
-# k8s.io/apimachinery v0.0.0-20190221084156-01f179d85dbc => k8s.io/apimachinery v0.0.0-20190221084156-01f179d85dbc
-k8s.io/apimachinery/pkg/runtime
-k8s.io/apimachinery/pkg/util/runtime
+# k8s.io/apimachinery v0.0.0-20190404173353-6a84e37a896d => k8s.io/apimachinery v0.0.0-20190221084156-01f179d85dbc
k8s.io/apimachinery/pkg/apis/meta/v1
+k8s.io/apimachinery/pkg/runtime
k8s.io/apimachinery/pkg/runtime/schema
k8s.io/apimachinery/pkg/types
+k8s.io/apimachinery/pkg/util/runtime
+k8s.io/apimachinery/pkg/conversion
k8s.io/apimachinery/pkg/runtime/serializer
k8s.io/apimachinery/pkg/watch
k8s.io/apimachinery/pkg/labels
@@ -343,7 +339,6 @@ k8s.io/apimachinery/pkg/api/meta
k8s.io/apimachinery/pkg/apis/meta/v1/unstructured
k8s.io/apimachinery/pkg/util/strategicpatch
k8s.io/apimachinery/pkg/util/wait
-k8s.io/apimachinery/pkg/conversion
k8s.io/apimachinery/pkg/apis/meta/internalversion
k8s.io/apimachinery/pkg/apis/meta/v1beta1
k8s.io/apimachinery/pkg/fields
@@ -353,10 +348,11 @@ k8s.io/apimachinery/pkg/api/resource
k8s.io/apimachinery/pkg/util/validation
k8s.io/apimachinery/pkg/util/sets
k8s.io/apimachinery/pkg/util/waitgroup
+k8s.io/apimachinery/pkg/selection
k8s.io/apimachinery/pkg/conversion/queryparams
k8s.io/apimachinery/pkg/util/json
k8s.io/apimachinery/pkg/util/naming
-k8s.io/apimachinery/pkg/selection
+k8s.io/apimachinery/third_party/forked/golang/reflect
k8s.io/apimachinery/pkg/util/clock
k8s.io/apimachinery/pkg/util/net
k8s.io/apimachinery/pkg/runtime/serializer/streaming
@@ -373,12 +369,10 @@ k8s.io/apimachinery/pkg/util/framer
k8s.io/apimachinery/pkg/util/rand
k8s.io/apimachinery/pkg/util/mergepatch
k8s.io/apimachinery/third_party/forked/golang/json
-k8s.io/apimachinery/third_party/forked/golang/reflect
k8s.io/apimachinery/pkg/api/validation/path
k8s.io/apimachinery/pkg/apis/meta/v1/validation
k8s.io/apimachinery/pkg/util/uuid
-k8s.io/apimachinery/pkg/apis/meta/v1/unstructured/unstructuredscheme
-# k8s.io/apiserver v0.0.0-20190518070817-682b37ff211e => k8s.io/apiserver v0.0.0-20190402012035-5e1c1f41ee34
+# k8s.io/apiserver v0.0.0-20190531031430-24fd0f18bc21 => k8s.io/apiserver v0.0.0-20190402012035-5e1c1f41ee34
k8s.io/apiserver/pkg/server
k8s.io/apiserver/pkg/util/logs
k8s.io/apiserver/pkg/authentication/serviceaccount
@@ -472,14 +466,9 @@ k8s.io/apiserver/pkg/util/trace
k8s.io/apiserver/pkg/storage/etcd/util
k8s.io/apiserver/pkg/admission/plugin/webhook/config/apis/webhookadmission
k8s.io/apiserver/pkg/admission/plugin/webhook/config/apis/webhookadmission/v1alpha1
-# k8s.io/cli-runtime v0.0.0-20190221101700-11047e25a94a
-k8s.io/cli-runtime/pkg/genericclioptions
-k8s.io/cli-runtime/pkg/genericclioptions/printers
-k8s.io/cli-runtime/pkg/genericclioptions/resource
# k8s.io/client-go v11.0.0+incompatible => k8s.io/client-go v0.0.0-20190228133956-77e032213d34
k8s.io/client-go/tools/clientcmd
k8s.io/client-go/tools/reference
-k8s.io/client-go/kubernetes/scheme
k8s.io/client-go/tools/record
k8s.io/client-go/plugin/pkg/client/auth/oidc
k8s.io/client-go/rest
@@ -491,6 +480,7 @@ k8s.io/client-go/tools/cache
k8s.io/client-go/listers/rbac/v1
k8s.io/client-go/informers
k8s.io/client-go/util/workqueue
+k8s.io/client-go/kubernetes/scheme
k8s.io/client-go/listers/core/v1
k8s.io/client-go/kubernetes/fake
k8s.io/client-go/kubernetes/typed/core/v1
@@ -587,7 +577,6 @@ k8s.io/client-go/kubernetes/typed/storage/v1alpha1
k8s.io/client-go/kubernetes/typed/storage/v1alpha1/fake
k8s.io/client-go/kubernetes/typed/storage/v1beta1
k8s.io/client-go/kubernetes/typed/storage/v1beta1/fake
-k8s.io/client-go/util/jsonpath
k8s.io/client-go/tools/clientcmd/api/v1
k8s.io/client-go/pkg/apis/clientauthentication
k8s.io/client-go/pkg/apis/clientauthentication/v1alpha1
@@ -620,8 +609,6 @@ k8s.io/client-go/informers/settings/v1alpha1
k8s.io/client-go/informers/storage/v1
k8s.io/client-go/informers/storage/v1alpha1
k8s.io/client-go/informers/storage/v1beta1
-k8s.io/client-go/restmapper
-k8s.io/client-go/third_party/forked/golang/template
k8s.io/client-go/listers/admissionregistration/v1beta1
k8s.io/client-go/listers/admissionregistration/v1alpha1
k8s.io/client-go/listers/apps/v1beta1
@@ -646,7 +633,7 @@ k8s.io/client-go/listers/settings/v1alpha1
k8s.io/client-go/listers/storage/v1
k8s.io/client-go/listers/storage/v1alpha1
k8s.io/client-go/listers/storage/v1beta1
-# k8s.io/code-generator v0.0.0-20181203235156-f8cba74510f3 => k8s.io/code-generator v0.0.0-20181128191024-b1289fc74931
+# k8s.io/code-generator v0.0.0-20190311093542-50b561225d70 => k8s.io/code-generator v0.0.0-20181128191024-b1289fc74931
k8s.io/code-generator/cmd/client-gen
k8s.io/code-generator/cmd/conversion-gen/
k8s.io/code-generator/cmd/deepcopy-gen
@@ -689,7 +676,7 @@ k8s.io/gengo/parser
k8s.io/gengo/examples/set-gen/sets
# k8s.io/klog v0.2.0
k8s.io/klog
-# k8s.io/kube-aggregator v0.0.0-20190221095344-e77f03c95d65 => k8s.io/kube-aggregator v0.0.0-20190221095344-e77f03c95d65
+# k8s.io/kube-aggregator v0.0.0-20190404125450-f5e124c822d6 => k8s.io/kube-aggregator v0.0.0-20190221095344-e77f03c95d65
k8s.io/kube-aggregator/pkg/apis/apiregistration/v1
k8s.io/kube-aggregator/pkg/client/informers/externalversions
k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset
@@ -718,12 +705,11 @@ k8s.io/kube-openapi/pkg/generators/rules
k8s.io/kube-openapi/pkg/builder
k8s.io/kube-openapi/pkg/handler
k8s.io/kube-openapi/pkg/util/sets
-# k8s.io/kubernetes v1.12.8
+# k8s.io/kubernetes v1.14.2
k8s.io/kubernetes/plugin/pkg/auth/authorizer/rbac
k8s.io/kubernetes/pkg/util/labels
k8s.io/kubernetes/pkg/printers
k8s.io/kubernetes/pkg/printers/storage
k8s.io/kubernetes/pkg/apis/rbac/v1
k8s.io/kubernetes/pkg/registry/rbac/validation
-k8s.io/kubernetes/pkg/kubectl/scheme
k8s.io/kubernetes/pkg/apis/rbac