Skip to content

Commit

Permalink
vendor: Update cloud-sdk-go to v1.0.0-beta2 (#211)
Browse files Browse the repository at this point in the history
Updates `elastic/[email protected]` making all the necessary
adjustments while doing so.

Signed-off-by: Marc Lopez <[email protected]>
  • Loading branch information
marclop authored Mar 13, 2020
1 parent d15a85f commit cdd9169
Show file tree
Hide file tree
Showing 35 changed files with 135 additions and 181 deletions.
2 changes: 1 addition & 1 deletion cmd/deployment/elasticsearch/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ var startElasticsearchCmd = &cobra.Command{
return err
}

if c.Status == "started" {
if *c.Status == "started" {
return fmt.Errorf("cluster [%s][Elasticsearch]: is already started", args[0])
}

Expand Down
2 changes: 1 addition & 1 deletion cmd/deployment/kibana/show_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ func TestRunShowKibanaClusterCmd(t *testing.T) {
cmd: showKibanaClusterCmd,
args: []string{"d558cdf210dc4737960906a83b1db52c"},
},
err: "Get http://localhost/api/v1/clusters/kibana/d558cdf210dc4737960906a83b1db52c?convert_legacy_plans=false&show_metadata=false&show_plan_defaults=true&show_plan_logs=false&show_plans=false&show_settings=false",
err: `Get http://somehost/api/v1/clusters/kibana/d558cdf210dc4737960906a83b1db52c?convert_legacy_plans=false&show_metadata=false&show_plan_defaults=true&show_plan_logs=false&show_plans=false&show_settings=false`,
},
}

Expand Down
2 changes: 1 addition & 1 deletion cmd/deployment/kibana/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ var startKibanaCmd = &cobra.Command{
return err
}

if c.Status == "started" {
if *c.Status == "started" {
return fmt.Errorf("cluster [%s][Kibana]: is already started", args[0])
}

Expand Down
2 changes: 1 addition & 1 deletion cmd/util/testutils/testutils.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func MockInitApp() error {
OutputDevice: output.NewDevice(os.Stdout),
ErrorDevice: os.Stderr,
Output: "json",
Host: "http://localhost",
Host: "http://somehost",
APIKey: "helloiamakey",
}

Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ require (
github.com/chzyer/logex v1.1.10 // indirect
github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1 // indirect
github.com/davecgh/go-spew v1.1.1
github.com/elastic/cloud-sdk-go v1.0.0-beta1.0.20200305114619-8877c73631de
github.com/elastic/cloud-sdk-go v1.0.0-beta2
github.com/ghodss/yaml v1.0.0
github.com/go-openapi/runtime v0.19.12
github.com/go-openapi/strfmt v0.19.5
github.com/hashicorp/go-multierror v1.0.0
github.com/marclop/elasticsearch-cli v0.0.0-20190212132418-ee09f7ae57f1
github.com/marclop/elasticsearch-cli v0.0.0-20190212133917-c1d1bf9d46e4
github.com/pkg/errors v0.9.1
github.com/pmezard/go-difflib v1.0.0
github.com/spf13/cobra v0.0.6
Expand Down
45 changes: 28 additions & 17 deletions go.sum

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion pkg/deployment/apm/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func Delete(params DeleteParams) error {
return api.UnwrapError(err)
}

if dep.Status != "stopped" {
if *dep.Status != "stopped" {
return errors.New("apm delete: deployment must be stopped")
}

Expand Down
5 changes: 3 additions & 2 deletions pkg/deployment/apm/delete_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import (
"github.com/elastic/cloud-sdk-go/pkg/api/mock"
"github.com/elastic/cloud-sdk-go/pkg/models"
"github.com/elastic/cloud-sdk-go/pkg/output"
"github.com/elastic/cloud-sdk-go/pkg/util/ec"
multierror "github.com/hashicorp/go-multierror"

"github.com/elastic/ecctl/pkg/util"
Expand Down Expand Up @@ -57,7 +58,7 @@ func TestDelete(t *testing.T) {
ID: "d324608c97154bdba2dff97511d40368",
API: api.NewMock(mock.Response{Response: http.Response{
Body: mock.NewStructBody(models.ApmInfo{
Status: "started",
Status: ec.String("started"),
}),
StatusCode: 200,
}}),
Expand All @@ -71,7 +72,7 @@ func TestDelete(t *testing.T) {
API: api.NewMock(
mock.Response{Response: http.Response{
Body: mock.NewStructBody(models.ApmInfo{
Status: "stopped",
Status: ec.String("stopped"),
}),
StatusCode: 200,
}},
Expand Down
6 changes: 3 additions & 3 deletions pkg/deployment/apm/plan_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ func TestCancelPlan(t *testing.T) {
ID: "d324608c97154bdba2dff97511d40368",
API: api.NewMock(mock.Response{Response: http.Response{
Body: mock.NewStructBody(models.ApmInfo{
Status: "success",
Status: ec.String("success"),
}),
StatusCode: 200,
}}),
Expand Down Expand Up @@ -240,7 +240,7 @@ func TestCancelPlan(t *testing.T) {
ID: "d324608c97154bdba2dff97511d40368",
API: api.NewMock(util.AppendTrackResponses(mock.Response{Response: http.Response{
Body: mock.NewStructBody(models.ApmInfo{
Status: "success",
Status: ec.String("success"),
}),
StatusCode: 200,
}})...),
Expand Down Expand Up @@ -363,7 +363,7 @@ func TestReapplyLatestPlanAttempt(t *testing.T) {
},
want: &models.ApmCrudResponse{
ApmID: "181a0cc28c9143b5a0bda51cd65676b3",
SecretToken: "wPYRlBJauhJGEZU6Ug",
SecretToken: ec.String("wPYRlBJauhJGEZU6Ug"),
},
},
}
Expand Down
12 changes: 6 additions & 6 deletions pkg/deployment/apm/read_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,14 @@ func TestList(t *testing.T) {
ElasticsearchCluster: &models.TargetElasticsearchCluster{
ElasticsearchID: ec.String("d324608c97154bdba2dff97511d40368"),
},
Status: "started",
Status: ec.String("started"),
},
{
ID: ec.String("d324608c97154bdba2dff97511d40368"),
ElasticsearchCluster: &models.TargetElasticsearchCluster{
ElasticsearchID: ec.String("86d2ec6217774eedb93ba38483141997"),
},
Status: "stopped",
Status: ec.String("stopped"),
},
},
}),
Expand All @@ -81,14 +81,14 @@ func TestList(t *testing.T) {
ElasticsearchCluster: &models.TargetElasticsearchCluster{
ElasticsearchID: ec.String("d324608c97154bdba2dff97511d40368"),
},
Status: "started",
Status: ec.String("started"),
},
{
ID: ec.String("d324608c97154bdba2dff97511d40368"),
ElasticsearchCluster: &models.TargetElasticsearchCluster{
ElasticsearchID: ec.String("86d2ec6217774eedb93ba38483141997"),
},
Status: "stopped",
Status: ec.String("stopped"),
},
},
},
Expand Down Expand Up @@ -135,7 +135,7 @@ func TestShow(t *testing.T) {
ElasticsearchCluster: &models.TargetElasticsearchCluster{
ElasticsearchID: ec.String("d324608c97154bdba2dff97511d40368"),
},
Status: "started",
Status: ec.String("started"),
}),
StatusCode: 200,
}}),
Expand All @@ -145,7 +145,7 @@ func TestShow(t *testing.T) {
ElasticsearchCluster: &models.TargetElasticsearchCluster{
ElasticsearchID: ec.String("d324608c97154bdba2dff97511d40368"),
},
Status: "started",
Status: ec.String("started"),
},
},
{
Expand Down
12 changes: 6 additions & 6 deletions pkg/deployment/create_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,8 @@ func TestCreate(t *testing.T) {
{
CloudID: "my_elasticsearch_cluster:MTkyLjE2OC40NC4xMC5pcC5lcy5pbzo5MjQzJDAxZmEyODU4NzZmNTRlNjk5ZGEzZDNkNmZkOGE4NGYxJGNhOGFjNjU1NWYwZDQzZDhiYTEwNDhjOThlYTYwMjY1",
Credentials: &models.ClusterCredentials{
Password: "6n7Q5fXoFZDnpLOVPi5FnVLa",
Username: "elastic",
Password: ec.String("6n7Q5fXoFZDnpLOVPi5FnVLa"),
Username: ec.String("elastic"),
},
ID: ec.String("01fa285876f54e699da3d3d6fd8a84f1"),
Kind: ec.String("elasticsearch"),
Expand Down Expand Up @@ -154,8 +154,8 @@ func TestCreate(t *testing.T) {
{
CloudID: "my_elasticsearch_cluster:MTkyLjE2OC40NC4xMC5pcC5lcy5pbzo5MjQzJDAxZmEyODU4NzZmNTRlNjk5ZGEzZDNkNmZkOGE4NGYxJGNhOGFjNjU1NWYwZDQzZDhiYTEwNDhjOThlYTYwMjY1",
Credentials: &models.ClusterCredentials{
Password: "6n7Q5fXoFZDnpLOVPi5FnVLa",
Username: "elastic",
Password: ec.String("6n7Q5fXoFZDnpLOVPi5FnVLa"),
Username: ec.String("elastic"),
},
ID: ec.String("01fa285876f54e699da3d3d6fd8a84f1"),
Kind: ec.String("elasticsearch"),
Expand Down Expand Up @@ -201,8 +201,8 @@ func TestCreate(t *testing.T) {
{
CloudID: "my_elasticsearch_cluster:MTkyLjE2OC40NC4xMC5pcC5lcy5pbzo5MjQzJDAxZmEyODU4NzZmNTRlNjk5ZGEzZDNkNmZkOGE4NGYxJGNhOGFjNjU1NWYwZDQzZDhiYTEwNDhjOThlYTYwMjY1",
Credentials: &models.ClusterCredentials{
Password: "6n7Q5fXoFZDnpLOVPi5FnVLa",
Username: "elastic",
Password: ec.String("6n7Q5fXoFZDnpLOVPi5FnVLa"),
Username: ec.String("elastic"),
},
ID: ec.String("01fa285876f54e699da3d3d6fd8a84f1"),
Kind: ec.String("elasticsearch"),
Expand Down
7 changes: 4 additions & 3 deletions pkg/deployment/depresource/apm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ func TestNewApm(t *testing.T) {
{},
},
}
internalErrorBytes, _ := json.MarshalIndent(internalError, "", " ")
internalErrorBytes, _ := json.Marshal(internalError)
internalErrorBytesIndented, _ := json.MarshalIndent(internalError, "", " ")

var getResponse = models.DeploymentGetResponse{
Resources: &models.DeploymentResources{
Expand Down Expand Up @@ -115,7 +116,7 @@ func TestNewApm(t *testing.T) {
API: api.NewMock(mock.New500Response(mock.NewStructBody(internalError))),
Region: "ece-region",
}},
err: errors.New(string(internalErrorBytes)),
err: errors.New(string(internalErrorBytes) + "\n"),
},
{
name: "obtains the deployment info but fails getting the template ID info",
Expand Down Expand Up @@ -146,7 +147,7 @@ func TestNewApm(t *testing.T) {
),
Region: "ece-region",
}},
err: errors.New(string(internalErrorBytes)),
err: errors.New(string(internalErrorBytesIndented)),
},
{
name: "obtains the deployment template but it's an invalid template for appsearch",
Expand Down
7 changes: 4 additions & 3 deletions pkg/deployment/depresource/appsearch_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ func TestNewAppSearch(t *testing.T) {
{},
},
}
internalErrorBytes, _ := json.MarshalIndent(internalError, "", " ")
internalErrorBytes, _ := json.Marshal(internalError)
internalErrorBytesIndented, _ := json.MarshalIndent(internalError, "", " ")

var getResponse = models.DeploymentGetResponse{
Resources: &models.DeploymentResources{
Expand Down Expand Up @@ -115,7 +116,7 @@ func TestNewAppSearch(t *testing.T) {
API: api.NewMock(mock.New500Response(mock.NewStructBody(internalError))),
Region: "ece-region",
}},
err: errors.New(string(internalErrorBytes)),
err: errors.New(string(internalErrorBytes) + "\n"),
},
{
name: "obtains the deployment info but fails getting the template ID info",
Expand Down Expand Up @@ -146,7 +147,7 @@ func TestNewAppSearch(t *testing.T) {
),
Region: "ece-region",
}},
err: errors.New(string(internalErrorBytes)),
err: errors.New(string(internalErrorBytesIndented)),
},
{
name: "obtains the deployment template but it's an invalid template for appsearch",
Expand Down
10 changes: 1 addition & 9 deletions pkg/deployment/depresource/cancel_plan_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,7 @@ func TestCancelPlan(t *testing.T) {
},
}
internalErrorBytes, _ := json.MarshalIndent(internalError, "", " ")
var errGet500 = `failed auto-discovering the resource ref id: {
"errors": [
{
"code": "deployment.missing",
"fields": null,
"message": null
}
]
}`
var errGet500 = `failed auto-discovering the resource ref id: {"errors":[{"code":"deployment.missing","fields":null,"message":null}]}` + "\n"
type args struct {
params CancelPlanParams
}
Expand Down
7 changes: 4 additions & 3 deletions pkg/deployment/depresource/kibana_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ func TestNewKibana(t *testing.T) {
{},
},
}
internalErrorBytes, _ := json.MarshalIndent(internalError, "", " ")
internalErrorBytes, _ := json.Marshal(internalError)
internalErrorBytesIndent, _ := json.MarshalIndent(internalError, "", " ")

var getResponse = models.DeploymentGetResponse{
Resources: &models.DeploymentResources{
Expand Down Expand Up @@ -115,7 +116,7 @@ func TestNewKibana(t *testing.T) {
API: api.NewMock(mock.New500Response(mock.NewStructBody(internalError))),
Region: "ece-region",
}},
err: errors.New(string(internalErrorBytes)),
err: errors.New(string(internalErrorBytes) + "\n"),
},
{
name: "obtains the deployment info but fails getting the template ID info",
Expand Down Expand Up @@ -146,7 +147,7 @@ func TestNewKibana(t *testing.T) {
),
Region: "ece-region",
}},
err: errors.New(string(internalErrorBytes)),
err: errors.New(string(internalErrorBytesIndent)),
},
{
name: "obtains the deployment template but it's an invalid template for kibana",
Expand Down
20 changes: 2 additions & 18 deletions pkg/deployment/depresource/start_maintenance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,7 @@ func TestStartMaintenanceMode(t *testing.T) {
},
}
internalErrorBytes, _ := json.MarshalIndent(internalError, "", " ")
var errGet500 = `failed auto-discovering the resource ref id: {
"errors": [
{
"code": "deployment.missing",
"fields": null,
"message": null
}
]
}`
var errGet500 = `failed auto-discovering the resource ref id: {"errors":[{"code":"deployment.missing","fields":null,"message":null}]}` + "\n"
type args struct {
params StartParams
}
Expand Down Expand Up @@ -154,15 +146,7 @@ func TestStartInstancesMaintenanceMode(t *testing.T) {
},
}
internalErrorBytes, _ := json.MarshalIndent(internalError, "", " ")
var errGet500 = `failed auto-discovering the resource ref id: {
"errors": [
{
"code": "deployment.missing",
"fields": null,
"message": null
}
]
}`
var errGet500 = `failed auto-discovering the resource ref id: {"errors":[{"code":"deployment.missing","fields":null,"message":null}]}` + "\n"
type args struct {
params StartInstancesParams
}
Expand Down
20 changes: 2 additions & 18 deletions pkg/deployment/depresource/start_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,15 +117,7 @@ func TestStart(t *testing.T) {
},
}
internalErrorBytes, _ := json.MarshalIndent(internalError, "", " ")
var errGet500 = `failed auto-discovering the resource ref id: {
"errors": [
{
"code": "deployment.missing",
"fields": null,
"message": null
}
]
}`
var errGet500 = `failed auto-discovering the resource ref id: {"errors":[{"code":"deployment.missing","fields":null,"message":null}]}` + "\n"
type args struct {
params StartParams
}
Expand Down Expand Up @@ -231,15 +223,7 @@ func TestStartInstances(t *testing.T) {
},
}
internalErrorBytes, _ := json.MarshalIndent(internalError, "", " ")
var errGet500 = `failed auto-discovering the resource ref id: {
"errors": [
{
"code": "deployment.missing",
"fields": null,
"message": null
}
]
}`
var errGet500 = `failed auto-discovering the resource ref id: {"errors":[{"code":"deployment.missing","fields":null,"message":null}]}` + "\n"
type args struct {
params StartInstancesParams
}
Expand Down
10 changes: 1 addition & 9 deletions pkg/deployment/depresource/stop_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,7 @@ var internalError = models.BasicFailedReply{
},
}
var internalErrorBytes, _ = json.MarshalIndent(internalError, "", " ")
var errGet500 = `failed auto-discovering the resource ref id: {
"errors": [
{
"code": "deployment.missing",
"fields": null,
"message": null
}
]
}`
var errGet500 = `failed auto-discovering the resource ref id: {"errors":[{"code":"deployment.missing","fields":null,"message":null}]}` + "\n"

func TestStopInstancesParams_Validate(t *testing.T) {
tests := []struct {
Expand Down
2 changes: 1 addition & 1 deletion pkg/deployment/elasticsearch/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func DeleteCluster(params DeleteClusterParams) error {

// Even though the cluster state can change in between querying the state
// and performing the shutdown, it's not that relevant and thus accepted.
if res.Status != stoppedState {
if *res.Status != stoppedState {
return errors.New("elasticsearch delete: deployment must be stopped")
}

Expand Down
Loading

0 comments on commit cdd9169

Please sign in to comment.