Skip to content

Commit a78fc5c

Browse files
committed
Identity V3: fix Trust Create options
Remove required tag from the "impersonation" argument since it's boolean so we can just don't set "omitempty" tag to always send it in the Create request.
1 parent 163bc42 commit a78fc5c

3 files changed

Lines changed: 4 additions & 5 deletions

File tree

openstack/identity/v3/extensions/trusts/requests.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ type CreateOptsBuilder interface {
5252
// CreateOpts provides options used to create a new trust.
5353
type CreateOpts struct {
5454
// Impersonation allows the trustee to impersonate the trustor.
55-
Impersonation bool `json:"impersonation" required:"true"`
55+
Impersonation bool `json:"impersonation"`
5656

5757
// TrusteeUserID is a user who is capable of consuming the trust.
5858
TrusteeUserID string `json:"trustee_user_id" required:"true"`

openstack/identity/v3/extensions/trusts/testing/fixtures.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const CreateRequest = `
1414
{
1515
"trust": {
1616
"expires_at": "2019-12-01T14:00:00.999999Z",
17-
"impersonation": true,
17+
"impersonation": false,
1818
"allow_redelegation": true,
1919
"project_id": "9b71012f5a4a4aef9193f1995fe159b2",
2020
"roles": [
@@ -33,7 +33,7 @@ const CreateResponse = `
3333
"trust": {
3434
"expires_at": "2019-12-01T14:00:00.999999Z",
3535
"id": "3422b7c113894f5d90665e1a79655e23",
36-
"impersonation": true,
36+
"impersonation": false,
3737
"redelegation_count": 10,
3838
"project_id": "9b71012f5a4a4aef9193f1995fe159b2",
3939
"remaining_uses": null,

openstack/identity/v3/extensions/trusts/testing/requests_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,6 @@ func TestCreateTrust(t *testing.T) {
8181
expiresAt := time.Date(2019, 12, 1, 14, 0, 0, 999999999, time.UTC)
8282
result, err := trusts.Create(client.ServiceClient(), trusts.CreateOpts{
8383
ExpiresAt: &expiresAt,
84-
Impersonation: true,
8584
AllowRedelegation: true,
8685
ProjectID: "9b71012f5a4a4aef9193f1995fe159b2",
8786
Roles: []trusts.Role{
@@ -95,7 +94,7 @@ func TestCreateTrust(t *testing.T) {
9594
th.AssertNoErr(t, err)
9695

9796
th.AssertEquals(t, "3422b7c113894f5d90665e1a79655e23", result.ID)
98-
th.AssertEquals(t, true, result.Impersonation)
97+
th.AssertEquals(t, false, result.Impersonation)
9998
th.AssertEquals(t, 10, result.RedelegationCount)
10099
}
101100

0 commit comments

Comments
 (0)