diff --git a/examples/00-authentication.go b/examples/00-authentication.go index 690c5dd..ace698d 100644 --- a/examples/00-authentication.go +++ b/examples/00-authentication.go @@ -47,10 +47,10 @@ func main() { // Authenticate with a project name, username, password. creds = openstack.AuthOpts{ - AuthUrl: config.Host, - ProjectName: config.ProjectName, - Username: config.Username, - Password: config.Password, + AuthUrl: config.Host, + ProjectName: config.ProjectName, + Username: config.Username, + Password: config.Password, } auth, err = openstack.DoAuthRequest(creds) if err != nil { @@ -64,10 +64,10 @@ func main() { // Authenticate with a project id, username, password. creds = openstack.AuthOpts{ - AuthUrl: config.Host, - ProjectId: config.ProjectID, - Username: config.Username, - Password: config.Password, + AuthUrl: config.Host, + ProjectId: config.ProjectID, + Username: config.Username, + Password: config.Password, } auth, err = openstack.DoAuthRequest(creds) if err != nil { diff --git a/examples/10-objectstore.go b/examples/10-objectstore.go index 8510138..da022d4 100644 --- a/examples/10-objectstore.go +++ b/examples/10-objectstore.go @@ -35,10 +35,10 @@ func main() { // that has active object storage. // Authenticate with a project name, username, password. creds := openstack.AuthOpts{ - AuthUrl: config.Host, - ProjectName: config.ProjectName, - Username: config.Username, - Password: config.Password, + AuthUrl: config.Host, + ProjectName: config.ProjectName, + Username: config.Username, + Password: config.Password, } auth, err := openstack.DoAuthRequest(creds) if err != nil { diff --git a/examples/30-image-v1.go b/examples/30-image-v1.go index 67bc0ad..cde09db 100644 --- a/examples/30-image-v1.go +++ b/examples/30-image-v1.go @@ -31,10 +31,10 @@ func main() { // Authenticate with a username, password, tenant id. creds := openstack.AuthOpts{ - AuthUrl: config.Host, - ProjectName: config.ProjectName, - Username: config.Username, - Password: config.Password, + AuthUrl: config.Host, + ProjectName: config.ProjectName, + Username: config.Username, + Password: config.Password, } auth, err := openstack.DoAuthRequest(creds) if err != nil { diff --git a/examples/40-volume-v2.go b/examples/40-volume-v2.go index 6c30803..7137c35 100644 --- a/examples/40-volume-v2.go +++ b/examples/40-volume-v2.go @@ -21,8 +21,8 @@ import ( "net/http" "time" - "git.openstack.org/openstack/golang-client.git/volume/v2" "git.openstack.org/openstack/golang-client.git/openstack" + "git.openstack.org/openstack/golang-client.git/volume/v2" ) // Volume examples. @@ -31,10 +31,10 @@ func main() { // Authenticate with a username, password, tenant id. creds := openstack.AuthOpts{ - AuthUrl: config.Host, - ProjectName: config.ProjectName, - Username: config.Username, - Password: config.Password, + AuthUrl: config.Host, + ProjectName: config.ProjectName, + Username: config.Username, + Password: config.Password, } auth, err := openstack.DoAuthRequest(creds) if err != nil { diff --git a/examples/setup.go b/examples/setup.go index b15716e..e633466 100644 --- a/examples/setup.go +++ b/examples/setup.go @@ -37,7 +37,7 @@ type testconfig struct { ProjectName string Container string ImageRegion string - Debug bool + Debug bool } // getConfig provides access to credentials in other tests and examples. diff --git a/identity/middleware/validation_test.go b/identity/middleware/validation_test.go index afa827d..dfd6768 100644 --- a/identity/middleware/validation_test.go +++ b/identity/middleware/validation_test.go @@ -30,10 +30,10 @@ const ( func getAuthOpts() openstack.AuthOpts { return openstack.AuthOpts{ - AuthUrl: "http://localhost:5000/v2.0", - ProjectName: "demo", - Username: "demo", - Password: "demo", + AuthUrl: "http://localhost:5000/v2.0", + ProjectName: "demo", + Username: "demo", + Password: "demo", } } diff --git a/objectstorage/v1/objectstorage_test.go b/objectstorage/v1/objectstorage_test.go index dbc23bd..b77c884 100644 --- a/objectstorage/v1/objectstorage_test.go +++ b/objectstorage/v1/objectstorage_test.go @@ -137,8 +137,7 @@ func TestDeleteContainer(t *testing.T) { defer apiServer.Close() sess := testGetSession() - if err := objectstorage.DeleteContainer(sess, apiServer.URL+containerPrefix, - ); err != nil { + if err := objectstorage.DeleteContainer(sess, apiServer.URL+containerPrefix); err != nil { t.Error(err) } } @@ -259,8 +258,7 @@ func TestCopyObject(t *testing.T) { defer apiServer.Close() sess := testGetSession() - if err := objectstorage.CopyObject(sess, apiServer.URL+objPrefix, destURL, - ); err != nil { + if err := objectstorage.CopyObject(sess, apiServer.URL+objPrefix, destURL); err != nil { t.Error(err) } } diff --git a/openstack/auth-password.go b/openstack/auth-password.go index c984cf0..a9a114d 100644 --- a/openstack/auth-password.go +++ b/openstack/auth-password.go @@ -61,7 +61,7 @@ func NewUserPassV2(ao AuthOpts) (upv2 *UserPassV2, err error) { Password: ao.Password, }, ProjectName: ao.ProjectName, - ProjectId: ao.ProjectId, + ProjectId: ao.ProjectId, }, } return upv2, nil diff --git a/openstack/auth.go b/openstack/auth.go index fd6c425..2219f49 100644 --- a/openstack/auth.go +++ b/openstack/auth.go @@ -75,7 +75,7 @@ func DoAuthRequest(authopts AuthOpts) (AuthRef, error) { return nil, err } - _, err = PostJSON(auth_mod.AuthUrl + "/tokens", nil, nil, &auth_mod, &auth) + _, err = PostJSON(auth_mod.AuthUrl+"/tokens", nil, nil, &auth_mod, &auth) if err != nil { return nil, err } diff --git a/openstack/session.go b/openstack/session.go index 16f9c41..8b27360 100644 --- a/openstack/session.go +++ b/openstack/session.go @@ -153,7 +153,7 @@ func (s *Session) RequestJSON( headers.Add("Content-Type", "application/json") } - resp, err = s.Request(method, url, params, headers, &bodyjson) + resp, err = s.Request(method, url, params, headers, &bodyjson) if err != nil { return nil, err } diff --git a/volume/v2/volume.go b/volume/v2/volume.go index 6b1a9f1..d144fef 100644 --- a/volume/v2/volume.go +++ b/volume/v2/volume.go @@ -48,46 +48,46 @@ type Service struct { // Response is a structure for all properties of // an volume for a non detailed query type Response struct { - ID string `json:"id"` - Links []map[string]string `json:"links"` - Name string `json:"name"` + ID string `json:"id"` + Links []map[string]string `json:"links"` + Name string `json:"name"` } // DetailResponse is a structure for all properties of // an volume for a detailed query type DetailResponse struct { - ID string `json:"id"` - Attachments []map[string]string `json:"attachments"` - Links []map[string]string `json:"links"` - Metadata map[string]string `json:"metadata"` - Protected bool `json:"protected"` - Status string `json:"status"` - MigrationStatus string `json:"migration_status"` - UserID string `json:"user_id"` - Encrypted bool `json:"encrypted"` - Multiattach bool `json:"multiattach"` - CreatedAt util.RFC8601DateTime `json:"created_at"` - Description string `json:"description"` - Volume_type string `json:"volume_type"` - Name string `json:"name"` - Source_volid string `json:"source_volid"` - Snapshot_id string `json:"snapshot_id"` - Size int64 `json:"size"` + ID string `json:"id"` + Attachments []map[string]string `json:"attachments"` + Links []map[string]string `json:"links"` + Metadata map[string]string `json:"metadata"` + Protected bool `json:"protected"` + Status string `json:"status"` + MigrationStatus string `json:"migration_status"` + UserID string `json:"user_id"` + Encrypted bool `json:"encrypted"` + Multiattach bool `json:"multiattach"` + CreatedAt util.RFC8601DateTime `json:"created_at"` + Description string `json:"description"` + Volume_type string `json:"volume_type"` + Name string `json:"name"` + Source_volid string `json:"source_volid"` + Snapshot_id string `json:"snapshot_id"` + Size int64 `json:"size"` - Aavailability_zone string `json:"availability_zone"` - Rreplication_status string `json:"replication_status"` - Consistencygroup_id string `json:"consistencygroup_id"` + Aavailability_zone string `json:"availability_zone"` + Rreplication_status string `json:"replication_status"` + Consistencygroup_id string `json:"consistencygroup_id"` } // QueryParameters is a structure that // contains the filter, sort, and paging parameters for // an volume or volumedetail query. type QueryParameters struct { - All_tenant int64 - Marker string - Limit int64 - SortKey string - SortDirection SortDirection + All_tenant int64 + Marker string + Limit int64 + SortKey string + SortDirection SortDirection } // SortDirection of the sort, ascending or descending. diff --git a/volume/v2/volume_test.go b/volume/v2/volume_test.go index eecf734..5a7ecd9 100644 --- a/volume/v2/volume_test.go +++ b/volume/v2/volume_test.go @@ -21,10 +21,10 @@ import ( "strings" "testing" - "git.openstack.org/openstack/golang-client.git/volume/v2" "git.openstack.org/openstack/golang-client.git/openstack" "git.openstack.org/openstack/golang-client.git/testUtil" "git.openstack.org/openstack/golang-client.git/util" + "git.openstack.org/openstack/golang-client.git/volume/v2" ) var tokn = "ae5aebe5-6a5d-4a40-840a-9736a067aff4" @@ -40,9 +40,9 @@ func TestListVolumes(t *testing.T) { t.Error(errors.New("Incorrect number of volumes found")) } expectedVolume := volume.Response{ - Name: "volume_test1", - ID: "f5fc9874-fc89-4814-a358-23ba83a6115f", - Links: []map[string]string{{"href": "http://172.16.197.131:8776/v2/1d8837c5fcef4892951397df97661f97/volumes/f5fc9874-fc89-4814-a358-23ba83a6115f", "rel": "self"}, + Name: "volume_test1", + ID: "f5fc9874-fc89-4814-a358-23ba83a6115f", + Links: []map[string]string{{"href": "http://172.16.197.131:8776/v2/1d8837c5fcef4892951397df97661f97/volumes/f5fc9874-fc89-4814-a358-23ba83a6115f", "rel": "self"}, {"href": "http://172.16.197.131:8776/1d8837c5fcef4892951397df97661f97/volumes/f5fc9874-fc89-4814-a358-23ba83a6115f", "rel": "bookmark"}}} // Verify first one matches expected values testUtil.Equals(t, expectedVolume, volumes[0]) @@ -63,28 +63,28 @@ func TestListVolumeDetails(t *testing.T) { } createdAt, _ := util.NewDateTime(`"2014-09-29T14:44:31"`) expectedVolumeDetail := volume.DetailResponse{ - ID: "30becf77-63fe-4f5e-9507-a0578ffe0949", - Attachments: []map[string]string{{"attachment_id": "ddb2ac07-ed62-49eb-93da-73b258dd9bec", "host_name": "host_test", "volume_id": "30becf77-63fe-4f5e-9507-a0578ffe0949", "device": "/dev/vdb", "id": "30becf77-63fe-4f5e-9507-a0578ffe0949", "server_id": "0f081aae-1b0c-4b89-930c-5f2562460c72"}}, - Links: []map[string]string{{"href": "http://172.16.197.131:8776/v2/1d8837c5fcef4892951397df97661f97/volumes/30becf77-63fe-4f5e-9507-a0578ffe0949", "rel": "self"}, - {"href": "http://172.16.197.131:8776/1d8837c5fcef4892951397df97661f97/volumes/30becf77-63fe-4f5e-9507-a0578ffe0949", "rel": "bookmark"}}, - Metadata: map[string]string{"readonly": "false", "attached_mode": "rw"}, - Protected: false, - Status: "available", - MigrationStatus: "", - UserID: "a971aa69-c61a-4a49-b392-b0e41609bc5d", - Encrypted: false, - Multiattach: false, - CreatedAt: createdAt, - Description: "test volume", - Volume_type: "test_type", - Name: "test_volume", - Source_volid: "4b58bbb8-3b00-4f87-8243-8c622707bbab", - Snapshot_id: "cc488e4a-9649-4e5f-ad12-20ab37c683b5", - Size: 2, + ID: "30becf77-63fe-4f5e-9507-a0578ffe0949", + Attachments: []map[string]string{{"attachment_id": "ddb2ac07-ed62-49eb-93da-73b258dd9bec", "host_name": "host_test", "volume_id": "30becf77-63fe-4f5e-9507-a0578ffe0949", "device": "/dev/vdb", "id": "30becf77-63fe-4f5e-9507-a0578ffe0949", "server_id": "0f081aae-1b0c-4b89-930c-5f2562460c72"}}, + Links: []map[string]string{{"href": "http://172.16.197.131:8776/v2/1d8837c5fcef4892951397df97661f97/volumes/30becf77-63fe-4f5e-9507-a0578ffe0949", "rel": "self"}, + {"href": "http://172.16.197.131:8776/1d8837c5fcef4892951397df97661f97/volumes/30becf77-63fe-4f5e-9507-a0578ffe0949", "rel": "bookmark"}}, + Metadata: map[string]string{"readonly": "false", "attached_mode": "rw"}, + Protected: false, + Status: "available", + MigrationStatus: "", + UserID: "a971aa69-c61a-4a49-b392-b0e41609bc5d", + Encrypted: false, + Multiattach: false, + CreatedAt: createdAt, + Description: "test volume", + Volume_type: "test_type", + Name: "test_volume", + Source_volid: "4b58bbb8-3b00-4f87-8243-8c622707bbab", + Snapshot_id: "cc488e4a-9649-4e5f-ad12-20ab37c683b5", + Size: 2, - Aavailability_zone: "default_cluster", - Rreplication_status: "", - Consistencygroup_id: ""} + Aavailability_zone: "default_cluster", + Rreplication_status: "", + Consistencygroup_id: ""} testUtil.Equals(t, expectedVolumeDetail, volumes[0]) } @@ -98,7 +98,7 @@ func TestLimitFilterUrlProduced(t *testing.T) { func TestAll_tenantFilterUrlProduced(t *testing.T) { testVolumeQueryParameter(t, "volumes?all_tenant=1", - volume.QueryParameters{All_tenant: 1}) + volume.QueryParameters{All_tenant: 1}) } func TestMarkerUrlProduced(t *testing.T) {