diff --git a/examples/00-authentication.go b/examples/00-authentication.go index a2a5ef1..56dd75f 100644 --- a/examples/00-authentication.go +++ b/examples/00-authentication.go @@ -46,7 +46,7 @@ func main() { // Authenticate with a project name, username, password. creds = openstack.AuthOpts{ AuthUrl: config.Host, - Project: config.ProjectName, + ProjectName: config.ProjectName, Username: config.Username, Password: config.Password, } @@ -63,7 +63,7 @@ func main() { // Authenticate with a project id, username, password. creds = openstack.AuthOpts{ AuthUrl: config.Host, - Project: config.ProjectID, + ProjectId: config.ProjectID, Username: config.Username, Password: config.Password, } diff --git a/examples/10-objectstore.go b/examples/10-objectstore.go index a613776..33fec67 100644 --- a/examples/10-objectstore.go +++ b/examples/10-objectstore.go @@ -34,7 +34,7 @@ func main() { // Authenticate with a project name, username, password. creds := openstack.AuthOpts{ AuthUrl: config.Host, - Project: config.ProjectName, + ProjectName: config.ProjectName, Username: config.Username, Password: config.Password, } diff --git a/examples/30-image-v1.go b/examples/30-image-v1.go index e131a0e..6e58ce0 100644 --- a/examples/30-image-v1.go +++ b/examples/30-image-v1.go @@ -30,7 +30,7 @@ func main() { // Authenticate with a username, password, tenant id. creds := openstack.AuthOpts{ AuthUrl: config.Host, - Project: config.ProjectName, + ProjectName: config.ProjectName, Username: config.Username, Password: config.Password, } diff --git a/identity/middleware/validation_test.go b/identity/middleware/validation_test.go index 50e7fc8..6b2a2e1 100644 --- a/identity/middleware/validation_test.go +++ b/identity/middleware/validation_test.go @@ -29,7 +29,7 @@ const ( func getAuthOpts() openstack.AuthOpts { return openstack.AuthOpts{ AuthUrl: "http://localhost:5000/v2.0", - Project: "demo", + ProjectName: "demo", Username: "demo", Password: "demo", } diff --git a/openstack/auth-password.go b/openstack/auth-password.go index 0c3b530..c984cf0 100644 --- a/openstack/auth-password.go +++ b/openstack/auth-password.go @@ -30,7 +30,8 @@ type PasswordCredentials struct { type OSAuth struct { PasswordCredentials `json:"passwordCredentials"` - Project string `json:"tenantName"` + ProjectName string `json:"tenantName"` + ProjectId string `json:"tenantId"` } type UserPassV2 struct { @@ -59,7 +60,8 @@ func NewUserPassV2(ao AuthOpts) (upv2 *UserPassV2, err error) { Username: ao.Username, Password: ao.Password, }, - Project: ao.Project, + ProjectName: ao.ProjectName, + ProjectId: ao.ProjectId, }, } return upv2, nil diff --git a/openstack/auth.go b/openstack/auth.go index 2e8e739..fd6c425 100644 --- a/openstack/auth.go +++ b/openstack/auth.go @@ -39,7 +39,9 @@ type AuthOpts struct { // Project is optional to get an unscoped token but required for // a scoped token, which is required to do pretty much everything // except list projects - Project string + ProjectName string + + ProjectId string // Username is required for password auth Username string