Skip to content

Commit a6ed2ee

Browse files
committed
[fix] minor fixes
1 parent 2e0a674 commit a6ed2ee

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

openstack/swr/v2/policy/Create.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,22 +14,22 @@ type CreateOpts struct {
1414
}
1515

1616
// This function is used to create an image retention policy.
17-
func Create(client *golangsdk.ServiceClient, organization string, repository string, opts CreateOpts) (string, error) {
17+
func Create(client *golangsdk.ServiceClient, organization string, repository string, opts CreateOpts) (int, error) {
1818
b, err := build.RequestBody(opts, "")
1919
if err != nil {
20-
return "", err
20+
return -1, err
2121
}
2222

2323
// POST /v2/manage/namespaces/{namespace}/repos/{repository}/retentions
2424
raw, err := client.Post(client.ServiceURL("manage", "namespaces", organization, "repos", repository, "retentions"), b, nil, &golangsdk.RequestOpts{
2525
OkCodes: []int{201},
2626
})
2727
if err != nil {
28-
return "", err
28+
return -1, err
2929
}
3030

3131
var res struct {
32-
ID string `json:"id"`
32+
ID int `json:"id"`
3333
}
3434
err = extract.Into(raw.Body, &res)
3535
return res.ID, err

openstack/swr/v2/policy/Delete.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ import golangsdk "github.com/opentelekomcloud/gophertelekomcloud"
55
// This function is used to delete an image retention policy.
66
func Delete(client *golangsdk.ServiceClient, organization, repository, policy string) (err error) {
77
// DELETE /v2/manage/namespaces/{namespace}/repos/{repository}/retentions/{retention_id}
8-
_, err = client.Delete(client.ServiceURL("manage", "namespaces", organization, "repos", repository, "retentions", policy), nil)
8+
_, err = client.Delete(client.ServiceURL("manage", "namespaces", organization, "repos", repository, "retentions", policy), &golangsdk.RequestOpts{
9+
OkCodes: []int{200, 202},
10+
})
911
return err
1012
}

0 commit comments

Comments
 (0)