1
0
mirror of https://github.com/rancher/cli.git synced 2026-02-05 18:48:50 +01:00

Vendor update

This commit is contained in:
Dan Ramich
2018-05-07 10:19:58 -07:00
committed by Darren Shepherd
parent f7c605a614
commit a534650446
67 changed files with 1966 additions and 398 deletions

View File

@@ -2,6 +2,7 @@ github.com/c-bata/go-prompt f329ebd2409de559ba256325b8a18b13a145b5d5
github.com/docker/docker 8658748ef716e43a5f6d834825d818012ed6e2c4
github.com/ghodss/yaml 0ca9ea5df5451ffdf184b4428c902747c2c11cd7
github.com/grantae/certinfo 59d56a35515b3ab2326749924739cfe58facc991
github.com/hashicorp/go-version 23480c0665776210b5fbbac6eaaee40e3e6a96b7
github.com/mattn/go-colorable efa589957cd060542a26d2dd7832fd6a6c6c3ade
github.com/mattn/go-isatty 6ca4dbf54d38eea1a992b3c722a76a5d1c4cb25c
github.com/mattn/go-tty 931426f7535ac39720c8909d70ece5a41a2502a6
@@ -23,5 +24,5 @@ golang.org/x/sys/unix 2f57af4873d00d535c5c9028850aa2152e6a5566
golang.org/x/sys/windows 2f57af4873d00d535c5c9028850aa2152e6a5566
gopkg.in/yaml.v2 670d4cfef0544295bc27a114dbac37980d83185a
github.com/rancher/norman c5c5ff280dbedea350fd73163b1f069624c628c0
github.com/rancher/types 7d989d829e7b08c619fe3816513f442790344b30
github.com/rancher/norman 8d5d75c7b82deb9226f1203d16fba3965f2cd775
github.com/rancher/types 9f5225fa37e5cfe5e0e3321fa66514b4538412e4

12
vendor/github.com/hashicorp/go-version/.travis.yml generated vendored Normal file
View File

@@ -0,0 +1,12 @@
language: go
go:
- 1.0
- 1.1
- 1.2
- 1.3
- 1.4
- 1.9
script:
- go test

354
vendor/github.com/hashicorp/go-version/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,354 @@
Mozilla Public License, version 2.0
1. Definitions
1.1. “Contributor”
means each individual or legal entity that creates, contributes to the
creation of, or owns Covered Software.
1.2. “Contributor Version”
means the combination of the Contributions of others (if any) used by a
Contributor and that particular Contributors Contribution.
1.3. “Contribution”
means Covered Software of a particular Contributor.
1.4. “Covered Software”
means Source Code Form to which the initial Contributor has attached the
notice in Exhibit A, the Executable Form of such Source Code Form, and
Modifications of such Source Code Form, in each case including portions
thereof.
1.5. “Incompatible With Secondary Licenses”
means
a. that the initial Contributor has attached the notice described in
Exhibit B to the Covered Software; or
b. that the Covered Software was made available under the terms of version
1.1 or earlier of the License, but not also under the terms of a
Secondary License.
1.6. “Executable Form”
means any form of the work other than Source Code Form.
1.7. “Larger Work”
means a work that combines Covered Software with other material, in a separate
file or files, that is not Covered Software.
1.8. “License”
means this document.
1.9. “Licensable”
means having the right to grant, to the maximum extent possible, whether at the
time of the initial grant or subsequently, any and all of the rights conveyed by
this License.
1.10. “Modifications”
means any of the following:
a. any file in Source Code Form that results from an addition to, deletion
from, or modification of the contents of Covered Software; or
b. any new file in Source Code Form that contains any Covered Software.
1.11. “Patent Claims” of a Contributor
means any patent claim(s), including without limitation, method, process,
and apparatus claims, in any patent Licensable by such Contributor that
would be infringed, but for the grant of the License, by the making,
using, selling, offering for sale, having made, import, or transfer of
either its Contributions or its Contributor Version.
1.12. “Secondary License”
means either the GNU General Public License, Version 2.0, the GNU Lesser
General Public License, Version 2.1, the GNU Affero General Public
License, Version 3.0, or any later versions of those licenses.
1.13. “Source Code Form”
means the form of the work preferred for making modifications.
1.14. “You” (or “Your”)
means an individual or a legal entity exercising rights under this
License. For legal entities, “You” includes any entity that controls, is
controlled by, or is under common control with You. For purposes of this
definition, “control” means (a) the power, direct or indirect, to cause
the direction or management of such entity, whether by contract or
otherwise, or (b) ownership of more than fifty percent (50%) of the
outstanding shares or beneficial ownership of such entity.
2. License Grants and Conditions
2.1. Grants
Each Contributor hereby grants You a world-wide, royalty-free,
non-exclusive license:
a. under intellectual property rights (other than patent or trademark)
Licensable by such Contributor to use, reproduce, make available,
modify, display, perform, distribute, and otherwise exploit its
Contributions, either on an unmodified basis, with Modifications, or as
part of a Larger Work; and
b. under Patent Claims of such Contributor to make, use, sell, offer for
sale, have made, import, and otherwise transfer either its Contributions
or its Contributor Version.
2.2. Effective Date
The licenses granted in Section 2.1 with respect to any Contribution become
effective for each Contribution on the date the Contributor first distributes
such Contribution.
2.3. Limitations on Grant Scope
The licenses granted in this Section 2 are the only rights granted under this
License. No additional rights or licenses will be implied from the distribution
or licensing of Covered Software under this License. Notwithstanding Section
2.1(b) above, no patent license is granted by a Contributor:
a. for any code that a Contributor has removed from Covered Software; or
b. for infringements caused by: (i) Your and any other third partys
modifications of Covered Software, or (ii) the combination of its
Contributions with other software (except as part of its Contributor
Version); or
c. under Patent Claims infringed by Covered Software in the absence of its
Contributions.
This License does not grant any rights in the trademarks, service marks, or
logos of any Contributor (except as may be necessary to comply with the
notice requirements in Section 3.4).
2.4. Subsequent Licenses
No Contributor makes additional grants as a result of Your choice to
distribute the Covered Software under a subsequent version of this License
(see Section 10.2) or under the terms of a Secondary License (if permitted
under the terms of Section 3.3).
2.5. Representation
Each Contributor represents that the Contributor believes its Contributions
are its original creation(s) or it has sufficient rights to grant the
rights to its Contributions conveyed by this License.
2.6. Fair Use
This License is not intended to limit any rights You have under applicable
copyright doctrines of fair use, fair dealing, or other equivalents.
2.7. Conditions
Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted in
Section 2.1.
3. Responsibilities
3.1. Distribution of Source Form
All distribution of Covered Software in Source Code Form, including any
Modifications that You create or to which You contribute, must be under the
terms of this License. You must inform recipients that the Source Code Form
of the Covered Software is governed by the terms of this License, and how
they can obtain a copy of this License. You may not attempt to alter or
restrict the recipients rights in the Source Code Form.
3.2. Distribution of Executable Form
If You distribute Covered Software in Executable Form then:
a. such Covered Software must also be made available in Source Code Form,
as described in Section 3.1, and You must inform recipients of the
Executable Form how they can obtain a copy of such Source Code Form by
reasonable means in a timely manner, at a charge no more than the cost
of distribution to the recipient; and
b. You may distribute such Executable Form under the terms of this License,
or sublicense it under different terms, provided that the license for
the Executable Form does not attempt to limit or alter the recipients
rights in the Source Code Form under this License.
3.3. Distribution of a Larger Work
You may create and distribute a Larger Work under terms of Your choice,
provided that You also comply with the requirements of this License for the
Covered Software. If the Larger Work is a combination of Covered Software
with a work governed by one or more Secondary Licenses, and the Covered
Software is not Incompatible With Secondary Licenses, this License permits
You to additionally distribute such Covered Software under the terms of
such Secondary License(s), so that the recipient of the Larger Work may, at
their option, further distribute the Covered Software under the terms of
either this License or such Secondary License(s).
3.4. Notices
You may not remove or alter the substance of any license notices (including
copyright notices, patent notices, disclaimers of warranty, or limitations
of liability) contained within the Source Code Form of the Covered
Software, except that You may alter any license notices to the extent
required to remedy known factual inaccuracies.
3.5. Application of Additional Terms
You may choose to offer, and to charge a fee for, warranty, support,
indemnity or liability obligations to one or more recipients of Covered
Software. However, You may do so only on Your own behalf, and not on behalf
of any Contributor. You must make it absolutely clear that any such
warranty, support, indemnity, or liability obligation is offered by You
alone, and You hereby agree to indemnify every Contributor for any
liability incurred by such Contributor as a result of warranty, support,
indemnity or liability terms You offer. You may include additional
disclaimers of warranty and limitations of liability specific to any
jurisdiction.
4. Inability to Comply Due to Statute or Regulation
If it is impossible for You to comply with any of the terms of this License
with respect to some or all of the Covered Software due to statute, judicial
order, or regulation then You must: (a) comply with the terms of this License
to the maximum extent possible; and (b) describe the limitations and the code
they affect. Such description must be placed in a text file included with all
distributions of the Covered Software under this License. Except to the
extent prohibited by statute or regulation, such description must be
sufficiently detailed for a recipient of ordinary skill to be able to
understand it.
5. Termination
5.1. The rights granted under this License will terminate automatically if You
fail to comply with any of its terms. However, if You become compliant,
then the rights granted under this License from a particular Contributor
are reinstated (a) provisionally, unless and until such Contributor
explicitly and finally terminates Your grants, and (b) on an ongoing basis,
if such Contributor fails to notify You of the non-compliance by some
reasonable means prior to 60 days after You have come back into compliance.
Moreover, Your grants from a particular Contributor are reinstated on an
ongoing basis if such Contributor notifies You of the non-compliance by
some reasonable means, this is the first time You have received notice of
non-compliance with this License from such Contributor, and You become
compliant prior to 30 days after Your receipt of the notice.
5.2. If You initiate litigation against any entity by asserting a patent
infringement claim (excluding declaratory judgment actions, counter-claims,
and cross-claims) alleging that a Contributor Version directly or
indirectly infringes any patent, then the rights granted to You by any and
all Contributors for the Covered Software under Section 2.1 of this License
shall terminate.
5.3. In the event of termination under Sections 5.1 or 5.2 above, all end user
license agreements (excluding distributors and resellers) which have been
validly granted by You or Your distributors under this License prior to
termination shall survive termination.
6. Disclaimer of Warranty
Covered Software is provided under this License on an “as is” basis, without
warranty of any kind, either expressed, implied, or statutory, including,
without limitation, warranties that the Covered Software is free of defects,
merchantable, fit for a particular purpose or non-infringing. The entire
risk as to the quality and performance of the Covered Software is with You.
Should any Covered Software prove defective in any respect, You (not any
Contributor) assume the cost of any necessary servicing, repair, or
correction. This disclaimer of warranty constitutes an essential part of this
License. No use of any Covered Software is authorized under this License
except under this disclaimer.
7. Limitation of Liability
Under no circumstances and under no legal theory, whether tort (including
negligence), contract, or otherwise, shall any Contributor, or anyone who
distributes Covered Software as permitted above, be liable to You for any
direct, indirect, special, incidental, or consequential damages of any
character including, without limitation, damages for lost profits, loss of
goodwill, work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses, even if such party shall have been
informed of the possibility of such damages. This limitation of liability
shall not apply to liability for death or personal injury resulting from such
partys negligence to the extent applicable law prohibits such limitation.
Some jurisdictions do not allow the exclusion or limitation of incidental or
consequential damages, so this exclusion and limitation may not apply to You.
8. Litigation
Any litigation relating to this License may be brought only in the courts of
a jurisdiction where the defendant maintains its principal place of business
and such litigation shall be governed by laws of that jurisdiction, without
reference to its conflict-of-law provisions. Nothing in this Section shall
prevent a partys ability to bring cross-claims or counter-claims.
9. Miscellaneous
This License represents the complete agreement concerning the subject matter
hereof. If any provision of this License is held to be unenforceable, such
provision shall be reformed only to the extent necessary to make it
enforceable. Any law or regulation which provides that the language of a
contract shall be construed against the drafter shall not be used to construe
this License against a Contributor.
10. Versions of the License
10.1. New Versions
Mozilla Foundation is the license steward. Except as provided in Section
10.3, no one other than the license steward has the right to modify or
publish new versions of this License. Each version will be given a
distinguishing version number.
10.2. Effect of New Versions
You may distribute the Covered Software under the terms of the version of
the License under which You originally received the Covered Software, or
under the terms of any subsequent version published by the license
steward.
10.3. Modified Versions
If you create software not governed by this License, and you want to
create a new license for such software, you may create and use a modified
version of this License if you rename the license and remove any
references to the name of the license steward (except to note that such
modified license differs from this License).
10.4. Distributing Source Code Form that is Incompatible With Secondary Licenses
If You choose to distribute Source Code Form that is Incompatible With
Secondary Licenses under the terms of this version of the License, the
notice described in Exhibit B of this License must be attached.
Exhibit A - Source Code Form License Notice
This Source Code Form is subject to the
terms of the Mozilla Public License, v.
2.0. If a copy of the MPL was not
distributed with this file, You can
obtain one at
http://mozilla.org/MPL/2.0/.
If it is not possible or desirable to put the notice in a particular file, then
You may include the notice in a location (such as a LICENSE file in a relevant
directory) where a recipient would be likely to look for such a notice.
You may add additional accurate notices of copyright ownership.
Exhibit B - “Incompatible With Secondary Licenses” Notice
This Source Code Form is “Incompatible
With Secondary Licenses”, as defined by
the Mozilla Public License, v. 2.0.

65
vendor/github.com/hashicorp/go-version/README.md generated vendored Normal file
View File

@@ -0,0 +1,65 @@
# Versioning Library for Go
[![Build Status](https://travis-ci.org/hashicorp/go-version.svg?branch=master)](https://travis-ci.org/hashicorp/go-version)
go-version is a library for parsing versions and version constraints,
and verifying versions against a set of constraints. go-version
can sort a collection of versions properly, handles prerelease/beta
versions, can increment versions, etc.
Versions used with go-version must follow [SemVer](http://semver.org/).
## Installation and Usage
Package documentation can be found on
[GoDoc](http://godoc.org/github.com/hashicorp/go-version).
Installation can be done with a normal `go get`:
```
$ go get github.com/hashicorp/go-version
```
#### Version Parsing and Comparison
```go
v1, err := version.NewVersion("1.2")
v2, err := version.NewVersion("1.5+metadata")
// Comparison example. There is also GreaterThan, Equal, and just
// a simple Compare that returns an int allowing easy >=, <=, etc.
if v1.LessThan(v2) {
fmt.Printf("%s is less than %s", v1, v2)
}
```
#### Version Constraints
```go
v1, err := version.NewVersion("1.2")
// Constraints example.
constraints, err := version.NewConstraint(">= 1.0, < 1.4")
if constraints.Check(v1) {
fmt.Printf("%s satisfies constraints %s", v1, constraints)
}
```
#### Version Sorting
```go
versionsRaw := []string{"1.1", "0.7.1", "1.4-beta", "1.4", "2"}
versions := make([]*version.Version, len(versionsRaw))
for i, raw := range versionsRaw {
v, _ := version.NewVersion(raw)
versions[i] = v
}
// After this, the versions are properly sorted
sort.Sort(version.Collection(versions))
```
## Issues and Contributing
If you find an issue with this library, please report an issue. If you'd
like, we welcome any contributions. Fork this library and submit a pull
request.

204
vendor/github.com/hashicorp/go-version/constraint.go generated vendored Normal file
View File

@@ -0,0 +1,204 @@
package version
import (
"fmt"
"reflect"
"regexp"
"strings"
)
// Constraint represents a single constraint for a version, such as
// ">= 1.0".
type Constraint struct {
f constraintFunc
check *Version
original string
}
// Constraints is a slice of constraints. We make a custom type so that
// we can add methods to it.
type Constraints []*Constraint
type constraintFunc func(v, c *Version) bool
var constraintOperators map[string]constraintFunc
var constraintRegexp *regexp.Regexp
func init() {
constraintOperators = map[string]constraintFunc{
"": constraintEqual,
"=": constraintEqual,
"!=": constraintNotEqual,
">": constraintGreaterThan,
"<": constraintLessThan,
">=": constraintGreaterThanEqual,
"<=": constraintLessThanEqual,
"~>": constraintPessimistic,
}
ops := make([]string, 0, len(constraintOperators))
for k := range constraintOperators {
ops = append(ops, regexp.QuoteMeta(k))
}
constraintRegexp = regexp.MustCompile(fmt.Sprintf(
`^\s*(%s)\s*(%s)\s*$`,
strings.Join(ops, "|"),
VersionRegexpRaw))
}
// NewConstraint will parse one or more constraints from the given
// constraint string. The string must be a comma-separated list of
// constraints.
func NewConstraint(v string) (Constraints, error) {
vs := strings.Split(v, ",")
result := make([]*Constraint, len(vs))
for i, single := range vs {
c, err := parseSingle(single)
if err != nil {
return nil, err
}
result[i] = c
}
return Constraints(result), nil
}
// Check tests if a version satisfies all the constraints.
func (cs Constraints) Check(v *Version) bool {
for _, c := range cs {
if !c.Check(v) {
return false
}
}
return true
}
// Returns the string format of the constraints
func (cs Constraints) String() string {
csStr := make([]string, len(cs))
for i, c := range cs {
csStr[i] = c.String()
}
return strings.Join(csStr, ",")
}
// Check tests if a constraint is validated by the given version.
func (c *Constraint) Check(v *Version) bool {
return c.f(v, c.check)
}
func (c *Constraint) String() string {
return c.original
}
func parseSingle(v string) (*Constraint, error) {
matches := constraintRegexp.FindStringSubmatch(v)
if matches == nil {
return nil, fmt.Errorf("Malformed constraint: %s", v)
}
check, err := NewVersion(matches[2])
if err != nil {
return nil, err
}
return &Constraint{
f: constraintOperators[matches[1]],
check: check,
original: v,
}, nil
}
func prereleaseCheck(v, c *Version) bool {
switch vPre, cPre := v.Prerelease() != "", c.Prerelease() != ""; {
case cPre && vPre:
// A constraint with a pre-release can only match a pre-release version
// with the same base segments.
return reflect.DeepEqual(c.Segments64(), v.Segments64())
case !cPre && vPre:
// A constraint without a pre-release can only match a version without a
// pre-release.
return false
case cPre && !vPre:
// OK, except with the pessimistic operator
case !cPre && !vPre:
// OK
}
return true
}
//-------------------------------------------------------------------
// Constraint functions
//-------------------------------------------------------------------
func constraintEqual(v, c *Version) bool {
return v.Equal(c)
}
func constraintNotEqual(v, c *Version) bool {
return !v.Equal(c)
}
func constraintGreaterThan(v, c *Version) bool {
return prereleaseCheck(v, c) && v.Compare(c) == 1
}
func constraintLessThan(v, c *Version) bool {
return prereleaseCheck(v, c) && v.Compare(c) == -1
}
func constraintGreaterThanEqual(v, c *Version) bool {
return prereleaseCheck(v, c) && v.Compare(c) >= 0
}
func constraintLessThanEqual(v, c *Version) bool {
return prereleaseCheck(v, c) && v.Compare(c) <= 0
}
func constraintPessimistic(v, c *Version) bool {
// Using a pessimistic constraint with a pre-release, restricts versions to pre-releases
if !prereleaseCheck(v, c) || (c.Prerelease() != "" && v.Prerelease() == "") {
return false
}
// If the version being checked is naturally less than the constraint, then there
// is no way for the version to be valid against the constraint
if v.LessThan(c) {
return false
}
// We'll use this more than once, so grab the length now so it's a little cleaner
// to write the later checks
cs := len(c.segments)
// If the version being checked has less specificity than the constraint, then there
// is no way for the version to be valid against the constraint
if cs > len(v.segments) {
return false
}
// Check the segments in the constraint against those in the version. If the version
// being checked, at any point, does not have the same values in each index of the
// constraints segments, then it cannot be valid against the constraint.
for i := 0; i < c.si-1; i++ {
if v.segments[i] != c.segments[i] {
return false
}
}
// Check the last part of the segment in the constraint. If the version segment at
// this index is less than the constraints segment at this index, then it cannot
// be valid against the constraint
if c.segments[cs-1] > v.segments[cs-1] {
return false
}
// If nothing has rejected the version by now, it's valid
return true
}

326
vendor/github.com/hashicorp/go-version/version.go generated vendored Normal file
View File

@@ -0,0 +1,326 @@
package version
import (
"bytes"
"fmt"
"reflect"
"regexp"
"strconv"
"strings"
)
// The compiled regular expression used to test the validity of a version.
var versionRegexp *regexp.Regexp
// The raw regular expression string used for testing the validity
// of a version.
const VersionRegexpRaw string = `v?([0-9]+(\.[0-9]+)*?)` +
`(-?([0-9A-Za-z\-~]+(\.[0-9A-Za-z\-~]+)*))?` +
`(\+([0-9A-Za-z\-~]+(\.[0-9A-Za-z\-~]+)*))?` +
`?`
// Version represents a single version.
type Version struct {
metadata string
pre string
segments []int64
si int
}
func init() {
versionRegexp = regexp.MustCompile("^" + VersionRegexpRaw + "$")
}
// NewVersion parses the given version and returns a new
// Version.
func NewVersion(v string) (*Version, error) {
matches := versionRegexp.FindStringSubmatch(v)
if matches == nil {
return nil, fmt.Errorf("Malformed version: %s", v)
}
segmentsStr := strings.Split(matches[1], ".")
segments := make([]int64, len(segmentsStr))
si := 0
for i, str := range segmentsStr {
val, err := strconv.ParseInt(str, 10, 64)
if err != nil {
return nil, fmt.Errorf(
"Error parsing version: %s", err)
}
segments[i] = int64(val)
si++
}
// Even though we could support more than three segments, if we
// got less than three, pad it with 0s. This is to cover the basic
// default usecase of semver, which is MAJOR.MINOR.PATCH at the minimum
for i := len(segments); i < 3; i++ {
segments = append(segments, 0)
}
return &Version{
metadata: matches[7],
pre: matches[4],
segments: segments,
si: si,
}, nil
}
// Must is a helper that wraps a call to a function returning (*Version, error)
// and panics if error is non-nil.
func Must(v *Version, err error) *Version {
if err != nil {
panic(err)
}
return v
}
// Compare compares this version to another version. This
// returns -1, 0, or 1 if this version is smaller, equal,
// or larger than the other version, respectively.
//
// If you want boolean results, use the LessThan, Equal,
// or GreaterThan methods.
func (v *Version) Compare(other *Version) int {
// A quick, efficient equality check
if v.String() == other.String() {
return 0
}
segmentsSelf := v.Segments64()
segmentsOther := other.Segments64()
// If the segments are the same, we must compare on prerelease info
if reflect.DeepEqual(segmentsSelf, segmentsOther) {
preSelf := v.Prerelease()
preOther := other.Prerelease()
if preSelf == "" && preOther == "" {
return 0
}
if preSelf == "" {
return 1
}
if preOther == "" {
return -1
}
return comparePrereleases(preSelf, preOther)
}
// Get the highest specificity (hS), or if they're equal, just use segmentSelf length
lenSelf := len(segmentsSelf)
lenOther := len(segmentsOther)
hS := lenSelf
if lenSelf < lenOther {
hS = lenOther
}
// Compare the segments
// Because a constraint could have more/less specificity than the version it's
// checking, we need to account for a lopsided or jagged comparison
for i := 0; i < hS; i++ {
if i > lenSelf-1 {
// This means Self had the lower specificity
// Check to see if the remaining segments in Other are all zeros
if !allZero(segmentsOther[i:]) {
// if not, it means that Other has to be greater than Self
return -1
}
break
} else if i > lenOther-1 {
// this means Other had the lower specificity
// Check to see if the remaining segments in Self are all zeros -
if !allZero(segmentsSelf[i:]) {
//if not, it means that Self has to be greater than Other
return 1
}
break
}
lhs := segmentsSelf[i]
rhs := segmentsOther[i]
if lhs == rhs {
continue
} else if lhs < rhs {
return -1
}
// Otherwis, rhs was > lhs, they're not equal
return 1
}
// if we got this far, they're equal
return 0
}
func allZero(segs []int64) bool {
for _, s := range segs {
if s != 0 {
return false
}
}
return true
}
func comparePart(preSelf string, preOther string) int {
if preSelf == preOther {
return 0
}
var selfInt int64
selfNumeric := true
selfInt, err := strconv.ParseInt(preSelf, 10, 64)
if err != nil {
selfNumeric = false
}
var otherInt int64
otherNumeric := true
otherInt, err = strconv.ParseInt(preOther, 10, 64)
if err != nil {
otherNumeric = false
}
// if a part is empty, we use the other to decide
if preSelf == "" {
if otherNumeric {
return -1
}
return 1
}
if preOther == "" {
if selfNumeric {
return 1
}
return -1
}
if selfNumeric && !otherNumeric {
return -1
} else if !selfNumeric && otherNumeric {
return 1
} else if !selfNumeric && !otherNumeric && preSelf > preOther {
return 1
} else if selfInt > otherInt {
return 1
}
return -1
}
func comparePrereleases(v string, other string) int {
// the same pre release!
if v == other {
return 0
}
// split both pre releases for analyse their parts
selfPreReleaseMeta := strings.Split(v, ".")
otherPreReleaseMeta := strings.Split(other, ".")
selfPreReleaseLen := len(selfPreReleaseMeta)
otherPreReleaseLen := len(otherPreReleaseMeta)
biggestLen := otherPreReleaseLen
if selfPreReleaseLen > otherPreReleaseLen {
biggestLen = selfPreReleaseLen
}
// loop for parts to find the first difference
for i := 0; i < biggestLen; i = i + 1 {
partSelfPre := ""
if i < selfPreReleaseLen {
partSelfPre = selfPreReleaseMeta[i]
}
partOtherPre := ""
if i < otherPreReleaseLen {
partOtherPre = otherPreReleaseMeta[i]
}
compare := comparePart(partSelfPre, partOtherPre)
// if parts are equals, continue the loop
if compare != 0 {
return compare
}
}
return 0
}
// Equal tests if two versions are equal.
func (v *Version) Equal(o *Version) bool {
return v.Compare(o) == 0
}
// GreaterThan tests if this version is greater than another version.
func (v *Version) GreaterThan(o *Version) bool {
return v.Compare(o) > 0
}
// LessThan tests if this version is less than another version.
func (v *Version) LessThan(o *Version) bool {
return v.Compare(o) < 0
}
// Metadata returns any metadata that was part of the version
// string.
//
// Metadata is anything that comes after the "+" in the version.
// For example, with "1.2.3+beta", the metadata is "beta".
func (v *Version) Metadata() string {
return v.metadata
}
// Prerelease returns any prerelease data that is part of the version,
// or blank if there is no prerelease data.
//
// Prerelease information is anything that comes after the "-" in the
// version (but before any metadata). For example, with "1.2.3-beta",
// the prerelease information is "beta".
func (v *Version) Prerelease() string {
return v.pre
}
// Segments returns the numeric segments of the version as a slice of ints.
//
// This excludes any metadata or pre-release information. For example,
// for a version "1.2.3-beta", segments will return a slice of
// 1, 2, 3.
func (v *Version) Segments() []int {
segmentSlice := make([]int, len(v.segments))
for i, v := range v.segments {
segmentSlice[i] = int(v)
}
return segmentSlice
}
// Segments64 returns the numeric segments of the version as a slice of int64s.
//
// This excludes any metadata or pre-release information. For example,
// for a version "1.2.3-beta", segments will return a slice of
// 1, 2, 3.
func (v *Version) Segments64() []int64 {
return v.segments
}
// String returns the full version string included pre-release
// and metadata information.
func (v *Version) String() string {
var buf bytes.Buffer
fmtParts := make([]string, len(v.segments))
for i, s := range v.segments {
// We can ignore err here since we've pre-parsed the values in segments
str := strconv.FormatInt(s, 10)
fmtParts[i] = str
}
fmt.Fprintf(&buf, strings.Join(fmtParts, "."))
if v.pre != "" {
fmt.Fprintf(&buf, "-%s", v.pre)
}
if v.metadata != "" {
fmt.Fprintf(&buf, "+%s", v.metadata)
}
return buf.String()
}

View File

@@ -0,0 +1,17 @@
package version
// Collection is a type that implements the sort.Interface interface
// so that versions can be sorted.
type Collection []*Version
func (v Collection) Len() int {
return len(v)
}
func (v Collection) Less(i, j int) bool {
return v[i].LessThan(v[j])
}
func (v Collection) Swap(i, j int) {
v[i], v[j] = v[j], v[i]
}

View File

@@ -285,6 +285,10 @@ func (a *APIOperations) doAction(
var input io.Reader
if debug {
fmt.Println("POST " + actionURL)
}
if inputObject != nil {
bodyContent, err := json.Marshal(inputObject)
if err != nil {
@@ -325,5 +329,8 @@ func (a *APIOperations) doAction(
fmt.Println("Response <= " + string(byteContent))
}
return json.Unmarshal(byteContent, respObject)
if nil != respObject {
return json.Unmarshal(byteContent, respObject)
}
return nil
}

View File

@@ -1,88 +0,0 @@
package convert
import (
"strings"
)
func APIUpdateMerge(dest, src map[string]interface{}, replace bool) map[string]interface{} {
result := map[string]interface{}{}
if replace {
if status, ok := dest["status"]; ok {
result["status"] = status
}
if metadata, ok := dest["metadata"]; ok {
result["metadata"] = metadata
}
} else {
result = copyMap(dest)
}
for k, v := range src {
if k == "metadata" {
result["metadata"] = mergeMetadata(ToMapInterface(dest["metadata"]), ToMapInterface(v))
} else if k == "status" {
continue
}
existing, ok := dest[k]
if ok && !replace {
result[k] = merge(existing, v)
} else {
result[k] = v
}
}
return result
}
func mergeMetadata(dest map[string]interface{}, src map[string]interface{}) map[string]interface{} {
result := copyMap(dest)
labels := mergeMaps(ToMapInterface(dest["labels"]), ToMapInterface(src["labels"]))
existingAnnotation := ToMapInterface(dest["annotations"])
newAnnotation := ToMapInterface(src["annotations"])
annotations := copyMap(existingAnnotation)
for k, v := range newAnnotation {
if strings.Contains(k, "cattle.io/") {
continue
}
annotations[k] = v
}
for k, v := range existingAnnotation {
if strings.Contains(k, "cattle.io/") {
annotations[k] = v
}
}
result["labels"] = labels
result["annotations"] = annotations
return result
}
func merge(dest, src interface{}) interface{} {
sm, smOk := src.(map[string]interface{})
dm, dmOk := dest.(map[string]interface{})
if smOk && dmOk {
return mergeMaps(dm, sm)
}
return src
}
func mergeMaps(dest map[string]interface{}, src map[string]interface{}) interface{} {
result := copyMap(dest)
for k, v := range src {
result[k] = merge(dest[k], v)
}
return result
}
func copyMap(src map[string]interface{}) map[string]interface{} {
result := map[string]interface{}{}
for k, v := range src {
result[k] = v
}
return result
}

19
vendor/github.com/rancher/norman/types/id.go generated vendored Normal file
View File

@@ -0,0 +1,19 @@
package types
import (
"fmt"
"regexp"
"strings"
utilrand "k8s.io/apimachinery/pkg/util/rand"
)
var (
lowerChars = regexp.MustCompile("[a-z]+")
)
func GenerateName(typeName string) string {
base := typeName[0:1] + lowerChars.ReplaceAllString(typeName[1:], "")
last := utilrand.String(5)
return fmt.Sprintf("%s-%s", strings.ToLower(base), last)
}

View File

@@ -74,6 +74,9 @@ type AccessControl interface {
CanGet(apiContext *APIContext, schema *Schema) error
CanUpdate(apiContext *APIContext, obj map[string]interface{}, schema *Schema) error
CanDelete(apiContext *APIContext, obj map[string]interface{}, schema *Schema) error
// CanDo function should not yet be used if a corresponding specific method exists. It has been added to
// satisfy a specific usecase for the short term until full-blown dynamic RBAC can be implemented.
CanDo(apiGroup, resource, verb string, apiContext *APIContext, obj map[string]interface{}, schema *Schema) error
Filter(apiContext *APIContext, schema *Schema, obj map[string]interface{}, context map[string]string) map[string]interface{}
FilterList(apiContext *APIContext, schema *Schema, obj []map[string]interface{}, context map[string]string) []map[string]interface{}
@@ -95,11 +98,9 @@ type APIContext struct {
ResponseWriter ResponseWriter
QueryFilter QueryFilter
SubContextAttributeProvider SubContextAttributeProvider
//QueryOptions *QueryOptions
URLBuilder URLBuilder
AccessControl AccessControl
SubContext map[string]string
//Attributes map[string]interface{}
URLBuilder URLBuilder
AccessControl AccessControl
SubContext map[string]string
Request *http.Request
Response http.ResponseWriter

View File

@@ -1,8 +1,10 @@
package client
const (
CanalNetworkProviderType = "canalNetworkProvider"
CanalNetworkProviderType = "canalNetworkProvider"
CanalNetworkProviderFieldIface = "iface"
)
type CanalNetworkProvider struct {
Iface string `json:"iface,omitempty" yaml:"iface,omitempty"`
}

View File

@@ -64,7 +64,9 @@ type CatalogOperations interface {
ByID(id string) (*Catalog, error)
Delete(container *Catalog) error
ActionRefresh(resource *CatalogCollection) error
ActionRefresh(resource *Catalog) error
CollectionActionRefresh(resource *CatalogCollection) error
}
func newCatalogClient(apiClient *Client) *CatalogClient {
@@ -112,8 +114,12 @@ func (c *CatalogClient) Delete(container *Catalog) error {
return c.apiClient.Ops.DoResourceDelete(CatalogType, &container.Resource)
}
func (c *CatalogClient) ActionRefresh(resource *CatalogCollection) error {
func (c *CatalogClient) ActionRefresh(resource *Catalog) error {
err := c.apiClient.Ops.DoAction(CatalogType, "refresh", &resource.Resource, nil, nil)
return err
}
func (c *CatalogClient) CollectionActionRefresh(resource *CatalogCollection) error {
err := c.apiClient.Ops.DoCollectionAction(CatalogType, "refresh", &resource.Collection, nil, nil)
return err
}

View File

@@ -25,6 +25,7 @@ type Client struct {
Catalog CatalogOperations
Template TemplateOperations
TemplateVersion TemplateVersionOperations
TemplateContent TemplateContentOperations
Group GroupOperations
GroupMember GroupMemberOperations
Principal PrincipalOperations
@@ -79,6 +80,7 @@ func NewClient(opts *clientbase.ClientOpts) (*Client, error) {
client.Catalog = newCatalogClient(client)
client.Template = newTemplateClient(client)
client.TemplateVersion = newTemplateVersionClient(client)
client.TemplateContent = newTemplateContentClient(client)
client.Group = newGroupClient(client)
client.GroupMember = newGroupMemberClient(client)
client.Principal = newPrincipalClient(client)

View File

@@ -98,7 +98,9 @@ type ClusterOperations interface {
ByID(id string) (*Cluster, error)
Delete(container *Cluster) error
ActionGenerateKubeconfig(*Cluster) (*GenerateKubeConfigOutput, error)
ActionGenerateKubeconfig(resource *Cluster) (*GenerateKubeConfigOutput, error)
ActionImportYaml(resource *Cluster, input *ImportClusterYamlInput) (*ImportYamlOutput, error)
}
func newClusterClient(apiClient *Client) *ClusterClient {
@@ -147,10 +149,13 @@ func (c *ClusterClient) Delete(container *Cluster) error {
}
func (c *ClusterClient) ActionGenerateKubeconfig(resource *Cluster) (*GenerateKubeConfigOutput, error) {
resp := &GenerateKubeConfigOutput{}
err := c.apiClient.Ops.DoAction(ClusterType, "generateKubeconfig", &resource.Resource, nil, resp)
return resp, err
}
func (c *ClusterClient) ActionImportYaml(resource *Cluster, input *ImportClusterYamlInput) (*ImportYamlOutput, error) {
resp := &ImportYamlOutput{}
err := c.apiClient.Ops.DoAction(ClusterType, "importYaml", &resource.Resource, input, resp)
return resp, err
}

View File

@@ -71,6 +71,14 @@ type ClusterAlertOperations interface {
Update(existing *ClusterAlert, updates interface{}) (*ClusterAlert, error)
ByID(id string) (*ClusterAlert, error)
Delete(container *ClusterAlert) error
ActionActivate(resource *ClusterAlert) error
ActionDeactivate(resource *ClusterAlert) error
ActionMute(resource *ClusterAlert) error
ActionUnmute(resource *ClusterAlert) error
}
func newClusterAlertClient(apiClient *Client) *ClusterAlertClient {
@@ -117,3 +125,23 @@ func (c *ClusterAlertClient) ByID(id string) (*ClusterAlert, error) {
func (c *ClusterAlertClient) Delete(container *ClusterAlert) error {
return c.apiClient.Ops.DoResourceDelete(ClusterAlertType, &container.Resource)
}
func (c *ClusterAlertClient) ActionActivate(resource *ClusterAlert) error {
err := c.apiClient.Ops.DoAction(ClusterAlertType, "activate", &resource.Resource, nil, nil)
return err
}
func (c *ClusterAlertClient) ActionDeactivate(resource *ClusterAlert) error {
err := c.apiClient.Ops.DoAction(ClusterAlertType, "deactivate", &resource.Resource, nil, nil)
return err
}
func (c *ClusterAlertClient) ActionMute(resource *ClusterAlert) error {
err := c.apiClient.Ops.DoAction(ClusterAlertType, "mute", &resource.Resource, nil, nil)
return err
}
func (c *ClusterAlertClient) ActionUnmute(resource *ClusterAlert) error {
err := c.apiClient.Ops.DoAction(ClusterAlertType, "unmute", &resource.Resource, nil, nil)
return err
}

View File

@@ -7,7 +7,9 @@ import (
const (
ClusterLoggingType = "clusterLogging"
ClusterLoggingFieldAnnotations = "annotations"
ClusterLoggingFieldAppliedSpec = "appliedSpec"
ClusterLoggingFieldClusterId = "clusterId"
ClusterLoggingFieldConditions = "conditions"
ClusterLoggingFieldCreated = "created"
ClusterLoggingFieldCreatorID = "creatorId"
ClusterLoggingFieldElasticsearchConfig = "elasticsearchConfig"
@@ -22,7 +24,6 @@ const (
ClusterLoggingFieldRemoved = "removed"
ClusterLoggingFieldSplunkConfig = "splunkConfig"
ClusterLoggingFieldState = "state"
ClusterLoggingFieldStatus = "status"
ClusterLoggingFieldSyslogConfig = "syslogConfig"
ClusterLoggingFieldTransitioning = "transitioning"
ClusterLoggingFieldTransitioningMessage = "transitioningMessage"
@@ -32,7 +33,9 @@ const (
type ClusterLogging struct {
types.Resource
Annotations map[string]string `json:"annotations,omitempty" yaml:"annotations,omitempty"`
AppliedSpec *ClusterLoggingSpec `json:"appliedSpec,omitempty" yaml:"appliedSpec,omitempty"`
ClusterId string `json:"clusterId,omitempty" yaml:"clusterId,omitempty"`
Conditions []LoggingCondition `json:"conditions,omitempty" yaml:"conditions,omitempty"`
Created string `json:"created,omitempty" yaml:"created,omitempty"`
CreatorID string `json:"creatorId,omitempty" yaml:"creatorId,omitempty"`
ElasticsearchConfig *ElasticsearchConfig `json:"elasticsearchConfig,omitempty" yaml:"elasticsearchConfig,omitempty"`
@@ -47,7 +50,6 @@ type ClusterLogging struct {
Removed string `json:"removed,omitempty" yaml:"removed,omitempty"`
SplunkConfig *SplunkConfig `json:"splunkConfig,omitempty" yaml:"splunkConfig,omitempty"`
State string `json:"state,omitempty" yaml:"state,omitempty"`
Status *LoggingStatus `json:"status,omitempty" yaml:"status,omitempty"`
SyslogConfig *SyslogConfig `json:"syslogConfig,omitempty" yaml:"syslogConfig,omitempty"`
Transitioning string `json:"transitioning,omitempty" yaml:"transitioning,omitempty"`
TransitioningMessage string `json:"transitioningMessage,omitempty" yaml:"transitioningMessage,omitempty"`

View File

@@ -0,0 +1,12 @@
package client
const (
ClusterLoggingStatusType = "clusterLoggingStatus"
ClusterLoggingStatusFieldAppliedSpec = "appliedSpec"
ClusterLoggingStatusFieldConditions = "conditions"
)
type ClusterLoggingStatus struct {
AppliedSpec *ClusterLoggingSpec `json:"appliedSpec,omitempty" yaml:"appliedSpec,omitempty"`
Conditions []LoggingCondition `json:"conditions,omitempty" yaml:"conditions,omitempty"`
}

View File

@@ -60,7 +60,15 @@ type ClusterPipelineOperations interface {
ByID(id string) (*ClusterPipeline, error)
Delete(container *ClusterPipeline) error
ActionAuthuser(*ClusterPipeline, *AuthUserInput) (*SourceCodeCredential, error)
ActionAuthapp(resource *ClusterPipeline, input *AuthAppInput) (*ClusterPipeline, error)
ActionAuthuser(resource *ClusterPipeline, input *AuthUserInput) (*SourceCodeCredential, error)
ActionDeploy(resource *ClusterPipeline) error
ActionDestroy(resource *ClusterPipeline) error
ActionRevokeapp(resource *ClusterPipeline) error
}
func newClusterPipelineClient(apiClient *Client) *ClusterPipelineClient {
@@ -108,11 +116,29 @@ func (c *ClusterPipelineClient) Delete(container *ClusterPipeline) error {
return c.apiClient.Ops.DoResourceDelete(ClusterPipelineType, &container.Resource)
}
func (c *ClusterPipelineClient) ActionAuthuser(resource *ClusterPipeline, input *AuthUserInput) (*SourceCodeCredential, error) {
resp := &SourceCodeCredential{}
err := c.apiClient.Ops.DoAction(ClusterPipelineType, "authuser", &resource.Resource, input, resp)
func (c *ClusterPipelineClient) ActionAuthapp(resource *ClusterPipeline, input *AuthAppInput) (*ClusterPipeline, error) {
resp := &ClusterPipeline{}
err := c.apiClient.Ops.DoAction(ClusterPipelineType, "authapp", &resource.Resource, input, resp)
return resp, err
}
func (c *ClusterPipelineClient) ActionAuthuser(resource *ClusterPipeline, input *AuthUserInput) (*SourceCodeCredential, error) {
resp := &SourceCodeCredential{}
err := c.apiClient.Ops.DoAction(ClusterPipelineType, "authuser", &resource.Resource, input, resp)
return resp, err
}
func (c *ClusterPipelineClient) ActionDeploy(resource *ClusterPipeline) error {
err := c.apiClient.Ops.DoAction(ClusterPipelineType, "deploy", &resource.Resource, nil, nil)
return err
}
func (c *ClusterPipelineClient) ActionDestroy(resource *ClusterPipeline) error {
err := c.apiClient.Ops.DoAction(ClusterPipelineType, "destroy", &resource.Resource, nil, nil)
return err
}
func (c *ClusterPipelineClient) ActionRevokeapp(resource *ClusterPipeline) error {
err := c.apiClient.Ops.DoAction(ClusterPipelineType, "revokeapp", &resource.Resource, nil, nil)
return err
}

View File

@@ -0,0 +1,42 @@
package client
const (
DockerInfoType = "dockerInfo"
DockerInfoFieldArchitecture = "architecture"
DockerInfoFieldCgroupDriver = "cgroupDriver"
DockerInfoFieldDebug = "debug"
DockerInfoFieldDockerRootDir = "dockerRootDir"
DockerInfoFieldDriver = "driver"
DockerInfoFieldExperimentalBuild = "experimentalBuild"
DockerInfoFieldHTTPProxy = "httpProxy"
DockerInfoFieldHTTPSProxy = "httpsProxy"
DockerInfoFieldIndexServerAddress = "indexServerAddress"
DockerInfoFieldKernelVersion = "kernelVersion"
DockerInfoFieldLabels = "labels"
DockerInfoFieldLoggingDriver = "loggingDriver"
DockerInfoFieldName = "name"
DockerInfoFieldNoProxy = "noProxy"
DockerInfoFieldOSType = "osType"
DockerInfoFieldOperatingSystem = "operatingSystem"
DockerInfoFieldServerVersion = "serverVersion"
)
type DockerInfo struct {
Architecture string `json:"architecture,omitempty" yaml:"architecture,omitempty"`
CgroupDriver string `json:"cgroupDriver,omitempty" yaml:"cgroupDriver,omitempty"`
Debug bool `json:"debug,omitempty" yaml:"debug,omitempty"`
DockerRootDir string `json:"dockerRootDir,omitempty" yaml:"dockerRootDir,omitempty"`
Driver string `json:"driver,omitempty" yaml:"driver,omitempty"`
ExperimentalBuild bool `json:"experimentalBuild,omitempty" yaml:"experimentalBuild,omitempty"`
HTTPProxy string `json:"httpProxy,omitempty" yaml:"httpProxy,omitempty"`
HTTPSProxy string `json:"httpsProxy,omitempty" yaml:"httpsProxy,omitempty"`
IndexServerAddress string `json:"indexServerAddress,omitempty" yaml:"indexServerAddress,omitempty"`
KernelVersion string `json:"kernelVersion,omitempty" yaml:"kernelVersion,omitempty"`
Labels []string `json:"labels,omitempty" yaml:"labels,omitempty"`
LoggingDriver string `json:"loggingDriver,omitempty" yaml:"loggingDriver,omitempty"`
Name string `json:"name,omitempty" yaml:"name,omitempty"`
NoProxy string `json:"noProxy,omitempty" yaml:"noProxy,omitempty"`
OSType string `json:"osType,omitempty" yaml:"osType,omitempty"`
OperatingSystem string `json:"operatingSystem,omitempty" yaml:"operatingSystem,omitempty"`
ServerVersion string `json:"serverVersion,omitempty" yaml:"serverVersion,omitempty"`
}

View File

@@ -1,12 +0,0 @@
package client
const (
FileType = "file"
FileFieldContents = "contents"
FileFieldName = "name"
)
type File struct {
Contents string `json:"contents,omitempty" yaml:"contents,omitempty"`
Name string `json:"name,omitempty" yaml:"name,omitempty"`
}

View File

@@ -1,50 +1,50 @@
package client
const (
GoogleKubernetesEngineConfigType = "googleKubernetesEngineConfig"
GoogleKubernetesEngineConfigFieldClusterIpv4Cidr = "clusterIpv4Cidr"
GoogleKubernetesEngineConfigFieldCredential = "credential"
GoogleKubernetesEngineConfigFieldDescription = "description"
GoogleKubernetesEngineConfigFieldDiskSizeGb = "diskSizeGb"
GoogleKubernetesEngineConfigFieldEnableAlphaFeature = "enableAlphaFeature"
GoogleKubernetesEngineConfigFieldHTTPLoadBalancing = "httpLoadBalancing"
GoogleKubernetesEngineConfigFieldHorizontalPodAutoscaling = "horizontalPodAutoscaling"
GoogleKubernetesEngineConfigFieldImageType = "imageType"
GoogleKubernetesEngineConfigFieldKubernetesDashboard = "kubernetesDashboard"
GoogleKubernetesEngineConfigFieldLabels = "labels"
GoogleKubernetesEngineConfigFieldLegacyAbac = "legacyAbac"
GoogleKubernetesEngineConfigFieldLocations = "locations"
GoogleKubernetesEngineConfigFieldMachineType = "machineType"
GoogleKubernetesEngineConfigFieldMasterVersion = "masterVersion"
GoogleKubernetesEngineConfigFieldNetwork = "network"
GoogleKubernetesEngineConfigFieldNetworkPolicyConfig = "networkPolicyConfig"
GoogleKubernetesEngineConfigFieldNodeCount = "nodeCount"
GoogleKubernetesEngineConfigFieldNodeVersion = "nodeVersion"
GoogleKubernetesEngineConfigFieldProjectID = "projectId"
GoogleKubernetesEngineConfigFieldSubNetwork = "subNetwork"
GoogleKubernetesEngineConfigFieldZone = "zone"
GoogleKubernetesEngineConfigType = "googleKubernetesEngineConfig"
GoogleKubernetesEngineConfigFieldClusterIpv4Cidr = "clusterIpv4Cidr"
GoogleKubernetesEngineConfigFieldCredential = "credential"
GoogleKubernetesEngineConfigFieldDescription = "description"
GoogleKubernetesEngineConfigFieldDisableHTTPLoadBalancing = "disableHttpLoadBalancing"
GoogleKubernetesEngineConfigFieldDisableHorizontalPodAutoscaling = "disableHorizontalPodAutoscaling"
GoogleKubernetesEngineConfigFieldDisableNetworkPolicyConfig = "disableNetworkPolicyConfig"
GoogleKubernetesEngineConfigFieldDiskSizeGb = "diskSizeGb"
GoogleKubernetesEngineConfigFieldEnableAlphaFeature = "enableAlphaFeature"
GoogleKubernetesEngineConfigFieldEnableKubernetesDashboard = "enableKubernetesDashboard"
GoogleKubernetesEngineConfigFieldEnableLegacyAbac = "enableLegacyAbac"
GoogleKubernetesEngineConfigFieldImageType = "imageType"
GoogleKubernetesEngineConfigFieldLabels = "labels"
GoogleKubernetesEngineConfigFieldLocations = "locations"
GoogleKubernetesEngineConfigFieldMachineType = "machineType"
GoogleKubernetesEngineConfigFieldMasterVersion = "masterVersion"
GoogleKubernetesEngineConfigFieldNetwork = "network"
GoogleKubernetesEngineConfigFieldNodeCount = "nodeCount"
GoogleKubernetesEngineConfigFieldNodeVersion = "nodeVersion"
GoogleKubernetesEngineConfigFieldProjectID = "projectId"
GoogleKubernetesEngineConfigFieldSubNetwork = "subNetwork"
GoogleKubernetesEngineConfigFieldZone = "zone"
)
type GoogleKubernetesEngineConfig struct {
ClusterIpv4Cidr string `json:"clusterIpv4Cidr,omitempty" yaml:"clusterIpv4Cidr,omitempty"`
Credential string `json:"credential,omitempty" yaml:"credential,omitempty"`
Description string `json:"description,omitempty" yaml:"description,omitempty"`
DiskSizeGb int64 `json:"diskSizeGb,omitempty" yaml:"diskSizeGb,omitempty"`
EnableAlphaFeature bool `json:"enableAlphaFeature,omitempty" yaml:"enableAlphaFeature,omitempty"`
HTTPLoadBalancing bool `json:"httpLoadBalancing,omitempty" yaml:"httpLoadBalancing,omitempty"`
HorizontalPodAutoscaling bool `json:"horizontalPodAutoscaling,omitempty" yaml:"horizontalPodAutoscaling,omitempty"`
ImageType string `json:"imageType,omitempty" yaml:"imageType,omitempty"`
KubernetesDashboard bool `json:"kubernetesDashboard,omitempty" yaml:"kubernetesDashboard,omitempty"`
Labels map[string]string `json:"labels,omitempty" yaml:"labels,omitempty"`
LegacyAbac bool `json:"legacyAbac,omitempty" yaml:"legacyAbac,omitempty"`
Locations []string `json:"locations,omitempty" yaml:"locations,omitempty"`
MachineType string `json:"machineType,omitempty" yaml:"machineType,omitempty"`
MasterVersion string `json:"masterVersion,omitempty" yaml:"masterVersion,omitempty"`
Network string `json:"network,omitempty" yaml:"network,omitempty"`
NetworkPolicyConfig bool `json:"networkPolicyConfig,omitempty" yaml:"networkPolicyConfig,omitempty"`
NodeCount int64 `json:"nodeCount,omitempty" yaml:"nodeCount,omitempty"`
NodeVersion string `json:"nodeVersion,omitempty" yaml:"nodeVersion,omitempty"`
ProjectID string `json:"projectId,omitempty" yaml:"projectId,omitempty"`
SubNetwork string `json:"subNetwork,omitempty" yaml:"subNetwork,omitempty"`
Zone string `json:"zone,omitempty" yaml:"zone,omitempty"`
ClusterIpv4Cidr string `json:"clusterIpv4Cidr,omitempty" yaml:"clusterIpv4Cidr,omitempty"`
Credential string `json:"credential,omitempty" yaml:"credential,omitempty"`
Description string `json:"description,omitempty" yaml:"description,omitempty"`
DisableHTTPLoadBalancing bool `json:"disableHttpLoadBalancing,omitempty" yaml:"disableHttpLoadBalancing,omitempty"`
DisableHorizontalPodAutoscaling bool `json:"disableHorizontalPodAutoscaling,omitempty" yaml:"disableHorizontalPodAutoscaling,omitempty"`
DisableNetworkPolicyConfig bool `json:"disableNetworkPolicyConfig,omitempty" yaml:"disableNetworkPolicyConfig,omitempty"`
DiskSizeGb int64 `json:"diskSizeGb,omitempty" yaml:"diskSizeGb,omitempty"`
EnableAlphaFeature bool `json:"enableAlphaFeature,omitempty" yaml:"enableAlphaFeature,omitempty"`
EnableKubernetesDashboard bool `json:"enableKubernetesDashboard,omitempty" yaml:"enableKubernetesDashboard,omitempty"`
EnableLegacyAbac bool `json:"enableLegacyAbac,omitempty" yaml:"enableLegacyAbac,omitempty"`
ImageType string `json:"imageType,omitempty" yaml:"imageType,omitempty"`
Labels map[string]string `json:"labels,omitempty" yaml:"labels,omitempty"`
Locations []string `json:"locations,omitempty" yaml:"locations,omitempty"`
MachineType string `json:"machineType,omitempty" yaml:"machineType,omitempty"`
MasterVersion string `json:"masterVersion,omitempty" yaml:"masterVersion,omitempty"`
Network string `json:"network,omitempty" yaml:"network,omitempty"`
NodeCount int64 `json:"nodeCount,omitempty" yaml:"nodeCount,omitempty"`
NodeVersion string `json:"nodeVersion,omitempty" yaml:"nodeVersion,omitempty"`
ProjectID string `json:"projectId,omitempty" yaml:"projectId,omitempty"`
SubNetwork string `json:"subNetwork,omitempty" yaml:"subNetwork,omitempty"`
Zone string `json:"zone,omitempty" yaml:"zone,omitempty"`
}

View File

@@ -0,0 +1,16 @@
package client
const (
ImportClusterYamlInputType = "importClusterYamlInput"
ImportClusterYamlInputFieldDefaultNamespace = "defaultNamespace"
ImportClusterYamlInputFieldNamespace = "namespace"
ImportClusterYamlInputFieldProjectId = "projectId"
ImportClusterYamlInputFieldYAML = "yaml"
)
type ImportClusterYamlInput struct {
DefaultNamespace string `json:"defaultNamespace,omitempty" yaml:"defaultNamespace,omitempty"`
Namespace string `json:"namespace,omitempty" yaml:"namespace,omitempty"`
ProjectId string `json:"projectId,omitempty" yaml:"projectId,omitempty"`
YAML string `json:"yaml,omitempty" yaml:"yaml,omitempty"`
}

View File

@@ -0,0 +1,10 @@
package client
const (
ImportYamlOutputType = "importYamlOutput"
ImportYamlOutputFieldMessage = "message"
)
type ImportYamlOutput struct {
Message string `json:"message,omitempty" yaml:"message,omitempty"`
}

View File

@@ -2,12 +2,14 @@ package client
const (
IngressConfigType = "ingressConfig"
IngressConfigFieldExtraArgs = "extraArgs"
IngressConfigFieldNodeSelector = "nodeSelector"
IngressConfigFieldOptions = "options"
IngressConfigFieldProvider = "provider"
)
type IngressConfig struct {
ExtraArgs map[string]string `json:"extraArgs,omitempty" yaml:"extraArgs,omitempty"`
NodeSelector map[string]string `json:"nodeSelector,omitempty" yaml:"nodeSelector,omitempty"`
Options map[string]string `json:"options,omitempty" yaml:"options,omitempty"`
Provider string `json:"provider,omitempty" yaml:"provider,omitempty"`

View File

@@ -1,10 +0,0 @@
package client
const (
LoggingStatusType = "loggingStatus"
LoggingStatusFieldConditions = "conditions"
)
type LoggingStatus struct {
Conditions []LoggingCondition `json:"conditions,omitempty" yaml:"conditions,omitempty"`
}

View File

@@ -16,6 +16,7 @@ const (
NodeFieldCreatorID = "creatorId"
NodeFieldCustomConfig = "customConfig"
NodeFieldDescription = "description"
NodeFieldDockerInfo = "dockerInfo"
NodeFieldEtcd = "etcd"
NodeFieldExternalIPAddress = "externalIpAddress"
NodeFieldHostname = "hostname"
@@ -61,6 +62,7 @@ type Node struct {
CreatorID string `json:"creatorId,omitempty" yaml:"creatorId,omitempty"`
CustomConfig *CustomConfig `json:"customConfig,omitempty" yaml:"customConfig,omitempty"`
Description string `json:"description,omitempty" yaml:"description,omitempty"`
DockerInfo *DockerInfo `json:"dockerInfo,omitempty" yaml:"dockerInfo,omitempty"`
Etcd bool `json:"etcd,omitempty" yaml:"etcd,omitempty"`
ExternalIPAddress string `json:"externalIpAddress,omitempty" yaml:"externalIpAddress,omitempty"`
Hostname string `json:"hostname,omitempty" yaml:"hostname,omitempty"`

View File

@@ -68,9 +68,9 @@ type NodeDriverOperations interface {
ByID(id string) (*NodeDriver, error)
Delete(container *NodeDriver) error
ActionActivate(*NodeDriver) (*NodeDriver, error)
ActionActivate(resource *NodeDriver) (*NodeDriver, error)
ActionDeactivate(*NodeDriver) (*NodeDriver, error)
ActionDeactivate(resource *NodeDriver) (*NodeDriver, error)
}
func newNodeDriverClient(apiClient *Client) *NodeDriverClient {
@@ -119,19 +119,13 @@ func (c *NodeDriverClient) Delete(container *NodeDriver) error {
}
func (c *NodeDriverClient) ActionActivate(resource *NodeDriver) (*NodeDriver, error) {
resp := &NodeDriver{}
err := c.apiClient.Ops.DoAction(NodeDriverType, "activate", &resource.Resource, nil, resp)
return resp, err
}
func (c *NodeDriverClient) ActionDeactivate(resource *NodeDriver) (*NodeDriver, error) {
resp := &NodeDriver{}
err := c.apiClient.Ops.DoAction(NodeDriverType, "deactivate", &resource.Resource, nil, resp)
return resp, err
}

View File

@@ -2,7 +2,6 @@ package client
const (
NodeSpecType = "nodeSpec"
NodeSpecFieldClusterId = "clusterId"
NodeSpecFieldControlPlane = "controlPlane"
NodeSpecFieldCustomConfig = "customConfig"
NodeSpecFieldDescription = "description"
@@ -22,7 +21,6 @@ const (
)
type NodeSpec struct {
ClusterId string `json:"clusterId,omitempty" yaml:"clusterId,omitempty"`
ControlPlane bool `json:"controlPlane,omitempty" yaml:"controlPlane,omitempty"`
CustomConfig *CustomConfig `json:"customConfig,omitempty" yaml:"customConfig,omitempty"`
Description string `json:"description,omitempty" yaml:"description,omitempty"`

View File

@@ -5,6 +5,7 @@ const (
NodeStatusFieldAllocatable = "allocatable"
NodeStatusFieldCapacity = "capacity"
NodeStatusFieldConditions = "conditions"
NodeStatusFieldDockerInfo = "dockerInfo"
NodeStatusFieldExternalIPAddress = "externalIpAddress"
NodeStatusFieldHostname = "hostname"
NodeStatusFieldIPAddress = "ipAddress"
@@ -24,6 +25,7 @@ type NodeStatus struct {
Allocatable map[string]string `json:"allocatable,omitempty" yaml:"allocatable,omitempty"`
Capacity map[string]string `json:"capacity,omitempty" yaml:"capacity,omitempty"`
Conditions []NodeCondition `json:"conditions,omitempty" yaml:"conditions,omitempty"`
DockerInfo *DockerInfo `json:"dockerInfo,omitempty" yaml:"dockerInfo,omitempty"`
ExternalIPAddress string `json:"externalIpAddress,omitempty" yaml:"externalIpAddress,omitempty"`
Hostname string `json:"hostname,omitempty" yaml:"hostname,omitempty"`
IPAddress string `json:"ipAddress,omitempty" yaml:"ipAddress,omitempty"`

View File

@@ -66,7 +66,9 @@ type NotifierOperations interface {
ByID(id string) (*Notifier, error)
Delete(container *Notifier) error
ActionSend(resource *NotifierCollection, input *Notification) error
ActionSend(resource *Notifier, input *Notification) error
CollectionActionSend(resource *NotifierCollection, input *Notification) error
}
func newNotifierClient(apiClient *Client) *NotifierClient {
@@ -114,8 +116,12 @@ func (c *NotifierClient) Delete(container *Notifier) error {
return c.apiClient.Ops.DoResourceDelete(NotifierType, &container.Resource)
}
func (c *NotifierClient) ActionSend(resource *NotifierCollection, input *Notification) error {
func (c *NotifierClient) ActionSend(resource *Notifier, input *Notification) error {
err := c.apiClient.Ops.DoAction(NotifierType, "send", &resource.Resource, input, nil)
return err
}
func (c *NotifierClient) CollectionActionSend(resource *NotifierCollection, input *Notification) error {
err := c.apiClient.Ops.DoCollectionAction(NotifierType, "send", &resource.Collection, input, nil)
return err
}

View File

@@ -32,6 +32,7 @@ const (
PipelineFieldTriggerCronTimezone = "triggerCronTimezone"
PipelineFieldTriggerWebhookPr = "triggerWebhookPr"
PipelineFieldTriggerWebhookPush = "triggerWebhookPush"
PipelineFieldTriggerWebhookTag = "triggerWebhookTag"
PipelineFieldUuid = "uuid"
PipelineFieldWebHookID = "webhookId"
)
@@ -64,6 +65,7 @@ type Pipeline struct {
TriggerCronTimezone string `json:"triggerCronTimezone,omitempty" yaml:"triggerCronTimezone,omitempty"`
TriggerWebhookPr bool `json:"triggerWebhookPr,omitempty" yaml:"triggerWebhookPr,omitempty"`
TriggerWebhookPush bool `json:"triggerWebhookPush,omitempty" yaml:"triggerWebhookPush,omitempty"`
TriggerWebhookTag bool `json:"triggerWebhookTag,omitempty" yaml:"triggerWebhookTag,omitempty"`
Uuid string `json:"uuid,omitempty" yaml:"uuid,omitempty"`
WebHookID string `json:"webhookId,omitempty" yaml:"webhookId,omitempty"`
}
@@ -83,6 +85,12 @@ type PipelineOperations interface {
Update(existing *Pipeline, updates interface{}) (*Pipeline, error)
ByID(id string) (*Pipeline, error)
Delete(container *Pipeline) error
ActionActivate(resource *Pipeline) error
ActionDeactivate(resource *Pipeline) error
ActionRun(resource *Pipeline, input *RunPipelineInput) error
}
func newPipelineClient(apiClient *Client) *PipelineClient {
@@ -129,3 +137,18 @@ func (c *PipelineClient) ByID(id string) (*Pipeline, error) {
func (c *PipelineClient) Delete(container *Pipeline) error {
return c.apiClient.Ops.DoResourceDelete(PipelineType, &container.Resource)
}
func (c *PipelineClient) ActionActivate(resource *Pipeline) error {
err := c.apiClient.Ops.DoAction(PipelineType, "activate", &resource.Resource, nil, nil)
return err
}
func (c *PipelineClient) ActionDeactivate(resource *Pipeline) error {
err := c.apiClient.Ops.DoAction(PipelineType, "deactivate", &resource.Resource, nil, nil)
return err
}
func (c *PipelineClient) ActionRun(resource *Pipeline, input *RunPipelineInput) error {
err := c.apiClient.Ops.DoAction(PipelineType, "run", &resource.Resource, input, nil)
return err
}

View File

@@ -12,6 +12,7 @@ const (
PipelineExecutionFieldCreated = "created"
PipelineExecutionFieldCreatorID = "creatorId"
PipelineExecutionFieldEnded = "ended"
PipelineExecutionFieldEnvVars = "envVars"
PipelineExecutionFieldExecutionState = "executionState"
PipelineExecutionFieldLabels = "labels"
PipelineExecutionFieldName = "name"
@@ -40,6 +41,7 @@ type PipelineExecution struct {
Created string `json:"created,omitempty" yaml:"created,omitempty"`
CreatorID string `json:"creatorId,omitempty" yaml:"creatorId,omitempty"`
Ended string `json:"ended,omitempty" yaml:"ended,omitempty"`
EnvVars map[string]string `json:"envVars,omitempty" yaml:"envVars,omitempty"`
ExecutionState string `json:"executionState,omitempty" yaml:"executionState,omitempty"`
Labels map[string]string `json:"labels,omitempty" yaml:"labels,omitempty"`
Name string `json:"name,omitempty" yaml:"name,omitempty"`
@@ -75,6 +77,10 @@ type PipelineExecutionOperations interface {
Update(existing *PipelineExecution, updates interface{}) (*PipelineExecution, error)
ByID(id string) (*PipelineExecution, error)
Delete(container *PipelineExecution) error
ActionRerun(resource *PipelineExecution) error
ActionStop(resource *PipelineExecution) error
}
func newPipelineExecutionClient(apiClient *Client) *PipelineExecutionClient {
@@ -121,3 +127,13 @@ func (c *PipelineExecutionClient) ByID(id string) (*PipelineExecution, error) {
func (c *PipelineExecutionClient) Delete(container *PipelineExecution) error {
return c.apiClient.Ops.DoResourceDelete(PipelineExecutionType, &container.Resource)
}
func (c *PipelineExecutionClient) ActionRerun(resource *PipelineExecution) error {
err := c.apiClient.Ops.DoAction(PipelineExecutionType, "rerun", &resource.Resource, nil, nil)
return err
}
func (c *PipelineExecutionClient) ActionStop(resource *PipelineExecution) error {
err := c.apiClient.Ops.DoAction(PipelineExecutionType, "stop", &resource.Resource, nil, nil)
return err
}

View File

@@ -5,6 +5,7 @@ const (
PipelineExecutionStatusFieldCommit = "commit"
PipelineExecutionStatusFieldConditions = "conditions"
PipelineExecutionStatusFieldEnded = "ended"
PipelineExecutionStatusFieldEnvVars = "envVars"
PipelineExecutionStatusFieldExecutionState = "executionState"
PipelineExecutionStatusFieldStages = "stages"
PipelineExecutionStatusFieldStarted = "started"
@@ -14,6 +15,7 @@ type PipelineExecutionStatus struct {
Commit string `json:"commit,omitempty" yaml:"commit,omitempty"`
Conditions []PipelineCondition `json:"conditions,omitempty" yaml:"conditions,omitempty"`
Ended string `json:"ended,omitempty" yaml:"ended,omitempty"`
EnvVars map[string]string `json:"envVars,omitempty" yaml:"envVars,omitempty"`
ExecutionState string `json:"executionState,omitempty" yaml:"executionState,omitempty"`
Stages []StageStatus `json:"stages,omitempty" yaml:"stages,omitempty"`
Started string `json:"started,omitempty" yaml:"started,omitempty"`

View File

@@ -9,6 +9,7 @@ const (
PipelineSpecFieldTriggerCronTimezone = "triggerCronTimezone"
PipelineSpecFieldTriggerWebhookPr = "triggerWebhookPr"
PipelineSpecFieldTriggerWebhookPush = "triggerWebhookPush"
PipelineSpecFieldTriggerWebhookTag = "triggerWebhookTag"
)
type PipelineSpec struct {
@@ -19,4 +20,5 @@ type PipelineSpec struct {
TriggerCronTimezone string `json:"triggerCronTimezone,omitempty" yaml:"triggerCronTimezone,omitempty"`
TriggerWebhookPr bool `json:"triggerWebhookPr,omitempty" yaml:"triggerWebhookPr,omitempty"`
TriggerWebhookPush bool `json:"triggerWebhookPush,omitempty" yaml:"triggerWebhookPush,omitempty"`
TriggerWebhookTag bool `json:"triggerWebhookTag,omitempty" yaml:"triggerWebhookTag,omitempty"`
}

View File

@@ -60,7 +60,7 @@ type PrincipalOperations interface {
ByID(id string) (*Principal, error)
Delete(container *Principal) error
ActionSearch(resource *PrincipalCollection, input *SearchPrincipalsInput) (*PrincipalCollection, error)
CollectionActionSearch(resource *PrincipalCollection, input *SearchPrincipalsInput) (*PrincipalCollection, error)
}
func newPrincipalClient(apiClient *Client) *PrincipalClient {
@@ -108,9 +108,8 @@ func (c *PrincipalClient) Delete(container *Principal) error {
return c.apiClient.Ops.DoResourceDelete(PrincipalType, &container.Resource)
}
func (c *PrincipalClient) ActionSearch(resource *PrincipalCollection, input *SearchPrincipalsInput) (*PrincipalCollection, error) {
func (c *PrincipalClient) CollectionActionSearch(resource *PrincipalCollection, input *SearchPrincipalsInput) (*PrincipalCollection, error) {
resp := &PrincipalCollection{}
err := c.apiClient.Ops.DoCollectionAction(PrincipalType, "search", &resource.Collection, input, resp)
return resp, err
}

View File

@@ -60,7 +60,7 @@ type ProjectOperations interface {
ByID(id string) (*Project, error)
Delete(container *Project) error
ActionSetpodsecuritypolicytemplate(*Project, *SetPodSecurityPolicyTemplateInput) (*Project, error)
ActionSetpodsecuritypolicytemplate(resource *Project, input *SetPodSecurityPolicyTemplateInput) (*Project, error)
}
func newProjectClient(apiClient *Client) *ProjectClient {
@@ -109,10 +109,7 @@ func (c *ProjectClient) Delete(container *Project) error {
}
func (c *ProjectClient) ActionSetpodsecuritypolicytemplate(resource *Project, input *SetPodSecurityPolicyTemplateInput) (*Project, error) {
resp := &Project{}
err := c.apiClient.Ops.DoAction(ProjectType, "setpodsecuritypolicytemplate", &resource.Resource, input, resp)
return resp, err
}

View File

@@ -69,6 +69,14 @@ type ProjectAlertOperations interface {
Update(existing *ProjectAlert, updates interface{}) (*ProjectAlert, error)
ByID(id string) (*ProjectAlert, error)
Delete(container *ProjectAlert) error
ActionActivate(resource *ProjectAlert) error
ActionDeactivate(resource *ProjectAlert) error
ActionMute(resource *ProjectAlert) error
ActionUnmute(resource *ProjectAlert) error
}
func newProjectAlertClient(apiClient *Client) *ProjectAlertClient {
@@ -115,3 +123,23 @@ func (c *ProjectAlertClient) ByID(id string) (*ProjectAlert, error) {
func (c *ProjectAlertClient) Delete(container *ProjectAlert) error {
return c.apiClient.Ops.DoResourceDelete(ProjectAlertType, &container.Resource)
}
func (c *ProjectAlertClient) ActionActivate(resource *ProjectAlert) error {
err := c.apiClient.Ops.DoAction(ProjectAlertType, "activate", &resource.Resource, nil, nil)
return err
}
func (c *ProjectAlertClient) ActionDeactivate(resource *ProjectAlert) error {
err := c.apiClient.Ops.DoAction(ProjectAlertType, "deactivate", &resource.Resource, nil, nil)
return err
}
func (c *ProjectAlertClient) ActionMute(resource *ProjectAlert) error {
err := c.apiClient.Ops.DoAction(ProjectAlertType, "mute", &resource.Resource, nil, nil)
return err
}
func (c *ProjectAlertClient) ActionUnmute(resource *ProjectAlert) error {
err := c.apiClient.Ops.DoAction(ProjectAlertType, "unmute", &resource.Resource, nil, nil)
return err
}

View File

@@ -30,26 +30,26 @@ const (
type ProjectLogging struct {
types.Resource
Annotations map[string]string `json:"annotations,omitempty" yaml:"annotations,omitempty"`
Created string `json:"created,omitempty" yaml:"created,omitempty"`
CreatorID string `json:"creatorId,omitempty" yaml:"creatorId,omitempty"`
ElasticsearchConfig *ElasticsearchConfig `json:"elasticsearchConfig,omitempty" yaml:"elasticsearchConfig,omitempty"`
KafkaConfig *KafkaConfig `json:"kafkaConfig,omitempty" yaml:"kafkaConfig,omitempty"`
Labels map[string]string `json:"labels,omitempty" yaml:"labels,omitempty"`
Name string `json:"name,omitempty" yaml:"name,omitempty"`
NamespaceId string `json:"namespaceId,omitempty" yaml:"namespaceId,omitempty"`
OutputFlushInterval int64 `json:"outputFlushInterval,omitempty" yaml:"outputFlushInterval,omitempty"`
OutputTags map[string]string `json:"outputTags,omitempty" yaml:"outputTags,omitempty"`
OwnerReferences []OwnerReference `json:"ownerReferences,omitempty" yaml:"ownerReferences,omitempty"`
ProjectId string `json:"projectId,omitempty" yaml:"projectId,omitempty"`
Removed string `json:"removed,omitempty" yaml:"removed,omitempty"`
SplunkConfig *SplunkConfig `json:"splunkConfig,omitempty" yaml:"splunkConfig,omitempty"`
State string `json:"state,omitempty" yaml:"state,omitempty"`
Status *LoggingStatus `json:"status,omitempty" yaml:"status,omitempty"`
SyslogConfig *SyslogConfig `json:"syslogConfig,omitempty" yaml:"syslogConfig,omitempty"`
Transitioning string `json:"transitioning,omitempty" yaml:"transitioning,omitempty"`
TransitioningMessage string `json:"transitioningMessage,omitempty" yaml:"transitioningMessage,omitempty"`
Uuid string `json:"uuid,omitempty" yaml:"uuid,omitempty"`
Annotations map[string]string `json:"annotations,omitempty" yaml:"annotations,omitempty"`
Created string `json:"created,omitempty" yaml:"created,omitempty"`
CreatorID string `json:"creatorId,omitempty" yaml:"creatorId,omitempty"`
ElasticsearchConfig *ElasticsearchConfig `json:"elasticsearchConfig,omitempty" yaml:"elasticsearchConfig,omitempty"`
KafkaConfig *KafkaConfig `json:"kafkaConfig,omitempty" yaml:"kafkaConfig,omitempty"`
Labels map[string]string `json:"labels,omitempty" yaml:"labels,omitempty"`
Name string `json:"name,omitempty" yaml:"name,omitempty"`
NamespaceId string `json:"namespaceId,omitempty" yaml:"namespaceId,omitempty"`
OutputFlushInterval int64 `json:"outputFlushInterval,omitempty" yaml:"outputFlushInterval,omitempty"`
OutputTags map[string]string `json:"outputTags,omitempty" yaml:"outputTags,omitempty"`
OwnerReferences []OwnerReference `json:"ownerReferences,omitempty" yaml:"ownerReferences,omitempty"`
ProjectId string `json:"projectId,omitempty" yaml:"projectId,omitempty"`
Removed string `json:"removed,omitempty" yaml:"removed,omitempty"`
SplunkConfig *SplunkConfig `json:"splunkConfig,omitempty" yaml:"splunkConfig,omitempty"`
State string `json:"state,omitempty" yaml:"state,omitempty"`
Status *ProjectLoggingStatus `json:"status,omitempty" yaml:"status,omitempty"`
SyslogConfig *SyslogConfig `json:"syslogConfig,omitempty" yaml:"syslogConfig,omitempty"`
Transitioning string `json:"transitioning,omitempty" yaml:"transitioning,omitempty"`
TransitioningMessage string `json:"transitioningMessage,omitempty" yaml:"transitioningMessage,omitempty"`
Uuid string `json:"uuid,omitempty" yaml:"uuid,omitempty"`
}
type ProjectLoggingCollection struct {
types.Collection

View File

@@ -0,0 +1,12 @@
package client
const (
ProjectLoggingStatusType = "projectLoggingStatus"
ProjectLoggingStatusFieldAppliedSpec = "appliedSpec"
ProjectLoggingStatusFieldConditions = "conditions"
)
type ProjectLoggingStatus struct {
AppliedSpec *ProjectLoggingSpec `json:"appliedSpec,omitempty" yaml:"appliedSpec,omitempty"`
Conditions []LoggingCondition `json:"conditions,omitempty" yaml:"conditions,omitempty"`
}

View File

@@ -1,36 +1,42 @@
package client
const (
QuestionType = "question"
QuestionFieldDefault = "default"
QuestionFieldDescription = "description"
QuestionFieldGroup = "group"
QuestionFieldInvalidChars = "invalidChars"
QuestionFieldLabel = "label"
QuestionFieldMax = "max"
QuestionFieldMaxLength = "maxLength"
QuestionFieldMin = "min"
QuestionFieldMinLength = "minLength"
QuestionFieldOptions = "options"
QuestionFieldRequired = "required"
QuestionFieldType = "type"
QuestionFieldValidChars = "validChars"
QuestionFieldVariable = "variable"
QuestionType = "question"
QuestionFieldDefault = "default"
QuestionFieldDescription = "description"
QuestionFieldGroup = "group"
QuestionFieldInvalidChars = "invalidChars"
QuestionFieldLabel = "label"
QuestionFieldMax = "max"
QuestionFieldMaxLength = "maxLength"
QuestionFieldMin = "min"
QuestionFieldMinLength = "minLength"
QuestionFieldOptions = "options"
QuestionFieldRequired = "required"
QuestionFieldShowIf = "showIf"
QuestionFieldShowSubquestionIf = "showSubquestionIf"
QuestionFieldSubquestions = "subquestions"
QuestionFieldType = "type"
QuestionFieldValidChars = "validChars"
QuestionFieldVariable = "variable"
)
type Question struct {
Default string `json:"default,omitempty" yaml:"default,omitempty"`
Description string `json:"description,omitempty" yaml:"description,omitempty"`
Group string `json:"group,omitempty" yaml:"group,omitempty"`
InvalidChars string `json:"invalidChars,omitempty" yaml:"invalidChars,omitempty"`
Label string `json:"label,omitempty" yaml:"label,omitempty"`
Max int64 `json:"max,omitempty" yaml:"max,omitempty"`
MaxLength int64 `json:"maxLength,omitempty" yaml:"maxLength,omitempty"`
Min int64 `json:"min,omitempty" yaml:"min,omitempty"`
MinLength int64 `json:"minLength,omitempty" yaml:"minLength,omitempty"`
Options []string `json:"options,omitempty" yaml:"options,omitempty"`
Required bool `json:"required,omitempty" yaml:"required,omitempty"`
Type string `json:"type,omitempty" yaml:"type,omitempty"`
ValidChars string `json:"validChars,omitempty" yaml:"validChars,omitempty"`
Variable string `json:"variable,omitempty" yaml:"variable,omitempty"`
Default string `json:"default,omitempty" yaml:"default,omitempty"`
Description string `json:"description,omitempty" yaml:"description,omitempty"`
Group string `json:"group,omitempty" yaml:"group,omitempty"`
InvalidChars string `json:"invalidChars,omitempty" yaml:"invalidChars,omitempty"`
Label string `json:"label,omitempty" yaml:"label,omitempty"`
Max int64 `json:"max,omitempty" yaml:"max,omitempty"`
MaxLength int64 `json:"maxLength,omitempty" yaml:"maxLength,omitempty"`
Min int64 `json:"min,omitempty" yaml:"min,omitempty"`
MinLength int64 `json:"minLength,omitempty" yaml:"minLength,omitempty"`
Options []string `json:"options,omitempty" yaml:"options,omitempty"`
Required bool `json:"required,omitempty" yaml:"required,omitempty"`
ShowIf string `json:"showIf,omitempty" yaml:"showIf,omitempty"`
ShowSubquestionIf string `json:"showSubquestionIf,omitempty" yaml:"showSubquestionIf,omitempty"`
Subquestions []SubQuestion `json:"subquestions,omitempty" yaml:"subquestions,omitempty"`
Type string `json:"type,omitempty" yaml:"type,omitempty"`
ValidChars string `json:"validChars,omitempty" yaml:"validChars,omitempty"`
Variable string `json:"variable,omitempty" yaml:"variable,omitempty"`
}

View File

@@ -12,13 +12,9 @@ const (
RKESystemImagesFieldCanalNode = "canalNode"
RKESystemImagesFieldCertDownloader = "certDownloader"
RKESystemImagesFieldDNSmasq = "dnsmasq"
RKESystemImagesFieldDashboard = "dashboard"
RKESystemImagesFieldEtcd = "etcd"
RKESystemImagesFieldFlannel = "flannel"
RKESystemImagesFieldFlannelCNI = "flannelCni"
RKESystemImagesFieldGrafana = "grafana"
RKESystemImagesFieldHeapster = "heapster"
RKESystemImagesFieldInfluxdb = "influxdb"
RKESystemImagesFieldIngress = "ingress"
RKESystemImagesFieldIngressBackend = "ingressBackend"
RKESystemImagesFieldKubeDNS = "kubedns"
@@ -28,7 +24,6 @@ const (
RKESystemImagesFieldKubernetesServicesSidecar = "kubernetesServicesSidecar"
RKESystemImagesFieldNginxProxy = "nginxProxy"
RKESystemImagesFieldPodInfraContainer = "podInfraContainer"
RKESystemImagesFieldTiller = "tiller"
RKESystemImagesFieldWeaveCNI = "weaveCni"
RKESystemImagesFieldWeaveNode = "weaveNode"
)
@@ -44,13 +39,9 @@ type RKESystemImages struct {
CanalNode string `json:"canalNode,omitempty" yaml:"canalNode,omitempty"`
CertDownloader string `json:"certDownloader,omitempty" yaml:"certDownloader,omitempty"`
DNSmasq string `json:"dnsmasq,omitempty" yaml:"dnsmasq,omitempty"`
Dashboard string `json:"dashboard,omitempty" yaml:"dashboard,omitempty"`
Etcd string `json:"etcd,omitempty" yaml:"etcd,omitempty"`
Flannel string `json:"flannel,omitempty" yaml:"flannel,omitempty"`
FlannelCNI string `json:"flannelCni,omitempty" yaml:"flannelCni,omitempty"`
Grafana string `json:"grafana,omitempty" yaml:"grafana,omitempty"`
Heapster string `json:"heapster,omitempty" yaml:"heapster,omitempty"`
Influxdb string `json:"influxdb,omitempty" yaml:"influxdb,omitempty"`
Ingress string `json:"ingress,omitempty" yaml:"ingress,omitempty"`
IngressBackend string `json:"ingressBackend,omitempty" yaml:"ingressBackend,omitempty"`
KubeDNS string `json:"kubedns,omitempty" yaml:"kubedns,omitempty"`
@@ -60,7 +51,6 @@ type RKESystemImages struct {
KubernetesServicesSidecar string `json:"kubernetesServicesSidecar,omitempty" yaml:"kubernetesServicesSidecar,omitempty"`
NginxProxy string `json:"nginxProxy,omitempty" yaml:"nginxProxy,omitempty"`
PodInfraContainer string `json:"podInfraContainer,omitempty" yaml:"podInfraContainer,omitempty"`
Tiller string `json:"tiller,omitempty" yaml:"tiller,omitempty"`
WeaveCNI string `json:"weaveCni,omitempty" yaml:"weaveCni,omitempty"`
WeaveNode string `json:"weaveNode,omitempty" yaml:"weaveNode,omitempty"`
}

View File

@@ -6,6 +6,7 @@ const (
SMTPConfigFieldHost = "host"
SMTPConfigFieldPassword = "password"
SMTPConfigFieldPort = "port"
SMTPConfigFieldSender = "sender"
SMTPConfigFieldTLS = "tls"
SMTPConfigFieldUsername = "username"
)
@@ -15,6 +16,7 @@ type SMTPConfig struct {
Host string `json:"host,omitempty" yaml:"host,omitempty"`
Password string `json:"password,omitempty" yaml:"password,omitempty"`
Port int64 `json:"port,omitempty" yaml:"port,omitempty"`
Sender string `json:"sender,omitempty" yaml:"sender,omitempty"`
TLS bool `json:"tls,omitempty" yaml:"tls,omitempty"`
Username string `json:"username,omitempty" yaml:"username,omitempty"`
}

View File

@@ -67,6 +67,8 @@ type SourceCodeCredentialOperations interface {
Update(existing *SourceCodeCredential, updates interface{}) (*SourceCodeCredential, error)
ByID(id string) (*SourceCodeCredential, error)
Delete(container *SourceCodeCredential) error
ActionRefreshrepos(resource *SourceCodeCredential) error
}
func newSourceCodeCredentialClient(apiClient *Client) *SourceCodeCredentialClient {
@@ -113,3 +115,8 @@ func (c *SourceCodeCredentialClient) ByID(id string) (*SourceCodeCredential, err
func (c *SourceCodeCredentialClient) Delete(container *SourceCodeCredential) error {
return c.apiClient.Ops.DoResourceDelete(SourceCodeCredentialType, &container.Resource)
}
func (c *SourceCodeCredentialClient) ActionRefreshrepos(resource *SourceCodeCredential) error {
err := c.apiClient.Ops.DoAction(SourceCodeCredentialType, "refreshrepos", &resource.Resource, nil, nil)
return err
}

View File

@@ -0,0 +1,38 @@
package client
const (
SubQuestionType = "subQuestion"
SubQuestionFieldDefault = "default"
SubQuestionFieldDescription = "description"
SubQuestionFieldGroup = "group"
SubQuestionFieldInvalidChars = "invalidChars"
SubQuestionFieldLabel = "label"
SubQuestionFieldMax = "max"
SubQuestionFieldMaxLength = "maxLength"
SubQuestionFieldMin = "min"
SubQuestionFieldMinLength = "minLength"
SubQuestionFieldOptions = "options"
SubQuestionFieldRequired = "required"
SubQuestionFieldShowIf = "showIf"
SubQuestionFieldType = "type"
SubQuestionFieldValidChars = "validChars"
SubQuestionFieldVariable = "variable"
)
type SubQuestion struct {
Default string `json:"default,omitempty" yaml:"default,omitempty"`
Description string `json:"description,omitempty" yaml:"description,omitempty"`
Group string `json:"group,omitempty" yaml:"group,omitempty"`
InvalidChars string `json:"invalidChars,omitempty" yaml:"invalidChars,omitempty"`
Label string `json:"label,omitempty" yaml:"label,omitempty"`
Max int64 `json:"max,omitempty" yaml:"max,omitempty"`
MaxLength int64 `json:"maxLength,omitempty" yaml:"maxLength,omitempty"`
Min int64 `json:"min,omitempty" yaml:"min,omitempty"`
MinLength int64 `json:"minLength,omitempty" yaml:"minLength,omitempty"`
Options []string `json:"options,omitempty" yaml:"options,omitempty"`
Required bool `json:"required,omitempty" yaml:"required,omitempty"`
ShowIf string `json:"showIf,omitempty" yaml:"showIf,omitempty"`
Type string `json:"type,omitempty" yaml:"type,omitempty"`
ValidChars string `json:"validChars,omitempty" yaml:"validChars,omitempty"`
Variable string `json:"variable,omitempty" yaml:"variable,omitempty"`
}

View File

@@ -7,7 +7,6 @@ import (
const (
TemplateType = "template"
TemplateFieldAnnotations = "annotations"
TemplateFieldBase = "templateBase"
TemplateFieldCatalogID = "catalogId"
TemplateFieldCategories = "categories"
TemplateFieldCategory = "category"
@@ -16,13 +15,10 @@ const (
TemplateFieldDefaultTemplateVersionID = "defaultTemplateVersionId"
TemplateFieldDefaultVersion = "defaultVersion"
TemplateFieldDescription = "description"
TemplateFieldDisplayName = "displayName"
TemplateFieldFolderName = "folderName"
TemplateFieldIcon = "icon"
TemplateFieldIconFilename = "iconFilename"
TemplateFieldIsSystem = "isSystem"
TemplateFieldLabels = "labels"
TemplateFieldLicense = "license"
TemplateFieldMaintainer = "maintainer"
TemplateFieldName = "name"
TemplateFieldOwnerReferences = "ownerReferences"
@@ -36,13 +32,13 @@ const (
TemplateFieldTransitioningMessage = "transitioningMessage"
TemplateFieldUpgradeFrom = "upgradeFrom"
TemplateFieldUuid = "uuid"
TemplateFieldVersionLinks = "versionLinks"
TemplateFieldVersions = "versions"
)
type Template struct {
types.Resource
Annotations map[string]string `json:"annotations,omitempty" yaml:"annotations,omitempty"`
Base string `json:"templateBase,omitempty" yaml:"templateBase,omitempty"`
CatalogID string `json:"catalogId,omitempty" yaml:"catalogId,omitempty"`
Categories []string `json:"categories,omitempty" yaml:"categories,omitempty"`
Category string `json:"category,omitempty" yaml:"category,omitempty"`
@@ -51,13 +47,10 @@ type Template struct {
DefaultTemplateVersionID string `json:"defaultTemplateVersionId,omitempty" yaml:"defaultTemplateVersionId,omitempty"`
DefaultVersion string `json:"defaultVersion,omitempty" yaml:"defaultVersion,omitempty"`
Description string `json:"description,omitempty" yaml:"description,omitempty"`
DisplayName string `json:"displayName,omitempty" yaml:"displayName,omitempty"`
FolderName string `json:"folderName,omitempty" yaml:"folderName,omitempty"`
Icon string `json:"icon,omitempty" yaml:"icon,omitempty"`
IconFilename string `json:"iconFilename,omitempty" yaml:"iconFilename,omitempty"`
IsSystem string `json:"isSystem,omitempty" yaml:"isSystem,omitempty"`
Labels map[string]string `json:"labels,omitempty" yaml:"labels,omitempty"`
License string `json:"license,omitempty" yaml:"license,omitempty"`
Maintainer string `json:"maintainer,omitempty" yaml:"maintainer,omitempty"`
Name string `json:"name,omitempty" yaml:"name,omitempty"`
OwnerReferences []OwnerReference `json:"ownerReferences,omitempty" yaml:"ownerReferences,omitempty"`
@@ -71,6 +64,7 @@ type Template struct {
TransitioningMessage string `json:"transitioningMessage,omitempty" yaml:"transitioningMessage,omitempty"`
UpgradeFrom string `json:"upgradeFrom,omitempty" yaml:"upgradeFrom,omitempty"`
Uuid string `json:"uuid,omitempty" yaml:"uuid,omitempty"`
VersionLinks map[string]string `json:"versionLinks,omitempty" yaml:"versionLinks,omitempty"`
Versions []TemplateVersionSpec `json:"versions,omitempty" yaml:"versions,omitempty"`
}
type TemplateCollection struct {

View File

@@ -0,0 +1,93 @@
package client
import (
"github.com/rancher/norman/types"
)
const (
TemplateContentType = "templateContent"
TemplateContentFieldAnnotations = "annotations"
TemplateContentFieldCreated = "created"
TemplateContentFieldCreatorID = "creatorId"
TemplateContentFieldData = "data"
TemplateContentFieldLabels = "labels"
TemplateContentFieldName = "name"
TemplateContentFieldOwnerReferences = "ownerReferences"
TemplateContentFieldRemoved = "removed"
TemplateContentFieldUuid = "uuid"
)
type TemplateContent struct {
types.Resource
Annotations map[string]string `json:"annotations,omitempty" yaml:"annotations,omitempty"`
Created string `json:"created,omitempty" yaml:"created,omitempty"`
CreatorID string `json:"creatorId,omitempty" yaml:"creatorId,omitempty"`
Data string `json:"data,omitempty" yaml:"data,omitempty"`
Labels map[string]string `json:"labels,omitempty" yaml:"labels,omitempty"`
Name string `json:"name,omitempty" yaml:"name,omitempty"`
OwnerReferences []OwnerReference `json:"ownerReferences,omitempty" yaml:"ownerReferences,omitempty"`
Removed string `json:"removed,omitempty" yaml:"removed,omitempty"`
Uuid string `json:"uuid,omitempty" yaml:"uuid,omitempty"`
}
type TemplateContentCollection struct {
types.Collection
Data []TemplateContent `json:"data,omitempty"`
client *TemplateContentClient
}
type TemplateContentClient struct {
apiClient *Client
}
type TemplateContentOperations interface {
List(opts *types.ListOpts) (*TemplateContentCollection, error)
Create(opts *TemplateContent) (*TemplateContent, error)
Update(existing *TemplateContent, updates interface{}) (*TemplateContent, error)
ByID(id string) (*TemplateContent, error)
Delete(container *TemplateContent) error
}
func newTemplateContentClient(apiClient *Client) *TemplateContentClient {
return &TemplateContentClient{
apiClient: apiClient,
}
}
func (c *TemplateContentClient) Create(container *TemplateContent) (*TemplateContent, error) {
resp := &TemplateContent{}
err := c.apiClient.Ops.DoCreate(TemplateContentType, container, resp)
return resp, err
}
func (c *TemplateContentClient) Update(existing *TemplateContent, updates interface{}) (*TemplateContent, error) {
resp := &TemplateContent{}
err := c.apiClient.Ops.DoUpdate(TemplateContentType, &existing.Resource, updates, resp)
return resp, err
}
func (c *TemplateContentClient) List(opts *types.ListOpts) (*TemplateContentCollection, error) {
resp := &TemplateContentCollection{}
err := c.apiClient.Ops.DoList(TemplateContentType, opts, resp)
resp.client = c
return resp, err
}
func (cc *TemplateContentCollection) Next() (*TemplateContentCollection, error) {
if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" {
resp := &TemplateContentCollection{}
err := cc.client.apiClient.Ops.DoNext(cc.Pagination.Next, resp)
resp.client = cc.client
return resp, err
}
return nil, nil
}
func (c *TemplateContentClient) ByID(id string) (*TemplateContent, error) {
resp := &TemplateContent{}
err := c.apiClient.Ops.DoByID(TemplateContentType, id, resp)
return resp, err
}
func (c *TemplateContentClient) Delete(container *TemplateContent) error {
return c.apiClient.Ops.DoResourceDelete(TemplateContentType, &container.Resource)
}

View File

@@ -2,7 +2,6 @@ package client
const (
TemplateSpecType = "templateSpec"
TemplateSpecFieldBase = "templateBase"
TemplateSpecFieldCatalogID = "catalogId"
TemplateSpecFieldCategories = "categories"
TemplateSpecFieldCategory = "category"
@@ -13,8 +12,6 @@ const (
TemplateSpecFieldFolderName = "folderName"
TemplateSpecFieldIcon = "icon"
TemplateSpecFieldIconFilename = "iconFilename"
TemplateSpecFieldIsSystem = "isSystem"
TemplateSpecFieldLicense = "license"
TemplateSpecFieldMaintainer = "maintainer"
TemplateSpecFieldPath = "path"
TemplateSpecFieldProjectURL = "projectURL"
@@ -24,7 +21,6 @@ const (
)
type TemplateSpec struct {
Base string `json:"templateBase,omitempty" yaml:"templateBase,omitempty"`
CatalogID string `json:"catalogId,omitempty" yaml:"catalogId,omitempty"`
Categories []string `json:"categories,omitempty" yaml:"categories,omitempty"`
Category string `json:"category,omitempty" yaml:"category,omitempty"`
@@ -35,8 +31,6 @@ type TemplateSpec struct {
FolderName string `json:"folderName,omitempty" yaml:"folderName,omitempty"`
Icon string `json:"icon,omitempty" yaml:"icon,omitempty"`
IconFilename string `json:"iconFilename,omitempty" yaml:"iconFilename,omitempty"`
IsSystem string `json:"isSystem,omitempty" yaml:"isSystem,omitempty"`
License string `json:"license,omitempty" yaml:"license,omitempty"`
Maintainer string `json:"maintainer,omitempty" yaml:"maintainer,omitempty"`
Path string `json:"path,omitempty" yaml:"path,omitempty"`
ProjectURL string `json:"projectURL,omitempty" yaml:"projectURL,omitempty"`

View File

@@ -5,55 +5,55 @@ import (
)
const (
TemplateVersionType = "templateVersion"
TemplateVersionFieldAnnotations = "annotations"
TemplateVersionFieldCreated = "created"
TemplateVersionFieldCreatorID = "creatorId"
TemplateVersionFieldExternalID = "externalId"
TemplateVersionFieldFiles = "files"
TemplateVersionFieldLabels = "labels"
TemplateVersionFieldMaximumRancherVersion = "maximumRancherVersion"
TemplateVersionFieldMinimumRancherVersion = "minimumRancherVersion"
TemplateVersionFieldName = "name"
TemplateVersionFieldOwnerReferences = "ownerReferences"
TemplateVersionFieldQuestions = "questions"
TemplateVersionFieldReadme = "readme"
TemplateVersionFieldRemoved = "removed"
TemplateVersionFieldRevision = "revision"
TemplateVersionFieldState = "state"
TemplateVersionFieldStatus = "status"
TemplateVersionFieldTransitioning = "transitioning"
TemplateVersionFieldTransitioningMessage = "transitioningMessage"
TemplateVersionFieldUpgradeFrom = "upgradeFrom"
TemplateVersionFieldUpgradeVersionLinks = "upgradeVersionLinks"
TemplateVersionFieldUuid = "uuid"
TemplateVersionFieldVersion = "version"
TemplateVersionType = "templateVersion"
TemplateVersionFieldAnnotations = "annotations"
TemplateVersionFieldAppReadme = "appReadme"
TemplateVersionFieldCreated = "created"
TemplateVersionFieldCreatorID = "creatorId"
TemplateVersionFieldDigest = "digest"
TemplateVersionFieldExternalID = "externalId"
TemplateVersionFieldFiles = "files"
TemplateVersionFieldKubeVersion = "kubeVersion"
TemplateVersionFieldLabels = "labels"
TemplateVersionFieldName = "name"
TemplateVersionFieldOwnerReferences = "ownerReferences"
TemplateVersionFieldQuestions = "questions"
TemplateVersionFieldRancherVersion = "rancherVersion"
TemplateVersionFieldReadme = "readme"
TemplateVersionFieldRemoved = "removed"
TemplateVersionFieldState = "state"
TemplateVersionFieldStatus = "status"
TemplateVersionFieldTransitioning = "transitioning"
TemplateVersionFieldTransitioningMessage = "transitioningMessage"
TemplateVersionFieldUpgradeVersionLinks = "upgradeVersionLinks"
TemplateVersionFieldUuid = "uuid"
TemplateVersionFieldVersion = "version"
)
type TemplateVersion struct {
types.Resource
Annotations map[string]string `json:"annotations,omitempty" yaml:"annotations,omitempty"`
Created string `json:"created,omitempty" yaml:"created,omitempty"`
CreatorID string `json:"creatorId,omitempty" yaml:"creatorId,omitempty"`
ExternalID string `json:"externalId,omitempty" yaml:"externalId,omitempty"`
Files []File `json:"files,omitempty" yaml:"files,omitempty"`
Labels map[string]string `json:"labels,omitempty" yaml:"labels,omitempty"`
MaximumRancherVersion string `json:"maximumRancherVersion,omitempty" yaml:"maximumRancherVersion,omitempty"`
MinimumRancherVersion string `json:"minimumRancherVersion,omitempty" yaml:"minimumRancherVersion,omitempty"`
Name string `json:"name,omitempty" yaml:"name,omitempty"`
OwnerReferences []OwnerReference `json:"ownerReferences,omitempty" yaml:"ownerReferences,omitempty"`
Questions []Question `json:"questions,omitempty" yaml:"questions,omitempty"`
Readme string `json:"readme,omitempty" yaml:"readme,omitempty"`
Removed string `json:"removed,omitempty" yaml:"removed,omitempty"`
Revision *int64 `json:"revision,omitempty" yaml:"revision,omitempty"`
State string `json:"state,omitempty" yaml:"state,omitempty"`
Status *TemplateVersionStatus `json:"status,omitempty" yaml:"status,omitempty"`
Transitioning string `json:"transitioning,omitempty" yaml:"transitioning,omitempty"`
TransitioningMessage string `json:"transitioningMessage,omitempty" yaml:"transitioningMessage,omitempty"`
UpgradeFrom string `json:"upgradeFrom,omitempty" yaml:"upgradeFrom,omitempty"`
UpgradeVersionLinks map[string]string `json:"upgradeVersionLinks,omitempty" yaml:"upgradeVersionLinks,omitempty"`
Uuid string `json:"uuid,omitempty" yaml:"uuid,omitempty"`
Version string `json:"version,omitempty" yaml:"version,omitempty"`
Annotations map[string]string `json:"annotations,omitempty" yaml:"annotations,omitempty"`
AppReadme string `json:"appReadme,omitempty" yaml:"appReadme,omitempty"`
Created string `json:"created,omitempty" yaml:"created,omitempty"`
CreatorID string `json:"creatorId,omitempty" yaml:"creatorId,omitempty"`
Digest string `json:"digest,omitempty" yaml:"digest,omitempty"`
ExternalID string `json:"externalId,omitempty" yaml:"externalId,omitempty"`
Files map[string]string `json:"files,omitempty" yaml:"files,omitempty"`
KubeVersion string `json:"kubeVersion,omitempty" yaml:"kubeVersion,omitempty"`
Labels map[string]string `json:"labels,omitempty" yaml:"labels,omitempty"`
Name string `json:"name,omitempty" yaml:"name,omitempty"`
OwnerReferences []OwnerReference `json:"ownerReferences,omitempty" yaml:"ownerReferences,omitempty"`
Questions []Question `json:"questions,omitempty" yaml:"questions,omitempty"`
RancherVersion string `json:"rancherVersion,omitempty" yaml:"rancherVersion,omitempty"`
Readme string `json:"readme,omitempty" yaml:"readme,omitempty"`
Removed string `json:"removed,omitempty" yaml:"removed,omitempty"`
State string `json:"state,omitempty" yaml:"state,omitempty"`
Status *TemplateVersionStatus `json:"status,omitempty" yaml:"status,omitempty"`
Transitioning string `json:"transitioning,omitempty" yaml:"transitioning,omitempty"`
TransitioningMessage string `json:"transitioningMessage,omitempty" yaml:"transitioningMessage,omitempty"`
UpgradeVersionLinks map[string]string `json:"upgradeVersionLinks,omitempty" yaml:"upgradeVersionLinks,omitempty"`
Uuid string `json:"uuid,omitempty" yaml:"uuid,omitempty"`
Version string `json:"version,omitempty" yaml:"version,omitempty"`
}
type TemplateVersionCollection struct {
types.Collection

View File

@@ -1,28 +1,28 @@
package client
const (
TemplateVersionSpecType = "templateVersionSpec"
TemplateVersionSpecFieldExternalID = "externalId"
TemplateVersionSpecFieldFiles = "files"
TemplateVersionSpecFieldMaximumRancherVersion = "maximumRancherVersion"
TemplateVersionSpecFieldMinimumRancherVersion = "minimumRancherVersion"
TemplateVersionSpecFieldQuestions = "questions"
TemplateVersionSpecFieldReadme = "readme"
TemplateVersionSpecFieldRevision = "revision"
TemplateVersionSpecFieldUpgradeFrom = "upgradeFrom"
TemplateVersionSpecFieldUpgradeVersionLinks = "upgradeVersionLinks"
TemplateVersionSpecFieldVersion = "version"
TemplateVersionSpecType = "templateVersionSpec"
TemplateVersionSpecFieldAppReadme = "appReadme"
TemplateVersionSpecFieldDigest = "digest"
TemplateVersionSpecFieldExternalID = "externalId"
TemplateVersionSpecFieldFiles = "files"
TemplateVersionSpecFieldKubeVersion = "kubeVersion"
TemplateVersionSpecFieldQuestions = "questions"
TemplateVersionSpecFieldRancherVersion = "rancherVersion"
TemplateVersionSpecFieldReadme = "readme"
TemplateVersionSpecFieldUpgradeVersionLinks = "upgradeVersionLinks"
TemplateVersionSpecFieldVersion = "version"
)
type TemplateVersionSpec struct {
ExternalID string `json:"externalId,omitempty" yaml:"externalId,omitempty"`
Files []File `json:"files,omitempty" yaml:"files,omitempty"`
MaximumRancherVersion string `json:"maximumRancherVersion,omitempty" yaml:"maximumRancherVersion,omitempty"`
MinimumRancherVersion string `json:"minimumRancherVersion,omitempty" yaml:"minimumRancherVersion,omitempty"`
Questions []Question `json:"questions,omitempty" yaml:"questions,omitempty"`
Readme string `json:"readme,omitempty" yaml:"readme,omitempty"`
Revision *int64 `json:"revision,omitempty" yaml:"revision,omitempty"`
UpgradeFrom string `json:"upgradeFrom,omitempty" yaml:"upgradeFrom,omitempty"`
UpgradeVersionLinks map[string]string `json:"upgradeVersionLinks,omitempty" yaml:"upgradeVersionLinks,omitempty"`
Version string `json:"version,omitempty" yaml:"version,omitempty"`
AppReadme string `json:"appReadme,omitempty" yaml:"appReadme,omitempty"`
Digest string `json:"digest,omitempty" yaml:"digest,omitempty"`
ExternalID string `json:"externalId,omitempty" yaml:"externalId,omitempty"`
Files map[string]string `json:"files,omitempty" yaml:"files,omitempty"`
KubeVersion string `json:"kubeVersion,omitempty" yaml:"kubeVersion,omitempty"`
Questions []Question `json:"questions,omitempty" yaml:"questions,omitempty"`
RancherVersion string `json:"rancherVersion,omitempty" yaml:"rancherVersion,omitempty"`
Readme string `json:"readme,omitempty" yaml:"readme,omitempty"`
UpgradeVersionLinks map[string]string `json:"upgradeVersionLinks,omitempty" yaml:"upgradeVersionLinks,omitempty"`
Version string `json:"version,omitempty" yaml:"version,omitempty"`
}

View File

@@ -68,7 +68,7 @@ type TokenOperations interface {
ByID(id string) (*Token, error)
Delete(container *Token) error
ActionLogout(resource *TokenCollection) error
CollectionActionLogout(resource *TokenCollection) error
}
func newTokenClient(apiClient *Client) *TokenClient {
@@ -116,8 +116,7 @@ func (c *TokenClient) Delete(container *Token) error {
return c.apiClient.Ops.DoResourceDelete(TokenType, &container.Resource)
}
func (c *TokenClient) ActionLogout(resource *TokenCollection) error {
func (c *TokenClient) CollectionActionLogout(resource *TokenCollection) error {
err := c.apiClient.Ops.DoCollectionAction(TokenType, "logout", &resource.Collection, nil, nil)
return err
}

View File

@@ -56,9 +56,9 @@ type UserOperations interface {
ByID(id string) (*User, error)
Delete(container *User) error
ActionSetpassword(*User, *SetPasswordInput) (*User, error)
ActionSetpassword(resource *User, input *SetPasswordInput) (*User, error)
ActionChangepassword(resource *UserCollection, input *ChangePasswordInput) error
CollectionActionChangepassword(resource *UserCollection, input *ChangePasswordInput) error
}
func newUserClient(apiClient *Client) *UserClient {
@@ -107,16 +107,12 @@ func (c *UserClient) Delete(container *User) error {
}
func (c *UserClient) ActionSetpassword(resource *User, input *SetPasswordInput) (*User, error) {
resp := &User{}
err := c.apiClient.Ops.DoAction(UserType, "setpassword", &resource.Resource, input, resp)
return resp, err
}
func (c *UserClient) ActionChangepassword(resource *UserCollection, input *ChangePasswordInput) error {
func (c *UserClient) CollectionActionChangepassword(resource *UserCollection, input *ChangePasswordInput) error {
err := c.apiClient.Ops.DoCollectionAction(UserType, "changepassword", &resource.Collection, input, nil)
return err
}

View File

@@ -7,22 +7,24 @@ import (
const (
AppType = "app"
AppFieldAnnotations = "annotations"
AppFieldAnswerValues = "answerValues"
AppFieldAnswers = "answers"
AppFieldAppRevisionId = "appRevisionId"
AppFieldConditions = "conditions"
AppFieldCreated = "created"
AppFieldCreatorID = "creatorId"
AppFieldDescription = "description"
AppFieldExternalID = "externalId"
AppFieldInstallNamespace = "installNamespace"
AppFieldLabels = "labels"
AppFieldLastAppliedTemplates = "lastAppliedTemplate"
AppFieldName = "name"
AppFieldNamespaceId = "namespaceId"
AppFieldNotes = "notes"
AppFieldOwnerReferences = "ownerReferences"
AppFieldProjectId = "projectId"
AppFieldPrune = "prune"
AppFieldRemoved = "removed"
AppFieldState = "state"
AppFieldStatus = "status"
AppFieldTemplates = "templates"
AppFieldTargetNamespace = "targetNamespace"
AppFieldTransitioning = "transitioning"
AppFieldTransitioningMessage = "transitioningMessage"
AppFieldUuid = "uuid"
@@ -31,22 +33,24 @@ const (
type App struct {
types.Resource
Annotations map[string]string `json:"annotations,omitempty" yaml:"annotations,omitempty"`
AnswerValues string `json:"answerValues,omitempty" yaml:"answerValues,omitempty"`
Answers map[string]string `json:"answers,omitempty" yaml:"answers,omitempty"`
AppRevisionId string `json:"appRevisionId,omitempty" yaml:"appRevisionId,omitempty"`
Conditions []AppCondition `json:"conditions,omitempty" yaml:"conditions,omitempty"`
Created string `json:"created,omitempty" yaml:"created,omitempty"`
CreatorID string `json:"creatorId,omitempty" yaml:"creatorId,omitempty"`
Description string `json:"description,omitempty" yaml:"description,omitempty"`
ExternalID string `json:"externalId,omitempty" yaml:"externalId,omitempty"`
InstallNamespace string `json:"installNamespace,omitempty" yaml:"installNamespace,omitempty"`
Labels map[string]string `json:"labels,omitempty" yaml:"labels,omitempty"`
LastAppliedTemplates string `json:"lastAppliedTemplate,omitempty" yaml:"lastAppliedTemplate,omitempty"`
Name string `json:"name,omitempty" yaml:"name,omitempty"`
NamespaceId string `json:"namespaceId,omitempty" yaml:"namespaceId,omitempty"`
Notes string `json:"notes,omitempty" yaml:"notes,omitempty"`
OwnerReferences []OwnerReference `json:"ownerReferences,omitempty" yaml:"ownerReferences,omitempty"`
ProjectId string `json:"projectId,omitempty" yaml:"projectId,omitempty"`
Prune bool `json:"prune,omitempty" yaml:"prune,omitempty"`
Removed string `json:"removed,omitempty" yaml:"removed,omitempty"`
State string `json:"state,omitempty" yaml:"state,omitempty"`
Status *AppStatus `json:"status,omitempty" yaml:"status,omitempty"`
Templates map[string]string `json:"templates,omitempty" yaml:"templates,omitempty"`
TargetNamespace string `json:"targetNamespace,omitempty" yaml:"targetNamespace,omitempty"`
Transitioning string `json:"transitioning,omitempty" yaml:"transitioning,omitempty"`
TransitioningMessage string `json:"transitioningMessage,omitempty" yaml:"transitioningMessage,omitempty"`
Uuid string `json:"uuid,omitempty" yaml:"uuid,omitempty"`
@@ -67,6 +71,10 @@ type AppOperations interface {
Update(existing *App, updates interface{}) (*App, error)
ByID(id string) (*App, error)
Delete(container *App) error
ActionRollback(resource *App, input *RollbackRevision) error
ActionUpgrade(resource *App, input *AppUpgradeConfig) error
}
func newAppClient(apiClient *Client) *AppClient {
@@ -113,3 +121,13 @@ func (c *AppClient) ByID(id string) (*App, error) {
func (c *AppClient) Delete(container *App) error {
return c.apiClient.Ops.DoResourceDelete(AppType, &container.Resource)
}
func (c *AppClient) ActionRollback(resource *App, input *RollbackRevision) error {
err := c.apiClient.Ops.DoAction(AppType, "rollback", &resource.Resource, input, nil)
return err
}
func (c *AppClient) ActionUpgrade(resource *App, input *AppUpgradeConfig) error {
err := c.apiClient.Ops.DoAction(AppType, "upgrade", &resource.Resource, input, nil)
return err
}

View File

@@ -0,0 +1,101 @@
package client
import (
"github.com/rancher/norman/types"
)
const (
AppRevisionType = "appRevision"
AppRevisionFieldAnnotations = "annotations"
AppRevisionFieldCreated = "created"
AppRevisionFieldCreatorID = "creatorId"
AppRevisionFieldLabels = "labels"
AppRevisionFieldName = "name"
AppRevisionFieldNamespaceId = "namespaceId"
AppRevisionFieldOwnerReferences = "ownerReferences"
AppRevisionFieldRemoved = "removed"
AppRevisionFieldState = "state"
AppRevisionFieldStatus = "status"
AppRevisionFieldTransitioning = "transitioning"
AppRevisionFieldTransitioningMessage = "transitioningMessage"
AppRevisionFieldUuid = "uuid"
)
type AppRevision struct {
types.Resource
Annotations map[string]string `json:"annotations,omitempty" yaml:"annotations,omitempty"`
Created string `json:"created,omitempty" yaml:"created,omitempty"`
CreatorID string `json:"creatorId,omitempty" yaml:"creatorId,omitempty"`
Labels map[string]string `json:"labels,omitempty" yaml:"labels,omitempty"`
Name string `json:"name,omitempty" yaml:"name,omitempty"`
NamespaceId string `json:"namespaceId,omitempty" yaml:"namespaceId,omitempty"`
OwnerReferences []OwnerReference `json:"ownerReferences,omitempty" yaml:"ownerReferences,omitempty"`
Removed string `json:"removed,omitempty" yaml:"removed,omitempty"`
State string `json:"state,omitempty" yaml:"state,omitempty"`
Status *AppRevisionStatus `json:"status,omitempty" yaml:"status,omitempty"`
Transitioning string `json:"transitioning,omitempty" yaml:"transitioning,omitempty"`
TransitioningMessage string `json:"transitioningMessage,omitempty" yaml:"transitioningMessage,omitempty"`
Uuid string `json:"uuid,omitempty" yaml:"uuid,omitempty"`
}
type AppRevisionCollection struct {
types.Collection
Data []AppRevision `json:"data,omitempty"`
client *AppRevisionClient
}
type AppRevisionClient struct {
apiClient *Client
}
type AppRevisionOperations interface {
List(opts *types.ListOpts) (*AppRevisionCollection, error)
Create(opts *AppRevision) (*AppRevision, error)
Update(existing *AppRevision, updates interface{}) (*AppRevision, error)
ByID(id string) (*AppRevision, error)
Delete(container *AppRevision) error
}
func newAppRevisionClient(apiClient *Client) *AppRevisionClient {
return &AppRevisionClient{
apiClient: apiClient,
}
}
func (c *AppRevisionClient) Create(container *AppRevision) (*AppRevision, error) {
resp := &AppRevision{}
err := c.apiClient.Ops.DoCreate(AppRevisionType, container, resp)
return resp, err
}
func (c *AppRevisionClient) Update(existing *AppRevision, updates interface{}) (*AppRevision, error) {
resp := &AppRevision{}
err := c.apiClient.Ops.DoUpdate(AppRevisionType, &existing.Resource, updates, resp)
return resp, err
}
func (c *AppRevisionClient) List(opts *types.ListOpts) (*AppRevisionCollection, error) {
resp := &AppRevisionCollection{}
err := c.apiClient.Ops.DoList(AppRevisionType, opts, resp)
resp.client = c
return resp, err
}
func (cc *AppRevisionCollection) Next() (*AppRevisionCollection, error) {
if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" {
resp := &AppRevisionCollection{}
err := cc.client.apiClient.Ops.DoNext(cc.Pagination.Next, resp)
resp.client = cc.client
return resp, err
}
return nil, nil
}
func (c *AppRevisionClient) ByID(id string) (*AppRevision, error) {
resp := &AppRevision{}
err := c.apiClient.Ops.DoByID(AppRevisionType, id, resp)
return resp, err
}
func (c *AppRevisionClient) Delete(container *AppRevision) error {
return c.apiClient.Ops.DoResourceDelete(AppRevisionType, &container.Resource)
}

View File

@@ -0,0 +1,8 @@
package client
const (
AppRevisionSpecType = "appRevisionSpec"
)
type AppRevisionSpec struct {
}

View File

@@ -0,0 +1,16 @@
package client
const (
AppRevisionStatusType = "appRevisionStatus"
AppRevisionStatusFieldAnswers = "answers"
AppRevisionStatusFieldDigest = "digest"
AppRevisionStatusFieldExternalID = "externalId"
AppRevisionStatusFieldProjectId = "projectId"
)
type AppRevisionStatus struct {
Answers map[string]string `json:"answers,omitempty" yaml:"answers,omitempty"`
Digest string `json:"digest,omitempty" yaml:"digest,omitempty"`
ExternalID string `json:"externalId,omitempty" yaml:"externalId,omitempty"`
ProjectId string `json:"projectId,omitempty" yaml:"projectId,omitempty"`
}

View File

@@ -1,22 +1,22 @@
package client
const (
AppSpecType = "appSpec"
AppSpecFieldAnswerValues = "answerValues"
AppSpecFieldAnswers = "answers"
AppSpecFieldDescription = "description"
AppSpecFieldExternalID = "externalId"
AppSpecFieldInstallNamespace = "installNamespace"
AppSpecFieldProjectId = "projectId"
AppSpecFieldTemplates = "templates"
AppSpecType = "appSpec"
AppSpecFieldAnswers = "answers"
AppSpecFieldAppRevisionId = "appRevisionId"
AppSpecFieldDescription = "description"
AppSpecFieldExternalID = "externalId"
AppSpecFieldProjectId = "projectId"
AppSpecFieldPrune = "prune"
AppSpecFieldTargetNamespace = "targetNamespace"
)
type AppSpec struct {
AnswerValues string `json:"answerValues,omitempty" yaml:"answerValues,omitempty"`
Answers map[string]string `json:"answers,omitempty" yaml:"answers,omitempty"`
Description string `json:"description,omitempty" yaml:"description,omitempty"`
ExternalID string `json:"externalId,omitempty" yaml:"externalId,omitempty"`
InstallNamespace string `json:"installNamespace,omitempty" yaml:"installNamespace,omitempty"`
ProjectId string `json:"projectId,omitempty" yaml:"projectId,omitempty"`
Templates map[string]string `json:"templates,omitempty" yaml:"templates,omitempty"`
Answers map[string]string `json:"answers,omitempty" yaml:"answers,omitempty"`
AppRevisionId string `json:"appRevisionId,omitempty" yaml:"appRevisionId,omitempty"`
Description string `json:"description,omitempty" yaml:"description,omitempty"`
ExternalID string `json:"externalId,omitempty" yaml:"externalId,omitempty"`
ProjectId string `json:"projectId,omitempty" yaml:"projectId,omitempty"`
Prune bool `json:"prune,omitempty" yaml:"prune,omitempty"`
TargetNamespace string `json:"targetNamespace,omitempty" yaml:"targetNamespace,omitempty"`
}

View File

@@ -1,16 +1,14 @@
package client
const (
AppStatusType = "appStatus"
AppStatusFieldConditions = "conditions"
AppStatusFieldReleases = "releases"
AppStatusFieldStdError = "stdError"
AppStatusFieldStdOutput = "stdOutput"
AppStatusType = "appStatus"
AppStatusFieldConditions = "conditions"
AppStatusFieldLastAppliedTemplates = "lastAppliedTemplate"
AppStatusFieldNotes = "notes"
)
type AppStatus struct {
Conditions []AppCondition `json:"conditions,omitempty" yaml:"conditions,omitempty"`
Releases []ReleaseInfo `json:"releases,omitempty" yaml:"releases,omitempty"`
StdError []string `json:"stdError,omitempty" yaml:"stdError,omitempty"`
StdOutput []string `json:"stdOutput,omitempty" yaml:"stdOutput,omitempty"`
Conditions []AppCondition `json:"conditions,omitempty" yaml:"conditions,omitempty"`
LastAppliedTemplates string `json:"lastAppliedTemplate,omitempty" yaml:"lastAppliedTemplate,omitempty"`
Notes string `json:"notes,omitempty" yaml:"notes,omitempty"`
}

View File

@@ -0,0 +1,12 @@
package client
const (
AppUpgradeConfigType = "appUpgradeConfig"
AppUpgradeConfigFieldAnswers = "answers"
AppUpgradeConfigFieldExternalID = "externalId"
)
type AppUpgradeConfig struct {
Answers map[string]string `json:"answers,omitempty" yaml:"answers,omitempty"`
ExternalID string `json:"externalId,omitempty" yaml:"externalId,omitempty"`
}

View File

@@ -34,6 +34,7 @@ type Client struct {
CronJob CronJobOperations
Workload WorkloadOperations
App AppOperations
AppRevision AppRevisionOperations
NamespaceComposeConfig NamespaceComposeConfigOperations
}
@@ -74,6 +75,7 @@ func NewClient(opts *clientbase.ClientOpts) (*Client, error) {
client.CronJob = newCronJobClient(client)
client.Workload = newWorkloadClient(client)
client.App = newAppClient(client)
client.AppRevision = newAppRevisionClient(client)
client.NamespaceComposeConfig = newNamespaceComposeConfigClient(client)
return client, nil

View File

@@ -9,6 +9,7 @@ const (
ContainerFieldEntrypoint = "entrypoint"
ContainerFieldEnvironment = "environment"
ContainerFieldEnvironmentFrom = "environmentFrom"
ContainerFieldExitCode = "exitCode"
ContainerFieldImage = "image"
ContainerFieldImagePullPolicy = "imagePullPolicy"
ContainerFieldInitContainer = "initContainer"
@@ -21,12 +22,16 @@ const (
ContainerFieldReadOnly = "readOnly"
ContainerFieldReadinessProbe = "readinessProbe"
ContainerFieldResources = "resources"
ContainerFieldRestartCount = "restartCount"
ContainerFieldRunAsNonRoot = "runAsNonRoot"
ContainerFieldState = "state"
ContainerFieldStdin = "stdin"
ContainerFieldStdinOnce = "stdinOnce"
ContainerFieldTTY = "tty"
ContainerFieldTerminationMessagePath = "terminationMessagePath"
ContainerFieldTerminationMessagePolicy = "terminationMessagePolicy"
ContainerFieldTransitioning = "transitioning"
ContainerFieldTransitioningMessage = "transitioningMessage"
ContainerFieldUid = "uid"
ContainerFieldVolumeMounts = "volumeMounts"
ContainerFieldWorkingDir = "workingDir"
@@ -40,6 +45,7 @@ type Container struct {
Entrypoint []string `json:"entrypoint,omitempty" yaml:"entrypoint,omitempty"`
Environment map[string]string `json:"environment,omitempty" yaml:"environment,omitempty"`
EnvironmentFrom []EnvironmentFrom `json:"environmentFrom,omitempty" yaml:"environmentFrom,omitempty"`
ExitCode *int64 `json:"exitCode,omitempty" yaml:"exitCode,omitempty"`
Image string `json:"image,omitempty" yaml:"image,omitempty"`
ImagePullPolicy string `json:"imagePullPolicy,omitempty" yaml:"imagePullPolicy,omitempty"`
InitContainer bool `json:"initContainer,omitempty" yaml:"initContainer,omitempty"`
@@ -52,12 +58,16 @@ type Container struct {
ReadOnly *bool `json:"readOnly,omitempty" yaml:"readOnly,omitempty"`
ReadinessProbe *Probe `json:"readinessProbe,omitempty" yaml:"readinessProbe,omitempty"`
Resources *ResourceRequirements `json:"resources,omitempty" yaml:"resources,omitempty"`
RestartCount int64 `json:"restartCount,omitempty" yaml:"restartCount,omitempty"`
RunAsNonRoot *bool `json:"runAsNonRoot,omitempty" yaml:"runAsNonRoot,omitempty"`
State string `json:"state,omitempty" yaml:"state,omitempty"`
Stdin bool `json:"stdin,omitempty" yaml:"stdin,omitempty"`
StdinOnce bool `json:"stdinOnce,omitempty" yaml:"stdinOnce,omitempty"`
TTY bool `json:"tty,omitempty" yaml:"tty,omitempty"`
TerminationMessagePath string `json:"terminationMessagePath,omitempty" yaml:"terminationMessagePath,omitempty"`
TerminationMessagePolicy string `json:"terminationMessagePolicy,omitempty" yaml:"terminationMessagePolicy,omitempty"`
Transitioning string `json:"transitioning,omitempty" yaml:"transitioning,omitempty"`
TransitioningMessage string `json:"transitioningMessage,omitempty" yaml:"transitioningMessage,omitempty"`
Uid *int64 `json:"uid,omitempty" yaml:"uid,omitempty"`
VolumeMounts []VolumeMount `json:"volumeMounts,omitempty" yaml:"volumeMounts,omitempty"`
WorkingDir string `json:"workingDir,omitempty" yaml:"workingDir,omitempty"`

View File

@@ -117,6 +117,12 @@ type DeploymentOperations interface {
Update(existing *Deployment, updates interface{}) (*Deployment, error)
ByID(id string) (*Deployment, error)
Delete(container *Deployment) error
ActionPause(resource *Deployment) error
ActionResume(resource *Deployment) error
ActionRollback(resource *Deployment, input *DeploymentRollbackInput) error
}
func newDeploymentClient(apiClient *Client) *DeploymentClient {
@@ -163,3 +169,18 @@ func (c *DeploymentClient) ByID(id string) (*Deployment, error) {
func (c *DeploymentClient) Delete(container *Deployment) error {
return c.apiClient.Ops.DoResourceDelete(DeploymentType, &container.Resource)
}
func (c *DeploymentClient) ActionPause(resource *Deployment) error {
err := c.apiClient.Ops.DoAction(DeploymentType, "pause", &resource.Resource, nil, nil)
return err
}
func (c *DeploymentClient) ActionResume(resource *Deployment) error {
err := c.apiClient.Ops.DoAction(DeploymentType, "resume", &resource.Resource, nil, nil)
return err
}
func (c *DeploymentClient) ActionRollback(resource *Deployment, input *DeploymentRollbackInput) error {
err := c.apiClient.Ops.DoAction(DeploymentType, "rollback", &resource.Resource, input, nil)
return err
}

View File

@@ -1,18 +0,0 @@
package client
const (
ReleaseInfoType = "releaseInfo"
ReleaseInfoFieldCreateTimestamp = "createTimestamp"
ReleaseInfoFieldModifiedAt = "modifiedAt"
ReleaseInfoFieldName = "name"
ReleaseInfoFieldTemplateVersionID = "templateVersionId"
ReleaseInfoFieldVersion = "version"
)
type ReleaseInfo struct {
CreateTimestamp string `json:"createTimestamp,omitempty" yaml:"createTimestamp,omitempty"`
ModifiedAt string `json:"modifiedAt,omitempty" yaml:"modifiedAt,omitempty"`
Name string `json:"name,omitempty" yaml:"name,omitempty"`
TemplateVersionID string `json:"templateVersionId,omitempty" yaml:"templateVersionId,omitempty"`
Version string `json:"version,omitempty" yaml:"version,omitempty"`
}

View File

@@ -0,0 +1,10 @@
package client
const (
RollbackRevisionType = "rollbackRevision"
RollbackRevisionFieldRevisionId = "revisionId"
)
type RollbackRevision struct {
RevisionId string `json:"revisionId,omitempty" yaml:"revisionId,omitempty"`
}

View File

@@ -141,6 +141,12 @@ type WorkloadOperations interface {
Update(existing *Workload, updates interface{}) (*Workload, error)
ByID(id string) (*Workload, error)
Delete(container *Workload) error
ActionPause(resource *Workload) error
ActionResume(resource *Workload) error
ActionRollback(resource *Workload, input *RollbackRevision) error
}
func newWorkloadClient(apiClient *Client) *WorkloadClient {
@@ -187,3 +193,18 @@ func (c *WorkloadClient) ByID(id string) (*Workload, error) {
func (c *WorkloadClient) Delete(container *Workload) error {
return c.apiClient.Ops.DoResourceDelete(WorkloadType, &container.Resource)
}
func (c *WorkloadClient) ActionPause(resource *Workload) error {
err := c.apiClient.Ops.DoAction(WorkloadType, "pause", &resource.Resource, nil, nil)
return err
}
func (c *WorkloadClient) ActionResume(resource *Workload) error {
err := c.apiClient.Ops.DoAction(WorkloadType, "resume", &resource.Resource, nil, nil)
return err
}
func (c *WorkloadClient) ActionRollback(resource *Workload, input *RollbackRevision) error {
err := c.apiClient.Ops.DoAction(WorkloadType, "rollback", &resource.Resource, input, nil)
return err
}

View File

@@ -5,4 +5,4 @@ k8s.io/kubernetes v1.8.3
bitbucket.org/ww/goautoneg a547fc61f48d567d5b4ec6f8aee5573d8efce11d https://github.com/rancher/goautoneg.git
golang.org/x/sync fd80eb99c8f653c847d294a001bdf2a3a6f768f5
github.com/rancher/norman ff60298f31f081b06d198815b4c178a578664f7d
github.com/rancher/norman e6973cb055f2390e8814884353981ffa5496e30c

120
vendor/k8s.io/apimachinery/pkg/util/rand/rand.go generated vendored Normal file
View File

@@ -0,0 +1,120 @@
/*
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 rand provides utilities related to randomization.
package rand
import (
"math/rand"
"sync"
"time"
)
var rng = struct {
sync.Mutex
rand *rand.Rand
}{
rand: rand.New(rand.NewSource(time.Now().UTC().UnixNano())),
}
// Intn generates an integer in range [0,max).
// By design this should panic if input is invalid, <= 0.
func Intn(max int) int {
rng.Lock()
defer rng.Unlock()
return rng.rand.Intn(max)
}
// IntnRange generates an integer in range [min,max).
// By design this should panic if input is invalid, <= 0.
func IntnRange(min, max int) int {
rng.Lock()
defer rng.Unlock()
return rng.rand.Intn(max-min) + min
}
// IntnRange generates an int64 integer in range [min,max).
// By design this should panic if input is invalid, <= 0.
func Int63nRange(min, max int64) int64 {
rng.Lock()
defer rng.Unlock()
return rng.rand.Int63n(max-min) + min
}
// Seed seeds the rng with the provided seed.
func Seed(seed int64) {
rng.Lock()
defer rng.Unlock()
rng.rand = rand.New(rand.NewSource(seed))
}
// Perm returns, as a slice of n ints, a pseudo-random permutation of the integers [0,n)
// from the default Source.
func Perm(n int) []int {
rng.Lock()
defer rng.Unlock()
return rng.rand.Perm(n)
}
const (
// We omit vowels from the set of available characters to reduce the chances
// of "bad words" being formed.
alphanums = "bcdfghjklmnpqrstvwxz2456789"
// No. of bits required to index into alphanums string.
alphanumsIdxBits = 5
// Mask used to extract last alphanumsIdxBits of an int.
alphanumsIdxMask = 1<<alphanumsIdxBits - 1
// No. of random letters we can extract from a single int63.
maxAlphanumsPerInt = 63 / alphanumsIdxBits
)
// String generates a random alphanumeric string, without vowels, which is n
// characters long. This will panic if n is less than zero.
// How the random string is created:
// - we generate random int63's
// - from each int63, we are extracting multiple random letters by bit-shifting and masking
// - if some index is out of range of alphanums we neglect it (unlikely to happen multiple times in a row)
func String(n int) string {
b := make([]byte, n)
rng.Lock()
defer rng.Unlock()
randomInt63 := rng.rand.Int63()
remaining := maxAlphanumsPerInt
for i := 0; i < n; {
if remaining == 0 {
randomInt63, remaining = rng.rand.Int63(), maxAlphanumsPerInt
}
if idx := int(randomInt63 & alphanumsIdxMask); idx < len(alphanums) {
b[i] = alphanums[idx]
i++
}
randomInt63 >>= alphanumsIdxBits
remaining--
}
return string(b)
}
// SafeEncodeString encodes s using the same characters as rand.String. This reduces the chances of bad words and
// ensures that strings generated from hash functions appear consistent throughout the API.
func SafeEncodeString(s string) string {
r := make([]byte, len(s))
for i, b := range []rune(s) {
r[i] = alphanums[(int(b) % len(alphanums))]
}
return string(r)
}