Skip to content
This repository was archived by the owner on Aug 1, 2023. It is now read-only.

Commit 2e695a3

Browse files
author
Jamie Hannaford
committed
use interfaces rather than concrete types
1 parent 75e8cc4 commit 2e695a3

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

openstack/db/v1/instances/requests.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,10 @@ type CreateOpts struct {
4242
Name string
4343

4444
// A slice of database information options.
45-
Databases db.BatchCreateOpts
45+
Databases db.CreateOptsBuilder
4646

4747
// A slice of user information options.
48-
Users users.BatchCreateOpts
48+
Users users.CreateOptsBuilder
4949

5050
// Options to configure the type of datastore the instance will use. This is
5151
// optional, and if excluded will default to MySQL.
@@ -69,14 +69,14 @@ func (opts CreateOpts) ToInstanceCreateMap() (map[string]interface{}, error) {
6969
if opts.Name != "" {
7070
instance["name"] = opts.Name
7171
}
72-
if len(opts.Databases) > 0 {
72+
if opts.Databases != nil {
7373
dbs, err := opts.Databases.ToDBCreateMap()
7474
if err != nil {
7575
return nil, err
7676
}
7777
instance["databases"] = dbs["databases"]
7878
}
79-
if len(opts.Users) > 0 {
79+
if opts.Users != nil {
8080
users, err := opts.Users.ToUserCreateMap()
8181
if err != nil {
8282
return nil, err

rackspace/db/v1/instances/requests.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@ type CreateOpts struct {
2424
Name string
2525

2626
// A slice of database information options.
27-
Databases osDBs.BatchCreateOpts
27+
Databases osDBs.CreateOptsBuilder
2828

2929
// A slice of user information options.
30-
Users osUsers.BatchCreateOpts
30+
Users osUsers.CreateOptsBuilder
3131

3232
// ID of the configuration group to associate with the instance. Optional.
3333
ConfigID string

rackspace/db/v1/users/requests.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ change the respective passwords for two users:
2929
3030
ChangePassword(client, "instance_id", opts)
3131
*/
32-
func ChangePassword(client *gophercloud.ServiceClient, instanceID string, opts os.BatchCreateOpts) UpdatePasswordsResult {
32+
func ChangePassword(client *gophercloud.ServiceClient, instanceID string, opts os.CreateOptsBuilder) UpdatePasswordsResult {
3333
var res UpdatePasswordsResult
3434

3535
reqBody, err := opts.ToUserCreateMap()
@@ -142,7 +142,7 @@ instance. For example, to add a user to multiple databases:
142142
143143
GrantAccess(client, "instance_id", "user_name", opts)
144144
*/
145-
func GrantAccess(client *gophercloud.ServiceClient, instanceID, userName string, opts db.BatchCreateOpts) GrantAccessResult {
145+
func GrantAccess(client *gophercloud.ServiceClient, instanceID, userName string, opts db.CreateOptsBuilder) GrantAccessResult {
146146
var res GrantAccessResult
147147

148148
reqBody, err := opts.ToDBCreateMap()

0 commit comments

Comments
 (0)