Skip to content

Commit 2e09509

Browse files
authored
feat(IAM Access Groups): add CRN to schema (#375)
Signed-off-by: Hari K Arla <[email protected]>
1 parent 2921e02 commit 2e09509

File tree

2 files changed

+18
-10
lines changed

2 files changed

+18
-10
lines changed

iamaccessgroupsv2/iam_access_groups_v2.go

+8
Original file line numberDiff line numberDiff line change
@@ -4722,6 +4722,9 @@ type Group struct {
47224722

47234723
// This is set to true if rules exist for the group.
47244724
IsFederated *bool `json:"is_federated,omitempty"`
4725+
4726+
// CRN of the access group.
4727+
CRN *string `json:"crn,omitempty"`
47254728
}
47264729

47274730
// UnmarshalGroup unmarshals an instance of Group from the specified map of raw messages.
@@ -4777,6 +4780,11 @@ func UnmarshalGroup(m map[string]json.RawMessage, result interface{}) (err error
47774780
err = core.SDKErrorf(err, "", "is_federated-error", common.GetComponentInfo())
47784781
return
47794782
}
4783+
err = core.UnmarshalPrimitive(m, "crn", &obj.CRN)
4784+
if err != nil {
4785+
err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo())
4786+
return
4787+
}
47804788
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
47814789
return
47824790
}

iamaccessgroupsv2/iam_access_groups_v2_test.go

+10-10
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ var _ = Describe(`IamAccessGroupsV2`, func() {
252252
// Set mock response
253253
res.Header().Set("Content-type", "application/json")
254254
res.WriteHeader(201)
255-
fmt.Fprintf(res, "%s", `{"id": "ID", "name": "Name", "description": "Description", "account_id": "AccountID", "created_at": "2019-01-01T12:00:00.000Z", "created_by_id": "CreatedByID", "last_modified_at": "2019-01-01T12:00:00.000Z", "last_modified_by_id": "LastModifiedByID", "href": "Href", "is_federated": false}`)
255+
fmt.Fprintf(res, "%s", `{"id": "ID", "name": "Name", "description": "Description", "account_id": "AccountID", "created_at": "2019-01-01T12:00:00.000Z", "created_by_id": "CreatedByID", "last_modified_at": "2019-01-01T12:00:00.000Z", "last_modified_by_id": "LastModifiedByID", "href": "Href", "is_federated": false, "crn": "CRN"}`)
256256
}))
257257
})
258258
It(`Invoke CreateAccessGroup successfully with retries`, func() {
@@ -328,7 +328,7 @@ var _ = Describe(`IamAccessGroupsV2`, func() {
328328
// Set mock response
329329
res.Header().Set("Content-type", "application/json")
330330
res.WriteHeader(201)
331-
fmt.Fprintf(res, "%s", `{"id": "ID", "name": "Name", "description": "Description", "account_id": "AccountID", "created_at": "2019-01-01T12:00:00.000Z", "created_by_id": "CreatedByID", "last_modified_at": "2019-01-01T12:00:00.000Z", "last_modified_by_id": "LastModifiedByID", "href": "Href", "is_federated": false}`)
331+
fmt.Fprintf(res, "%s", `{"id": "ID", "name": "Name", "description": "Description", "account_id": "AccountID", "created_at": "2019-01-01T12:00:00.000Z", "created_by_id": "CreatedByID", "last_modified_at": "2019-01-01T12:00:00.000Z", "last_modified_by_id": "LastModifiedByID", "href": "Href", "is_federated": false, "crn": "CRN"}`)
332332
}))
333333
})
334334
It(`Invoke CreateAccessGroup successfully`, func() {
@@ -529,7 +529,7 @@ var _ = Describe(`IamAccessGroupsV2`, func() {
529529
// Set mock response
530530
res.Header().Set("Content-type", "application/json")
531531
res.WriteHeader(200)
532-
fmt.Fprintf(res, "%s", `{"limit": 5, "offset": 6, "total_count": 10, "first": {"href": "Href"}, "previous": {"href": "Href"}, "next": {"href": "Href"}, "last": {"href": "Href"}, "groups": [{"id": "ID", "name": "Name", "description": "Description", "account_id": "AccountID", "created_at": "2019-01-01T12:00:00.000Z", "created_by_id": "CreatedByID", "last_modified_at": "2019-01-01T12:00:00.000Z", "last_modified_by_id": "LastModifiedByID", "href": "Href", "is_federated": false}]}`)
532+
fmt.Fprintf(res, "%s", `{"limit": 5, "offset": 6, "total_count": 10, "first": {"href": "Href"}, "previous": {"href": "Href"}, "next": {"href": "Href"}, "last": {"href": "Href"}, "groups": [{"id": "ID", "name": "Name", "description": "Description", "account_id": "AccountID", "created_at": "2019-01-01T12:00:00.000Z", "created_by_id": "CreatedByID", "last_modified_at": "2019-01-01T12:00:00.000Z", "last_modified_by_id": "LastModifiedByID", "href": "Href", "is_federated": false, "crn": "CRN"}]}`)
533533
}))
534534
})
535535
It(`Invoke ListAccessGroups successfully with retries`, func() {
@@ -605,7 +605,7 @@ var _ = Describe(`IamAccessGroupsV2`, func() {
605605
// Set mock response
606606
res.Header().Set("Content-type", "application/json")
607607
res.WriteHeader(200)
608-
fmt.Fprintf(res, "%s", `{"limit": 5, "offset": 6, "total_count": 10, "first": {"href": "Href"}, "previous": {"href": "Href"}, "next": {"href": "Href"}, "last": {"href": "Href"}, "groups": [{"id": "ID", "name": "Name", "description": "Description", "account_id": "AccountID", "created_at": "2019-01-01T12:00:00.000Z", "created_by_id": "CreatedByID", "last_modified_at": "2019-01-01T12:00:00.000Z", "last_modified_by_id": "LastModifiedByID", "href": "Href", "is_federated": false}]}`)
608+
fmt.Fprintf(res, "%s", `{"limit": 5, "offset": 6, "total_count": 10, "first": {"href": "Href"}, "previous": {"href": "Href"}, "next": {"href": "Href"}, "last": {"href": "Href"}, "groups": [{"id": "ID", "name": "Name", "description": "Description", "account_id": "AccountID", "created_at": "2019-01-01T12:00:00.000Z", "created_by_id": "CreatedByID", "last_modified_at": "2019-01-01T12:00:00.000Z", "last_modified_by_id": "LastModifiedByID", "href": "Href", "is_federated": false, "crn": "CRN"}]}`)
609609
}))
610610
})
611611
It(`Invoke ListAccessGroups successfully`, func() {
@@ -784,9 +784,9 @@ var _ = Describe(`IamAccessGroupsV2`, func() {
784784
res.WriteHeader(200)
785785
requestNumber++
786786
if requestNumber == 1 {
787-
fmt.Fprintf(res, "%s", `{"next":{"href":"https://myhost.com/somePath?offset=1"},"total_count":2,"limit":1,"groups":[{"id":"ID","name":"Name","description":"Description","account_id":"AccountID","created_at":"2019-01-01T12:00:00.000Z","created_by_id":"CreatedByID","last_modified_at":"2019-01-01T12:00:00.000Z","last_modified_by_id":"LastModifiedByID","href":"Href","is_federated":false}]}`)
787+
fmt.Fprintf(res, "%s", `{"next":{"href":"https://myhost.com/somePath?offset=1"},"total_count":2,"limit":1,"groups":[{"id":"ID","name":"Name","description":"Description","account_id":"AccountID","created_at":"2019-01-01T12:00:00.000Z","created_by_id":"CreatedByID","last_modified_at":"2019-01-01T12:00:00.000Z","last_modified_by_id":"LastModifiedByID","href":"Href","is_federated":false,"crn":"CRN"}]}`)
788788
} else if requestNumber == 2 {
789-
fmt.Fprintf(res, "%s", `{"total_count":2,"limit":1,"groups":[{"id":"ID","name":"Name","description":"Description","account_id":"AccountID","created_at":"2019-01-01T12:00:00.000Z","created_by_id":"CreatedByID","last_modified_at":"2019-01-01T12:00:00.000Z","last_modified_by_id":"LastModifiedByID","href":"Href","is_federated":false}]}`)
789+
fmt.Fprintf(res, "%s", `{"total_count":2,"limit":1,"groups":[{"id":"ID","name":"Name","description":"Description","account_id":"AccountID","created_at":"2019-01-01T12:00:00.000Z","created_by_id":"CreatedByID","last_modified_at":"2019-01-01T12:00:00.000Z","last_modified_by_id":"LastModifiedByID","href":"Href","is_federated":false,"crn":"CRN"}]}`)
790790
} else {
791791
res.WriteHeader(400)
792792
}
@@ -931,7 +931,7 @@ var _ = Describe(`IamAccessGroupsV2`, func() {
931931
// Set mock response
932932
res.Header().Set("Content-type", "application/json")
933933
res.WriteHeader(200)
934-
fmt.Fprintf(res, "%s", `{"id": "ID", "name": "Name", "description": "Description", "account_id": "AccountID", "created_at": "2019-01-01T12:00:00.000Z", "created_by_id": "CreatedByID", "last_modified_at": "2019-01-01T12:00:00.000Z", "last_modified_by_id": "LastModifiedByID", "href": "Href", "is_federated": false}`)
934+
fmt.Fprintf(res, "%s", `{"id": "ID", "name": "Name", "description": "Description", "account_id": "AccountID", "created_at": "2019-01-01T12:00:00.000Z", "created_by_id": "CreatedByID", "last_modified_at": "2019-01-01T12:00:00.000Z", "last_modified_by_id": "LastModifiedByID", "href": "Href", "is_federated": false, "crn": "CRN"}`)
935935
}))
936936
})
937937
It(`Invoke GetAccessGroup successfully with retries`, func() {
@@ -992,7 +992,7 @@ var _ = Describe(`IamAccessGroupsV2`, func() {
992992
// Set mock response
993993
res.Header().Set("Content-type", "application/json")
994994
res.WriteHeader(200)
995-
fmt.Fprintf(res, "%s", `{"id": "ID", "name": "Name", "description": "Description", "account_id": "AccountID", "created_at": "2019-01-01T12:00:00.000Z", "created_by_id": "CreatedByID", "last_modified_at": "2019-01-01T12:00:00.000Z", "last_modified_by_id": "LastModifiedByID", "href": "Href", "is_federated": false}`)
995+
fmt.Fprintf(res, "%s", `{"id": "ID", "name": "Name", "description": "Description", "account_id": "AccountID", "created_at": "2019-01-01T12:00:00.000Z", "created_by_id": "CreatedByID", "last_modified_at": "2019-01-01T12:00:00.000Z", "last_modified_by_id": "LastModifiedByID", "href": "Href", "is_federated": false, "crn": "CRN"}`)
996996
}))
997997
})
998998
It(`Invoke GetAccessGroup successfully`, func() {
@@ -1187,7 +1187,7 @@ var _ = Describe(`IamAccessGroupsV2`, func() {
11871187
// Set mock response
11881188
res.Header().Set("Content-type", "application/json")
11891189
res.WriteHeader(200)
1190-
fmt.Fprintf(res, "%s", `{"id": "ID", "name": "Name", "description": "Description", "account_id": "AccountID", "created_at": "2019-01-01T12:00:00.000Z", "created_by_id": "CreatedByID", "last_modified_at": "2019-01-01T12:00:00.000Z", "last_modified_by_id": "LastModifiedByID", "href": "Href", "is_federated": false}`)
1190+
fmt.Fprintf(res, "%s", `{"id": "ID", "name": "Name", "description": "Description", "account_id": "AccountID", "created_at": "2019-01-01T12:00:00.000Z", "created_by_id": "CreatedByID", "last_modified_at": "2019-01-01T12:00:00.000Z", "last_modified_by_id": "LastModifiedByID", "href": "Href", "is_federated": false, "crn": "CRN"}`)
11911191
}))
11921192
})
11931193
It(`Invoke UpdateAccessGroup successfully with retries`, func() {
@@ -1265,7 +1265,7 @@ var _ = Describe(`IamAccessGroupsV2`, func() {
12651265
// Set mock response
12661266
res.Header().Set("Content-type", "application/json")
12671267
res.WriteHeader(200)
1268-
fmt.Fprintf(res, "%s", `{"id": "ID", "name": "Name", "description": "Description", "account_id": "AccountID", "created_at": "2019-01-01T12:00:00.000Z", "created_by_id": "CreatedByID", "last_modified_at": "2019-01-01T12:00:00.000Z", "last_modified_by_id": "LastModifiedByID", "href": "Href", "is_federated": false}`)
1268+
fmt.Fprintf(res, "%s", `{"id": "ID", "name": "Name", "description": "Description", "account_id": "AccountID", "created_at": "2019-01-01T12:00:00.000Z", "created_by_id": "CreatedByID", "last_modified_at": "2019-01-01T12:00:00.000Z", "last_modified_by_id": "LastModifiedByID", "href": "Href", "is_federated": false, "crn": "CRN"}`)
12691269
}))
12701270
})
12711271
It(`Invoke UpdateAccessGroup successfully`, func() {

0 commit comments

Comments
 (0)