Update Rancher API integration to go-rancher client v2.

This commit is contained in:
Raúl Sánchez 2017-11-05 13:02:03 +01:00 committed by Traefiker
parent d89b234cad
commit 07c6e33598
188 changed files with 5349 additions and 1969 deletions

View file

@ -110,6 +110,12 @@ secretKey = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
To enable Traefik to fetch information about the Environment it's deployed in only, you need to create an `Environment API Key`. To enable Traefik to fetch information about the Environment it's deployed in only, you need to create an `Environment API Key`.
This can be found within the API Key advanced options. This can be found within the API Key advanced options.
Add these labels to traefik docker deployment to autogenerated these values:
```
io.rancher.container.agent.role: environment
io.rancher.container.create_agent: true
```
## Labels: overriding default behaviour ## Labels: overriding default behaviour
Labels can be used on task containers to override default behaviour: Labels can be used on task containers to override default behaviour:

10
glide.lock generated
View file

@ -1,5 +1,5 @@
hash: 70e3ed39d2777d36b679ff55b8b0f2eb8d0b239fdfb8108f41b8b7239bc7920c hash: 1d18b9c76989feed304a8781b18ea24b43e858091b775316af97bfc210a06ea0
updated: 2017-10-25T10:18:20.438135-04:00 updated: 2017-11-02T11:39:20.438135-04:00
imports: imports:
- name: cloud.google.com/go - name: cloud.google.com/go
version: 2e6a95edb1071d750f6d7db777bf66cd2997af6c version: 2e6a95edb1071d750f6d7db777bf66cd2997af6c
@ -436,11 +436,11 @@ imports:
- name: github.com/PuerkitoBio/urlesc - name: github.com/PuerkitoBio/urlesc
version: 5bd2802263f21d8788851d5305584c82a5c75d7e version: 5bd2802263f21d8788851d5305584c82a5c75d7e
- name: github.com/rancher/go-rancher - name: github.com/rancher/go-rancher
version: 5b8f6cc26b355ba03d7611fce3844155b7baf05b version: 52e2f489534007ae843065468c5a1920d542afa4
subpackages: subpackages:
- client - v2
- name: github.com/rancher/go-rancher-metadata - name: github.com/rancher/go-rancher-metadata
version: 95d4962a8f0420be24fb49c2cb4f5491284c62f1 version: d2103caca5873119ff423d29cba09b4d03cd69b8
subpackages: subpackages:
- metadata - metadata
- name: github.com/ryanuber/go-glob - name: github.com/ryanuber/go-glob

View file

@ -166,7 +166,7 @@ import:
- package: github.com/golang/protobuf - package: github.com/golang/protobuf
version: 2bba0603135d7d7f5cb73b2125beeda19c09f4ef version: 2bba0603135d7d7f5cb73b2125beeda19c09f4ef
- package: github.com/rancher/go-rancher - package: github.com/rancher/go-rancher
version: 5b8f6cc26b355ba03d7611fce3844155b7baf05b version: 52e2f489534007ae843065468c5a1920d542afa4
- package: golang.org/x/oauth2 - package: golang.org/x/oauth2
version: 7fdf09982454086d5570c7db3e11f360194830ca version: 7fdf09982454086d5570c7db3e11f360194830ca
subpackages: subpackages:
@ -174,7 +174,7 @@ import:
- package: golang.org/x/time - package: golang.org/x/time
version: 8be79e1e0910c292df4e79c241bb7e8f7e725959 version: 8be79e1e0910c292df4e79c241bb7e8f7e725959
- package: github.com/rancher/go-rancher-metadata - package: github.com/rancher/go-rancher-metadata
version: 95d4962a8f0420be24fb49c2cb4f5491284c62f1 version: d2103caca5873119ff423d29cba09b4d03cd69b8
- package: github.com/googleapis/gax-go - package: github.com/googleapis/gax-go
version: 9af46dd5a1713e8b5cd71106287eba3cefdde50b version: 9af46dd5a1713e8b5cd71106287eba3cefdde50b
- package: google.golang.org/grpc - package: google.golang.org/grpc

View file

@ -11,7 +11,7 @@ import (
"github.com/containous/traefik/safe" "github.com/containous/traefik/safe"
"github.com/containous/traefik/types" "github.com/containous/traefik/types"
"github.com/mitchellh/mapstructure" "github.com/mitchellh/mapstructure"
rancher "github.com/rancher/go-rancher/client" rancher "github.com/rancher/go-rancher/v2"
) )
const ( const (
@ -72,11 +72,11 @@ func (p *Provider) apiProvide(configurationChan chan<- types.ConfigMessage, pool
} }
ctx := context.Background() ctx := context.Background()
var environments = listRancherEnvironments(rancherClient) var stacks = listRancherStacks(rancherClient)
var services = listRancherServices(rancherClient) var services = listRancherServices(rancherClient)
var container = listRancherContainer(rancherClient) var container = listRancherContainer(rancherClient)
var rancherData = parseAPISourcedRancherData(environments, services, container) var rancherData = parseAPISourcedRancherData(stacks, services, container)
configuration := p.loadRancherConfig(rancherData) configuration := p.loadRancherConfig(rancherData)
configurationChan <- types.ConfigMessage{ configurationChan <- types.ConfigMessage{
@ -93,11 +93,11 @@ func (p *Provider) apiProvide(configurationChan chan<- types.ConfigMessage, pool
case <-ticker.C: case <-ticker.C:
log.Debugf("Refreshing new Data from Provider API") log.Debugf("Refreshing new Data from Provider API")
var environments = listRancherEnvironments(rancherClient) var stacks = listRancherStacks(rancherClient)
var services = listRancherServices(rancherClient) var services = listRancherServices(rancherClient)
var container = listRancherContainer(rancherClient) var container = listRancherContainer(rancherClient)
rancherData := parseAPISourcedRancherData(environments, services, container) rancherData := parseAPISourcedRancherData(stacks, services, container)
configuration := p.loadRancherConfig(rancherData) configuration := p.loadRancherConfig(rancherData)
if configuration != nil { if configuration != nil {
@ -129,24 +129,21 @@ func (p *Provider) apiProvide(configurationChan chan<- types.ConfigMessage, pool
return nil return nil
} }
func listRancherEnvironments(client *rancher.RancherClient) []*rancher.Environment { func listRancherStacks(client *rancher.RancherClient) []*rancher.Stack {
// Rancher Environment in frontend UI is actually a stack var stackList = []*rancher.Stack{}
// https://forums.rancher.com/t/api-key-for-all-environments/279/9
var environmentList = []*rancher.Environment{} stacks, err := client.Stack.List(withoutPagination)
environments, err := client.Environment.List(nil)
if err != nil { if err != nil {
log.Errorf("Cannot get Rancher Environments %+v", err) log.Errorf("Cannot get Provider Stacks %+v", err)
} }
for k := range environments.Data { for k := range stacks.Data {
environmentList = append(environmentList, &environments.Data[k]) stackList = append(stackList, &stacks.Data[k])
} }
return environmentList return stackList
} }
func listRancherServices(client *rancher.RancherClient) []*rancher.Service { func listRancherServices(client *rancher.RancherClient) []*rancher.Service {
@ -197,19 +194,19 @@ func listRancherContainer(client *rancher.RancherClient) []*rancher.Container {
return containerList return containerList
} }
func parseAPISourcedRancherData(environments []*rancher.Environment, services []*rancher.Service, containers []*rancher.Container) []rancherData { func parseAPISourcedRancherData(stacks []*rancher.Stack, services []*rancher.Service, containers []*rancher.Container) []rancherData {
var rancherDataList []rancherData var rancherDataList []rancherData
for _, environment := range environments { for _, stack := range stacks {
for _, service := range services { for _, service := range services {
if service.EnvironmentId != environment.Id { if service.StackId != stack.Id {
continue continue
} }
rancherData := rancherData{ rancherData := rancherData{
Name: environment.Name + "/" + service.Name, Name: service.Name + "/" + stack.Name,
Health: service.HealthState, Health: service.HealthState,
State: service.State, State: service.State,
Labels: make(map[string]string), Labels: make(map[string]string),
@ -217,7 +214,7 @@ func parseAPISourcedRancherData(environments []*rancher.Environment, services []
} }
if service.LaunchConfig == nil || service.LaunchConfig.Labels == nil { if service.LaunchConfig == nil || service.LaunchConfig.Labels == nil {
log.Warnf("Rancher Service Labels are missing. Environment: %s, service: %s", environment.Name, service.Name) log.Warnf("Rancher Service Labels are missing. Stack: %s, service: %s", stack.Name, service.Name)
} else { } else {
for key, value := range service.LaunchConfig.Labels { for key, value := range service.LaunchConfig.Labels {
rancherData.Labels[key] = value.(string) rancherData.Labels[key] = value.(string)
@ -225,7 +222,7 @@ func parseAPISourcedRancherData(environments []*rancher.Environment, services []
} }
for _, container := range containers { for _, container := range containers {
if container.Labels[labelRancherStackServiceName] == rancherData.Name && if container.Labels[labelRancherStackServiceName] == stack.Name+"/"+service.Name &&
containerFilter(container.Name, container.HealthState, container.State) { containerFilter(container.Name, container.HealthState, container.State) {
if container.NetworkMode == hostNetwork { if container.NetworkMode == hostNetwork {

View file

@ -129,7 +129,7 @@ func parseMetadataSourcedRancherData(stacks []rancher.Stack) (rancherDataList []
} }
rancherDataList = append(rancherDataList, rancherData{ rancherDataList = append(rancherDataList, rancherData{
Name: stack.Name + "/" + service.Name, Name: service.Name + "/" + stack.Name,
State: service.State, State: service.State,
Labels: service.Labels, Labels: service.Labels,
Containers: containerIPAddresses, Containers: containerIPAddresses,

View file

@ -20,6 +20,7 @@ type Client interface {
GetSelfStack() (Stack, error) GetSelfStack() (Stack, error)
GetServices() ([]Service, error) GetServices() ([]Service, error)
GetStacks() ([]Stack, error) GetStacks() ([]Stack, error)
GetStackByName(string) (Stack, error)
GetContainers() ([]Container, error) GetContainers() ([]Container, error)
GetServiceContainers(string, string) ([]Container, error) GetServiceContainers(string, string) ([]Container, error)
GetHosts() ([]Host, error) GetHosts() ([]Host, error)
@ -190,6 +191,20 @@ func (m *client) GetStacks() ([]Stack, error) {
return stacks, nil return stacks, nil
} }
func (m *client) GetStackByName(name string) (Stack, error) {
resp, err := m.SendRequest("/stacks/" + name)
var stack Stack
if err != nil {
return stack, err
}
if err = json.Unmarshal(resp, &stack); err != nil {
return stack, err
}
return stack, nil
}
func (m *client) GetContainers() ([]Container, error) { func (m *client) GetContainers() ([]Container, error) {
resp, err := m.SendRequest("/containers") resp, err := m.SendRequest("/containers")
var containers []Container var containers []Container

View file

@ -43,6 +43,8 @@ type Service struct {
EnvironmentUUID string `json:"environment_uuid"` EnvironmentUUID string `json:"environment_uuid"`
State string `json:"state"` State string `json:"state"`
System bool `json:"system"` System bool `json:"system"`
EnvironmentName string `json:"environment_name"`
Selector string `json:"selector"`
} }
type Container struct { type Container struct {
@ -54,6 +56,7 @@ type Container struct {
ServiceName string `json:"service_name"` ServiceName string `json:"service_name"`
ServiceIndex string `json:"service_index"` ServiceIndex string `json:"service_index"`
StackName string `json:"stack_name"` StackName string `json:"stack_name"`
StackUUID string `json:"stack_uuid"`
Labels map[string]string `json:"labels"` Labels map[string]string `json:"labels"`
CreateIndex int `json:"create_index"` CreateIndex int `json:"create_index"`
HostUUID string `json:"host_uuid"` HostUUID string `json:"host_uuid"`
@ -73,6 +76,8 @@ type Container struct {
System bool `json:"system"` System bool `json:"system"`
EnvironmentUUID string `json:"environment_uuid"` EnvironmentUUID string `json:"environment_uuid"`
HealthCheck HealthCheck `json:"health_check"` HealthCheck HealthCheck `json:"health_check"`
EnvironmentName string `json:"environment_name"`
ServiceUUID string `json:"service_uuid"`
} }
type Network struct { type Network struct {
@ -97,6 +102,7 @@ type Host struct {
MilliCPU int64 `json:"milli_cpu"` MilliCPU int64 `json:"milli_cpu"`
LocalStorageMb int64 `json:"local_storage_mb"` LocalStorageMb int64 `json:"local_storage_mb"`
EnvironmentUUID string `json:"environment_uuid"` EnvironmentUUID string `json:"environment_uuid"`
State string `json:"state"`
} }
type PortRule struct { type PortRule struct {
@ -110,11 +116,12 @@ type PortRule struct {
BackendName string `json:"backend_name"` BackendName string `json:"backend_name"`
Selector string `json:"selector"` Selector string `json:"selector"`
Container string `json:"container"` Container string `json:"container"`
ContainerUUID string `json:"container_uuid"`
} }
type LBConfig struct { type LBConfig struct {
Certs []string `json:"certs"` CertificateIDs []string `json:"certificate_ids"`
DefaultCert string `json:"default_cert"` DefaultCertificateID string `json:"default_certificate_id"`
PortRules []PortRule `json:"port_rules"` PortRules []PortRule `json:"port_rules"`
Config string `json:"config"` Config string `json:"config"`
StickinessPolicy LBStickinessPolicy `json:"stickiness_policy"` StickinessPolicy LBStickinessPolicy `json:"stickiness_policy"`

View file

@ -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)
}

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
}

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
}

View file

@ -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)
}

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)
}

View file

@ -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)
}

View file

@ -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)
}

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)
}

View file

@ -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)
}

View file

@ -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)
}

View file

@ -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)
}

View file

@ -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)
}

View file

@ -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)
}

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)
}

View file

@ -23,6 +23,9 @@ type RancherBaseClient interface {
Delete(*Resource) error Delete(*Resource) error
Reload(*Resource, interface{}) error Reload(*Resource, interface{}) error
Action(string, string, *Resource, interface{}, interface{}) error Action(string, string, *Resource, interface{}, interface{}) error
GetOpts() *ClientOpts
GetSchemas() *Schemas
GetTypes() map[string]Schema
doGet(string, *ListOpts, interface{}) error doGet(string, *ListOpts, interface{}) error
doList(string, *ListOpts, interface{}) error doList(string, *ListOpts, interface{}) error

View file

@ -2,6 +2,7 @@ package client
import ( import (
"bytes" "bytes"
"encoding/base64"
"encoding/json" "encoding/json"
"fmt" "fmt"
"io" "io"
@ -10,6 +11,7 @@ import (
"net/url" "net/url"
"os" "os"
"regexp" "regexp"
"strings"
"time" "time"
"github.com/gorilla/websocket" "github.com/gorilla/websocket"
@ -24,6 +26,7 @@ const (
var ( var (
debug = false debug = false
dialer = &websocket.Dialer{} dialer = &websocket.Dialer{}
privateFieldRegex = regexp.MustCompile("^[[:lower:]]")
) )
type ClientOpts struct { type ClientOpts struct {
@ -128,7 +131,28 @@ func appendFilters(urlString string, filters map[string]interface{}) (string, er
return u.String(), nil 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 { 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 { if opts.Timeout == 0 {
opts.Timeout = time.Second * 10 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) { 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 { 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) 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() { func init() {
debug = os.Getenv("RANCHER_CLIENT_DEBUG") == "true" debug = os.Getenv("RANCHER_CLIENT_DEBUG") == "true"
if debug { if debug {

View file

@ -36,6 +36,8 @@ type Account struct {
TransitioningProgress int64 `json:"transitioningProgress,omitempty" yaml:"transitioning_progress,omitempty"` TransitioningProgress int64 `json:"transitioningProgress,omitempty" yaml:"transitioning_progress,omitempty"`
Uuid string `json:"uuid,omitempty" yaml:"uuid,omitempty"` Uuid string `json:"uuid,omitempty" yaml:"uuid,omitempty"`
Version string `json:"version,omitempty" yaml:"version,omitempty"`
} }
type AccountCollection struct { type AccountCollection struct {
@ -65,9 +67,9 @@ type AccountOperations interface {
ActionRemove(*Account) (*Account, error) ActionRemove(*Account) (*Account, error)
ActionRestore(*Account) (*Account, error)
ActionUpdate(*Account) (*Account, error) ActionUpdate(*Account) (*Account, error)
ActionUpgrade(*Account) (*Account, error)
} }
func newAccountClient(rancherClient *RancherClient) *AccountClient { func newAccountClient(rancherClient *RancherClient) *AccountClient {
@ -165,15 +167,6 @@ func (c *AccountClient) ActionRemove(resource *Account) (*Account, error) {
return resp, err 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) { func (c *AccountClient) ActionUpdate(resource *Account) (*Account, error) {
resp := &Account{} resp := &Account{}
@ -182,3 +175,12 @@ func (c *AccountClient) ActionUpdate(resource *Account) (*Account, error) {
return resp, err 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
}

View file

@ -63,14 +63,14 @@ type AgentOperations interface {
ActionDisconnect(*Agent) (*Agent, error) ActionDisconnect(*Agent) (*Agent, error)
ActionFinishreconnect(*Agent) (*Agent, error)
ActionPurge(*Agent) (*Agent, error) ActionPurge(*Agent) (*Agent, error)
ActionReconnect(*Agent) (*Agent, error) ActionReconnect(*Agent) (*Agent, error)
ActionRemove(*Agent) (*Agent, error) ActionRemove(*Agent) (*Agent, error)
ActionRestore(*Agent) (*Agent, error)
ActionUpdate(*Agent) (*Agent, error) ActionUpdate(*Agent) (*Agent, error)
} }
@ -160,6 +160,15 @@ func (c *AgentClient) ActionDisconnect(resource *Agent) (*Agent, error) {
return resp, err 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) { func (c *AgentClient) ActionPurge(resource *Agent) (*Agent, error) {
resp := &Agent{} resp := &Agent{}
@ -187,15 +196,6 @@ func (c *AgentClient) ActionRemove(resource *Agent) (*Agent, error) {
return resp, err 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) { func (c *AgentClient) ActionUpdate(resource *Agent) (*Agent, error) {
resp := &Agent{} resp := &Agent{}

View file

@ -11,16 +11,24 @@ type Amazonec2Config struct {
Ami string `json:"ami,omitempty" yaml:"ami,omitempty"` 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"` 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"` 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"` InstanceType string `json:"instanceType,omitempty" yaml:"instance_type,omitempty"`
KeypairName string `json:"keypairName,omitempty" yaml:"keypair_name,omitempty"` KeypairName string `json:"keypairName,omitempty" yaml:"keypair_name,omitempty"`
Monitoring bool `json:"monitoring,omitempty" yaml:"monitoring,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"` PrivateAddressOnly bool `json:"privateAddressOnly,omitempty" yaml:"private_address_only,omitempty"`
Region string `json:"region,omitempty" yaml:"region,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"` 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"` VolumeType string `json:"volumeType,omitempty" yaml:"volume_type,omitempty"`
VpcId string `json:"vpcId,omitempty" yaml:"vpc_id,omitempty"` VpcId string `json:"vpcId,omitempty" yaml:"vpc_id,omitempty"`

View file

@ -15,6 +15,8 @@ type AzureConfig struct {
CustomData string `json:"customData,omitempty" yaml:"custom_data,omitempty"` 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"` DockerPort string `json:"dockerPort,omitempty" yaml:"docker_port,omitempty"`
Environment string `json:"environment,omitempty" yaml:"environment,omitempty"` Environment string `json:"environment,omitempty" yaml:"environment,omitempty"`

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)
}

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)
}

View file

@ -6,7 +6,6 @@ type RancherClient struct {
Account AccountOperations Account AccountOperations
ActiveSetting ActiveSettingOperations ActiveSetting ActiveSettingOperations
AddOutputsInput AddOutputsInputOperations AddOutputsInput AddOutputsInputOperations
AddRemoveLoadBalancerServiceLinkInput AddRemoveLoadBalancerServiceLinkInputOperations
AddRemoveServiceLinkInput AddRemoveServiceLinkInputOperations AddRemoveServiceLinkInput AddRemoveServiceLinkInputOperations
Agent AgentOperations Agent AgentOperations
Amazonec2Config Amazonec2ConfigOperations Amazonec2Config Amazonec2ConfigOperations
@ -17,9 +16,12 @@ type RancherClient struct {
Backup BackupOperations Backup BackupOperations
BackupTarget BackupTargetOperations BackupTarget BackupTargetOperations
BaseMachineConfig BaseMachineConfigOperations BaseMachineConfig BaseMachineConfigOperations
Binding BindingOperations
BlkioDeviceOption BlkioDeviceOptionOperations BlkioDeviceOption BlkioDeviceOptionOperations
CatalogTemplate CatalogTemplateOperations
Certificate CertificateOperations Certificate CertificateOperations
ChangeSecretInput ChangeSecretInputOperations ChangeSecretInput ChangeSecretInputOperations
ClusterMembership ClusterMembershipOperations
ComposeConfig ComposeConfigOperations ComposeConfig ComposeConfigOperations
ComposeConfigInput ComposeConfigInputOperations ComposeConfigInput ComposeConfigInputOperations
ComposeProject ComposeProjectOperations ComposeProject ComposeProjectOperations
@ -34,12 +36,10 @@ type RancherClient struct {
Credential CredentialOperations Credential CredentialOperations
Databasechangelog DatabasechangelogOperations Databasechangelog DatabasechangelogOperations
Databasechangeloglock DatabasechangeloglockOperations Databasechangeloglock DatabasechangeloglockOperations
DefaultNetwork DefaultNetworkOperations
DigitaloceanConfig DigitaloceanConfigOperations DigitaloceanConfig DigitaloceanConfigOperations
DnsService DnsServiceOperations DnsService DnsServiceOperations
DockerBuild DockerBuildOperations DockerBuild DockerBuildOperations
DynamicSchema DynamicSchemaOperations
Environment EnvironmentOperations
EnvironmentUpgrade EnvironmentUpgradeOperations
ExtensionImplementation ExtensionImplementationOperations ExtensionImplementation ExtensionImplementationOperations
ExtensionPoint ExtensionPointOperations ExtensionPoint ExtensionPointOperations
ExternalDnsEvent ExternalDnsEventOperations ExternalDnsEvent ExternalDnsEventOperations
@ -54,14 +54,14 @@ type RancherClient struct {
ExternalStoragePoolEvent ExternalStoragePoolEventOperations ExternalStoragePoolEvent ExternalStoragePoolEventOperations
ExternalVolumeEvent ExternalVolumeEventOperations ExternalVolumeEvent ExternalVolumeEventOperations
FieldDocumentation FieldDocumentationOperations FieldDocumentation FieldDocumentationOperations
Githubconfig GithubconfigOperations GenericObject GenericObjectOperations
HaConfig HaConfigOperations HaConfig HaConfigOperations
HaConfigInput HaConfigInputOperations HaConfigInput HaConfigInputOperations
HaproxyConfig HaproxyConfigOperations
HealthcheckInstanceHostMap HealthcheckInstanceHostMapOperations HealthcheckInstanceHostMap HealthcheckInstanceHostMapOperations
Host HostOperations Host HostOperations
HostAccess HostAccessOperations HostAccess HostAccessOperations
HostApiProxyToken HostApiProxyTokenOperations HostApiProxyToken HostApiProxyTokenOperations
HostTemplate HostTemplateOperations
Identity IdentityOperations Identity IdentityOperations
Image ImageOperations Image ImageOperations
InServiceUpgradeStrategy InServiceUpgradeStrategyOperations InServiceUpgradeStrategy InServiceUpgradeStrategyOperations
@ -72,35 +72,43 @@ type RancherClient struct {
InstanceLink InstanceLinkOperations InstanceLink InstanceLinkOperations
InstanceStop InstanceStopOperations InstanceStop InstanceStopOperations
IpAddress IpAddressOperations IpAddress IpAddressOperations
IpAddressAssociateInput IpAddressAssociateInputOperations
KubernetesService KubernetesServiceOperations KubernetesService KubernetesServiceOperations
KubernetesStack KubernetesStackOperations KubernetesStack KubernetesStackOperations
KubernetesStackUpgrade KubernetesStackUpgradeOperations KubernetesStackUpgrade KubernetesStackUpgradeOperations
Label LabelOperations Label LabelOperations
LaunchConfig LaunchConfigOperations LaunchConfig LaunchConfigOperations
Ldapconfig LdapconfigOperations LbConfig LbConfigOperations
LoadBalancerAppCookieStickinessPolicy LoadBalancerAppCookieStickinessPolicyOperations LbTargetConfig LbTargetConfigOperations
LoadBalancerConfig LoadBalancerConfigOperations
LoadBalancerCookieStickinessPolicy LoadBalancerCookieStickinessPolicyOperations LoadBalancerCookieStickinessPolicy LoadBalancerCookieStickinessPolicyOperations
LoadBalancerService LoadBalancerServiceOperations LoadBalancerService LoadBalancerServiceOperations
LoadBalancerServiceLink LoadBalancerServiceLinkOperations
LocalAuthConfig LocalAuthConfigOperations LocalAuthConfig LocalAuthConfigOperations
LogConfig LogConfigOperations LogConfig LogConfigOperations
Machine MachineOperations Machine MachineOperations
MachineDriver MachineDriverOperations MachineDriver MachineDriverOperations
Mount MountOperations Mount MountOperations
MountEntry MountEntryOperations
Network NetworkOperations Network NetworkOperations
NetworkDriver NetworkDriverOperations
NetworkDriverService NetworkDriverServiceOperations
NetworkPolicyRule NetworkPolicyRuleOperations
NetworkPolicyRuleBetween NetworkPolicyRuleBetweenOperations
NetworkPolicyRuleMember NetworkPolicyRuleMemberOperations
NetworkPolicyRuleWithin NetworkPolicyRuleWithinOperations
NfsConfig NfsConfigOperations NfsConfig NfsConfigOperations
Openldapconfig OpenldapconfigOperations Openldapconfig OpenldapconfigOperations
PacketConfig PacketConfigOperations PacketConfig PacketConfigOperations
Password PasswordOperations Password PasswordOperations
PhysicalHost PhysicalHostOperations PhysicalHost PhysicalHostOperations
Port PortOperations Port PortOperations
PortRule PortRuleOperations
ProcessDefinition ProcessDefinitionOperations ProcessDefinition ProcessDefinitionOperations
ProcessExecution ProcessExecutionOperations ProcessExecution ProcessExecutionOperations
ProcessInstance ProcessInstanceOperations ProcessInstance ProcessInstanceOperations
ProcessPool ProcessPoolOperations
ProcessSummary ProcessSummaryOperations
Project ProjectOperations Project ProjectOperations
ProjectMember ProjectMemberOperations ProjectMember ProjectMemberOperations
ProjectTemplate ProjectTemplateOperations
PublicEndpoint PublicEndpointOperations PublicEndpoint PublicEndpointOperations
Publish PublishOperations Publish PublishOperations
PullTask PullTaskOperations PullTask PullTaskOperations
@ -115,36 +123,48 @@ type RancherClient struct {
RevertToSnapshotInput RevertToSnapshotInputOperations RevertToSnapshotInput RevertToSnapshotInputOperations
RollingRestartStrategy RollingRestartStrategyOperations RollingRestartStrategy RollingRestartStrategyOperations
ScalePolicy ScalePolicyOperations ScalePolicy ScalePolicyOperations
ScheduledUpgrade ScheduledUpgradeOperations
SecondaryLaunchConfig SecondaryLaunchConfigOperations SecondaryLaunchConfig SecondaryLaunchConfigOperations
Secret SecretOperations
SecretReference SecretReferenceOperations
Service ServiceOperations Service ServiceOperations
ServiceBinding ServiceBindingOperations
ServiceConsumeMap ServiceConsumeMapOperations ServiceConsumeMap ServiceConsumeMapOperations
ServiceEvent ServiceEventOperations ServiceEvent ServiceEventOperations
ServiceExposeMap ServiceExposeMapOperations ServiceExposeMap ServiceExposeMapOperations
ServiceLink ServiceLinkOperations ServiceLink ServiceLinkOperations
ServiceLog ServiceLogOperations
ServiceProxy ServiceProxyOperations ServiceProxy ServiceProxyOperations
ServiceRestart ServiceRestartOperations ServiceRestart ServiceRestartOperations
ServiceUpgrade ServiceUpgradeOperations ServiceUpgrade ServiceUpgradeOperations
ServiceUpgradeStrategy ServiceUpgradeStrategyOperations ServiceUpgradeStrategy ServiceUpgradeStrategyOperations
ServicesPortRange ServicesPortRangeOperations ServicesPortRange ServicesPortRangeOperations
SetLabelsInput SetLabelsInputOperations
SetLoadBalancerServiceLinksInput SetLoadBalancerServiceLinksInputOperations
SetProjectMembersInput SetProjectMembersInputOperations SetProjectMembersInput SetProjectMembersInputOperations
SetServiceLinksInput SetServiceLinksInputOperations SetServiceLinksInput SetServiceLinksInputOperations
Setting SettingOperations Setting SettingOperations
Snapshot SnapshotOperations Snapshot SnapshotOperations
SnapshotBackupInput SnapshotBackupInputOperations SnapshotBackupInput SnapshotBackupInputOperations
Stack StackOperations
StackUpgrade StackUpgradeOperations
StateTransition StateTransitionOperations StateTransition StateTransitionOperations
StatsAccess StatsAccessOperations StatsAccess StatsAccessOperations
StorageDriver StorageDriverOperations
StorageDriverService StorageDriverServiceOperations
StoragePool StoragePoolOperations StoragePool StoragePoolOperations
Subscribe SubscribeOperations Subnet SubnetOperations
TargetPortRule TargetPortRuleOperations
Task TaskOperations Task TaskOperations
TaskInstance TaskInstanceOperations TaskInstance TaskInstanceOperations
ToServiceUpgradeStrategy ToServiceUpgradeStrategyOperations ToServiceUpgradeStrategy ToServiceUpgradeStrategyOperations
TypeDocumentation TypeDocumentationOperations TypeDocumentation TypeDocumentationOperations
Ulimit UlimitOperations
UserPreference UserPreferenceOperations
VirtualMachine VirtualMachineOperations VirtualMachine VirtualMachineOperations
VirtualMachineDisk VirtualMachineDiskOperations VirtualMachineDisk VirtualMachineDiskOperations
Volume VolumeOperations Volume VolumeOperations
VolumeActivateInput VolumeActivateInputOperations
VolumeSnapshotInput VolumeSnapshotInputOperations VolumeSnapshotInput VolumeSnapshotInputOperations
VolumeTemplate VolumeTemplateOperations
} }
func constructClient(rancherBaseClient *RancherBaseClientImpl) *RancherClient { func constructClient(rancherBaseClient *RancherBaseClientImpl) *RancherClient {
@ -155,7 +175,6 @@ func constructClient(rancherBaseClient *RancherBaseClientImpl) *RancherClient {
client.Account = newAccountClient(client) client.Account = newAccountClient(client)
client.ActiveSetting = newActiveSettingClient(client) client.ActiveSetting = newActiveSettingClient(client)
client.AddOutputsInput = newAddOutputsInputClient(client) client.AddOutputsInput = newAddOutputsInputClient(client)
client.AddRemoveLoadBalancerServiceLinkInput = newAddRemoveLoadBalancerServiceLinkInputClient(client)
client.AddRemoveServiceLinkInput = newAddRemoveServiceLinkInputClient(client) client.AddRemoveServiceLinkInput = newAddRemoveServiceLinkInputClient(client)
client.Agent = newAgentClient(client) client.Agent = newAgentClient(client)
client.Amazonec2Config = newAmazonec2ConfigClient(client) client.Amazonec2Config = newAmazonec2ConfigClient(client)
@ -166,9 +185,12 @@ func constructClient(rancherBaseClient *RancherBaseClientImpl) *RancherClient {
client.Backup = newBackupClient(client) client.Backup = newBackupClient(client)
client.BackupTarget = newBackupTargetClient(client) client.BackupTarget = newBackupTargetClient(client)
client.BaseMachineConfig = newBaseMachineConfigClient(client) client.BaseMachineConfig = newBaseMachineConfigClient(client)
client.Binding = newBindingClient(client)
client.BlkioDeviceOption = newBlkioDeviceOptionClient(client) client.BlkioDeviceOption = newBlkioDeviceOptionClient(client)
client.CatalogTemplate = newCatalogTemplateClient(client)
client.Certificate = newCertificateClient(client) client.Certificate = newCertificateClient(client)
client.ChangeSecretInput = newChangeSecretInputClient(client) client.ChangeSecretInput = newChangeSecretInputClient(client)
client.ClusterMembership = newClusterMembershipClient(client)
client.ComposeConfig = newComposeConfigClient(client) client.ComposeConfig = newComposeConfigClient(client)
client.ComposeConfigInput = newComposeConfigInputClient(client) client.ComposeConfigInput = newComposeConfigInputClient(client)
client.ComposeProject = newComposeProjectClient(client) client.ComposeProject = newComposeProjectClient(client)
@ -183,12 +205,10 @@ func constructClient(rancherBaseClient *RancherBaseClientImpl) *RancherClient {
client.Credential = newCredentialClient(client) client.Credential = newCredentialClient(client)
client.Databasechangelog = newDatabasechangelogClient(client) client.Databasechangelog = newDatabasechangelogClient(client)
client.Databasechangeloglock = newDatabasechangeloglockClient(client) client.Databasechangeloglock = newDatabasechangeloglockClient(client)
client.DefaultNetwork = newDefaultNetworkClient(client)
client.DigitaloceanConfig = newDigitaloceanConfigClient(client) client.DigitaloceanConfig = newDigitaloceanConfigClient(client)
client.DnsService = newDnsServiceClient(client) client.DnsService = newDnsServiceClient(client)
client.DockerBuild = newDockerBuildClient(client) client.DockerBuild = newDockerBuildClient(client)
client.DynamicSchema = newDynamicSchemaClient(client)
client.Environment = newEnvironmentClient(client)
client.EnvironmentUpgrade = newEnvironmentUpgradeClient(client)
client.ExtensionImplementation = newExtensionImplementationClient(client) client.ExtensionImplementation = newExtensionImplementationClient(client)
client.ExtensionPoint = newExtensionPointClient(client) client.ExtensionPoint = newExtensionPointClient(client)
client.ExternalDnsEvent = newExternalDnsEventClient(client) client.ExternalDnsEvent = newExternalDnsEventClient(client)
@ -203,14 +223,14 @@ func constructClient(rancherBaseClient *RancherBaseClientImpl) *RancherClient {
client.ExternalStoragePoolEvent = newExternalStoragePoolEventClient(client) client.ExternalStoragePoolEvent = newExternalStoragePoolEventClient(client)
client.ExternalVolumeEvent = newExternalVolumeEventClient(client) client.ExternalVolumeEvent = newExternalVolumeEventClient(client)
client.FieldDocumentation = newFieldDocumentationClient(client) client.FieldDocumentation = newFieldDocumentationClient(client)
client.Githubconfig = newGithubconfigClient(client) client.GenericObject = newGenericObjectClient(client)
client.HaConfig = newHaConfigClient(client) client.HaConfig = newHaConfigClient(client)
client.HaConfigInput = newHaConfigInputClient(client) client.HaConfigInput = newHaConfigInputClient(client)
client.HaproxyConfig = newHaproxyConfigClient(client)
client.HealthcheckInstanceHostMap = newHealthcheckInstanceHostMapClient(client) client.HealthcheckInstanceHostMap = newHealthcheckInstanceHostMapClient(client)
client.Host = newHostClient(client) client.Host = newHostClient(client)
client.HostAccess = newHostAccessClient(client) client.HostAccess = newHostAccessClient(client)
client.HostApiProxyToken = newHostApiProxyTokenClient(client) client.HostApiProxyToken = newHostApiProxyTokenClient(client)
client.HostTemplate = newHostTemplateClient(client)
client.Identity = newIdentityClient(client) client.Identity = newIdentityClient(client)
client.Image = newImageClient(client) client.Image = newImageClient(client)
client.InServiceUpgradeStrategy = newInServiceUpgradeStrategyClient(client) client.InServiceUpgradeStrategy = newInServiceUpgradeStrategyClient(client)
@ -221,35 +241,43 @@ func constructClient(rancherBaseClient *RancherBaseClientImpl) *RancherClient {
client.InstanceLink = newInstanceLinkClient(client) client.InstanceLink = newInstanceLinkClient(client)
client.InstanceStop = newInstanceStopClient(client) client.InstanceStop = newInstanceStopClient(client)
client.IpAddress = newIpAddressClient(client) client.IpAddress = newIpAddressClient(client)
client.IpAddressAssociateInput = newIpAddressAssociateInputClient(client)
client.KubernetesService = newKubernetesServiceClient(client) client.KubernetesService = newKubernetesServiceClient(client)
client.KubernetesStack = newKubernetesStackClient(client) client.KubernetesStack = newKubernetesStackClient(client)
client.KubernetesStackUpgrade = newKubernetesStackUpgradeClient(client) client.KubernetesStackUpgrade = newKubernetesStackUpgradeClient(client)
client.Label = newLabelClient(client) client.Label = newLabelClient(client)
client.LaunchConfig = newLaunchConfigClient(client) client.LaunchConfig = newLaunchConfigClient(client)
client.Ldapconfig = newLdapconfigClient(client) client.LbConfig = newLbConfigClient(client)
client.LoadBalancerAppCookieStickinessPolicy = newLoadBalancerAppCookieStickinessPolicyClient(client) client.LbTargetConfig = newLbTargetConfigClient(client)
client.LoadBalancerConfig = newLoadBalancerConfigClient(client)
client.LoadBalancerCookieStickinessPolicy = newLoadBalancerCookieStickinessPolicyClient(client) client.LoadBalancerCookieStickinessPolicy = newLoadBalancerCookieStickinessPolicyClient(client)
client.LoadBalancerService = newLoadBalancerServiceClient(client) client.LoadBalancerService = newLoadBalancerServiceClient(client)
client.LoadBalancerServiceLink = newLoadBalancerServiceLinkClient(client)
client.LocalAuthConfig = newLocalAuthConfigClient(client) client.LocalAuthConfig = newLocalAuthConfigClient(client)
client.LogConfig = newLogConfigClient(client) client.LogConfig = newLogConfigClient(client)
client.Machine = newMachineClient(client) client.Machine = newMachineClient(client)
client.MachineDriver = newMachineDriverClient(client) client.MachineDriver = newMachineDriverClient(client)
client.Mount = newMountClient(client) client.Mount = newMountClient(client)
client.MountEntry = newMountEntryClient(client)
client.Network = newNetworkClient(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.NfsConfig = newNfsConfigClient(client)
client.Openldapconfig = newOpenldapconfigClient(client) client.Openldapconfig = newOpenldapconfigClient(client)
client.PacketConfig = newPacketConfigClient(client) client.PacketConfig = newPacketConfigClient(client)
client.Password = newPasswordClient(client) client.Password = newPasswordClient(client)
client.PhysicalHost = newPhysicalHostClient(client) client.PhysicalHost = newPhysicalHostClient(client)
client.Port = newPortClient(client) client.Port = newPortClient(client)
client.PortRule = newPortRuleClient(client)
client.ProcessDefinition = newProcessDefinitionClient(client) client.ProcessDefinition = newProcessDefinitionClient(client)
client.ProcessExecution = newProcessExecutionClient(client) client.ProcessExecution = newProcessExecutionClient(client)
client.ProcessInstance = newProcessInstanceClient(client) client.ProcessInstance = newProcessInstanceClient(client)
client.ProcessPool = newProcessPoolClient(client)
client.ProcessSummary = newProcessSummaryClient(client)
client.Project = newProjectClient(client) client.Project = newProjectClient(client)
client.ProjectMember = newProjectMemberClient(client) client.ProjectMember = newProjectMemberClient(client)
client.ProjectTemplate = newProjectTemplateClient(client)
client.PublicEndpoint = newPublicEndpointClient(client) client.PublicEndpoint = newPublicEndpointClient(client)
client.Publish = newPublishClient(client) client.Publish = newPublishClient(client)
client.PullTask = newPullTaskClient(client) client.PullTask = newPullTaskClient(client)
@ -264,36 +292,48 @@ func constructClient(rancherBaseClient *RancherBaseClientImpl) *RancherClient {
client.RevertToSnapshotInput = newRevertToSnapshotInputClient(client) client.RevertToSnapshotInput = newRevertToSnapshotInputClient(client)
client.RollingRestartStrategy = newRollingRestartStrategyClient(client) client.RollingRestartStrategy = newRollingRestartStrategyClient(client)
client.ScalePolicy = newScalePolicyClient(client) client.ScalePolicy = newScalePolicyClient(client)
client.ScheduledUpgrade = newScheduledUpgradeClient(client)
client.SecondaryLaunchConfig = newSecondaryLaunchConfigClient(client) client.SecondaryLaunchConfig = newSecondaryLaunchConfigClient(client)
client.Secret = newSecretClient(client)
client.SecretReference = newSecretReferenceClient(client)
client.Service = newServiceClient(client) client.Service = newServiceClient(client)
client.ServiceBinding = newServiceBindingClient(client)
client.ServiceConsumeMap = newServiceConsumeMapClient(client) client.ServiceConsumeMap = newServiceConsumeMapClient(client)
client.ServiceEvent = newServiceEventClient(client) client.ServiceEvent = newServiceEventClient(client)
client.ServiceExposeMap = newServiceExposeMapClient(client) client.ServiceExposeMap = newServiceExposeMapClient(client)
client.ServiceLink = newServiceLinkClient(client) client.ServiceLink = newServiceLinkClient(client)
client.ServiceLog = newServiceLogClient(client)
client.ServiceProxy = newServiceProxyClient(client) client.ServiceProxy = newServiceProxyClient(client)
client.ServiceRestart = newServiceRestartClient(client) client.ServiceRestart = newServiceRestartClient(client)
client.ServiceUpgrade = newServiceUpgradeClient(client) client.ServiceUpgrade = newServiceUpgradeClient(client)
client.ServiceUpgradeStrategy = newServiceUpgradeStrategyClient(client) client.ServiceUpgradeStrategy = newServiceUpgradeStrategyClient(client)
client.ServicesPortRange = newServicesPortRangeClient(client) client.ServicesPortRange = newServicesPortRangeClient(client)
client.SetLabelsInput = newSetLabelsInputClient(client)
client.SetLoadBalancerServiceLinksInput = newSetLoadBalancerServiceLinksInputClient(client)
client.SetProjectMembersInput = newSetProjectMembersInputClient(client) client.SetProjectMembersInput = newSetProjectMembersInputClient(client)
client.SetServiceLinksInput = newSetServiceLinksInputClient(client) client.SetServiceLinksInput = newSetServiceLinksInputClient(client)
client.Setting = newSettingClient(client) client.Setting = newSettingClient(client)
client.Snapshot = newSnapshotClient(client) client.Snapshot = newSnapshotClient(client)
client.SnapshotBackupInput = newSnapshotBackupInputClient(client) client.SnapshotBackupInput = newSnapshotBackupInputClient(client)
client.Stack = newStackClient(client)
client.StackUpgrade = newStackUpgradeClient(client)
client.StateTransition = newStateTransitionClient(client) client.StateTransition = newStateTransitionClient(client)
client.StatsAccess = newStatsAccessClient(client) client.StatsAccess = newStatsAccessClient(client)
client.StorageDriver = newStorageDriverClient(client)
client.StorageDriverService = newStorageDriverServiceClient(client)
client.StoragePool = newStoragePoolClient(client) client.StoragePool = newStoragePoolClient(client)
client.Subscribe = newSubscribeClient(client) client.Subnet = newSubnetClient(client)
client.TargetPortRule = newTargetPortRuleClient(client)
client.Task = newTaskClient(client) client.Task = newTaskClient(client)
client.TaskInstance = newTaskInstanceClient(client) client.TaskInstance = newTaskInstanceClient(client)
client.ToServiceUpgradeStrategy = newToServiceUpgradeStrategyClient(client) client.ToServiceUpgradeStrategy = newToServiceUpgradeStrategyClient(client)
client.TypeDocumentation = newTypeDocumentationClient(client) client.TypeDocumentation = newTypeDocumentationClient(client)
client.Ulimit = newUlimitClient(client)
client.UserPreference = newUserPreferenceClient(client)
client.VirtualMachine = newVirtualMachineClient(client) client.VirtualMachine = newVirtualMachineClient(client)
client.VirtualMachineDisk = newVirtualMachineDiskClient(client) client.VirtualMachineDisk = newVirtualMachineDiskClient(client)
client.Volume = newVolumeClient(client) client.Volume = newVolumeClient(client)
client.VolumeActivateInput = newVolumeActivateInputClient(client)
client.VolumeSnapshotInput = newVolumeSnapshotInputClient(client) client.VolumeSnapshotInput = newVolumeSnapshotInputClient(client)
client.VolumeTemplate = newVolumeTemplateClient(client)
return client return client
} }

View file

@ -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)
}

View file

@ -9,6 +9,10 @@ type ComposeProject struct {
AccountId string `json:"accountId,omitempty" yaml:"account_id,omitempty"` 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"` Created string `json:"created,omitempty" yaml:"created,omitempty"`
Data map[string]interface{} `json:"data,omitempty" yaml:"data,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"` 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"` HealthState string `json:"healthState,omitempty" yaml:"health_state,omitempty"`
Kind string `json:"kind,omitempty" yaml:"kind,omitempty"` Kind string `json:"kind,omitempty" yaml:"kind,omitempty"`
@ -33,8 +39,12 @@ type ComposeProject struct {
Removed string `json:"removed,omitempty" yaml:"removed,omitempty"` 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"` 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"` Templates map[string]interface{} `json:"templates,omitempty" yaml:"templates,omitempty"`
Transitioning string `json:"transitioning,omitempty" yaml:"transitioning,omitempty"` Transitioning string `json:"transitioning,omitempty" yaml:"transitioning,omitempty"`
@ -63,19 +73,17 @@ type ComposeProjectOperations interface {
ById(id string) (*ComposeProject, error) ById(id string) (*ComposeProject, error)
Delete(container *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) (*Stack, error)
ActionRollback(*ComposeProject) (*Environment, error)
} }
func newComposeProjectClient(rancherClient *RancherClient) *ComposeProjectClient { 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) 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{} resp := &Stack{}
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{}
err := c.rancherClient.doAction(COMPOSE_PROJECT_TYPE, "cancelupgrade", &resource.Resource, nil, resp) err := c.rancherClient.doAction(COMPOSE_PROJECT_TYPE, "cancelupgrade", &resource.Resource, nil, resp)
return resp, err 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) err := c.rancherClient.doAction(COMPOSE_PROJECT_TYPE, "create", &resource.Resource, nil, resp)
return resp, err 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) err := c.rancherClient.doAction(COMPOSE_PROJECT_TYPE, "error", &resource.Resource, nil, resp)
return resp, err 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) err := c.rancherClient.doAction(COMPOSE_PROJECT_TYPE, "finishupgrade", &resource.Resource, nil, resp)
return resp, err 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) err := c.rancherClient.doAction(COMPOSE_PROJECT_TYPE, "remove", &resource.Resource, nil, resp)
return resp, err 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) err := c.rancherClient.doAction(COMPOSE_PROJECT_TYPE, "rollback", &resource.Resource, nil, resp)

View file

@ -17,21 +17,23 @@ type ComposeService struct {
Description string `json:"description,omitempty" yaml:"description,omitempty"` 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"` ExternalId string `json:"externalId,omitempty" yaml:"external_id,omitempty"`
Fqdn string `json:"fqdn,omitempty" yaml:"fqdn,omitempty"` Fqdn string `json:"fqdn,omitempty" yaml:"fqdn,omitempty"`
HealthState string `json:"healthState,omitempty" yaml:"health_state,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"` Kind string `json:"kind,omitempty" yaml:"kind,omitempty"`
LaunchConfig *LaunchConfig `json:"launchConfig,omitempty" yaml:"launch_config,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"` 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"` 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"` 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"` StartOnCreate bool `json:"startOnCreate,omitempty" yaml:"start_on_create,omitempty"`
State string `json:"state,omitempty" yaml:"state,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"` Transitioning string `json:"transitioning,omitempty" yaml:"transitioning,omitempty"`
TransitioningMessage string `json:"transitioningMessage,omitempty" yaml:"transitioning_message,omitempty"` TransitioningMessage string `json:"transitioningMessage,omitempty" yaml:"transitioning_message,omitempty"`
@ -79,10 +85,10 @@ type ComposeServiceOperations interface {
ActionActivate(*ComposeService) (*Service, error) ActionActivate(*ComposeService) (*Service, error)
ActionCancelrollback(*ComposeService) (*Service, error)
ActionCancelupgrade(*ComposeService) (*Service, error) ActionCancelupgrade(*ComposeService) (*Service, error)
ActionContinueupgrade(*ComposeService) (*Service, error)
ActionCreate(*ComposeService) (*Service, error) ActionCreate(*ComposeService) (*Service, error)
ActionFinishupgrade(*ComposeService) (*Service, error) ActionFinishupgrade(*ComposeService) (*Service, error)
@ -151,15 +157,6 @@ func (c *ComposeServiceClient) ActionActivate(resource *ComposeService) (*Servic
return resp, err 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) { func (c *ComposeServiceClient) ActionCancelupgrade(resource *ComposeService) (*Service, error) {
resp := &Service{} resp := &Service{}
@ -169,6 +166,15 @@ func (c *ComposeServiceClient) ActionCancelupgrade(resource *ComposeService) (*S
return resp, err 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) { func (c *ComposeServiceClient) ActionCreate(resource *ComposeService) (*Service, error) {
resp := &Service{} resp := &Service{}

View file

@ -15,18 +15,36 @@ type Container struct {
BlkioDeviceOptions map[string]interface{} `json:"blkioDeviceOptions,omitempty" yaml:"blkio_device_options,omitempty"` 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"` Build *DockerBuild `json:"build,omitempty" yaml:"build,omitempty"`
CapAdd []string `json:"capAdd,omitempty" yaml:"cap_add,omitempty"` CapAdd []string `json:"capAdd,omitempty" yaml:"cap_add,omitempty"`
CapDrop []string `json:"capDrop,omitempty" yaml:"cap_drop,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"` Command []string `json:"command,omitempty" yaml:"command,omitempty"`
Count int64 `json:"count,omitempty" yaml:"count,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"` 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"` CpuShares int64 `json:"cpuShares,omitempty" yaml:"cpu_shares,omitempty"`
CreateIndex int64 `json:"createIndex,omitempty" yaml:"create_index,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"` 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"` 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"` DnsSearch []string `json:"dnsSearch,omitempty" yaml:"dns_search,omitempty"`
DomainName string `json:"domainName,omitempty" yaml:"domain_name,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"` 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"` 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"` 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"` HostId string `json:"hostId,omitempty" yaml:"host_id,omitempty"`
Hostname string `json:"hostname,omitempty" yaml:"hostname,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"` 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"` Kind string `json:"kind,omitempty" yaml:"kind,omitempty"`
Labels map[string]interface{} `json:"labels,omitempty" yaml:"labels,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"` 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"` 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"` Name string `json:"name,omitempty" yaml:"name,omitempty"`
NativeContainer bool `json:"nativeContainer,omitempty" yaml:"native_container,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"` NetworkContainerId string `json:"networkContainerId,omitempty" yaml:"network_container_id,omitempty"`
NetworkIds []string `json:"networkIds,omitempty" yaml:"network_ids,omitempty"` NetworkIds []string `json:"networkIds,omitempty" yaml:"network_ids,omitempty"`
NetworkMode string `json:"networkMode,omitempty" yaml:"network_mode,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"` 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"` Ports []string `json:"ports,omitempty" yaml:"ports,omitempty"`
PrimaryIpAddress string `json:"primaryIpAddress,omitempty" yaml:"primary_ip_address,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"` Privileged bool `json:"privileged,omitempty" yaml:"privileged,omitempty"`
PublishAllPorts bool `json:"publishAllPorts,omitempty" yaml:"publish_all_ports,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"` 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"` 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"` StartCount int64 `json:"startCount,omitempty" yaml:"start_count,omitempty"`
StartOnCreate bool `json:"startOnCreate,omitempty" yaml:"start_on_create,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"` 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"` Token string `json:"token,omitempty" yaml:"token,omitempty"`
@ -143,8 +231,16 @@ type Container struct {
Tty bool `json:"tty,omitempty" yaml:"tty,omitempty"` Tty bool `json:"tty,omitempty" yaml:"tty,omitempty"`
Ulimits []Ulimit `json:"ulimits,omitempty" yaml:"ulimits,omitempty"`
User string `json:"user,omitempty" yaml:"user,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"` Uuid string `json:"uuid,omitempty" yaml:"uuid,omitempty"`
Version string `json:"version,omitempty" yaml:"version,omitempty"` Version string `json:"version,omitempty" yaml:"version,omitempty"`
@ -195,10 +291,6 @@ type ContainerOperations interface {
ActionRestart(*Container) (*Instance, error) ActionRestart(*Container) (*Instance, error)
ActionRestore(*Container) (*Instance, error)
ActionSetlabels(*Container, *SetLabelsInput) (*Container, error)
ActionStart(*Container) (*Instance, error) ActionStart(*Container) (*Instance, error)
ActionStop(*Container, *InstanceStop) (*Instance, error) ActionStop(*Container, *InstanceStop) (*Instance, error)
@ -370,24 +462,6 @@ func (c *ContainerClient) ActionRestart(resource *Container) (*Instance, error)
return resp, err 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) { func (c *ContainerClient) ActionStart(resource *Container) (*Instance, error) {
resp := &Instance{} resp := &Instance{}

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
}

View file

@ -23,6 +23,8 @@ type DigitaloceanConfig struct {
SshKeyFingerprint string `json:"sshKeyFingerprint,omitempty" yaml:"ssh_key_fingerprint,omitempty"` 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"` SshPort string `json:"sshPort,omitempty" yaml:"ssh_port,omitempty"`
SshUser string `json:"sshUser,omitempty" yaml:"ssh_user,omitempty"` SshUser string `json:"sshUser,omitempty" yaml:"ssh_user,omitempty"`

View file

@ -17,18 +17,20 @@ type DnsService struct {
Description string `json:"description,omitempty" yaml:"description,omitempty"` 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"` ExternalId string `json:"externalId,omitempty" yaml:"external_id,omitempty"`
Fqdn string `json:"fqdn,omitempty" yaml:"fqdn,omitempty"` Fqdn string `json:"fqdn,omitempty" yaml:"fqdn,omitempty"`
HealthState string `json:"healthState,omitempty" yaml:"health_state,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"` Kind string `json:"kind,omitempty" yaml:"kind,omitempty"`
LaunchConfig *LaunchConfig `json:"launchConfig,omitempty" yaml:"launch_config,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"` Metadata map[string]interface{} `json:"metadata,omitempty" yaml:"metadata,omitempty"`
Name string `json:"name,omitempty" yaml:"name,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"` 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"` StartOnCreate bool `json:"startOnCreate,omitempty" yaml:"start_on_create,omitempty"`
State string `json:"state,omitempty" yaml:"state,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"` Transitioning string `json:"transitioning,omitempty" yaml:"transitioning,omitempty"`
TransitioningMessage string `json:"transitioningMessage,omitempty" yaml:"transitioning_message,omitempty"` TransitioningMessage string `json:"transitioningMessage,omitempty" yaml:"transitioning_message,omitempty"`
@ -77,10 +83,10 @@ type DnsServiceOperations interface {
ActionAddservicelink(*DnsService, *AddRemoveServiceLinkInput) (*Service, error) ActionAddservicelink(*DnsService, *AddRemoveServiceLinkInput) (*Service, error)
ActionCancelrollback(*DnsService) (*Service, error)
ActionCancelupgrade(*DnsService) (*Service, error) ActionCancelupgrade(*DnsService) (*Service, error)
ActionContinueupgrade(*DnsService) (*Service, error)
ActionCreate(*DnsService) (*Service, error) ActionCreate(*DnsService) (*Service, error)
ActionDeactivate(*DnsService) (*Service, error) ActionDeactivate(*DnsService) (*Service, error)
@ -170,15 +176,6 @@ func (c *DnsServiceClient) ActionAddservicelink(resource *DnsService, input *Add
return resp, err 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) { func (c *DnsServiceClient) ActionCancelupgrade(resource *DnsService) (*Service, error) {
resp := &Service{} resp := &Service{}
@ -188,6 +185,15 @@ func (c *DnsServiceClient) ActionCancelupgrade(resource *DnsService) (*Service,
return resp, err 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) { func (c *DnsServiceClient) ActionCreate(resource *DnsService) (*Service, error) {
resp := &Service{} resp := &Service{}

View file

@ -9,7 +9,7 @@ type ExtensionPoint struct {
ExcludeSetting string `json:"excludeSetting,omitempty" yaml:"exclude_setting,omitempty"` 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"` IncludeSetting string `json:"includeSetting,omitempty" yaml:"include_setting,omitempty"`

View file

@ -19,7 +19,7 @@ type ExternalHandler struct {
Priority int64 `json:"priority,omitempty" yaml:"priority,omitempty"` 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"` RemoveTime string `json:"removeTime,omitempty" yaml:"remove_time,omitempty"`
@ -67,8 +67,6 @@ type ExternalHandlerOperations interface {
ActionRemove(*ExternalHandler) (*ExternalHandler, error) ActionRemove(*ExternalHandler) (*ExternalHandler, error)
ActionRestore(*ExternalHandler) (*ExternalHandler, error)
ActionUpdate(*ExternalHandler) (*ExternalHandler, error) ActionUpdate(*ExternalHandler) (*ExternalHandler, error)
} }
@ -167,15 +165,6 @@ func (c *ExternalHandlerClient) ActionRemove(resource *ExternalHandler) (*Extern
return resp, err 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) { func (c *ExternalHandlerClient) ActionUpdate(resource *ExternalHandler) (*ExternalHandler, error) {
resp := &ExternalHandler{} resp := &ExternalHandler{}

View file

@ -13,6 +13,8 @@ type ExternalHandlerExternalHandlerProcessMap struct {
Description string `json:"description,omitempty" yaml:"description,omitempty"` 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"` ExternalHandlerId string `json:"externalHandlerId,omitempty" yaml:"external_handler_id,omitempty"`
ExternalHandlerProcessId string `json:"externalHandlerProcessId,omitempty" yaml:"external_handler_process_id,omitempty"` ExternalHandlerProcessId string `json:"externalHandlerProcessId,omitempty" yaml:"external_handler_process_id,omitempty"`
@ -65,8 +67,6 @@ type ExternalHandlerExternalHandlerProcessMapOperations interface {
ActionRemove(*ExternalHandlerExternalHandlerProcessMap) (*ExternalHandlerExternalHandlerProcessMap, error) ActionRemove(*ExternalHandlerExternalHandlerProcessMap) (*ExternalHandlerExternalHandlerProcessMap, error)
ActionRestore(*ExternalHandlerExternalHandlerProcessMap) (*ExternalHandlerExternalHandlerProcessMap, error)
ActionUpdate(*ExternalHandlerExternalHandlerProcessMap) (*ExternalHandlerExternalHandlerProcessMap, error) ActionUpdate(*ExternalHandlerExternalHandlerProcessMap) (*ExternalHandlerExternalHandlerProcessMap, error)
} }
@ -165,15 +165,6 @@ func (c *ExternalHandlerExternalHandlerProcessMapClient) ActionRemove(resource *
return resp, err 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) { func (c *ExternalHandlerExternalHandlerProcessMapClient) ActionUpdate(resource *ExternalHandlerExternalHandlerProcessMap) (*ExternalHandlerExternalHandlerProcessMap, error) {
resp := &ExternalHandlerExternalHandlerProcessMap{} resp := &ExternalHandlerExternalHandlerProcessMap{}

View file

@ -59,8 +59,6 @@ type ExternalHandlerProcessOperations interface {
ActionRemove(*ExternalHandlerProcess) (*ExternalHandlerProcess, error) ActionRemove(*ExternalHandlerProcess) (*ExternalHandlerProcess, error)
ActionRestore(*ExternalHandlerProcess) (*ExternalHandlerProcess, error)
ActionUpdate(*ExternalHandlerProcess) (*ExternalHandlerProcess, error) ActionUpdate(*ExternalHandlerProcess) (*ExternalHandlerProcess, error)
} }
@ -159,15 +157,6 @@ func (c *ExternalHandlerProcessClient) ActionRemove(resource *ExternalHandlerPro
return resp, err 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) { func (c *ExternalHandlerProcessClient) ActionUpdate(resource *ExternalHandlerProcess) (*ExternalHandlerProcess, error) {
resp := &ExternalHandlerProcess{} resp := &ExternalHandlerProcess{}

View file

@ -15,8 +15,6 @@ type ExternalService struct {
Description string `json:"description,omitempty" yaml:"description,omitempty"` 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"` ExternalId string `json:"externalId,omitempty" yaml:"external_id,omitempty"`
ExternalIpAddresses []string `json:"externalIpAddresses,omitempty" yaml:"external_ip_addresses,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"` 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"` Kind string `json:"kind,omitempty" yaml:"kind,omitempty"`
LaunchConfig *LaunchConfig `json:"launchConfig,omitempty" yaml:"launch_config,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"` Metadata map[string]interface{} `json:"metadata,omitempty" yaml:"metadata,omitempty"`
Name string `json:"name,omitempty" yaml:"name,omitempty"` Name string `json:"name,omitempty" yaml:"name,omitempty"`
@ -41,10 +43,14 @@ type ExternalService struct {
Removed string `json:"removed,omitempty" yaml:"removed,omitempty"` 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"` StartOnCreate bool `json:"startOnCreate,omitempty" yaml:"start_on_create,omitempty"`
State string `json:"state,omitempty" yaml:"state,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"` Transitioning string `json:"transitioning,omitempty" yaml:"transitioning,omitempty"`
TransitioningMessage string `json:"transitioningMessage,omitempty" yaml:"transitioning_message,omitempty"` TransitioningMessage string `json:"transitioningMessage,omitempty" yaml:"transitioning_message,omitempty"`
@ -75,10 +81,10 @@ type ExternalServiceOperations interface {
ActionActivate(*ExternalService) (*Service, error) ActionActivate(*ExternalService) (*Service, error)
ActionCancelrollback(*ExternalService) (*Service, error)
ActionCancelupgrade(*ExternalService) (*Service, error) ActionCancelupgrade(*ExternalService) (*Service, error)
ActionContinueupgrade(*ExternalService) (*Service, error)
ActionCreate(*ExternalService) (*Service, error) ActionCreate(*ExternalService) (*Service, error)
ActionDeactivate(*ExternalService) (*Service, error) ActionDeactivate(*ExternalService) (*Service, error)
@ -155,15 +161,6 @@ func (c *ExternalServiceClient) ActionActivate(resource *ExternalService) (*Serv
return resp, err 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) { func (c *ExternalServiceClient) ActionCancelupgrade(resource *ExternalService) (*Service, error) {
resp := &Service{} resp := &Service{}
@ -173,6 +170,15 @@ func (c *ExternalServiceClient) ActionCancelupgrade(resource *ExternalService) (
return resp, err 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) { func (c *ExternalServiceClient) ActionCreate(resource *ExternalService) (*Service, error) {
resp := &Service{} resp := &Service{}

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
}

View file

@ -11,10 +11,20 @@ type Host struct {
AgentId string `json:"agentId,omitempty" yaml:"agent_id,omitempty"` 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"` 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"` 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"` ComputeTotal int64 `json:"computeTotal,omitempty" yaml:"compute_total,omitempty"`
Created string `json:"created,omitempty" yaml:"created,omitempty"` Created string `json:"created,omitempty" yaml:"created,omitempty"`
@ -23,24 +33,58 @@ type Host struct {
Description string `json:"description,omitempty" yaml:"description,omitempty"` 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"` Hostname string `json:"hostname,omitempty" yaml:"hostname,omitempty"`
Info interface{} `json:"info,omitempty" yaml:"info,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"` Kind string `json:"kind,omitempty" yaml:"kind,omitempty"`
Labels map[string]interface{} `json:"labels,omitempty" yaml:"labels,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"` 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"` 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"` RemoveTime string `json:"removeTime,omitempty" yaml:"remove_time,omitempty"`
Removed string `json:"removed,omitempty" yaml:"removed,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"` State string `json:"state,omitempty" yaml:"state,omitempty"`
Transitioning string `json:"transitioning,omitempty" yaml:"transitioning,omitempty"` Transitioning string `json:"transitioning,omitempty" yaml:"transitioning,omitempty"`
@ -77,12 +121,16 @@ type HostOperations interface {
ActionDockersocket(*Host) (*HostAccess, error) ActionDockersocket(*Host) (*HostAccess, error)
ActionError(*Host) (*Host, error)
ActionEvacuate(*Host) (*Host, error)
ActionProvision(*Host) (*Host, error)
ActionPurge(*Host) (*Host, error) ActionPurge(*Host) (*Host, error)
ActionRemove(*Host) (*Host, error) ActionRemove(*Host) (*Host, error)
ActionRestore(*Host) (*Host, error)
ActionUpdate(*Host) (*Host, error) ActionUpdate(*Host) (*Host, error)
} }
@ -172,6 +220,33 @@ func (c *HostClient) ActionDockersocket(resource *Host) (*HostAccess, error) {
return resp, err 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) { func (c *HostClient) ActionPurge(resource *Host) (*Host, error) {
resp := &Host{} resp := &Host{}
@ -190,15 +265,6 @@ func (c *HostClient) ActionRemove(resource *Host) (*Host, error) {
return resp, err 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) { func (c *HostClient) ActionUpdate(resource *Host) (*Host, error) {
resp := &Host{} resp := &Host{}

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
}

View file

@ -24,6 +24,8 @@ type Identity struct {
ProjectId string `json:"projectId,omitempty" yaml:"project_id,omitempty"` ProjectId string `json:"projectId,omitempty" yaml:"project_id,omitempty"`
Role string `json:"role,omitempty" yaml:"role,omitempty"` Role string `json:"role,omitempty" yaml:"role,omitempty"`
User bool `json:"user,omitempty" yaml:"user,omitempty"`
} }
type IdentityCollection struct { type IdentityCollection struct {

View file

@ -61,8 +61,6 @@ type ImageOperations interface {
ActionRemove(*Image) (*Image, error) ActionRemove(*Image) (*Image, error)
ActionRestore(*Image) (*Image, error)
ActionUpdate(*Image) (*Image, error) ActionUpdate(*Image) (*Image, error)
} }
@ -161,15 +159,6 @@ func (c *ImageClient) ActionRemove(resource *Image) (*Image, error) {
return resp, err 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) { func (c *ImageClient) ActionUpdate(resource *Image) (*Image, error) {
resp := &Image{} resp := &Image{}

View file

@ -15,9 +15,9 @@ type InServiceUpgradeStrategy struct {
PreviousLaunchConfig *LaunchConfig `json:"previousLaunchConfig,omitempty" yaml:"previous_launch_config,omitempty"` 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"` StartFirst bool `json:"startFirst,omitempty" yaml:"start_first,omitempty"`
} }

View file

@ -73,8 +73,6 @@ type InstanceOperations interface {
ActionRestart(*Instance) (*Instance, error) ActionRestart(*Instance) (*Instance, error)
ActionRestore(*Instance) (*Instance, error)
ActionStart(*Instance) (*Instance, error) ActionStart(*Instance) (*Instance, error)
ActionStop(*Instance, *InstanceStop) (*Instance, error) ActionStop(*Instance, *InstanceStop) (*Instance, error)
@ -219,15 +217,6 @@ func (c *InstanceClient) ActionRestart(resource *Instance) (*Instance, error) {
return resp, err 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) { func (c *InstanceClient) ActionStart(resource *Instance) (*Instance, error) {
resp := &Instance{} resp := &Instance{}

View file

@ -69,8 +69,6 @@ type InstanceLinkOperations interface {
ActionRemove(*InstanceLink) (*InstanceLink, error) ActionRemove(*InstanceLink) (*InstanceLink, error)
ActionRestore(*InstanceLink) (*InstanceLink, error)
ActionUpdate(*InstanceLink) (*InstanceLink, error) ActionUpdate(*InstanceLink) (*InstanceLink, error)
} }
@ -169,15 +167,6 @@ func (c *InstanceLinkClient) ActionRemove(resource *InstanceLink) (*InstanceLink
return resp, err 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) { func (c *InstanceLinkClient) ActionUpdate(resource *InstanceLink) (*InstanceLink, error) {
resp := &InstanceLink{} resp := &InstanceLink{}

View file

@ -57,6 +57,8 @@ type IpAddressOperations interface {
ActionActivate(*IpAddress) (*IpAddress, error) ActionActivate(*IpAddress) (*IpAddress, error)
ActionAssociate(*IpAddress) (*IpAddress, error)
ActionCreate(*IpAddress) (*IpAddress, error) ActionCreate(*IpAddress) (*IpAddress, error)
ActionDeactivate(*IpAddress) (*IpAddress, error) ActionDeactivate(*IpAddress) (*IpAddress, error)
@ -67,8 +69,6 @@ type IpAddressOperations interface {
ActionRemove(*IpAddress) (*IpAddress, error) ActionRemove(*IpAddress) (*IpAddress, error)
ActionRestore(*IpAddress) (*IpAddress, error)
ActionUpdate(*IpAddress) (*IpAddress, error) ActionUpdate(*IpAddress) (*IpAddress, error)
} }
@ -131,6 +131,15 @@ func (c *IpAddressClient) ActionActivate(resource *IpAddress) (*IpAddress, error
return resp, err 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) { func (c *IpAddressClient) ActionCreate(resource *IpAddress) (*IpAddress, error) {
resp := &IpAddress{} resp := &IpAddress{}
@ -176,15 +185,6 @@ func (c *IpAddressClient) ActionRemove(resource *IpAddress) (*IpAddress, error)
return resp, err 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) { func (c *IpAddressClient) ActionUpdate(resource *IpAddress) (*IpAddress, error) {
resp := &IpAddress{} resp := &IpAddress{}

View file

@ -15,14 +15,16 @@ type KubernetesService struct {
Description string `json:"description,omitempty" yaml:"description,omitempty"` 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"` ExternalId string `json:"externalId,omitempty" yaml:"external_id,omitempty"`
HealthState string `json:"healthState,omitempty" yaml:"health_state,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"` 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"` Name string `json:"name,omitempty" yaml:"name,omitempty"`
RemoveTime string `json:"removeTime,omitempty" yaml:"remove_time,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"` 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"` State string `json:"state,omitempty" yaml:"state,omitempty"`
System bool `json:"system,omitempty" yaml:"system,omitempty"`
Template interface{} `json:"template,omitempty" yaml:"template,omitempty"` Template interface{} `json:"template,omitempty" yaml:"template,omitempty"`
Transitioning string `json:"transitioning,omitempty" yaml:"transitioning,omitempty"` Transitioning string `json:"transitioning,omitempty" yaml:"transitioning,omitempty"`
@ -67,10 +73,10 @@ type KubernetesServiceOperations interface {
ActionAddservicelink(*KubernetesService, *AddRemoveServiceLinkInput) (*Service, error) ActionAddservicelink(*KubernetesService, *AddRemoveServiceLinkInput) (*Service, error)
ActionCancelrollback(*KubernetesService) (*Service, error)
ActionCancelupgrade(*KubernetesService) (*Service, error) ActionCancelupgrade(*KubernetesService) (*Service, error)
ActionContinueupgrade(*KubernetesService) (*Service, error)
ActionCreate(*KubernetesService) (*Service, error) ActionCreate(*KubernetesService) (*Service, error)
ActionDeactivate(*KubernetesService) (*Service, error) ActionDeactivate(*KubernetesService) (*Service, error)
@ -160,15 +166,6 @@ func (c *KubernetesServiceClient) ActionAddservicelink(resource *KubernetesServi
return resp, err 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) { func (c *KubernetesServiceClient) ActionCancelupgrade(resource *KubernetesService) (*Service, error) {
resp := &Service{} resp := &Service{}
@ -178,6 +175,15 @@ func (c *KubernetesServiceClient) ActionCancelupgrade(resource *KubernetesServic
return resp, err 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) { func (c *KubernetesServiceClient) ActionCreate(resource *KubernetesService) (*Service, error) {
resp := &Service{} resp := &Service{}

View file

@ -9,6 +9,10 @@ type KubernetesStack struct {
AccountId string `json:"accountId,omitempty" yaml:"account_id,omitempty"` 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"` Created string `json:"created,omitempty" yaml:"created,omitempty"`
Data map[string]interface{} `json:"data,omitempty" yaml:"data,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"` 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"` HealthState string `json:"healthState,omitempty" yaml:"health_state,omitempty"`
Kind string `json:"kind,omitempty" yaml:"kind,omitempty"` Kind string `json:"kind,omitempty" yaml:"kind,omitempty"`
@ -35,8 +41,12 @@ type KubernetesStack struct {
Removed string `json:"removed,omitempty" yaml:"removed,omitempty"` 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"` 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"` Templates map[string]interface{} `json:"templates,omitempty" yaml:"templates,omitempty"`
Transitioning string `json:"transitioning,omitempty" yaml:"transitioning,omitempty"` Transitioning string `json:"transitioning,omitempty" yaml:"transitioning,omitempty"`
@ -65,19 +75,17 @@ type KubernetesStackOperations interface {
ById(id string) (*KubernetesStack, error) ById(id string) (*KubernetesStack, error)
Delete(container *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) (*Stack, error)
ActionRollback(*KubernetesStack) (*Environment, error)
ActionUpgrade(*KubernetesStack, *KubernetesStackUpgrade) (*KubernetesStack, 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) 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{} resp := &Stack{}
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{}
err := c.rancherClient.doAction(KUBERNETES_STACK_TYPE, "cancelupgrade", &resource.Resource, nil, resp) err := c.rancherClient.doAction(KUBERNETES_STACK_TYPE, "cancelupgrade", &resource.Resource, nil, resp)
return resp, err 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) err := c.rancherClient.doAction(KUBERNETES_STACK_TYPE, "create", &resource.Resource, nil, resp)
return resp, err 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) err := c.rancherClient.doAction(KUBERNETES_STACK_TYPE, "error", &resource.Resource, nil, resp)
return resp, err 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) err := c.rancherClient.doAction(KUBERNETES_STACK_TYPE, "finishupgrade", &resource.Resource, nil, resp)
return resp, err 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) err := c.rancherClient.doAction(KUBERNETES_STACK_TYPE, "remove", &resource.Resource, nil, resp)
return resp, err 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) err := c.rancherClient.doAction(KUBERNETES_STACK_TYPE, "rollback", &resource.Resource, nil, resp)

View file

@ -7,6 +7,8 @@ const (
type KubernetesStackUpgrade struct { type KubernetesStackUpgrade struct {
Resource Resource
Answers map[string]interface{} `json:"answers,omitempty" yaml:"answers,omitempty"`
Environment map[string]interface{} `json:"environment,omitempty" yaml:"environment,omitempty"` Environment map[string]interface{} `json:"environment,omitempty" yaml:"environment,omitempty"`
ExternalId string `json:"externalId,omitempty" yaml:"external_id,omitempty"` ExternalId string `json:"externalId,omitempty" yaml:"external_id,omitempty"`

View file

@ -15,18 +15,36 @@ type LaunchConfig struct {
BlkioDeviceOptions map[string]interface{} `json:"blkioDeviceOptions,omitempty" yaml:"blkio_device_options,omitempty"` 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"` Build *DockerBuild `json:"build,omitempty" yaml:"build,omitempty"`
CapAdd []string `json:"capAdd,omitempty" yaml:"cap_add,omitempty"` CapAdd []string `json:"capAdd,omitempty" yaml:"cap_add,omitempty"`
CapDrop []string `json:"capDrop,omitempty" yaml:"cap_drop,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"` Command []string `json:"command,omitempty" yaml:"command,omitempty"`
Count int64 `json:"count,omitempty" yaml:"count,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"` 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"` CpuShares int64 `json:"cpuShares,omitempty" yaml:"cpu_shares,omitempty"`
CreateIndex int64 `json:"createIndex,omitempty" yaml:"create_index,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"` 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"` 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"` DnsSearch []string `json:"dnsSearch,omitempty" yaml:"dns_search,omitempty"`
DomainName string `json:"domainName,omitempty" yaml:"domain_name,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"` EntryPoint []string `json:"entryPoint,omitempty" yaml:"entry_point,omitempty"`
Environment map[string]interface{} `json:"environment,omitempty" yaml:"environment,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"` 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"` 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"` 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"` HostId string `json:"hostId,omitempty" yaml:"host_id,omitempty"`
Hostname string `json:"hostname,omitempty" yaml:"hostname,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"` 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"` Kind string `json:"kind,omitempty" yaml:"kind,omitempty"`
Labels map[string]interface{} `json:"labels,omitempty" yaml:"labels,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"` 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"` 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"` 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"` NetworkContainerId string `json:"networkContainerId,omitempty" yaml:"network_container_id,omitempty"`
NetworkIds []string `json:"networkIds,omitempty" yaml:"network_ids,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"` 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"` 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"` Ports []string `json:"ports,omitempty" yaml:"ports,omitempty"`
PrimaryIpAddress string `json:"primaryIpAddress,omitempty" yaml:"primary_ip_address,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"` Privileged bool `json:"privileged,omitempty" yaml:"privileged,omitempty"`
PublishAllPorts bool `json:"publishAllPorts,omitempty" yaml:"publish_all_ports,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"` 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"` 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"` StartCount int64 `json:"startCount,omitempty" yaml:"start_count,omitempty"`
StartOnCreate bool `json:"startOnCreate,omitempty" yaml:"start_on_create,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"` 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"` Token string `json:"token,omitempty" yaml:"token,omitempty"`
@ -149,10 +239,18 @@ type LaunchConfig struct {
Tty bool `json:"tty,omitempty" yaml:"tty,omitempty"` Tty bool `json:"tty,omitempty" yaml:"tty,omitempty"`
Ulimits []Ulimit `json:"ulimits,omitempty" yaml:"ulimits,omitempty"`
User string `json:"user,omitempty" yaml:"user,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"` 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"` Uuid string `json:"uuid,omitempty" yaml:"uuid,omitempty"`
Vcpu int64 `json:"vcpu,omitempty" yaml:"vcpu,omitempty"` Vcpu int64 `json:"vcpu,omitempty" yaml:"vcpu,omitempty"`
@ -203,10 +301,6 @@ type LaunchConfigOperations interface {
ActionRestart(*LaunchConfig) (*Instance, error) ActionRestart(*LaunchConfig) (*Instance, error)
ActionRestore(*LaunchConfig) (*Instance, error)
ActionSetlabels(*LaunchConfig, *SetLabelsInput) (*Container, error)
ActionStart(*LaunchConfig) (*Instance, error) ActionStart(*LaunchConfig) (*Instance, error)
ActionStop(*LaunchConfig, *InstanceStop) (*Instance, error) ActionStop(*LaunchConfig, *InstanceStop) (*Instance, error)
@ -369,24 +463,6 @@ func (c *LaunchConfigClient) ActionRestart(resource *LaunchConfig) (*Instance, e
return resp, err 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) { func (c *LaunchConfigClient) ActionStart(resource *LaunchConfig) (*Instance, error) {
resp := &Instance{} resp := &Instance{}

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)
}

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