Skip to content

Commit da281ed

Browse files
committed
refactoring: show metadata -> get metadata
1 parent 5c226fe commit da281ed

6 files changed

Lines changed: 18 additions & 18 deletions

File tree

acceptance/openstack/sharedfilesystems/v2/shares_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -248,9 +248,9 @@ func TestShareMetadata(t *testing.T) {
248248
t.Fatalf("Unable to delete share metadatum: %v", err)
249249
}
250250

251-
metadata, err = shares.ShowMetadata(client, share.ID).Extract()
251+
metadata, err = shares.GetMetadata(client, share.ID).Extract()
252252
if err != nil {
253-
t.Fatalf("Unable to show share metadata: %v", err)
253+
t.Fatalf("Unable to get share metadata: %v", err)
254254
}
255255

256256
if metadata == nil || len(metadata) != 0 {

openstack/sharedfilesystems/v2/shares/requests.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -380,10 +380,10 @@ func Update(client *gophercloud.ServiceClient, id string, opts UpdateOptsBuilder
380380
return
381381
}
382382

383-
// ShowMetadata retrieves metadata of the specified share. To extract the retrieved
384-
// metadata from the response, call the Extract method on the ShowMetadataResult.
385-
func ShowMetadata(client *gophercloud.ServiceClient, id string) (r ShowMetadataResult) {
386-
_, r.Err = client.Get(showMetadataURL(client, id), &r.Body, nil)
383+
// GetMetadata retrieves metadata of the specified share. To extract the retrieved
384+
// metadata from the response, call the Extract method on the GetMetadataResult.
385+
func GetMetadata(client *gophercloud.ServiceClient, id string) (r GetMetadataResult) {
386+
_, r.Err = client.Get(getMetadataURL(client, id), &r.Body, nil)
387387
return
388388
}
389389

openstack/sharedfilesystems/v2/shares/results.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -325,13 +325,13 @@ type ShrinkResult struct {
325325
gophercloud.ErrResult
326326
}
327327

328-
// ShowMetadataResult contains the response body and error from a ShowMetadata request.
329-
type ShowMetadataResult struct {
328+
// GetMetadataResult contains the response body and error from a GetMetadata request.
329+
type GetMetadataResult struct {
330330
gophercloud.Result
331331
}
332332

333-
// Extract will get the string-string map from ShowMetadataResult
334-
func (r ShowMetadataResult) Extract() (map[string]string, error) {
333+
// Extract will get the string-string map from GetMetadataResult
334+
func (r GetMetadataResult) Extract() (map[string]string, error) {
335335
var s struct {
336336
Metadata map[string]string `json:"metadata"`
337337
}

openstack/sharedfilesystems/v2/shares/testing/fixtures.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -419,21 +419,21 @@ func MockShrinkResponse(t *testing.T) {
419419
})
420420
}
421421

422-
var showMetadataResponse = `{
422+
var getMetadataResponse = `{
423423
"metadata": {
424424
"foo": "bar"
425425
}
426426
}`
427427

428-
// MockShowMetadataResponse creates a mock show metadata response
429-
func MockShowMetadataResponse(t *testing.T) {
428+
// MockGetMetadataResponse creates a mock show metadata response
429+
func MockGetMetadataResponse(t *testing.T) {
430430
th.Mux.HandleFunc(shareEndpoint+"/"+shareID+"/metadata", func(w http.ResponseWriter, r *http.Request) {
431431
th.TestMethod(t, r, "GET")
432432
th.TestHeader(t, r, "X-Auth-Token", fake.TokenID)
433433
th.TestHeader(t, r, "Accept", "application/json")
434434
w.Header().Add("Content-Type", "application/json")
435435
w.WriteHeader(http.StatusOK)
436-
fmt.Fprint(w, showMetadataResponse)
436+
fmt.Fprint(w, getMetadataResponse)
437437
})
438438
}
439439

openstack/sharedfilesystems/v2/shares/testing/request_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -284,15 +284,15 @@ func TestShrinkSuccess(t *testing.T) {
284284
th.AssertNoErr(t, err)
285285
}
286286

287-
func TestShowMetadataSuccess(t *testing.T) {
287+
func TestGetMetadataSuccess(t *testing.T) {
288288
th.SetupHTTP()
289289
defer th.TeardownHTTP()
290290

291-
MockShowMetadataResponse(t)
291+
MockGetMetadataResponse(t)
292292

293293
c := client.ServiceClient()
294294

295-
actual, err := shares.ShowMetadata(c, shareID).Extract()
295+
actual, err := shares.GetMetadata(c, shareID).Extract()
296296
th.AssertNoErr(t, err)
297297
th.AssertDeepEquals(t, map[string]string{"foo": "bar"}, actual)
298298
}

openstack/sharedfilesystems/v2/shares/urls.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ func shrinkURL(c *gophercloud.ServiceClient, id string) string {
4646
return c.ServiceURL("shares", id, "action")
4747
}
4848

49-
func showMetadataURL(c *gophercloud.ServiceClient, id string) string {
49+
func getMetadataURL(c *gophercloud.ServiceClient, id string) string {
5050
return c.ServiceURL("shares", id, "metadata")
5151
}
5252

0 commit comments

Comments
 (0)