Rancher V2 provider updates (#13908)

* Move to v2 client in vendor directory

* Move to v2 api and project IDs for environments

* add host label support to registration command

* Update go-rancher/catalog

* Allow go-rancher to handle URL versioning
This commit is contained in:
Bill Maxwell 2017-06-08 02:24:53 -07:00 committed by Paul Stack
parent 9e0c52c6db
commit 305ae18d2c
247 changed files with 7467 additions and 30647 deletions

View File

@ -3,8 +3,8 @@ package rancher
import (
"log"
rancherClient "github.com/rancher/go-rancher/client"
"github.com/raphink/go-rancher/catalog"
"github.com/rancher/go-rancher/catalog"
rancherClient "github.com/rancher/go-rancher/v2"
)
// Config is the configuration parameters for a Rancher API
@ -33,19 +33,24 @@ func (c *Config) GlobalClient() (*rancherClient.RancherClient, error) {
// EnvironmentClient creates a Rancher client scoped to an Environment's API
func (c *Config) EnvironmentClient(env string) (*rancherClient.RancherClient, error) {
url := c.APIURL + "/projects/" + env + "/schemas"
client, err := rancherClient.NewRancherClient(&rancherClient.ClientOpts{
Url: url,
AccessKey: c.AccessKey,
SecretKey: c.SecretKey,
})
globalClient, err := c.GlobalClient()
if err != nil {
return nil, err
}
log.Printf("[INFO] Rancher Client configured for url: %s", url)
project, err := globalClient.Project.ById(env)
if err != nil {
return nil, err
}
projectURL := project.Links["self"]
return client, nil
log.Printf("[INFO] Rancher Client configured for url: %s/schemas", projectURL)
return rancherClient.NewRancherClient(&rancherClient.ClientOpts{
Url: projectURL + "/schemas",
AccessKey: c.AccessKey,
SecretKey: c.SecretKey,
})
}
// RegistryClient creates a Rancher client scoped to a Registry's API
@ -64,18 +69,9 @@ func (c *Config) RegistryClient(id string) (*rancherClient.RancherClient, error)
// CatalogClient creates a Rancher client scoped to a Catalog's API
func (c *Config) CatalogClient() (*catalog.RancherClient, error) {
url := c.APIURL + "-catalog/schemas"
client, err := catalog.NewRancherClient(&catalog.ClientOpts{
Url: url,
return catalog.NewRancherClient(&catalog.ClientOpts{
Url: c.APIURL,
AccessKey: c.AccessKey,
SecretKey: c.SecretKey,
})
if err != nil {
return nil, err
}
log.Printf("[INFO] Rancher Catalog Client configured for url: %s", url)
return client, nil
}

View File

@ -11,6 +11,7 @@ import (
"github.com/hashicorp/terraform/terraform"
)
// CLIConfig used to store data from file.
type CLIConfig struct {
AccessKey string `json:"accessKey"`
SecretKey string `json:"secretKey"`
@ -71,7 +72,7 @@ func init() {
"secret_key": "API secret used to authenticate with the rancher server",
"api_url": "The URL to the rancher API",
"api_url": "The URL to the rancher API, must include version uri (ie. v1 or v2-beta)",
"config": "Path to the Rancher client cli.json config file",
}
@ -110,14 +111,19 @@ func providerConfigure(d *schema.ResourceData) (interface{}, error) {
}
config := &Config{
APIURL: apiURL + "/v1",
APIURL: apiURL,
AccessKey: accessKey,
SecretKey: secretKey,
}
_, err := config.GlobalClient()
client, err := config.GlobalClient()
if err != nil {
return &Config{}, err
}
// Let Rancher Client normalizes the URL making it reliable as a base.
config.APIURL = client.GetOpts().Url
return config, err
return config, nil
}
func loadConfig(path string) (CLIConfig, error) {

View File

@ -7,7 +7,7 @@ import (
"github.com/hashicorp/terraform/helper/resource"
"github.com/hashicorp/terraform/helper/schema"
rancher "github.com/rancher/go-rancher/client"
rancher "github.com/rancher/go-rancher/v2"
)
func resourceRancherCertificate() *schema.Resource {
@ -253,7 +253,7 @@ func resourceRancherCertificateImport(d *schema.ResourceData, meta interface{})
if err != nil {
return []*schema.ResourceData{}, err
}
stack, err := client.Environment.ById(d.Id())
stack, err := client.Stack.ById(d.Id())
if err != nil {
return []*schema.ResourceData{}, err
}

View File

@ -3,13 +3,22 @@ package rancher
import (
"fmt"
"log"
"strings"
"time"
"github.com/hashicorp/terraform/helper/resource"
"github.com/hashicorp/terraform/helper/schema"
"github.com/hashicorp/terraform/helper/validation"
rancherClient "github.com/rancher/go-rancher/client"
rancherClient "github.com/rancher/go-rancher/v2"
)
var (
defaultProjectTemplates = map[string]string{
"mesos": "",
"kubernetes": "",
"windows": "",
"swarm": "",
"cattle": "",
}
)
func resourceRancherEnvironment() *schema.Resource {
@ -32,10 +41,17 @@ func resourceRancherEnvironment() *schema.Resource {
Required: true,
},
"orchestration": &schema.Schema{
Type: schema.TypeString,
Default: "cattle",
Optional: true,
ValidateFunc: validation.StringInSlice([]string{"cattle", "kubernetes", "mesos", "swarm"}, true),
Type: schema.TypeString,
Optional: true,
ValidateFunc: validation.StringInSlice([]string{"cattle", "kubernetes", "mesos", "swarm", "windows"}, true),
Computed: true,
ConflictsWith: []string{"project_template_id"},
},
"project_template_id": &schema.Schema{
Type: schema.TypeString,
Optional: true,
Computed: true,
ConflictsWith: []string{"orchestration"},
},
"description": &schema.Schema{
Type: schema.TypeString,
@ -68,6 +84,8 @@ func resourceRancherEnvironment() *schema.Resource {
func resourceRancherEnvironmentCreate(d *schema.ResourceData, meta interface{}) error {
log.Printf("[INFO] Creating Environment: %s", d.Id())
populateProjectTemplateIDs(meta.(*Config))
client, err := meta.(*Config).GlobalClient()
if err != nil {
return err
@ -76,13 +94,18 @@ func resourceRancherEnvironmentCreate(d *schema.ResourceData, meta interface{})
name := d.Get("name").(string)
description := d.Get("description").(string)
orchestration := d.Get("orchestration").(string)
projectTemplateID := d.Get("project_template_id").(string)
data := map[string]interface{}{
"name": &name,
"description": &description,
projectTemplateID, err = getProjectTemplateID(orchestration, projectTemplateID)
if err != nil {
return err
}
setOrchestrationFields(orchestration, data)
data := map[string]interface{}{
"name": &name,
"description": &description,
"projectTemplateId": &projectTemplateID,
}
var newEnv rancherClient.Project
if err := client.Create("project", data, &newEnv); err != nil {
@ -112,7 +135,7 @@ func resourceRancherEnvironmentCreate(d *schema.ResourceData, meta interface{})
if err != nil {
return err
}
members := v.([]interface{})
members := makeProjectMembers(v.([]interface{}))
_, err = envClient.Project.ActionSetmembers(&newEnv, &rancherClient.SetProjectMembersInput{
Members: members,
})
@ -153,6 +176,7 @@ func resourceRancherEnvironmentRead(d *schema.ResourceData, meta interface{}) er
d.Set("description", env.Description)
d.Set("name", env.Name)
d.Set("orchestration", getActiveOrchestration(env))
d.Set("project_template_id", env.ProjectTemplateId)
envClient, err := meta.(*Config).EnvironmentClient(d.Id())
if err != nil {
@ -166,6 +190,8 @@ func resourceRancherEnvironmentRead(d *schema.ResourceData, meta interface{}) er
}
func resourceRancherEnvironmentUpdate(d *schema.ResourceData, meta interface{}) error {
populateProjectTemplateIDs(meta.(*Config))
client, err := meta.(*Config).GlobalClient()
if err != nil {
return err
@ -174,13 +200,18 @@ func resourceRancherEnvironmentUpdate(d *schema.ResourceData, meta interface{})
name := d.Get("name").(string)
description := d.Get("description").(string)
orchestration := d.Get("orchestration").(string)
projectTemplateID := d.Get("project_template_id").(string)
data := map[string]interface{}{
"name": &name,
"description": &description,
projectTemplateID, err = getProjectTemplateID(orchestration, projectTemplateID)
if err != nil {
return err
}
setOrchestrationFields(orchestration, data)
data := map[string]interface{}{
"name": &name,
"description": &description,
"project_template_id": &projectTemplateID,
}
var newEnv rancherClient.Project
env, err := client.Project.ById(d.Id())
@ -246,18 +277,21 @@ func resourceRancherEnvironmentDelete(d *schema.ResourceData, meta interface{})
return nil
}
func setOrchestrationFields(orchestration string, data map[string]interface{}) {
orch := strings.ToLower(orchestration)
data["swarm"] = false
data["kubernetes"] = false
data["mesos"] = false
if orch == "k8s" {
orch = "kubernetes"
func getProjectTemplateID(orchestration, templateID string) (string, error) {
id := templateID
if templateID == "" && orchestration == "" {
return "", fmt.Errorf("Need either 'orchestration' or 'project_template_id'")
}
data[orch] = true
if templateID == "" && orchestration != "" {
ok := false
id, ok = defaultProjectTemplates[orchestration]
if !ok {
return "", fmt.Errorf("Invalid orchestration: %s", orchestration)
}
}
return id, nil
}
func normalizeMembers(in []rancherClient.ProjectMember) (out []interface{}) {
@ -272,7 +306,7 @@ func normalizeMembers(in []rancherClient.ProjectMember) (out []interface{}) {
return
}
func makeProjectMembers(in []interface{}) (out []interface{}) {
func makeProjectMembers(in []interface{}) (out []rancherClient.ProjectMember) {
for _, m := range in {
mMap := m.(map[string]interface{})
mm := rancherClient.ProjectMember{
@ -295,6 +329,14 @@ func EnvironmentStateRefreshFunc(client *rancherClient.RancherClient, environmen
return nil, "", err
}
// Env not returned, or State not set...
if env == nil || env.State == "" {
// This makes it so user level API keys can be used instead of just admin
env = &rancherClient.Project{
State: "removed",
}
}
return env, env.State, nil
}
}

View File

@ -7,7 +7,7 @@ import (
"github.com/hashicorp/terraform/helper/resource"
"github.com/hashicorp/terraform/terraform"
rancherClient "github.com/rancher/go-rancher/client"
rancherClient "github.com/rancher/go-rancher/v2"
)
func TestAccRancherEnvironment_basic(t *testing.T) {
@ -191,7 +191,6 @@ resource "rancher_environment" "foo" {
orchestration = "swarm"
}
`
const testAccRancherEnvironmentMembersConfig = `
resource "rancher_environment" "foo" {
name = "foo"
@ -223,5 +222,13 @@ resource "rancher_environment" "foo" {
external_id_type = "github_user"
role = "owner"
}
`
const testAccRancherInvalidEnvironmentConfig = `
resource "rancher_environment_invalid_config" "bar" {
name = "bar"
description = "Terraform acc test group - failure"
orchestration = "cattle"
project_template_id = "1pt1"
}
`

View File

@ -7,12 +7,12 @@ import (
"github.com/hashicorp/terraform/helper/resource"
"github.com/hashicorp/terraform/helper/schema"
rancher "github.com/rancher/go-rancher/client"
rancher "github.com/rancher/go-rancher/v2"
)
// ro_labels are used internally by Rancher
// They are not documented and should not be set in Terraform
var ro_labels = []string{
var roLabels = []string{
"io.rancher.host.agent_image",
"io.rancher.host.docker_version",
"io.rancher.host.kvm",
@ -117,7 +117,7 @@ func resourceRancherHostRead(d *schema.ResourceData, meta interface{}) error {
labels := host.Labels
// Remove read-only labels
for _, lbl := range ro_labels {
for _, lbl := range roLabels {
delete(labels, lbl)
}
d.Set("labels", host.Labels)
@ -141,7 +141,7 @@ func resourceRancherHostUpdate(d *schema.ResourceData, meta interface{}) error {
if err != nil {
return err
}
for _, lbl := range ro_labels {
for _, lbl := range roLabels {
labels[lbl] = host.Labels[lbl]
}

View File

@ -7,7 +7,7 @@ import (
"github.com/hashicorp/terraform/helper/resource"
"github.com/hashicorp/terraform/helper/schema"
rancherClient "github.com/rancher/go-rancher/client"
rancherClient "github.com/rancher/go-rancher/v2"
)
func resourceRancherRegistrationToken() *schema.Resource {
@ -15,6 +15,7 @@ func resourceRancherRegistrationToken() *schema.Resource {
Create: resourceRancherRegistrationTokenCreate,
Read: resourceRancherRegistrationTokenRead,
Delete: resourceRancherRegistrationTokenDelete,
Update: resourceRancherRegistrationTokenUpdate,
Importer: &schema.ResourceImporter{
State: resourceRancherRegistrationTokenImport,
},
@ -55,6 +56,10 @@ func resourceRancherRegistrationToken() *schema.Resource {
Type: schema.TypeString,
Computed: true,
},
"host_labels": {
Type: schema.TypeMap,
Optional: true,
},
},
}
}
@ -105,7 +110,6 @@ func resourceRancherRegistrationTokenRead(d *schema.ResourceData, meta interface
if err != nil {
return err
}
// client := meta.(*Config)
regT, err := client.RegistrationToken.ById(d.Id())
if err != nil {
@ -124,6 +128,7 @@ func resourceRancherRegistrationTokenRead(d *schema.ResourceData, meta interface
return nil
}
regCommand := addHostLabels(regT.Command, d.Get("host_labels").(map[string]interface{}))
log.Printf("[INFO] RegistrationToken Name: %s", regT.Name)
d.Set("description", regT.Description)
@ -131,7 +136,7 @@ func resourceRancherRegistrationTokenRead(d *schema.ResourceData, meta interface
d.Set("token", regT.Token)
d.Set("registration_url", regT.RegistrationUrl)
d.Set("environment_id", regT.AccountId)
d.Set("command", regT.Command)
d.Set("command", regCommand)
d.Set("image", regT.Image)
return nil
@ -204,6 +209,16 @@ func resourceRancherRegistrationTokenDelete(d *schema.ResourceData, meta interfa
return nil
}
func resourceRancherRegistrationTokenUpdate(d *schema.ResourceData, meta interface{}) error {
//if d.HasChange("host_labels") {
//newCommand := addHostLabels(
//d.Get("command").(string),
//d.Get("host_labels").(map[string]interface{}))
//d.Set("command", newCommand)
//}
return resourceRancherRegistrationTokenRead(d, meta)
}
func resourceRancherRegistrationTokenImport(d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) {
envID, resourceID := splitID(d.Id())
d.SetId(resourceID)

View File

@ -7,7 +7,7 @@ import (
"github.com/hashicorp/terraform/helper/resource"
"github.com/hashicorp/terraform/terraform"
rancherClient "github.com/rancher/go-rancher/client"
rancherClient "github.com/rancher/go-rancher/v2"
)
func TestAccRancherRegistrationToken_basic(t *testing.T) {

View File

@ -7,7 +7,7 @@ import (
"github.com/hashicorp/terraform/helper/resource"
"github.com/hashicorp/terraform/helper/schema"
rancherClient "github.com/rancher/go-rancher/client"
rancherClient "github.com/rancher/go-rancher/v2"
)
func resourceRancherRegistry() *schema.Resource {

View File

@ -7,7 +7,7 @@ import (
"github.com/hashicorp/terraform/helper/resource"
"github.com/hashicorp/terraform/helper/schema"
rancherClient "github.com/rancher/go-rancher/client"
rancherClient "github.com/rancher/go-rancher/v2"
)
func resourceRancherRegistryCredential() *schema.Resource {
@ -64,7 +64,6 @@ func resourceRancherRegistryCredentialCreate(d *schema.ResourceData, meta interf
name := d.Get("name").(string)
description := d.Get("description").(string)
email := d.Get("email").(string)
publicValue := d.Get("public_value").(string)
secretValue := d.Get("secret_value").(string)
registryID := d.Get("registry_id").(string)
@ -72,7 +71,6 @@ func resourceRancherRegistryCredentialCreate(d *schema.ResourceData, meta interf
registryCred := rancherClient.RegistryCredential{
Name: name,
Description: description,
Email: email,
PublicValue: publicValue,
SecretValue: secretValue,
RegistryId: registryID,
@ -130,7 +128,6 @@ func resourceRancherRegistryCredentialRead(d *schema.ResourceData, meta interfac
d.Set("description", registryCred.Description)
d.Set("name", registryCred.Name)
d.Set("email", registryCred.Email)
d.Set("public_value", registryCred.PublicValue)
d.Set("registry_id", registryCred.RegistryId)
@ -151,13 +148,11 @@ func resourceRancherRegistryCredentialUpdate(d *schema.ResourceData, meta interf
name := d.Get("name").(string)
description := d.Get("description").(string)
email := d.Get("email").(string)
publicValue := d.Get("public_value").(string)
secretValue := d.Get("secret_value").(string)
registryCred.Name = name
registryCred.Description = description
registryCred.Email = email
registryCred.PublicValue = publicValue
registryCred.SecretValue = secretValue
client.RegistryCredential.Update(registryCred, &registryCred)

View File

@ -7,7 +7,7 @@ import (
"github.com/hashicorp/terraform/helper/resource"
"github.com/hashicorp/terraform/terraform"
rancherClient "github.com/rancher/go-rancher/client"
rancherClient "github.com/rancher/go-rancher/v2"
)
func TestAccRancherRegistryCredential_basic(t *testing.T) {

View File

@ -7,7 +7,7 @@ import (
"github.com/hashicorp/terraform/helper/resource"
"github.com/hashicorp/terraform/terraform"
rancherClient "github.com/rancher/go-rancher/client"
rancherClient "github.com/rancher/go-rancher/v2"
)
func TestAccRancherRegistry_basic(t *testing.T) {

View File

@ -1,8 +1,10 @@
package rancher
import (
"encoding/json"
"fmt"
"log"
"net/http"
"reflect"
"strings"
"time"
@ -11,7 +13,8 @@ import (
"github.com/hashicorp/terraform/helper/resource"
"github.com/hashicorp/terraform/helper/schema"
"github.com/hashicorp/terraform/helper/validation"
rancherClient "github.com/rancher/go-rancher/client"
"github.com/rancher/go-rancher/catalog"
rancherClient "github.com/rancher/go-rancher/v2"
)
func resourceRancherStack() *schema.Resource {
@ -99,8 +102,8 @@ func resourceRancherStackCreate(d *schema.ResourceData, meta interface{}) error
return err
}
var newStack rancherClient.Environment
if err := client.Create("environment", data, &newStack); err != nil {
var newStack rancherClient.Stack
if err := client.Create("stack", data, &newStack); err != nil {
return err
}
@ -131,7 +134,7 @@ func resourceRancherStackRead(d *schema.ResourceData, meta interface{}) error {
return err
}
stack, err := client.Environment.ById(d.Id())
stack, err := client.Stack.ById(d.Id())
if err != nil {
return err
}
@ -148,7 +151,7 @@ func resourceRancherStackRead(d *schema.ResourceData, meta interface{}) error {
return nil
}
config, err := client.Environment.ActionExportconfig(stack, &rancherClient.ComposeConfigInput{})
config, err := client.Stack.ActionExportconfig(stack, &rancherClient.ComposeConfigInput{})
if err != nil {
return err
}
@ -205,13 +208,13 @@ func resourceRancherStackUpdate(d *schema.ResourceData, meta interface{}) error
return err
}
stack, err := client.Environment.ById(d.Id())
stack, err := client.Stack.ById(d.Id())
if err != nil {
return err
}
var newStack rancherClient.Environment
if err = client.Update("environment", &stack.Resource, data, &newStack); err != nil {
var newStack rancherClient.Stack
if err = client.Update(stack.Type, &stack.Resource, data, &newStack); err != nil {
return err
}
@ -224,7 +227,7 @@ func resourceRancherStackUpdate(d *schema.ResourceData, meta interface{}) error
MinTimeout: 3 * time.Second,
}
s, waitErr := stateConf.WaitForState()
stack = s.(*rancherClient.Environment)
stack = s.(*rancherClient.Stack)
if waitErr != nil {
return fmt.Errorf(
"Error waiting for stack (%s) to be updated: %s", stack.Id, waitErr)
@ -244,7 +247,7 @@ func resourceRancherStackUpdate(d *schema.ResourceData, meta interface{}) error
envValue := value
envMap[key] = &envValue
}
stack, err = client.Environment.ActionUpgrade(stack, &rancherClient.EnvironmentUpgrade{
stack, err = client.Stack.ActionUpgrade(stack, &rancherClient.StackUpgrade{
DockerCompose: *data["dockerCompose"].(*string),
RancherCompose: *data["rancherCompose"].(*string),
Environment: envMap,
@ -267,10 +270,10 @@ func resourceRancherStackUpdate(d *schema.ResourceData, meta interface{}) error
return fmt.Errorf(
"Error waiting for stack (%s) to be upgraded: %s", stack.Id, waitErr)
}
stack = s.(*rancherClient.Environment)
stack = s.(*rancherClient.Stack)
if d.Get("finish_upgrade").(bool) {
stack, err = client.Environment.ActionFinishupgrade(stack)
stack, err = client.Stack.ActionFinishupgrade(stack)
if err != nil {
return err
}
@ -311,12 +314,12 @@ func resourceRancherStackDelete(d *schema.ResourceData, meta interface{}) error
return err
}
stack, err := client.Environment.ById(id)
stack, err := client.Stack.ById(id)
if err != nil {
return err
}
if err := client.Environment.Delete(stack); err != nil {
if err := client.Stack.Delete(stack); err != nil {
return fmt.Errorf("Error deleting Stack: %s", err)
}
@ -351,7 +354,7 @@ func resourceRancherStackImport(d *schema.ResourceData, meta interface{}) ([]*sc
if err != nil {
return []*schema.ResourceData{}, err
}
stack, err := client.Environment.ById(d.Id())
stack, err := client.Stack.ById(d.Id())
if err != nil {
return []*schema.ResourceData{}, err
}
@ -364,7 +367,7 @@ func resourceRancherStackImport(d *schema.ResourceData, meta interface{}) ([]*sc
// a Rancher Stack.
func StackStateRefreshFunc(client *rancherClient.RancherClient, stackID string) resource.StateRefreshFunc {
return func() (interface{}, string, error) {
stack, err := client.Environment.ById(stackID)
stack, err := client.Stack.ById(stackID)
if err != nil {
return nil, "", err
@ -401,17 +404,18 @@ func makeStackData(d *schema.ResourceData, meta interface{}) (data map[string]in
if err != nil {
return data, err
}
template, err := catalogClient.Template.ById(catalogID)
templateVersion, err := getCatalogTemplateVersion(catalogClient, catalogID)
if err != nil {
return data, fmt.Errorf("Failed to get catalog template: %s", err)
return data, err
}
if template == nil {
return data, fmt.Errorf("Unknown catalog template %s", catalogID)
if templateVersion.Id != catalogID {
return data, fmt.Errorf("Did not find template %s", catalogID)
}
dockerCompose = template.Files["docker-compose.yml"].(string)
rancherCompose = template.Files["rancher-compose.yml"].(string)
dockerCompose = templateVersion.Files["docker-compose.yml"].(string)
rancherCompose = templateVersion.Files["rancher-compose.yml"].(string)
}
if c, ok := d.GetOk("docker_compose"); ok {
@ -420,9 +424,11 @@ func makeStackData(d *schema.ResourceData, meta interface{}) (data map[string]in
if c, ok := d.GetOk("rancher_compose"); ok {
rancherCompose = c.(string)
}
environment = environmentFromMap(d.Get("environment").(map[string]interface{}))
startOnCreate := d.Get("start_on_create")
system := systemScope(d.Get("scope").(string))
data = map[string]interface{}{
"name": &name,
@ -432,6 +438,7 @@ func makeStackData(d *schema.ResourceData, meta interface{}) (data map[string]in
"environment": &environment,
"externalId": &externalID,
"startOnCreate": &startOnCreate,
"system": &system,
}
return data, nil
@ -452,3 +459,47 @@ func suppressComposeDiff(k, old, new string, d *schema.ResourceData) bool {
return reflect.DeepEqual(cOld, cNew)
}
func getCatalogTemplateVersion(c *catalog.RancherClient, catalogID string) (*catalog.TemplateVersion, error) {
templateVersion := &catalog.TemplateVersion{}
namesAndFolder := strings.SplitN(catalogID, ":", 3)
if len(namesAndFolder) != 3 {
return templateVersion, fmt.Errorf("catalog_id: %s not in 'catalog:name:N' format", catalogID)
}
template, err := c.Template.ById(namesAndFolder[0] + ":" + namesAndFolder[1])
if err != nil {
return templateVersion, fmt.Errorf("Failed to get catalog template: %s at url %s", err, c.GetOpts().Url)
}
if template == nil {
return templateVersion, fmt.Errorf("Unknown catalog template %s", catalogID)
}
for _, versionLink := range template.VersionLinks {
if strings.HasSuffix(versionLink.(string), catalogID) {
client := &http.Client{}
req, err := http.NewRequest("GET", fmt.Sprint(versionLink), nil)
req.SetBasicAuth(c.GetOpts().AccessKey, c.GetOpts().SecretKey)
resp, err := client.Do(req)
if err != nil {
return templateVersion, err
}
defer resp.Body.Close()
if resp.StatusCode != 200 {
return templateVersion, fmt.Errorf("Bad Response %d lookup up %s", resp.StatusCode, versionLink)
}
err = json.NewDecoder(resp.Body).Decode(templateVersion)
return templateVersion, err
}
}
return templateVersion, nil
}
func systemScope(scope string) bool {
return scope == "system"
}

View File

@ -7,11 +7,11 @@ import (
"github.com/hashicorp/terraform/helper/resource"
"github.com/hashicorp/terraform/terraform"
rancherClient "github.com/rancher/go-rancher/client"
rancherClient "github.com/rancher/go-rancher/v2"
)
func TestAccRancherStack_basic(t *testing.T) {
var stack rancherClient.Environment
var stack rancherClient.Stack
resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
@ -47,7 +47,7 @@ func TestAccRancherStack_basic(t *testing.T) {
}
func TestAccRancherStack_compose(t *testing.T) {
var stack rancherClient.Environment
var stack rancherClient.Stack
resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
@ -74,7 +74,7 @@ func TestAccRancherStack_compose(t *testing.T) {
//upgrading a stack automatically starts the services which never
//completes if there is no host available
func TestAccRancherStack_catalog(t *testing.T) {
var stack rancherClient.Environment
var stack rancherClient.Stack
resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
@ -116,7 +116,7 @@ func TestAccRancherStack_catalog(t *testing.T) {
}
func TestAccRancherStack_disappears(t *testing.T) {
var stack rancherClient.Environment
var stack rancherClient.Stack
resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
@ -135,14 +135,14 @@ func TestAccRancherStack_disappears(t *testing.T) {
})
}
func testAccRancherStackDisappears(stack *rancherClient.Environment) resource.TestCheckFunc {
func testAccRancherStackDisappears(stack *rancherClient.Stack) resource.TestCheckFunc {
return func(s *terraform.State) error {
client, err := testAccProvider.Meta().(*Config).EnvironmentClient(stack.AccountId)
if err != nil {
return err
}
if err := client.Environment.Delete(stack); err != nil {
if err := client.Stack.Delete(stack); err != nil {
return fmt.Errorf("Error deleting Stack: %s", err)
}
@ -165,7 +165,7 @@ func testAccRancherStackDisappears(stack *rancherClient.Environment) resource.Te
}
}
func testAccCheckRancherStackExists(n string, stack *rancherClient.Environment) resource.TestCheckFunc {
func testAccCheckRancherStackExists(n string, stack *rancherClient.Stack) resource.TestCheckFunc {
return func(s *terraform.State) error {
rs, ok := s.RootModule().Resources[n]
@ -182,7 +182,7 @@ func testAccCheckRancherStackExists(n string, stack *rancherClient.Environment)
return err
}
foundStack, err := client.Environment.ById(rs.Primary.ID)
foundStack, err := client.Stack.ById(rs.Primary.ID)
if err != nil {
return err
}
@ -197,7 +197,7 @@ func testAccCheckRancherStackExists(n string, stack *rancherClient.Environment)
}
}
func testAccCheckRancherStackAttributes(stack *rancherClient.Environment, environment map[string]string, startOnCreate bool) resource.TestCheckFunc {
func testAccCheckRancherStackAttributes(stack *rancherClient.Stack, environment map[string]string, startOnCreate bool) resource.TestCheckFunc {
return func(s *terraform.State) error {
if len(stack.Environment) != len(environment) {
@ -228,7 +228,7 @@ func testAccCheckRancherStackDestroy(s *terraform.State) error {
return err
}
stack, err := client.Environment.ById(rs.Primary.ID)
stack, err := client.Stack.ById(rs.Primary.ID)
if err == nil {
if stack != nil &&

View File

@ -1,9 +1,11 @@
package rancher
import (
"fmt"
"net/url"
"strings"
"github.com/rancher/go-rancher/client"
"github.com/rancher/go-rancher/v2"
)
const (
@ -13,18 +15,7 @@ const (
// GetActiveOrchestration get the name of the active orchestration for a environment
func getActiveOrchestration(project *client.Project) string {
orch := "cattle"
switch {
case project.Swarm:
orch = "swarm"
case project.Mesos:
orch = "mesos"
case project.Kubernetes:
orch = "kubernetes"
}
return orch
return project.Orchestration
}
func removed(state string) bool {
@ -42,3 +33,50 @@ func splitID(id string) (envID, resourceID string) {
func NewListOpts() *client.ListOpts {
return client.NewListOpts()
}
func populateProjectTemplateIDs(config *Config) error {
cli, err := config.GlobalClient()
if err != nil {
return err
}
for projectTemplate := range defaultProjectTemplates {
templates, err := cli.ProjectTemplate.List(&client.ListOpts{
Filters: map[string]interface{}{
"isPublic": true,
"name": projectTemplate,
"sort": "created",
},
})
if err != nil {
return err
}
if len(templates.Data) > 0 {
defaultProjectTemplates[projectTemplate] = templates.Data[0].Id
}
}
return nil
}
func addHostLabels(command string, labels map[string]interface{}) string {
result := []string{}
hostLabels := url.Values{}
if len(labels) == 0 {
return command
}
tokenizedCommand := strings.Split(command, " ")
if len(tokenizedCommand) > 0 {
result = append(result, tokenizedCommand[:3]...)
for k, v := range labels {
hostLabels.Add(k, v.(string))
}
strHostLabels := hostLabels.Encode()
result = append(result, "-e", fmt.Sprintf("CATTLE_HOST_LABELS='%s'", strHostLabels))
result = append(result, tokenizedCommand[3:]...)
}
return strings.Join(result, " ")
}

View File

@ -3,7 +3,7 @@ package rancher
import (
"testing"
"github.com/rancher/go-rancher/client"
"github.com/rancher/go-rancher/v2"
)
var idTests = []struct {
@ -46,10 +46,10 @@ var orchestrationTests = []struct {
project *client.Project
orchestration string
}{
{&client.Project{}, "cattle"},
{&client.Project{Swarm: true}, "swarm"},
{&client.Project{Mesos: true}, "mesos"},
{&client.Project{Kubernetes: true}, "kubernetes"},
{&client.Project{Orchestration: "cattle"}, "cattle"},
{&client.Project{Orchestration: "swarm"}, "swarm"},
{&client.Project{Orchestration: "mesos"}, "mesos"},
{&client.Project{Orchestration: "kubernetes"}, "kubernetes"},
}
func TestActiveOrchestration(t *testing.T) {
@ -60,3 +60,36 @@ func TestActiveOrchestration(t *testing.T) {
}
}
}
type LabelTestCase struct {
Labels map[string]interface{}
Command string
ExpectedCommand string
}
var (
HostLabelTestCases = []LabelTestCase{
LabelTestCase{
Labels: map[string]interface{}{
"orch": "true",
"etcd": "true",
},
Command: "sudo docker run --rm --privileged -v /var/run/docker.sock:/var/run/docker.sock -v /var/lib/rancher:/var/lib/rancher rancher/agent:v1.2.2 http://192.168.122.158:8080/v1/scripts/71FF294EA7A2B6865708:1483142400000:8OVFmSEUlS2VXvVGbYCXTFaMC8w",
ExpectedCommand: "sudo docker run -e CATTLE_HOST_LABELS='etcd=true&orch=true' --rm --privileged -v /var/run/docker.sock:/var/run/docker.sock -v /var/lib/rancher:/var/lib/rancher rancher/agent:v1.2.2 http://192.168.122.158:8080/v1/scripts/71FF294EA7A2B6865708:1483142400000:8OVFmSEUlS2VXvVGbYCXTFaMC8w",
},
LabelTestCase{
Labels: map[string]interface{}{},
Command: "sudo docker run --rm --privileged -v /var/run/docker.sock:/var/run/docker.sock -v /var/lib/rancher:/var/lib/rancher rancher/agent:v1.2.2 http://192.168.122.158:8080/v1/scripts/71FF294EA7A2B6865708:1483142400000:8OVFmSEUlS2VXvVGbYCXTFaMC8w",
ExpectedCommand: "sudo docker run --rm --privileged -v /var/run/docker.sock:/var/run/docker.sock -v /var/lib/rancher:/var/lib/rancher rancher/agent:v1.2.2 http://192.168.122.158:8080/v1/scripts/71FF294EA7A2B6865708:1483142400000:8OVFmSEUlS2VXvVGbYCXTFaMC8w",
},
}
)
func TestAddHostLabels(t *testing.T) {
for _, tCase := range HostLabelTestCases {
cmd := addHostLabels(tCase.Command, tCase.Labels)
if cmd != tCase.ExpectedCommand {
t.Errorf("Command:\n%s\nDoes not match\n%s", cmd, tCase.ExpectedCommand)
}
}
}

View File

@ -1,7 +1,7 @@
FROM ubuntu:16.04
# FROM arm=armhf/ubuntu:16.04
ARG DAPPER_HOST_ARCH
ARG DAPPER_HOST_ARCH=amd64
ENV HOST_ARCH=${DAPPER_HOST_ARCH} ARCH=${DAPPER_HOST_ARCH}
RUN apt-get update && \
@ -11,17 +11,16 @@ RUN apt-get update && \
ENV GOLANG_ARCH_amd64=amd64 GOLANG_ARCH_arm=armv6l GOLANG_ARCH=GOLANG_ARCH_${ARCH} \
GOPATH=/go PATH=/go/bin:/usr/local/go/bin:${PATH} SHELL=/bin/bash
RUN wget -O - https://storage.googleapis.com/golang/go1.6.2.linux-${!GOLANG_ARCH}.tar.gz | tar -xzf - -C /usr/local && \
go get github.com/rancher/trash && go get github.com/golang/lint/golint
ENV DOCKER_URL_amd64=https://get.docker.com/builds/Linux/x86_64/docker-1.10.3 \
DOCKER_URL_arm=https://github.com/rancher/docker/releases/download/v1.10.3-ros1/docker-1.10.3_arm \
DOCKER_URL=DOCKER_URL_${ARCH}
RUN wget -O - ${!DOCKER_URL} > /usr/bin/docker && chmod +x /usr/bin/docker
RUN wget -O - https://storage.googleapis.com/golang/go1.7.1.linux-${!GOLANG_ARCH}.tar.gz | tar -xzf - -C /usr/local && \
go get github.com/rancher/trash && go get github.com/golang/lint/golint
ENV DAPPER_SOURCE /go/src/github.com/rancher/go-rancher/
ENV DAPPER_OUTPUT ./bin ./dist
ENV DAPPER_OUTPUT ./bin
ENV DAPPER_DOCKER_SOCKET true
ENV TRASH_CACHE ${DAPPER_SOURCE}/.trash-cache
ENV HOME ${DAPPER_SOURCE}

View File

@ -1,5 +1,25 @@
# Go Bindings for Rancher API
# Generating Code
First, you must have a master version of Rancher running. The best way to do this is:
```sh
docker run -p 8080:8080 -d rancher/server:master
```
Once Rancher is running, you can run the gen-schema.sh script:
```sh
./scripts/gen-schema.sh http://<docker host ip>:8080
# The default url is http://localhost:8080, so if rancher/server is listening on localhost, you can omit the url:
./scripts/gen-schema.sh
```
This will add, remove, and modify go files appropriately. Submit a PR that includes *all* these changes.
## Important caveats
1. If you are running on macOS, you must have gnu-sed installed as sed for this to work properly.
2. If you are running against cattle that is running out of an IDE and you don't have go-machine-service running (you probably don't), you'll see a number of unexpected removed or modified files like `generated_host.go` `generated_machine.go` and `generated_*config.go`.
# Building
```sh

View File

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

View File

@ -1,7 +1,8 @@
package client
package catalog
import (
"bytes"
"encoding/base64"
"encoding/json"
"fmt"
"io"
@ -10,6 +11,7 @@ import (
"net/url"
"os"
"regexp"
"strings"
"time"
"github.com/gorilla/websocket"
@ -22,8 +24,9 @@ const (
)
var (
debug = false
dialer = &websocket.Dialer{}
debug = false
dialer = &websocket.Dialer{}
privateFieldRegex = regexp.MustCompile("^[[:lower:]]")
)
type ClientOpts struct {
@ -115,14 +118,45 @@ func appendFilters(urlString string, filters map[string]interface{}) (string, er
q := u.Query()
for k, v := range filters {
q.Add(k, fmt.Sprintf("%v", v))
if l, ok := v.([]string); ok {
for _, v := range l {
q.Add(k, v)
}
} else {
q.Add(k, fmt.Sprintf("%v", v))
}
}
u.RawQuery = q.Encode()
return u.String(), nil
}
func setupRancherBaseClient(rancherClient *RancherBaseClient, opts *ClientOpts) error {
func NormalizeUrl(existingUrl string) (string, error) {
u, err := url.Parse(existingUrl)
if err != nil {
return "", err
}
if u.Path == "" || u.Path == "/" {
u.Path = "v1-catalog"
} else if u.Path == "/v1" || strings.HasPrefix(u.Path, "/v1/") {
u.Path = strings.Replace(u.Path, "/v1", "/v1-catalog", 1)
} else if u.Path == "/v2-beta" || strings.HasPrefix(u.Path, "/v2-beta/") {
u.Path = strings.Replace(u.Path, "/v2-beta", "/v1-catalog", 1)
} else if u.Path == "/v2" || strings.HasPrefix(u.Path, "/v2/") {
u.Path = strings.Replace(u.Path, "/v2", "/v1-catalog", 1)
}
return u.String(), nil
}
func setupRancherBaseClient(rancherClient *RancherBaseClientImpl, opts *ClientOpts) error {
var err error
opts.Url, err = NormalizeUrl(opts.Url)
if err != nil {
return err
}
if opts.Timeout == 0 {
opts.Timeout = time.Second * 10
}
@ -196,18 +230,18 @@ func NewListOpts() *ListOpts {
}
}
func (rancherClient *RancherBaseClient) setupRequest(req *http.Request) {
func (rancherClient *RancherBaseClientImpl) setupRequest(req *http.Request) {
req.SetBasicAuth(rancherClient.Opts.AccessKey, rancherClient.Opts.SecretKey)
}
func (rancherClient *RancherBaseClient) newHttpClient() *http.Client {
func (rancherClient *RancherBaseClientImpl) newHttpClient() *http.Client {
if rancherClient.Opts.Timeout == 0 {
rancherClient.Opts.Timeout = time.Second * 10
}
return &http.Client{Timeout: rancherClient.Opts.Timeout}
}
func (rancherClient *RancherBaseClient) doDelete(url string) error {
func (rancherClient *RancherBaseClientImpl) doDelete(url string) error {
client := rancherClient.newHttpClient()
req, err := http.NewRequest("DELETE", url, nil)
if err != nil {
@ -231,11 +265,21 @@ func (rancherClient *RancherBaseClient) doDelete(url string) error {
return nil
}
func (rancherClient *RancherBaseClient) Websocket(url string, headers map[string][]string) (*websocket.Conn, *http.Response, error) {
return dialer.Dial(url, http.Header(headers))
func (rancherClient *RancherBaseClientImpl) Websocket(url string, headers map[string][]string) (*websocket.Conn, *http.Response, error) {
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 *RancherBaseClient) doGet(url string, opts *ListOpts, respObject interface{}) error {
func (rancherClient *RancherBaseClientImpl) doGet(url string, opts *ListOpts, respObject interface{}) error {
if opts == nil {
opts = NewListOpts()
}
@ -283,11 +327,11 @@ func (rancherClient *RancherBaseClient) doGet(url string, opts *ListOpts, respOb
return nil
}
func (rancherClient *RancherBaseClient) List(schemaType string, opts *ListOpts, respObject interface{}) error {
func (rancherClient *RancherBaseClientImpl) List(schemaType string, opts *ListOpts, respObject interface{}) error {
return rancherClient.doList(schemaType, opts, respObject)
}
func (rancherClient *RancherBaseClient) doList(schemaType string, opts *ListOpts, respObject interface{}) error {
func (rancherClient *RancherBaseClientImpl) doList(schemaType string, opts *ListOpts, respObject interface{}) error {
schema, ok := rancherClient.Types[schemaType]
if !ok {
return errors.New("Unknown schema type [" + schemaType + "]")
@ -305,11 +349,15 @@ func (rancherClient *RancherBaseClient) doList(schemaType string, opts *ListOpts
return rancherClient.doGet(collectionUrl, opts, respObject)
}
func (rancherClient *RancherBaseClient) Post(url string, createObj interface{}, respObject interface{}) error {
func (rancherClient *RancherBaseClientImpl) doNext(nextUrl string, respObject interface{}) error {
return rancherClient.doGet(nextUrl, nil, respObject)
}
func (rancherClient *RancherBaseClientImpl) Post(url string, createObj interface{}, respObject interface{}) error {
return rancherClient.doModify("POST", url, createObj, respObject)
}
func (rancherClient *RancherBaseClient) GetLink(resource Resource, link string, respObject interface{}) error {
func (rancherClient *RancherBaseClientImpl) GetLink(resource Resource, link string, respObject interface{}) error {
url := resource.Links[link]
if url == "" {
return fmt.Errorf("Failed to find link: %s", link)
@ -318,7 +366,7 @@ func (rancherClient *RancherBaseClient) GetLink(resource Resource, link string,
return rancherClient.doGet(url, &ListOpts{}, respObject)
}
func (rancherClient *RancherBaseClient) doModify(method string, url string, createObj interface{}, respObject interface{}) error {
func (rancherClient *RancherBaseClientImpl) doModify(method string, url string, createObj interface{}, respObject interface{}) error {
bodyContent, err := json.Marshal(createObj)
if err != nil {
return err
@ -337,7 +385,6 @@ func (rancherClient *RancherBaseClient) doModify(method string, url string, crea
rancherClient.setupRequest(req)
req.Header.Set("Content-Type", "application/json")
req.Header.Set("Content-Length", string(len(bodyContent)))
resp, err := client.Do(req)
if err != nil {
@ -365,11 +412,11 @@ func (rancherClient *RancherBaseClient) doModify(method string, url string, crea
return nil
}
func (rancherClient *RancherBaseClient) Create(schemaType string, createObj interface{}, respObject interface{}) error {
func (rancherClient *RancherBaseClientImpl) Create(schemaType string, createObj interface{}, respObject interface{}) error {
return rancherClient.doCreate(schemaType, createObj, respObject)
}
func (rancherClient *RancherBaseClient) doCreate(schemaType string, createObj interface{}, respObject interface{}) error {
func (rancherClient *RancherBaseClientImpl) doCreate(schemaType string, createObj interface{}, respObject interface{}) error {
if createObj == nil {
createObj = map[string]string{}
}
@ -397,11 +444,11 @@ func (rancherClient *RancherBaseClient) doCreate(schemaType string, createObj in
return rancherClient.doModify("POST", collectionUrl, createObj, respObject)
}
func (rancherClient *RancherBaseClient) Update(schemaType string, existing *Resource, updates interface{}, respObject interface{}) error {
func (rancherClient *RancherBaseClientImpl) Update(schemaType string, existing *Resource, updates interface{}, respObject interface{}) error {
return rancherClient.doUpdate(schemaType, existing, updates, respObject)
}
func (rancherClient *RancherBaseClient) doUpdate(schemaType string, existing *Resource, updates interface{}, respObject interface{}) error {
func (rancherClient *RancherBaseClientImpl) doUpdate(schemaType string, existing *Resource, updates interface{}, respObject interface{}) error {
if existing == nil {
return errors.New("Existing object is nil")
}
@ -431,11 +478,11 @@ func (rancherClient *RancherBaseClient) doUpdate(schemaType string, existing *Re
return rancherClient.doModify("PUT", selfUrl, updates, respObject)
}
func (rancherClient *RancherBaseClient) ById(schemaType string, id string, respObject interface{}) error {
func (rancherClient *RancherBaseClientImpl) ById(schemaType string, id string, respObject interface{}) error {
return rancherClient.doById(schemaType, id, respObject)
}
func (rancherClient *RancherBaseClient) doById(schemaType string, id string, respObject interface{}) error {
func (rancherClient *RancherBaseClientImpl) doById(schemaType string, id string, respObject interface{}) error {
schema, ok := rancherClient.Types[schemaType]
if !ok {
return errors.New("Unknown schema type [" + schemaType + "]")
@ -455,14 +502,14 @@ func (rancherClient *RancherBaseClient) doById(schemaType string, id string, res
return err
}
func (rancherClient *RancherBaseClient) Delete(existing *Resource) error {
func (rancherClient *RancherBaseClientImpl) Delete(existing *Resource) error {
if existing == nil {
return nil
}
return rancherClient.doResourceDelete(existing.Type, existing)
}
func (rancherClient *RancherBaseClient) doResourceDelete(schemaType string, existing *Resource) error {
func (rancherClient *RancherBaseClientImpl) doResourceDelete(schemaType string, existing *Resource) error {
schema, ok := rancherClient.Types[schemaType]
if !ok {
return errors.New("Unknown schema type [" + schemaType + "]")
@ -480,7 +527,7 @@ func (rancherClient *RancherBaseClient) doResourceDelete(schemaType string, exis
return rancherClient.doDelete(selfUrl)
}
func (rancherClient *RancherBaseClient) Reload(existing *Resource, output interface{}) error {
func (rancherClient *RancherBaseClientImpl) Reload(existing *Resource, output interface{}) error {
selfUrl, ok := existing.Links[SELF]
if !ok {
return errors.New(fmt.Sprintf("Failed to find self URL of [%v]", existing))
@ -489,12 +536,12 @@ func (rancherClient *RancherBaseClient) Reload(existing *Resource, output interf
return rancherClient.doGet(selfUrl, NewListOpts(), output)
}
func (rancherClient *RancherBaseClient) Action(schemaType string, action string,
func (rancherClient *RancherBaseClientImpl) Action(schemaType string, action string,
existing *Resource, inputObject, respObject interface{}) error {
return rancherClient.doAction(schemaType, action, existing, inputObject, respObject)
}
func (rancherClient *RancherBaseClient) doAction(schemaType string, action string,
func (rancherClient *RancherBaseClientImpl) doAction(schemaType string, action string,
existing *Resource, inputObject, respObject interface{}) error {
if existing == nil {
@ -557,6 +604,18 @@ func (rancherClient *RancherBaseClient) doAction(schemaType string, action strin
return json.Unmarshal(byteContent, respObject)
}
func (rancherClient *RancherBaseClientImpl) GetOpts() *ClientOpts {
return rancherClient.Opts
}
func (rancherClient *RancherBaseClientImpl) GetSchemas() *Schemas {
return rancherClient.Schemas
}
func (rancherClient *RancherBaseClientImpl) GetTypes() map[string]Schema {
return rancherClient.Types
}
func init() {
debug = os.Getenv("RANCHER_CLIENT_DEBUG") == "true"
if debug {

View File

@ -16,7 +16,8 @@ type ApiVersion struct {
type ApiVersionCollection struct {
Collection
Data []ApiVersion `json:"data,omitempty"`
Data []ApiVersion `json:"data,omitempty"`
client *ApiVersionClient
}
type ApiVersionClient struct {
@ -52,9 +53,20 @@ func (c *ApiVersionClient) Update(existing *ApiVersion, updates interface{}) (*A
func (c *ApiVersionClient) List(opts *ListOpts) (*ApiVersionCollection, error) {
resp := &ApiVersionCollection{}
err := c.rancherClient.doList(API_VERSION_TYPE, opts, resp)
resp.client = c
return resp, err
}
func (cc *ApiVersionCollection) Next() (*ApiVersionCollection, error) {
if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" {
resp := &ApiVersionCollection{}
err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp)
resp.client = cc.client
return resp, err
}
return nil, nil
}
func (c *ApiVersionClient) ById(id string) (*ApiVersion, error) {
resp := &ApiVersion{}
err := c.rancherClient.doById(API_VERSION_TYPE, id, resp)

View File

@ -11,28 +11,25 @@ type Catalog struct {
Branch string `json:"branch,omitempty" yaml:"branch,omitempty"`
CatalogRoot string `json:"catalogRoot,omitempty" yaml:"catalog_root,omitempty"`
Commit string `json:"commit,omitempty" yaml:"commit,omitempty"`
Description string `json:"description,omitempty" yaml:"description,omitempty"`
EnvironmentId string `json:"environmentId,omitempty" yaml:"environment_id,omitempty"`
LastUpdated string `json:"lastUpdated,omitempty" yaml:"last_updated,omitempty"`
Kind string `json:"kind,omitempty" yaml:"kind,omitempty"`
Links map[string]interface{} `json:"links,omitempty" yaml:"links,omitempty"`
Message string `json:"message,omitempty" yaml:"message,omitempty"`
Metadata map[string]interface{} `json:"metadata,omitempty" yaml:"metadata,omitempty"`
State string `json:"state,omitempty" yaml:"state,omitempty"`
Name string `json:"name,omitempty" yaml:"name,omitempty"`
Type string `json:"type,omitempty" yaml:"type,omitempty"`
Uri string `json:"uri,omitempty" yaml:"uri,omitempty"`
Url string `json:"url,omitempty" yaml:"url,omitempty"`
}
type CatalogCollection struct {
Collection
Data []Catalog `json:"data,omitempty"`
Data []Catalog `json:"data,omitempty"`
client *CatalogClient
}
type CatalogClient struct {
@ -68,9 +65,20 @@ func (c *CatalogClient) Update(existing *Catalog, updates interface{}) (*Catalog
func (c *CatalogClient) List(opts *ListOpts) (*CatalogCollection, error) {
resp := &CatalogCollection{}
err := c.rancherClient.doList(CATALOG_TYPE, opts, resp)
resp.client = c
return resp, err
}
func (cc *CatalogCollection) Next() (*CatalogCollection, error) {
if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" {
resp := &CatalogCollection{}
err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp)
resp.client = cc.client
return resp, err
}
return nil, nil
}
func (c *CatalogClient) ById(id string) (*Catalog, error) {
resp := &Catalog{}
err := c.rancherClient.doById(CATALOG_TYPE, id, resp)

View File

@ -4,10 +4,10 @@ type RancherClient struct {
RancherBaseClient
ApiVersion ApiVersionOperations
Question QuestionOperations
Template TemplateOperations
TemplateVersion TemplateVersionOperations
Catalog CatalogOperations
Template TemplateOperations
Question QuestionOperations
TemplateVersion TemplateVersionOperations
Error ErrorOperations
}
@ -17,10 +17,10 @@ func constructClient(rancherBaseClient *RancherBaseClientImpl) *RancherClient {
}
client.ApiVersion = newApiVersionClient(client)
client.Question = newQuestionClient(client)
client.Template = newTemplateClient(client)
client.TemplateVersion = newTemplateVersionClient(client)
client.Catalog = newCatalogClient(client)
client.Template = newTemplateClient(client)
client.Question = newQuestionClient(client)
client.TemplateVersion = newTemplateVersionClient(client)
client.Error = newErrorClient(client)
return client

View File

@ -20,7 +20,8 @@ type Error struct {
type ErrorCollection struct {
Collection
Data []Error `json:"data,omitempty"`
Data []Error `json:"data,omitempty"`
client *ErrorClient
}
type ErrorClient struct {
@ -56,9 +57,20 @@ func (c *ErrorClient) Update(existing *Error, updates interface{}) (*Error, erro
func (c *ErrorClient) List(opts *ListOpts) (*ErrorCollection, error) {
resp := &ErrorCollection{}
err := c.rancherClient.doList(ERROR_TYPE, opts, resp)
resp.client = c
return resp, err
}
func (cc *ErrorCollection) Next() (*ErrorCollection, error) {
if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" {
resp := &ErrorCollection{}
err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp)
resp.client = cc.client
return resp, err
}
return nil, nil
}
func (c *ErrorClient) ById(id string) (*Error, error) {
resp := &Error{}
err := c.rancherClient.doById(ERROR_TYPE, id, resp)

View File

@ -38,7 +38,8 @@ type Question struct {
type QuestionCollection struct {
Collection
Data []Question `json:"data,omitempty"`
Data []Question `json:"data,omitempty"`
client *QuestionClient
}
type QuestionClient struct {
@ -74,9 +75,20 @@ func (c *QuestionClient) Update(existing *Question, updates interface{}) (*Quest
func (c *QuestionClient) List(opts *ListOpts) (*QuestionCollection, error) {
resp := &QuestionCollection{}
err := c.rancherClient.doList(QUESTION_TYPE, opts, resp)
resp.client = c
return resp, err
}
func (cc *QuestionCollection) Next() (*QuestionCollection, error) {
if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" {
resp := &QuestionCollection{}
err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp)
resp.client = cc.client
return resp, err
}
return nil, nil
}
func (c *QuestionClient) ById(id string) (*Question, error) {
resp := &Question{}
err := c.rancherClient.doById(QUESTION_TYPE, id, resp)

View File

@ -9,17 +9,23 @@ type Template struct {
Actions map[string]interface{} `json:"actions,omitempty" yaml:"actions,omitempty"`
Bindings map[string]interface{} `json:"bindings,omitempty" yaml:"bindings,omitempty"`
CatalogId string `json:"catalogId,omitempty" yaml:"catalog_id,omitempty"`
Categories []string `json:"categories,omitempty" yaml:"categories,omitempty"`
Category string `json:"category,omitempty" yaml:"category,omitempty"`
DefaultTemplateVersionId string `json:"defaultTemplateVersionId,omitempty" yaml:"default_template_version_id,omitempty"`
DefaultVersion string `json:"defaultVersion,omitempty" yaml:"default_version,omitempty"`
Description string `json:"description,omitempty" yaml:"description,omitempty"`
Files map[string]interface{} `json:"files,omitempty" yaml:"files,omitempty"`
EnvironmentId string `json:"environmentId,omitempty" yaml:"environment_id,omitempty"`
FolderName string `json:"folderName,omitempty" yaml:"folder_name,omitempty"`
IconFilename string `json:"iconFilename,omitempty" yaml:"icon_filename,omitempty"`
IsSystem string `json:"isSystem,omitempty" yaml:"is_system,omitempty"`
@ -31,28 +37,25 @@ type Template struct {
Maintainer string `json:"maintainer,omitempty" yaml:"maintainer,omitempty"`
MinimumRancherVersion string `json:"minimumRancherVersion,omitempty" yaml:"minimum_rancher_version,omitempty"`
Name string `json:"name,omitempty" yaml:"name,omitempty"`
Path string `json:"path,omitempty" yaml:"path,omitempty"`
TemplateBase string `json:"templateBase,omitempty" yaml:"template_base,omitempty"`
TemplateVersionRancherVersion map[string]interface{} `json:"templateVersionRancherVersion,omitempty" yaml:"template_version_rancher_version,omitempty"`
Type string `json:"type,omitempty" yaml:"type,omitempty"`
UpgradeFrom string `json:"upgradeFrom,omitempty" yaml:"upgrade_from,omitempty"`
UpgradeVersionLinks map[string]interface{} `json:"upgradeVersionLinks,omitempty" yaml:"upgrade_version_links,omitempty"`
VersionLinks map[string]interface{} `json:"versionLinks,omitempty" yaml:"version_links,omitempty"`
Versions []string `json:"versions,omitempty" yaml:"versions,omitempty"`
}
type TemplateCollection struct {
Collection
Data []Template `json:"data,omitempty"`
Data []Template `json:"data,omitempty"`
client *TemplateClient
}
type TemplateClient struct {
@ -88,9 +91,20 @@ func (c *TemplateClient) Update(existing *Template, updates interface{}) (*Templ
func (c *TemplateClient) List(opts *ListOpts) (*TemplateCollection, error) {
resp := &TemplateCollection{}
err := c.rancherClient.doList(TEMPLATE_TYPE, opts, resp)
resp.client = c
return resp, err
}
func (cc *TemplateCollection) Next() (*TemplateCollection, error) {
if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" {
resp := &TemplateCollection{}
err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp)
resp.client = cc.client
return resp, err
}
return nil, nil
}
func (c *TemplateClient) ById(id string) (*Template, error) {
resp := &Template{}
err := c.rancherClient.doById(TEMPLATE_TYPE, id, resp)

View File

@ -11,43 +11,19 @@ type TemplateVersion struct {
Bindings map[string]interface{} `json:"bindings,omitempty" yaml:"bindings,omitempty"`
CatalogId string `json:"catalogId,omitempty" yaml:"catalog_id,omitempty"`
Category string `json:"category,omitempty" yaml:"category,omitempty"`
DefaultVersion string `json:"defaultVersion,omitempty" yaml:"default_version,omitempty"`
Description string `json:"description,omitempty" yaml:"description,omitempty"`
Files map[string]interface{} `json:"files,omitempty" yaml:"files,omitempty"`
IconLink string `json:"iconLink,omitempty" yaml:"icon_link,omitempty"`
IsSystem string `json:"isSystem,omitempty" yaml:"is_system,omitempty"`
Labels map[string]interface{} `json:"labels,omitempty" yaml:"labels,omitempty"`
License string `json:"license,omitempty" yaml:"license,omitempty"`
Links map[string]interface{} `json:"links,omitempty" yaml:"links,omitempty"`
Maintainer string `json:"maintainer,omitempty" yaml:"maintainer,omitempty"`
MaximumRancherVersion string `json:"maximumRancherVersion,omitempty" yaml:"maximum_rancher_version,omitempty"`
MinimumRancherVersion string `json:"minimumRancherVersion,omitempty" yaml:"minimum_rancher_version,omitempty"`
Name string `json:"name,omitempty" yaml:"name,omitempty"`
Questions []Question `json:"questions,omitempty" yaml:"questions,omitempty"`
Path string `json:"path,omitempty" yaml:"path,omitempty"`
ProjectURL string `json:"projectURL,omitempty" yaml:"project_url,omitempty"`
Questions []string `json:"questions,omitempty" yaml:"questions,omitempty"`
ReadmeLink string `json:"readmeLink,omitempty" yaml:"readme_link,omitempty"`
TemplateBase string `json:"templateBase,omitempty" yaml:"template_base,omitempty"`
TemplateVersionRancherVersion map[string]interface{} `json:"templateVersionRancherVersion,omitempty" yaml:"template_version_rancher_version,omitempty"`
TemplateId string `json:"templateId,omitempty" yaml:"template_id,omitempty"`
Type string `json:"type,omitempty" yaml:"type,omitempty"`
@ -56,13 +32,12 @@ type TemplateVersion struct {
UpgradeVersionLinks map[string]interface{} `json:"upgradeVersionLinks,omitempty" yaml:"upgrade_version_links,omitempty"`
Version string `json:"version,omitempty" yaml:"version,omitempty"`
VersionLinks map[string]interface{} `json:"versionLinks,omitempty" yaml:"version_links,omitempty"`
}
type TemplateVersionCollection struct {
Collection
Data []TemplateVersion `json:"data,omitempty"`
Data []TemplateVersion `json:"data,omitempty"`
client *TemplateVersionClient
}
type TemplateVersionClient struct {
@ -98,9 +73,20 @@ func (c *TemplateVersionClient) Update(existing *TemplateVersion, updates interf
func (c *TemplateVersionClient) List(opts *ListOpts) (*TemplateVersionCollection, error) {
resp := &TemplateVersionCollection{}
err := c.rancherClient.doList(TEMPLATE_VERSION_TYPE, opts, resp)
resp.client = c
return resp, err
}
func (cc *TemplateVersionCollection) Next() (*TemplateVersionCollection, error) {
if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" {
resp := &TemplateVersionCollection{}
err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp)
resp.client = cc.client
return resp, err
}
return nil, nil
}
func (c *TemplateVersionClient) ById(id string) (*TemplateVersion, error) {
resp := &TemplateVersion{}
err := c.rancherClient.doById(TEMPLATE_VERSION_TYPE, id, resp)

View File

@ -56,6 +56,8 @@ func typeToFields(t reflect.Type) map[string]Field {
continue
} else if typeField.Anonymous {
continue
} else if privateFieldRegex.FindStringIndex(typeField.Name) != nil {
continue
}
fieldString := strings.ToLower(typeField.Type.Kind().String())

View File

@ -1,7 +0,0 @@
package client
type RancherBaseClient struct {
Opts *ClientOpts
Schemas *Schemas
Types map[string]Schema
}

View File

@ -1,64 +0,0 @@
package client
const (
ADD_LABEL_INPUT_TYPE = "addLabelInput"
)
type AddLabelInput struct {
Resource
Key string `json:"key,omitempty"`
Value string `json:"value,omitempty"`
}
type AddLabelInputCollection struct {
Collection
Data []AddLabelInput `json:"data,omitempty"`
}
type AddLabelInputClient struct {
rancherClient *RancherClient
}
type AddLabelInputOperations interface {
List(opts *ListOpts) (*AddLabelInputCollection, error)
Create(opts *AddLabelInput) (*AddLabelInput, error)
Update(existing *AddLabelInput, updates interface{}) (*AddLabelInput, error)
ById(id string) (*AddLabelInput, error)
Delete(container *AddLabelInput) error
}
func newAddLabelInputClient(rancherClient *RancherClient) *AddLabelInputClient {
return &AddLabelInputClient{
rancherClient: rancherClient,
}
}
func (c *AddLabelInputClient) Create(container *AddLabelInput) (*AddLabelInput, error) {
resp := &AddLabelInput{}
err := c.rancherClient.doCreate(ADD_LABEL_INPUT_TYPE, container, resp)
return resp, err
}
func (c *AddLabelInputClient) Update(existing *AddLabelInput, updates interface{}) (*AddLabelInput, error) {
resp := &AddLabelInput{}
err := c.rancherClient.doUpdate(ADD_LABEL_INPUT_TYPE, &existing.Resource, updates, resp)
return resp, err
}
func (c *AddLabelInputClient) List(opts *ListOpts) (*AddLabelInputCollection, error) {
resp := &AddLabelInputCollection{}
err := c.rancherClient.doList(ADD_LABEL_INPUT_TYPE, opts, resp)
return resp, err
}
func (c *AddLabelInputClient) ById(id string) (*AddLabelInput, error) {
resp := &AddLabelInput{}
err := c.rancherClient.doById(ADD_LABEL_INPUT_TYPE, id, resp)
return resp, err
}
func (c *AddLabelInputClient) Delete(container *AddLabelInput) error {
return c.rancherClient.doResourceDelete(ADD_LABEL_INPUT_TYPE, &container.Resource)
}

View File

@ -1,69 +0,0 @@
package client
const (
ADD_LOAD_BALANCER_INPUT_TYPE = "addLoadBalancerInput"
)
type AddLoadBalancerInput struct {
Resource
LoadBalancerId string `json:"loadBalancerId,omitempty" yaml:"load_balancer_id,omitempty"`
Weight int64 `json:"weight,omitempty" yaml:"weight,omitempty"`
}
type AddLoadBalancerInputCollection struct {
Collection
Data []AddLoadBalancerInput `json:"data,omitempty"`
}
type AddLoadBalancerInputClient struct {
rancherClient *RancherClient
}
type AddLoadBalancerInputOperations interface {
List(opts *ListOpts) (*AddLoadBalancerInputCollection, error)
Create(opts *AddLoadBalancerInput) (*AddLoadBalancerInput, error)
Update(existing *AddLoadBalancerInput, updates interface{}) (*AddLoadBalancerInput, error)
ById(id string) (*AddLoadBalancerInput, error)
Delete(container *AddLoadBalancerInput) error
}
func newAddLoadBalancerInputClient(rancherClient *RancherClient) *AddLoadBalancerInputClient {
return &AddLoadBalancerInputClient{
rancherClient: rancherClient,
}
}
func (c *AddLoadBalancerInputClient) Create(container *AddLoadBalancerInput) (*AddLoadBalancerInput, error) {
resp := &AddLoadBalancerInput{}
err := c.rancherClient.doCreate(ADD_LOAD_BALANCER_INPUT_TYPE, container, resp)
return resp, err
}
func (c *AddLoadBalancerInputClient) Update(existing *AddLoadBalancerInput, updates interface{}) (*AddLoadBalancerInput, error) {
resp := &AddLoadBalancerInput{}
err := c.rancherClient.doUpdate(ADD_LOAD_BALANCER_INPUT_TYPE, &existing.Resource, updates, resp)
return resp, err
}
func (c *AddLoadBalancerInputClient) List(opts *ListOpts) (*AddLoadBalancerInputCollection, error) {
resp := &AddLoadBalancerInputCollection{}
err := c.rancherClient.doList(ADD_LOAD_BALANCER_INPUT_TYPE, opts, resp)
return resp, err
}
func (c *AddLoadBalancerInputClient) ById(id string) (*AddLoadBalancerInput, error) {
resp := &AddLoadBalancerInput{}
err := c.rancherClient.doById(ADD_LOAD_BALANCER_INPUT_TYPE, id, resp)
if apiError, ok := err.(*ApiError); ok {
if apiError.StatusCode == 404 {
return nil, nil
}
}
return resp, err
}
func (c *AddLoadBalancerInputClient) Delete(container *AddLoadBalancerInput) error {
return c.rancherClient.doResourceDelete(ADD_LOAD_BALANCER_INPUT_TYPE, &container.Resource)
}

View File

@ -1,67 +0,0 @@
package client
const (
ADD_REMOVE_CLUSTER_HOST_INPUT_TYPE = "addRemoveClusterHostInput"
)
type AddRemoveClusterHostInput struct {
Resource
HostId string `json:"hostId,omitempty" yaml:"host_id,omitempty"`
}
type AddRemoveClusterHostInputCollection struct {
Collection
Data []AddRemoveClusterHostInput `json:"data,omitempty"`
}
type AddRemoveClusterHostInputClient struct {
rancherClient *RancherClient
}
type AddRemoveClusterHostInputOperations interface {
List(opts *ListOpts) (*AddRemoveClusterHostInputCollection, error)
Create(opts *AddRemoveClusterHostInput) (*AddRemoveClusterHostInput, error)
Update(existing *AddRemoveClusterHostInput, updates interface{}) (*AddRemoveClusterHostInput, error)
ById(id string) (*AddRemoveClusterHostInput, error)
Delete(container *AddRemoveClusterHostInput) error
}
func newAddRemoveClusterHostInputClient(rancherClient *RancherClient) *AddRemoveClusterHostInputClient {
return &AddRemoveClusterHostInputClient{
rancherClient: rancherClient,
}
}
func (c *AddRemoveClusterHostInputClient) Create(container *AddRemoveClusterHostInput) (*AddRemoveClusterHostInput, error) {
resp := &AddRemoveClusterHostInput{}
err := c.rancherClient.doCreate(ADD_REMOVE_CLUSTER_HOST_INPUT_TYPE, container, resp)
return resp, err
}
func (c *AddRemoveClusterHostInputClient) Update(existing *AddRemoveClusterHostInput, updates interface{}) (*AddRemoveClusterHostInput, error) {
resp := &AddRemoveClusterHostInput{}
err := c.rancherClient.doUpdate(ADD_REMOVE_CLUSTER_HOST_INPUT_TYPE, &existing.Resource, updates, resp)
return resp, err
}
func (c *AddRemoveClusterHostInputClient) List(opts *ListOpts) (*AddRemoveClusterHostInputCollection, error) {
resp := &AddRemoveClusterHostInputCollection{}
err := c.rancherClient.doList(ADD_REMOVE_CLUSTER_HOST_INPUT_TYPE, opts, resp)
return resp, err
}
func (c *AddRemoveClusterHostInputClient) ById(id string) (*AddRemoveClusterHostInput, error) {
resp := &AddRemoveClusterHostInput{}
err := c.rancherClient.doById(ADD_REMOVE_CLUSTER_HOST_INPUT_TYPE, id, resp)
if apiError, ok := err.(*ApiError); ok {
if apiError.StatusCode == 404 {
return nil, nil
}
}
return resp, err
}
func (c *AddRemoveClusterHostInputClient) Delete(container *AddRemoveClusterHostInput) error {
return c.rancherClient.doResourceDelete(ADD_REMOVE_CLUSTER_HOST_INPUT_TYPE, &container.Resource)
}

View File

@ -1,67 +0,0 @@
package client
const (
ADD_REMOVE_LOAD_BALANCER_HOST_INPUT_TYPE = "addRemoveLoadBalancerHostInput"
)
type AddRemoveLoadBalancerHostInput struct {
Resource
HostId string `json:"hostId,omitempty" yaml:"host_id,omitempty"`
}
type AddRemoveLoadBalancerHostInputCollection struct {
Collection
Data []AddRemoveLoadBalancerHostInput `json:"data,omitempty"`
}
type AddRemoveLoadBalancerHostInputClient struct {
rancherClient *RancherClient
}
type AddRemoveLoadBalancerHostInputOperations interface {
List(opts *ListOpts) (*AddRemoveLoadBalancerHostInputCollection, error)
Create(opts *AddRemoveLoadBalancerHostInput) (*AddRemoveLoadBalancerHostInput, error)
Update(existing *AddRemoveLoadBalancerHostInput, updates interface{}) (*AddRemoveLoadBalancerHostInput, error)
ById(id string) (*AddRemoveLoadBalancerHostInput, error)
Delete(container *AddRemoveLoadBalancerHostInput) error
}
func newAddRemoveLoadBalancerHostInputClient(rancherClient *RancherClient) *AddRemoveLoadBalancerHostInputClient {
return &AddRemoveLoadBalancerHostInputClient{
rancherClient: rancherClient,
}
}
func (c *AddRemoveLoadBalancerHostInputClient) Create(container *AddRemoveLoadBalancerHostInput) (*AddRemoveLoadBalancerHostInput, error) {
resp := &AddRemoveLoadBalancerHostInput{}
err := c.rancherClient.doCreate(ADD_REMOVE_LOAD_BALANCER_HOST_INPUT_TYPE, container, resp)
return resp, err
}
func (c *AddRemoveLoadBalancerHostInputClient) Update(existing *AddRemoveLoadBalancerHostInput, updates interface{}) (*AddRemoveLoadBalancerHostInput, error) {
resp := &AddRemoveLoadBalancerHostInput{}
err := c.rancherClient.doUpdate(ADD_REMOVE_LOAD_BALANCER_HOST_INPUT_TYPE, &existing.Resource, updates, resp)
return resp, err
}
func (c *AddRemoveLoadBalancerHostInputClient) List(opts *ListOpts) (*AddRemoveLoadBalancerHostInputCollection, error) {
resp := &AddRemoveLoadBalancerHostInputCollection{}
err := c.rancherClient.doList(ADD_REMOVE_LOAD_BALANCER_HOST_INPUT_TYPE, opts, resp)
return resp, err
}
func (c *AddRemoveLoadBalancerHostInputClient) ById(id string) (*AddRemoveLoadBalancerHostInput, error) {
resp := &AddRemoveLoadBalancerHostInput{}
err := c.rancherClient.doById(ADD_REMOVE_LOAD_BALANCER_HOST_INPUT_TYPE, id, resp)
if apiError, ok := err.(*ApiError); ok {
if apiError.StatusCode == 404 {
return nil, nil
}
}
return resp, err
}
func (c *AddRemoveLoadBalancerHostInputClient) Delete(container *AddRemoveLoadBalancerHostInput) error {
return c.rancherClient.doResourceDelete(ADD_REMOVE_LOAD_BALANCER_HOST_INPUT_TYPE, &container.Resource)
}

View File

@ -1,67 +0,0 @@
package client
const (
ADD_REMOVE_LOAD_BALANCER_LISTENER_INPUT_TYPE = "addRemoveLoadBalancerListenerInput"
)
type AddRemoveLoadBalancerListenerInput struct {
Resource
LoadBalancerListenerId string `json:"loadBalancerListenerId,omitempty" yaml:"load_balancer_listener_id,omitempty"`
}
type AddRemoveLoadBalancerListenerInputCollection struct {
Collection
Data []AddRemoveLoadBalancerListenerInput `json:"data,omitempty"`
}
type AddRemoveLoadBalancerListenerInputClient struct {
rancherClient *RancherClient
}
type AddRemoveLoadBalancerListenerInputOperations interface {
List(opts *ListOpts) (*AddRemoveLoadBalancerListenerInputCollection, error)
Create(opts *AddRemoveLoadBalancerListenerInput) (*AddRemoveLoadBalancerListenerInput, error)
Update(existing *AddRemoveLoadBalancerListenerInput, updates interface{}) (*AddRemoveLoadBalancerListenerInput, error)
ById(id string) (*AddRemoveLoadBalancerListenerInput, error)
Delete(container *AddRemoveLoadBalancerListenerInput) error
}
func newAddRemoveLoadBalancerListenerInputClient(rancherClient *RancherClient) *AddRemoveLoadBalancerListenerInputClient {
return &AddRemoveLoadBalancerListenerInputClient{
rancherClient: rancherClient,
}
}
func (c *AddRemoveLoadBalancerListenerInputClient) Create(container *AddRemoveLoadBalancerListenerInput) (*AddRemoveLoadBalancerListenerInput, error) {
resp := &AddRemoveLoadBalancerListenerInput{}
err := c.rancherClient.doCreate(ADD_REMOVE_LOAD_BALANCER_LISTENER_INPUT_TYPE, container, resp)
return resp, err
}
func (c *AddRemoveLoadBalancerListenerInputClient) Update(existing *AddRemoveLoadBalancerListenerInput, updates interface{}) (*AddRemoveLoadBalancerListenerInput, error) {
resp := &AddRemoveLoadBalancerListenerInput{}
err := c.rancherClient.doUpdate(ADD_REMOVE_LOAD_BALANCER_LISTENER_INPUT_TYPE, &existing.Resource, updates, resp)
return resp, err
}
func (c *AddRemoveLoadBalancerListenerInputClient) List(opts *ListOpts) (*AddRemoveLoadBalancerListenerInputCollection, error) {
resp := &AddRemoveLoadBalancerListenerInputCollection{}
err := c.rancherClient.doList(ADD_REMOVE_LOAD_BALANCER_LISTENER_INPUT_TYPE, opts, resp)
return resp, err
}
func (c *AddRemoveLoadBalancerListenerInputClient) ById(id string) (*AddRemoveLoadBalancerListenerInput, error) {
resp := &AddRemoveLoadBalancerListenerInput{}
err := c.rancherClient.doById(ADD_REMOVE_LOAD_BALANCER_LISTENER_INPUT_TYPE, id, resp)
if apiError, ok := err.(*ApiError); ok {
if apiError.StatusCode == 404 {
return nil, nil
}
}
return resp, err
}
func (c *AddRemoveLoadBalancerListenerInputClient) Delete(container *AddRemoveLoadBalancerListenerInput) error {
return c.rancherClient.doResourceDelete(ADD_REMOVE_LOAD_BALANCER_LISTENER_INPUT_TYPE, &container.Resource)
}

View File

@ -1,67 +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"`
}
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)
return resp, err
}
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,67 +0,0 @@
package client
const (
ADD_REMOVE_LOAD_BALANCER_TARGET_INPUT_TYPE = "addRemoveLoadBalancerTargetInput"
)
type AddRemoveLoadBalancerTargetInput struct {
Resource
LoadBalancerTarget LoadBalancerTarget `json:"loadBalancerTarget,omitempty" yaml:"load_balancer_target,omitempty"`
}
type AddRemoveLoadBalancerTargetInputCollection struct {
Collection
Data []AddRemoveLoadBalancerTargetInput `json:"data,omitempty"`
}
type AddRemoveLoadBalancerTargetInputClient struct {
rancherClient *RancherClient
}
type AddRemoveLoadBalancerTargetInputOperations interface {
List(opts *ListOpts) (*AddRemoveLoadBalancerTargetInputCollection, error)
Create(opts *AddRemoveLoadBalancerTargetInput) (*AddRemoveLoadBalancerTargetInput, error)
Update(existing *AddRemoveLoadBalancerTargetInput, updates interface{}) (*AddRemoveLoadBalancerTargetInput, error)
ById(id string) (*AddRemoveLoadBalancerTargetInput, error)
Delete(container *AddRemoveLoadBalancerTargetInput) error
}
func newAddRemoveLoadBalancerTargetInputClient(rancherClient *RancherClient) *AddRemoveLoadBalancerTargetInputClient {
return &AddRemoveLoadBalancerTargetInputClient{
rancherClient: rancherClient,
}
}
func (c *AddRemoveLoadBalancerTargetInputClient) Create(container *AddRemoveLoadBalancerTargetInput) (*AddRemoveLoadBalancerTargetInput, error) {
resp := &AddRemoveLoadBalancerTargetInput{}
err := c.rancherClient.doCreate(ADD_REMOVE_LOAD_BALANCER_TARGET_INPUT_TYPE, container, resp)
return resp, err
}
func (c *AddRemoveLoadBalancerTargetInputClient) Update(existing *AddRemoveLoadBalancerTargetInput, updates interface{}) (*AddRemoveLoadBalancerTargetInput, error) {
resp := &AddRemoveLoadBalancerTargetInput{}
err := c.rancherClient.doUpdate(ADD_REMOVE_LOAD_BALANCER_TARGET_INPUT_TYPE, &existing.Resource, updates, resp)
return resp, err
}
func (c *AddRemoveLoadBalancerTargetInputClient) List(opts *ListOpts) (*AddRemoveLoadBalancerTargetInputCollection, error) {
resp := &AddRemoveLoadBalancerTargetInputCollection{}
err := c.rancherClient.doList(ADD_REMOVE_LOAD_BALANCER_TARGET_INPUT_TYPE, opts, resp)
return resp, err
}
func (c *AddRemoveLoadBalancerTargetInputClient) ById(id string) (*AddRemoveLoadBalancerTargetInput, error) {
resp := &AddRemoveLoadBalancerTargetInput{}
err := c.rancherClient.doById(ADD_REMOVE_LOAD_BALANCER_TARGET_INPUT_TYPE, id, resp)
if apiError, ok := err.(*ApiError); ok {
if apiError.StatusCode == 404 {
return nil, nil
}
}
return resp, err
}
func (c *AddRemoveLoadBalancerTargetInputClient) Delete(container *AddRemoveLoadBalancerTargetInput) error {
return c.rancherClient.doResourceDelete(ADD_REMOVE_LOAD_BALANCER_TARGET_INPUT_TYPE, &container.Resource)
}

View File

@ -1,223 +0,0 @@
package client
const (
CLUSTER_TYPE = "cluster"
)
type Cluster struct {
Resource
AccountId string `json:"accountId,omitempty" yaml:"account_id,omitempty"`
AgentId string `json:"agentId,omitempty" yaml:"agent_id,omitempty"`
AgentState string `json:"agentState,omitempty" yaml:"agent_state,omitempty"`
ApiProxy string `json:"apiProxy,omitempty" yaml:"api_proxy,omitempty"`
ComputeTotal int64 `json:"computeTotal,omitempty" yaml:"compute_total,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"`
DiscoverySpec string `json:"discoverySpec,omitempty" yaml:"discovery_spec,omitempty"`
Hostname string `json:"hostname,omitempty" yaml:"hostname,omitempty"`
Info interface{} `json:"info,omitempty" yaml:"info,omitempty"`
Kind string `json:"kind,omitempty" yaml:"kind,omitempty"`
Labels map[string]interface{} `json:"labels,omitempty" yaml:"labels,omitempty"`
Name string `json:"name,omitempty" yaml:"name,omitempty"`
PhysicalHostId string `json:"physicalHostId,omitempty" yaml:"physical_host_id,omitempty"`
Port int64 `json:"port,omitempty" yaml:"port,omitempty"`
PublicEndpoints []interface{} `json:"publicEndpoints,omitempty" yaml:"public_endpoints,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"`
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 ClusterCollection struct {
Collection
Data []Cluster `json:"data,omitempty"`
}
type ClusterClient struct {
rancherClient *RancherClient
}
type ClusterOperations interface {
List(opts *ListOpts) (*ClusterCollection, error)
Create(opts *Cluster) (*Cluster, error)
Update(existing *Cluster, updates interface{}) (*Cluster, error)
ById(id string) (*Cluster, error)
Delete(container *Cluster) error
ActionActivate(*Cluster) (*Host, error)
ActionAddhost(*Cluster, *AddRemoveClusterHostInput) (*Cluster, error)
ActionCreate(*Cluster) (*Host, error)
ActionDeactivate(*Cluster) (*Host, error)
ActionDockersocket(*Cluster) (*HostAccess, error)
ActionPurge(*Cluster) (*Host, error)
ActionRemove(*Cluster) (*Host, error)
ActionRemovehost(*Cluster, *AddRemoveClusterHostInput) (*Cluster, error)
ActionRestore(*Cluster) (*Host, error)
ActionUpdate(*Cluster) (*Host, error)
}
func newClusterClient(rancherClient *RancherClient) *ClusterClient {
return &ClusterClient{
rancherClient: rancherClient,
}
}
func (c *ClusterClient) Create(container *Cluster) (*Cluster, error) {
resp := &Cluster{}
err := c.rancherClient.doCreate(CLUSTER_TYPE, container, resp)
return resp, err
}
func (c *ClusterClient) Update(existing *Cluster, updates interface{}) (*Cluster, error) {
resp := &Cluster{}
err := c.rancherClient.doUpdate(CLUSTER_TYPE, &existing.Resource, updates, resp)
return resp, err
}
func (c *ClusterClient) List(opts *ListOpts) (*ClusterCollection, error) {
resp := &ClusterCollection{}
err := c.rancherClient.doList(CLUSTER_TYPE, opts, resp)
return resp, err
}
func (c *ClusterClient) ById(id string) (*Cluster, error) {
resp := &Cluster{}
err := c.rancherClient.doById(CLUSTER_TYPE, id, resp)
if apiError, ok := err.(*ApiError); ok {
if apiError.StatusCode == 404 {
return nil, nil
}
}
return resp, err
}
func (c *ClusterClient) Delete(container *Cluster) error {
return c.rancherClient.doResourceDelete(CLUSTER_TYPE, &container.Resource)
}
func (c *ClusterClient) ActionActivate(resource *Cluster) (*Host, error) {
resp := &Host{}
err := c.rancherClient.doAction(CLUSTER_TYPE, "activate", &resource.Resource, nil, resp)
return resp, err
}
func (c *ClusterClient) ActionAddhost(resource *Cluster, input *AddRemoveClusterHostInput) (*Cluster, error) {
resp := &Cluster{}
err := c.rancherClient.doAction(CLUSTER_TYPE, "addhost", &resource.Resource, input, resp)
return resp, err
}
func (c *ClusterClient) ActionCreate(resource *Cluster) (*Host, error) {
resp := &Host{}
err := c.rancherClient.doAction(CLUSTER_TYPE, "create", &resource.Resource, nil, resp)
return resp, err
}
func (c *ClusterClient) ActionDeactivate(resource *Cluster) (*Host, error) {
resp := &Host{}
err := c.rancherClient.doAction(CLUSTER_TYPE, "deactivate", &resource.Resource, nil, resp)
return resp, err
}
func (c *ClusterClient) ActionDockersocket(resource *Cluster) (*HostAccess, error) {
resp := &HostAccess{}
err := c.rancherClient.doAction(CLUSTER_TYPE, "dockersocket", &resource.Resource, nil, resp)
return resp, err
}
func (c *ClusterClient) ActionPurge(resource *Cluster) (*Host, error) {
resp := &Host{}
err := c.rancherClient.doAction(CLUSTER_TYPE, "purge", &resource.Resource, nil, resp)
return resp, err
}
func (c *ClusterClient) ActionRemove(resource *Cluster) (*Host, error) {
resp := &Host{}
err := c.rancherClient.doAction(CLUSTER_TYPE, "remove", &resource.Resource, nil, resp)
return resp, err
}
func (c *ClusterClient) ActionRemovehost(resource *Cluster, input *AddRemoveClusterHostInput) (*Cluster, error) {
resp := &Cluster{}
err := c.rancherClient.doAction(CLUSTER_TYPE, "removehost", &resource.Resource, input, resp)
return resp, err
}
func (c *ClusterClient) ActionRestore(resource *Cluster) (*Host, error) {
resp := &Host{}
err := c.rancherClient.doAction(CLUSTER_TYPE, "restore", &resource.Resource, nil, resp)
return resp, err
}
func (c *ClusterClient) ActionUpdate(resource *Cluster) (*Host, error) {
resp := &Host{}
err := c.rancherClient.doAction(CLUSTER_TYPE, "update", &resource.Resource, nil, resp)
return resp, err
}

View File

@ -1,252 +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"`
}
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)
return resp, err
}
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,73 +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"`
}
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)
return resp, err
}
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,81 +0,0 @@
package client
const (
EXOSCALE_CONFIG_TYPE = "exoscaleConfig"
)
type ExoscaleConfig struct {
Resource
ApiKey string `json:"apiKey,omitempty" yaml:"api_key,omitempty"`
ApiSecretKey string `json:"apiSecretKey,omitempty" yaml:"api_secret_key,omitempty"`
AvailabilityZone string `json:"availabilityZone,omitempty" yaml:"availability_zone,omitempty"`
DiskSize string `json:"diskSize,omitempty" yaml:"disk_size,omitempty"`
Image string `json:"image,omitempty" yaml:"image,omitempty"`
InstanceProfile string `json:"instanceProfile,omitempty" yaml:"instance_profile,omitempty"`
SecurityGroup []string `json:"securityGroup,omitempty" yaml:"security_group,omitempty"`
Url string `json:"url,omitempty" yaml:"url,omitempty"`
}
type ExoscaleConfigCollection struct {
Collection
Data []ExoscaleConfig `json:"data,omitempty"`
}
type ExoscaleConfigClient struct {
rancherClient *RancherClient
}
type ExoscaleConfigOperations interface {
List(opts *ListOpts) (*ExoscaleConfigCollection, error)
Create(opts *ExoscaleConfig) (*ExoscaleConfig, error)
Update(existing *ExoscaleConfig, updates interface{}) (*ExoscaleConfig, error)
ById(id string) (*ExoscaleConfig, error)
Delete(container *ExoscaleConfig) error
}
func newExoscaleConfigClient(rancherClient *RancherClient) *ExoscaleConfigClient {
return &ExoscaleConfigClient{
rancherClient: rancherClient,
}
}
func (c *ExoscaleConfigClient) Create(container *ExoscaleConfig) (*ExoscaleConfig, error) {
resp := &ExoscaleConfig{}
err := c.rancherClient.doCreate(EXOSCALE_CONFIG_TYPE, container, resp)
return resp, err
}
func (c *ExoscaleConfigClient) Update(existing *ExoscaleConfig, updates interface{}) (*ExoscaleConfig, error) {
resp := &ExoscaleConfig{}
err := c.rancherClient.doUpdate(EXOSCALE_CONFIG_TYPE, &existing.Resource, updates, resp)
return resp, err
}
func (c *ExoscaleConfigClient) List(opts *ListOpts) (*ExoscaleConfigCollection, error) {
resp := &ExoscaleConfigCollection{}
err := c.rancherClient.doList(EXOSCALE_CONFIG_TYPE, opts, resp)
return resp, err
}
func (c *ExoscaleConfigClient) ById(id string) (*ExoscaleConfig, error) {
resp := &ExoscaleConfig{}
err := c.rancherClient.doById(EXOSCALE_CONFIG_TYPE, id, resp)
if apiError, ok := err.(*ApiError); ok {
if apiError.StatusCode == 404 {
return nil, nil
}
}
return resp, err
}
func (c *ExoscaleConfigClient) Delete(container *ExoscaleConfig) error {
return c.rancherClient.doResourceDelete(EXOSCALE_CONFIG_TYPE, &container.Resource)
}

View File

@ -1,81 +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"`
}
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)
return resp, err
}
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,139 +0,0 @@
package client
const (
GLOBAL_LOAD_BALANCER_TYPE = "globalLoadBalancer"
)
type GlobalLoadBalancer 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"`
GlobalLoadBalancerHealthCheck []interface{} `json:"globalLoadBalancerHealthCheck,omitempty" yaml:"global_load_balancer_health_check,omitempty"`
GlobalLoadBalancerPolicy []interface{} `json:"globalLoadBalancerPolicy,omitempty" yaml:"global_load_balancer_policy,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"`
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 GlobalLoadBalancerCollection struct {
Collection
Data []GlobalLoadBalancer `json:"data,omitempty"`
}
type GlobalLoadBalancerClient struct {
rancherClient *RancherClient
}
type GlobalLoadBalancerOperations interface {
List(opts *ListOpts) (*GlobalLoadBalancerCollection, error)
Create(opts *GlobalLoadBalancer) (*GlobalLoadBalancer, error)
Update(existing *GlobalLoadBalancer, updates interface{}) (*GlobalLoadBalancer, error)
ById(id string) (*GlobalLoadBalancer, error)
Delete(container *GlobalLoadBalancer) error
ActionAddloadbalancer(*GlobalLoadBalancer, *AddLoadBalancerInput) (*GlobalLoadBalancer, error)
ActionCreate(*GlobalLoadBalancer) (*GlobalLoadBalancer, error)
ActionRemove(*GlobalLoadBalancer) (*GlobalLoadBalancer, error)
ActionRemoveloadbalancer(*GlobalLoadBalancer, *RemoveLoadBalancerInput) (*GlobalLoadBalancer, error)
}
func newGlobalLoadBalancerClient(rancherClient *RancherClient) *GlobalLoadBalancerClient {
return &GlobalLoadBalancerClient{
rancherClient: rancherClient,
}
}
func (c *GlobalLoadBalancerClient) Create(container *GlobalLoadBalancer) (*GlobalLoadBalancer, error) {
resp := &GlobalLoadBalancer{}
err := c.rancherClient.doCreate(GLOBAL_LOAD_BALANCER_TYPE, container, resp)
return resp, err
}
func (c *GlobalLoadBalancerClient) Update(existing *GlobalLoadBalancer, updates interface{}) (*GlobalLoadBalancer, error) {
resp := &GlobalLoadBalancer{}
err := c.rancherClient.doUpdate(GLOBAL_LOAD_BALANCER_TYPE, &existing.Resource, updates, resp)
return resp, err
}
func (c *GlobalLoadBalancerClient) List(opts *ListOpts) (*GlobalLoadBalancerCollection, error) {
resp := &GlobalLoadBalancerCollection{}
err := c.rancherClient.doList(GLOBAL_LOAD_BALANCER_TYPE, opts, resp)
return resp, err
}
func (c *GlobalLoadBalancerClient) ById(id string) (*GlobalLoadBalancer, error) {
resp := &GlobalLoadBalancer{}
err := c.rancherClient.doById(GLOBAL_LOAD_BALANCER_TYPE, id, resp)
if apiError, ok := err.(*ApiError); ok {
if apiError.StatusCode == 404 {
return nil, nil
}
}
return resp, err
}
func (c *GlobalLoadBalancerClient) Delete(container *GlobalLoadBalancer) error {
return c.rancherClient.doResourceDelete(GLOBAL_LOAD_BALANCER_TYPE, &container.Resource)
}
func (c *GlobalLoadBalancerClient) ActionAddloadbalancer(resource *GlobalLoadBalancer, input *AddLoadBalancerInput) (*GlobalLoadBalancer, error) {
resp := &GlobalLoadBalancer{}
err := c.rancherClient.doAction(GLOBAL_LOAD_BALANCER_TYPE, "addloadbalancer", &resource.Resource, input, resp)
return resp, err
}
func (c *GlobalLoadBalancerClient) ActionCreate(resource *GlobalLoadBalancer) (*GlobalLoadBalancer, error) {
resp := &GlobalLoadBalancer{}
err := c.rancherClient.doAction(GLOBAL_LOAD_BALANCER_TYPE, "create", &resource.Resource, nil, resp)
return resp, err
}
func (c *GlobalLoadBalancerClient) ActionRemove(resource *GlobalLoadBalancer) (*GlobalLoadBalancer, error) {
resp := &GlobalLoadBalancer{}
err := c.rancherClient.doAction(GLOBAL_LOAD_BALANCER_TYPE, "remove", &resource.Resource, nil, resp)
return resp, err
}
func (c *GlobalLoadBalancerClient) ActionRemoveloadbalancer(resource *GlobalLoadBalancer, input *RemoveLoadBalancerInput) (*GlobalLoadBalancer, error) {
resp := &GlobalLoadBalancer{}
err := c.rancherClient.doAction(GLOBAL_LOAD_BALANCER_TYPE, "removeloadbalancer", &resource.Resource, input, resp)
return resp, err
}

View File

@ -1,67 +0,0 @@
package client
const (
GLOBAL_LOAD_BALANCER_HEALTH_CHECK_TYPE = "globalLoadBalancerHealthCheck"
)
type GlobalLoadBalancerHealthCheck struct {
Resource
Name string `json:"name,omitempty" yaml:"name,omitempty"`
}
type GlobalLoadBalancerHealthCheckCollection struct {
Collection
Data []GlobalLoadBalancerHealthCheck `json:"data,omitempty"`
}
type GlobalLoadBalancerHealthCheckClient struct {
rancherClient *RancherClient
}
type GlobalLoadBalancerHealthCheckOperations interface {
List(opts *ListOpts) (*GlobalLoadBalancerHealthCheckCollection, error)
Create(opts *GlobalLoadBalancerHealthCheck) (*GlobalLoadBalancerHealthCheck, error)
Update(existing *GlobalLoadBalancerHealthCheck, updates interface{}) (*GlobalLoadBalancerHealthCheck, error)
ById(id string) (*GlobalLoadBalancerHealthCheck, error)
Delete(container *GlobalLoadBalancerHealthCheck) error
}
func newGlobalLoadBalancerHealthCheckClient(rancherClient *RancherClient) *GlobalLoadBalancerHealthCheckClient {
return &GlobalLoadBalancerHealthCheckClient{
rancherClient: rancherClient,
}
}
func (c *GlobalLoadBalancerHealthCheckClient) Create(container *GlobalLoadBalancerHealthCheck) (*GlobalLoadBalancerHealthCheck, error) {
resp := &GlobalLoadBalancerHealthCheck{}
err := c.rancherClient.doCreate(GLOBAL_LOAD_BALANCER_HEALTH_CHECK_TYPE, container, resp)
return resp, err
}
func (c *GlobalLoadBalancerHealthCheckClient) Update(existing *GlobalLoadBalancerHealthCheck, updates interface{}) (*GlobalLoadBalancerHealthCheck, error) {
resp := &GlobalLoadBalancerHealthCheck{}
err := c.rancherClient.doUpdate(GLOBAL_LOAD_BALANCER_HEALTH_CHECK_TYPE, &existing.Resource, updates, resp)
return resp, err
}
func (c *GlobalLoadBalancerHealthCheckClient) List(opts *ListOpts) (*GlobalLoadBalancerHealthCheckCollection, error) {
resp := &GlobalLoadBalancerHealthCheckCollection{}
err := c.rancherClient.doList(GLOBAL_LOAD_BALANCER_HEALTH_CHECK_TYPE, opts, resp)
return resp, err
}
func (c *GlobalLoadBalancerHealthCheckClient) ById(id string) (*GlobalLoadBalancerHealthCheck, error) {
resp := &GlobalLoadBalancerHealthCheck{}
err := c.rancherClient.doById(GLOBAL_LOAD_BALANCER_HEALTH_CHECK_TYPE, id, resp)
if apiError, ok := err.(*ApiError); ok {
if apiError.StatusCode == 404 {
return nil, nil
}
}
return resp, err
}
func (c *GlobalLoadBalancerHealthCheckClient) Delete(container *GlobalLoadBalancerHealthCheck) error {
return c.rancherClient.doResourceDelete(GLOBAL_LOAD_BALANCER_HEALTH_CHECK_TYPE, &container.Resource)
}

View File

@ -1,67 +0,0 @@
package client
const (
GLOBAL_LOAD_BALANCER_POLICY_TYPE = "globalLoadBalancerPolicy"
)
type GlobalLoadBalancerPolicy struct {
Resource
Name string `json:"name,omitempty" yaml:"name,omitempty"`
}
type GlobalLoadBalancerPolicyCollection struct {
Collection
Data []GlobalLoadBalancerPolicy `json:"data,omitempty"`
}
type GlobalLoadBalancerPolicyClient struct {
rancherClient *RancherClient
}
type GlobalLoadBalancerPolicyOperations interface {
List(opts *ListOpts) (*GlobalLoadBalancerPolicyCollection, error)
Create(opts *GlobalLoadBalancerPolicy) (*GlobalLoadBalancerPolicy, error)
Update(existing *GlobalLoadBalancerPolicy, updates interface{}) (*GlobalLoadBalancerPolicy, error)
ById(id string) (*GlobalLoadBalancerPolicy, error)
Delete(container *GlobalLoadBalancerPolicy) error
}
func newGlobalLoadBalancerPolicyClient(rancherClient *RancherClient) *GlobalLoadBalancerPolicyClient {
return &GlobalLoadBalancerPolicyClient{
rancherClient: rancherClient,
}
}
func (c *GlobalLoadBalancerPolicyClient) Create(container *GlobalLoadBalancerPolicy) (*GlobalLoadBalancerPolicy, error) {
resp := &GlobalLoadBalancerPolicy{}
err := c.rancherClient.doCreate(GLOBAL_LOAD_BALANCER_POLICY_TYPE, container, resp)
return resp, err
}
func (c *GlobalLoadBalancerPolicyClient) Update(existing *GlobalLoadBalancerPolicy, updates interface{}) (*GlobalLoadBalancerPolicy, error) {
resp := &GlobalLoadBalancerPolicy{}
err := c.rancherClient.doUpdate(GLOBAL_LOAD_BALANCER_POLICY_TYPE, &existing.Resource, updates, resp)
return resp, err
}
func (c *GlobalLoadBalancerPolicyClient) List(opts *ListOpts) (*GlobalLoadBalancerPolicyCollection, error) {
resp := &GlobalLoadBalancerPolicyCollection{}
err := c.rancherClient.doList(GLOBAL_LOAD_BALANCER_POLICY_TYPE, opts, resp)
return resp, err
}
func (c *GlobalLoadBalancerPolicyClient) ById(id string) (*GlobalLoadBalancerPolicy, error) {
resp := &GlobalLoadBalancerPolicy{}
err := c.rancherClient.doById(GLOBAL_LOAD_BALANCER_POLICY_TYPE, id, resp)
if apiError, ok := err.(*ApiError); ok {
if apiError.StatusCode == 404 {
return nil, nil
}
}
return resp, err
}
func (c *GlobalLoadBalancerPolicyClient) Delete(container *GlobalLoadBalancerPolicy) error {
return c.rancherClient.doResourceDelete(GLOBAL_LOAD_BALANCER_POLICY_TYPE, &container.Resource)
}

View File

@ -1,69 +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"`
}
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)
return resp, err
}
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,67 +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"`
}
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)
return resp, err
}
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,224 +0,0 @@
package client
const (
LOAD_BALANCER_TYPE = "loadBalancer"
)
type LoadBalancer struct {
Resource
AccountId string `json:"accountId,omitempty" yaml:"account_id,omitempty"`
CertificateIds []string `json:"certificateIds,omitempty" yaml:"certificate_ids,omitempty"`
Created string `json:"created,omitempty" yaml:"created,omitempty"`
Data map[string]interface{} `json:"data,omitempty" yaml:"data,omitempty"`
DefaultCertificateId string `json:"defaultCertificateId,omitempty" yaml:"default_certificate_id,omitempty"`
Description string `json:"description,omitempty" yaml:"description,omitempty"`
GlobalLoadBalancerId string `json:"globalLoadBalancerId,omitempty" yaml:"global_load_balancer_id,omitempty"`
Kind string `json:"kind,omitempty" yaml:"kind,omitempty"`
LoadBalancerConfigId string `json:"loadBalancerConfigId,omitempty" yaml:"load_balancer_config_id,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"`
ServiceId string `json:"serviceId,omitempty" yaml:"service_id,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"`
Weight int64 `json:"weight,omitempty" yaml:"weight,omitempty"`
}
type LoadBalancerCollection struct {
Collection
Data []LoadBalancer `json:"data,omitempty"`
}
type LoadBalancerClient struct {
rancherClient *RancherClient
}
type LoadBalancerOperations interface {
List(opts *ListOpts) (*LoadBalancerCollection, error)
Create(opts *LoadBalancer) (*LoadBalancer, error)
Update(existing *LoadBalancer, updates interface{}) (*LoadBalancer, error)
ById(id string) (*LoadBalancer, error)
Delete(container *LoadBalancer) error
ActionActivate(*LoadBalancer) (*LoadBalancer, error)
ActionAddhost(*LoadBalancer, *AddRemoveLoadBalancerHostInput) (*LoadBalancer, error)
ActionAddtarget(*LoadBalancer, *AddRemoveLoadBalancerTargetInput) (*LoadBalancer, error)
ActionCreate(*LoadBalancer) (*LoadBalancer, error)
ActionDeactivate(*LoadBalancer) (*LoadBalancer, error)
ActionRemove(*LoadBalancer) (*LoadBalancer, error)
ActionRemovehost(*LoadBalancer, *AddRemoveLoadBalancerHostInput) (*LoadBalancer, error)
ActionRemovetarget(*LoadBalancer, *AddRemoveLoadBalancerTargetInput) (*LoadBalancer, error)
ActionSethosts(*LoadBalancer, *SetLoadBalancerHostsInput) (*LoadBalancer, error)
ActionSettargets(*LoadBalancer, *SetLoadBalancerTargetsInput) (*LoadBalancer, error)
ActionUpdate(*LoadBalancer) (*LoadBalancer, error)
}
func newLoadBalancerClient(rancherClient *RancherClient) *LoadBalancerClient {
return &LoadBalancerClient{
rancherClient: rancherClient,
}
}
func (c *LoadBalancerClient) Create(container *LoadBalancer) (*LoadBalancer, error) {
resp := &LoadBalancer{}
err := c.rancherClient.doCreate(LOAD_BALANCER_TYPE, container, resp)
return resp, err
}
func (c *LoadBalancerClient) Update(existing *LoadBalancer, updates interface{}) (*LoadBalancer, error) {
resp := &LoadBalancer{}
err := c.rancherClient.doUpdate(LOAD_BALANCER_TYPE, &existing.Resource, updates, resp)
return resp, err
}
func (c *LoadBalancerClient) List(opts *ListOpts) (*LoadBalancerCollection, error) {
resp := &LoadBalancerCollection{}
err := c.rancherClient.doList(LOAD_BALANCER_TYPE, opts, resp)
return resp, err
}
func (c *LoadBalancerClient) ById(id string) (*LoadBalancer, error) {
resp := &LoadBalancer{}
err := c.rancherClient.doById(LOAD_BALANCER_TYPE, id, resp)
if apiError, ok := err.(*ApiError); ok {
if apiError.StatusCode == 404 {
return nil, nil
}
}
return resp, err
}
func (c *LoadBalancerClient) Delete(container *LoadBalancer) error {
return c.rancherClient.doResourceDelete(LOAD_BALANCER_TYPE, &container.Resource)
}
func (c *LoadBalancerClient) ActionActivate(resource *LoadBalancer) (*LoadBalancer, error) {
resp := &LoadBalancer{}
err := c.rancherClient.doAction(LOAD_BALANCER_TYPE, "activate", &resource.Resource, nil, resp)
return resp, err
}
func (c *LoadBalancerClient) ActionAddhost(resource *LoadBalancer, input *AddRemoveLoadBalancerHostInput) (*LoadBalancer, error) {
resp := &LoadBalancer{}
err := c.rancherClient.doAction(LOAD_BALANCER_TYPE, "addhost", &resource.Resource, input, resp)
return resp, err
}
func (c *LoadBalancerClient) ActionAddtarget(resource *LoadBalancer, input *AddRemoveLoadBalancerTargetInput) (*LoadBalancer, error) {
resp := &LoadBalancer{}
err := c.rancherClient.doAction(LOAD_BALANCER_TYPE, "addtarget", &resource.Resource, input, resp)
return resp, err
}
func (c *LoadBalancerClient) ActionCreate(resource *LoadBalancer) (*LoadBalancer, error) {
resp := &LoadBalancer{}
err := c.rancherClient.doAction(LOAD_BALANCER_TYPE, "create", &resource.Resource, nil, resp)
return resp, err
}
func (c *LoadBalancerClient) ActionDeactivate(resource *LoadBalancer) (*LoadBalancer, error) {
resp := &LoadBalancer{}
err := c.rancherClient.doAction(LOAD_BALANCER_TYPE, "deactivate", &resource.Resource, nil, resp)
return resp, err
}
func (c *LoadBalancerClient) ActionRemove(resource *LoadBalancer) (*LoadBalancer, error) {
resp := &LoadBalancer{}
err := c.rancherClient.doAction(LOAD_BALANCER_TYPE, "remove", &resource.Resource, nil, resp)
return resp, err
}
func (c *LoadBalancerClient) ActionRemovehost(resource *LoadBalancer, input *AddRemoveLoadBalancerHostInput) (*LoadBalancer, error) {
resp := &LoadBalancer{}
err := c.rancherClient.doAction(LOAD_BALANCER_TYPE, "removehost", &resource.Resource, input, resp)
return resp, err
}
func (c *LoadBalancerClient) ActionRemovetarget(resource *LoadBalancer, input *AddRemoveLoadBalancerTargetInput) (*LoadBalancer, error) {
resp := &LoadBalancer{}
err := c.rancherClient.doAction(LOAD_BALANCER_TYPE, "removetarget", &resource.Resource, input, resp)
return resp, err
}
func (c *LoadBalancerClient) ActionSethosts(resource *LoadBalancer, input *SetLoadBalancerHostsInput) (*LoadBalancer, error) {
resp := &LoadBalancer{}
err := c.rancherClient.doAction(LOAD_BALANCER_TYPE, "sethosts", &resource.Resource, input, resp)
return resp, err
}
func (c *LoadBalancerClient) ActionSettargets(resource *LoadBalancer, input *SetLoadBalancerTargetsInput) (*LoadBalancer, error) {
resp := &LoadBalancer{}
err := c.rancherClient.doAction(LOAD_BALANCER_TYPE, "settargets", &resource.Resource, input, resp)
return resp, err
}
func (c *LoadBalancerClient) ActionUpdate(resource *LoadBalancer) (*LoadBalancer, error) {
resp := &LoadBalancer{}
err := c.rancherClient.doAction(LOAD_BALANCER_TYPE, "update", &resource.Resource, nil, resp)
return resp, err
}

View File

@ -1,79 +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"`
}
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)
return resp, err
}
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,69 +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"`
}
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)
return resp, err
}
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,117 +0,0 @@
package client
const (
LOAD_BALANCER_CONFIG_LISTENER_MAP_TYPE = "loadBalancerConfigListenerMap"
)
type LoadBalancerConfigListenerMap 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"`
Kind string `json:"kind,omitempty" yaml:"kind,omitempty"`
LoadBalancerConfigId string `json:"loadBalancerConfigId,omitempty" yaml:"load_balancer_config_id,omitempty"`
LoadBalancerListenerId string `json:"loadBalancerListenerId,omitempty" yaml:"load_balancer_listener_id,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"`
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 LoadBalancerConfigListenerMapCollection struct {
Collection
Data []LoadBalancerConfigListenerMap `json:"data,omitempty"`
}
type LoadBalancerConfigListenerMapClient struct {
rancherClient *RancherClient
}
type LoadBalancerConfigListenerMapOperations interface {
List(opts *ListOpts) (*LoadBalancerConfigListenerMapCollection, error)
Create(opts *LoadBalancerConfigListenerMap) (*LoadBalancerConfigListenerMap, error)
Update(existing *LoadBalancerConfigListenerMap, updates interface{}) (*LoadBalancerConfigListenerMap, error)
ById(id string) (*LoadBalancerConfigListenerMap, error)
Delete(container *LoadBalancerConfigListenerMap) error
ActionCreate(*LoadBalancerConfigListenerMap) (*LoadBalancerConfigListenerMap, error)
ActionRemove(*LoadBalancerConfigListenerMap) (*LoadBalancerConfigListenerMap, error)
}
func newLoadBalancerConfigListenerMapClient(rancherClient *RancherClient) *LoadBalancerConfigListenerMapClient {
return &LoadBalancerConfigListenerMapClient{
rancherClient: rancherClient,
}
}
func (c *LoadBalancerConfigListenerMapClient) Create(container *LoadBalancerConfigListenerMap) (*LoadBalancerConfigListenerMap, error) {
resp := &LoadBalancerConfigListenerMap{}
err := c.rancherClient.doCreate(LOAD_BALANCER_CONFIG_LISTENER_MAP_TYPE, container, resp)
return resp, err
}
func (c *LoadBalancerConfigListenerMapClient) Update(existing *LoadBalancerConfigListenerMap, updates interface{}) (*LoadBalancerConfigListenerMap, error) {
resp := &LoadBalancerConfigListenerMap{}
err := c.rancherClient.doUpdate(LOAD_BALANCER_CONFIG_LISTENER_MAP_TYPE, &existing.Resource, updates, resp)
return resp, err
}
func (c *LoadBalancerConfigListenerMapClient) List(opts *ListOpts) (*LoadBalancerConfigListenerMapCollection, error) {
resp := &LoadBalancerConfigListenerMapCollection{}
err := c.rancherClient.doList(LOAD_BALANCER_CONFIG_LISTENER_MAP_TYPE, opts, resp)
return resp, err
}
func (c *LoadBalancerConfigListenerMapClient) ById(id string) (*LoadBalancerConfigListenerMap, error) {
resp := &LoadBalancerConfigListenerMap{}
err := c.rancherClient.doById(LOAD_BALANCER_CONFIG_LISTENER_MAP_TYPE, id, resp)
if apiError, ok := err.(*ApiError); ok {
if apiError.StatusCode == 404 {
return nil, nil
}
}
return resp, err
}
func (c *LoadBalancerConfigListenerMapClient) Delete(container *LoadBalancerConfigListenerMap) error {
return c.rancherClient.doResourceDelete(LOAD_BALANCER_CONFIG_LISTENER_MAP_TYPE, &container.Resource)
}
func (c *LoadBalancerConfigListenerMapClient) ActionCreate(resource *LoadBalancerConfigListenerMap) (*LoadBalancerConfigListenerMap, error) {
resp := &LoadBalancerConfigListenerMap{}
err := c.rancherClient.doAction(LOAD_BALANCER_CONFIG_LISTENER_MAP_TYPE, "create", &resource.Resource, nil, resp)
return resp, err
}
func (c *LoadBalancerConfigListenerMapClient) ActionRemove(resource *LoadBalancerConfigListenerMap) (*LoadBalancerConfigListenerMap, error) {
resp := &LoadBalancerConfigListenerMap{}
err := c.rancherClient.doAction(LOAD_BALANCER_CONFIG_LISTENER_MAP_TYPE, "remove", &resource.Resource, nil, resp)
return resp, err
}

View File

@ -1,79 +0,0 @@
package client
const (
LOAD_BALANCER_HEALTH_CHECK_TYPE = "loadBalancerHealthCheck"
)
type LoadBalancerHealthCheck struct {
Resource
HealthyThreshold int64 `json:"healthyThreshold,omitempty" yaml:"healthy_threshold,omitempty"`
Interval int64 `json:"interval,omitempty" yaml:"interval,omitempty"`
Name string `json:"name,omitempty" yaml:"name,omitempty"`
Port int64 `json:"port,omitempty" yaml:"port,omitempty"`
RequestLine string `json:"requestLine,omitempty" yaml:"request_line,omitempty"`
ResponseTimeout int64 `json:"responseTimeout,omitempty" yaml:"response_timeout,omitempty"`
UnhealthyThreshold int64 `json:"unhealthyThreshold,omitempty" yaml:"unhealthy_threshold,omitempty"`
}
type LoadBalancerHealthCheckCollection struct {
Collection
Data []LoadBalancerHealthCheck `json:"data,omitempty"`
}
type LoadBalancerHealthCheckClient struct {
rancherClient *RancherClient
}
type LoadBalancerHealthCheckOperations interface {
List(opts *ListOpts) (*LoadBalancerHealthCheckCollection, error)
Create(opts *LoadBalancerHealthCheck) (*LoadBalancerHealthCheck, error)
Update(existing *LoadBalancerHealthCheck, updates interface{}) (*LoadBalancerHealthCheck, error)
ById(id string) (*LoadBalancerHealthCheck, error)
Delete(container *LoadBalancerHealthCheck) error
}
func newLoadBalancerHealthCheckClient(rancherClient *RancherClient) *LoadBalancerHealthCheckClient {
return &LoadBalancerHealthCheckClient{
rancherClient: rancherClient,
}
}
func (c *LoadBalancerHealthCheckClient) Create(container *LoadBalancerHealthCheck) (*LoadBalancerHealthCheck, error) {
resp := &LoadBalancerHealthCheck{}
err := c.rancherClient.doCreate(LOAD_BALANCER_HEALTH_CHECK_TYPE, container, resp)
return resp, err
}
func (c *LoadBalancerHealthCheckClient) Update(existing *LoadBalancerHealthCheck, updates interface{}) (*LoadBalancerHealthCheck, error) {
resp := &LoadBalancerHealthCheck{}
err := c.rancherClient.doUpdate(LOAD_BALANCER_HEALTH_CHECK_TYPE, &existing.Resource, updates, resp)
return resp, err
}
func (c *LoadBalancerHealthCheckClient) List(opts *ListOpts) (*LoadBalancerHealthCheckCollection, error) {
resp := &LoadBalancerHealthCheckCollection{}
err := c.rancherClient.doList(LOAD_BALANCER_HEALTH_CHECK_TYPE, opts, resp)
return resp, err
}
func (c *LoadBalancerHealthCheckClient) ById(id string) (*LoadBalancerHealthCheck, error) {
resp := &LoadBalancerHealthCheck{}
err := c.rancherClient.doById(LOAD_BALANCER_HEALTH_CHECK_TYPE, id, resp)
if apiError, ok := err.(*ApiError); ok {
if apiError.StatusCode == 404 {
return nil, nil
}
}
return resp, err
}
func (c *LoadBalancerHealthCheckClient) Delete(container *LoadBalancerHealthCheck) error {
return c.rancherClient.doResourceDelete(LOAD_BALANCER_HEALTH_CHECK_TYPE, &container.Resource)
}

View File

@ -1,89 +0,0 @@
package client
const (
LOAD_BALANCER_HOST_MAP_TYPE = "loadBalancerHostMap"
)
type LoadBalancerHostMap 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"`
HostId string `json:"hostId,omitempty" yaml:"host_id,omitempty"`
Kind string `json:"kind,omitempty" yaml:"kind,omitempty"`
LoadBalancerId string `json:"loadBalancerId,omitempty" yaml:"load_balancer_id,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"`
State string `json:"state,omitempty" yaml:"state,omitempty"`
Uuid string `json:"uuid,omitempty" yaml:"uuid,omitempty"`
}
type LoadBalancerHostMapCollection struct {
Collection
Data []LoadBalancerHostMap `json:"data,omitempty"`
}
type LoadBalancerHostMapClient struct {
rancherClient *RancherClient
}
type LoadBalancerHostMapOperations interface {
List(opts *ListOpts) (*LoadBalancerHostMapCollection, error)
Create(opts *LoadBalancerHostMap) (*LoadBalancerHostMap, error)
Update(existing *LoadBalancerHostMap, updates interface{}) (*LoadBalancerHostMap, error)
ById(id string) (*LoadBalancerHostMap, error)
Delete(container *LoadBalancerHostMap) error
}
func newLoadBalancerHostMapClient(rancherClient *RancherClient) *LoadBalancerHostMapClient {
return &LoadBalancerHostMapClient{
rancherClient: rancherClient,
}
}
func (c *LoadBalancerHostMapClient) Create(container *LoadBalancerHostMap) (*LoadBalancerHostMap, error) {
resp := &LoadBalancerHostMap{}
err := c.rancherClient.doCreate(LOAD_BALANCER_HOST_MAP_TYPE, container, resp)
return resp, err
}
func (c *LoadBalancerHostMapClient) Update(existing *LoadBalancerHostMap, updates interface{}) (*LoadBalancerHostMap, error) {
resp := &LoadBalancerHostMap{}
err := c.rancherClient.doUpdate(LOAD_BALANCER_HOST_MAP_TYPE, &existing.Resource, updates, resp)
return resp, err
}
func (c *LoadBalancerHostMapClient) List(opts *ListOpts) (*LoadBalancerHostMapCollection, error) {
resp := &LoadBalancerHostMapCollection{}
err := c.rancherClient.doList(LOAD_BALANCER_HOST_MAP_TYPE, opts, resp)
return resp, err
}
func (c *LoadBalancerHostMapClient) ById(id string) (*LoadBalancerHostMap, error) {
resp := &LoadBalancerHostMap{}
err := c.rancherClient.doById(LOAD_BALANCER_HOST_MAP_TYPE, id, resp)
if apiError, ok := err.(*ApiError); ok {
if apiError.StatusCode == 404 {
return nil, nil
}
}
return resp, err
}
func (c *LoadBalancerHostMapClient) Delete(container *LoadBalancerHostMap) error {
return c.rancherClient.doResourceDelete(LOAD_BALANCER_HOST_MAP_TYPE, &container.Resource)
}

View File

@ -1,127 +0,0 @@
package client
const (
LOAD_BALANCER_LISTENER_TYPE = "loadBalancerListener"
)
type LoadBalancerListener struct {
Resource
AccountId string `json:"accountId,omitempty" yaml:"account_id,omitempty"`
Algorithm string `json:"algorithm,omitempty" yaml:"algorithm,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"`
Kind string `json:"kind,omitempty" yaml:"kind,omitempty"`
Name string `json:"name,omitempty" yaml:"name,omitempty"`
PrivatePort int64 `json:"privatePort,omitempty" yaml:"private_port,omitempty"`
RemoveTime string `json:"removeTime,omitempty" yaml:"remove_time,omitempty"`
Removed string `json:"removed,omitempty" yaml:"removed,omitempty"`
ServiceId string `json:"serviceId,omitempty" yaml:"service_id,omitempty"`
SourcePort int64 `json:"sourcePort,omitempty" yaml:"source_port,omitempty"`
SourceProtocol string `json:"sourceProtocol,omitempty" yaml:"source_protocol,omitempty"`
State string `json:"state,omitempty" yaml:"state,omitempty"`
TargetPort int64 `json:"targetPort,omitempty" yaml:"target_port,omitempty"`
TargetProtocol string `json:"targetProtocol,omitempty" yaml:"target_protocol,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 LoadBalancerListenerCollection struct {
Collection
Data []LoadBalancerListener `json:"data,omitempty"`
}
type LoadBalancerListenerClient struct {
rancherClient *RancherClient
}
type LoadBalancerListenerOperations interface {
List(opts *ListOpts) (*LoadBalancerListenerCollection, error)
Create(opts *LoadBalancerListener) (*LoadBalancerListener, error)
Update(existing *LoadBalancerListener, updates interface{}) (*LoadBalancerListener, error)
ById(id string) (*LoadBalancerListener, error)
Delete(container *LoadBalancerListener) error
ActionCreate(*LoadBalancerListener) (*LoadBalancerListener, error)
ActionRemove(*LoadBalancerListener) (*LoadBalancerListener, error)
}
func newLoadBalancerListenerClient(rancherClient *RancherClient) *LoadBalancerListenerClient {
return &LoadBalancerListenerClient{
rancherClient: rancherClient,
}
}
func (c *LoadBalancerListenerClient) Create(container *LoadBalancerListener) (*LoadBalancerListener, error) {
resp := &LoadBalancerListener{}
err := c.rancherClient.doCreate(LOAD_BALANCER_LISTENER_TYPE, container, resp)
return resp, err
}
func (c *LoadBalancerListenerClient) Update(existing *LoadBalancerListener, updates interface{}) (*LoadBalancerListener, error) {
resp := &LoadBalancerListener{}
err := c.rancherClient.doUpdate(LOAD_BALANCER_LISTENER_TYPE, &existing.Resource, updates, resp)
return resp, err
}
func (c *LoadBalancerListenerClient) List(opts *ListOpts) (*LoadBalancerListenerCollection, error) {
resp := &LoadBalancerListenerCollection{}
err := c.rancherClient.doList(LOAD_BALANCER_LISTENER_TYPE, opts, resp)
return resp, err
}
func (c *LoadBalancerListenerClient) ById(id string) (*LoadBalancerListener, error) {
resp := &LoadBalancerListener{}
err := c.rancherClient.doById(LOAD_BALANCER_LISTENER_TYPE, id, resp)
if apiError, ok := err.(*ApiError); ok {
if apiError.StatusCode == 404 {
return nil, nil
}
}
return resp, err
}
func (c *LoadBalancerListenerClient) Delete(container *LoadBalancerListener) error {
return c.rancherClient.doResourceDelete(LOAD_BALANCER_LISTENER_TYPE, &container.Resource)
}
func (c *LoadBalancerListenerClient) ActionCreate(resource *LoadBalancerListener) (*LoadBalancerListener, error) {
resp := &LoadBalancerListener{}
err := c.rancherClient.doAction(LOAD_BALANCER_LISTENER_TYPE, "create", &resource.Resource, nil, resp)
return resp, err
}
func (c *LoadBalancerListenerClient) ActionRemove(resource *LoadBalancerListener) (*LoadBalancerListener, error) {
resp := &LoadBalancerListener{}
err := c.rancherClient.doAction(LOAD_BALANCER_LISTENER_TYPE, "remove", &resource.Resource, nil, resp)
return resp, err
}

View File

@ -1,71 +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"`
}
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)
return resp, err
}
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,132 +0,0 @@
package client
const (
LOAD_BALANCER_TARGET_TYPE = "loadBalancerTarget"
)
type LoadBalancerTarget 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"`
InstanceId string `json:"instanceId,omitempty" yaml:"instance_id,omitempty"`
IpAddress string `json:"ipAddress,omitempty" yaml:"ip_address,omitempty"`
Kind string `json:"kind,omitempty" yaml:"kind,omitempty"`
LoadBalancerId string `json:"loadBalancerId,omitempty" yaml:"load_balancer_id,omitempty"`
Name string `json:"name,omitempty" yaml:"name,omitempty"`
Ports []string `json:"ports,omitempty" yaml:"ports,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"`
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 LoadBalancerTargetCollection struct {
Collection
Data []LoadBalancerTarget `json:"data,omitempty"`
}
type LoadBalancerTargetClient struct {
rancherClient *RancherClient
}
type LoadBalancerTargetOperations interface {
List(opts *ListOpts) (*LoadBalancerTargetCollection, error)
Create(opts *LoadBalancerTarget) (*LoadBalancerTarget, error)
Update(existing *LoadBalancerTarget, updates interface{}) (*LoadBalancerTarget, error)
ById(id string) (*LoadBalancerTarget, error)
Delete(container *LoadBalancerTarget) error
ActionCreate(*LoadBalancerTarget) (*LoadBalancerTarget, error)
ActionRemove(*LoadBalancerTarget) (*LoadBalancerTarget, error)
ActionUpdate(*LoadBalancerTarget) (*LoadBalancerTarget, error)
}
func newLoadBalancerTargetClient(rancherClient *RancherClient) *LoadBalancerTargetClient {
return &LoadBalancerTargetClient{
rancherClient: rancherClient,
}
}
func (c *LoadBalancerTargetClient) Create(container *LoadBalancerTarget) (*LoadBalancerTarget, error) {
resp := &LoadBalancerTarget{}
err := c.rancherClient.doCreate(LOAD_BALANCER_TARGET_TYPE, container, resp)
return resp, err
}
func (c *LoadBalancerTargetClient) Update(existing *LoadBalancerTarget, updates interface{}) (*LoadBalancerTarget, error) {
resp := &LoadBalancerTarget{}
err := c.rancherClient.doUpdate(LOAD_BALANCER_TARGET_TYPE, &existing.Resource, updates, resp)
return resp, err
}
func (c *LoadBalancerTargetClient) List(opts *ListOpts) (*LoadBalancerTargetCollection, error) {
resp := &LoadBalancerTargetCollection{}
err := c.rancherClient.doList(LOAD_BALANCER_TARGET_TYPE, opts, resp)
return resp, err
}
func (c *LoadBalancerTargetClient) ById(id string) (*LoadBalancerTarget, error) {
resp := &LoadBalancerTarget{}
err := c.rancherClient.doById(LOAD_BALANCER_TARGET_TYPE, id, resp)
if apiError, ok := err.(*ApiError); ok {
if apiError.StatusCode == 404 {
return nil, nil
}
}
return resp, err
}
func (c *LoadBalancerTargetClient) Delete(container *LoadBalancerTarget) error {
return c.rancherClient.doResourceDelete(LOAD_BALANCER_TARGET_TYPE, &container.Resource)
}
func (c *LoadBalancerTargetClient) ActionCreate(resource *LoadBalancerTarget) (*LoadBalancerTarget, error) {
resp := &LoadBalancerTarget{}
err := c.rancherClient.doAction(LOAD_BALANCER_TARGET_TYPE, "create", &resource.Resource, nil, resp)
return resp, err
}
func (c *LoadBalancerTargetClient) ActionRemove(resource *LoadBalancerTarget) (*LoadBalancerTarget, error) {
resp := &LoadBalancerTarget{}
err := c.rancherClient.doAction(LOAD_BALANCER_TARGET_TYPE, "remove", &resource.Resource, nil, resp)
return resp, err
}
func (c *LoadBalancerTargetClient) ActionUpdate(resource *LoadBalancerTarget) (*LoadBalancerTarget, error) {
resp := &LoadBalancerTarget{}
err := c.rancherClient.doAction(LOAD_BALANCER_TARGET_TYPE, "update", &resource.Resource, nil, resp)
return resp, err
}

View File

@ -1,67 +0,0 @@
package client
const (
MACHINE_DRIVER_ERROR_INPUT_TYPE = "machineDriverErrorInput"
)
type MachineDriverErrorInput struct {
Resource
ErrorMessage string `json:"errorMessage,omitempty" yaml:"error_message,omitempty"`
}
type MachineDriverErrorInputCollection struct {
Collection
Data []MachineDriverErrorInput `json:"data,omitempty"`
}
type MachineDriverErrorInputClient struct {
rancherClient *RancherClient
}
type MachineDriverErrorInputOperations interface {
List(opts *ListOpts) (*MachineDriverErrorInputCollection, error)
Create(opts *MachineDriverErrorInput) (*MachineDriverErrorInput, error)
Update(existing *MachineDriverErrorInput, updates interface{}) (*MachineDriverErrorInput, error)
ById(id string) (*MachineDriverErrorInput, error)
Delete(container *MachineDriverErrorInput) error
}
func newMachineDriverErrorInputClient(rancherClient *RancherClient) *MachineDriverErrorInputClient {
return &MachineDriverErrorInputClient{
rancherClient: rancherClient,
}
}
func (c *MachineDriverErrorInputClient) Create(container *MachineDriverErrorInput) (*MachineDriverErrorInput, error) {
resp := &MachineDriverErrorInput{}
err := c.rancherClient.doCreate(MACHINE_DRIVER_ERROR_INPUT_TYPE, container, resp)
return resp, err
}
func (c *MachineDriverErrorInputClient) Update(existing *MachineDriverErrorInput, updates interface{}) (*MachineDriverErrorInput, error) {
resp := &MachineDriverErrorInput{}
err := c.rancherClient.doUpdate(MACHINE_DRIVER_ERROR_INPUT_TYPE, &existing.Resource, updates, resp)
return resp, err
}
func (c *MachineDriverErrorInputClient) List(opts *ListOpts) (*MachineDriverErrorInputCollection, error) {
resp := &MachineDriverErrorInputCollection{}
err := c.rancherClient.doList(MACHINE_DRIVER_ERROR_INPUT_TYPE, opts, resp)
return resp, err
}
func (c *MachineDriverErrorInputClient) ById(id string) (*MachineDriverErrorInput, error) {
resp := &MachineDriverErrorInput{}
err := c.rancherClient.doById(MACHINE_DRIVER_ERROR_INPUT_TYPE, id, resp)
if apiError, ok := err.(*ApiError); ok {
if apiError.StatusCode == 404 {
return nil, nil
}
}
return resp, err
}
func (c *MachineDriverErrorInputClient) Delete(container *MachineDriverErrorInput) error {
return c.rancherClient.doResourceDelete(MACHINE_DRIVER_ERROR_INPUT_TYPE, &container.Resource)
}

View File

@ -1,71 +0,0 @@
package client
const (
MACHINE_DRIVER_UPDATE_INPUT_TYPE = "machineDriverUpdateInput"
)
type MachineDriverUpdateInput struct {
Resource
Md5checksum string `json:"md5checksum,omitempty" yaml:"md5checksum,omitempty"`
Name string `json:"name,omitempty" yaml:"name,omitempty"`
Uri string `json:"uri,omitempty" yaml:"uri,omitempty"`
}
type MachineDriverUpdateInputCollection struct {
Collection
Data []MachineDriverUpdateInput `json:"data,omitempty"`
}
type MachineDriverUpdateInputClient struct {
rancherClient *RancherClient
}
type MachineDriverUpdateInputOperations interface {
List(opts *ListOpts) (*MachineDriverUpdateInputCollection, error)
Create(opts *MachineDriverUpdateInput) (*MachineDriverUpdateInput, error)
Update(existing *MachineDriverUpdateInput, updates interface{}) (*MachineDriverUpdateInput, error)
ById(id string) (*MachineDriverUpdateInput, error)
Delete(container *MachineDriverUpdateInput) error
}
func newMachineDriverUpdateInputClient(rancherClient *RancherClient) *MachineDriverUpdateInputClient {
return &MachineDriverUpdateInputClient{
rancherClient: rancherClient,
}
}
func (c *MachineDriverUpdateInputClient) Create(container *MachineDriverUpdateInput) (*MachineDriverUpdateInput, error) {
resp := &MachineDriverUpdateInput{}
err := c.rancherClient.doCreate(MACHINE_DRIVER_UPDATE_INPUT_TYPE, container, resp)
return resp, err
}
func (c *MachineDriverUpdateInputClient) Update(existing *MachineDriverUpdateInput, updates interface{}) (*MachineDriverUpdateInput, error) {
resp := &MachineDriverUpdateInput{}
err := c.rancherClient.doUpdate(MACHINE_DRIVER_UPDATE_INPUT_TYPE, &existing.Resource, updates, resp)
return resp, err
}
func (c *MachineDriverUpdateInputClient) List(opts *ListOpts) (*MachineDriverUpdateInputCollection, error) {
resp := &MachineDriverUpdateInputCollection{}
err := c.rancherClient.doList(MACHINE_DRIVER_UPDATE_INPUT_TYPE, opts, resp)
return resp, err
}
func (c *MachineDriverUpdateInputClient) ById(id string) (*MachineDriverUpdateInput, error) {
resp := &MachineDriverUpdateInput{}
err := c.rancherClient.doById(MACHINE_DRIVER_UPDATE_INPUT_TYPE, id, resp)
if apiError, ok := err.(*ApiError); ok {
if apiError.StatusCode == 404 {
return nil, nil
}
}
return resp, err
}
func (c *MachineDriverUpdateInputClient) Delete(container *MachineDriverUpdateInput) error {
return c.rancherClient.doResourceDelete(MACHINE_DRIVER_UPDATE_INPUT_TYPE, &container.Resource)
}

View File

@ -1,107 +0,0 @@
package client
const (
OPENSTACK_CONFIG_TYPE = "openstackConfig"
)
type OpenstackConfig struct {
Resource
AuthUrl string `json:"authUrl,omitempty" yaml:"auth_url,omitempty"`
AvailabilityZone string `json:"availabilityZone,omitempty" yaml:"availability_zone,omitempty"`
DomainId string `json:"domainId,omitempty" yaml:"domain_id,omitempty"`
DomainName string `json:"domainName,omitempty" yaml:"domain_name,omitempty"`
EndpointType string `json:"endpointType,omitempty" yaml:"endpoint_type,omitempty"`
FlavorId string `json:"flavorId,omitempty" yaml:"flavor_id,omitempty"`
FlavorName string `json:"flavorName,omitempty" yaml:"flavor_name,omitempty"`
FloatingipPool string `json:"floatingipPool,omitempty" yaml:"floatingip_pool,omitempty"`
ImageId string `json:"imageId,omitempty" yaml:"image_id,omitempty"`
ImageName string `json:"imageName,omitempty" yaml:"image_name,omitempty"`
Insecure bool `json:"insecure,omitempty" yaml:"insecure,omitempty"`
NetId string `json:"netId,omitempty" yaml:"net_id,omitempty"`
NetName string `json:"netName,omitempty" yaml:"net_name,omitempty"`
Password string `json:"password,omitempty" yaml:"password,omitempty"`
Region string `json:"region,omitempty" yaml:"region,omitempty"`
SecGroups string `json:"secGroups,omitempty" yaml:"sec_groups,omitempty"`
SshPort string `json:"sshPort,omitempty" yaml:"ssh_port,omitempty"`
SshUser string `json:"sshUser,omitempty" yaml:"ssh_user,omitempty"`
TenantId string `json:"tenantId,omitempty" yaml:"tenant_id,omitempty"`
TenantName string `json:"tenantName,omitempty" yaml:"tenant_name,omitempty"`
Username string `json:"username,omitempty" yaml:"username,omitempty"`
}
type OpenstackConfigCollection struct {
Collection
Data []OpenstackConfig `json:"data,omitempty"`
}
type OpenstackConfigClient struct {
rancherClient *RancherClient
}
type OpenstackConfigOperations interface {
List(opts *ListOpts) (*OpenstackConfigCollection, error)
Create(opts *OpenstackConfig) (*OpenstackConfig, error)
Update(existing *OpenstackConfig, updates interface{}) (*OpenstackConfig, error)
ById(id string) (*OpenstackConfig, error)
Delete(container *OpenstackConfig) error
}
func newOpenstackConfigClient(rancherClient *RancherClient) *OpenstackConfigClient {
return &OpenstackConfigClient{
rancherClient: rancherClient,
}
}
func (c *OpenstackConfigClient) Create(container *OpenstackConfig) (*OpenstackConfig, error) {
resp := &OpenstackConfig{}
err := c.rancherClient.doCreate(OPENSTACK_CONFIG_TYPE, container, resp)
return resp, err
}
func (c *OpenstackConfigClient) Update(existing *OpenstackConfig, updates interface{}) (*OpenstackConfig, error) {
resp := &OpenstackConfig{}
err := c.rancherClient.doUpdate(OPENSTACK_CONFIG_TYPE, &existing.Resource, updates, resp)
return resp, err
}
func (c *OpenstackConfigClient) List(opts *ListOpts) (*OpenstackConfigCollection, error) {
resp := &OpenstackConfigCollection{}
err := c.rancherClient.doList(OPENSTACK_CONFIG_TYPE, opts, resp)
return resp, err
}
func (c *OpenstackConfigClient) ById(id string) (*OpenstackConfig, error) {
resp := &OpenstackConfig{}
err := c.rancherClient.doById(OPENSTACK_CONFIG_TYPE, id, resp)
if apiError, ok := err.(*ApiError); ok {
if apiError.StatusCode == 404 {
return nil, nil
}
}
return resp, err
}
func (c *OpenstackConfigClient) Delete(container *OpenstackConfig) error {
return c.rancherClient.doResourceDelete(OPENSTACK_CONFIG_TYPE, &container.Resource)
}

View File

@ -1,83 +0,0 @@
package client
const (
RACKSPACE_CONFIG_TYPE = "rackspaceConfig"
)
type RackspaceConfig struct {
Resource
ApiKey string `json:"apiKey,omitempty" yaml:"api_key,omitempty"`
DockerInstall string `json:"dockerInstall,omitempty" yaml:"docker_install,omitempty"`
EndpointType string `json:"endpointType,omitempty" yaml:"endpoint_type,omitempty"`
FlavorId string `json:"flavorId,omitempty" yaml:"flavor_id,omitempty"`
ImageId string `json:"imageId,omitempty" yaml:"image_id,omitempty"`
Region string `json:"region,omitempty" yaml:"region,omitempty"`
SshPort string `json:"sshPort,omitempty" yaml:"ssh_port,omitempty"`
SshUser string `json:"sshUser,omitempty" yaml:"ssh_user,omitempty"`
Username string `json:"username,omitempty" yaml:"username,omitempty"`
}
type RackspaceConfigCollection struct {
Collection
Data []RackspaceConfig `json:"data,omitempty"`
}
type RackspaceConfigClient struct {
rancherClient *RancherClient
}
type RackspaceConfigOperations interface {
List(opts *ListOpts) (*RackspaceConfigCollection, error)
Create(opts *RackspaceConfig) (*RackspaceConfig, error)
Update(existing *RackspaceConfig, updates interface{}) (*RackspaceConfig, error)
ById(id string) (*RackspaceConfig, error)
Delete(container *RackspaceConfig) error
}
func newRackspaceConfigClient(rancherClient *RancherClient) *RackspaceConfigClient {
return &RackspaceConfigClient{
rancherClient: rancherClient,
}
}
func (c *RackspaceConfigClient) Create(container *RackspaceConfig) (*RackspaceConfig, error) {
resp := &RackspaceConfig{}
err := c.rancherClient.doCreate(RACKSPACE_CONFIG_TYPE, container, resp)
return resp, err
}
func (c *RackspaceConfigClient) Update(existing *RackspaceConfig, updates interface{}) (*RackspaceConfig, error) {
resp := &RackspaceConfig{}
err := c.rancherClient.doUpdate(RACKSPACE_CONFIG_TYPE, &existing.Resource, updates, resp)
return resp, err
}
func (c *RackspaceConfigClient) List(opts *ListOpts) (*RackspaceConfigCollection, error) {
resp := &RackspaceConfigCollection{}
err := c.rancherClient.doList(RACKSPACE_CONFIG_TYPE, opts, resp)
return resp, err
}
func (c *RackspaceConfigClient) ById(id string) (*RackspaceConfig, error) {
resp := &RackspaceConfig{}
err := c.rancherClient.doById(RACKSPACE_CONFIG_TYPE, id, resp)
if apiError, ok := err.(*ApiError); ok {
if apiError.StatusCode == 404 {
return nil, nil
}
}
return resp, err
}
func (c *RackspaceConfigClient) Delete(container *RackspaceConfig) error {
return c.rancherClient.doResourceDelete(RACKSPACE_CONFIG_TYPE, &container.Resource)
}

View File

@ -1,62 +0,0 @@
package client
const (
REMOVE_LABEL_INPUT_TYPE = "removeLabelInput"
)
type RemoveLabelInput struct {
Resource
Label string `json:"label,omitempty"`
}
type RemoveLabelInputCollection struct {
Collection
Data []RemoveLabelInput `json:"data,omitempty"`
}
type RemoveLabelInputClient struct {
rancherClient *RancherClient
}
type RemoveLabelInputOperations interface {
List(opts *ListOpts) (*RemoveLabelInputCollection, error)
Create(opts *RemoveLabelInput) (*RemoveLabelInput, error)
Update(existing *RemoveLabelInput, updates interface{}) (*RemoveLabelInput, error)
ById(id string) (*RemoveLabelInput, error)
Delete(container *RemoveLabelInput) error
}
func newRemoveLabelInputClient(rancherClient *RancherClient) *RemoveLabelInputClient {
return &RemoveLabelInputClient{
rancherClient: rancherClient,
}
}
func (c *RemoveLabelInputClient) Create(container *RemoveLabelInput) (*RemoveLabelInput, error) {
resp := &RemoveLabelInput{}
err := c.rancherClient.doCreate(REMOVE_LABEL_INPUT_TYPE, container, resp)
return resp, err
}
func (c *RemoveLabelInputClient) Update(existing *RemoveLabelInput, updates interface{}) (*RemoveLabelInput, error) {
resp := &RemoveLabelInput{}
err := c.rancherClient.doUpdate(REMOVE_LABEL_INPUT_TYPE, &existing.Resource, updates, resp)
return resp, err
}
func (c *RemoveLabelInputClient) List(opts *ListOpts) (*RemoveLabelInputCollection, error) {
resp := &RemoveLabelInputCollection{}
err := c.rancherClient.doList(REMOVE_LABEL_INPUT_TYPE, opts, resp)
return resp, err
}
func (c *RemoveLabelInputClient) ById(id string) (*RemoveLabelInput, error) {
resp := &RemoveLabelInput{}
err := c.rancherClient.doById(REMOVE_LABEL_INPUT_TYPE, id, resp)
return resp, err
}
func (c *RemoveLabelInputClient) Delete(container *RemoveLabelInput) error {
return c.rancherClient.doResourceDelete(REMOVE_LABEL_INPUT_TYPE, &container.Resource)
}

View File

@ -1,67 +0,0 @@
package client
const (
REMOVE_LOAD_BALANCER_INPUT_TYPE = "removeLoadBalancerInput"
)
type RemoveLoadBalancerInput struct {
Resource
LoadBalancerId string `json:"loadBalancerId,omitempty" yaml:"load_balancer_id,omitempty"`
}
type RemoveLoadBalancerInputCollection struct {
Collection
Data []RemoveLoadBalancerInput `json:"data,omitempty"`
}
type RemoveLoadBalancerInputClient struct {
rancherClient *RancherClient
}
type RemoveLoadBalancerInputOperations interface {
List(opts *ListOpts) (*RemoveLoadBalancerInputCollection, error)
Create(opts *RemoveLoadBalancerInput) (*RemoveLoadBalancerInput, error)
Update(existing *RemoveLoadBalancerInput, updates interface{}) (*RemoveLoadBalancerInput, error)
ById(id string) (*RemoveLoadBalancerInput, error)
Delete(container *RemoveLoadBalancerInput) error
}
func newRemoveLoadBalancerInputClient(rancherClient *RancherClient) *RemoveLoadBalancerInputClient {
return &RemoveLoadBalancerInputClient{
rancherClient: rancherClient,
}
}
func (c *RemoveLoadBalancerInputClient) Create(container *RemoveLoadBalancerInput) (*RemoveLoadBalancerInput, error) {
resp := &RemoveLoadBalancerInput{}
err := c.rancherClient.doCreate(REMOVE_LOAD_BALANCER_INPUT_TYPE, container, resp)
return resp, err
}
func (c *RemoveLoadBalancerInputClient) Update(existing *RemoveLoadBalancerInput, updates interface{}) (*RemoveLoadBalancerInput, error) {
resp := &RemoveLoadBalancerInput{}
err := c.rancherClient.doUpdate(REMOVE_LOAD_BALANCER_INPUT_TYPE, &existing.Resource, updates, resp)
return resp, err
}
func (c *RemoveLoadBalancerInputClient) List(opts *ListOpts) (*RemoveLoadBalancerInputCollection, error) {
resp := &RemoveLoadBalancerInputCollection{}
err := c.rancherClient.doList(REMOVE_LOAD_BALANCER_INPUT_TYPE, opts, resp)
return resp, err
}
func (c *RemoveLoadBalancerInputClient) ById(id string) (*RemoveLoadBalancerInput, error) {
resp := &RemoveLoadBalancerInput{}
err := c.rancherClient.doById(REMOVE_LOAD_BALANCER_INPUT_TYPE, id, resp)
if apiError, ok := err.(*ApiError); ok {
if apiError.StatusCode == 404 {
return nil, nil
}
}
return resp, err
}
func (c *RemoveLoadBalancerInputClient) Delete(container *RemoveLoadBalancerInput) error {
return c.rancherClient.doResourceDelete(REMOVE_LOAD_BALANCER_INPUT_TYPE, &container.Resource)
}

View File

@ -1,67 +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"`
}
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)
return resp, err
}
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,67 +0,0 @@
package client
const (
SET_LOAD_BALANCER_HOSTS_INPUT_TYPE = "setLoadBalancerHostsInput"
)
type SetLoadBalancerHostsInput struct {
Resource
HostIds []string `json:"hostIds,omitempty" yaml:"host_ids,omitempty"`
}
type SetLoadBalancerHostsInputCollection struct {
Collection
Data []SetLoadBalancerHostsInput `json:"data,omitempty"`
}
type SetLoadBalancerHostsInputClient struct {
rancherClient *RancherClient
}
type SetLoadBalancerHostsInputOperations interface {
List(opts *ListOpts) (*SetLoadBalancerHostsInputCollection, error)
Create(opts *SetLoadBalancerHostsInput) (*SetLoadBalancerHostsInput, error)
Update(existing *SetLoadBalancerHostsInput, updates interface{}) (*SetLoadBalancerHostsInput, error)
ById(id string) (*SetLoadBalancerHostsInput, error)
Delete(container *SetLoadBalancerHostsInput) error
}
func newSetLoadBalancerHostsInputClient(rancherClient *RancherClient) *SetLoadBalancerHostsInputClient {
return &SetLoadBalancerHostsInputClient{
rancherClient: rancherClient,
}
}
func (c *SetLoadBalancerHostsInputClient) Create(container *SetLoadBalancerHostsInput) (*SetLoadBalancerHostsInput, error) {
resp := &SetLoadBalancerHostsInput{}
err := c.rancherClient.doCreate(SET_LOAD_BALANCER_HOSTS_INPUT_TYPE, container, resp)
return resp, err
}
func (c *SetLoadBalancerHostsInputClient) Update(existing *SetLoadBalancerHostsInput, updates interface{}) (*SetLoadBalancerHostsInput, error) {
resp := &SetLoadBalancerHostsInput{}
err := c.rancherClient.doUpdate(SET_LOAD_BALANCER_HOSTS_INPUT_TYPE, &existing.Resource, updates, resp)
return resp, err
}
func (c *SetLoadBalancerHostsInputClient) List(opts *ListOpts) (*SetLoadBalancerHostsInputCollection, error) {
resp := &SetLoadBalancerHostsInputCollection{}
err := c.rancherClient.doList(SET_LOAD_BALANCER_HOSTS_INPUT_TYPE, opts, resp)
return resp, err
}
func (c *SetLoadBalancerHostsInputClient) ById(id string) (*SetLoadBalancerHostsInput, error) {
resp := &SetLoadBalancerHostsInput{}
err := c.rancherClient.doById(SET_LOAD_BALANCER_HOSTS_INPUT_TYPE, id, resp)
if apiError, ok := err.(*ApiError); ok {
if apiError.StatusCode == 404 {
return nil, nil
}
}
return resp, err
}
func (c *SetLoadBalancerHostsInputClient) Delete(container *SetLoadBalancerHostsInput) error {
return c.rancherClient.doResourceDelete(SET_LOAD_BALANCER_HOSTS_INPUT_TYPE, &container.Resource)
}

View File

@ -1,67 +0,0 @@
package client
const (
SET_LOAD_BALANCER_LISTENERS_INPUT_TYPE = "setLoadBalancerListenersInput"
)
type SetLoadBalancerListenersInput struct {
Resource
LoadBalancerListenerIds []string `json:"loadBalancerListenerIds,omitempty" yaml:"load_balancer_listener_ids,omitempty"`
}
type SetLoadBalancerListenersInputCollection struct {
Collection
Data []SetLoadBalancerListenersInput `json:"data,omitempty"`
}
type SetLoadBalancerListenersInputClient struct {
rancherClient *RancherClient
}
type SetLoadBalancerListenersInputOperations interface {
List(opts *ListOpts) (*SetLoadBalancerListenersInputCollection, error)
Create(opts *SetLoadBalancerListenersInput) (*SetLoadBalancerListenersInput, error)
Update(existing *SetLoadBalancerListenersInput, updates interface{}) (*SetLoadBalancerListenersInput, error)
ById(id string) (*SetLoadBalancerListenersInput, error)
Delete(container *SetLoadBalancerListenersInput) error
}
func newSetLoadBalancerListenersInputClient(rancherClient *RancherClient) *SetLoadBalancerListenersInputClient {
return &SetLoadBalancerListenersInputClient{
rancherClient: rancherClient,
}
}
func (c *SetLoadBalancerListenersInputClient) Create(container *SetLoadBalancerListenersInput) (*SetLoadBalancerListenersInput, error) {
resp := &SetLoadBalancerListenersInput{}
err := c.rancherClient.doCreate(SET_LOAD_BALANCER_LISTENERS_INPUT_TYPE, container, resp)
return resp, err
}
func (c *SetLoadBalancerListenersInputClient) Update(existing *SetLoadBalancerListenersInput, updates interface{}) (*SetLoadBalancerListenersInput, error) {
resp := &SetLoadBalancerListenersInput{}
err := c.rancherClient.doUpdate(SET_LOAD_BALANCER_LISTENERS_INPUT_TYPE, &existing.Resource, updates, resp)
return resp, err
}
func (c *SetLoadBalancerListenersInputClient) List(opts *ListOpts) (*SetLoadBalancerListenersInputCollection, error) {
resp := &SetLoadBalancerListenersInputCollection{}
err := c.rancherClient.doList(SET_LOAD_BALANCER_LISTENERS_INPUT_TYPE, opts, resp)
return resp, err
}
func (c *SetLoadBalancerListenersInputClient) ById(id string) (*SetLoadBalancerListenersInput, error) {
resp := &SetLoadBalancerListenersInput{}
err := c.rancherClient.doById(SET_LOAD_BALANCER_LISTENERS_INPUT_TYPE, id, resp)
if apiError, ok := err.(*ApiError); ok {
if apiError.StatusCode == 404 {
return nil, nil
}
}
return resp, err
}
func (c *SetLoadBalancerListenersInputClient) Delete(container *SetLoadBalancerListenersInput) error {
return c.rancherClient.doResourceDelete(SET_LOAD_BALANCER_LISTENERS_INPUT_TYPE, &container.Resource)
}

View File

@ -1,67 +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"`
}
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)
return resp, err
}
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,67 +0,0 @@
package client
const (
SET_LOAD_BALANCER_TARGETS_INPUT_TYPE = "setLoadBalancerTargetsInput"
)
type SetLoadBalancerTargetsInput struct {
Resource
LoadBalancerTargets []interface{} `json:"loadBalancerTargets,omitempty" yaml:"load_balancer_targets,omitempty"`
}
type SetLoadBalancerTargetsInputCollection struct {
Collection
Data []SetLoadBalancerTargetsInput `json:"data,omitempty"`
}
type SetLoadBalancerTargetsInputClient struct {
rancherClient *RancherClient
}
type SetLoadBalancerTargetsInputOperations interface {
List(opts *ListOpts) (*SetLoadBalancerTargetsInputCollection, error)
Create(opts *SetLoadBalancerTargetsInput) (*SetLoadBalancerTargetsInput, error)
Update(existing *SetLoadBalancerTargetsInput, updates interface{}) (*SetLoadBalancerTargetsInput, error)
ById(id string) (*SetLoadBalancerTargetsInput, error)
Delete(container *SetLoadBalancerTargetsInput) error
}
func newSetLoadBalancerTargetsInputClient(rancherClient *RancherClient) *SetLoadBalancerTargetsInputClient {
return &SetLoadBalancerTargetsInputClient{
rancherClient: rancherClient,
}
}
func (c *SetLoadBalancerTargetsInputClient) Create(container *SetLoadBalancerTargetsInput) (*SetLoadBalancerTargetsInput, error) {
resp := &SetLoadBalancerTargetsInput{}
err := c.rancherClient.doCreate(SET_LOAD_BALANCER_TARGETS_INPUT_TYPE, container, resp)
return resp, err
}
func (c *SetLoadBalancerTargetsInputClient) Update(existing *SetLoadBalancerTargetsInput, updates interface{}) (*SetLoadBalancerTargetsInput, error) {
resp := &SetLoadBalancerTargetsInput{}
err := c.rancherClient.doUpdate(SET_LOAD_BALANCER_TARGETS_INPUT_TYPE, &existing.Resource, updates, resp)
return resp, err
}
func (c *SetLoadBalancerTargetsInputClient) List(opts *ListOpts) (*SetLoadBalancerTargetsInputCollection, error) {
resp := &SetLoadBalancerTargetsInputCollection{}
err := c.rancherClient.doList(SET_LOAD_BALANCER_TARGETS_INPUT_TYPE, opts, resp)
return resp, err
}
func (c *SetLoadBalancerTargetsInputClient) ById(id string) (*SetLoadBalancerTargetsInput, error) {
resp := &SetLoadBalancerTargetsInput{}
err := c.rancherClient.doById(SET_LOAD_BALANCER_TARGETS_INPUT_TYPE, id, resp)
if apiError, ok := err.(*ApiError); ok {
if apiError.StatusCode == 404 {
return nil, nil
}
}
return resp, err
}
func (c *SetLoadBalancerTargetsInputClient) Delete(container *SetLoadBalancerTargetsInput) error {
return c.rancherClient.doResourceDelete(SET_LOAD_BALANCER_TARGETS_INPUT_TYPE, &container.Resource)
}

View File

@ -1,95 +0,0 @@
package client
const (
SOFTLAYER_CONFIG_TYPE = "softlayerConfig"
)
type SoftlayerConfig struct {
Resource
ApiEndpoint string `json:"apiEndpoint,omitempty" yaml:"api_endpoint,omitempty"`
ApiKey string `json:"apiKey,omitempty" yaml:"api_key,omitempty"`
Cpu string `json:"cpu,omitempty" yaml:"cpu,omitempty"`
DiskSize string `json:"diskSize,omitempty" yaml:"disk_size,omitempty"`
Domain string `json:"domain,omitempty" yaml:"domain,omitempty"`
Hostname string `json:"hostname,omitempty" yaml:"hostname,omitempty"`
HourlyBilling bool `json:"hourlyBilling,omitempty" yaml:"hourly_billing,omitempty"`
Image string `json:"image,omitempty" yaml:"image,omitempty"`
LocalDisk bool `json:"localDisk,omitempty" yaml:"local_disk,omitempty"`
Memory string `json:"memory,omitempty" yaml:"memory,omitempty"`
PrivateNetOnly bool `json:"privateNetOnly,omitempty" yaml:"private_net_only,omitempty"`
PrivateVlanId string `json:"privateVlanId,omitempty" yaml:"private_vlan_id,omitempty"`
PublicVlanId string `json:"publicVlanId,omitempty" yaml:"public_vlan_id,omitempty"`
Region string `json:"region,omitempty" yaml:"region,omitempty"`
User string `json:"user,omitempty" yaml:"user,omitempty"`
}
type SoftlayerConfigCollection struct {
Collection
Data []SoftlayerConfig `json:"data,omitempty"`
}
type SoftlayerConfigClient struct {
rancherClient *RancherClient
}
type SoftlayerConfigOperations interface {
List(opts *ListOpts) (*SoftlayerConfigCollection, error)
Create(opts *SoftlayerConfig) (*SoftlayerConfig, error)
Update(existing *SoftlayerConfig, updates interface{}) (*SoftlayerConfig, error)
ById(id string) (*SoftlayerConfig, error)
Delete(container *SoftlayerConfig) error
}
func newSoftlayerConfigClient(rancherClient *RancherClient) *SoftlayerConfigClient {
return &SoftlayerConfigClient{
rancherClient: rancherClient,
}
}
func (c *SoftlayerConfigClient) Create(container *SoftlayerConfig) (*SoftlayerConfig, error) {
resp := &SoftlayerConfig{}
err := c.rancherClient.doCreate(SOFTLAYER_CONFIG_TYPE, container, resp)
return resp, err
}
func (c *SoftlayerConfigClient) Update(existing *SoftlayerConfig, updates interface{}) (*SoftlayerConfig, error) {
resp := &SoftlayerConfig{}
err := c.rancherClient.doUpdate(SOFTLAYER_CONFIG_TYPE, &existing.Resource, updates, resp)
return resp, err
}
func (c *SoftlayerConfigClient) List(opts *ListOpts) (*SoftlayerConfigCollection, error) {
resp := &SoftlayerConfigCollection{}
err := c.rancherClient.doList(SOFTLAYER_CONFIG_TYPE, opts, resp)
return resp, err
}
func (c *SoftlayerConfigClient) ById(id string) (*SoftlayerConfig, error) {
resp := &SoftlayerConfig{}
err := c.rancherClient.doById(SOFTLAYER_CONFIG_TYPE, id, resp)
if apiError, ok := err.(*ApiError); ok {
if apiError.StatusCode == 404 {
return nil, nil
}
}
return resp, err
}
func (c *SoftlayerConfigClient) Delete(container *SoftlayerConfig) error {
return c.rancherClient.doResourceDelete(SOFTLAYER_CONFIG_TYPE, &container.Resource)
}

View File

@ -1,77 +0,0 @@
package client
const (
UBIQUITY_CONFIG_TYPE = "ubiquityConfig"
)
type UbiquityConfig struct {
Resource
ApiToken string `json:"apiToken,omitempty" yaml:"api_token,omitempty"`
ApiUsername string `json:"apiUsername,omitempty" yaml:"api_username,omitempty"`
ClientId string `json:"clientId,omitempty" yaml:"client_id,omitempty"`
FlavorId string `json:"flavorId,omitempty" yaml:"flavor_id,omitempty"`
ImageId string `json:"imageId,omitempty" yaml:"image_id,omitempty"`
ZoneId string `json:"zoneId,omitempty" yaml:"zone_id,omitempty"`
}
type UbiquityConfigCollection struct {
Collection
Data []UbiquityConfig `json:"data,omitempty"`
}
type UbiquityConfigClient struct {
rancherClient *RancherClient
}
type UbiquityConfigOperations interface {
List(opts *ListOpts) (*UbiquityConfigCollection, error)
Create(opts *UbiquityConfig) (*UbiquityConfig, error)
Update(existing *UbiquityConfig, updates interface{}) (*UbiquityConfig, error)
ById(id string) (*UbiquityConfig, error)
Delete(container *UbiquityConfig) error
}
func newUbiquityConfigClient(rancherClient *RancherClient) *UbiquityConfigClient {
return &UbiquityConfigClient{
rancherClient: rancherClient,
}
}
func (c *UbiquityConfigClient) Create(container *UbiquityConfig) (*UbiquityConfig, error) {
resp := &UbiquityConfig{}
err := c.rancherClient.doCreate(UBIQUITY_CONFIG_TYPE, container, resp)
return resp, err
}
func (c *UbiquityConfigClient) Update(existing *UbiquityConfig, updates interface{}) (*UbiquityConfig, error) {
resp := &UbiquityConfig{}
err := c.rancherClient.doUpdate(UBIQUITY_CONFIG_TYPE, &existing.Resource, updates, resp)
return resp, err
}
func (c *UbiquityConfigClient) List(opts *ListOpts) (*UbiquityConfigCollection, error) {
resp := &UbiquityConfigCollection{}
err := c.rancherClient.doList(UBIQUITY_CONFIG_TYPE, opts, resp)
return resp, err
}
func (c *UbiquityConfigClient) ById(id string) (*UbiquityConfig, error) {
resp := &UbiquityConfig{}
err := c.rancherClient.doById(UBIQUITY_CONFIG_TYPE, id, resp)
if apiError, ok := err.(*ApiError); ok {
if apiError.StatusCode == 404 {
return nil, nil
}
}
return resp, err
}
func (c *UbiquityConfigClient) Delete(container *UbiquityConfig) error {
return c.rancherClient.doResourceDelete(UBIQUITY_CONFIG_TYPE, &container.Resource)
}

View File

@ -1,165 +0,0 @@
package client
const (
USER_PREFERENCE_TYPE = "userPreference"
)
type UserPreference 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"`
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"`
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"`
Value string `json:"value,omitempty" yaml:"value,omitempty"`
}
type UserPreferenceCollection struct {
Collection
Data []UserPreference `json:"data,omitempty"`
}
type UserPreferenceClient struct {
rancherClient *RancherClient
}
type UserPreferenceOperations interface {
List(opts *ListOpts) (*UserPreferenceCollection, error)
Create(opts *UserPreference) (*UserPreference, error)
Update(existing *UserPreference, updates interface{}) (*UserPreference, error)
ById(id string) (*UserPreference, error)
Delete(container *UserPreference) error
ActionActivate(*UserPreference) (*UserPreference, error)
ActionCreate(*UserPreference) (*UserPreference, error)
ActionDeactivate(*UserPreference) (*UserPreference, error)
ActionPurge(*UserPreference) (*UserPreference, error)
ActionRemove(*UserPreference) (*UserPreference, error)
ActionRestore(*UserPreference) (*UserPreference, error)
ActionUpdate(*UserPreference) (*UserPreference, error)
}
func newUserPreferenceClient(rancherClient *RancherClient) *UserPreferenceClient {
return &UserPreferenceClient{
rancherClient: rancherClient,
}
}
func (c *UserPreferenceClient) Create(container *UserPreference) (*UserPreference, error) {
resp := &UserPreference{}
err := c.rancherClient.doCreate(USER_PREFERENCE_TYPE, container, resp)
return resp, err
}
func (c *UserPreferenceClient) Update(existing *UserPreference, updates interface{}) (*UserPreference, error) {
resp := &UserPreference{}
err := c.rancherClient.doUpdate(USER_PREFERENCE_TYPE, &existing.Resource, updates, resp)
return resp, err
}
func (c *UserPreferenceClient) List(opts *ListOpts) (*UserPreferenceCollection, error) {
resp := &UserPreferenceCollection{}
err := c.rancherClient.doList(USER_PREFERENCE_TYPE, opts, resp)
return resp, err
}
func (c *UserPreferenceClient) ById(id string) (*UserPreference, error) {
resp := &UserPreference{}
err := c.rancherClient.doById(USER_PREFERENCE_TYPE, id, resp)
return resp, err
}
func (c *UserPreferenceClient) Delete(container *UserPreference) error {
return c.rancherClient.doResourceDelete(USER_PREFERENCE_TYPE, &container.Resource)
}
func (c *UserPreferenceClient) ActionActivate(resource *UserPreference) (*UserPreference, error) {
resp := &UserPreference{}
err := c.rancherClient.doAction(USER_PREFERENCE_TYPE, "activate", &resource.Resource, nil, resp)
return resp, err
}
func (c *UserPreferenceClient) ActionCreate(resource *UserPreference) (*UserPreference, error) {
resp := &UserPreference{}
err := c.rancherClient.doAction(USER_PREFERENCE_TYPE, "create", &resource.Resource, nil, resp)
return resp, err
}
func (c *UserPreferenceClient) ActionDeactivate(resource *UserPreference) (*UserPreference, error) {
resp := &UserPreference{}
err := c.rancherClient.doAction(USER_PREFERENCE_TYPE, "deactivate", &resource.Resource, nil, resp)
return resp, err
}
func (c *UserPreferenceClient) ActionPurge(resource *UserPreference) (*UserPreference, error) {
resp := &UserPreference{}
err := c.rancherClient.doAction(USER_PREFERENCE_TYPE, "purge", &resource.Resource, nil, resp)
return resp, err
}
func (c *UserPreferenceClient) ActionRemove(resource *UserPreference) (*UserPreference, error) {
resp := &UserPreference{}
err := c.rancherClient.doAction(USER_PREFERENCE_TYPE, "remove", &resource.Resource, nil, resp)
return resp, err
}
func (c *UserPreferenceClient) ActionRestore(resource *UserPreference) (*UserPreference, error) {
resp := &UserPreference{}
err := c.rancherClient.doAction(USER_PREFERENCE_TYPE, "restore", &resource.Resource, nil, resp)
return resp, err
}
func (c *UserPreferenceClient) ActionUpdate(resource *UserPreference) (*UserPreference, error) {
resp := &UserPreference{}
err := c.rancherClient.doAction(USER_PREFERENCE_TYPE, "update", &resource.Resource, nil, resp)
return resp, err
}

View File

@ -1,79 +0,0 @@
package client
const (
VIRTUALBOX_CONFIG_TYPE = "virtualboxConfig"
)
type VirtualboxConfig struct {
Resource
Boot2dockerUrl string `json:"boot2dockerUrl,omitempty" yaml:"boot2docker_url,omitempty"`
CpuCount string `json:"cpuCount,omitempty" yaml:"cpu_count,omitempty"`
DiskSize string `json:"diskSize,omitempty" yaml:"disk_size,omitempty"`
HostonlyCidr string `json:"hostonlyCidr,omitempty" yaml:"hostonly_cidr,omitempty"`
ImportBoot2dockerVm string `json:"importBoot2dockerVm,omitempty" yaml:"import_boot2docker_vm,omitempty"`
Memory string `json:"memory,omitempty" yaml:"memory,omitempty"`
NoShare bool `json:"noShare,omitempty" yaml:"no_share,omitempty"`
}
type VirtualboxConfigCollection struct {
Collection
Data []VirtualboxConfig `json:"data,omitempty"`
}
type VirtualboxConfigClient struct {
rancherClient *RancherClient
}
type VirtualboxConfigOperations interface {
List(opts *ListOpts) (*VirtualboxConfigCollection, error)
Create(opts *VirtualboxConfig) (*VirtualboxConfig, error)
Update(existing *VirtualboxConfig, updates interface{}) (*VirtualboxConfig, error)
ById(id string) (*VirtualboxConfig, error)
Delete(container *VirtualboxConfig) error
}
func newVirtualboxConfigClient(rancherClient *RancherClient) *VirtualboxConfigClient {
return &VirtualboxConfigClient{
rancherClient: rancherClient,
}
}
func (c *VirtualboxConfigClient) Create(container *VirtualboxConfig) (*VirtualboxConfig, error) {
resp := &VirtualboxConfig{}
err := c.rancherClient.doCreate(VIRTUALBOX_CONFIG_TYPE, container, resp)
return resp, err
}
func (c *VirtualboxConfigClient) Update(existing *VirtualboxConfig, updates interface{}) (*VirtualboxConfig, error) {
resp := &VirtualboxConfig{}
err := c.rancherClient.doUpdate(VIRTUALBOX_CONFIG_TYPE, &existing.Resource, updates, resp)
return resp, err
}
func (c *VirtualboxConfigClient) List(opts *ListOpts) (*VirtualboxConfigCollection, error) {
resp := &VirtualboxConfigCollection{}
err := c.rancherClient.doList(VIRTUALBOX_CONFIG_TYPE, opts, resp)
return resp, err
}
func (c *VirtualboxConfigClient) ById(id string) (*VirtualboxConfig, error) {
resp := &VirtualboxConfig{}
err := c.rancherClient.doById(VIRTUALBOX_CONFIG_TYPE, id, resp)
if apiError, ok := err.(*ApiError); ok {
if apiError.StatusCode == 404 {
return nil, nil
}
}
return resp, err
}
func (c *VirtualboxConfigClient) Delete(container *VirtualboxConfig) error {
return c.rancherClient.doResourceDelete(VIRTUALBOX_CONFIG_TYPE, &container.Resource)
}

View File

@ -1,93 +0,0 @@
package client
const (
VMWAREVCLOUDAIR_CONFIG_TYPE = "vmwarevcloudairConfig"
)
type VmwarevcloudairConfig struct {
Resource
Catalog string `json:"catalog,omitempty" yaml:"catalog,omitempty"`
Catalogitem string `json:"catalogitem,omitempty" yaml:"catalogitem,omitempty"`
Computeid string `json:"computeid,omitempty" yaml:"computeid,omitempty"`
CpuCount string `json:"cpuCount,omitempty" yaml:"cpu_count,omitempty"`
DockerPort string `json:"dockerPort,omitempty" yaml:"docker_port,omitempty"`
Edgegateway string `json:"edgegateway,omitempty" yaml:"edgegateway,omitempty"`
MemorySize string `json:"memorySize,omitempty" yaml:"memory_size,omitempty"`
Orgvdcnetwork string `json:"orgvdcnetwork,omitempty" yaml:"orgvdcnetwork,omitempty"`
Password string `json:"password,omitempty" yaml:"password,omitempty"`
Provision bool `json:"provision,omitempty" yaml:"provision,omitempty"`
Publicip string `json:"publicip,omitempty" yaml:"publicip,omitempty"`
SshPort string `json:"sshPort,omitempty" yaml:"ssh_port,omitempty"`
Username string `json:"username,omitempty" yaml:"username,omitempty"`
Vdcid string `json:"vdcid,omitempty" yaml:"vdcid,omitempty"`
}
type VmwarevcloudairConfigCollection struct {
Collection
Data []VmwarevcloudairConfig `json:"data,omitempty"`
}
type VmwarevcloudairConfigClient struct {
rancherClient *RancherClient
}
type VmwarevcloudairConfigOperations interface {
List(opts *ListOpts) (*VmwarevcloudairConfigCollection, error)
Create(opts *VmwarevcloudairConfig) (*VmwarevcloudairConfig, error)
Update(existing *VmwarevcloudairConfig, updates interface{}) (*VmwarevcloudairConfig, error)
ById(id string) (*VmwarevcloudairConfig, error)
Delete(container *VmwarevcloudairConfig) error
}
func newVmwarevcloudairConfigClient(rancherClient *RancherClient) *VmwarevcloudairConfigClient {
return &VmwarevcloudairConfigClient{
rancherClient: rancherClient,
}
}
func (c *VmwarevcloudairConfigClient) Create(container *VmwarevcloudairConfig) (*VmwarevcloudairConfig, error) {
resp := &VmwarevcloudairConfig{}
err := c.rancherClient.doCreate(VMWAREVCLOUDAIR_CONFIG_TYPE, container, resp)
return resp, err
}
func (c *VmwarevcloudairConfigClient) Update(existing *VmwarevcloudairConfig, updates interface{}) (*VmwarevcloudairConfig, error) {
resp := &VmwarevcloudairConfig{}
err := c.rancherClient.doUpdate(VMWAREVCLOUDAIR_CONFIG_TYPE, &existing.Resource, updates, resp)
return resp, err
}
func (c *VmwarevcloudairConfigClient) List(opts *ListOpts) (*VmwarevcloudairConfigCollection, error) {
resp := &VmwarevcloudairConfigCollection{}
err := c.rancherClient.doList(VMWAREVCLOUDAIR_CONFIG_TYPE, opts, resp)
return resp, err
}
func (c *VmwarevcloudairConfigClient) ById(id string) (*VmwarevcloudairConfig, error) {
resp := &VmwarevcloudairConfig{}
err := c.rancherClient.doById(VMWAREVCLOUDAIR_CONFIG_TYPE, id, resp)
if apiError, ok := err.(*ApiError); ok {
if apiError.StatusCode == 404 {
return nil, nil
}
}
return resp, err
}
func (c *VmwarevcloudairConfigClient) Delete(container *VmwarevcloudairConfig) error {
return c.rancherClient.doResourceDelete(VMWAREVCLOUDAIR_CONFIG_TYPE, &container.Resource)
}

View File

@ -1,89 +0,0 @@
package client
const (
VMWAREVSPHERE_CONFIG_TYPE = "vmwarevsphereConfig"
)
type VmwarevsphereConfig struct {
Resource
Boot2dockerUrl string `json:"boot2dockerUrl,omitempty" yaml:"boot2docker_url,omitempty"`
ComputeIp string `json:"computeIp,omitempty" yaml:"compute_ip,omitempty"`
CpuCount string `json:"cpuCount,omitempty" yaml:"cpu_count,omitempty"`
Datacenter string `json:"datacenter,omitempty" yaml:"datacenter,omitempty"`
Datastore string `json:"datastore,omitempty" yaml:"datastore,omitempty"`
DiskSize string `json:"diskSize,omitempty" yaml:"disk_size,omitempty"`
MemorySize string `json:"memorySize,omitempty" yaml:"memory_size,omitempty"`
Network string `json:"network,omitempty" yaml:"network,omitempty"`
Password string `json:"password,omitempty" yaml:"password,omitempty"`
Pool string `json:"pool,omitempty" yaml:"pool,omitempty"`
Username string `json:"username,omitempty" yaml:"username,omitempty"`
Vcenter string `json:"vcenter,omitempty" yaml:"vcenter,omitempty"`
}
type VmwarevsphereConfigCollection struct {
Collection
Data []VmwarevsphereConfig `json:"data,omitempty"`
}
type VmwarevsphereConfigClient struct {
rancherClient *RancherClient
}
type VmwarevsphereConfigOperations interface {
List(opts *ListOpts) (*VmwarevsphereConfigCollection, error)
Create(opts *VmwarevsphereConfig) (*VmwarevsphereConfig, error)
Update(existing *VmwarevsphereConfig, updates interface{}) (*VmwarevsphereConfig, error)
ById(id string) (*VmwarevsphereConfig, error)
Delete(container *VmwarevsphereConfig) error
}
func newVmwarevsphereConfigClient(rancherClient *RancherClient) *VmwarevsphereConfigClient {
return &VmwarevsphereConfigClient{
rancherClient: rancherClient,
}
}
func (c *VmwarevsphereConfigClient) Create(container *VmwarevsphereConfig) (*VmwarevsphereConfig, error) {
resp := &VmwarevsphereConfig{}
err := c.rancherClient.doCreate(VMWAREVSPHERE_CONFIG_TYPE, container, resp)
return resp, err
}
func (c *VmwarevsphereConfigClient) Update(existing *VmwarevsphereConfig, updates interface{}) (*VmwarevsphereConfig, error) {
resp := &VmwarevsphereConfig{}
err := c.rancherClient.doUpdate(VMWAREVSPHERE_CONFIG_TYPE, &existing.Resource, updates, resp)
return resp, err
}
func (c *VmwarevsphereConfigClient) List(opts *ListOpts) (*VmwarevsphereConfigCollection, error) {
resp := &VmwarevsphereConfigCollection{}
err := c.rancherClient.doList(VMWAREVSPHERE_CONFIG_TYPE, opts, resp)
return resp, err
}
func (c *VmwarevsphereConfigClient) ById(id string) (*VmwarevsphereConfig, error) {
resp := &VmwarevsphereConfig{}
err := c.rancherClient.doById(VMWAREVSPHERE_CONFIG_TYPE, id, resp)
if apiError, ok := err.(*ApiError); ok {
if apiError.StatusCode == 404 {
return nil, nil
}
}
return resp, err
}
func (c *VmwarevsphereConfigClient) Delete(container *VmwarevsphereConfig) error {
return c.rancherClient.doResourceDelete(VMWAREVSPHERE_CONFIG_TYPE, &container.Resource)
}

File diff suppressed because it is too large Load Diff

39
vendor/github.com/rancher/go-rancher/v2/client.go generated vendored Normal file
View File

@ -0,0 +1,39 @@
package client
import (
"net/http"
"github.com/gorilla/websocket"
)
type RancherBaseClientImpl struct {
Opts *ClientOpts
Schemas *Schemas
Types map[string]Schema
}
type RancherBaseClient interface {
Websocket(string, map[string][]string) (*websocket.Conn, *http.Response, error)
List(string, *ListOpts, interface{}) error
Post(string, interface{}, interface{}) error
GetLink(Resource, string, interface{}) error
Create(string, interface{}, interface{}) error
Update(string, *Resource, interface{}, interface{}) error
ById(string, string, interface{}) error
Delete(*Resource) error
Reload(*Resource, interface{}) error
Action(string, string, *Resource, interface{}, interface{}) error
GetOpts() *ClientOpts
GetSchemas() *Schemas
GetTypes() map[string]Schema
doGet(string, *ListOpts, interface{}) error
doList(string, *ListOpts, interface{}) error
doNext(string, interface{}) error
doModify(string, string, interface{}, interface{}) error
doCreate(string, interface{}, interface{}) error
doUpdate(string, *Resource, interface{}, interface{}) error
doById(string, string, interface{}) error
doResourceDelete(string, *Resource) error
doAction(string, string, *Resource, interface{}, interface{}) error
}

View File

@ -1,7 +1,8 @@
package catalog
package client
import (
"bytes"
"encoding/base64"
"encoding/json"
"fmt"
"io"
@ -23,8 +24,9 @@ const (
)
var (
debug = false
dialer = &websocket.Dialer{}
debug = false
dialer = &websocket.Dialer{}
privateFieldRegex = regexp.MustCompile("^[[:lower:]]")
)
type ClientOpts struct {
@ -129,7 +131,28 @@ func appendFilters(urlString string, filters map[string]interface{}) (string, er
return u.String(), nil
}
func NormalizeUrl(existingUrl string) (string, error) {
u, err := url.Parse(existingUrl)
if err != nil {
return "", err
}
if u.Path == "" || u.Path == "/" {
u.Path = "v2-beta"
} else if u.Path == "/v1" || strings.HasPrefix(u.Path, "/v1/") {
u.Path = strings.Replace(u.Path, "/v1", "/v2-beta", 1)
}
return u.String(), nil
}
func setupRancherBaseClient(rancherClient *RancherBaseClientImpl, opts *ClientOpts) error {
var err error
opts.Url, err = NormalizeUrl(opts.Url)
if err != nil {
return err
}
if opts.Timeout == 0 {
opts.Timeout = time.Second * 10
}
@ -152,14 +175,9 @@ func setupRancherBaseClient(rancherClient *RancherBaseClientImpl, opts *ClientOp
return newApiError(resp, opts.Url)
}
var schemasUrls string
if strings.HasSuffix(opts.Url, "/schemas") {
schemasUrls = opts.Url
} else {
schemasUrls = resp.Header.Get("X-API-Schemas")
if len(schemasUrls) == 0 {
return errors.New("Failed to find schema at [" + opts.Url + "]")
}
schemasUrls := resp.Header.Get("X-API-Schemas")
if len(schemasUrls) == 0 {
return errors.New("Failed to find schema at [" + opts.Url + "]")
}
if schemasUrls != opts.Url {
@ -244,7 +262,17 @@ func (rancherClient *RancherBaseClientImpl) doDelete(url string) error {
}
func (rancherClient *RancherBaseClientImpl) Websocket(url string, headers map[string][]string) (*websocket.Conn, *http.Response, error) {
return dialer.Dial(url, http.Header(headers))
httpHeaders := http.Header{}
for k, v := range httpHeaders {
httpHeaders[k] = v
}
if rancherClient.Opts != nil {
s := rancherClient.Opts.AccessKey + ":" + rancherClient.Opts.SecretKey
httpHeaders.Add("Authorization", "Basic "+base64.StdEncoding.EncodeToString([]byte(s)))
}
return dialer.Dial(url, http.Header(httpHeaders))
}
func (rancherClient *RancherBaseClientImpl) doGet(url string, opts *ListOpts, respObject interface{}) error {
@ -317,6 +345,10 @@ func (rancherClient *RancherBaseClientImpl) doList(schemaType string, opts *List
return rancherClient.doGet(collectionUrl, opts, respObject)
}
func (rancherClient *RancherBaseClientImpl) doNext(nextUrl string, respObject interface{}) error {
return rancherClient.doGet(nextUrl, nil, respObject)
}
func (rancherClient *RancherBaseClientImpl) Post(url string, createObj interface{}, respObject interface{}) error {
return rancherClient.doModify("POST", url, createObj, respObject)
}
@ -349,7 +381,6 @@ func (rancherClient *RancherBaseClientImpl) doModify(method string, url string,
rancherClient.setupRequest(req)
req.Header.Set("Content-Type", "application/json")
req.Header.Set("Content-Length", string(len(bodyContent)))
resp, err := client.Do(req)
if err != nil {
@ -569,6 +600,18 @@ func (rancherClient *RancherBaseClientImpl) doAction(schemaType string, action s
return json.Unmarshal(byteContent, respObject)
}
func (rancherClient *RancherBaseClientImpl) GetOpts() *ClientOpts {
return rancherClient.Opts
}
func (rancherClient *RancherBaseClientImpl) GetSchemas() *Schemas {
return rancherClient.Schemas
}
func (rancherClient *RancherBaseClientImpl) GetTypes() map[string]Schema {
return rancherClient.Types
}
func init() {
debug = os.Getenv("RANCHER_CLIENT_DEBUG") == "true"
if debug {

View File

@ -36,11 +36,14 @@ type Account struct {
TransitioningProgress int64 `json:"transitioningProgress,omitempty" yaml:"transitioning_progress,omitempty"`
Uuid string `json:"uuid,omitempty" yaml:"uuid,omitempty"`
Version string `json:"version,omitempty" yaml:"version,omitempty"`
}
type AccountCollection struct {
Collection
Data []Account `json:"data,omitempty"`
Data []Account `json:"data,omitempty"`
client *AccountClient
}
type AccountClient struct {
@ -67,6 +70,8 @@ type AccountOperations interface {
ActionRestore(*Account) (*Account, error)
ActionUpdate(*Account) (*Account, error)
ActionUpgrade(*Account) (*Account, error)
}
func newAccountClient(rancherClient *RancherClient) *AccountClient {
@ -90,9 +95,20 @@ func (c *AccountClient) Update(existing *Account, updates interface{}) (*Account
func (c *AccountClient) List(opts *ListOpts) (*AccountCollection, error) {
resp := &AccountCollection{}
err := c.rancherClient.doList(ACCOUNT_TYPE, opts, resp)
resp.client = c
return resp, err
}
func (cc *AccountCollection) Next() (*AccountCollection, error) {
if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" {
resp := &AccountCollection{}
err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp)
resp.client = cc.client
return resp, err
}
return nil, nil
}
func (c *AccountClient) ById(id string) (*Account, error) {
resp := &Account{}
err := c.rancherClient.doById(ACCOUNT_TYPE, id, resp)
@ -170,3 +186,12 @@ func (c *AccountClient) ActionUpdate(resource *Account) (*Account, error) {
return resp, err
}
func (c *AccountClient) ActionUpgrade(resource *Account) (*Account, error) {
resp := &Account{}
err := c.rancherClient.doAction(ACCOUNT_TYPE, "upgrade", &resource.Resource, nil, resp)
return resp, err
}

View File

@ -20,7 +20,8 @@ type ActiveSetting struct {
type ActiveSettingCollection struct {
Collection
Data []ActiveSetting `json:"data,omitempty"`
Data []ActiveSetting `json:"data,omitempty"`
client *ActiveSettingClient
}
type ActiveSettingClient struct {
@ -56,9 +57,20 @@ func (c *ActiveSettingClient) Update(existing *ActiveSetting, updates interface{
func (c *ActiveSettingClient) List(opts *ListOpts) (*ActiveSettingCollection, error) {
resp := &ActiveSettingCollection{}
err := c.rancherClient.doList(ACTIVE_SETTING_TYPE, opts, resp)
resp.client = c
return resp, err
}
func (cc *ActiveSettingCollection) Next() (*ActiveSettingCollection, error) {
if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" {
resp := &ActiveSettingCollection{}
err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp)
resp.client = cc.client
return resp, err
}
return nil, nil
}
func (c *ActiveSettingClient) ById(id string) (*ActiveSetting, error) {
resp := &ActiveSetting{}
err := c.rancherClient.doById(ACTIVE_SETTING_TYPE, id, resp)

View File

@ -12,7 +12,8 @@ type AddOutputsInput struct {
type AddOutputsInputCollection struct {
Collection
Data []AddOutputsInput `json:"data,omitempty"`
Data []AddOutputsInput `json:"data,omitempty"`
client *AddOutputsInputClient
}
type AddOutputsInputClient struct {
@ -48,9 +49,20 @@ func (c *AddOutputsInputClient) Update(existing *AddOutputsInput, updates interf
func (c *AddOutputsInputClient) List(opts *ListOpts) (*AddOutputsInputCollection, error) {
resp := &AddOutputsInputCollection{}
err := c.rancherClient.doList(ADD_OUTPUTS_INPUT_TYPE, opts, resp)
resp.client = c
return resp, err
}
func (cc *AddOutputsInputCollection) Next() (*AddOutputsInputCollection, error) {
if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" {
resp := &AddOutputsInputCollection{}
err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp)
resp.client = cc.client
return resp, err
}
return nil, nil
}
func (c *AddOutputsInputClient) ById(id string) (*AddOutputsInput, error) {
resp := &AddOutputsInput{}
err := c.rancherClient.doById(ADD_OUTPUTS_INPUT_TYPE, id, resp)

View File

@ -12,7 +12,8 @@ type AddRemoveServiceLinkInput struct {
type AddRemoveServiceLinkInputCollection struct {
Collection
Data []AddRemoveServiceLinkInput `json:"data,omitempty"`
Data []AddRemoveServiceLinkInput `json:"data,omitempty"`
client *AddRemoveServiceLinkInputClient
}
type AddRemoveServiceLinkInputClient struct {
@ -48,9 +49,20 @@ func (c *AddRemoveServiceLinkInputClient) Update(existing *AddRemoveServiceLinkI
func (c *AddRemoveServiceLinkInputClient) List(opts *ListOpts) (*AddRemoveServiceLinkInputCollection, error) {
resp := &AddRemoveServiceLinkInputCollection{}
err := c.rancherClient.doList(ADD_REMOVE_SERVICE_LINK_INPUT_TYPE, opts, resp)
resp.client = c
return resp, err
}
func (cc *AddRemoveServiceLinkInputCollection) Next() (*AddRemoveServiceLinkInputCollection, error) {
if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" {
resp := &AddRemoveServiceLinkInputCollection{}
err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp)
resp.client = cc.client
return resp, err
}
return nil, nil
}
func (c *AddRemoveServiceLinkInputClient) ById(id string) (*AddRemoveServiceLinkInput, error) {
resp := &AddRemoveServiceLinkInput{}
err := c.rancherClient.doById(ADD_REMOVE_SERVICE_LINK_INPUT_TYPE, id, resp)

View File

@ -40,7 +40,8 @@ type Agent struct {
type AgentCollection struct {
Collection
Data []Agent `json:"data,omitempty"`
Data []Agent `json:"data,omitempty"`
client *AgentClient
}
type AgentClient struct {
@ -60,6 +61,10 @@ type AgentOperations interface {
ActionDeactivate(*Agent) (*Agent, error)
ActionDisconnect(*Agent) (*Agent, error)
ActionFinishreconnect(*Agent) (*Agent, error)
ActionPurge(*Agent) (*Agent, error)
ActionReconnect(*Agent) (*Agent, error)
@ -92,9 +97,20 @@ func (c *AgentClient) Update(existing *Agent, updates interface{}) (*Agent, erro
func (c *AgentClient) List(opts *ListOpts) (*AgentCollection, error) {
resp := &AgentCollection{}
err := c.rancherClient.doList(AGENT_TYPE, opts, resp)
resp.client = c
return resp, err
}
func (cc *AgentCollection) Next() (*AgentCollection, error) {
if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" {
resp := &AgentCollection{}
err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp)
resp.client = cc.client
return resp, err
}
return nil, nil
}
func (c *AgentClient) ById(id string) (*Agent, error) {
resp := &Agent{}
err := c.rancherClient.doById(AGENT_TYPE, id, resp)
@ -137,6 +153,24 @@ func (c *AgentClient) ActionDeactivate(resource *Agent) (*Agent, error) {
return resp, err
}
func (c *AgentClient) ActionDisconnect(resource *Agent) (*Agent, error) {
resp := &Agent{}
err := c.rancherClient.doAction(AGENT_TYPE, "disconnect", &resource.Resource, nil, resp)
return resp, err
}
func (c *AgentClient) ActionFinishreconnect(resource *Agent) (*Agent, error) {
resp := &Agent{}
err := c.rancherClient.doAction(AGENT_TYPE, "finishreconnect", &resource.Resource, nil, resp)
return resp, err
}
func (c *AgentClient) ActionPurge(resource *Agent) (*Agent, error) {
resp := &Agent{}

View File

@ -11,34 +11,58 @@ type Amazonec2Config struct {
Ami string `json:"ami,omitempty" yaml:"ami,omitempty"`
BlockDurationMinutes string `json:"blockDurationMinutes,omitempty" yaml:"block_duration_minutes,omitempty"`
DeviceName string `json:"deviceName,omitempty" yaml:"device_name,omitempty"`
Endpoint string `json:"endpoint,omitempty" yaml:"endpoint,omitempty"`
IamInstanceProfile string `json:"iamInstanceProfile,omitempty" yaml:"iam_instance_profile,omitempty"`
InsecureTransport bool `json:"insecureTransport,omitempty" yaml:"insecure_transport,omitempty"`
InstanceType string `json:"instanceType,omitempty" yaml:"instance_type,omitempty"`
KeypairName string `json:"keypairName,omitempty" yaml:"keypair_name,omitempty"`
Monitoring bool `json:"monitoring,omitempty" yaml:"monitoring,omitempty"`
OpenPort []string `json:"openPort,omitempty" yaml:"open_port,omitempty"`
PrivateAddressOnly bool `json:"privateAddressOnly,omitempty" yaml:"private_address_only,omitempty"`
Region string `json:"region,omitempty" yaml:"region,omitempty"`
RequestSpotInstance bool `json:"requestSpotInstance,omitempty" yaml:"request_spot_instance,omitempty"`
Retries string `json:"retries,omitempty" yaml:"retries,omitempty"`
RootSize string `json:"rootSize,omitempty" yaml:"root_size,omitempty"`
SecretKey string `json:"secretKey,omitempty" yaml:"secret_key,omitempty"`
SecurityGroup string `json:"securityGroup,omitempty" yaml:"security_group,omitempty"`
SecurityGroup []string `json:"securityGroup,omitempty" yaml:"security_group,omitempty"`
SessionToken string `json:"sessionToken,omitempty" yaml:"session_token,omitempty"`
SpotPrice string `json:"spotPrice,omitempty" yaml:"spot_price,omitempty"`
SshKeypath string `json:"sshKeypath,omitempty" yaml:"ssh_keypath,omitempty"`
SshUser string `json:"sshUser,omitempty" yaml:"ssh_user,omitempty"`
SubnetId string `json:"subnetId,omitempty" yaml:"subnet_id,omitempty"`
Tags string `json:"tags,omitempty" yaml:"tags,omitempty"`
UseEbsOptimizedInstance bool `json:"useEbsOptimizedInstance,omitempty" yaml:"use_ebs_optimized_instance,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"`
VpcId string `json:"vpcId,omitempty" yaml:"vpc_id,omitempty"`
Zone string `json:"zone,omitempty" yaml:"zone,omitempty"`
@ -46,7 +70,8 @@ type Amazonec2Config struct {
type Amazonec2ConfigCollection struct {
Collection
Data []Amazonec2Config `json:"data,omitempty"`
Data []Amazonec2Config `json:"data,omitempty"`
client *Amazonec2ConfigClient
}
type Amazonec2ConfigClient struct {
@ -82,9 +107,20 @@ func (c *Amazonec2ConfigClient) Update(existing *Amazonec2Config, updates interf
func (c *Amazonec2ConfigClient) List(opts *ListOpts) (*Amazonec2ConfigCollection, error) {
resp := &Amazonec2ConfigCollection{}
err := c.rancherClient.doList(AMAZONEC2CONFIG_TYPE, opts, resp)
resp.client = c
return resp, err
}
func (cc *Amazonec2ConfigCollection) Next() (*Amazonec2ConfigCollection, error) {
if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" {
resp := &Amazonec2ConfigCollection{}
err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp)
resp.client = cc.client
return resp, err
}
return nil, nil
}
func (c *Amazonec2ConfigClient) ById(id string) (*Amazonec2Config, error) {
resp := &Amazonec2Config{}
err := c.rancherClient.doById(AMAZONEC2CONFIG_TYPE, id, resp)

View File

@ -40,7 +40,8 @@ type ApiKey struct {
type ApiKeyCollection struct {
Collection
Data []ApiKey `json:"data,omitempty"`
Data []ApiKey `json:"data,omitempty"`
client *ApiKeyClient
}
type ApiKeyClient struct {
@ -88,9 +89,20 @@ func (c *ApiKeyClient) Update(existing *ApiKey, updates interface{}) (*ApiKey, e
func (c *ApiKeyClient) List(opts *ListOpts) (*ApiKeyCollection, error) {
resp := &ApiKeyCollection{}
err := c.rancherClient.doList(API_KEY_TYPE, opts, resp)
resp.client = c
return resp, err
}
func (cc *ApiKeyCollection) Next() (*ApiKeyCollection, error) {
if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" {
resp := &ApiKeyCollection{}
err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp)
resp.client = cc.client
return resp, err
}
return nil, nil
}
func (c *ApiKeyClient) ById(id string) (*ApiKey, error) {
resp := &ApiKey{}
err := c.rancherClient.doById(API_KEY_TYPE, id, resp)

View File

@ -38,7 +38,8 @@ type AuditLog struct {
type AuditLogCollection struct {
Collection
Data []AuditLog `json:"data,omitempty"`
Data []AuditLog `json:"data,omitempty"`
client *AuditLogClient
}
type AuditLogClient struct {
@ -74,9 +75,20 @@ func (c *AuditLogClient) Update(existing *AuditLog, updates interface{}) (*Audit
func (c *AuditLogClient) List(opts *ListOpts) (*AuditLogCollection, error) {
resp := &AuditLogCollection{}
err := c.rancherClient.doList(AUDIT_LOG_TYPE, opts, resp)
resp.client = c
return resp, err
}
func (cc *AuditLogCollection) Next() (*AuditLogCollection, error) {
if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" {
resp := &AuditLogCollection{}
err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp)
resp.client = cc.client
return resp, err
}
return nil, nil
}
func (c *AuditLogClient) ById(id string) (*AuditLog, error) {
resp := &AuditLog{}
err := c.rancherClient.doById(AUDIT_LOG_TYPE, id, resp)

View File

@ -7,32 +7,55 @@ const (
type AzureConfig struct {
Resource
AvailabilitySet string `json:"availabilitySet,omitempty" yaml:"availability_set,omitempty"`
ClientId string `json:"clientId,omitempty" yaml:"client_id,omitempty"`
ClientSecret string `json:"clientSecret,omitempty" yaml:"client_secret,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"`
DockerSwarmMasterPort string `json:"dockerSwarmMasterPort,omitempty" yaml:"docker_swarm_master_port,omitempty"`
Environment string `json:"environment,omitempty" yaml:"environment,omitempty"`
Image string `json:"image,omitempty" yaml:"image,omitempty"`
Location string `json:"location,omitempty" yaml:"location,omitempty"`
Password string `json:"password,omitempty" yaml:"password,omitempty"`
NoPublicIp bool `json:"noPublicIp,omitempty" yaml:"no_public_ip,omitempty"`
PublishSettingsFile string `json:"publishSettingsFile,omitempty" yaml:"publish_settings_file,omitempty"`
OpenPort []string `json:"openPort,omitempty" yaml:"open_port,omitempty"`
PrivateIpAddress string `json:"privateIpAddress,omitempty" yaml:"private_ip_address,omitempty"`
ResourceGroup string `json:"resourceGroup,omitempty" yaml:"resource_group,omitempty"`
Size string `json:"size,omitempty" yaml:"size,omitempty"`
SshPort string `json:"sshPort,omitempty" yaml:"ssh_port,omitempty"`
SshUser string `json:"sshUser,omitempty" yaml:"ssh_user,omitempty"`
SubscriptionCert string `json:"subscriptionCert,omitempty" yaml:"subscription_cert,omitempty"`
StaticPublicIp bool `json:"staticPublicIp,omitempty" yaml:"static_public_ip,omitempty"`
StorageType string `json:"storageType,omitempty" yaml:"storage_type,omitempty"`
Subnet string `json:"subnet,omitempty" yaml:"subnet,omitempty"`
SubnetPrefix string `json:"subnetPrefix,omitempty" yaml:"subnet_prefix,omitempty"`
SubscriptionId string `json:"subscriptionId,omitempty" yaml:"subscription_id,omitempty"`
Username string `json:"username,omitempty" yaml:"username,omitempty"`
UsePrivateIp bool `json:"usePrivateIp,omitempty" yaml:"use_private_ip,omitempty"`
Vnet string `json:"vnet,omitempty" yaml:"vnet,omitempty"`
}
type AzureConfigCollection struct {
Collection
Data []AzureConfig `json:"data,omitempty"`
Data []AzureConfig `json:"data,omitempty"`
client *AzureConfigClient
}
type AzureConfigClient struct {
@ -68,9 +91,20 @@ func (c *AzureConfigClient) Update(existing *AzureConfig, updates interface{}) (
func (c *AzureConfigClient) List(opts *ListOpts) (*AzureConfigCollection, error) {
resp := &AzureConfigCollection{}
err := c.rancherClient.doList(AZURE_CONFIG_TYPE, opts, resp)
resp.client = c
return resp, err
}
func (cc *AzureConfigCollection) Next() (*AzureConfigCollection, error) {
if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" {
resp := &AzureConfigCollection{}
err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp)
resp.client = cc.client
return resp, err
}
return nil, nil
}
func (c *AzureConfigClient) ById(id string) (*AzureConfig, error) {
resp := &AzureConfig{}
err := c.rancherClient.doById(AZURE_CONFIG_TYPE, id, resp)

View File

@ -26,7 +26,8 @@ type Azureadconfig struct {
type AzureadconfigCollection struct {
Collection
Data []Azureadconfig `json:"data,omitempty"`
Data []Azureadconfig `json:"data,omitempty"`
client *AzureadconfigClient
}
type AzureadconfigClient struct {
@ -62,9 +63,20 @@ func (c *AzureadconfigClient) Update(existing *Azureadconfig, updates interface{
func (c *AzureadconfigClient) List(opts *ListOpts) (*AzureadconfigCollection, error) {
resp := &AzureadconfigCollection{}
err := c.rancherClient.doList(AZUREADCONFIG_TYPE, opts, resp)
resp.client = c
return resp, err
}
func (cc *AzureadconfigCollection) Next() (*AzureadconfigCollection, error) {
if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" {
resp := &AzureadconfigCollection{}
err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp)
resp.client = cc.client
return resp, err
}
return nil, nil
}
func (c *AzureadconfigClient) ById(id string) (*Azureadconfig, error) {
resp := &Azureadconfig{}
err := c.rancherClient.doById(AZUREADCONFIG_TYPE, id, resp)

View File

@ -44,7 +44,8 @@ type Backup struct {
type BackupCollection struct {
Collection
Data []Backup `json:"data,omitempty"`
Data []Backup `json:"data,omitempty"`
client *BackupClient
}
type BackupClient struct {
@ -84,9 +85,20 @@ func (c *BackupClient) Update(existing *Backup, updates interface{}) (*Backup, e
func (c *BackupClient) List(opts *ListOpts) (*BackupCollection, error) {
resp := &BackupCollection{}
err := c.rancherClient.doList(BACKUP_TYPE, opts, resp)
resp.client = c
return resp, err
}
func (cc *BackupCollection) Next() (*BackupCollection, error) {
if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" {
resp := &BackupCollection{}
err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp)
resp.client = cc.client
return resp, err
}
return nil, nil
}
func (c *BackupClient) ById(id string) (*Backup, error) {
resp := &Backup{}
err := c.rancherClient.doById(BACKUP_TYPE, id, resp)

View File

@ -38,7 +38,8 @@ type BackupTarget struct {
type BackupTargetCollection struct {
Collection
Data []BackupTarget `json:"data,omitempty"`
Data []BackupTarget `json:"data,omitempty"`
client *BackupTargetClient
}
type BackupTargetClient struct {
@ -78,9 +79,20 @@ func (c *BackupTargetClient) Update(existing *BackupTarget, updates interface{})
func (c *BackupTargetClient) List(opts *ListOpts) (*BackupTargetCollection, error) {
resp := &BackupTargetCollection{}
err := c.rancherClient.doList(BACKUP_TARGET_TYPE, opts, resp)
resp.client = c
return resp, err
}
func (cc *BackupTargetCollection) Next() (*BackupTargetCollection, error) {
if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" {
resp := &BackupTargetCollection{}
err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp)
resp.client = cc.client
return resp, err
}
return nil, nil
}
func (c *BackupTargetClient) ById(id string) (*BackupTarget, error) {
resp := &BackupTarget{}
err := c.rancherClient.doById(BACKUP_TARGET_TYPE, id, resp)

View File

@ -10,7 +10,8 @@ type BaseMachineConfig struct {
type BaseMachineConfigCollection struct {
Collection
Data []BaseMachineConfig `json:"data,omitempty"`
Data []BaseMachineConfig `json:"data,omitempty"`
client *BaseMachineConfigClient
}
type BaseMachineConfigClient struct {
@ -46,9 +47,20 @@ func (c *BaseMachineConfigClient) Update(existing *BaseMachineConfig, updates in
func (c *BaseMachineConfigClient) List(opts *ListOpts) (*BaseMachineConfigCollection, error) {
resp := &BaseMachineConfigCollection{}
err := c.rancherClient.doList(BASE_MACHINE_CONFIG_TYPE, opts, resp)
resp.client = c
return resp, err
}
func (cc *BaseMachineConfigCollection) Next() (*BaseMachineConfigCollection, error) {
if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" {
resp := &BaseMachineConfigCollection{}
err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp)
resp.client = cc.client
return resp, err
}
return nil, nil
}
func (c *BaseMachineConfigClient) ById(id string) (*BaseMachineConfig, error) {
resp := &BaseMachineConfig{}
err := c.rancherClient.doById(BASE_MACHINE_CONFIG_TYPE, id, resp)

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

@ -20,7 +20,8 @@ type BlkioDeviceOption struct {
type BlkioDeviceOptionCollection struct {
Collection
Data []BlkioDeviceOption `json:"data,omitempty"`
Data []BlkioDeviceOption `json:"data,omitempty"`
client *BlkioDeviceOptionClient
}
type BlkioDeviceOptionClient struct {
@ -56,9 +57,20 @@ func (c *BlkioDeviceOptionClient) Update(existing *BlkioDeviceOption, updates in
func (c *BlkioDeviceOptionClient) List(opts *ListOpts) (*BlkioDeviceOptionCollection, error) {
resp := &BlkioDeviceOptionCollection{}
err := c.rancherClient.doList(BLKIO_DEVICE_OPTION_TYPE, opts, resp)
resp.client = c
return resp, err
}
func (cc *BlkioDeviceOptionCollection) Next() (*BlkioDeviceOptionCollection, error) {
if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" {
resp := &BlkioDeviceOptionCollection{}
err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp)
resp.client = cc.client
return resp, err
}
return nil, nil
}
func (c *BlkioDeviceOptionClient) ById(id string) (*BlkioDeviceOption, error) {
resp := &BlkioDeviceOption{}
err := c.rancherClient.doById(BLKIO_DEVICE_OPTION_TYPE, id, resp)

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

@ -62,7 +62,8 @@ type Certificate struct {
type CertificateCollection struct {
Collection
Data []Certificate `json:"data,omitempty"`
Data []Certificate `json:"data,omitempty"`
client *CertificateClient
}
type CertificateClient struct {
@ -104,9 +105,20 @@ func (c *CertificateClient) Update(existing *Certificate, updates interface{}) (
func (c *CertificateClient) List(opts *ListOpts) (*CertificateCollection, error) {
resp := &CertificateCollection{}
err := c.rancherClient.doList(CERTIFICATE_TYPE, opts, resp)
resp.client = c
return resp, err
}
func (cc *CertificateCollection) Next() (*CertificateCollection, error) {
if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" {
resp := &CertificateCollection{}
err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp)
resp.client = cc.client
return resp, err
}
return nil, nil
}
func (c *CertificateClient) ById(id string) (*Certificate, error) {
resp := &Certificate{}
err := c.rancherClient.doById(CERTIFICATE_TYPE, id, resp)

View File

@ -14,7 +14,8 @@ type ChangeSecretInput struct {
type ChangeSecretInputCollection struct {
Collection
Data []ChangeSecretInput `json:"data,omitempty"`
Data []ChangeSecretInput `json:"data,omitempty"`
client *ChangeSecretInputClient
}
type ChangeSecretInputClient struct {
@ -50,9 +51,20 @@ func (c *ChangeSecretInputClient) Update(existing *ChangeSecretInput, updates in
func (c *ChangeSecretInputClient) List(opts *ListOpts) (*ChangeSecretInputCollection, error) {
resp := &ChangeSecretInputCollection{}
err := c.rancherClient.doList(CHANGE_SECRET_INPUT_TYPE, opts, resp)
resp.client = c
return resp, err
}
func (cc *ChangeSecretInputCollection) Next() (*ChangeSecretInputCollection, error) {
if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" {
resp := &ChangeSecretInputCollection{}
err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp)
resp.client = cc.client
return resp, err
}
return nil, nil
}
func (c *ChangeSecretInputClient) ById(id string) (*ChangeSecretInput, error) {
resp := &ChangeSecretInput{}
err := c.rancherClient.doById(CHANGE_SECRET_INPUT_TYPE, id, resp)

View File

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

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

@ -14,7 +14,8 @@ type ComposeConfig struct {
type ComposeConfigCollection struct {
Collection
Data []ComposeConfig `json:"data,omitempty"`
Data []ComposeConfig `json:"data,omitempty"`
client *ComposeConfigClient
}
type ComposeConfigClient struct {
@ -50,9 +51,20 @@ func (c *ComposeConfigClient) Update(existing *ComposeConfig, updates interface{
func (c *ComposeConfigClient) List(opts *ListOpts) (*ComposeConfigCollection, error) {
resp := &ComposeConfigCollection{}
err := c.rancherClient.doList(COMPOSE_CONFIG_TYPE, opts, resp)
resp.client = c
return resp, err
}
func (cc *ComposeConfigCollection) Next() (*ComposeConfigCollection, error) {
if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" {
resp := &ComposeConfigCollection{}
err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp)
resp.client = cc.client
return resp, err
}
return nil, nil
}
func (c *ComposeConfigClient) ById(id string) (*ComposeConfig, error) {
resp := &ComposeConfig{}
err := c.rancherClient.doById(COMPOSE_CONFIG_TYPE, id, resp)

View File

@ -12,7 +12,8 @@ type ComposeConfigInput struct {
type ComposeConfigInputCollection struct {
Collection
Data []ComposeConfigInput `json:"data,omitempty"`
Data []ComposeConfigInput `json:"data,omitempty"`
client *ComposeConfigInputClient
}
type ComposeConfigInputClient struct {
@ -48,9 +49,20 @@ func (c *ComposeConfigInputClient) Update(existing *ComposeConfigInput, updates
func (c *ComposeConfigInputClient) List(opts *ListOpts) (*ComposeConfigInputCollection, error) {
resp := &ComposeConfigInputCollection{}
err := c.rancherClient.doList(COMPOSE_CONFIG_INPUT_TYPE, opts, resp)
resp.client = c
return resp, err
}
func (cc *ComposeConfigInputCollection) Next() (*ComposeConfigInputCollection, error) {
if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" {
resp := &ComposeConfigInputCollection{}
err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp)
resp.client = cc.client
return resp, err
}
return nil, nil
}
func (c *ComposeConfigInputClient) ById(id string) (*ComposeConfigInput, error) {
resp := &ComposeConfigInput{}
err := c.rancherClient.doById(COMPOSE_CONFIG_INPUT_TYPE, id, resp)

View File

@ -9,6 +9,10 @@ type ComposeProject struct {
AccountId string `json:"accountId,omitempty" yaml:"account_id,omitempty"`
Answers map[string]interface{} `json:"answers,omitempty" yaml:"answers,omitempty"`
Binding *Binding `json:"binding,omitempty" yaml:"binding,omitempty"`
Created string `json:"created,omitempty" yaml:"created,omitempty"`
Data map[string]interface{} `json:"data,omitempty" yaml:"data,omitempty"`
@ -19,6 +23,8 @@ type ComposeProject struct {
ExternalId string `json:"externalId,omitempty" yaml:"external_id,omitempty"`
Group string `json:"group,omitempty" yaml:"group,omitempty"`
HealthState string `json:"healthState,omitempty" yaml:"health_state,omitempty"`
Kind string `json:"kind,omitempty" yaml:"kind,omitempty"`
@ -33,8 +39,12 @@ type ComposeProject struct {
Removed string `json:"removed,omitempty" yaml:"removed,omitempty"`
ServiceIds []string `json:"serviceIds,omitempty" yaml:"service_ids,omitempty"`
State string `json:"state,omitempty" yaml:"state,omitempty"`
System bool `json:"system,omitempty" yaml:"system,omitempty"`
Templates map[string]interface{} `json:"templates,omitempty" yaml:"templates,omitempty"`
Transitioning string `json:"transitioning,omitempty" yaml:"transitioning,omitempty"`
@ -48,7 +58,8 @@ type ComposeProject struct {
type ComposeProjectCollection struct {
Collection
Data []ComposeProject `json:"data,omitempty"`
Data []ComposeProject `json:"data,omitempty"`
client *ComposeProjectClient
}
type ComposeProjectClient struct {
@ -62,19 +73,17 @@ type ComposeProjectOperations interface {
ById(id string) (*ComposeProject, error)
Delete(container *ComposeProject) error
ActionCancelrollback(*ComposeProject) (*Environment, error)
ActionCancelupgrade(*ComposeProject) (*Stack, error)
ActionCancelupgrade(*ComposeProject) (*Environment, error)
ActionCreate(*ComposeProject) (*Stack, error)
ActionCreate(*ComposeProject) (*Environment, error)
ActionError(*ComposeProject) (*Stack, error)
ActionError(*ComposeProject) (*Environment, error)
ActionFinishupgrade(*ComposeProject) (*Stack, error)
ActionFinishupgrade(*ComposeProject) (*Environment, error)
ActionRemove(*ComposeProject) (*Stack, error)
ActionRemove(*ComposeProject) (*Environment, error)
ActionRollback(*ComposeProject) (*Environment, error)
ActionRollback(*ComposeProject) (*Stack, error)
}
func newComposeProjectClient(rancherClient *RancherClient) *ComposeProjectClient {
@ -98,9 +107,20 @@ func (c *ComposeProjectClient) Update(existing *ComposeProject, updates interfac
func (c *ComposeProjectClient) List(opts *ListOpts) (*ComposeProjectCollection, error) {
resp := &ComposeProjectCollection{}
err := c.rancherClient.doList(COMPOSE_PROJECT_TYPE, opts, resp)
resp.client = c
return resp, err
}
func (cc *ComposeProjectCollection) Next() (*ComposeProjectCollection, error) {
if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" {
resp := &ComposeProjectCollection{}
err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp)
resp.client = cc.client
return resp, err
}
return nil, nil
}
func (c *ComposeProjectClient) ById(id string) (*ComposeProject, error) {
resp := &ComposeProject{}
err := c.rancherClient.doById(COMPOSE_PROJECT_TYPE, id, resp)
@ -116,63 +136,54 @@ func (c *ComposeProjectClient) Delete(container *ComposeProject) error {
return c.rancherClient.doResourceDelete(COMPOSE_PROJECT_TYPE, &container.Resource)
}
func (c *ComposeProjectClient) ActionCancelrollback(resource *ComposeProject) (*Environment, error) {
func (c *ComposeProjectClient) ActionCancelupgrade(resource *ComposeProject) (*Stack, error) {
resp := &Environment{}
err := c.rancherClient.doAction(COMPOSE_PROJECT_TYPE, "cancelrollback", &resource.Resource, nil, resp)
return resp, err
}
func (c *ComposeProjectClient) ActionCancelupgrade(resource *ComposeProject) (*Environment, error) {
resp := &Environment{}
resp := &Stack{}
err := c.rancherClient.doAction(COMPOSE_PROJECT_TYPE, "cancelupgrade", &resource.Resource, nil, resp)
return resp, err
}
func (c *ComposeProjectClient) ActionCreate(resource *ComposeProject) (*Environment, error) {
func (c *ComposeProjectClient) ActionCreate(resource *ComposeProject) (*Stack, error) {
resp := &Environment{}
resp := &Stack{}
err := c.rancherClient.doAction(COMPOSE_PROJECT_TYPE, "create", &resource.Resource, nil, resp)
return resp, err
}
func (c *ComposeProjectClient) ActionError(resource *ComposeProject) (*Environment, error) {
func (c *ComposeProjectClient) ActionError(resource *ComposeProject) (*Stack, error) {
resp := &Environment{}
resp := &Stack{}
err := c.rancherClient.doAction(COMPOSE_PROJECT_TYPE, "error", &resource.Resource, nil, resp)
return resp, err
}
func (c *ComposeProjectClient) ActionFinishupgrade(resource *ComposeProject) (*Environment, error) {
func (c *ComposeProjectClient) ActionFinishupgrade(resource *ComposeProject) (*Stack, error) {
resp := &Environment{}
resp := &Stack{}
err := c.rancherClient.doAction(COMPOSE_PROJECT_TYPE, "finishupgrade", &resource.Resource, nil, resp)
return resp, err
}
func (c *ComposeProjectClient) ActionRemove(resource *ComposeProject) (*Environment, error) {
func (c *ComposeProjectClient) ActionRemove(resource *ComposeProject) (*Stack, error) {
resp := &Environment{}
resp := &Stack{}
err := c.rancherClient.doAction(COMPOSE_PROJECT_TYPE, "remove", &resource.Resource, nil, resp)
return resp, err
}
func (c *ComposeProjectClient) ActionRollback(resource *ComposeProject) (*Environment, error) {
func (c *ComposeProjectClient) ActionRollback(resource *ComposeProject) (*Stack, error) {
resp := &Environment{}
resp := &Stack{}
err := c.rancherClient.doAction(COMPOSE_PROJECT_TYPE, "rollback", &resource.Resource, nil, resp)

View File

@ -17,21 +17,23 @@ type ComposeService struct {
Description string `json:"description,omitempty" yaml:"description,omitempty"`
EnvironmentId string `json:"environmentId,omitempty" yaml:"environment_id,omitempty"`
ExternalId string `json:"externalId,omitempty" yaml:"external_id,omitempty"`
Fqdn string `json:"fqdn,omitempty" yaml:"fqdn,omitempty"`
HealthState string `json:"healthState,omitempty" yaml:"health_state,omitempty"`
InstanceIds []string `json:"instanceIds,omitempty" yaml:"instance_ids,omitempty"`
Kind string `json:"kind,omitempty" yaml:"kind,omitempty"`
LaunchConfig *LaunchConfig `json:"launchConfig,omitempty" yaml:"launch_config,omitempty"`
LinkedServices map[string]interface{} `json:"linkedServices,omitempty" yaml:"linked_services,omitempty"`
Name string `json:"name,omitempty" yaml:"name,omitempty"`
PublicEndpoints []interface{} `json:"publicEndpoints,omitempty" yaml:"public_endpoints,omitempty"`
PublicEndpoints []PublicEndpoint `json:"publicEndpoints,omitempty" yaml:"public_endpoints,omitempty"`
RemoveTime string `json:"removeTime,omitempty" yaml:"remove_time,omitempty"`
@ -45,10 +47,14 @@ type ComposeService struct {
SelectorLink string `json:"selectorLink,omitempty" yaml:"selector_link,omitempty"`
StackId string `json:"stackId,omitempty" yaml:"stack_id,omitempty"`
StartOnCreate bool `json:"startOnCreate,omitempty" yaml:"start_on_create,omitempty"`
State string `json:"state,omitempty" yaml:"state,omitempty"`
System bool `json:"system,omitempty" yaml:"system,omitempty"`
Transitioning string `json:"transitioning,omitempty" yaml:"transitioning,omitempty"`
TransitioningMessage string `json:"transitioningMessage,omitempty" yaml:"transitioning_message,omitempty"`
@ -62,7 +68,8 @@ type ComposeService struct {
type ComposeServiceCollection struct {
Collection
Data []ComposeService `json:"data,omitempty"`
Data []ComposeService `json:"data,omitempty"`
client *ComposeServiceClient
}
type ComposeServiceClient struct {
@ -78,10 +85,10 @@ type ComposeServiceOperations interface {
ActionActivate(*ComposeService) (*Service, error)
ActionCancelrollback(*ComposeService) (*Service, error)
ActionCancelupgrade(*ComposeService) (*Service, error)
ActionContinueupgrade(*ComposeService) (*Service, error)
ActionCreate(*ComposeService) (*Service, error)
ActionFinishupgrade(*ComposeService) (*Service, error)
@ -112,9 +119,20 @@ func (c *ComposeServiceClient) Update(existing *ComposeService, updates interfac
func (c *ComposeServiceClient) List(opts *ListOpts) (*ComposeServiceCollection, error) {
resp := &ComposeServiceCollection{}
err := c.rancherClient.doList(COMPOSE_SERVICE_TYPE, opts, resp)
resp.client = c
return resp, err
}
func (cc *ComposeServiceCollection) Next() (*ComposeServiceCollection, error) {
if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" {
resp := &ComposeServiceCollection{}
err := cc.client.rancherClient.doNext(cc.Pagination.Next, resp)
resp.client = cc.client
return resp, err
}
return nil, nil
}
func (c *ComposeServiceClient) ById(id string) (*ComposeService, error) {
resp := &ComposeService{}
err := c.rancherClient.doById(COMPOSE_SERVICE_TYPE, id, resp)
@ -139,15 +157,6 @@ func (c *ComposeServiceClient) ActionActivate(resource *ComposeService) (*Servic
return resp, err
}
func (c *ComposeServiceClient) ActionCancelrollback(resource *ComposeService) (*Service, error) {
resp := &Service{}
err := c.rancherClient.doAction(COMPOSE_SERVICE_TYPE, "cancelrollback", &resource.Resource, nil, resp)
return resp, err
}
func (c *ComposeServiceClient) ActionCancelupgrade(resource *ComposeService) (*Service, error) {
resp := &Service{}
@ -157,6 +166,15 @@ func (c *ComposeServiceClient) ActionCancelupgrade(resource *ComposeService) (*S
return resp, err
}
func (c *ComposeServiceClient) ActionContinueupgrade(resource *ComposeService) (*Service, error) {
resp := &Service{}
err := c.rancherClient.doAction(COMPOSE_SERVICE_TYPE, "continueupgrade", &resource.Resource, nil, resp)
return resp, err
}
func (c *ComposeServiceClient) ActionCreate(resource *ComposeService) (*Service, error) {
resp := &Service{}

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