diff --git a/rancher/context.go b/rancher/context.go index 3355bda1..cb273d3c 100644 --- a/rancher/context.go +++ b/rancher/context.go @@ -67,6 +67,7 @@ type RancherConfig struct { DefaultCert string `yaml:"default_cert,omitempty"` Certs []string `yaml:"certs,omitempty"` Metadata map[string]interface{} `yaml:"metadata,omitempty"` + ScalePolicy *rancherClient.ScalePolicy `yaml:"scale_policy,omitempty"` ServiceSchemas map[string]rancherClient.Schema `yaml:"service_schemas,omitempty"` UpgradeStrategy rancherClient.InServiceUpgradeStrategy `yaml:"upgrade_strategy,omitempty"` } diff --git a/rancher/normal.go b/rancher/normal.go index 01329012..945a4c12 100644 --- a/rancher/normal.go +++ b/rancher/normal.go @@ -54,6 +54,7 @@ func (f *NormalFactory) config(r *RancherService) (*CompositeService, *rancherCl Name: r.name, Metadata: r.Metadata(), Scale: int64(r.getConfiguredScale()), + ScalePolicy: rancherConfig.ScalePolicy, RetainIp: rancherConfig.RetainIp, EnvironmentId: r.Context().Environment.Id, SelectorContainer: r.SelectorContainer(), diff --git a/scripts/config_schema_v1.json b/scripts/config_schema_v1.json index b694fcfb..d85060c6 100644 --- a/scripts/config_schema_v1.json +++ b/scripts/config_schema_v1.json @@ -112,6 +112,7 @@ "restart": {"type": "string"}, "retain_ip": {"type": "boolean"}, "scale": {"type": "number"}, + "scale_policy": {"type": "object"}, "security_opt": {"type": "array", "items": {"type": "string"}, "uniqueItems": true}, "shm_size": {"type": ["number", "string"]}, "stdin_open": {"type": "boolean"}, diff --git a/trash.yml b/trash.yml index b8ef2a3c..58198427 100644 --- a/trash.yml +++ b/trash.yml @@ -49,7 +49,7 @@ import: version: ecc762f6877af82d7c6f56cae2a50045951f8af1 - package: github.com/rancher/go-rancher - version: 6f68a5fa617dca7db1a509c2a789c1fffaca7b19 + version: 37c17e456a2d6dce279f54ee2f957797d30a20dc - package: github.com/rancher/rancher-catalog-service version: a3a8b500adceb82b3a0387b2c7b06a60e7eeee9a diff --git a/vendor/github.com/docker/libcompose/config/schema.go b/vendor/github.com/docker/libcompose/config/schema.go index 63a9ef8f..6a86fc2b 100644 --- a/vendor/github.com/docker/libcompose/config/schema.go +++ b/vendor/github.com/docker/libcompose/config/schema.go @@ -115,6 +115,7 @@ var schemaString = `{ "restart": {"type": "string"}, "retain_ip": {"type": "boolean"}, "scale": {"type": "number"}, + "scale_policy": {"type": "object"}, "security_opt": {"type": "array", "items": {"type": "string"}, "uniqueItems": true}, "shm_size": {"type": ["number", "string"]}, "stdin_open": {"type": "boolean"}, diff --git a/vendor/github.com/rancher/go-rancher/client/generated_azureadconfig.go b/vendor/github.com/rancher/go-rancher/client/generated_azureadconfig.go new file mode 100644 index 00000000..fe741e2e --- /dev/null +++ b/vendor/github.com/rancher/go-rancher/client/generated_azureadconfig.go @@ -0,0 +1,81 @@ +package client + +const ( + AZUREADCONFIG_TYPE = "azureadconfig" +) + +type Azureadconfig struct { + Resource + + AccessMode string `json:"accessMode,omitempty" yaml:"access_mode,omitempty"` + + AdminAccountPassword string `json:"adminAccountPassword,omitempty" yaml:"admin_account_password,omitempty"` + + AdminAccountUsername string `json:"adminAccountUsername,omitempty" yaml:"admin_account_username,omitempty"` + + ClientId string `json:"clientId,omitempty" yaml:"client_id,omitempty"` + + Domain string `json:"domain,omitempty" yaml:"domain,omitempty"` + + Enabled bool `json:"enabled,omitempty" yaml:"enabled,omitempty"` + + Name string `json:"name,omitempty" yaml:"name,omitempty"` + + TenantId string `json:"tenantId,omitempty" yaml:"tenant_id,omitempty"` +} + +type AzureadconfigCollection struct { + Collection + Data []Azureadconfig `json:"data,omitempty"` +} + +type AzureadconfigClient struct { + rancherClient *RancherClient +} + +type AzureadconfigOperations interface { + List(opts *ListOpts) (*AzureadconfigCollection, error) + Create(opts *Azureadconfig) (*Azureadconfig, error) + Update(existing *Azureadconfig, updates interface{}) (*Azureadconfig, error) + ById(id string) (*Azureadconfig, error) + Delete(container *Azureadconfig) error +} + +func newAzureadconfigClient(rancherClient *RancherClient) *AzureadconfigClient { + return &AzureadconfigClient{ + rancherClient: rancherClient, + } +} + +func (c *AzureadconfigClient) Create(container *Azureadconfig) (*Azureadconfig, error) { + resp := &Azureadconfig{} + err := c.rancherClient.doCreate(AZUREADCONFIG_TYPE, container, resp) + return resp, err +} + +func (c *AzureadconfigClient) Update(existing *Azureadconfig, updates interface{}) (*Azureadconfig, error) { + resp := &Azureadconfig{} + err := c.rancherClient.doUpdate(AZUREADCONFIG_TYPE, &existing.Resource, updates, resp) + return resp, err +} + +func (c *AzureadconfigClient) List(opts *ListOpts) (*AzureadconfigCollection, error) { + resp := &AzureadconfigCollection{} + err := c.rancherClient.doList(AZUREADCONFIG_TYPE, opts, resp) + return resp, err +} + +func (c *AzureadconfigClient) ById(id string) (*Azureadconfig, error) { + resp := &Azureadconfig{} + err := c.rancherClient.doById(AZUREADCONFIG_TYPE, id, resp) + if apiError, ok := err.(*ApiError); ok { + if apiError.StatusCode == 404 { + return nil, nil + } + } + return resp, err +} + +func (c *AzureadconfigClient) Delete(container *Azureadconfig) error { + return c.rancherClient.doResourceDelete(AZUREADCONFIG_TYPE, &container.Resource) +} diff --git a/vendor/github.com/rancher/go-rancher/client/generated_client.go b/vendor/github.com/rancher/go-rancher/client/generated_client.go index 8714180f..a5381d4e 100644 --- a/vendor/github.com/rancher/go-rancher/client/generated_client.go +++ b/vendor/github.com/rancher/go-rancher/client/generated_client.go @@ -11,6 +11,7 @@ type RancherClient struct { Agent AgentOperations ApiKey ApiKeyOperations AuditLog AuditLogOperations + Azureadconfig AzureadconfigOperations Backup BackupOperations BackupTarget BackupTargetOperations BaseMachineConfig BaseMachineConfigOperations @@ -107,6 +108,7 @@ type RancherClient struct { RestoreFromBackupInput RestoreFromBackupInputOperations RevertToSnapshotInput RevertToSnapshotInputOperations RollingRestartStrategy RollingRestartStrategyOperations + ScalePolicy ScalePolicyOperations SecondaryLaunchConfig SecondaryLaunchConfigOperations Service ServiceOperations ServiceConsumeMap ServiceConsumeMapOperations @@ -154,6 +156,7 @@ func constructClient() *RancherClient { client.Agent = newAgentClient(client) client.ApiKey = newApiKeyClient(client) client.AuditLog = newAuditLogClient(client) + client.Azureadconfig = newAzureadconfigClient(client) client.Backup = newBackupClient(client) client.BackupTarget = newBackupTargetClient(client) client.BaseMachineConfig = newBaseMachineConfigClient(client) @@ -250,6 +253,7 @@ func constructClient() *RancherClient { client.RestoreFromBackupInput = newRestoreFromBackupInputClient(client) client.RevertToSnapshotInput = newRevertToSnapshotInputClient(client) client.RollingRestartStrategy = newRollingRestartStrategyClient(client) + client.ScalePolicy = newScalePolicyClient(client) client.SecondaryLaunchConfig = newSecondaryLaunchConfigClient(client) client.Service = newServiceClient(client) client.ServiceConsumeMap = newServiceConsumeMapClient(client) diff --git a/vendor/github.com/rancher/go-rancher/client/generated_compose_project.go b/vendor/github.com/rancher/go-rancher/client/generated_compose_project.go index 89445d1e..7d41efad 100644 --- a/vendor/github.com/rancher/go-rancher/client/generated_compose_project.go +++ b/vendor/github.com/rancher/go-rancher/client/generated_compose_project.go @@ -62,31 +62,19 @@ type ComposeProjectOperations interface { ById(id string) (*ComposeProject, error) Delete(container *ComposeProject) error - ActionActivateservices(*ComposeProject) (*Environment, error) - - ActionAddoutputs(*ComposeProject, *AddOutputsInput) (*Environment, error) - ActionCancelrollback(*ComposeProject) (*Environment, error) ActionCancelupgrade(*ComposeProject) (*Environment, error) ActionCreate(*ComposeProject) (*Environment, error) - ActionDeactivateservices(*ComposeProject) (*Environment, error) - ActionError(*ComposeProject) (*Environment, error) - ActionExportconfig(*ComposeProject, *ComposeConfigInput) (*ComposeConfig, error) - ActionFinishupgrade(*ComposeProject) (*Environment, error) ActionRemove(*ComposeProject) (*Environment, error) ActionRollback(*ComposeProject) (*Environment, error) - - ActionUpdate(*ComposeProject) (*Environment, error) - - ActionUpgrade(*ComposeProject, *EnvironmentUpgrade) (*Environment, error) } func newComposeProjectClient(rancherClient *RancherClient) *ComposeProjectClient { @@ -128,24 +116,6 @@ func (c *ComposeProjectClient) Delete(container *ComposeProject) error { return c.rancherClient.doResourceDelete(COMPOSE_PROJECT_TYPE, &container.Resource) } -func (c *ComposeProjectClient) ActionActivateservices(resource *ComposeProject) (*Environment, error) { - - resp := &Environment{} - - err := c.rancherClient.doAction(COMPOSE_PROJECT_TYPE, "activateservices", &resource.Resource, nil, resp) - - return resp, err -} - -func (c *ComposeProjectClient) ActionAddoutputs(resource *ComposeProject, input *AddOutputsInput) (*Environment, error) { - - resp := &Environment{} - - err := c.rancherClient.doAction(COMPOSE_PROJECT_TYPE, "addoutputs", &resource.Resource, input, resp) - - return resp, err -} - func (c *ComposeProjectClient) ActionCancelrollback(resource *ComposeProject) (*Environment, error) { resp := &Environment{} @@ -173,15 +143,6 @@ func (c *ComposeProjectClient) ActionCreate(resource *ComposeProject) (*Environm return resp, err } -func (c *ComposeProjectClient) ActionDeactivateservices(resource *ComposeProject) (*Environment, error) { - - resp := &Environment{} - - err := c.rancherClient.doAction(COMPOSE_PROJECT_TYPE, "deactivateservices", &resource.Resource, nil, resp) - - return resp, err -} - func (c *ComposeProjectClient) ActionError(resource *ComposeProject) (*Environment, error) { resp := &Environment{} @@ -191,15 +152,6 @@ func (c *ComposeProjectClient) ActionError(resource *ComposeProject) (*Environme return resp, err } -func (c *ComposeProjectClient) ActionExportconfig(resource *ComposeProject, input *ComposeConfigInput) (*ComposeConfig, error) { - - resp := &ComposeConfig{} - - err := c.rancherClient.doAction(COMPOSE_PROJECT_TYPE, "exportconfig", &resource.Resource, input, resp) - - return resp, err -} - func (c *ComposeProjectClient) ActionFinishupgrade(resource *ComposeProject) (*Environment, error) { resp := &Environment{} @@ -226,21 +178,3 @@ func (c *ComposeProjectClient) ActionRollback(resource *ComposeProject) (*Enviro return resp, err } - -func (c *ComposeProjectClient) ActionUpdate(resource *ComposeProject) (*Environment, error) { - - resp := &Environment{} - - err := c.rancherClient.doAction(COMPOSE_PROJECT_TYPE, "update", &resource.Resource, nil, resp) - - return resp, err -} - -func (c *ComposeProjectClient) ActionUpgrade(resource *ComposeProject, input *EnvironmentUpgrade) (*Environment, error) { - - resp := &Environment{} - - err := c.rancherClient.doAction(COMPOSE_PROJECT_TYPE, "upgrade", &resource.Resource, input, resp) - - return resp, err -} diff --git a/vendor/github.com/rancher/go-rancher/client/generated_compose_service.go b/vendor/github.com/rancher/go-rancher/client/generated_compose_service.go index 22f401e7..e8511e0b 100644 --- a/vendor/github.com/rancher/go-rancher/client/generated_compose_service.go +++ b/vendor/github.com/rancher/go-rancher/client/generated_compose_service.go @@ -11,6 +11,8 @@ type ComposeService struct { Created string `json:"created,omitempty" yaml:"created,omitempty"` + CurrentScale int64 `json:"currentScale,omitempty" yaml:"current_scale,omitempty"` + Data map[string]interface{} `json:"data,omitempty" yaml:"data,omitempty"` Description string `json:"description,omitempty" yaml:"description,omitempty"` @@ -37,6 +39,8 @@ type ComposeService struct { Scale int64 `json:"scale,omitempty" yaml:"scale,omitempty"` + ScalePolicy *ScalePolicy `json:"scalePolicy,omitempty" yaml:"scale_policy,omitempty"` + SelectorContainer string `json:"selectorContainer,omitempty" yaml:"selector_container,omitempty"` SelectorLink string `json:"selectorLink,omitempty" yaml:"selector_link,omitempty"` @@ -74,31 +78,17 @@ type ComposeServiceOperations interface { ActionActivate(*ComposeService) (*Service, error) - ActionAddservicelink(*ComposeService, *AddRemoveServiceLinkInput) (*Service, error) - ActionCancelrollback(*ComposeService) (*Service, error) ActionCancelupgrade(*ComposeService) (*Service, error) ActionCreate(*ComposeService) (*Service, error) - ActionDeactivate(*ComposeService) (*Service, error) - ActionFinishupgrade(*ComposeService) (*Service, error) ActionRemove(*ComposeService) (*Service, error) - ActionRemoveservicelink(*ComposeService, *AddRemoveServiceLinkInput) (*Service, error) - - ActionRestart(*ComposeService, *ServiceRestart) (*Service, error) - ActionRollback(*ComposeService) (*Service, error) - - ActionSetservicelinks(*ComposeService, *SetServiceLinksInput) (*Service, error) - - ActionUpdate(*ComposeService) (*Service, error) - - ActionUpgrade(*ComposeService, *ServiceUpgrade) (*Service, error) } func newComposeServiceClient(rancherClient *RancherClient) *ComposeServiceClient { @@ -149,15 +139,6 @@ func (c *ComposeServiceClient) ActionActivate(resource *ComposeService) (*Servic return resp, err } -func (c *ComposeServiceClient) ActionAddservicelink(resource *ComposeService, input *AddRemoveServiceLinkInput) (*Service, error) { - - resp := &Service{} - - err := c.rancherClient.doAction(COMPOSE_SERVICE_TYPE, "addservicelink", &resource.Resource, input, resp) - - return resp, err -} - func (c *ComposeServiceClient) ActionCancelrollback(resource *ComposeService) (*Service, error) { resp := &Service{} @@ -185,15 +166,6 @@ func (c *ComposeServiceClient) ActionCreate(resource *ComposeService) (*Service, return resp, err } -func (c *ComposeServiceClient) ActionDeactivate(resource *ComposeService) (*Service, error) { - - resp := &Service{} - - err := c.rancherClient.doAction(COMPOSE_SERVICE_TYPE, "deactivate", &resource.Resource, nil, resp) - - return resp, err -} - func (c *ComposeServiceClient) ActionFinishupgrade(resource *ComposeService) (*Service, error) { resp := &Service{} @@ -212,24 +184,6 @@ func (c *ComposeServiceClient) ActionRemove(resource *ComposeService) (*Service, return resp, err } -func (c *ComposeServiceClient) ActionRemoveservicelink(resource *ComposeService, input *AddRemoveServiceLinkInput) (*Service, error) { - - resp := &Service{} - - err := c.rancherClient.doAction(COMPOSE_SERVICE_TYPE, "removeservicelink", &resource.Resource, input, resp) - - return resp, err -} - -func (c *ComposeServiceClient) ActionRestart(resource *ComposeService, input *ServiceRestart) (*Service, error) { - - resp := &Service{} - - err := c.rancherClient.doAction(COMPOSE_SERVICE_TYPE, "restart", &resource.Resource, input, resp) - - return resp, err -} - func (c *ComposeServiceClient) ActionRollback(resource *ComposeService) (*Service, error) { resp := &Service{} @@ -238,30 +192,3 @@ func (c *ComposeServiceClient) ActionRollback(resource *ComposeService) (*Servic return resp, err } - -func (c *ComposeServiceClient) ActionSetservicelinks(resource *ComposeService, input *SetServiceLinksInput) (*Service, error) { - - resp := &Service{} - - err := c.rancherClient.doAction(COMPOSE_SERVICE_TYPE, "setservicelinks", &resource.Resource, input, resp) - - return resp, err -} - -func (c *ComposeServiceClient) ActionUpdate(resource *ComposeService) (*Service, error) { - - resp := &Service{} - - err := c.rancherClient.doAction(COMPOSE_SERVICE_TYPE, "update", &resource.Resource, nil, resp) - - return resp, err -} - -func (c *ComposeServiceClient) ActionUpgrade(resource *ComposeService, input *ServiceUpgrade) (*Service, error) { - - resp := &Service{} - - err := c.rancherClient.doAction(COMPOSE_SERVICE_TYPE, "upgrade", &resource.Resource, input, resp) - - return resp, err -} diff --git a/vendor/github.com/rancher/go-rancher/client/generated_external_service.go b/vendor/github.com/rancher/go-rancher/client/generated_external_service.go index c6833390..6bdc9d7d 100644 --- a/vendor/github.com/rancher/go-rancher/client/generated_external_service.go +++ b/vendor/github.com/rancher/go-rancher/client/generated_external_service.go @@ -74,8 +74,6 @@ type ExternalServiceOperations interface { ActionActivate(*ExternalService) (*Service, error) - ActionAddservicelink(*ExternalService, *AddRemoveServiceLinkInput) (*Service, error) - ActionCancelrollback(*ExternalService) (*Service, error) ActionCancelupgrade(*ExternalService) (*Service, error) @@ -88,14 +86,10 @@ type ExternalServiceOperations interface { ActionRemove(*ExternalService) (*Service, error) - ActionRemoveservicelink(*ExternalService, *AddRemoveServiceLinkInput) (*Service, error) - ActionRestart(*ExternalService, *ServiceRestart) (*Service, error) ActionRollback(*ExternalService) (*Service, error) - ActionSetservicelinks(*ExternalService, *SetServiceLinksInput) (*Service, error) - ActionUpdate(*ExternalService) (*Service, error) ActionUpgrade(*ExternalService, *ServiceUpgrade) (*Service, error) @@ -149,15 +143,6 @@ func (c *ExternalServiceClient) ActionActivate(resource *ExternalService) (*Serv return resp, err } -func (c *ExternalServiceClient) ActionAddservicelink(resource *ExternalService, input *AddRemoveServiceLinkInput) (*Service, error) { - - resp := &Service{} - - err := c.rancherClient.doAction(EXTERNAL_SERVICE_TYPE, "addservicelink", &resource.Resource, input, resp) - - return resp, err -} - func (c *ExternalServiceClient) ActionCancelrollback(resource *ExternalService) (*Service, error) { resp := &Service{} @@ -212,15 +197,6 @@ func (c *ExternalServiceClient) ActionRemove(resource *ExternalService) (*Servic return resp, err } -func (c *ExternalServiceClient) ActionRemoveservicelink(resource *ExternalService, input *AddRemoveServiceLinkInput) (*Service, error) { - - resp := &Service{} - - err := c.rancherClient.doAction(EXTERNAL_SERVICE_TYPE, "removeservicelink", &resource.Resource, input, resp) - - return resp, err -} - func (c *ExternalServiceClient) ActionRestart(resource *ExternalService, input *ServiceRestart) (*Service, error) { resp := &Service{} @@ -239,15 +215,6 @@ func (c *ExternalServiceClient) ActionRollback(resource *ExternalService) (*Serv return resp, err } -func (c *ExternalServiceClient) ActionSetservicelinks(resource *ExternalService, input *SetServiceLinksInput) (*Service, error) { - - resp := &Service{} - - err := c.rancherClient.doAction(EXTERNAL_SERVICE_TYPE, "setservicelinks", &resource.Resource, input, resp) - - return resp, err -} - func (c *ExternalServiceClient) ActionUpdate(resource *ExternalService) (*Service, error) { resp := &Service{} diff --git a/vendor/github.com/rancher/go-rancher/client/generated_launch_config.go b/vendor/github.com/rancher/go-rancher/client/generated_launch_config.go index be4a6d9d..b24cf4b2 100644 --- a/vendor/github.com/rancher/go-rancher/client/generated_launch_config.go +++ b/vendor/github.com/rancher/go-rancher/client/generated_launch_config.go @@ -192,8 +192,6 @@ type LaunchConfigOperations interface { ActionExecute(*LaunchConfig, *ContainerExec) (*HostAccess, error) - ActionLogs(*LaunchConfig, *ContainerLogs) (*HostAccess, error) - ActionMigrate(*LaunchConfig) (*Instance, error) ActionProxy(*LaunchConfig, *ContainerProxy) (*HostAccess, error) @@ -314,15 +312,6 @@ func (c *LaunchConfigClient) ActionExecute(resource *LaunchConfig, input *Contai return resp, err } -func (c *LaunchConfigClient) ActionLogs(resource *LaunchConfig, input *ContainerLogs) (*HostAccess, error) { - - resp := &HostAccess{} - - err := c.rancherClient.doAction(LAUNCH_CONFIG_TYPE, "logs", &resource.Resource, input, resp) - - return resp, err -} - func (c *LaunchConfigClient) ActionMigrate(resource *LaunchConfig) (*Instance, error) { resp := &Instance{} diff --git a/vendor/github.com/rancher/go-rancher/client/generated_ldapconfig.go b/vendor/github.com/rancher/go-rancher/client/generated_ldapconfig.go index 94ddbf4f..f760cfc9 100644 --- a/vendor/github.com/rancher/go-rancher/client/generated_ldapconfig.go +++ b/vendor/github.com/rancher/go-rancher/client/generated_ldapconfig.go @@ -9,6 +9,8 @@ type Ldapconfig struct { AccessMode string `json:"accessMode,omitempty" yaml:"access_mode,omitempty"` + AllowedIdentities []interface{} `json:"allowedIdentities,omitempty" yaml:"allowed_identities,omitempty"` + ConnectionTimeout int64 `json:"connectionTimeout,omitempty" yaml:"connection_timeout,omitempty"` Domain string `json:"domain,omitempty" yaml:"domain,omitempty"` diff --git a/vendor/github.com/rancher/go-rancher/client/generated_load_balancer_service.go b/vendor/github.com/rancher/go-rancher/client/generated_load_balancer_service.go index 564da6f0..ad6b7ba2 100644 --- a/vendor/github.com/rancher/go-rancher/client/generated_load_balancer_service.go +++ b/vendor/github.com/rancher/go-rancher/client/generated_load_balancer_service.go @@ -15,6 +15,8 @@ type LoadBalancerService struct { Created string `json:"created,omitempty" yaml:"created,omitempty"` + CurrentScale int64 `json:"currentScale,omitempty" yaml:"current_scale,omitempty"` + Data map[string]interface{} `json:"data,omitempty" yaml:"data,omitempty"` DefaultCertificateId string `json:"defaultCertificateId,omitempty" yaml:"default_certificate_id,omitempty"` @@ -49,6 +51,8 @@ type LoadBalancerService struct { Scale int64 `json:"scale,omitempty" yaml:"scale,omitempty"` + ScalePolicy *ScalePolicy `json:"scalePolicy,omitempty" yaml:"scale_policy,omitempty"` + SelectorLink string `json:"selectorLink,omitempty" yaml:"selector_link,omitempty"` StartOnCreate bool `json:"startOnCreate,omitempty" yaml:"start_on_create,omitempty"` diff --git a/vendor/github.com/rancher/go-rancher/client/generated_scale_policy.go b/vendor/github.com/rancher/go-rancher/client/generated_scale_policy.go new file mode 100644 index 00000000..abcd1bb5 --- /dev/null +++ b/vendor/github.com/rancher/go-rancher/client/generated_scale_policy.go @@ -0,0 +1,71 @@ +package client + +const ( + SCALE_POLICY_TYPE = "scalePolicy" +) + +type ScalePolicy struct { + Resource + + Increment int64 `json:"increment,omitempty" yaml:"increment,omitempty"` + + Max int64 `json:"max,omitempty" yaml:"max,omitempty"` + + Min int64 `json:"min,omitempty" yaml:"min,omitempty"` +} + +type ScalePolicyCollection struct { + Collection + Data []ScalePolicy `json:"data,omitempty"` +} + +type ScalePolicyClient struct { + rancherClient *RancherClient +} + +type ScalePolicyOperations interface { + List(opts *ListOpts) (*ScalePolicyCollection, error) + Create(opts *ScalePolicy) (*ScalePolicy, error) + Update(existing *ScalePolicy, updates interface{}) (*ScalePolicy, error) + ById(id string) (*ScalePolicy, error) + Delete(container *ScalePolicy) error +} + +func newScalePolicyClient(rancherClient *RancherClient) *ScalePolicyClient { + return &ScalePolicyClient{ + rancherClient: rancherClient, + } +} + +func (c *ScalePolicyClient) Create(container *ScalePolicy) (*ScalePolicy, error) { + resp := &ScalePolicy{} + err := c.rancherClient.doCreate(SCALE_POLICY_TYPE, container, resp) + return resp, err +} + +func (c *ScalePolicyClient) Update(existing *ScalePolicy, updates interface{}) (*ScalePolicy, error) { + resp := &ScalePolicy{} + err := c.rancherClient.doUpdate(SCALE_POLICY_TYPE, &existing.Resource, updates, resp) + return resp, err +} + +func (c *ScalePolicyClient) List(opts *ListOpts) (*ScalePolicyCollection, error) { + resp := &ScalePolicyCollection{} + err := c.rancherClient.doList(SCALE_POLICY_TYPE, opts, resp) + return resp, err +} + +func (c *ScalePolicyClient) ById(id string) (*ScalePolicy, error) { + resp := &ScalePolicy{} + err := c.rancherClient.doById(SCALE_POLICY_TYPE, id, resp) + if apiError, ok := err.(*ApiError); ok { + if apiError.StatusCode == 404 { + return nil, nil + } + } + return resp, err +} + +func (c *ScalePolicyClient) Delete(container *ScalePolicy) error { + return c.rancherClient.doResourceDelete(SCALE_POLICY_TYPE, &container.Resource) +} diff --git a/vendor/github.com/rancher/go-rancher/client/generated_secondary_launch_config.go b/vendor/github.com/rancher/go-rancher/client/generated_secondary_launch_config.go index 629c0b09..ab742558 100644 --- a/vendor/github.com/rancher/go-rancher/client/generated_secondary_launch_config.go +++ b/vendor/github.com/rancher/go-rancher/client/generated_secondary_launch_config.go @@ -194,8 +194,6 @@ type SecondaryLaunchConfigOperations interface { ActionExecute(*SecondaryLaunchConfig, *ContainerExec) (*HostAccess, error) - ActionLogs(*SecondaryLaunchConfig, *ContainerLogs) (*HostAccess, error) - ActionMigrate(*SecondaryLaunchConfig) (*Instance, error) ActionProxy(*SecondaryLaunchConfig, *ContainerProxy) (*HostAccess, error) @@ -316,15 +314,6 @@ func (c *SecondaryLaunchConfigClient) ActionExecute(resource *SecondaryLaunchCon return resp, err } -func (c *SecondaryLaunchConfigClient) ActionLogs(resource *SecondaryLaunchConfig, input *ContainerLogs) (*HostAccess, error) { - - resp := &HostAccess{} - - err := c.rancherClient.doAction(SECONDARY_LAUNCH_CONFIG_TYPE, "logs", &resource.Resource, input, resp) - - return resp, err -} - func (c *SecondaryLaunchConfigClient) ActionMigrate(resource *SecondaryLaunchConfig) (*Instance, error) { resp := &Instance{} diff --git a/vendor/github.com/rancher/go-rancher/client/generated_service.go b/vendor/github.com/rancher/go-rancher/client/generated_service.go index 57d59a06..063bcff2 100644 --- a/vendor/github.com/rancher/go-rancher/client/generated_service.go +++ b/vendor/github.com/rancher/go-rancher/client/generated_service.go @@ -15,6 +15,8 @@ type Service struct { Created string `json:"created,omitempty" yaml:"created,omitempty"` + CurrentScale int64 `json:"currentScale,omitempty" yaml:"current_scale,omitempty"` + Data map[string]interface{} `json:"data,omitempty" yaml:"data,omitempty"` Description string `json:"description,omitempty" yaml:"description,omitempty"` @@ -45,6 +47,8 @@ type Service struct { Scale int64 `json:"scale,omitempty" yaml:"scale,omitempty"` + ScalePolicy *ScalePolicy `json:"scalePolicy,omitempty" yaml:"scale_policy,omitempty"` + SecondaryLaunchConfigs []interface{} `json:"secondaryLaunchConfigs,omitempty" yaml:"secondary_launch_configs,omitempty"` SelectorContainer string `json:"selectorContainer,omitempty" yaml:"selector_container,omitempty"` diff --git a/vendor/github.com/rancher/go-rancher/client/generated_volume.go b/vendor/github.com/rancher/go-rancher/client/generated_volume.go index e525f9b1..395deb6d 100644 --- a/vendor/github.com/rancher/go-rancher/client/generated_volume.go +++ b/vendor/github.com/rancher/go-rancher/client/generated_volume.go @@ -72,8 +72,6 @@ type VolumeOperations interface { ActionCreate(*Volume) (*Volume, error) - ActionDeactivate(*Volume) (*Volume, error) - ActionDeallocate(*Volume) (*Volume, error) ActionPurge(*Volume) (*Volume, error) @@ -157,15 +155,6 @@ func (c *VolumeClient) ActionCreate(resource *Volume) (*Volume, error) { return resp, err } -func (c *VolumeClient) ActionDeactivate(resource *Volume) (*Volume, error) { - - resp := &Volume{} - - err := c.rancherClient.doAction(VOLUME_TYPE, "deactivate", &resource.Resource, nil, resp) - - return resp, err -} - func (c *VolumeClient) ActionDeallocate(resource *Volume) (*Volume, error) { resp := &Volume{}