Merge pull request #27 from 0rax/api-v2

Update plugin to go-rancher/v2 to allow retention of secrets on upgrade
This commit is contained in:
Joachim Hill-Grannec
2017-11-21 15:37:51 -05:00
committed by GitHub
189 changed files with 5315 additions and 2117 deletions
+4 -3
View File
@@ -2,13 +2,14 @@ package main
import (
"fmt"
"github.com/urfave/cli"
"log"
"os"
log "github.com/Sirupsen/logrus"
"github.com/urfave/cli"
)
type Rancher struct {
Url string `json:"url"`
URL string `json:"url"`
AccessKey string `json:"access_key"`
SecretKey string `json:"secret_key"`
Service string `json:"service"`
+27 -55
View File
@@ -3,10 +3,11 @@ package main
import (
"errors"
"fmt"
log "github.com/Sirupsen/logrus"
"github.com/rancher/go-rancher/client"
"strings"
"time"
log "github.com/Sirupsen/logrus"
client "github.com/rancher/go-rancher/v2"
)
type Plugin struct {
@@ -48,65 +49,36 @@ func (p *Plugin) Exec() error {
SecretKey: p.Secret,
})
if err != nil {
return errors.New(fmt.Sprintf("Failed to create rancher client: %s\n :(", err))
return fmt.Errorf("Failed to create rancher client: %s", err)
}
var stackId string
// Prepare service filters for service listing
serviceFilters := map[string]interface{}{"name": wantedService}
// Query stacks with filter name=wantedStack
if wantedStack != "" {
environments, err := rancher.Environment.List(&client.ListOpts{})
stacks, err := rancher.Stack.List(&client.ListOpts{Filters: map[string]interface{}{"name": wantedStack}})
if err != nil {
return errors.New(fmt.Sprintf("Failed to list rancher environments: %s\n", err))
return fmt.Errorf("Failed to list rancher environments: %s", err)
}
for _, env := range environments.Data {
if env.Name == wantedStack {
stackId = env.Id
}
}
if stackId == "" {
return errors.New(fmt.Sprintf("Unable to find stack %s\n", wantedStack))
if len(stacks.Data) <= 0 {
return fmt.Errorf("Unable to find stack %s", wantedStack)
}
// If found add stackID to serviceFilters
serviceFilters["stackId"] = stacks.Data[0].Id
}
// Get the initial set of services
services, err := rancher.Service.List(&client.ListOpts{})
// Check for an error
// Query services with prepared filters
services, err := rancher.Service.List(&client.ListOpts{Filters: serviceFilters})
if err != nil {
return errors.New(fmt.Sprintf("Failed to list rancher services: %s\n", err))
return fmt.Errorf("Failed to list rancher services: %s", err)
}
var service client.Service
found := false
//TODO: find a more elegant and clear way to iterate through the service paging
for {
// Iterate the current services
for _, svc := range services.Data {
if svc.Name == wantedService && ((wantedStack != "" && svc.EnvironmentId == stackId) || wantedStack == "") {
service = svc
found = true
break
}
}
if found {
break
}
// Get the next set of services (paginate)
if !found {
services, err = services.Next()
if err != nil {
return errors.New(fmt.Sprintf("Failed to list rancher services: %s\n", err))
}
if services == nil {
break
}
}
}
if !found {
return errors.New(fmt.Sprintf("Unable to find service %s\n", p.Service))
if len(services.Data) <= 0 {
return fmt.Errorf("Unable to find service %s", p.Service)
}
service := services.Data[0]
// Service is found, proceed with upgrade
service.LaunchConfig.ImageUuid = p.DockerImage
upgrade := &client.ServiceUpgrade{}
upgrade.InServiceStrategy = &client.InServiceUpgradeStrategy{
@@ -119,10 +91,10 @@ func (p *Plugin) Exec() error {
upgrade.ToServiceStrategy = &client.ToServiceUpgradeStrategy{}
_, err = rancher.Service.ActionUpgrade(&service, upgrade)
if err != nil {
return errors.New(fmt.Sprintf("Unable to upgrade service %s: %s\n", p.Service, err))
return fmt.Errorf("Unable to upgrade service %s: %s", p.Service, err)
}
log.Info(fmt.Sprintf("Upgraded %s to %s\n", p.Service, p.DockerImage))
log.Infof("Upgraded %s to %s", p.Service, p.DockerImage)
if p.Confirm {
srv, err := retry(func() (interface{}, error) {
s, e := rancher.Service.ById(service.Id)
@@ -130,20 +102,20 @@ func (p *Plugin) Exec() error {
return nil, e
}
if s.State != "upgraded" {
return nil, errors.New(fmt.Sprintf("Service not upgraded: %s", s.State))
return nil, fmt.Errorf("Service not upgraded: %s", s.State)
}
return s, nil
}, time.Duration(p.Timeout)*time.Second, 3*time.Second)
if err != nil {
return errors.New(fmt.Sprintf("Error waiting for service upgrade to complete: %s", err))
return fmt.Errorf("Error waiting for service upgrade to complete: %s", err)
}
_, err = rancher.Service.ActionFinishupgrade(srv.(*client.Service))
if err != nil {
return errors.New(fmt.Sprintf("Unable to finish upgrade %s: %s\n", p.Service, err))
return fmt.Errorf("Unable to finish upgrade %s: %s", p.Service, err)
}
log.Info(fmt.Printf("Finished upgrade %s\n", p.Service))
log.Infof("Finished upgrade %s", p.Service)
}
return nil
}
-30
View File
@@ -1,30 +0,0 @@
FROM ubuntu:16.04
# FROM arm=armhf/ubuntu:16.04
ARG DAPPER_HOST_ARCH=amd64
ENV HOST_ARCH=${DAPPER_HOST_ARCH} ARCH=${DAPPER_HOST_ARCH}
RUN apt-get update && \
apt-get install -y gcc ca-certificates git wget curl vim less file && \
rm -f /bin/sh && ln -s /bin/bash /bin/sh
ENV GOLANG_ARCH_amd64=amd64 GOLANG_ARCH_arm=armv6l GOLANG_ARCH=GOLANG_ARCH_${ARCH} \
GOPATH=/go PATH=/go/bin:/usr/local/go/bin:${PATH} SHELL=/bin/bash
ENV DOCKER_URL_amd64=https://get.docker.com/builds/Linux/x86_64/docker-1.10.3 \
DOCKER_URL_arm=https://github.com/rancher/docker/releases/download/v1.10.3-ros1/docker-1.10.3_arm \
DOCKER_URL=DOCKER_URL_${ARCH}
RUN wget -O - ${!DOCKER_URL} > /usr/bin/docker && chmod +x /usr/bin/docker
RUN wget -O - https://storage.googleapis.com/golang/go1.7.1.linux-${!GOLANG_ARCH}.tar.gz | tar -xzf - -C /usr/local && \
go get github.com/rancher/trash && go get github.com/golang/lint/golint
ENV DAPPER_SOURCE /go/src/github.com/rancher/go-rancher/
ENV DAPPER_OUTPUT ./bin
ENV DAPPER_DOCKER_SOCKET true
ENV TRASH_CACHE ${DAPPER_SOURCE}/.trash-cache
ENV HOME ${DAPPER_SOURCE}
WORKDIR ${DAPPER_SOURCE}
ENTRYPOINT ["./scripts/entry"]
CMD ["ci"]
-23
View File
@@ -1,23 +0,0 @@
TARGETS := $(shell ls scripts)
.dapper:
@echo Downloading dapper
@curl -sL https://releases.rancher.com/dapper/latest/dapper-`uname -s`-`uname -m` > .dapper.tmp
@@chmod +x .dapper.tmp
@./.dapper.tmp -v
@mv .dapper.tmp .dapper
$(TARGETS): .dapper
./.dapper $@
trash: .dapper
./.dapper -m bind trash
trash-keep: .dapper
./.dapper -m bind trash -k
deps: trash
.DEFAULT_GOAL := ci
.PHONY: $(TARGETS)
-55
View File
@@ -1,55 +0,0 @@
# Go Bindings for Rancher API
# Generating Code
First, you must have a master version of Rancher running. The best way to do this is:
```sh
docker run -p 8080:8080 -d rancher/server:master
```
Once Rancher is running, you can run the gen-schema.sh script:
```sh
./scripts/gen-schema.sh http://<docker host ip>:8080
# The default url is http://localhost:8080, so if rancher/server is listening on localhost, you can omit the url:
./scripts/gen-schema.sh
```
This will add, remove, and modify go files appropriately. Submit a PR that includes *all* these changes.
## Important caveats
1. If you are running on macOS, you must have gnu-sed installed as sed for this to work properly.
2. If you are running against cattle that is running out of an IDE and you don't have go-machine-service running (you probably don't), you'll see a number of unexpected removed or modified files like `generated_host.go` `generated_machine.go` and `generated_*config.go`.
# Building
```sh
godep go build ./client
```
# Tests
```sh
godep go test ./client
```
# Contact
For bugs, questions, comments, corrections, suggestions, etc., open an issue in
[rancher/rancher](//github.com/rancher/rancher/issues) with a title starting with `[go-rancher] `.
Or just [click here](//github.com/rancher/rancher/issues/new?title=%5Bgo-rancher%5D%20) to create a new issue.
# License
Copyright (c) 2014-2015 [Rancher Labs, Inc.](http://rancher.com)
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](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.
@@ -1,79 +0,0 @@
package client
const (
ADD_REMOVE_LOAD_BALANCER_SERVICE_LINK_INPUT_TYPE = "addRemoveLoadBalancerServiceLinkInput"
)
type AddRemoveLoadBalancerServiceLinkInput struct {
Resource
ServiceLink LoadBalancerServiceLink `json:"serviceLink,omitempty" yaml:"service_link,omitempty"`
}
type AddRemoveLoadBalancerServiceLinkInputCollection struct {
Collection
Data []AddRemoveLoadBalancerServiceLinkInput `json:"data,omitempty"`
client *AddRemoveLoadBalancerServiceLinkInputClient
}
type AddRemoveLoadBalancerServiceLinkInputClient struct {
rancherClient *RancherClient
}
type AddRemoveLoadBalancerServiceLinkInputOperations interface {
List(opts *ListOpts) (*AddRemoveLoadBalancerServiceLinkInputCollection, error)
Create(opts *AddRemoveLoadBalancerServiceLinkInput) (*AddRemoveLoadBalancerServiceLinkInput, error)
Update(existing *AddRemoveLoadBalancerServiceLinkInput, updates interface{}) (*AddRemoveLoadBalancerServiceLinkInput, error)
ById(id string) (*AddRemoveLoadBalancerServiceLinkInput, error)
Delete(container *AddRemoveLoadBalancerServiceLinkInput) error
}
func newAddRemoveLoadBalancerServiceLinkInputClient(rancherClient *RancherClient) *AddRemoveLoadBalancerServiceLinkInputClient {
return &AddRemoveLoadBalancerServiceLinkInputClient{
rancherClient: rancherClient,
}
}
func (c *AddRemoveLoadBalancerServiceLinkInputClient) Create(container *AddRemoveLoadBalancerServiceLinkInput) (*AddRemoveLoadBalancerServiceLinkInput, error) {
resp := &AddRemoveLoadBalancerServiceLinkInput{}
err := c.rancherClient.doCreate(ADD_REMOVE_LOAD_BALANCER_SERVICE_LINK_INPUT_TYPE, container, resp)
return resp, err
}
func (c *AddRemoveLoadBalancerServiceLinkInputClient) Update(existing *AddRemoveLoadBalancerServiceLinkInput, updates interface{}) (*AddRemoveLoadBalancerServiceLinkInput, error) {
resp := &AddRemoveLoadBalancerServiceLinkInput{}
err := c.rancherClient.doUpdate(ADD_REMOVE_LOAD_BALANCER_SERVICE_LINK_INPUT_TYPE, &existing.Resource, updates, resp)
return resp, err
}
func (c *AddRemoveLoadBalancerServiceLinkInputClient) List(opts *ListOpts) (*AddRemoveLoadBalancerServiceLinkInputCollection, error) {
resp := &AddRemoveLoadBalancerServiceLinkInputCollection{}
err := c.rancherClient.doList(ADD_REMOVE_LOAD_BALANCER_SERVICE_LINK_INPUT_TYPE, opts, resp)
resp.client = c
return resp, err
}
func (cc *AddRemoveLoadBalancerServiceLinkInputCollection) Next() (*AddRemoveLoadBalancerServiceLinkInputCollection, error) {
if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" {
resp := &AddRemoveLoadBalancerServiceLinkInputCollection{}
err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp)
resp.client = cc.client
return resp, err
}
return nil, nil
}
func (c *AddRemoveLoadBalancerServiceLinkInputClient) ById(id string) (*AddRemoveLoadBalancerServiceLinkInput, error) {
resp := &AddRemoveLoadBalancerServiceLinkInput{}
err := c.rancherClient.doById(ADD_REMOVE_LOAD_BALANCER_SERVICE_LINK_INPUT_TYPE, id, resp)
if apiError, ok := err.(*ApiError); ok {
if apiError.StatusCode == 404 {
return nil, nil
}
}
return resp, err
}
func (c *AddRemoveLoadBalancerServiceLinkInputClient) Delete(container *AddRemoveLoadBalancerServiceLinkInput) error {
return c.rancherClient.doResourceDelete(ADD_REMOVE_LOAD_BALANCER_SERVICE_LINK_INPUT_TYPE, &container.Resource)
}
-129
View File
@@ -1,129 +0,0 @@
package client
const (
DYNAMIC_SCHEMA_TYPE = "dynamicSchema"
)
type DynamicSchema struct {
Resource
AccountId string `json:"accountId,omitempty" yaml:"account_id,omitempty"`
Created string `json:"created,omitempty" yaml:"created,omitempty"`
Data map[string]interface{} `json:"data,omitempty" yaml:"data,omitempty"`
Definition string `json:"definition,omitempty" yaml:"definition,omitempty"`
Description string `json:"description,omitempty" yaml:"description,omitempty"`
Kind string `json:"kind,omitempty" yaml:"kind,omitempty"`
Name string `json:"name,omitempty" yaml:"name,omitempty"`
Parent string `json:"parent,omitempty" yaml:"parent,omitempty"`
Removed string `json:"removed,omitempty" yaml:"removed,omitempty"`
Roles []string `json:"roles,omitempty" yaml:"roles,omitempty"`
State string `json:"state,omitempty" yaml:"state,omitempty"`
Transitioning string `json:"transitioning,omitempty" yaml:"transitioning,omitempty"`
TransitioningMessage string `json:"transitioningMessage,omitempty" yaml:"transitioning_message,omitempty"`
TransitioningProgress int64 `json:"transitioningProgress,omitempty" yaml:"transitioning_progress,omitempty"`
Uuid string `json:"uuid,omitempty" yaml:"uuid,omitempty"`
}
type DynamicSchemaCollection struct {
Collection
Data []DynamicSchema `json:"data,omitempty"`
client *DynamicSchemaClient
}
type DynamicSchemaClient struct {
rancherClient *RancherClient
}
type DynamicSchemaOperations interface {
List(opts *ListOpts) (*DynamicSchemaCollection, error)
Create(opts *DynamicSchema) (*DynamicSchema, error)
Update(existing *DynamicSchema, updates interface{}) (*DynamicSchema, error)
ById(id string) (*DynamicSchema, error)
Delete(container *DynamicSchema) error
ActionCreate(*DynamicSchema) (*DynamicSchema, error)
ActionRemove(*DynamicSchema) (*DynamicSchema, error)
}
func newDynamicSchemaClient(rancherClient *RancherClient) *DynamicSchemaClient {
return &DynamicSchemaClient{
rancherClient: rancherClient,
}
}
func (c *DynamicSchemaClient) Create(container *DynamicSchema) (*DynamicSchema, error) {
resp := &DynamicSchema{}
err := c.rancherClient.doCreate(DYNAMIC_SCHEMA_TYPE, container, resp)
return resp, err
}
func (c *DynamicSchemaClient) Update(existing *DynamicSchema, updates interface{}) (*DynamicSchema, error) {
resp := &DynamicSchema{}
err := c.rancherClient.doUpdate(DYNAMIC_SCHEMA_TYPE, &existing.Resource, updates, resp)
return resp, err
}
func (c *DynamicSchemaClient) List(opts *ListOpts) (*DynamicSchemaCollection, error) {
resp := &DynamicSchemaCollection{}
err := c.rancherClient.doList(DYNAMIC_SCHEMA_TYPE, opts, resp)
resp.client = c
return resp, err
}
func (cc *DynamicSchemaCollection) Next() (*DynamicSchemaCollection, error) {
if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" {
resp := &DynamicSchemaCollection{}
err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp)
resp.client = cc.client
return resp, err
}
return nil, nil
}
func (c *DynamicSchemaClient) ById(id string) (*DynamicSchema, error) {
resp := &DynamicSchema{}
err := c.rancherClient.doById(DYNAMIC_SCHEMA_TYPE, id, resp)
if apiError, ok := err.(*ApiError); ok {
if apiError.StatusCode == 404 {
return nil, nil
}
}
return resp, err
}
func (c *DynamicSchemaClient) Delete(container *DynamicSchema) error {
return c.rancherClient.doResourceDelete(DYNAMIC_SCHEMA_TYPE, &container.Resource)
}
func (c *DynamicSchemaClient) ActionCreate(resource *DynamicSchema) (*DynamicSchema, error) {
resp := &DynamicSchema{}
err := c.rancherClient.doAction(DYNAMIC_SCHEMA_TYPE, "create", &resource.Resource, nil, resp)
return resp, err
}
func (c *DynamicSchemaClient) ActionRemove(resource *DynamicSchema) (*DynamicSchema, error) {
resp := &DynamicSchema{}
err := c.rancherClient.doAction(DYNAMIC_SCHEMA_TYPE, "remove", &resource.Resource, nil, resp)
return resp, err
}
-264
View File
@@ -1,264 +0,0 @@
package client
const (
ENVIRONMENT_TYPE = "environment"
)
type Environment struct {
Resource
AccountId string `json:"accountId,omitempty" yaml:"account_id,omitempty"`
Created string `json:"created,omitempty" yaml:"created,omitempty"`
Data map[string]interface{} `json:"data,omitempty" yaml:"data,omitempty"`
Description string `json:"description,omitempty" yaml:"description,omitempty"`
DockerCompose string `json:"dockerCompose,omitempty" yaml:"docker_compose,omitempty"`
Environment map[string]interface{} `json:"environment,omitempty" yaml:"environment,omitempty"`
ExternalId string `json:"externalId,omitempty" yaml:"external_id,omitempty"`
HealthState string `json:"healthState,omitempty" yaml:"health_state,omitempty"`
Kind string `json:"kind,omitempty" yaml:"kind,omitempty"`
Name string `json:"name,omitempty" yaml:"name,omitempty"`
Outputs map[string]interface{} `json:"outputs,omitempty" yaml:"outputs,omitempty"`
PreviousEnvironment map[string]interface{} `json:"previousEnvironment,omitempty" yaml:"previous_environment,omitempty"`
PreviousExternalId string `json:"previousExternalId,omitempty" yaml:"previous_external_id,omitempty"`
RancherCompose string `json:"rancherCompose,omitempty" yaml:"rancher_compose,omitempty"`
RemoveTime string `json:"removeTime,omitempty" yaml:"remove_time,omitempty"`
Removed string `json:"removed,omitempty" yaml:"removed,omitempty"`
StartOnCreate bool `json:"startOnCreate,omitempty" yaml:"start_on_create,omitempty"`
State string `json:"state,omitempty" yaml:"state,omitempty"`
Transitioning string `json:"transitioning,omitempty" yaml:"transitioning,omitempty"`
TransitioningMessage string `json:"transitioningMessage,omitempty" yaml:"transitioning_message,omitempty"`
TransitioningProgress int64 `json:"transitioningProgress,omitempty" yaml:"transitioning_progress,omitempty"`
Uuid string `json:"uuid,omitempty" yaml:"uuid,omitempty"`
}
type EnvironmentCollection struct {
Collection
Data []Environment `json:"data,omitempty"`
client *EnvironmentClient
}
type EnvironmentClient struct {
rancherClient *RancherClient
}
type EnvironmentOperations interface {
List(opts *ListOpts) (*EnvironmentCollection, error)
Create(opts *Environment) (*Environment, error)
Update(existing *Environment, updates interface{}) (*Environment, error)
ById(id string) (*Environment, error)
Delete(container *Environment) error
ActionActivateservices(*Environment) (*Environment, error)
ActionAddoutputs(*Environment, *AddOutputsInput) (*Environment, error)
ActionCancelrollback(*Environment) (*Environment, error)
ActionCancelupgrade(*Environment) (*Environment, error)
ActionCreate(*Environment) (*Environment, error)
ActionDeactivateservices(*Environment) (*Environment, error)
ActionError(*Environment) (*Environment, error)
ActionExportconfig(*Environment, *ComposeConfigInput) (*ComposeConfig, error)
ActionFinishupgrade(*Environment) (*Environment, error)
ActionRemove(*Environment) (*Environment, error)
ActionRollback(*Environment) (*Environment, error)
ActionUpdate(*Environment) (*Environment, error)
ActionUpgrade(*Environment, *EnvironmentUpgrade) (*Environment, error)
}
func newEnvironmentClient(rancherClient *RancherClient) *EnvironmentClient {
return &EnvironmentClient{
rancherClient: rancherClient,
}
}
func (c *EnvironmentClient) Create(container *Environment) (*Environment, error) {
resp := &Environment{}
err := c.rancherClient.doCreate(ENVIRONMENT_TYPE, container, resp)
return resp, err
}
func (c *EnvironmentClient) Update(existing *Environment, updates interface{}) (*Environment, error) {
resp := &Environment{}
err := c.rancherClient.doUpdate(ENVIRONMENT_TYPE, &existing.Resource, updates, resp)
return resp, err
}
func (c *EnvironmentClient) List(opts *ListOpts) (*EnvironmentCollection, error) {
resp := &EnvironmentCollection{}
err := c.rancherClient.doList(ENVIRONMENT_TYPE, opts, resp)
resp.client = c
return resp, err
}
func (cc *EnvironmentCollection) Next() (*EnvironmentCollection, error) {
if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" {
resp := &EnvironmentCollection{}
err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp)
resp.client = cc.client
return resp, err
}
return nil, nil
}
func (c *EnvironmentClient) ById(id string) (*Environment, error) {
resp := &Environment{}
err := c.rancherClient.doById(ENVIRONMENT_TYPE, id, resp)
if apiError, ok := err.(*ApiError); ok {
if apiError.StatusCode == 404 {
return nil, nil
}
}
return resp, err
}
func (c *EnvironmentClient) Delete(container *Environment) error {
return c.rancherClient.doResourceDelete(ENVIRONMENT_TYPE, &container.Resource)
}
func (c *EnvironmentClient) ActionActivateservices(resource *Environment) (*Environment, error) {
resp := &Environment{}
err := c.rancherClient.doAction(ENVIRONMENT_TYPE, "activateservices", &resource.Resource, nil, resp)
return resp, err
}
func (c *EnvironmentClient) ActionAddoutputs(resource *Environment, input *AddOutputsInput) (*Environment, error) {
resp := &Environment{}
err := c.rancherClient.doAction(ENVIRONMENT_TYPE, "addoutputs", &resource.Resource, input, resp)
return resp, err
}
func (c *EnvironmentClient) ActionCancelrollback(resource *Environment) (*Environment, error) {
resp := &Environment{}
err := c.rancherClient.doAction(ENVIRONMENT_TYPE, "cancelrollback", &resource.Resource, nil, resp)
return resp, err
}
func (c *EnvironmentClient) ActionCancelupgrade(resource *Environment) (*Environment, error) {
resp := &Environment{}
err := c.rancherClient.doAction(ENVIRONMENT_TYPE, "cancelupgrade", &resource.Resource, nil, resp)
return resp, err
}
func (c *EnvironmentClient) ActionCreate(resource *Environment) (*Environment, error) {
resp := &Environment{}
err := c.rancherClient.doAction(ENVIRONMENT_TYPE, "create", &resource.Resource, nil, resp)
return resp, err
}
func (c *EnvironmentClient) ActionDeactivateservices(resource *Environment) (*Environment, error) {
resp := &Environment{}
err := c.rancherClient.doAction(ENVIRONMENT_TYPE, "deactivateservices", &resource.Resource, nil, resp)
return resp, err
}
func (c *EnvironmentClient) ActionError(resource *Environment) (*Environment, error) {
resp := &Environment{}
err := c.rancherClient.doAction(ENVIRONMENT_TYPE, "error", &resource.Resource, nil, resp)
return resp, err
}
func (c *EnvironmentClient) ActionExportconfig(resource *Environment, input *ComposeConfigInput) (*ComposeConfig, error) {
resp := &ComposeConfig{}
err := c.rancherClient.doAction(ENVIRONMENT_TYPE, "exportconfig", &resource.Resource, input, resp)
return resp, err
}
func (c *EnvironmentClient) ActionFinishupgrade(resource *Environment) (*Environment, error) {
resp := &Environment{}
err := c.rancherClient.doAction(ENVIRONMENT_TYPE, "finishupgrade", &resource.Resource, nil, resp)
return resp, err
}
func (c *EnvironmentClient) ActionRemove(resource *Environment) (*Environment, error) {
resp := &Environment{}
err := c.rancherClient.doAction(ENVIRONMENT_TYPE, "remove", &resource.Resource, nil, resp)
return resp, err
}
func (c *EnvironmentClient) ActionRollback(resource *Environment) (*Environment, error) {
resp := &Environment{}
err := c.rancherClient.doAction(ENVIRONMENT_TYPE, "rollback", &resource.Resource, nil, resp)
return resp, err
}
func (c *EnvironmentClient) ActionUpdate(resource *Environment) (*Environment, error) {
resp := &Environment{}
err := c.rancherClient.doAction(ENVIRONMENT_TYPE, "update", &resource.Resource, nil, resp)
return resp, err
}
func (c *EnvironmentClient) ActionUpgrade(resource *Environment, input *EnvironmentUpgrade) (*Environment, error) {
resp := &Environment{}
err := c.rancherClient.doAction(ENVIRONMENT_TYPE, "upgrade", &resource.Resource, input, resp)
return resp, err
}
@@ -1,85 +0,0 @@
package client
const (
ENVIRONMENT_UPGRADE_TYPE = "environmentUpgrade"
)
type EnvironmentUpgrade struct {
Resource
DockerCompose string `json:"dockerCompose,omitempty" yaml:"docker_compose,omitempty"`
Environment map[string]interface{} `json:"environment,omitempty" yaml:"environment,omitempty"`
ExternalId string `json:"externalId,omitempty" yaml:"external_id,omitempty"`
RancherCompose string `json:"rancherCompose,omitempty" yaml:"rancher_compose,omitempty"`
}
type EnvironmentUpgradeCollection struct {
Collection
Data []EnvironmentUpgrade `json:"data,omitempty"`
client *EnvironmentUpgradeClient
}
type EnvironmentUpgradeClient struct {
rancherClient *RancherClient
}
type EnvironmentUpgradeOperations interface {
List(opts *ListOpts) (*EnvironmentUpgradeCollection, error)
Create(opts *EnvironmentUpgrade) (*EnvironmentUpgrade, error)
Update(existing *EnvironmentUpgrade, updates interface{}) (*EnvironmentUpgrade, error)
ById(id string) (*EnvironmentUpgrade, error)
Delete(container *EnvironmentUpgrade) error
}
func newEnvironmentUpgradeClient(rancherClient *RancherClient) *EnvironmentUpgradeClient {
return &EnvironmentUpgradeClient{
rancherClient: rancherClient,
}
}
func (c *EnvironmentUpgradeClient) Create(container *EnvironmentUpgrade) (*EnvironmentUpgrade, error) {
resp := &EnvironmentUpgrade{}
err := c.rancherClient.doCreate(ENVIRONMENT_UPGRADE_TYPE, container, resp)
return resp, err
}
func (c *EnvironmentUpgradeClient) Update(existing *EnvironmentUpgrade, updates interface{}) (*EnvironmentUpgrade, error) {
resp := &EnvironmentUpgrade{}
err := c.rancherClient.doUpdate(ENVIRONMENT_UPGRADE_TYPE, &existing.Resource, updates, resp)
return resp, err
}
func (c *EnvironmentUpgradeClient) List(opts *ListOpts) (*EnvironmentUpgradeCollection, error) {
resp := &EnvironmentUpgradeCollection{}
err := c.rancherClient.doList(ENVIRONMENT_UPGRADE_TYPE, opts, resp)
resp.client = c
return resp, err
}
func (cc *EnvironmentUpgradeCollection) Next() (*EnvironmentUpgradeCollection, error) {
if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" {
resp := &EnvironmentUpgradeCollection{}
err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp)
resp.client = cc.client
return resp, err
}
return nil, nil
}
func (c *EnvironmentUpgradeClient) ById(id string) (*EnvironmentUpgrade, error) {
resp := &EnvironmentUpgrade{}
err := c.rancherClient.doById(ENVIRONMENT_UPGRADE_TYPE, id, resp)
if apiError, ok := err.(*ApiError); ok {
if apiError.StatusCode == 404 {
return nil, nil
}
}
return resp, err
}
func (c *EnvironmentUpgradeClient) Delete(container *EnvironmentUpgrade) error {
return c.rancherClient.doResourceDelete(ENVIRONMENT_UPGRADE_TYPE, &container.Resource)
}
-93
View File
@@ -1,93 +0,0 @@
package client
const (
GITHUBCONFIG_TYPE = "githubconfig"
)
type Githubconfig struct {
Resource
AccessMode string `json:"accessMode,omitempty" yaml:"access_mode,omitempty"`
AllowedIdentities []interface{} `json:"allowedIdentities,omitempty" yaml:"allowed_identities,omitempty"`
ClientId string `json:"clientId,omitempty" yaml:"client_id,omitempty"`
ClientSecret string `json:"clientSecret,omitempty" yaml:"client_secret,omitempty"`
Enabled bool `json:"enabled,omitempty" yaml:"enabled,omitempty"`
Hostname string `json:"hostname,omitempty" yaml:"hostname,omitempty"`
Name string `json:"name,omitempty" yaml:"name,omitempty"`
Scheme string `json:"scheme,omitempty" yaml:"scheme,omitempty"`
}
type GithubconfigCollection struct {
Collection
Data []Githubconfig `json:"data,omitempty"`
client *GithubconfigClient
}
type GithubconfigClient struct {
rancherClient *RancherClient
}
type GithubconfigOperations interface {
List(opts *ListOpts) (*GithubconfigCollection, error)
Create(opts *Githubconfig) (*Githubconfig, error)
Update(existing *Githubconfig, updates interface{}) (*Githubconfig, error)
ById(id string) (*Githubconfig, error)
Delete(container *Githubconfig) error
}
func newGithubconfigClient(rancherClient *RancherClient) *GithubconfigClient {
return &GithubconfigClient{
rancherClient: rancherClient,
}
}
func (c *GithubconfigClient) Create(container *Githubconfig) (*Githubconfig, error) {
resp := &Githubconfig{}
err := c.rancherClient.doCreate(GITHUBCONFIG_TYPE, container, resp)
return resp, err
}
func (c *GithubconfigClient) Update(existing *Githubconfig, updates interface{}) (*Githubconfig, error) {
resp := &Githubconfig{}
err := c.rancherClient.doUpdate(GITHUBCONFIG_TYPE, &existing.Resource, updates, resp)
return resp, err
}
func (c *GithubconfigClient) List(opts *ListOpts) (*GithubconfigCollection, error) {
resp := &GithubconfigCollection{}
err := c.rancherClient.doList(GITHUBCONFIG_TYPE, opts, resp)
resp.client = c
return resp, err
}
func (cc *GithubconfigCollection) Next() (*GithubconfigCollection, error) {
if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" {
resp := &GithubconfigCollection{}
err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp)
resp.client = cc.client
return resp, err
}
return nil, nil
}
func (c *GithubconfigClient) ById(id string) (*Githubconfig, error) {
resp := &Githubconfig{}
err := c.rancherClient.doById(GITHUBCONFIG_TYPE, id, resp)
if apiError, ok := err.(*ApiError); ok {
if apiError.StatusCode == 404 {
return nil, nil
}
}
return resp, err
}
func (c *GithubconfigClient) Delete(container *Githubconfig) error {
return c.rancherClient.doResourceDelete(GITHUBCONFIG_TYPE, &container.Resource)
}
@@ -1,81 +0,0 @@
package client
const (
HAPROXY_CONFIG_TYPE = "haproxyConfig"
)
type HaproxyConfig struct {
Resource
Defaults string `json:"defaults,omitempty" yaml:"defaults,omitempty"`
Global string `json:"global,omitempty" yaml:"global,omitempty"`
}
type HaproxyConfigCollection struct {
Collection
Data []HaproxyConfig `json:"data,omitempty"`
client *HaproxyConfigClient
}
type HaproxyConfigClient struct {
rancherClient *RancherClient
}
type HaproxyConfigOperations interface {
List(opts *ListOpts) (*HaproxyConfigCollection, error)
Create(opts *HaproxyConfig) (*HaproxyConfig, error)
Update(existing *HaproxyConfig, updates interface{}) (*HaproxyConfig, error)
ById(id string) (*HaproxyConfig, error)
Delete(container *HaproxyConfig) error
}
func newHaproxyConfigClient(rancherClient *RancherClient) *HaproxyConfigClient {
return &HaproxyConfigClient{
rancherClient: rancherClient,
}
}
func (c *HaproxyConfigClient) Create(container *HaproxyConfig) (*HaproxyConfig, error) {
resp := &HaproxyConfig{}
err := c.rancherClient.doCreate(HAPROXY_CONFIG_TYPE, container, resp)
return resp, err
}
func (c *HaproxyConfigClient) Update(existing *HaproxyConfig, updates interface{}) (*HaproxyConfig, error) {
resp := &HaproxyConfig{}
err := c.rancherClient.doUpdate(HAPROXY_CONFIG_TYPE, &existing.Resource, updates, resp)
return resp, err
}
func (c *HaproxyConfigClient) List(opts *ListOpts) (*HaproxyConfigCollection, error) {
resp := &HaproxyConfigCollection{}
err := c.rancherClient.doList(HAPROXY_CONFIG_TYPE, opts, resp)
resp.client = c
return resp, err
}
func (cc *HaproxyConfigCollection) Next() (*HaproxyConfigCollection, error) {
if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" {
resp := &HaproxyConfigCollection{}
err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp)
resp.client = cc.client
return resp, err
}
return nil, nil
}
func (c *HaproxyConfigClient) ById(id string) (*HaproxyConfig, error) {
resp := &HaproxyConfig{}
err := c.rancherClient.doById(HAPROXY_CONFIG_TYPE, id, resp)
if apiError, ok := err.(*ApiError); ok {
if apiError.StatusCode == 404 {
return nil, nil
}
}
return resp, err
}
func (c *HaproxyConfigClient) Delete(container *HaproxyConfig) error {
return c.rancherClient.doResourceDelete(HAPROXY_CONFIG_TYPE, &container.Resource)
}
@@ -1,79 +0,0 @@
package client
const (
IP_ADDRESS_ASSOCIATE_INPUT_TYPE = "ipAddressAssociateInput"
)
type IpAddressAssociateInput struct {
Resource
IpAddressId string `json:"ipAddressId,omitempty" yaml:"ip_address_id,omitempty"`
}
type IpAddressAssociateInputCollection struct {
Collection
Data []IpAddressAssociateInput `json:"data,omitempty"`
client *IpAddressAssociateInputClient
}
type IpAddressAssociateInputClient struct {
rancherClient *RancherClient
}
type IpAddressAssociateInputOperations interface {
List(opts *ListOpts) (*IpAddressAssociateInputCollection, error)
Create(opts *IpAddressAssociateInput) (*IpAddressAssociateInput, error)
Update(existing *IpAddressAssociateInput, updates interface{}) (*IpAddressAssociateInput, error)
ById(id string) (*IpAddressAssociateInput, error)
Delete(container *IpAddressAssociateInput) error
}
func newIpAddressAssociateInputClient(rancherClient *RancherClient) *IpAddressAssociateInputClient {
return &IpAddressAssociateInputClient{
rancherClient: rancherClient,
}
}
func (c *IpAddressAssociateInputClient) Create(container *IpAddressAssociateInput) (*IpAddressAssociateInput, error) {
resp := &IpAddressAssociateInput{}
err := c.rancherClient.doCreate(IP_ADDRESS_ASSOCIATE_INPUT_TYPE, container, resp)
return resp, err
}
func (c *IpAddressAssociateInputClient) Update(existing *IpAddressAssociateInput, updates interface{}) (*IpAddressAssociateInput, error) {
resp := &IpAddressAssociateInput{}
err := c.rancherClient.doUpdate(IP_ADDRESS_ASSOCIATE_INPUT_TYPE, &existing.Resource, updates, resp)
return resp, err
}
func (c *IpAddressAssociateInputClient) List(opts *ListOpts) (*IpAddressAssociateInputCollection, error) {
resp := &IpAddressAssociateInputCollection{}
err := c.rancherClient.doList(IP_ADDRESS_ASSOCIATE_INPUT_TYPE, opts, resp)
resp.client = c
return resp, err
}
func (cc *IpAddressAssociateInputCollection) Next() (*IpAddressAssociateInputCollection, error) {
if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" {
resp := &IpAddressAssociateInputCollection{}
err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp)
resp.client = cc.client
return resp, err
}
return nil, nil
}
func (c *IpAddressAssociateInputClient) ById(id string) (*IpAddressAssociateInput, error) {
resp := &IpAddressAssociateInput{}
err := c.rancherClient.doById(IP_ADDRESS_ASSOCIATE_INPUT_TYPE, id, resp)
if apiError, ok := err.(*ApiError); ok {
if apiError.StatusCode == 404 {
return nil, nil
}
}
return resp, err
}
func (c *IpAddressAssociateInputClient) Delete(container *IpAddressAssociateInput) error {
return c.rancherClient.doResourceDelete(IP_ADDRESS_ASSOCIATE_INPUT_TYPE, &container.Resource)
}
-123
View File
@@ -1,123 +0,0 @@
package client
const (
LDAPCONFIG_TYPE = "ldapconfig"
)
type Ldapconfig struct {
Resource
AccessMode string `json:"accessMode,omitempty" yaml:"access_mode,omitempty"`
AllowedIdentities []interface{} `json:"allowedIdentities,omitempty" yaml:"allowed_identities,omitempty"`
ConnectionTimeout int64 `json:"connectionTimeout,omitempty" yaml:"connection_timeout,omitempty"`
Domain string `json:"domain,omitempty" yaml:"domain,omitempty"`
Enabled bool `json:"enabled,omitempty" yaml:"enabled,omitempty"`
GroupMemberMappingAttribute string `json:"groupMemberMappingAttribute,omitempty" yaml:"group_member_mapping_attribute,omitempty"`
GroupNameField string `json:"groupNameField,omitempty" yaml:"group_name_field,omitempty"`
GroupObjectClass string `json:"groupObjectClass,omitempty" yaml:"group_object_class,omitempty"`
GroupSearchField string `json:"groupSearchField,omitempty" yaml:"group_search_field,omitempty"`
LoginDomain string `json:"loginDomain,omitempty" yaml:"login_domain,omitempty"`
Name string `json:"name,omitempty" yaml:"name,omitempty"`
Port int64 `json:"port,omitempty" yaml:"port,omitempty"`
Server string `json:"server,omitempty" yaml:"server,omitempty"`
ServiceAccountPassword string `json:"serviceAccountPassword,omitempty" yaml:"service_account_password,omitempty"`
ServiceAccountUsername string `json:"serviceAccountUsername,omitempty" yaml:"service_account_username,omitempty"`
Tls bool `json:"tls,omitempty" yaml:"tls,omitempty"`
UserDisabledBitMask int64 `json:"userDisabledBitMask,omitempty" yaml:"user_disabled_bit_mask,omitempty"`
UserEnabledAttribute string `json:"userEnabledAttribute,omitempty" yaml:"user_enabled_attribute,omitempty"`
UserLoginField string `json:"userLoginField,omitempty" yaml:"user_login_field,omitempty"`
UserMemberAttribute string `json:"userMemberAttribute,omitempty" yaml:"user_member_attribute,omitempty"`
UserNameField string `json:"userNameField,omitempty" yaml:"user_name_field,omitempty"`
UserObjectClass string `json:"userObjectClass,omitempty" yaml:"user_object_class,omitempty"`
UserSearchField string `json:"userSearchField,omitempty" yaml:"user_search_field,omitempty"`
}
type LdapconfigCollection struct {
Collection
Data []Ldapconfig `json:"data,omitempty"`
client *LdapconfigClient
}
type LdapconfigClient struct {
rancherClient *RancherClient
}
type LdapconfigOperations interface {
List(opts *ListOpts) (*LdapconfigCollection, error)
Create(opts *Ldapconfig) (*Ldapconfig, error)
Update(existing *Ldapconfig, updates interface{}) (*Ldapconfig, error)
ById(id string) (*Ldapconfig, error)
Delete(container *Ldapconfig) error
}
func newLdapconfigClient(rancherClient *RancherClient) *LdapconfigClient {
return &LdapconfigClient{
rancherClient: rancherClient,
}
}
func (c *LdapconfigClient) Create(container *Ldapconfig) (*Ldapconfig, error) {
resp := &Ldapconfig{}
err := c.rancherClient.doCreate(LDAPCONFIG_TYPE, container, resp)
return resp, err
}
func (c *LdapconfigClient) Update(existing *Ldapconfig, updates interface{}) (*Ldapconfig, error) {
resp := &Ldapconfig{}
err := c.rancherClient.doUpdate(LDAPCONFIG_TYPE, &existing.Resource, updates, resp)
return resp, err
}
func (c *LdapconfigClient) List(opts *ListOpts) (*LdapconfigCollection, error) {
resp := &LdapconfigCollection{}
err := c.rancherClient.doList(LDAPCONFIG_TYPE, opts, resp)
resp.client = c
return resp, err
}
func (cc *LdapconfigCollection) Next() (*LdapconfigCollection, error) {
if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" {
resp := &LdapconfigCollection{}
err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp)
resp.client = cc.client
return resp, err
}
return nil, nil
}
func (c *LdapconfigClient) ById(id string) (*Ldapconfig, error) {
resp := &Ldapconfig{}
err := c.rancherClient.doById(LDAPCONFIG_TYPE, id, resp)
if apiError, ok := err.(*ApiError); ok {
if apiError.StatusCode == 404 {
return nil, nil
}
}
return resp, err
}
func (c *LdapconfigClient) Delete(container *Ldapconfig) error {
return c.rancherClient.doResourceDelete(LDAPCONFIG_TYPE, &container.Resource)
}
@@ -1,91 +0,0 @@
package client
const (
LOAD_BALANCER_APP_COOKIE_STICKINESS_POLICY_TYPE = "loadBalancerAppCookieStickinessPolicy"
)
type LoadBalancerAppCookieStickinessPolicy struct {
Resource
Cookie string `json:"cookie,omitempty" yaml:"cookie,omitempty"`
MaxLength int64 `json:"maxLength,omitempty" yaml:"max_length,omitempty"`
Mode string `json:"mode,omitempty" yaml:"mode,omitempty"`
Name string `json:"name,omitempty" yaml:"name,omitempty"`
Prefix bool `json:"prefix,omitempty" yaml:"prefix,omitempty"`
RequestLearn bool `json:"requestLearn,omitempty" yaml:"request_learn,omitempty"`
Timeout int64 `json:"timeout,omitempty" yaml:"timeout,omitempty"`
}
type LoadBalancerAppCookieStickinessPolicyCollection struct {
Collection
Data []LoadBalancerAppCookieStickinessPolicy `json:"data,omitempty"`
client *LoadBalancerAppCookieStickinessPolicyClient
}
type LoadBalancerAppCookieStickinessPolicyClient struct {
rancherClient *RancherClient
}
type LoadBalancerAppCookieStickinessPolicyOperations interface {
List(opts *ListOpts) (*LoadBalancerAppCookieStickinessPolicyCollection, error)
Create(opts *LoadBalancerAppCookieStickinessPolicy) (*LoadBalancerAppCookieStickinessPolicy, error)
Update(existing *LoadBalancerAppCookieStickinessPolicy, updates interface{}) (*LoadBalancerAppCookieStickinessPolicy, error)
ById(id string) (*LoadBalancerAppCookieStickinessPolicy, error)
Delete(container *LoadBalancerAppCookieStickinessPolicy) error
}
func newLoadBalancerAppCookieStickinessPolicyClient(rancherClient *RancherClient) *LoadBalancerAppCookieStickinessPolicyClient {
return &LoadBalancerAppCookieStickinessPolicyClient{
rancherClient: rancherClient,
}
}
func (c *LoadBalancerAppCookieStickinessPolicyClient) Create(container *LoadBalancerAppCookieStickinessPolicy) (*LoadBalancerAppCookieStickinessPolicy, error) {
resp := &LoadBalancerAppCookieStickinessPolicy{}
err := c.rancherClient.doCreate(LOAD_BALANCER_APP_COOKIE_STICKINESS_POLICY_TYPE, container, resp)
return resp, err
}
func (c *LoadBalancerAppCookieStickinessPolicyClient) Update(existing *LoadBalancerAppCookieStickinessPolicy, updates interface{}) (*LoadBalancerAppCookieStickinessPolicy, error) {
resp := &LoadBalancerAppCookieStickinessPolicy{}
err := c.rancherClient.doUpdate(LOAD_BALANCER_APP_COOKIE_STICKINESS_POLICY_TYPE, &existing.Resource, updates, resp)
return resp, err
}
func (c *LoadBalancerAppCookieStickinessPolicyClient) List(opts *ListOpts) (*LoadBalancerAppCookieStickinessPolicyCollection, error) {
resp := &LoadBalancerAppCookieStickinessPolicyCollection{}
err := c.rancherClient.doList(LOAD_BALANCER_APP_COOKIE_STICKINESS_POLICY_TYPE, opts, resp)
resp.client = c
return resp, err
}
func (cc *LoadBalancerAppCookieStickinessPolicyCollection) Next() (*LoadBalancerAppCookieStickinessPolicyCollection, error) {
if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" {
resp := &LoadBalancerAppCookieStickinessPolicyCollection{}
err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp)
resp.client = cc.client
return resp, err
}
return nil, nil
}
func (c *LoadBalancerAppCookieStickinessPolicyClient) ById(id string) (*LoadBalancerAppCookieStickinessPolicy, error) {
resp := &LoadBalancerAppCookieStickinessPolicy{}
err := c.rancherClient.doById(LOAD_BALANCER_APP_COOKIE_STICKINESS_POLICY_TYPE, id, resp)
if apiError, ok := err.(*ApiError); ok {
if apiError.StatusCode == 404 {
return nil, nil
}
}
return resp, err
}
func (c *LoadBalancerAppCookieStickinessPolicyClient) Delete(container *LoadBalancerAppCookieStickinessPolicy) error {
return c.rancherClient.doResourceDelete(LOAD_BALANCER_APP_COOKIE_STICKINESS_POLICY_TYPE, &container.Resource)
}
@@ -1,81 +0,0 @@
package client
const (
LOAD_BALANCER_CONFIG_TYPE = "loadBalancerConfig"
)
type LoadBalancerConfig struct {
Resource
HaproxyConfig *HaproxyConfig `json:"haproxyConfig,omitempty" yaml:"haproxy_config,omitempty"`
LbCookieStickinessPolicy *LoadBalancerCookieStickinessPolicy `json:"lbCookieStickinessPolicy,omitempty" yaml:"lb_cookie_stickiness_policy,omitempty"`
}
type LoadBalancerConfigCollection struct {
Collection
Data []LoadBalancerConfig `json:"data,omitempty"`
client *LoadBalancerConfigClient
}
type LoadBalancerConfigClient struct {
rancherClient *RancherClient
}
type LoadBalancerConfigOperations interface {
List(opts *ListOpts) (*LoadBalancerConfigCollection, error)
Create(opts *LoadBalancerConfig) (*LoadBalancerConfig, error)
Update(existing *LoadBalancerConfig, updates interface{}) (*LoadBalancerConfig, error)
ById(id string) (*LoadBalancerConfig, error)
Delete(container *LoadBalancerConfig) error
}
func newLoadBalancerConfigClient(rancherClient *RancherClient) *LoadBalancerConfigClient {
return &LoadBalancerConfigClient{
rancherClient: rancherClient,
}
}
func (c *LoadBalancerConfigClient) Create(container *LoadBalancerConfig) (*LoadBalancerConfig, error) {
resp := &LoadBalancerConfig{}
err := c.rancherClient.doCreate(LOAD_BALANCER_CONFIG_TYPE, container, resp)
return resp, err
}
func (c *LoadBalancerConfigClient) Update(existing *LoadBalancerConfig, updates interface{}) (*LoadBalancerConfig, error) {
resp := &LoadBalancerConfig{}
err := c.rancherClient.doUpdate(LOAD_BALANCER_CONFIG_TYPE, &existing.Resource, updates, resp)
return resp, err
}
func (c *LoadBalancerConfigClient) List(opts *ListOpts) (*LoadBalancerConfigCollection, error) {
resp := &LoadBalancerConfigCollection{}
err := c.rancherClient.doList(LOAD_BALANCER_CONFIG_TYPE, opts, resp)
resp.client = c
return resp, err
}
func (cc *LoadBalancerConfigCollection) Next() (*LoadBalancerConfigCollection, error) {
if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" {
resp := &LoadBalancerConfigCollection{}
err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp)
resp.client = cc.client
return resp, err
}
return nil, nil
}
func (c *LoadBalancerConfigClient) ById(id string) (*LoadBalancerConfig, error) {
resp := &LoadBalancerConfig{}
err := c.rancherClient.doById(LOAD_BALANCER_CONFIG_TYPE, id, resp)
if apiError, ok := err.(*ApiError); ok {
if apiError.StatusCode == 404 {
return nil, nil
}
}
return resp, err
}
func (c *LoadBalancerConfigClient) Delete(container *LoadBalancerConfig) error {
return c.rancherClient.doResourceDelete(LOAD_BALANCER_CONFIG_TYPE, &container.Resource)
}
@@ -1,83 +0,0 @@
package client
const (
LOAD_BALANCER_SERVICE_LINK_TYPE = "loadBalancerServiceLink"
)
type LoadBalancerServiceLink struct {
Resource
Ports []string `json:"ports,omitempty" yaml:"ports,omitempty"`
ServiceId string `json:"serviceId,omitempty" yaml:"service_id,omitempty"`
Uuid string `json:"uuid,omitempty" yaml:"uuid,omitempty"`
}
type LoadBalancerServiceLinkCollection struct {
Collection
Data []LoadBalancerServiceLink `json:"data,omitempty"`
client *LoadBalancerServiceLinkClient
}
type LoadBalancerServiceLinkClient struct {
rancherClient *RancherClient
}
type LoadBalancerServiceLinkOperations interface {
List(opts *ListOpts) (*LoadBalancerServiceLinkCollection, error)
Create(opts *LoadBalancerServiceLink) (*LoadBalancerServiceLink, error)
Update(existing *LoadBalancerServiceLink, updates interface{}) (*LoadBalancerServiceLink, error)
ById(id string) (*LoadBalancerServiceLink, error)
Delete(container *LoadBalancerServiceLink) error
}
func newLoadBalancerServiceLinkClient(rancherClient *RancherClient) *LoadBalancerServiceLinkClient {
return &LoadBalancerServiceLinkClient{
rancherClient: rancherClient,
}
}
func (c *LoadBalancerServiceLinkClient) Create(container *LoadBalancerServiceLink) (*LoadBalancerServiceLink, error) {
resp := &LoadBalancerServiceLink{}
err := c.rancherClient.doCreate(LOAD_BALANCER_SERVICE_LINK_TYPE, container, resp)
return resp, err
}
func (c *LoadBalancerServiceLinkClient) Update(existing *LoadBalancerServiceLink, updates interface{}) (*LoadBalancerServiceLink, error) {
resp := &LoadBalancerServiceLink{}
err := c.rancherClient.doUpdate(LOAD_BALANCER_SERVICE_LINK_TYPE, &existing.Resource, updates, resp)
return resp, err
}
func (c *LoadBalancerServiceLinkClient) List(opts *ListOpts) (*LoadBalancerServiceLinkCollection, error) {
resp := &LoadBalancerServiceLinkCollection{}
err := c.rancherClient.doList(LOAD_BALANCER_SERVICE_LINK_TYPE, opts, resp)
resp.client = c
return resp, err
}
func (cc *LoadBalancerServiceLinkCollection) Next() (*LoadBalancerServiceLinkCollection, error) {
if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" {
resp := &LoadBalancerServiceLinkCollection{}
err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp)
resp.client = cc.client
return resp, err
}
return nil, nil
}
func (c *LoadBalancerServiceLinkClient) ById(id string) (*LoadBalancerServiceLink, error) {
resp := &LoadBalancerServiceLink{}
err := c.rancherClient.doById(LOAD_BALANCER_SERVICE_LINK_TYPE, id, resp)
if apiError, ok := err.(*ApiError); ok {
if apiError.StatusCode == 404 {
return nil, nil
}
}
return resp, err
}
func (c *LoadBalancerServiceLinkClient) Delete(container *LoadBalancerServiceLink) error {
return c.rancherClient.doResourceDelete(LOAD_BALANCER_SERVICE_LINK_TYPE, &container.Resource)
}
@@ -1,79 +0,0 @@
package client
const (
SET_LABELS_INPUT_TYPE = "setLabelsInput"
)
type SetLabelsInput struct {
Resource
Labels interface{} `json:"labels,omitempty" yaml:"labels,omitempty"`
}
type SetLabelsInputCollection struct {
Collection
Data []SetLabelsInput `json:"data,omitempty"`
client *SetLabelsInputClient
}
type SetLabelsInputClient struct {
rancherClient *RancherClient
}
type SetLabelsInputOperations interface {
List(opts *ListOpts) (*SetLabelsInputCollection, error)
Create(opts *SetLabelsInput) (*SetLabelsInput, error)
Update(existing *SetLabelsInput, updates interface{}) (*SetLabelsInput, error)
ById(id string) (*SetLabelsInput, error)
Delete(container *SetLabelsInput) error
}
func newSetLabelsInputClient(rancherClient *RancherClient) *SetLabelsInputClient {
return &SetLabelsInputClient{
rancherClient: rancherClient,
}
}
func (c *SetLabelsInputClient) Create(container *SetLabelsInput) (*SetLabelsInput, error) {
resp := &SetLabelsInput{}
err := c.rancherClient.doCreate(SET_LABELS_INPUT_TYPE, container, resp)
return resp, err
}
func (c *SetLabelsInputClient) Update(existing *SetLabelsInput, updates interface{}) (*SetLabelsInput, error) {
resp := &SetLabelsInput{}
err := c.rancherClient.doUpdate(SET_LABELS_INPUT_TYPE, &existing.Resource, updates, resp)
return resp, err
}
func (c *SetLabelsInputClient) List(opts *ListOpts) (*SetLabelsInputCollection, error) {
resp := &SetLabelsInputCollection{}
err := c.rancherClient.doList(SET_LABELS_INPUT_TYPE, opts, resp)
resp.client = c
return resp, err
}
func (cc *SetLabelsInputCollection) Next() (*SetLabelsInputCollection, error) {
if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" {
resp := &SetLabelsInputCollection{}
err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp)
resp.client = cc.client
return resp, err
}
return nil, nil
}
func (c *SetLabelsInputClient) ById(id string) (*SetLabelsInput, error) {
resp := &SetLabelsInput{}
err := c.rancherClient.doById(SET_LABELS_INPUT_TYPE, id, resp)
if apiError, ok := err.(*ApiError); ok {
if apiError.StatusCode == 404 {
return nil, nil
}
}
return resp, err
}
func (c *SetLabelsInputClient) Delete(container *SetLabelsInput) error {
return c.rancherClient.doResourceDelete(SET_LABELS_INPUT_TYPE, &container.Resource)
}
@@ -1,79 +0,0 @@
package client
const (
SET_LOAD_BALANCER_SERVICE_LINKS_INPUT_TYPE = "setLoadBalancerServiceLinksInput"
)
type SetLoadBalancerServiceLinksInput struct {
Resource
ServiceLinks []interface{} `json:"serviceLinks,omitempty" yaml:"service_links,omitempty"`
}
type SetLoadBalancerServiceLinksInputCollection struct {
Collection
Data []SetLoadBalancerServiceLinksInput `json:"data,omitempty"`
client *SetLoadBalancerServiceLinksInputClient
}
type SetLoadBalancerServiceLinksInputClient struct {
rancherClient *RancherClient
}
type SetLoadBalancerServiceLinksInputOperations interface {
List(opts *ListOpts) (*SetLoadBalancerServiceLinksInputCollection, error)
Create(opts *SetLoadBalancerServiceLinksInput) (*SetLoadBalancerServiceLinksInput, error)
Update(existing *SetLoadBalancerServiceLinksInput, updates interface{}) (*SetLoadBalancerServiceLinksInput, error)
ById(id string) (*SetLoadBalancerServiceLinksInput, error)
Delete(container *SetLoadBalancerServiceLinksInput) error
}
func newSetLoadBalancerServiceLinksInputClient(rancherClient *RancherClient) *SetLoadBalancerServiceLinksInputClient {
return &SetLoadBalancerServiceLinksInputClient{
rancherClient: rancherClient,
}
}
func (c *SetLoadBalancerServiceLinksInputClient) Create(container *SetLoadBalancerServiceLinksInput) (*SetLoadBalancerServiceLinksInput, error) {
resp := &SetLoadBalancerServiceLinksInput{}
err := c.rancherClient.doCreate(SET_LOAD_BALANCER_SERVICE_LINKS_INPUT_TYPE, container, resp)
return resp, err
}
func (c *SetLoadBalancerServiceLinksInputClient) Update(existing *SetLoadBalancerServiceLinksInput, updates interface{}) (*SetLoadBalancerServiceLinksInput, error) {
resp := &SetLoadBalancerServiceLinksInput{}
err := c.rancherClient.doUpdate(SET_LOAD_BALANCER_SERVICE_LINKS_INPUT_TYPE, &existing.Resource, updates, resp)
return resp, err
}
func (c *SetLoadBalancerServiceLinksInputClient) List(opts *ListOpts) (*SetLoadBalancerServiceLinksInputCollection, error) {
resp := &SetLoadBalancerServiceLinksInputCollection{}
err := c.rancherClient.doList(SET_LOAD_BALANCER_SERVICE_LINKS_INPUT_TYPE, opts, resp)
resp.client = c
return resp, err
}
func (cc *SetLoadBalancerServiceLinksInputCollection) Next() (*SetLoadBalancerServiceLinksInputCollection, error) {
if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" {
resp := &SetLoadBalancerServiceLinksInputCollection{}
err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp)
resp.client = cc.client
return resp, err
}
return nil, nil
}
func (c *SetLoadBalancerServiceLinksInputClient) ById(id string) (*SetLoadBalancerServiceLinksInput, error) {
resp := &SetLoadBalancerServiceLinksInput{}
err := c.rancherClient.doById(SET_LOAD_BALANCER_SERVICE_LINKS_INPUT_TYPE, id, resp)
if apiError, ok := err.(*ApiError); ok {
if apiError.StatusCode == 404 {
return nil, nil
}
}
return resp, err
}
func (c *SetLoadBalancerServiceLinksInputClient) Delete(container *SetLoadBalancerServiceLinksInput) error {
return c.rancherClient.doResourceDelete(SET_LOAD_BALANCER_SERVICE_LINKS_INPUT_TYPE, &container.Resource)
}
-81
View File
@@ -1,81 +0,0 @@
package client
const (
SUBSCRIBE_TYPE = "subscribe"
)
type Subscribe struct {
Resource
AgentId string `json:"agentId,omitempty" yaml:"agent_id,omitempty"`
EventNames []string `json:"eventNames,omitempty" yaml:"event_names,omitempty"`
}
type SubscribeCollection struct {
Collection
Data []Subscribe `json:"data,omitempty"`
client *SubscribeClient
}
type SubscribeClient struct {
rancherClient *RancherClient
}
type SubscribeOperations interface {
List(opts *ListOpts) (*SubscribeCollection, error)
Create(opts *Subscribe) (*Subscribe, error)
Update(existing *Subscribe, updates interface{}) (*Subscribe, error)
ById(id string) (*Subscribe, error)
Delete(container *Subscribe) error
}
func newSubscribeClient(rancherClient *RancherClient) *SubscribeClient {
return &SubscribeClient{
rancherClient: rancherClient,
}
}
func (c *SubscribeClient) Create(container *Subscribe) (*Subscribe, error) {
resp := &Subscribe{}
err := c.rancherClient.doCreate(SUBSCRIBE_TYPE, container, resp)
return resp, err
}
func (c *SubscribeClient) Update(existing *Subscribe, updates interface{}) (*Subscribe, error) {
resp := &Subscribe{}
err := c.rancherClient.doUpdate(SUBSCRIBE_TYPE, &existing.Resource, updates, resp)
return resp, err
}
func (c *SubscribeClient) List(opts *ListOpts) (*SubscribeCollection, error) {
resp := &SubscribeCollection{}
err := c.rancherClient.doList(SUBSCRIBE_TYPE, opts, resp)
resp.client = c
return resp, err
}
func (cc *SubscribeCollection) Next() (*SubscribeCollection, error) {
if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" {
resp := &SubscribeCollection{}
err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp)
resp.client = cc.client
return resp, err
}
return nil, nil
}
func (c *SubscribeClient) ById(id string) (*Subscribe, error) {
resp := &Subscribe{}
err := c.rancherClient.doById(SUBSCRIBE_TYPE, id, resp)
if apiError, ok := err.(*ApiError); ok {
if apiError.StatusCode == 404 {
return nil, nil
}
}
return resp, err
}
func (c *SubscribeClient) Delete(container *Subscribe) error {
return c.rancherClient.doResourceDelete(SUBSCRIBE_TYPE, &container.Resource)
}
-10
View File
@@ -1,10 +0,0 @@
package main
import (
"fmt"
_ "github.com/rancher/go-rancher/client"
)
func main() {
fmt.Println("I have nothing to do...")
}
-6
View File
@@ -1,6 +0,0 @@
github.com/pkg/errors 1d2e60385a13aaa66134984235061c2f9302520e
github.com/gorilla/context 215affda49addc4c8ef7e2534915df2c8c35c6cd
github.com/gorilla/mux f15e0c49460fd49eebe2bcc8486b05d1bef68d3a
github.com/gorilla/websocket 1551221275a7bd42978745a376b2531f791d88f3
github.com/Sirupsen/logrus 26709e2714106fb8ad40b773b711ebce25b78914
gopkg.in/yaml.v2 a83829b6f1293c91addabc89d0571c246397bbf4
@@ -23,6 +23,9 @@ type RancherBaseClient interface {
Delete(*Resource) error
Reload(*Resource, interface{}) error
Action(string, string, *Resource, interface{}, interface{}) error
GetOpts() *ClientOpts
GetSchemas() *Schemas
GetTypes() map[string]Schema
doGet(string, *ListOpts, interface{}) error
doList(string, *ListOpts, interface{}) error
@@ -2,6 +2,7 @@ package client
import (
"bytes"
"encoding/base64"
"encoding/json"
"fmt"
"io"
@@ -10,6 +11,7 @@ import (
"net/url"
"os"
"regexp"
"strings"
"time"
"github.com/gorilla/websocket"
@@ -22,8 +24,9 @@ const (
)
var (
debug = false
dialer = &websocket.Dialer{}
debug = false
dialer = &websocket.Dialer{}
privateFieldRegex = regexp.MustCompile("^[[:lower:]]")
)
type ClientOpts struct {
@@ -128,7 +131,28 @@ func appendFilters(urlString string, filters map[string]interface{}) (string, er
return u.String(), nil
}
func NormalizeUrl(existingUrl string) (string, error) {
u, err := url.Parse(existingUrl)
if err != nil {
return "", err
}
if u.Path == "" || u.Path == "/" {
u.Path = "v2-beta"
} else if u.Path == "/v1" || strings.HasPrefix(u.Path, "/v1/") {
u.Path = strings.Replace(u.Path, "/v1", "/v2-beta", 1)
}
return u.String(), nil
}
func setupRancherBaseClient(rancherClient *RancherBaseClientImpl, opts *ClientOpts) error {
var err error
opts.Url, err = NormalizeUrl(opts.Url)
if err != nil {
return err
}
if opts.Timeout == 0 {
opts.Timeout = time.Second * 10
}
@@ -238,7 +262,17 @@ func (rancherClient *RancherBaseClientImpl) doDelete(url string) error {
}
func (rancherClient *RancherBaseClientImpl) Websocket(url string, headers map[string][]string) (*websocket.Conn, *http.Response, error) {
return dialer.Dial(url, http.Header(headers))
httpHeaders := http.Header{}
for k, v := range httpHeaders {
httpHeaders[k] = v
}
if rancherClient.Opts != nil {
s := rancherClient.Opts.AccessKey + ":" + rancherClient.Opts.SecretKey
httpHeaders.Add("Authorization", "Basic "+base64.StdEncoding.EncodeToString([]byte(s)))
}
return dialer.Dial(url, http.Header(httpHeaders))
}
func (rancherClient *RancherBaseClientImpl) doGet(url string, opts *ListOpts, respObject interface{}) error {
@@ -566,6 +600,18 @@ func (rancherClient *RancherBaseClientImpl) doAction(schemaType string, action s
return json.Unmarshal(byteContent, respObject)
}
func (rancherClient *RancherBaseClientImpl) GetOpts() *ClientOpts {
return rancherClient.Opts
}
func (rancherClient *RancherBaseClientImpl) GetSchemas() *Schemas {
return rancherClient.Schemas
}
func (rancherClient *RancherBaseClientImpl) GetTypes() map[string]Schema {
return rancherClient.Types
}
func init() {
debug = os.Getenv("RANCHER_CLIENT_DEBUG") == "true"
if debug {
@@ -36,6 +36,8 @@ type Account struct {
TransitioningProgress int64 `json:"transitioningProgress,omitempty" yaml:"transitioning_progress,omitempty"`
Uuid string `json:"uuid,omitempty" yaml:"uuid,omitempty"`
Version string `json:"version,omitempty" yaml:"version,omitempty"`
}
type AccountCollection struct {
@@ -65,9 +67,9 @@ type AccountOperations interface {
ActionRemove(*Account) (*Account, error)
ActionRestore(*Account) (*Account, error)
ActionUpdate(*Account) (*Account, error)
ActionUpgrade(*Account) (*Account, error)
}
func newAccountClient(rancherClient *RancherClient) *AccountClient {
@@ -165,15 +167,6 @@ func (c *AccountClient) ActionRemove(resource *Account) (*Account, error) {
return resp, err
}
func (c *AccountClient) ActionRestore(resource *Account) (*Account, error) {
resp := &Account{}
err := c.rancherClient.doAction(ACCOUNT_TYPE, "restore", &resource.Resource, nil, resp)
return resp, err
}
func (c *AccountClient) ActionUpdate(resource *Account) (*Account, error) {
resp := &Account{}
@@ -182,3 +175,12 @@ func (c *AccountClient) ActionUpdate(resource *Account) (*Account, error) {
return resp, err
}
func (c *AccountClient) ActionUpgrade(resource *Account) (*Account, error) {
resp := &Account{}
err := c.rancherClient.doAction(ACCOUNT_TYPE, "upgrade", &resource.Resource, nil, resp)
return resp, err
}
@@ -63,14 +63,14 @@ type AgentOperations interface {
ActionDisconnect(*Agent) (*Agent, error)
ActionFinishreconnect(*Agent) (*Agent, error)
ActionPurge(*Agent) (*Agent, error)
ActionReconnect(*Agent) (*Agent, error)
ActionRemove(*Agent) (*Agent, error)
ActionRestore(*Agent) (*Agent, error)
ActionUpdate(*Agent) (*Agent, error)
}
@@ -160,6 +160,15 @@ func (c *AgentClient) ActionDisconnect(resource *Agent) (*Agent, error) {
return resp, err
}
func (c *AgentClient) ActionFinishreconnect(resource *Agent) (*Agent, error) {
resp := &Agent{}
err := c.rancherClient.doAction(AGENT_TYPE, "finishreconnect", &resource.Resource, nil, resp)
return resp, err
}
func (c *AgentClient) ActionPurge(resource *Agent) (*Agent, error) {
resp := &Agent{}
@@ -187,15 +196,6 @@ func (c *AgentClient) ActionRemove(resource *Agent) (*Agent, error) {
return resp, err
}
func (c *AgentClient) ActionRestore(resource *Agent) (*Agent, error) {
resp := &Agent{}
err := c.rancherClient.doAction(AGENT_TYPE, "restore", &resource.Resource, nil, resp)
return resp, err
}
func (c *AgentClient) ActionUpdate(resource *Agent) (*Agent, error) {
resp := &Agent{}
@@ -11,16 +11,24 @@ type Amazonec2Config struct {
Ami string `json:"ami,omitempty" yaml:"ami,omitempty"`
BlockDurationMinutes string `json:"blockDurationMinutes,omitempty" yaml:"block_duration_minutes,omitempty"`
DeviceName string `json:"deviceName,omitempty" yaml:"device_name,omitempty"`
Endpoint string `json:"endpoint,omitempty" yaml:"endpoint,omitempty"`
IamInstanceProfile string `json:"iamInstanceProfile,omitempty" yaml:"iam_instance_profile,omitempty"`
InsecureTransport bool `json:"insecureTransport,omitempty" yaml:"insecure_transport,omitempty"`
InstanceType string `json:"instanceType,omitempty" yaml:"instance_type,omitempty"`
KeypairName string `json:"keypairName,omitempty" yaml:"keypair_name,omitempty"`
Monitoring bool `json:"monitoring,omitempty" yaml:"monitoring,omitempty"`
OpenPort []string `json:"openPort,omitempty" yaml:"open_port,omitempty"`
PrivateAddressOnly bool `json:"privateAddressOnly,omitempty" yaml:"private_address_only,omitempty"`
Region string `json:"region,omitempty" yaml:"region,omitempty"`
@@ -51,6 +59,8 @@ type Amazonec2Config struct {
UsePrivateAddress bool `json:"usePrivateAddress,omitempty" yaml:"use_private_address,omitempty"`
Userdata string `json:"userdata,omitempty" yaml:"userdata,omitempty"`
VolumeType string `json:"volumeType,omitempty" yaml:"volume_type,omitempty"`
VpcId string `json:"vpcId,omitempty" yaml:"vpc_id,omitempty"`
@@ -15,6 +15,8 @@ type AzureConfig struct {
CustomData string `json:"customData,omitempty" yaml:"custom_data,omitempty"`
Dns string `json:"dns,omitempty" yaml:"dns,omitempty"`
DockerPort string `json:"dockerPort,omitempty" yaml:"docker_port,omitempty"`
Environment string `json:"environment,omitempty" yaml:"environment,omitempty"`
+79
View File
@@ -0,0 +1,79 @@
package client
const (
BINDING_TYPE = "binding"
)
type Binding struct {
Resource
Services map[string]interface{} `json:"services,omitempty" yaml:"services,omitempty"`
}
type BindingCollection struct {
Collection
Data []Binding `json:"data,omitempty"`
client *BindingClient
}
type BindingClient struct {
rancherClient *RancherClient
}
type BindingOperations interface {
List(opts *ListOpts) (*BindingCollection, error)
Create(opts *Binding) (*Binding, error)
Update(existing *Binding, updates interface{}) (*Binding, error)
ById(id string) (*Binding, error)
Delete(container *Binding) error
}
func newBindingClient(rancherClient *RancherClient) *BindingClient {
return &BindingClient{
rancherClient: rancherClient,
}
}
func (c *BindingClient) Create(container *Binding) (*Binding, error) {
resp := &Binding{}
err := c.rancherClient.doCreate(BINDING_TYPE, container, resp)
return resp, err
}
func (c *BindingClient) Update(existing *Binding, updates interface{}) (*Binding, error) {
resp := &Binding{}
err := c.rancherClient.doUpdate(BINDING_TYPE, &existing.Resource, updates, resp)
return resp, err
}
func (c *BindingClient) List(opts *ListOpts) (*BindingCollection, error) {
resp := &BindingCollection{}
err := c.rancherClient.doList(BINDING_TYPE, opts, resp)
resp.client = c
return resp, err
}
func (cc *BindingCollection) Next() (*BindingCollection, error) {
if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" {
resp := &BindingCollection{}
err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp)
resp.client = cc.client
return resp, err
}
return nil, nil
}
func (c *BindingClient) ById(id string) (*Binding, error) {
resp := &Binding{}
err := c.rancherClient.doById(BINDING_TYPE, id, resp)
if apiError, ok := err.(*ApiError); ok {
if apiError.StatusCode == 404 {
return nil, nil
}
}
return resp, err
}
func (c *BindingClient) Delete(container *Binding) error {
return c.rancherClient.doResourceDelete(BINDING_TYPE, &container.Resource)
}
+93
View File
@@ -0,0 +1,93 @@
package client
const (
CATALOG_TEMPLATE_TYPE = "catalogTemplate"
)
type CatalogTemplate struct {
Resource
Answers map[string]interface{} `json:"answers,omitempty" yaml:"answers,omitempty"`
Binding Binding `json:"binding,omitempty" yaml:"binding,omitempty"`
Description string `json:"description,omitempty" yaml:"description,omitempty"`
DockerCompose string `json:"dockerCompose,omitempty" yaml:"docker_compose,omitempty"`
Name string `json:"name,omitempty" yaml:"name,omitempty"`
RancherCompose string `json:"rancherCompose,omitempty" yaml:"rancher_compose,omitempty"`
TemplateId string `json:"templateId,omitempty" yaml:"template_id,omitempty"`
TemplateVersionId string `json:"templateVersionId,omitempty" yaml:"template_version_id,omitempty"`
}
type CatalogTemplateCollection struct {
Collection
Data []CatalogTemplate `json:"data,omitempty"`
client *CatalogTemplateClient
}
type CatalogTemplateClient struct {
rancherClient *RancherClient
}
type CatalogTemplateOperations interface {
List(opts *ListOpts) (*CatalogTemplateCollection, error)
Create(opts *CatalogTemplate) (*CatalogTemplate, error)
Update(existing *CatalogTemplate, updates interface{}) (*CatalogTemplate, error)
ById(id string) (*CatalogTemplate, error)
Delete(container *CatalogTemplate) error
}
func newCatalogTemplateClient(rancherClient *RancherClient) *CatalogTemplateClient {
return &CatalogTemplateClient{
rancherClient: rancherClient,
}
}
func (c *CatalogTemplateClient) Create(container *CatalogTemplate) (*CatalogTemplate, error) {
resp := &CatalogTemplate{}
err := c.rancherClient.doCreate(CATALOG_TEMPLATE_TYPE, container, resp)
return resp, err
}
func (c *CatalogTemplateClient) Update(existing *CatalogTemplate, updates interface{}) (*CatalogTemplate, error) {
resp := &CatalogTemplate{}
err := c.rancherClient.doUpdate(CATALOG_TEMPLATE_TYPE, &existing.Resource, updates, resp)
return resp, err
}
func (c *CatalogTemplateClient) List(opts *ListOpts) (*CatalogTemplateCollection, error) {
resp := &CatalogTemplateCollection{}
err := c.rancherClient.doList(CATALOG_TEMPLATE_TYPE, opts, resp)
resp.client = c
return resp, err
}
func (cc *CatalogTemplateCollection) Next() (*CatalogTemplateCollection, error) {
if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" {
resp := &CatalogTemplateCollection{}
err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp)
resp.client = cc.client
return resp, err
}
return nil, nil
}
func (c *CatalogTemplateClient) ById(id string) (*CatalogTemplate, error) {
resp := &CatalogTemplate{}
err := c.rancherClient.doById(CATALOG_TEMPLATE_TYPE, id, resp)
if apiError, ok := err.(*ApiError); ok {
if apiError.StatusCode == 404 {
return nil, nil
}
}
return resp, err
}
func (c *CatalogTemplateClient) Delete(container *CatalogTemplate) error {
return c.rancherClient.doResourceDelete(CATALOG_TEMPLATE_TYPE, &container.Resource)
}
@@ -6,7 +6,6 @@ type RancherClient struct {
Account AccountOperations
ActiveSetting ActiveSettingOperations
AddOutputsInput AddOutputsInputOperations
AddRemoveLoadBalancerServiceLinkInput AddRemoveLoadBalancerServiceLinkInputOperations
AddRemoveServiceLinkInput AddRemoveServiceLinkInputOperations
Agent AgentOperations
Amazonec2Config Amazonec2ConfigOperations
@@ -17,9 +16,12 @@ type RancherClient struct {
Backup BackupOperations
BackupTarget BackupTargetOperations
BaseMachineConfig BaseMachineConfigOperations
Binding BindingOperations
BlkioDeviceOption BlkioDeviceOptionOperations
CatalogTemplate CatalogTemplateOperations
Certificate CertificateOperations
ChangeSecretInput ChangeSecretInputOperations
ClusterMembership ClusterMembershipOperations
ComposeConfig ComposeConfigOperations
ComposeConfigInput ComposeConfigInputOperations
ComposeProject ComposeProjectOperations
@@ -34,12 +36,10 @@ type RancherClient struct {
Credential CredentialOperations
Databasechangelog DatabasechangelogOperations
Databasechangeloglock DatabasechangeloglockOperations
DefaultNetwork DefaultNetworkOperations
DigitaloceanConfig DigitaloceanConfigOperations
DnsService DnsServiceOperations
DockerBuild DockerBuildOperations
DynamicSchema DynamicSchemaOperations
Environment EnvironmentOperations
EnvironmentUpgrade EnvironmentUpgradeOperations
ExtensionImplementation ExtensionImplementationOperations
ExtensionPoint ExtensionPointOperations
ExternalDnsEvent ExternalDnsEventOperations
@@ -54,14 +54,14 @@ type RancherClient struct {
ExternalStoragePoolEvent ExternalStoragePoolEventOperations
ExternalVolumeEvent ExternalVolumeEventOperations
FieldDocumentation FieldDocumentationOperations
Githubconfig GithubconfigOperations
GenericObject GenericObjectOperations
HaConfig HaConfigOperations
HaConfigInput HaConfigInputOperations
HaproxyConfig HaproxyConfigOperations
HealthcheckInstanceHostMap HealthcheckInstanceHostMapOperations
Host HostOperations
HostAccess HostAccessOperations
HostApiProxyToken HostApiProxyTokenOperations
HostTemplate HostTemplateOperations
Identity IdentityOperations
Image ImageOperations
InServiceUpgradeStrategy InServiceUpgradeStrategyOperations
@@ -72,35 +72,43 @@ type RancherClient struct {
InstanceLink InstanceLinkOperations
InstanceStop InstanceStopOperations
IpAddress IpAddressOperations
IpAddressAssociateInput IpAddressAssociateInputOperations
KubernetesService KubernetesServiceOperations
KubernetesStack KubernetesStackOperations
KubernetesStackUpgrade KubernetesStackUpgradeOperations
Label LabelOperations
LaunchConfig LaunchConfigOperations
Ldapconfig LdapconfigOperations
LoadBalancerAppCookieStickinessPolicy LoadBalancerAppCookieStickinessPolicyOperations
LoadBalancerConfig LoadBalancerConfigOperations
LbConfig LbConfigOperations
LbTargetConfig LbTargetConfigOperations
LoadBalancerCookieStickinessPolicy LoadBalancerCookieStickinessPolicyOperations
LoadBalancerService LoadBalancerServiceOperations
LoadBalancerServiceLink LoadBalancerServiceLinkOperations
LocalAuthConfig LocalAuthConfigOperations
LogConfig LogConfigOperations
Machine MachineOperations
MachineDriver MachineDriverOperations
Mount MountOperations
MountEntry MountEntryOperations
Network NetworkOperations
NetworkDriver NetworkDriverOperations
NetworkDriverService NetworkDriverServiceOperations
NetworkPolicyRule NetworkPolicyRuleOperations
NetworkPolicyRuleBetween NetworkPolicyRuleBetweenOperations
NetworkPolicyRuleMember NetworkPolicyRuleMemberOperations
NetworkPolicyRuleWithin NetworkPolicyRuleWithinOperations
NfsConfig NfsConfigOperations
Openldapconfig OpenldapconfigOperations
PacketConfig PacketConfigOperations
Password PasswordOperations
PhysicalHost PhysicalHostOperations
Port PortOperations
PortRule PortRuleOperations
ProcessDefinition ProcessDefinitionOperations
ProcessExecution ProcessExecutionOperations
ProcessInstance ProcessInstanceOperations
ProcessPool ProcessPoolOperations
ProcessSummary ProcessSummaryOperations
Project ProjectOperations
ProjectMember ProjectMemberOperations
ProjectTemplate ProjectTemplateOperations
PublicEndpoint PublicEndpointOperations
Publish PublishOperations
PullTask PullTaskOperations
@@ -115,36 +123,48 @@ type RancherClient struct {
RevertToSnapshotInput RevertToSnapshotInputOperations
RollingRestartStrategy RollingRestartStrategyOperations
ScalePolicy ScalePolicyOperations
ScheduledUpgrade ScheduledUpgradeOperations
SecondaryLaunchConfig SecondaryLaunchConfigOperations
Secret SecretOperations
SecretReference SecretReferenceOperations
Service ServiceOperations
ServiceBinding ServiceBindingOperations
ServiceConsumeMap ServiceConsumeMapOperations
ServiceEvent ServiceEventOperations
ServiceExposeMap ServiceExposeMapOperations
ServiceLink ServiceLinkOperations
ServiceLog ServiceLogOperations
ServiceProxy ServiceProxyOperations
ServiceRestart ServiceRestartOperations
ServiceUpgrade ServiceUpgradeOperations
ServiceUpgradeStrategy ServiceUpgradeStrategyOperations
ServicesPortRange ServicesPortRangeOperations
SetLabelsInput SetLabelsInputOperations
SetLoadBalancerServiceLinksInput SetLoadBalancerServiceLinksInputOperations
SetProjectMembersInput SetProjectMembersInputOperations
SetServiceLinksInput SetServiceLinksInputOperations
Setting SettingOperations
Snapshot SnapshotOperations
SnapshotBackupInput SnapshotBackupInputOperations
Stack StackOperations
StackUpgrade StackUpgradeOperations
StateTransition StateTransitionOperations
StatsAccess StatsAccessOperations
StorageDriver StorageDriverOperations
StorageDriverService StorageDriverServiceOperations
StoragePool StoragePoolOperations
Subscribe SubscribeOperations
Subnet SubnetOperations
TargetPortRule TargetPortRuleOperations
Task TaskOperations
TaskInstance TaskInstanceOperations
ToServiceUpgradeStrategy ToServiceUpgradeStrategyOperations
TypeDocumentation TypeDocumentationOperations
Ulimit UlimitOperations
UserPreference UserPreferenceOperations
VirtualMachine VirtualMachineOperations
VirtualMachineDisk VirtualMachineDiskOperations
Volume VolumeOperations
VolumeActivateInput VolumeActivateInputOperations
VolumeSnapshotInput VolumeSnapshotInputOperations
VolumeTemplate VolumeTemplateOperations
}
func constructClient(rancherBaseClient *RancherBaseClientImpl) *RancherClient {
@@ -155,7 +175,6 @@ func constructClient(rancherBaseClient *RancherBaseClientImpl) *RancherClient {
client.Account = newAccountClient(client)
client.ActiveSetting = newActiveSettingClient(client)
client.AddOutputsInput = newAddOutputsInputClient(client)
client.AddRemoveLoadBalancerServiceLinkInput = newAddRemoveLoadBalancerServiceLinkInputClient(client)
client.AddRemoveServiceLinkInput = newAddRemoveServiceLinkInputClient(client)
client.Agent = newAgentClient(client)
client.Amazonec2Config = newAmazonec2ConfigClient(client)
@@ -166,9 +185,12 @@ func constructClient(rancherBaseClient *RancherBaseClientImpl) *RancherClient {
client.Backup = newBackupClient(client)
client.BackupTarget = newBackupTargetClient(client)
client.BaseMachineConfig = newBaseMachineConfigClient(client)
client.Binding = newBindingClient(client)
client.BlkioDeviceOption = newBlkioDeviceOptionClient(client)
client.CatalogTemplate = newCatalogTemplateClient(client)
client.Certificate = newCertificateClient(client)
client.ChangeSecretInput = newChangeSecretInputClient(client)
client.ClusterMembership = newClusterMembershipClient(client)
client.ComposeConfig = newComposeConfigClient(client)
client.ComposeConfigInput = newComposeConfigInputClient(client)
client.ComposeProject = newComposeProjectClient(client)
@@ -183,12 +205,10 @@ func constructClient(rancherBaseClient *RancherBaseClientImpl) *RancherClient {
client.Credential = newCredentialClient(client)
client.Databasechangelog = newDatabasechangelogClient(client)
client.Databasechangeloglock = newDatabasechangeloglockClient(client)
client.DefaultNetwork = newDefaultNetworkClient(client)
client.DigitaloceanConfig = newDigitaloceanConfigClient(client)
client.DnsService = newDnsServiceClient(client)
client.DockerBuild = newDockerBuildClient(client)
client.DynamicSchema = newDynamicSchemaClient(client)
client.Environment = newEnvironmentClient(client)
client.EnvironmentUpgrade = newEnvironmentUpgradeClient(client)
client.ExtensionImplementation = newExtensionImplementationClient(client)
client.ExtensionPoint = newExtensionPointClient(client)
client.ExternalDnsEvent = newExternalDnsEventClient(client)
@@ -203,14 +223,14 @@ func constructClient(rancherBaseClient *RancherBaseClientImpl) *RancherClient {
client.ExternalStoragePoolEvent = newExternalStoragePoolEventClient(client)
client.ExternalVolumeEvent = newExternalVolumeEventClient(client)
client.FieldDocumentation = newFieldDocumentationClient(client)
client.Githubconfig = newGithubconfigClient(client)
client.GenericObject = newGenericObjectClient(client)
client.HaConfig = newHaConfigClient(client)
client.HaConfigInput = newHaConfigInputClient(client)
client.HaproxyConfig = newHaproxyConfigClient(client)
client.HealthcheckInstanceHostMap = newHealthcheckInstanceHostMapClient(client)
client.Host = newHostClient(client)
client.HostAccess = newHostAccessClient(client)
client.HostApiProxyToken = newHostApiProxyTokenClient(client)
client.HostTemplate = newHostTemplateClient(client)
client.Identity = newIdentityClient(client)
client.Image = newImageClient(client)
client.InServiceUpgradeStrategy = newInServiceUpgradeStrategyClient(client)
@@ -221,35 +241,43 @@ func constructClient(rancherBaseClient *RancherBaseClientImpl) *RancherClient {
client.InstanceLink = newInstanceLinkClient(client)
client.InstanceStop = newInstanceStopClient(client)
client.IpAddress = newIpAddressClient(client)
client.IpAddressAssociateInput = newIpAddressAssociateInputClient(client)
client.KubernetesService = newKubernetesServiceClient(client)
client.KubernetesStack = newKubernetesStackClient(client)
client.KubernetesStackUpgrade = newKubernetesStackUpgradeClient(client)
client.Label = newLabelClient(client)
client.LaunchConfig = newLaunchConfigClient(client)
client.Ldapconfig = newLdapconfigClient(client)
client.LoadBalancerAppCookieStickinessPolicy = newLoadBalancerAppCookieStickinessPolicyClient(client)
client.LoadBalancerConfig = newLoadBalancerConfigClient(client)
client.LbConfig = newLbConfigClient(client)
client.LbTargetConfig = newLbTargetConfigClient(client)
client.LoadBalancerCookieStickinessPolicy = newLoadBalancerCookieStickinessPolicyClient(client)
client.LoadBalancerService = newLoadBalancerServiceClient(client)
client.LoadBalancerServiceLink = newLoadBalancerServiceLinkClient(client)
client.LocalAuthConfig = newLocalAuthConfigClient(client)
client.LogConfig = newLogConfigClient(client)
client.Machine = newMachineClient(client)
client.MachineDriver = newMachineDriverClient(client)
client.Mount = newMountClient(client)
client.MountEntry = newMountEntryClient(client)
client.Network = newNetworkClient(client)
client.NetworkDriver = newNetworkDriverClient(client)
client.NetworkDriverService = newNetworkDriverServiceClient(client)
client.NetworkPolicyRule = newNetworkPolicyRuleClient(client)
client.NetworkPolicyRuleBetween = newNetworkPolicyRuleBetweenClient(client)
client.NetworkPolicyRuleMember = newNetworkPolicyRuleMemberClient(client)
client.NetworkPolicyRuleWithin = newNetworkPolicyRuleWithinClient(client)
client.NfsConfig = newNfsConfigClient(client)
client.Openldapconfig = newOpenldapconfigClient(client)
client.PacketConfig = newPacketConfigClient(client)
client.Password = newPasswordClient(client)
client.PhysicalHost = newPhysicalHostClient(client)
client.Port = newPortClient(client)
client.PortRule = newPortRuleClient(client)
client.ProcessDefinition = newProcessDefinitionClient(client)
client.ProcessExecution = newProcessExecutionClient(client)
client.ProcessInstance = newProcessInstanceClient(client)
client.ProcessPool = newProcessPoolClient(client)
client.ProcessSummary = newProcessSummaryClient(client)
client.Project = newProjectClient(client)
client.ProjectMember = newProjectMemberClient(client)
client.ProjectTemplate = newProjectTemplateClient(client)
client.PublicEndpoint = newPublicEndpointClient(client)
client.Publish = newPublishClient(client)
client.PullTask = newPullTaskClient(client)
@@ -264,36 +292,48 @@ func constructClient(rancherBaseClient *RancherBaseClientImpl) *RancherClient {
client.RevertToSnapshotInput = newRevertToSnapshotInputClient(client)
client.RollingRestartStrategy = newRollingRestartStrategyClient(client)
client.ScalePolicy = newScalePolicyClient(client)
client.ScheduledUpgrade = newScheduledUpgradeClient(client)
client.SecondaryLaunchConfig = newSecondaryLaunchConfigClient(client)
client.Secret = newSecretClient(client)
client.SecretReference = newSecretReferenceClient(client)
client.Service = newServiceClient(client)
client.ServiceBinding = newServiceBindingClient(client)
client.ServiceConsumeMap = newServiceConsumeMapClient(client)
client.ServiceEvent = newServiceEventClient(client)
client.ServiceExposeMap = newServiceExposeMapClient(client)
client.ServiceLink = newServiceLinkClient(client)
client.ServiceLog = newServiceLogClient(client)
client.ServiceProxy = newServiceProxyClient(client)
client.ServiceRestart = newServiceRestartClient(client)
client.ServiceUpgrade = newServiceUpgradeClient(client)
client.ServiceUpgradeStrategy = newServiceUpgradeStrategyClient(client)
client.ServicesPortRange = newServicesPortRangeClient(client)
client.SetLabelsInput = newSetLabelsInputClient(client)
client.SetLoadBalancerServiceLinksInput = newSetLoadBalancerServiceLinksInputClient(client)
client.SetProjectMembersInput = newSetProjectMembersInputClient(client)
client.SetServiceLinksInput = newSetServiceLinksInputClient(client)
client.Setting = newSettingClient(client)
client.Snapshot = newSnapshotClient(client)
client.SnapshotBackupInput = newSnapshotBackupInputClient(client)
client.Stack = newStackClient(client)
client.StackUpgrade = newStackUpgradeClient(client)
client.StateTransition = newStateTransitionClient(client)
client.StatsAccess = newStatsAccessClient(client)
client.StorageDriver = newStorageDriverClient(client)
client.StorageDriverService = newStorageDriverServiceClient(client)
client.StoragePool = newStoragePoolClient(client)
client.Subscribe = newSubscribeClient(client)
client.Subnet = newSubnetClient(client)
client.TargetPortRule = newTargetPortRuleClient(client)
client.Task = newTaskClient(client)
client.TaskInstance = newTaskInstanceClient(client)
client.ToServiceUpgradeStrategy = newToServiceUpgradeStrategyClient(client)
client.TypeDocumentation = newTypeDocumentationClient(client)
client.Ulimit = newUlimitClient(client)
client.UserPreference = newUserPreferenceClient(client)
client.VirtualMachine = newVirtualMachineClient(client)
client.VirtualMachineDisk = newVirtualMachineDiskClient(client)
client.Volume = newVolumeClient(client)
client.VolumeActivateInput = newVolumeActivateInputClient(client)
client.VolumeSnapshotInput = newVolumeSnapshotInputClient(client)
client.VolumeTemplate = newVolumeTemplateClient(client)
return client
}
@@ -0,0 +1,87 @@
package client
const (
CLUSTER_MEMBERSHIP_TYPE = "clusterMembership"
)
type ClusterMembership struct {
Resource
Clustered bool `json:"clustered,omitempty" yaml:"clustered,omitempty"`
Config string `json:"config,omitempty" yaml:"config,omitempty"`
Heartbeat int64 `json:"heartbeat,omitempty" yaml:"heartbeat,omitempty"`
Name string `json:"name,omitempty" yaml:"name,omitempty"`
Uuid string `json:"uuid,omitempty" yaml:"uuid,omitempty"`
}
type ClusterMembershipCollection struct {
Collection
Data []ClusterMembership `json:"data,omitempty"`
client *ClusterMembershipClient
}
type ClusterMembershipClient struct {
rancherClient *RancherClient
}
type ClusterMembershipOperations interface {
List(opts *ListOpts) (*ClusterMembershipCollection, error)
Create(opts *ClusterMembership) (*ClusterMembership, error)
Update(existing *ClusterMembership, updates interface{}) (*ClusterMembership, error)
ById(id string) (*ClusterMembership, error)
Delete(container *ClusterMembership) error
}
func newClusterMembershipClient(rancherClient *RancherClient) *ClusterMembershipClient {
return &ClusterMembershipClient{
rancherClient: rancherClient,
}
}
func (c *ClusterMembershipClient) Create(container *ClusterMembership) (*ClusterMembership, error) {
resp := &ClusterMembership{}
err := c.rancherClient.doCreate(CLUSTER_MEMBERSHIP_TYPE, container, resp)
return resp, err
}
func (c *ClusterMembershipClient) Update(existing *ClusterMembership, updates interface{}) (*ClusterMembership, error) {
resp := &ClusterMembership{}
err := c.rancherClient.doUpdate(CLUSTER_MEMBERSHIP_TYPE, &existing.Resource, updates, resp)
return resp, err
}
func (c *ClusterMembershipClient) List(opts *ListOpts) (*ClusterMembershipCollection, error) {
resp := &ClusterMembershipCollection{}
err := c.rancherClient.doList(CLUSTER_MEMBERSHIP_TYPE, opts, resp)
resp.client = c
return resp, err
}
func (cc *ClusterMembershipCollection) Next() (*ClusterMembershipCollection, error) {
if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" {
resp := &ClusterMembershipCollection{}
err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp)
resp.client = cc.client
return resp, err
}
return nil, nil
}
func (c *ClusterMembershipClient) ById(id string) (*ClusterMembership, error) {
resp := &ClusterMembership{}
err := c.rancherClient.doById(CLUSTER_MEMBERSHIP_TYPE, id, resp)
if apiError, ok := err.(*ApiError); ok {
if apiError.StatusCode == 404 {
return nil, nil
}
}
return resp, err
}
func (c *ClusterMembershipClient) Delete(container *ClusterMembership) error {
return c.rancherClient.doResourceDelete(CLUSTER_MEMBERSHIP_TYPE, &container.Resource)
}
@@ -9,6 +9,10 @@ type ComposeProject struct {
AccountId string `json:"accountId,omitempty" yaml:"account_id,omitempty"`
Answers map[string]interface{} `json:"answers,omitempty" yaml:"answers,omitempty"`
Binding *Binding `json:"binding,omitempty" yaml:"binding,omitempty"`
Created string `json:"created,omitempty" yaml:"created,omitempty"`
Data map[string]interface{} `json:"data,omitempty" yaml:"data,omitempty"`
@@ -19,6 +23,8 @@ type ComposeProject struct {
ExternalId string `json:"externalId,omitempty" yaml:"external_id,omitempty"`
Group string `json:"group,omitempty" yaml:"group,omitempty"`
HealthState string `json:"healthState,omitempty" yaml:"health_state,omitempty"`
Kind string `json:"kind,omitempty" yaml:"kind,omitempty"`
@@ -33,8 +39,12 @@ type ComposeProject struct {
Removed string `json:"removed,omitempty" yaml:"removed,omitempty"`
ServiceIds []string `json:"serviceIds,omitempty" yaml:"service_ids,omitempty"`
State string `json:"state,omitempty" yaml:"state,omitempty"`
System bool `json:"system,omitempty" yaml:"system,omitempty"`
Templates map[string]interface{} `json:"templates,omitempty" yaml:"templates,omitempty"`
Transitioning string `json:"transitioning,omitempty" yaml:"transitioning,omitempty"`
@@ -63,19 +73,17 @@ type ComposeProjectOperations interface {
ById(id string) (*ComposeProject, error)
Delete(container *ComposeProject) error
ActionCancelrollback(*ComposeProject) (*Environment, error)
ActionCancelupgrade(*ComposeProject) (*Stack, error)
ActionCancelupgrade(*ComposeProject) (*Environment, error)
ActionCreate(*ComposeProject) (*Stack, error)
ActionCreate(*ComposeProject) (*Environment, error)
ActionError(*ComposeProject) (*Stack, error)
ActionError(*ComposeProject) (*Environment, error)
ActionFinishupgrade(*ComposeProject) (*Stack, error)
ActionFinishupgrade(*ComposeProject) (*Environment, error)
ActionRemove(*ComposeProject) (*Stack, error)
ActionRemove(*ComposeProject) (*Environment, error)
ActionRollback(*ComposeProject) (*Environment, error)
ActionRollback(*ComposeProject) (*Stack, error)
}
func newComposeProjectClient(rancherClient *RancherClient) *ComposeProjectClient {
@@ -128,63 +136,54 @@ func (c *ComposeProjectClient) Delete(container *ComposeProject) error {
return c.rancherClient.doResourceDelete(COMPOSE_PROJECT_TYPE, &container.Resource)
}
func (c *ComposeProjectClient) ActionCancelrollback(resource *ComposeProject) (*Environment, error) {
func (c *ComposeProjectClient) ActionCancelupgrade(resource *ComposeProject) (*Stack, error) {
resp := &Environment{}
err := c.rancherClient.doAction(COMPOSE_PROJECT_TYPE, "cancelrollback", &resource.Resource, nil, resp)
return resp, err
}
func (c *ComposeProjectClient) ActionCancelupgrade(resource *ComposeProject) (*Environment, error) {
resp := &Environment{}
resp := &Stack{}
err := c.rancherClient.doAction(COMPOSE_PROJECT_TYPE, "cancelupgrade", &resource.Resource, nil, resp)
return resp, err
}
func (c *ComposeProjectClient) ActionCreate(resource *ComposeProject) (*Environment, error) {
func (c *ComposeProjectClient) ActionCreate(resource *ComposeProject) (*Stack, error) {
resp := &Environment{}
resp := &Stack{}
err := c.rancherClient.doAction(COMPOSE_PROJECT_TYPE, "create", &resource.Resource, nil, resp)
return resp, err
}
func (c *ComposeProjectClient) ActionError(resource *ComposeProject) (*Environment, error) {
func (c *ComposeProjectClient) ActionError(resource *ComposeProject) (*Stack, error) {
resp := &Environment{}
resp := &Stack{}
err := c.rancherClient.doAction(COMPOSE_PROJECT_TYPE, "error", &resource.Resource, nil, resp)
return resp, err
}
func (c *ComposeProjectClient) ActionFinishupgrade(resource *ComposeProject) (*Environment, error) {
func (c *ComposeProjectClient) ActionFinishupgrade(resource *ComposeProject) (*Stack, error) {
resp := &Environment{}
resp := &Stack{}
err := c.rancherClient.doAction(COMPOSE_PROJECT_TYPE, "finishupgrade", &resource.Resource, nil, resp)
return resp, err
}
func (c *ComposeProjectClient) ActionRemove(resource *ComposeProject) (*Environment, error) {
func (c *ComposeProjectClient) ActionRemove(resource *ComposeProject) (*Stack, error) {
resp := &Environment{}
resp := &Stack{}
err := c.rancherClient.doAction(COMPOSE_PROJECT_TYPE, "remove", &resource.Resource, nil, resp)
return resp, err
}
func (c *ComposeProjectClient) ActionRollback(resource *ComposeProject) (*Environment, error) {
func (c *ComposeProjectClient) ActionRollback(resource *ComposeProject) (*Stack, error) {
resp := &Environment{}
resp := &Stack{}
err := c.rancherClient.doAction(COMPOSE_PROJECT_TYPE, "rollback", &resource.Resource, nil, resp)
@@ -17,21 +17,23 @@ type ComposeService struct {
Description string `json:"description,omitempty" yaml:"description,omitempty"`
EnvironmentId string `json:"environmentId,omitempty" yaml:"environment_id,omitempty"`
ExternalId string `json:"externalId,omitempty" yaml:"external_id,omitempty"`
Fqdn string `json:"fqdn,omitempty" yaml:"fqdn,omitempty"`
HealthState string `json:"healthState,omitempty" yaml:"health_state,omitempty"`
InstanceIds []string `json:"instanceIds,omitempty" yaml:"instance_ids,omitempty"`
Kind string `json:"kind,omitempty" yaml:"kind,omitempty"`
LaunchConfig *LaunchConfig `json:"launchConfig,omitempty" yaml:"launch_config,omitempty"`
LinkedServices map[string]interface{} `json:"linkedServices,omitempty" yaml:"linked_services,omitempty"`
Name string `json:"name,omitempty" yaml:"name,omitempty"`
PublicEndpoints []interface{} `json:"publicEndpoints,omitempty" yaml:"public_endpoints,omitempty"`
PublicEndpoints []PublicEndpoint `json:"publicEndpoints,omitempty" yaml:"public_endpoints,omitempty"`
RemoveTime string `json:"removeTime,omitempty" yaml:"remove_time,omitempty"`
@@ -45,10 +47,14 @@ type ComposeService struct {
SelectorLink string `json:"selectorLink,omitempty" yaml:"selector_link,omitempty"`
StackId string `json:"stackId,omitempty" yaml:"stack_id,omitempty"`
StartOnCreate bool `json:"startOnCreate,omitempty" yaml:"start_on_create,omitempty"`
State string `json:"state,omitempty" yaml:"state,omitempty"`
System bool `json:"system,omitempty" yaml:"system,omitempty"`
Transitioning string `json:"transitioning,omitempty" yaml:"transitioning,omitempty"`
TransitioningMessage string `json:"transitioningMessage,omitempty" yaml:"transitioning_message,omitempty"`
@@ -79,10 +85,10 @@ type ComposeServiceOperations interface {
ActionActivate(*ComposeService) (*Service, error)
ActionCancelrollback(*ComposeService) (*Service, error)
ActionCancelupgrade(*ComposeService) (*Service, error)
ActionContinueupgrade(*ComposeService) (*Service, error)
ActionCreate(*ComposeService) (*Service, error)
ActionFinishupgrade(*ComposeService) (*Service, error)
@@ -151,15 +157,6 @@ func (c *ComposeServiceClient) ActionActivate(resource *ComposeService) (*Servic
return resp, err
}
func (c *ComposeServiceClient) ActionCancelrollback(resource *ComposeService) (*Service, error) {
resp := &Service{}
err := c.rancherClient.doAction(COMPOSE_SERVICE_TYPE, "cancelrollback", &resource.Resource, nil, resp)
return resp, err
}
func (c *ComposeServiceClient) ActionCancelupgrade(resource *ComposeService) (*Service, error) {
resp := &Service{}
@@ -169,6 +166,15 @@ func (c *ComposeServiceClient) ActionCancelupgrade(resource *ComposeService) (*S
return resp, err
}
func (c *ComposeServiceClient) ActionContinueupgrade(resource *ComposeService) (*Service, error) {
resp := &Service{}
err := c.rancherClient.doAction(COMPOSE_SERVICE_TYPE, "continueupgrade", &resource.Resource, nil, resp)
return resp, err
}
func (c *ComposeServiceClient) ActionCreate(resource *ComposeService) (*Service, error) {
resp := &Service{}
@@ -15,18 +15,36 @@ type Container struct {
BlkioDeviceOptions map[string]interface{} `json:"blkioDeviceOptions,omitempty" yaml:"blkio_device_options,omitempty"`
BlkioWeight int64 `json:"blkioWeight,omitempty" yaml:"blkio_weight,omitempty"`
Build *DockerBuild `json:"build,omitempty" yaml:"build,omitempty"`
CapAdd []string `json:"capAdd,omitempty" yaml:"cap_add,omitempty"`
CapDrop []string `json:"capDrop,omitempty" yaml:"cap_drop,omitempty"`
CgroupParent string `json:"cgroupParent,omitempty" yaml:"cgroup_parent,omitempty"`
Command []string `json:"command,omitempty" yaml:"command,omitempty"`
Count int64 `json:"count,omitempty" yaml:"count,omitempty"`
CpuCount int64 `json:"cpuCount,omitempty" yaml:"cpu_count,omitempty"`
CpuPercent int64 `json:"cpuPercent,omitempty" yaml:"cpu_percent,omitempty"`
CpuPeriod int64 `json:"cpuPeriod,omitempty" yaml:"cpu_period,omitempty"`
CpuQuota int64 `json:"cpuQuota,omitempty" yaml:"cpu_quota,omitempty"`
CpuRealtimePeriod int64 `json:"cpuRealtimePeriod,omitempty" yaml:"cpu_realtime_period,omitempty"`
CpuRealtimeRuntime int64 `json:"cpuRealtimeRuntime,omitempty" yaml:"cpu_realtime_runtime,omitempty"`
CpuSet string `json:"cpuSet,omitempty" yaml:"cpu_set,omitempty"`
CpuSetMems string `json:"cpuSetMems,omitempty" yaml:"cpu_set_mems,omitempty"`
CpuShares int64 `json:"cpuShares,omitempty" yaml:"cpu_shares,omitempty"`
CreateIndex int64 `json:"createIndex,omitempty" yaml:"create_index,omitempty"`
@@ -47,8 +65,12 @@ type Container struct {
Devices []string `json:"devices,omitempty" yaml:"devices,omitempty"`
DiskQuota int64 `json:"diskQuota,omitempty" yaml:"disk_quota,omitempty"`
Dns []string `json:"dns,omitempty" yaml:"dns,omitempty"`
DnsOpt []string `json:"dnsOpt,omitempty" yaml:"dns_opt,omitempty"`
DnsSearch []string `json:"dnsSearch,omitempty" yaml:"dns_search,omitempty"`
DomainName string `json:"domainName,omitempty" yaml:"domain_name,omitempty"`
@@ -65,10 +87,20 @@ type Container struct {
FirstRunning string `json:"firstRunning,omitempty" yaml:"first_running,omitempty"`
GroupAdd []string `json:"groupAdd,omitempty" yaml:"group_add,omitempty"`
HealthCheck *InstanceHealthCheck `json:"healthCheck,omitempty" yaml:"health_check,omitempty"`
HealthCmd []string `json:"healthCmd,omitempty" yaml:"health_cmd,omitempty"`
HealthInterval int64 `json:"healthInterval,omitempty" yaml:"health_interval,omitempty"`
HealthRetries int64 `json:"healthRetries,omitempty" yaml:"health_retries,omitempty"`
HealthState string `json:"healthState,omitempty" yaml:"health_state,omitempty"`
HealthTimeout int64 `json:"healthTimeout,omitempty" yaml:"health_timeout,omitempty"`
HostId string `json:"hostId,omitempty" yaml:"host_id,omitempty"`
Hostname string `json:"hostname,omitempty" yaml:"hostname,omitempty"`
@@ -77,6 +109,22 @@ type Container struct {
InstanceLinks map[string]interface{} `json:"instanceLinks,omitempty" yaml:"instance_links,omitempty"`
InstanceTriggeredStop string `json:"instanceTriggeredStop,omitempty" yaml:"instance_triggered_stop,omitempty"`
IoMaximumBandwidth int64 `json:"ioMaximumBandwidth,omitempty" yaml:"io_maximum_bandwidth,omitempty"`
IoMaximumIOps int64 `json:"ioMaximumIOps,omitempty" yaml:"io_maximum_iops,omitempty"`
Ip string `json:"ip,omitempty" yaml:"ip,omitempty"`
Ip6 string `json:"ip6,omitempty" yaml:"ip6,omitempty"`
IpcMode string `json:"ipcMode,omitempty" yaml:"ipc_mode,omitempty"`
Isolation string `json:"isolation,omitempty" yaml:"isolation,omitempty"`
KernelMemory int64 `json:"kernelMemory,omitempty" yaml:"kernel_memory,omitempty"`
Kind string `json:"kind,omitempty" yaml:"kind,omitempty"`
Labels map[string]interface{} `json:"labels,omitempty" yaml:"labels,omitempty"`
@@ -87,24 +135,42 @@ type Container struct {
Memory int64 `json:"memory,omitempty" yaml:"memory,omitempty"`
MemoryReservation int64 `json:"memoryReservation,omitempty" yaml:"memory_reservation,omitempty"`
MemorySwap int64 `json:"memorySwap,omitempty" yaml:"memory_swap,omitempty"`
MemorySwappiness int64 `json:"memorySwappiness,omitempty" yaml:"memory_swappiness,omitempty"`
MilliCpuReservation int64 `json:"milliCpuReservation,omitempty" yaml:"milli_cpu_reservation,omitempty"`
Mounts []MountEntry `json:"mounts,omitempty" yaml:"mounts,omitempty"`
Name string `json:"name,omitempty" yaml:"name,omitempty"`
NativeContainer bool `json:"nativeContainer,omitempty" yaml:"native_container,omitempty"`
NetAlias []string `json:"netAlias,omitempty" yaml:"net_alias,omitempty"`
NetworkContainerId string `json:"networkContainerId,omitempty" yaml:"network_container_id,omitempty"`
NetworkIds []string `json:"networkIds,omitempty" yaml:"network_ids,omitempty"`
NetworkMode string `json:"networkMode,omitempty" yaml:"network_mode,omitempty"`
OomKillDisable bool `json:"oomKillDisable,omitempty" yaml:"oom_kill_disable,omitempty"`
OomScoreAdj int64 `json:"oomScoreAdj,omitempty" yaml:"oom_score_adj,omitempty"`
PidMode string `json:"pidMode,omitempty" yaml:"pid_mode,omitempty"`
PidsLimit int64 `json:"pidsLimit,omitempty" yaml:"pids_limit,omitempty"`
Ports []string `json:"ports,omitempty" yaml:"ports,omitempty"`
PrimaryIpAddress string `json:"primaryIpAddress,omitempty" yaml:"primary_ip_address,omitempty"`
PrimaryNetworkId string `json:"primaryNetworkId,omitempty" yaml:"primary_network_id,omitempty"`
Privileged bool `json:"privileged,omitempty" yaml:"privileged,omitempty"`
PublishAllPorts bool `json:"publishAllPorts,omitempty" yaml:"publish_all_ports,omitempty"`
@@ -121,8 +187,20 @@ type Container struct {
RestartPolicy *RestartPolicy `json:"restartPolicy,omitempty" yaml:"restart_policy,omitempty"`
RunInit bool `json:"runInit,omitempty" yaml:"run_init,omitempty"`
Secrets []SecretReference `json:"secrets,omitempty" yaml:"secrets,omitempty"`
SecurityOpt []string `json:"securityOpt,omitempty" yaml:"security_opt,omitempty"`
ServiceId string `json:"serviceId,omitempty" yaml:"service_id,omitempty"`
ServiceIds []string `json:"serviceIds,omitempty" yaml:"service_ids,omitempty"`
ShmSize int64 `json:"shmSize,omitempty" yaml:"shm_size,omitempty"`
StackId string `json:"stackId,omitempty" yaml:"stack_id,omitempty"`
StartCount int64 `json:"startCount,omitempty" yaml:"start_count,omitempty"`
StartOnCreate bool `json:"startOnCreate,omitempty" yaml:"start_on_create,omitempty"`
@@ -131,7 +209,17 @@ type Container struct {
StdinOpen bool `json:"stdinOpen,omitempty" yaml:"stdin_open,omitempty"`
SystemContainer string `json:"systemContainer,omitempty" yaml:"system_container,omitempty"`
StopSignal string `json:"stopSignal,omitempty" yaml:"stop_signal,omitempty"`
StopTimeout int64 `json:"stopTimeout,omitempty" yaml:"stop_timeout,omitempty"`
StorageOpt map[string]interface{} `json:"storageOpt,omitempty" yaml:"storage_opt,omitempty"`
Sysctls map[string]interface{} `json:"sysctls,omitempty" yaml:"sysctls,omitempty"`
System bool `json:"system,omitempty" yaml:"system,omitempty"`
Tmpfs map[string]interface{} `json:"tmpfs,omitempty" yaml:"tmpfs,omitempty"`
Token string `json:"token,omitempty" yaml:"token,omitempty"`
@@ -143,8 +231,16 @@ type Container struct {
Tty bool `json:"tty,omitempty" yaml:"tty,omitempty"`
Ulimits []Ulimit `json:"ulimits,omitempty" yaml:"ulimits,omitempty"`
User string `json:"user,omitempty" yaml:"user,omitempty"`
UserPorts []string `json:"userPorts,omitempty" yaml:"user_ports,omitempty"`
UsernsMode string `json:"usernsMode,omitempty" yaml:"userns_mode,omitempty"`
Uts string `json:"uts,omitempty" yaml:"uts,omitempty"`
Uuid string `json:"uuid,omitempty" yaml:"uuid,omitempty"`
Version string `json:"version,omitempty" yaml:"version,omitempty"`
@@ -195,10 +291,6 @@ type ContainerOperations interface {
ActionRestart(*Container) (*Instance, error)
ActionRestore(*Container) (*Instance, error)
ActionSetlabels(*Container, *SetLabelsInput) (*Container, error)
ActionStart(*Container) (*Instance, error)
ActionStop(*Container, *InstanceStop) (*Instance, error)
@@ -370,24 +462,6 @@ func (c *ContainerClient) ActionRestart(resource *Container) (*Instance, error)
return resp, err
}
func (c *ContainerClient) ActionRestore(resource *Container) (*Instance, error) {
resp := &Instance{}
err := c.rancherClient.doAction(CONTAINER_TYPE, "restore", &resource.Resource, nil, resp)
return resp, err
}
func (c *ContainerClient) ActionSetlabels(resource *Container, input *SetLabelsInput) (*Container, error) {
resp := &Container{}
err := c.rancherClient.doAction(CONTAINER_TYPE, "setlabels", &resource.Resource, input, resp)
return resp, err
}
func (c *ContainerClient) ActionStart(resource *Container) (*Instance, error) {
resp := &Instance{}
+183
View File
@@ -0,0 +1,183 @@
package client
const (
DEFAULT_NETWORK_TYPE = "defaultNetwork"
)
type DefaultNetwork struct {
Resource
AccountId string `json:"accountId,omitempty" yaml:"account_id,omitempty"`
Created string `json:"created,omitempty" yaml:"created,omitempty"`
Data map[string]interface{} `json:"data,omitempty" yaml:"data,omitempty"`
DefaultPolicyAction string `json:"defaultPolicyAction,omitempty" yaml:"default_policy_action,omitempty"`
Description string `json:"description,omitempty" yaml:"description,omitempty"`
Dns []string `json:"dns,omitempty" yaml:"dns,omitempty"`
DnsSearch []string `json:"dnsSearch,omitempty" yaml:"dns_search,omitempty"`
HostPorts bool `json:"hostPorts,omitempty" yaml:"host_ports,omitempty"`
Kind string `json:"kind,omitempty" yaml:"kind,omitempty"`
Metadata map[string]interface{} `json:"metadata,omitempty" yaml:"metadata,omitempty"`
Name string `json:"name,omitempty" yaml:"name,omitempty"`
Policy []NetworkPolicyRule `json:"policy,omitempty" yaml:"policy,omitempty"`
RemoveTime string `json:"removeTime,omitempty" yaml:"remove_time,omitempty"`
Removed string `json:"removed,omitempty" yaml:"removed,omitempty"`
State string `json:"state,omitempty" yaml:"state,omitempty"`
Subnets []Subnet `json:"subnets,omitempty" yaml:"subnets,omitempty"`
Transitioning string `json:"transitioning,omitempty" yaml:"transitioning,omitempty"`
TransitioningMessage string `json:"transitioningMessage,omitempty" yaml:"transitioning_message,omitempty"`
TransitioningProgress int64 `json:"transitioningProgress,omitempty" yaml:"transitioning_progress,omitempty"`
Uuid string `json:"uuid,omitempty" yaml:"uuid,omitempty"`
}
type DefaultNetworkCollection struct {
Collection
Data []DefaultNetwork `json:"data,omitempty"`
client *DefaultNetworkClient
}
type DefaultNetworkClient struct {
rancherClient *RancherClient
}
type DefaultNetworkOperations interface {
List(opts *ListOpts) (*DefaultNetworkCollection, error)
Create(opts *DefaultNetwork) (*DefaultNetwork, error)
Update(existing *DefaultNetwork, updates interface{}) (*DefaultNetwork, error)
ById(id string) (*DefaultNetwork, error)
Delete(container *DefaultNetwork) error
ActionActivate(*DefaultNetwork) (*Network, error)
ActionCreate(*DefaultNetwork) (*Network, error)
ActionDeactivate(*DefaultNetwork) (*Network, error)
ActionPurge(*DefaultNetwork) (*Network, error)
ActionRemove(*DefaultNetwork) (*Network, error)
ActionUpdate(*DefaultNetwork) (*Network, error)
}
func newDefaultNetworkClient(rancherClient *RancherClient) *DefaultNetworkClient {
return &DefaultNetworkClient{
rancherClient: rancherClient,
}
}
func (c *DefaultNetworkClient) Create(container *DefaultNetwork) (*DefaultNetwork, error) {
resp := &DefaultNetwork{}
err := c.rancherClient.doCreate(DEFAULT_NETWORK_TYPE, container, resp)
return resp, err
}
func (c *DefaultNetworkClient) Update(existing *DefaultNetwork, updates interface{}) (*DefaultNetwork, error) {
resp := &DefaultNetwork{}
err := c.rancherClient.doUpdate(DEFAULT_NETWORK_TYPE, &existing.Resource, updates, resp)
return resp, err
}
func (c *DefaultNetworkClient) List(opts *ListOpts) (*DefaultNetworkCollection, error) {
resp := &DefaultNetworkCollection{}
err := c.rancherClient.doList(DEFAULT_NETWORK_TYPE, opts, resp)
resp.client = c
return resp, err
}
func (cc *DefaultNetworkCollection) Next() (*DefaultNetworkCollection, error) {
if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" {
resp := &DefaultNetworkCollection{}
err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp)
resp.client = cc.client
return resp, err
}
return nil, nil
}
func (c *DefaultNetworkClient) ById(id string) (*DefaultNetwork, error) {
resp := &DefaultNetwork{}
err := c.rancherClient.doById(DEFAULT_NETWORK_TYPE, id, resp)
if apiError, ok := err.(*ApiError); ok {
if apiError.StatusCode == 404 {
return nil, nil
}
}
return resp, err
}
func (c *DefaultNetworkClient) Delete(container *DefaultNetwork) error {
return c.rancherClient.doResourceDelete(DEFAULT_NETWORK_TYPE, &container.Resource)
}
func (c *DefaultNetworkClient) ActionActivate(resource *DefaultNetwork) (*Network, error) {
resp := &Network{}
err := c.rancherClient.doAction(DEFAULT_NETWORK_TYPE, "activate", &resource.Resource, nil, resp)
return resp, err
}
func (c *DefaultNetworkClient) ActionCreate(resource *DefaultNetwork) (*Network, error) {
resp := &Network{}
err := c.rancherClient.doAction(DEFAULT_NETWORK_TYPE, "create", &resource.Resource, nil, resp)
return resp, err
}
func (c *DefaultNetworkClient) ActionDeactivate(resource *DefaultNetwork) (*Network, error) {
resp := &Network{}
err := c.rancherClient.doAction(DEFAULT_NETWORK_TYPE, "deactivate", &resource.Resource, nil, resp)
return resp, err
}
func (c *DefaultNetworkClient) ActionPurge(resource *DefaultNetwork) (*Network, error) {
resp := &Network{}
err := c.rancherClient.doAction(DEFAULT_NETWORK_TYPE, "purge", &resource.Resource, nil, resp)
return resp, err
}
func (c *DefaultNetworkClient) ActionRemove(resource *DefaultNetwork) (*Network, error) {
resp := &Network{}
err := c.rancherClient.doAction(DEFAULT_NETWORK_TYPE, "remove", &resource.Resource, nil, resp)
return resp, err
}
func (c *DefaultNetworkClient) ActionUpdate(resource *DefaultNetwork) (*Network, error) {
resp := &Network{}
err := c.rancherClient.doAction(DEFAULT_NETWORK_TYPE, "update", &resource.Resource, nil, resp)
return resp, err
}
@@ -23,6 +23,8 @@ type DigitaloceanConfig struct {
SshKeyFingerprint string `json:"sshKeyFingerprint,omitempty" yaml:"ssh_key_fingerprint,omitempty"`
SshKeyPath string `json:"sshKeyPath,omitempty" yaml:"ssh_key_path,omitempty"`
SshPort string `json:"sshPort,omitempty" yaml:"ssh_port,omitempty"`
SshUser string `json:"sshUser,omitempty" yaml:"ssh_user,omitempty"`
@@ -17,18 +17,20 @@ type DnsService struct {
Description string `json:"description,omitempty" yaml:"description,omitempty"`
EnvironmentId string `json:"environmentId,omitempty" yaml:"environment_id,omitempty"`
ExternalId string `json:"externalId,omitempty" yaml:"external_id,omitempty"`
Fqdn string `json:"fqdn,omitempty" yaml:"fqdn,omitempty"`
HealthState string `json:"healthState,omitempty" yaml:"health_state,omitempty"`
InstanceIds []string `json:"instanceIds,omitempty" yaml:"instance_ids,omitempty"`
Kind string `json:"kind,omitempty" yaml:"kind,omitempty"`
LaunchConfig *LaunchConfig `json:"launchConfig,omitempty" yaml:"launch_config,omitempty"`
LinkedServices map[string]interface{} `json:"linkedServices,omitempty" yaml:"linked_services,omitempty"`
Metadata map[string]interface{} `json:"metadata,omitempty" yaml:"metadata,omitempty"`
Name string `json:"name,omitempty" yaml:"name,omitempty"`
@@ -41,10 +43,14 @@ type DnsService struct {
SelectorLink string `json:"selectorLink,omitempty" yaml:"selector_link,omitempty"`
StackId string `json:"stackId,omitempty" yaml:"stack_id,omitempty"`
StartOnCreate bool `json:"startOnCreate,omitempty" yaml:"start_on_create,omitempty"`
State string `json:"state,omitempty" yaml:"state,omitempty"`
System bool `json:"system,omitempty" yaml:"system,omitempty"`
Transitioning string `json:"transitioning,omitempty" yaml:"transitioning,omitempty"`
TransitioningMessage string `json:"transitioningMessage,omitempty" yaml:"transitioning_message,omitempty"`
@@ -77,10 +83,10 @@ type DnsServiceOperations interface {
ActionAddservicelink(*DnsService, *AddRemoveServiceLinkInput) (*Service, error)
ActionCancelrollback(*DnsService) (*Service, error)
ActionCancelupgrade(*DnsService) (*Service, error)
ActionContinueupgrade(*DnsService) (*Service, error)
ActionCreate(*DnsService) (*Service, error)
ActionDeactivate(*DnsService) (*Service, error)
@@ -170,15 +176,6 @@ func (c *DnsServiceClient) ActionAddservicelink(resource *DnsService, input *Add
return resp, err
}
func (c *DnsServiceClient) ActionCancelrollback(resource *DnsService) (*Service, error) {
resp := &Service{}
err := c.rancherClient.doAction(DNS_SERVICE_TYPE, "cancelrollback", &resource.Resource, nil, resp)
return resp, err
}
func (c *DnsServiceClient) ActionCancelupgrade(resource *DnsService) (*Service, error) {
resp := &Service{}
@@ -188,6 +185,15 @@ func (c *DnsServiceClient) ActionCancelupgrade(resource *DnsService) (*Service,
return resp, err
}
func (c *DnsServiceClient) ActionContinueupgrade(resource *DnsService) (*Service, error) {
resp := &Service{}
err := c.rancherClient.doAction(DNS_SERVICE_TYPE, "continueupgrade", &resource.Resource, nil, resp)
return resp, err
}
func (c *DnsServiceClient) ActionCreate(resource *DnsService) (*Service, error) {
resp := &Service{}
@@ -9,7 +9,7 @@ type ExtensionPoint struct {
ExcludeSetting string `json:"excludeSetting,omitempty" yaml:"exclude_setting,omitempty"`
Implementations []interface{} `json:"implementations,omitempty" yaml:"implementations,omitempty"`
Implementations []ExtensionImplementation `json:"implementations,omitempty" yaml:"implementations,omitempty"`
IncludeSetting string `json:"includeSetting,omitempty" yaml:"include_setting,omitempty"`
@@ -19,7 +19,7 @@ type ExternalHandler struct {
Priority int64 `json:"priority,omitempty" yaml:"priority,omitempty"`
ProcessConfigs []interface{} `json:"processConfigs,omitempty" yaml:"process_configs,omitempty"`
ProcessConfigs []ExternalHandlerProcessConfig `json:"processConfigs,omitempty" yaml:"process_configs,omitempty"`
RemoveTime string `json:"removeTime,omitempty" yaml:"remove_time,omitempty"`
@@ -67,8 +67,6 @@ type ExternalHandlerOperations interface {
ActionRemove(*ExternalHandler) (*ExternalHandler, error)
ActionRestore(*ExternalHandler) (*ExternalHandler, error)
ActionUpdate(*ExternalHandler) (*ExternalHandler, error)
}
@@ -167,15 +165,6 @@ func (c *ExternalHandlerClient) ActionRemove(resource *ExternalHandler) (*Extern
return resp, err
}
func (c *ExternalHandlerClient) ActionRestore(resource *ExternalHandler) (*ExternalHandler, error) {
resp := &ExternalHandler{}
err := c.rancherClient.doAction(EXTERNAL_HANDLER_TYPE, "restore", &resource.Resource, nil, resp)
return resp, err
}
func (c *ExternalHandlerClient) ActionUpdate(resource *ExternalHandler) (*ExternalHandler, error) {
resp := &ExternalHandler{}
@@ -13,6 +13,8 @@ type ExternalHandlerExternalHandlerProcessMap struct {
Description string `json:"description,omitempty" yaml:"description,omitempty"`
EventName string `json:"eventName,omitempty" yaml:"event_name,omitempty"`
ExternalHandlerId string `json:"externalHandlerId,omitempty" yaml:"external_handler_id,omitempty"`
ExternalHandlerProcessId string `json:"externalHandlerProcessId,omitempty" yaml:"external_handler_process_id,omitempty"`
@@ -65,8 +67,6 @@ type ExternalHandlerExternalHandlerProcessMapOperations interface {
ActionRemove(*ExternalHandlerExternalHandlerProcessMap) (*ExternalHandlerExternalHandlerProcessMap, error)
ActionRestore(*ExternalHandlerExternalHandlerProcessMap) (*ExternalHandlerExternalHandlerProcessMap, error)
ActionUpdate(*ExternalHandlerExternalHandlerProcessMap) (*ExternalHandlerExternalHandlerProcessMap, error)
}
@@ -165,15 +165,6 @@ func (c *ExternalHandlerExternalHandlerProcessMapClient) ActionRemove(resource *
return resp, err
}
func (c *ExternalHandlerExternalHandlerProcessMapClient) ActionRestore(resource *ExternalHandlerExternalHandlerProcessMap) (*ExternalHandlerExternalHandlerProcessMap, error) {
resp := &ExternalHandlerExternalHandlerProcessMap{}
err := c.rancherClient.doAction(EXTERNAL_HANDLER_EXTERNAL_HANDLER_PROCESS_MAP_TYPE, "restore", &resource.Resource, nil, resp)
return resp, err
}
func (c *ExternalHandlerExternalHandlerProcessMapClient) ActionUpdate(resource *ExternalHandlerExternalHandlerProcessMap) (*ExternalHandlerExternalHandlerProcessMap, error) {
resp := &ExternalHandlerExternalHandlerProcessMap{}
@@ -59,8 +59,6 @@ type ExternalHandlerProcessOperations interface {
ActionRemove(*ExternalHandlerProcess) (*ExternalHandlerProcess, error)
ActionRestore(*ExternalHandlerProcess) (*ExternalHandlerProcess, error)
ActionUpdate(*ExternalHandlerProcess) (*ExternalHandlerProcess, error)
}
@@ -159,15 +157,6 @@ func (c *ExternalHandlerProcessClient) ActionRemove(resource *ExternalHandlerPro
return resp, err
}
func (c *ExternalHandlerProcessClient) ActionRestore(resource *ExternalHandlerProcess) (*ExternalHandlerProcess, error) {
resp := &ExternalHandlerProcess{}
err := c.rancherClient.doAction(EXTERNAL_HANDLER_PROCESS_TYPE, "restore", &resource.Resource, nil, resp)
return resp, err
}
func (c *ExternalHandlerProcessClient) ActionUpdate(resource *ExternalHandlerProcess) (*ExternalHandlerProcess, error) {
resp := &ExternalHandlerProcess{}
@@ -15,8 +15,6 @@ type ExternalService struct {
Description string `json:"description,omitempty" yaml:"description,omitempty"`
EnvironmentId string `json:"environmentId,omitempty" yaml:"environment_id,omitempty"`
ExternalId string `json:"externalId,omitempty" yaml:"external_id,omitempty"`
ExternalIpAddresses []string `json:"externalIpAddresses,omitempty" yaml:"external_ip_addresses,omitempty"`
@@ -29,10 +27,14 @@ type ExternalService struct {
Hostname string `json:"hostname,omitempty" yaml:"hostname,omitempty"`
InstanceIds []string `json:"instanceIds,omitempty" yaml:"instance_ids,omitempty"`
Kind string `json:"kind,omitempty" yaml:"kind,omitempty"`
LaunchConfig *LaunchConfig `json:"launchConfig,omitempty" yaml:"launch_config,omitempty"`
LinkedServices map[string]interface{} `json:"linkedServices,omitempty" yaml:"linked_services,omitempty"`
Metadata map[string]interface{} `json:"metadata,omitempty" yaml:"metadata,omitempty"`
Name string `json:"name,omitempty" yaml:"name,omitempty"`
@@ -41,10 +43,14 @@ type ExternalService struct {
Removed string `json:"removed,omitempty" yaml:"removed,omitempty"`
StackId string `json:"stackId,omitempty" yaml:"stack_id,omitempty"`
StartOnCreate bool `json:"startOnCreate,omitempty" yaml:"start_on_create,omitempty"`
State string `json:"state,omitempty" yaml:"state,omitempty"`
System bool `json:"system,omitempty" yaml:"system,omitempty"`
Transitioning string `json:"transitioning,omitempty" yaml:"transitioning,omitempty"`
TransitioningMessage string `json:"transitioningMessage,omitempty" yaml:"transitioning_message,omitempty"`
@@ -75,10 +81,10 @@ type ExternalServiceOperations interface {
ActionActivate(*ExternalService) (*Service, error)
ActionCancelrollback(*ExternalService) (*Service, error)
ActionCancelupgrade(*ExternalService) (*Service, error)
ActionContinueupgrade(*ExternalService) (*Service, error)
ActionCreate(*ExternalService) (*Service, error)
ActionDeactivate(*ExternalService) (*Service, error)
@@ -155,15 +161,6 @@ func (c *ExternalServiceClient) ActionActivate(resource *ExternalService) (*Serv
return resp, err
}
func (c *ExternalServiceClient) ActionCancelrollback(resource *ExternalService) (*Service, error) {
resp := &Service{}
err := c.rancherClient.doAction(EXTERNAL_SERVICE_TYPE, "cancelrollback", &resource.Resource, nil, resp)
return resp, err
}
func (c *ExternalServiceClient) ActionCancelupgrade(resource *ExternalService) (*Service, error) {
resp := &Service{}
@@ -173,6 +170,15 @@ func (c *ExternalServiceClient) ActionCancelupgrade(resource *ExternalService) (
return resp, err
}
func (c *ExternalServiceClient) ActionContinueupgrade(resource *ExternalService) (*Service, error) {
resp := &Service{}
err := c.rancherClient.doAction(EXTERNAL_SERVICE_TYPE, "continueupgrade", &resource.Resource, nil, resp)
return resp, err
}
func (c *ExternalServiceClient) ActionCreate(resource *ExternalService) (*Service, error) {
resp := &Service{}
+129
View File
@@ -0,0 +1,129 @@
package client
const (
GENERIC_OBJECT_TYPE = "genericObject"
)
type GenericObject struct {
Resource
AccountId string `json:"accountId,omitempty" yaml:"account_id,omitempty"`
Created string `json:"created,omitempty" yaml:"created,omitempty"`
Data map[string]interface{} `json:"data,omitempty" yaml:"data,omitempty"`
Description string `json:"description,omitempty" yaml:"description,omitempty"`
Key string `json:"key,omitempty" yaml:"key,omitempty"`
Kind string `json:"kind,omitempty" yaml:"kind,omitempty"`
Name string `json:"name,omitempty" yaml:"name,omitempty"`
RemoveTime string `json:"removeTime,omitempty" yaml:"remove_time,omitempty"`
Removed string `json:"removed,omitempty" yaml:"removed,omitempty"`
ResourceData map[string]interface{} `json:"resourceData,omitempty" yaml:"resource_data,omitempty"`
State string `json:"state,omitempty" yaml:"state,omitempty"`
Transitioning string `json:"transitioning,omitempty" yaml:"transitioning,omitempty"`
TransitioningMessage string `json:"transitioningMessage,omitempty" yaml:"transitioning_message,omitempty"`
TransitioningProgress int64 `json:"transitioningProgress,omitempty" yaml:"transitioning_progress,omitempty"`
Uuid string `json:"uuid,omitempty" yaml:"uuid,omitempty"`
}
type GenericObjectCollection struct {
Collection
Data []GenericObject `json:"data,omitempty"`
client *GenericObjectClient
}
type GenericObjectClient struct {
rancherClient *RancherClient
}
type GenericObjectOperations interface {
List(opts *ListOpts) (*GenericObjectCollection, error)
Create(opts *GenericObject) (*GenericObject, error)
Update(existing *GenericObject, updates interface{}) (*GenericObject, error)
ById(id string) (*GenericObject, error)
Delete(container *GenericObject) error
ActionCreate(*GenericObject) (*GenericObject, error)
ActionRemove(*GenericObject) (*GenericObject, error)
}
func newGenericObjectClient(rancherClient *RancherClient) *GenericObjectClient {
return &GenericObjectClient{
rancherClient: rancherClient,
}
}
func (c *GenericObjectClient) Create(container *GenericObject) (*GenericObject, error) {
resp := &GenericObject{}
err := c.rancherClient.doCreate(GENERIC_OBJECT_TYPE, container, resp)
return resp, err
}
func (c *GenericObjectClient) Update(existing *GenericObject, updates interface{}) (*GenericObject, error) {
resp := &GenericObject{}
err := c.rancherClient.doUpdate(GENERIC_OBJECT_TYPE, &existing.Resource, updates, resp)
return resp, err
}
func (c *GenericObjectClient) List(opts *ListOpts) (*GenericObjectCollection, error) {
resp := &GenericObjectCollection{}
err := c.rancherClient.doList(GENERIC_OBJECT_TYPE, opts, resp)
resp.client = c
return resp, err
}
func (cc *GenericObjectCollection) Next() (*GenericObjectCollection, error) {
if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" {
resp := &GenericObjectCollection{}
err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp)
resp.client = cc.client
return resp, err
}
return nil, nil
}
func (c *GenericObjectClient) ById(id string) (*GenericObject, error) {
resp := &GenericObject{}
err := c.rancherClient.doById(GENERIC_OBJECT_TYPE, id, resp)
if apiError, ok := err.(*ApiError); ok {
if apiError.StatusCode == 404 {
return nil, nil
}
}
return resp, err
}
func (c *GenericObjectClient) Delete(container *GenericObject) error {
return c.rancherClient.doResourceDelete(GENERIC_OBJECT_TYPE, &container.Resource)
}
func (c *GenericObjectClient) ActionCreate(resource *GenericObject) (*GenericObject, error) {
resp := &GenericObject{}
err := c.rancherClient.doAction(GENERIC_OBJECT_TYPE, "create", &resource.Resource, nil, resp)
return resp, err
}
func (c *GenericObjectClient) ActionRemove(resource *GenericObject) (*GenericObject, error) {
resp := &GenericObject{}
err := c.rancherClient.doAction(GENERIC_OBJECT_TYPE, "remove", &resource.Resource, nil, resp)
return resp, err
}
@@ -11,10 +11,20 @@ type Host struct {
AgentId string `json:"agentId,omitempty" yaml:"agent_id,omitempty"`
AgentIpAddress string `json:"agentIpAddress,omitempty" yaml:"agent_ip_address,omitempty"`
AgentState string `json:"agentState,omitempty" yaml:"agent_state,omitempty"`
Amazonec2Config *Amazonec2Config `json:"amazonec2Config,omitempty" yaml:"amazonec2config,omitempty"`
ApiProxy string `json:"apiProxy,omitempty" yaml:"api_proxy,omitempty"`
AuthCertificateAuthority string `json:"authCertificateAuthority,omitempty" yaml:"auth_certificate_authority,omitempty"`
AuthKey string `json:"authKey,omitempty" yaml:"auth_key,omitempty"`
AzureConfig *AzureConfig `json:"azureConfig,omitempty" yaml:"azure_config,omitempty"`
ComputeTotal int64 `json:"computeTotal,omitempty" yaml:"compute_total,omitempty"`
Created string `json:"created,omitempty" yaml:"created,omitempty"`
@@ -23,24 +33,58 @@ type Host struct {
Description string `json:"description,omitempty" yaml:"description,omitempty"`
DigitaloceanConfig *DigitaloceanConfig `json:"digitaloceanConfig,omitempty" yaml:"digitalocean_config,omitempty"`
DockerVersion string `json:"dockerVersion,omitempty" yaml:"docker_version,omitempty"`
Driver string `json:"driver,omitempty" yaml:"driver,omitempty"`
EngineEnv map[string]interface{} `json:"engineEnv,omitempty" yaml:"engine_env,omitempty"`
EngineInsecureRegistry []string `json:"engineInsecureRegistry,omitempty" yaml:"engine_insecure_registry,omitempty"`
EngineInstallUrl string `json:"engineInstallUrl,omitempty" yaml:"engine_install_url,omitempty"`
EngineLabel map[string]interface{} `json:"engineLabel,omitempty" yaml:"engine_label,omitempty"`
EngineOpt map[string]interface{} `json:"engineOpt,omitempty" yaml:"engine_opt,omitempty"`
EngineRegistryMirror []string `json:"engineRegistryMirror,omitempty" yaml:"engine_registry_mirror,omitempty"`
EngineStorageDriver string `json:"engineStorageDriver,omitempty" yaml:"engine_storage_driver,omitempty"`
HostTemplateId string `json:"hostTemplateId,omitempty" yaml:"host_template_id,omitempty"`
Hostname string `json:"hostname,omitempty" yaml:"hostname,omitempty"`
Info interface{} `json:"info,omitempty" yaml:"info,omitempty"`
InstanceIds []string `json:"instanceIds,omitempty" yaml:"instance_ids,omitempty"`
Kind string `json:"kind,omitempty" yaml:"kind,omitempty"`
Labels map[string]interface{} `json:"labels,omitempty" yaml:"labels,omitempty"`
LocalStorageMb int64 `json:"localStorageMb,omitempty" yaml:"local_storage_mb,omitempty"`
Memory int64 `json:"memory,omitempty" yaml:"memory,omitempty"`
MilliCpu int64 `json:"milliCpu,omitempty" yaml:"milli_cpu,omitempty"`
Name string `json:"name,omitempty" yaml:"name,omitempty"`
PacketConfig *PacketConfig `json:"packetConfig,omitempty" yaml:"packet_config,omitempty"`
PhysicalHostId string `json:"physicalHostId,omitempty" yaml:"physical_host_id,omitempty"`
PublicEndpoints []interface{} `json:"publicEndpoints,omitempty" yaml:"public_endpoints,omitempty"`
PublicEndpoints []PublicEndpoint `json:"publicEndpoints,omitempty" yaml:"public_endpoints,omitempty"`
RemoveTime string `json:"removeTime,omitempty" yaml:"remove_time,omitempty"`
Removed string `json:"removed,omitempty" yaml:"removed,omitempty"`
StackId string `json:"stackId,omitempty" yaml:"stack_id,omitempty"`
State string `json:"state,omitempty" yaml:"state,omitempty"`
Transitioning string `json:"transitioning,omitempty" yaml:"transitioning,omitempty"`
@@ -77,12 +121,16 @@ type HostOperations interface {
ActionDockersocket(*Host) (*HostAccess, error)
ActionError(*Host) (*Host, error)
ActionEvacuate(*Host) (*Host, error)
ActionProvision(*Host) (*Host, error)
ActionPurge(*Host) (*Host, error)
ActionRemove(*Host) (*Host, error)
ActionRestore(*Host) (*Host, error)
ActionUpdate(*Host) (*Host, error)
}
@@ -172,6 +220,33 @@ func (c *HostClient) ActionDockersocket(resource *Host) (*HostAccess, error) {
return resp, err
}
func (c *HostClient) ActionError(resource *Host) (*Host, error) {
resp := &Host{}
err := c.rancherClient.doAction(HOST_TYPE, "error", &resource.Resource, nil, resp)
return resp, err
}
func (c *HostClient) ActionEvacuate(resource *Host) (*Host, error) {
resp := &Host{}
err := c.rancherClient.doAction(HOST_TYPE, "evacuate", &resource.Resource, nil, resp)
return resp, err
}
func (c *HostClient) ActionProvision(resource *Host) (*Host, error) {
resp := &Host{}
err := c.rancherClient.doAction(HOST_TYPE, "provision", &resource.Resource, nil, resp)
return resp, err
}
func (c *HostClient) ActionPurge(resource *Host) (*Host, error) {
resp := &Host{}
@@ -190,15 +265,6 @@ func (c *HostClient) ActionRemove(resource *Host) (*Host, error) {
return resp, err
}
func (c *HostClient) ActionRestore(resource *Host) (*Host, error) {
resp := &Host{}
err := c.rancherClient.doAction(HOST_TYPE, "restore", &resource.Resource, nil, resp)
return resp, err
}
func (c *HostClient) ActionUpdate(resource *Host) (*Host, error) {
resp := &Host{}
+133
View File
@@ -0,0 +1,133 @@
package client
const (
HOST_TEMPLATE_TYPE = "hostTemplate"
)
type HostTemplate struct {
Resource
AccountId string `json:"accountId,omitempty" yaml:"account_id,omitempty"`
Created string `json:"created,omitempty" yaml:"created,omitempty"`
Data map[string]interface{} `json:"data,omitempty" yaml:"data,omitempty"`
Description string `json:"description,omitempty" yaml:"description,omitempty"`
Driver string `json:"driver,omitempty" yaml:"driver,omitempty"`
FlavorPrefix string `json:"flavorPrefix,omitempty" yaml:"flavor_prefix,omitempty"`
Kind string `json:"kind,omitempty" yaml:"kind,omitempty"`
Name string `json:"name,omitempty" yaml:"name,omitempty"`
PublicValues map[string]interface{} `json:"publicValues,omitempty" yaml:"public_values,omitempty"`
RemoveTime string `json:"removeTime,omitempty" yaml:"remove_time,omitempty"`
Removed string `json:"removed,omitempty" yaml:"removed,omitempty"`
SecretValues map[string]interface{} `json:"secretValues,omitempty" yaml:"secret_values,omitempty"`
State string `json:"state,omitempty" yaml:"state,omitempty"`
Transitioning string `json:"transitioning,omitempty" yaml:"transitioning,omitempty"`
TransitioningMessage string `json:"transitioningMessage,omitempty" yaml:"transitioning_message,omitempty"`
TransitioningProgress int64 `json:"transitioningProgress,omitempty" yaml:"transitioning_progress,omitempty"`
Uuid string `json:"uuid,omitempty" yaml:"uuid,omitempty"`
}
type HostTemplateCollection struct {
Collection
Data []HostTemplate `json:"data,omitempty"`
client *HostTemplateClient
}
type HostTemplateClient struct {
rancherClient *RancherClient
}
type HostTemplateOperations interface {
List(opts *ListOpts) (*HostTemplateCollection, error)
Create(opts *HostTemplate) (*HostTemplate, error)
Update(existing *HostTemplate, updates interface{}) (*HostTemplate, error)
ById(id string) (*HostTemplate, error)
Delete(container *HostTemplate) error
ActionCreate(*HostTemplate) (*HostTemplate, error)
ActionRemove(*HostTemplate) (*HostTemplate, error)
}
func newHostTemplateClient(rancherClient *RancherClient) *HostTemplateClient {
return &HostTemplateClient{
rancherClient: rancherClient,
}
}
func (c *HostTemplateClient) Create(container *HostTemplate) (*HostTemplate, error) {
resp := &HostTemplate{}
err := c.rancherClient.doCreate(HOST_TEMPLATE_TYPE, container, resp)
return resp, err
}
func (c *HostTemplateClient) Update(existing *HostTemplate, updates interface{}) (*HostTemplate, error) {
resp := &HostTemplate{}
err := c.rancherClient.doUpdate(HOST_TEMPLATE_TYPE, &existing.Resource, updates, resp)
return resp, err
}
func (c *HostTemplateClient) List(opts *ListOpts) (*HostTemplateCollection, error) {
resp := &HostTemplateCollection{}
err := c.rancherClient.doList(HOST_TEMPLATE_TYPE, opts, resp)
resp.client = c
return resp, err
}
func (cc *HostTemplateCollection) Next() (*HostTemplateCollection, error) {
if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" {
resp := &HostTemplateCollection{}
err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp)
resp.client = cc.client
return resp, err
}
return nil, nil
}
func (c *HostTemplateClient) ById(id string) (*HostTemplate, error) {
resp := &HostTemplate{}
err := c.rancherClient.doById(HOST_TEMPLATE_TYPE, id, resp)
if apiError, ok := err.(*ApiError); ok {
if apiError.StatusCode == 404 {
return nil, nil
}
}
return resp, err
}
func (c *HostTemplateClient) Delete(container *HostTemplate) error {
return c.rancherClient.doResourceDelete(HOST_TEMPLATE_TYPE, &container.Resource)
}
func (c *HostTemplateClient) ActionCreate(resource *HostTemplate) (*HostTemplate, error) {
resp := &HostTemplate{}
err := c.rancherClient.doAction(HOST_TEMPLATE_TYPE, "create", &resource.Resource, nil, resp)
return resp, err
}
func (c *HostTemplateClient) ActionRemove(resource *HostTemplate) (*HostTemplate, error) {
resp := &HostTemplate{}
err := c.rancherClient.doAction(HOST_TEMPLATE_TYPE, "remove", &resource.Resource, nil, resp)
return resp, err
}
@@ -24,6 +24,8 @@ type Identity struct {
ProjectId string `json:"projectId,omitempty" yaml:"project_id,omitempty"`
Role string `json:"role,omitempty" yaml:"role,omitempty"`
User bool `json:"user,omitempty" yaml:"user,omitempty"`
}
type IdentityCollection struct {
@@ -61,8 +61,6 @@ type ImageOperations interface {
ActionRemove(*Image) (*Image, error)
ActionRestore(*Image) (*Image, error)
ActionUpdate(*Image) (*Image, error)
}
@@ -161,15 +159,6 @@ func (c *ImageClient) ActionRemove(resource *Image) (*Image, error) {
return resp, err
}
func (c *ImageClient) ActionRestore(resource *Image) (*Image, error) {
resp := &Image{}
err := c.rancherClient.doAction(IMAGE_TYPE, "restore", &resource.Resource, nil, resp)
return resp, err
}
func (c *ImageClient) ActionUpdate(resource *Image) (*Image, error) {
resp := &Image{}
@@ -15,9 +15,9 @@ type InServiceUpgradeStrategy struct {
PreviousLaunchConfig *LaunchConfig `json:"previousLaunchConfig,omitempty" yaml:"previous_launch_config,omitempty"`
PreviousSecondaryLaunchConfigs []interface{} `json:"previousSecondaryLaunchConfigs,omitempty" yaml:"previous_secondary_launch_configs,omitempty"`
PreviousSecondaryLaunchConfigs []SecondaryLaunchConfig `json:"previousSecondaryLaunchConfigs,omitempty" yaml:"previous_secondary_launch_configs,omitempty"`
SecondaryLaunchConfigs []interface{} `json:"secondaryLaunchConfigs,omitempty" yaml:"secondary_launch_configs,omitempty"`
SecondaryLaunchConfigs []SecondaryLaunchConfig `json:"secondaryLaunchConfigs,omitempty" yaml:"secondary_launch_configs,omitempty"`
StartFirst bool `json:"startFirst,omitempty" yaml:"start_first,omitempty"`
}
@@ -73,8 +73,6 @@ type InstanceOperations interface {
ActionRestart(*Instance) (*Instance, error)
ActionRestore(*Instance) (*Instance, error)
ActionStart(*Instance) (*Instance, error)
ActionStop(*Instance, *InstanceStop) (*Instance, error)
@@ -219,15 +217,6 @@ func (c *InstanceClient) ActionRestart(resource *Instance) (*Instance, error) {
return resp, err
}
func (c *InstanceClient) ActionRestore(resource *Instance) (*Instance, error) {
resp := &Instance{}
err := c.rancherClient.doAction(INSTANCE_TYPE, "restore", &resource.Resource, nil, resp)
return resp, err
}
func (c *InstanceClient) ActionStart(resource *Instance) (*Instance, error) {
resp := &Instance{}
@@ -69,8 +69,6 @@ type InstanceLinkOperations interface {
ActionRemove(*InstanceLink) (*InstanceLink, error)
ActionRestore(*InstanceLink) (*InstanceLink, error)
ActionUpdate(*InstanceLink) (*InstanceLink, error)
}
@@ -169,15 +167,6 @@ func (c *InstanceLinkClient) ActionRemove(resource *InstanceLink) (*InstanceLink
return resp, err
}
func (c *InstanceLinkClient) ActionRestore(resource *InstanceLink) (*InstanceLink, error) {
resp := &InstanceLink{}
err := c.rancherClient.doAction(INSTANCE_LINK_TYPE, "restore", &resource.Resource, nil, resp)
return resp, err
}
func (c *InstanceLinkClient) ActionUpdate(resource *InstanceLink) (*InstanceLink, error) {
resp := &InstanceLink{}
@@ -57,6 +57,8 @@ type IpAddressOperations interface {
ActionActivate(*IpAddress) (*IpAddress, error)
ActionAssociate(*IpAddress) (*IpAddress, error)
ActionCreate(*IpAddress) (*IpAddress, error)
ActionDeactivate(*IpAddress) (*IpAddress, error)
@@ -67,8 +69,6 @@ type IpAddressOperations interface {
ActionRemove(*IpAddress) (*IpAddress, error)
ActionRestore(*IpAddress) (*IpAddress, error)
ActionUpdate(*IpAddress) (*IpAddress, error)
}
@@ -131,6 +131,15 @@ func (c *IpAddressClient) ActionActivate(resource *IpAddress) (*IpAddress, error
return resp, err
}
func (c *IpAddressClient) ActionAssociate(resource *IpAddress) (*IpAddress, error) {
resp := &IpAddress{}
err := c.rancherClient.doAction(IP_ADDRESS_TYPE, "associate", &resource.Resource, nil, resp)
return resp, err
}
func (c *IpAddressClient) ActionCreate(resource *IpAddress) (*IpAddress, error) {
resp := &IpAddress{}
@@ -176,15 +185,6 @@ func (c *IpAddressClient) ActionRemove(resource *IpAddress) (*IpAddress, error)
return resp, err
}
func (c *IpAddressClient) ActionRestore(resource *IpAddress) (*IpAddress, error) {
resp := &IpAddress{}
err := c.rancherClient.doAction(IP_ADDRESS_TYPE, "restore", &resource.Resource, nil, resp)
return resp, err
}
func (c *IpAddressClient) ActionUpdate(resource *IpAddress) (*IpAddress, error) {
resp := &IpAddress{}
@@ -15,14 +15,16 @@ type KubernetesService struct {
Description string `json:"description,omitempty" yaml:"description,omitempty"`
EnvironmentId string `json:"environmentId,omitempty" yaml:"environment_id,omitempty"`
ExternalId string `json:"externalId,omitempty" yaml:"external_id,omitempty"`
HealthState string `json:"healthState,omitempty" yaml:"health_state,omitempty"`
InstanceIds []string `json:"instanceIds,omitempty" yaml:"instance_ids,omitempty"`
Kind string `json:"kind,omitempty" yaml:"kind,omitempty"`
LinkedServices map[string]interface{} `json:"linkedServices,omitempty" yaml:"linked_services,omitempty"`
Name string `json:"name,omitempty" yaml:"name,omitempty"`
RemoveTime string `json:"removeTime,omitempty" yaml:"remove_time,omitempty"`
@@ -31,8 +33,12 @@ type KubernetesService struct {
SelectorContainer string `json:"selectorContainer,omitempty" yaml:"selector_container,omitempty"`
StackId string `json:"stackId,omitempty" yaml:"stack_id,omitempty"`
State string `json:"state,omitempty" yaml:"state,omitempty"`
System bool `json:"system,omitempty" yaml:"system,omitempty"`
Template interface{} `json:"template,omitempty" yaml:"template,omitempty"`
Transitioning string `json:"transitioning,omitempty" yaml:"transitioning,omitempty"`
@@ -67,10 +73,10 @@ type KubernetesServiceOperations interface {
ActionAddservicelink(*KubernetesService, *AddRemoveServiceLinkInput) (*Service, error)
ActionCancelrollback(*KubernetesService) (*Service, error)
ActionCancelupgrade(*KubernetesService) (*Service, error)
ActionContinueupgrade(*KubernetesService) (*Service, error)
ActionCreate(*KubernetesService) (*Service, error)
ActionDeactivate(*KubernetesService) (*Service, error)
@@ -160,15 +166,6 @@ func (c *KubernetesServiceClient) ActionAddservicelink(resource *KubernetesServi
return resp, err
}
func (c *KubernetesServiceClient) ActionCancelrollback(resource *KubernetesService) (*Service, error) {
resp := &Service{}
err := c.rancherClient.doAction(KUBERNETES_SERVICE_TYPE, "cancelrollback", &resource.Resource, nil, resp)
return resp, err
}
func (c *KubernetesServiceClient) ActionCancelupgrade(resource *KubernetesService) (*Service, error) {
resp := &Service{}
@@ -178,6 +175,15 @@ func (c *KubernetesServiceClient) ActionCancelupgrade(resource *KubernetesServic
return resp, err
}
func (c *KubernetesServiceClient) ActionContinueupgrade(resource *KubernetesService) (*Service, error) {
resp := &Service{}
err := c.rancherClient.doAction(KUBERNETES_SERVICE_TYPE, "continueupgrade", &resource.Resource, nil, resp)
return resp, err
}
func (c *KubernetesServiceClient) ActionCreate(resource *KubernetesService) (*Service, error) {
resp := &Service{}
@@ -9,6 +9,10 @@ type KubernetesStack struct {
AccountId string `json:"accountId,omitempty" yaml:"account_id,omitempty"`
Answers map[string]interface{} `json:"answers,omitempty" yaml:"answers,omitempty"`
Binding *Binding `json:"binding,omitempty" yaml:"binding,omitempty"`
Created string `json:"created,omitempty" yaml:"created,omitempty"`
Data map[string]interface{} `json:"data,omitempty" yaml:"data,omitempty"`
@@ -19,6 +23,8 @@ type KubernetesStack struct {
ExternalId string `json:"externalId,omitempty" yaml:"external_id,omitempty"`
Group string `json:"group,omitempty" yaml:"group,omitempty"`
HealthState string `json:"healthState,omitempty" yaml:"health_state,omitempty"`
Kind string `json:"kind,omitempty" yaml:"kind,omitempty"`
@@ -35,8 +41,12 @@ type KubernetesStack struct {
Removed string `json:"removed,omitempty" yaml:"removed,omitempty"`
ServiceIds []string `json:"serviceIds,omitempty" yaml:"service_ids,omitempty"`
State string `json:"state,omitempty" yaml:"state,omitempty"`
System bool `json:"system,omitempty" yaml:"system,omitempty"`
Templates map[string]interface{} `json:"templates,omitempty" yaml:"templates,omitempty"`
Transitioning string `json:"transitioning,omitempty" yaml:"transitioning,omitempty"`
@@ -65,19 +75,17 @@ type KubernetesStackOperations interface {
ById(id string) (*KubernetesStack, error)
Delete(container *KubernetesStack) error
ActionCancelrollback(*KubernetesStack) (*Environment, error)
ActionCancelupgrade(*KubernetesStack) (*Stack, error)
ActionCancelupgrade(*KubernetesStack) (*Environment, error)
ActionCreate(*KubernetesStack) (*Stack, error)
ActionCreate(*KubernetesStack) (*Environment, error)
ActionError(*KubernetesStack) (*Stack, error)
ActionError(*KubernetesStack) (*Environment, error)
ActionFinishupgrade(*KubernetesStack) (*Stack, error)
ActionFinishupgrade(*KubernetesStack) (*Environment, error)
ActionRemove(*KubernetesStack) (*Stack, error)
ActionRemove(*KubernetesStack) (*Environment, error)
ActionRollback(*KubernetesStack) (*Environment, error)
ActionRollback(*KubernetesStack) (*Stack, error)
ActionUpgrade(*KubernetesStack, *KubernetesStackUpgrade) (*KubernetesStack, error)
}
@@ -132,63 +140,54 @@ func (c *KubernetesStackClient) Delete(container *KubernetesStack) error {
return c.rancherClient.doResourceDelete(KUBERNETES_STACK_TYPE, &container.Resource)
}
func (c *KubernetesStackClient) ActionCancelrollback(resource *KubernetesStack) (*Environment, error) {
func (c *KubernetesStackClient) ActionCancelupgrade(resource *KubernetesStack) (*Stack, error) {
resp := &Environment{}
err := c.rancherClient.doAction(KUBERNETES_STACK_TYPE, "cancelrollback", &resource.Resource, nil, resp)
return resp, err
}
func (c *KubernetesStackClient) ActionCancelupgrade(resource *KubernetesStack) (*Environment, error) {
resp := &Environment{}
resp := &Stack{}
err := c.rancherClient.doAction(KUBERNETES_STACK_TYPE, "cancelupgrade", &resource.Resource, nil, resp)
return resp, err
}
func (c *KubernetesStackClient) ActionCreate(resource *KubernetesStack) (*Environment, error) {
func (c *KubernetesStackClient) ActionCreate(resource *KubernetesStack) (*Stack, error) {
resp := &Environment{}
resp := &Stack{}
err := c.rancherClient.doAction(KUBERNETES_STACK_TYPE, "create", &resource.Resource, nil, resp)
return resp, err
}
func (c *KubernetesStackClient) ActionError(resource *KubernetesStack) (*Environment, error) {
func (c *KubernetesStackClient) ActionError(resource *KubernetesStack) (*Stack, error) {
resp := &Environment{}
resp := &Stack{}
err := c.rancherClient.doAction(KUBERNETES_STACK_TYPE, "error", &resource.Resource, nil, resp)
return resp, err
}
func (c *KubernetesStackClient) ActionFinishupgrade(resource *KubernetesStack) (*Environment, error) {
func (c *KubernetesStackClient) ActionFinishupgrade(resource *KubernetesStack) (*Stack, error) {
resp := &Environment{}
resp := &Stack{}
err := c.rancherClient.doAction(KUBERNETES_STACK_TYPE, "finishupgrade", &resource.Resource, nil, resp)
return resp, err
}
func (c *KubernetesStackClient) ActionRemove(resource *KubernetesStack) (*Environment, error) {
func (c *KubernetesStackClient) ActionRemove(resource *KubernetesStack) (*Stack, error) {
resp := &Environment{}
resp := &Stack{}
err := c.rancherClient.doAction(KUBERNETES_STACK_TYPE, "remove", &resource.Resource, nil, resp)
return resp, err
}
func (c *KubernetesStackClient) ActionRollback(resource *KubernetesStack) (*Environment, error) {
func (c *KubernetesStackClient) ActionRollback(resource *KubernetesStack) (*Stack, error) {
resp := &Environment{}
resp := &Stack{}
err := c.rancherClient.doAction(KUBERNETES_STACK_TYPE, "rollback", &resource.Resource, nil, resp)
@@ -7,6 +7,8 @@ const (
type KubernetesStackUpgrade struct {
Resource
Answers map[string]interface{} `json:"answers,omitempty" yaml:"answers,omitempty"`
Environment map[string]interface{} `json:"environment,omitempty" yaml:"environment,omitempty"`
ExternalId string `json:"externalId,omitempty" yaml:"external_id,omitempty"`
@@ -15,18 +15,36 @@ type LaunchConfig struct {
BlkioDeviceOptions map[string]interface{} `json:"blkioDeviceOptions,omitempty" yaml:"blkio_device_options,omitempty"`
BlkioWeight int64 `json:"blkioWeight,omitempty" yaml:"blkio_weight,omitempty"`
Build *DockerBuild `json:"build,omitempty" yaml:"build,omitempty"`
CapAdd []string `json:"capAdd,omitempty" yaml:"cap_add,omitempty"`
CapDrop []string `json:"capDrop,omitempty" yaml:"cap_drop,omitempty"`
CgroupParent string `json:"cgroupParent,omitempty" yaml:"cgroup_parent,omitempty"`
Command []string `json:"command,omitempty" yaml:"command,omitempty"`
Count int64 `json:"count,omitempty" yaml:"count,omitempty"`
CpuCount int64 `json:"cpuCount,omitempty" yaml:"cpu_count,omitempty"`
CpuPercent int64 `json:"cpuPercent,omitempty" yaml:"cpu_percent,omitempty"`
CpuPeriod int64 `json:"cpuPeriod,omitempty" yaml:"cpu_period,omitempty"`
CpuQuota int64 `json:"cpuQuota,omitempty" yaml:"cpu_quota,omitempty"`
CpuRealtimePeriod int64 `json:"cpuRealtimePeriod,omitempty" yaml:"cpu_realtime_period,omitempty"`
CpuRealtimeRuntime int64 `json:"cpuRealtimeRuntime,omitempty" yaml:"cpu_realtime_runtime,omitempty"`
CpuSet string `json:"cpuSet,omitempty" yaml:"cpu_set,omitempty"`
CpuSetMems string `json:"cpuSetMems,omitempty" yaml:"cpu_set_mems,omitempty"`
CpuShares int64 `json:"cpuShares,omitempty" yaml:"cpu_shares,omitempty"`
CreateIndex int64 `json:"createIndex,omitempty" yaml:"create_index,omitempty"`
@@ -49,14 +67,20 @@ type LaunchConfig struct {
Devices []string `json:"devices,omitempty" yaml:"devices,omitempty"`
Disks []interface{} `json:"disks,omitempty" yaml:"disks,omitempty"`
DiskQuota int64 `json:"diskQuota,omitempty" yaml:"disk_quota,omitempty"`
Disks []VirtualMachineDisk `json:"disks,omitempty" yaml:"disks,omitempty"`
Dns []string `json:"dns,omitempty" yaml:"dns,omitempty"`
DnsOpt []string `json:"dnsOpt,omitempty" yaml:"dns_opt,omitempty"`
DnsSearch []string `json:"dnsSearch,omitempty" yaml:"dns_search,omitempty"`
DomainName string `json:"domainName,omitempty" yaml:"domain_name,omitempty"`
DrainTimeoutMs int64 `json:"drainTimeoutMs,omitempty" yaml:"drain_timeout_ms,omitempty"`
EntryPoint []string `json:"entryPoint,omitempty" yaml:"entry_point,omitempty"`
Environment map[string]interface{} `json:"environment,omitempty" yaml:"environment,omitempty"`
@@ -69,10 +93,20 @@ type LaunchConfig struct {
FirstRunning string `json:"firstRunning,omitempty" yaml:"first_running,omitempty"`
GroupAdd []string `json:"groupAdd,omitempty" yaml:"group_add,omitempty"`
HealthCheck *InstanceHealthCheck `json:"healthCheck,omitempty" yaml:"health_check,omitempty"`
HealthCmd []string `json:"healthCmd,omitempty" yaml:"health_cmd,omitempty"`
HealthInterval int64 `json:"healthInterval,omitempty" yaml:"health_interval,omitempty"`
HealthRetries int64 `json:"healthRetries,omitempty" yaml:"health_retries,omitempty"`
HealthState string `json:"healthState,omitempty" yaml:"health_state,omitempty"`
HealthTimeout int64 `json:"healthTimeout,omitempty" yaml:"health_timeout,omitempty"`
HostId string `json:"hostId,omitempty" yaml:"host_id,omitempty"`
Hostname string `json:"hostname,omitempty" yaml:"hostname,omitempty"`
@@ -81,6 +115,22 @@ type LaunchConfig struct {
InstanceLinks map[string]interface{} `json:"instanceLinks,omitempty" yaml:"instance_links,omitempty"`
InstanceTriggeredStop string `json:"instanceTriggeredStop,omitempty" yaml:"instance_triggered_stop,omitempty"`
IoMaximumBandwidth int64 `json:"ioMaximumBandwidth,omitempty" yaml:"io_maximum_bandwidth,omitempty"`
IoMaximumIOps int64 `json:"ioMaximumIOps,omitempty" yaml:"io_maximum_iops,omitempty"`
Ip string `json:"ip,omitempty" yaml:"ip,omitempty"`
Ip6 string `json:"ip6,omitempty" yaml:"ip6,omitempty"`
IpcMode string `json:"ipcMode,omitempty" yaml:"ipc_mode,omitempty"`
Isolation string `json:"isolation,omitempty" yaml:"isolation,omitempty"`
KernelMemory int64 `json:"kernelMemory,omitempty" yaml:"kernel_memory,omitempty"`
Kind string `json:"kind,omitempty" yaml:"kind,omitempty"`
Labels map[string]interface{} `json:"labels,omitempty" yaml:"labels,omitempty"`
@@ -93,10 +143,20 @@ type LaunchConfig struct {
MemoryMb int64 `json:"memoryMb,omitempty" yaml:"memory_mb,omitempty"`
MemoryReservation int64 `json:"memoryReservation,omitempty" yaml:"memory_reservation,omitempty"`
MemorySwap int64 `json:"memorySwap,omitempty" yaml:"memory_swap,omitempty"`
MemorySwappiness int64 `json:"memorySwappiness,omitempty" yaml:"memory_swappiness,omitempty"`
MilliCpuReservation int64 `json:"milliCpuReservation,omitempty" yaml:"milli_cpu_reservation,omitempty"`
Mounts []MountEntry `json:"mounts,omitempty" yaml:"mounts,omitempty"`
NativeContainer bool `json:"nativeContainer,omitempty" yaml:"native_container,omitempty"`
NetAlias []string `json:"netAlias,omitempty" yaml:"net_alias,omitempty"`
NetworkContainerId string `json:"networkContainerId,omitempty" yaml:"network_container_id,omitempty"`
NetworkIds []string `json:"networkIds,omitempty" yaml:"network_ids,omitempty"`
@@ -105,12 +165,20 @@ type LaunchConfig struct {
NetworkMode string `json:"networkMode,omitempty" yaml:"network_mode,omitempty"`
OomKillDisable bool `json:"oomKillDisable,omitempty" yaml:"oom_kill_disable,omitempty"`
OomScoreAdj int64 `json:"oomScoreAdj,omitempty" yaml:"oom_score_adj,omitempty"`
PidMode string `json:"pidMode,omitempty" yaml:"pid_mode,omitempty"`
PidsLimit int64 `json:"pidsLimit,omitempty" yaml:"pids_limit,omitempty"`
Ports []string `json:"ports,omitempty" yaml:"ports,omitempty"`
PrimaryIpAddress string `json:"primaryIpAddress,omitempty" yaml:"primary_ip_address,omitempty"`
PrimaryNetworkId string `json:"primaryNetworkId,omitempty" yaml:"primary_network_id,omitempty"`
Privileged bool `json:"privileged,omitempty" yaml:"privileged,omitempty"`
PublishAllPorts bool `json:"publishAllPorts,omitempty" yaml:"publish_all_ports,omitempty"`
@@ -127,8 +195,20 @@ type LaunchConfig struct {
RequestedIpAddress string `json:"requestedIpAddress,omitempty" yaml:"requested_ip_address,omitempty"`
RunInit bool `json:"runInit,omitempty" yaml:"run_init,omitempty"`
Secrets []SecretReference `json:"secrets,omitempty" yaml:"secrets,omitempty"`
SecurityOpt []string `json:"securityOpt,omitempty" yaml:"security_opt,omitempty"`
ServiceId string `json:"serviceId,omitempty" yaml:"service_id,omitempty"`
ServiceIds []string `json:"serviceIds,omitempty" yaml:"service_ids,omitempty"`
ShmSize int64 `json:"shmSize,omitempty" yaml:"shm_size,omitempty"`
StackId string `json:"stackId,omitempty" yaml:"stack_id,omitempty"`
StartCount int64 `json:"startCount,omitempty" yaml:"start_count,omitempty"`
StartOnCreate bool `json:"startOnCreate,omitempty" yaml:"start_on_create,omitempty"`
@@ -137,7 +217,17 @@ type LaunchConfig struct {
StdinOpen bool `json:"stdinOpen,omitempty" yaml:"stdin_open,omitempty"`
SystemContainer string `json:"systemContainer,omitempty" yaml:"system_container,omitempty"`
StopSignal string `json:"stopSignal,omitempty" yaml:"stop_signal,omitempty"`
StopTimeout int64 `json:"stopTimeout,omitempty" yaml:"stop_timeout,omitempty"`
StorageOpt map[string]interface{} `json:"storageOpt,omitempty" yaml:"storage_opt,omitempty"`
Sysctls map[string]interface{} `json:"sysctls,omitempty" yaml:"sysctls,omitempty"`
System bool `json:"system,omitempty" yaml:"system,omitempty"`
Tmpfs map[string]interface{} `json:"tmpfs,omitempty" yaml:"tmpfs,omitempty"`
Token string `json:"token,omitempty" yaml:"token,omitempty"`
@@ -149,10 +239,18 @@ type LaunchConfig struct {
Tty bool `json:"tty,omitempty" yaml:"tty,omitempty"`
Ulimits []Ulimit `json:"ulimits,omitempty" yaml:"ulimits,omitempty"`
User string `json:"user,omitempty" yaml:"user,omitempty"`
UserPorts []string `json:"userPorts,omitempty" yaml:"user_ports,omitempty"`
Userdata string `json:"userdata,omitempty" yaml:"userdata,omitempty"`
UsernsMode string `json:"usernsMode,omitempty" yaml:"userns_mode,omitempty"`
Uts string `json:"uts,omitempty" yaml:"uts,omitempty"`
Uuid string `json:"uuid,omitempty" yaml:"uuid,omitempty"`
Vcpu int64 `json:"vcpu,omitempty" yaml:"vcpu,omitempty"`
@@ -203,10 +301,6 @@ type LaunchConfigOperations interface {
ActionRestart(*LaunchConfig) (*Instance, error)
ActionRestore(*LaunchConfig) (*Instance, error)
ActionSetlabels(*LaunchConfig, *SetLabelsInput) (*Container, error)
ActionStart(*LaunchConfig) (*Instance, error)
ActionStop(*LaunchConfig, *InstanceStop) (*Instance, error)
@@ -369,24 +463,6 @@ func (c *LaunchConfigClient) ActionRestart(resource *LaunchConfig) (*Instance, e
return resp, err
}
func (c *LaunchConfigClient) ActionRestore(resource *LaunchConfig) (*Instance, error) {
resp := &Instance{}
err := c.rancherClient.doAction(LAUNCH_CONFIG_TYPE, "restore", &resource.Resource, nil, resp)
return resp, err
}
func (c *LaunchConfigClient) ActionSetlabels(resource *LaunchConfig, input *SetLabelsInput) (*Container, error) {
resp := &Container{}
err := c.rancherClient.doAction(LAUNCH_CONFIG_TYPE, "setlabels", &resource.Resource, input, resp)
return resp, err
}
func (c *LaunchConfigClient) ActionStart(resource *LaunchConfig) (*Instance, error) {
resp := &Instance{}
+87
View File
@@ -0,0 +1,87 @@
package client
const (
LB_CONFIG_TYPE = "lbConfig"
)
type LbConfig struct {
Resource
CertificateIds []string `json:"certificateIds,omitempty" yaml:"certificate_ids,omitempty"`
Config string `json:"config,omitempty" yaml:"config,omitempty"`
DefaultCertificateId string `json:"defaultCertificateId,omitempty" yaml:"default_certificate_id,omitempty"`
PortRules []PortRule `json:"portRules,omitempty" yaml:"port_rules,omitempty"`
StickinessPolicy *LoadBalancerCookieStickinessPolicy `json:"stickinessPolicy,omitempty" yaml:"stickiness_policy,omitempty"`
}
type LbConfigCollection struct {
Collection
Data []LbConfig `json:"data,omitempty"`
client *LbConfigClient
}
type LbConfigClient struct {
rancherClient *RancherClient
}
type LbConfigOperations interface {
List(opts *ListOpts) (*LbConfigCollection, error)
Create(opts *LbConfig) (*LbConfig, error)
Update(existing *LbConfig, updates interface{}) (*LbConfig, error)
ById(id string) (*LbConfig, error)
Delete(container *LbConfig) error
}
func newLbConfigClient(rancherClient *RancherClient) *LbConfigClient {
return &LbConfigClient{
rancherClient: rancherClient,
}
}
func (c *LbConfigClient) Create(container *LbConfig) (*LbConfig, error) {
resp := &LbConfig{}
err := c.rancherClient.doCreate(LB_CONFIG_TYPE, container, resp)
return resp, err
}
func (c *LbConfigClient) Update(existing *LbConfig, updates interface{}) (*LbConfig, error) {
resp := &LbConfig{}
err := c.rancherClient.doUpdate(LB_CONFIG_TYPE, &existing.Resource, updates, resp)
return resp, err
}
func (c *LbConfigClient) List(opts *ListOpts) (*LbConfigCollection, error) {
resp := &LbConfigCollection{}
err := c.rancherClient.doList(LB_CONFIG_TYPE, opts, resp)
resp.client = c
return resp, err
}
func (cc *LbConfigCollection) Next() (*LbConfigCollection, error) {
if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" {
resp := &LbConfigCollection{}
err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp)
resp.client = cc.client
return resp, err
}
return nil, nil
}
func (c *LbConfigClient) ById(id string) (*LbConfig, error) {
resp := &LbConfig{}
err := c.rancherClient.doById(LB_CONFIG_TYPE, id, resp)
if apiError, ok := err.(*ApiError); ok {
if apiError.StatusCode == 404 {
return nil, nil
}
}
return resp, err
}
func (c *LbConfigClient) Delete(container *LbConfig) error {
return c.rancherClient.doResourceDelete(LB_CONFIG_TYPE, &container.Resource)
}
+79
View File
@@ -0,0 +1,79 @@
package client
const (
LB_TARGET_CONFIG_TYPE = "lbTargetConfig"
)
type LbTargetConfig struct {
Resource
PortRules []TargetPortRule `json:"portRules,omitempty" yaml:"port_rules,omitempty"`
}
type LbTargetConfigCollection struct {
Collection
Data []LbTargetConfig `json:"data,omitempty"`
client *LbTargetConfigClient
}
type LbTargetConfigClient struct {
rancherClient *RancherClient
}
type LbTargetConfigOperations interface {
List(opts *ListOpts) (*LbTargetConfigCollection, error)
Create(opts *LbTargetConfig) (*LbTargetConfig, error)
Update(existing *LbTargetConfig, updates interface{}) (*LbTargetConfig, error)
ById(id string) (*LbTargetConfig, error)
Delete(container *LbTargetConfig) error
}
func newLbTargetConfigClient(rancherClient *RancherClient) *LbTargetConfigClient {
return &LbTargetConfigClient{
rancherClient: rancherClient,
}
}
func (c *LbTargetConfigClient) Create(container *LbTargetConfig) (*LbTargetConfig, error) {
resp := &LbTargetConfig{}
err := c.rancherClient.doCreate(LB_TARGET_CONFIG_TYPE, container, resp)
return resp, err
}
func (c *LbTargetConfigClient) Update(existing *LbTargetConfig, updates interface{}) (*LbTargetConfig, error) {
resp := &LbTargetConfig{}
err := c.rancherClient.doUpdate(LB_TARGET_CONFIG_TYPE, &existing.Resource, updates, resp)
return resp, err
}
func (c *LbTargetConfigClient) List(opts *ListOpts) (*LbTargetConfigCollection, error) {
resp := &LbTargetConfigCollection{}
err := c.rancherClient.doList(LB_TARGET_CONFIG_TYPE, opts, resp)
resp.client = c
return resp, err
}
func (cc *LbTargetConfigCollection) Next() (*LbTargetConfigCollection, error) {
if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" {
resp := &LbTargetConfigCollection{}
err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp)
resp.client = cc.client
return resp, err
}
return nil, nil
}
func (c *LbTargetConfigClient) ById(id string) (*LbTargetConfig, error) {
resp := &LbTargetConfig{}
err := c.rancherClient.doById(LB_TARGET_CONFIG_TYPE, id, resp)
if apiError, ok := err.(*ApiError); ok {
if apiError.StatusCode == 404 {
return nil, nil
}
}
return resp, err
}
func (c *LbTargetConfigClient) Delete(container *LbTargetConfig) error {
return c.rancherClient.doResourceDelete(LB_TARGET_CONFIG_TYPE, &container.Resource)
}

Some files were not shown because too many files have changed in this diff Show More