diff --git a/iamaccessgroupsv2/iam_access_groups_v2.go b/iamaccessgroupsv2/iam_access_groups_v2.go index 84ae42e8..dcabbe14 100644 --- a/iamaccessgroupsv2/iam_access_groups_v2.go +++ b/iamaccessgroupsv2/iam_access_groups_v2.go @@ -15,7 +15,7 @@ */ /* - * IBM OpenAPI SDK Code Generator Version: 99-SNAPSHOT-8d569e8f-20201030-111043 + * IBM OpenAPI SDK Code Generator Version: 99-SNAPSHOT-af92e433-20201110-100619 */ @@ -28,6 +28,7 @@ import ( "fmt" "github.com/IBM/go-sdk-core/v4/core" common "github.com/IBM/platform-services-go-sdk/common" + "github.com/go-openapi/strfmt" "net/http" "reflect" "time" @@ -1461,7 +1462,7 @@ type AccountSettings struct { AccountID *string `json:"account_id,omitempty"` // The timestamp the settings were last edited at. - LastModifiedAt *string `json:"last_modified_at,omitempty"` + LastModifiedAt *strfmt.DateTime `json:"last_modified_at,omitempty"` // The `iam_id` of the entity that last modified the settings. LastModifiedByID *string `json:"last_modified_by_id,omitempty"` @@ -1633,7 +1634,7 @@ type AddGroupMembersResponseMembersItem struct { Type *string `json:"type,omitempty"` // The timestamp the membership was created at. - CreatedAt *string `json:"created_at,omitempty"` + CreatedAt *strfmt.DateTime `json:"created_at,omitempty"` // The `iam_id` of the entity that created the membership. CreatedByID *string `json:"created_by_id,omitempty"` @@ -2262,13 +2263,13 @@ type Group struct { AccountID *string `json:"account_id,omitempty"` // The timestamp the group was created at. - CreatedAt *string `json:"created_at,omitempty"` + CreatedAt *strfmt.DateTime `json:"created_at,omitempty"` // The `iam_id` of the entity that created the group. CreatedByID *string `json:"created_by_id,omitempty"` // The timestamp the group was last edited at. - LastModifiedAt *string `json:"last_modified_at,omitempty"` + LastModifiedAt *strfmt.DateTime `json:"last_modified_at,omitempty"` // The `iam_id` of the entity that last modified the group name or description. LastModifiedByID *string `json:"last_modified_by_id,omitempty"` @@ -2759,7 +2760,7 @@ type ListGroupMembersResponseMember struct { Href *string `json:"href,omitempty"` // The timestamp the membership was created at. - CreatedAt *string `json:"created_at,omitempty"` + CreatedAt *strfmt.DateTime `json:"created_at,omitempty"` // The `iam_id` of the entity that created the membership. CreatedByID *string `json:"created_by_id,omitempty"` @@ -3112,13 +3113,13 @@ type Rule struct { Conditions []RuleConditions `json:"conditions,omitempty"` // The timestamp the rule was created at. - CreatedAt *string `json:"created_at,omitempty"` + CreatedAt *strfmt.DateTime `json:"created_at,omitempty"` // The `iam_id` of the entity that created the rule. CreatedByID *string `json:"created_by_id,omitempty"` // The timestamp the rule was last edited at. - LastModifiedAt *string `json:"last_modified_at,omitempty"` + LastModifiedAt *strfmt.DateTime `json:"last_modified_at,omitempty"` // The IAM id that last modified the rule. LastModifiedByID *string `json:"last_modified_by_id,omitempty"` diff --git a/iamaccessgroupsv2/iam_access_groups_v2_examples_test.go b/iamaccessgroupsv2/iam_access_groups_v2_examples_test.go new file mode 100644 index 00000000..51522310 --- /dev/null +++ b/iamaccessgroupsv2/iam_access_groups_v2_examples_test.go @@ -0,0 +1,477 @@ +// +build examples + +/** + * (C) Copyright IBM Corp. 2020. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package iamaccessgroupsv2_test + +import ( + "encoding/json" + "fmt" + "os" + + "github.com/IBM/go-sdk-core/v4/core" + "github.com/IBM/platform-services-go-sdk/iamaccessgroupsv2" + . "github.com/onsi/ginkgo" + . "github.com/onsi/gomega" +) + +// +// This file provides an example of how to use the IAM Access Groups service. +// +// The following configuration properties are assumed to be defined in the external configuration file: +// IAM_ACCESS_GROUPS_URL= +// IAM_ACCESS_GROUPS_AUTHTYPE=iam +// IAM_ACCESS_GROUPS_APIKEY= +// IAM_ACCESS_GROUPS_AUTH_URL= +// IAM_ACCESS_GROUPS_TEST_ACCOUNT_ID= +// + +const externalConfigFile = "../iam_access_groups.env" + +var ( + iamAccessGroupsService *iamaccessgroupsv2.IamAccessGroupsV2 + config map[string]string + configLoaded bool = false + + testAccountID string + testGroupEtag string + testGroupID string + testClaimRuleID string + testClaimRuleEtag string + testAccountSettings *iamaccessgroupsv2.AccountSettings +) + +func shouldSkipTest() { + if !configLoaded { + Skip("External configuration is not available, skipping tests...") + } +} + +var _ = Describe(`IamAccessGroupsV2 Examples Tests`, func() { + Describe(`External configuration`, func() { + It("Successfully load the configuration", func() { + var err error + _, err = os.Stat(externalConfigFile) + if err != nil { + Skip("External configuration file not found, skipping tests: " + err.Error()) + } + + os.Setenv("IBM_CREDENTIALS_FILE", externalConfigFile) + config, err = core.GetServiceProperties(iamaccessgroupsv2.DefaultServiceName) + if err != nil { + Skip("Error loading service properties, skipping tests: " + err.Error()) + } + + testAccountID = config["TEST_ACCOUNT_ID"] + + configLoaded = len(config) > 0 + }) + }) + + Describe(`Client initialization`, func() { + BeforeEach(func() { + shouldSkipTest() + }) + It("Successfully construct the service client instance", func() { + var err error + + // begin-common + + iamAccessGroupsServiceOptions := &iamaccessgroupsv2.IamAccessGroupsV2Options{} + + iamAccessGroupsService, err = iamaccessgroupsv2.NewIamAccessGroupsV2UsingExternalConfig(iamAccessGroupsServiceOptions) + + if err != nil { + panic(err) + } + + // end-common + + Expect(iamAccessGroupsService).ToNot(BeNil()) + }) + }) + + Describe(`IamAccessGroupsV2 request examples`, func() { + BeforeEach(func() { + shouldSkipTest() + }) + It(`CreateAccessGroup request example`, func() { + // begin-create_access_group + + createAccessGroupOptions := iamAccessGroupsService.NewCreateAccessGroupOptions(testAccountID, "Managers") + createAccessGroupOptions.SetDescription("Group for managers") + group, response, err := iamAccessGroupsService.CreateAccessGroup(createAccessGroupOptions) + if err != nil { + panic(err) + } + b, _ := json.MarshalIndent(group, "", " ") + fmt.Println(string(b)) + + // end-create_access_group + + Expect(err).To(BeNil()) + Expect(response.StatusCode).To(Equal(201)) + Expect(group).ToNot(BeNil()) + + testGroupID = *group.ID + }) + It(`GetAccessGroup request example`, func() { + // begin-get_access_group + + getAccessGroupOptions := iamAccessGroupsService.NewGetAccessGroupOptions(testGroupID) + group, response, err := iamAccessGroupsService.GetAccessGroup(getAccessGroupOptions) + if err != nil { + panic(err) + } + b, _ := json.MarshalIndent(group, "", " ") + fmt.Println(string(b)) + + // end-get_access_group + + Expect(err).To(BeNil()) + Expect(response.StatusCode).To(Equal(200)) + Expect(group).ToNot(BeNil()) + + testGroupEtag = response.GetHeaders().Get("ETag") + }) + It(`UpdateAccessGroup request example`, func() { + // begin-update_access_group + + updateAccessGroupOptions := iamAccessGroupsService.NewUpdateAccessGroupOptions(testGroupID, testGroupEtag) + updateAccessGroupOptions.SetName("Awesome Managers") + updateAccessGroupOptions.SetDescription("Group for awesome managers") + group, response, err := iamAccessGroupsService.UpdateAccessGroup(updateAccessGroupOptions) + if err != nil { + panic(err) + } + b, _ := json.MarshalIndent(group, "", " ") + fmt.Println(string(b)) + + // end-update_access_group + + Expect(err).To(BeNil()) + Expect(response.StatusCode).To(Equal(200)) + Expect(group).ToNot(BeNil()) + }) + It(`ListAccessGroups request example`, func() { + // begin-list_access_groups + + listAccessGroupsOptions := iamAccessGroupsService.NewListAccessGroupsOptions(testAccountID) + groupsList, response, err := iamAccessGroupsService.ListAccessGroups(listAccessGroupsOptions) + if err != nil { + panic(err) + } + b, _ := json.MarshalIndent(groupsList, "", " ") + fmt.Println(string(b)) + + // end-list_access_groups + + Expect(err).To(BeNil()) + Expect(response.StatusCode).To(Equal(200)) + Expect(groupsList).ToNot(BeNil()) + }) + It(`AddMembersToAccessGroup request example`, func() { + // begin-add_members_to_access_group + + groupMembers := []iamaccessgroupsv2.AddGroupMembersRequestMembersItem{ + iamaccessgroupsv2.AddGroupMembersRequestMembersItem{ + IamID: core.StringPtr("IBMid-user1"), + Type: core.StringPtr("user"), + }, + iamaccessgroupsv2.AddGroupMembersRequestMembersItem{ + IamID: core.StringPtr("iam-ServiceId-123"), + Type: core.StringPtr("service"), + }, + } + addMembersToAccessGroupOptions := iamAccessGroupsService.NewAddMembersToAccessGroupOptions(testGroupID) + addMembersToAccessGroupOptions.SetMembers(groupMembers) + addGroupMembersResponse, response, err := iamAccessGroupsService.AddMembersToAccessGroup(addMembersToAccessGroupOptions) + if err != nil { + panic(err) + } + b, _ := json.MarshalIndent(addGroupMembersResponse, "", " ") + fmt.Println(string(b)) + + // end-add_members_to_access_group + + Expect(err).To(BeNil()) + Expect(response.StatusCode).To(Equal(207)) + Expect(addGroupMembersResponse).ToNot(BeNil()) + }) + It(`IsMemberOfAccessGroup request example`, func() { + // begin-is_member_of_access_group + + isMemberOfAccessGroupOptions := iamAccessGroupsService.NewIsMemberOfAccessGroupOptions(testGroupID, "IBMid-user1") + response, err := iamAccessGroupsService.IsMemberOfAccessGroup(isMemberOfAccessGroupOptions) + if err != nil { + panic(err) + } + + // end-is_member_of_access_group + + Expect(err).To(BeNil()) + Expect(response.StatusCode).To(Equal(204)) + }) + It(`ListAccessGroupMembers request example`, func() { + // begin-list_access_group_members + + listAccessGroupMembersOptions := iamAccessGroupsService.NewListAccessGroupMembersOptions(testGroupID) + groupMembersList, response, err := iamAccessGroupsService.ListAccessGroupMembers(listAccessGroupMembersOptions) + if err != nil { + panic(err) + } + b, _ := json.MarshalIndent(groupMembersList, "", " ") + fmt.Println(string(b)) + + // end-list_access_group_members + + Expect(err).To(BeNil()) + Expect(response.StatusCode).To(Equal(200)) + Expect(groupMembersList).ToNot(BeNil()) + }) + It(`RemoveMemberFromAccessGroup request example`, func() { + // begin-remove_member_from_access_group + + removeMemberFromAccessGroupOptions := iamAccessGroupsService.NewRemoveMemberFromAccessGroupOptions(testGroupID, "IBMid-user1") + response, err := iamAccessGroupsService.RemoveMemberFromAccessGroup(removeMemberFromAccessGroupOptions) + if err != nil { + panic(err) + } + + // end-remove_member_from_access_group + + Expect(err).To(BeNil()) + Expect(response.StatusCode).To(Equal(204)) + }) + It(`RemoveMembersFromAccessGroup request example`, func() { + // begin-remove_members_from_access_group + + removeMembersFromAccessGroupOptions := iamAccessGroupsService.NewRemoveMembersFromAccessGroupOptions(testGroupID) + removeMembersFromAccessGroupOptions.SetMembers([]string{"iam-ServiceId-123"}) + deleteGroupBulkMembersResponse, response, err := iamAccessGroupsService.RemoveMembersFromAccessGroup(removeMembersFromAccessGroupOptions) + if err != nil { + panic(err) + } + b, _ := json.MarshalIndent(deleteGroupBulkMembersResponse, "", " ") + fmt.Println(string(b)) + + // end-remove_members_from_access_group + + Expect(err).To(BeNil()) + Expect(response.StatusCode).To(Equal(207)) + Expect(deleteGroupBulkMembersResponse).ToNot(BeNil()) + }) + It(`AddMemberToMultipleAccessGroups request example`, func() { + // begin-add_member_to_multiple_access_groups + + addMemberToMultipleAccessGroupsOptions := iamAccessGroupsService.NewAddMemberToMultipleAccessGroupsOptions(testAccountID, "IBMid-user1") + addMemberToMultipleAccessGroupsOptions.SetType("user") + addMemberToMultipleAccessGroupsOptions.SetGroups([]string{testGroupID}) + addMembershipMultipleGroupsResponse, response, err := iamAccessGroupsService.AddMemberToMultipleAccessGroups(addMemberToMultipleAccessGroupsOptions) + if err != nil { + panic(err) + } + b, _ := json.MarshalIndent(addMembershipMultipleGroupsResponse, "", " ") + fmt.Println(string(b)) + + // end-add_member_to_multiple_access_groups + + Expect(err).To(BeNil()) + Expect(response.StatusCode).To(Equal(207)) + Expect(addMembershipMultipleGroupsResponse).ToNot(BeNil()) + }) + It(`RemoveMemberFromAllAccessGroups request example`, func() { + // begin-remove_member_from_all_access_groups + + removeMemberFromAllAccessGroupsOptions := iamAccessGroupsService.NewRemoveMemberFromAllAccessGroupsOptions(testAccountID, "IBMid-user1") + deleteFromAllGroupsResponse, response, err := iamAccessGroupsService.RemoveMemberFromAllAccessGroups(removeMemberFromAllAccessGroupsOptions) + if err != nil { + panic(err) + } + b, _ := json.MarshalIndent(deleteFromAllGroupsResponse, "", " ") + fmt.Println(string(b)) + + // end-remove_member_from_all_access_groups + + Expect(err).To(BeNil()) + Expect(response.StatusCode).To(Equal(207)) + Expect(deleteFromAllGroupsResponse).ToNot(BeNil()) + }) + It(`AddAccessGroupRule request example`, func() { + // begin-add_access_group_rule + + ruleConditionsModel := iamaccessgroupsv2.RuleConditions{ + Claim: core.StringPtr("isManager"), + Operator: core.StringPtr("EQUALS"), + Value: core.StringPtr("true"), + } + addAccessGroupRuleOptions := iamAccessGroupsService.NewAddAccessGroupRuleOptions( + testGroupID, + int64(12), + "https://idp.example.org/SAML2", + []iamaccessgroupsv2.RuleConditions{ruleConditionsModel}, + ) + addAccessGroupRuleOptions.SetName("Manager group rule") + rule, response, err := iamAccessGroupsService.AddAccessGroupRule(addAccessGroupRuleOptions) + if err != nil { + panic(err) + } + b, _ := json.MarshalIndent(rule, "", " ") + fmt.Println(string(b)) + + // end-add_access_group_rule + + Expect(err).To(BeNil()) + Expect(response.StatusCode).To(Equal(201)) + Expect(rule).ToNot(BeNil()) + + testClaimRuleID = *rule.ID + }) + It(`GetAccessGroupRule request example`, func() { + // begin-get_access_group_rule + + getAccessGroupRuleOptions := iamAccessGroupsService.NewGetAccessGroupRuleOptions(testGroupID, testClaimRuleID) + rule, response, err := iamAccessGroupsService.GetAccessGroupRule(getAccessGroupRuleOptions) + if err != nil { + panic(err) + } + b, _ := json.MarshalIndent(rule, "", " ") + fmt.Println(string(b)) + + // end-get_access_group_rule + + Expect(err).To(BeNil()) + Expect(response.StatusCode).To(Equal(200)) + Expect(rule).ToNot(BeNil()) + + testClaimRuleEtag = response.GetHeaders().Get("Etag") + }) + It(`ReplaceAccessGroupRule request example`, func() { + // begin-replace_access_group_rule + + ruleConditionsModel := iamaccessgroupsv2.RuleConditions{ + Claim: core.StringPtr("isManager"), + Operator: core.StringPtr("EQUALS"), + Value: core.StringPtr("true"), + } + replaceAccessGroupRuleOptions := iamAccessGroupsService.NewReplaceAccessGroupRuleOptions( + testGroupID, + testClaimRuleID, + testClaimRuleEtag, + int64(24), + "https://idp.example.org/SAML2", + []iamaccessgroupsv2.RuleConditions{ruleConditionsModel}, + ) + replaceAccessGroupRuleOptions.SetName("Manager group rule") + rule, response, err := iamAccessGroupsService.ReplaceAccessGroupRule(replaceAccessGroupRuleOptions) + if err != nil { + panic(err) + } + b, _ := json.MarshalIndent(rule, "", " ") + fmt.Println(string(b)) + + // end-replace_access_group_rule + + Expect(err).To(BeNil()) + Expect(response.StatusCode).To(Equal(200)) + Expect(rule).ToNot(BeNil()) + }) + It(`ListAccessGroupRules request example`, func() { + // begin-list_access_group_rules + + listAccessGroupRulesOptions := iamAccessGroupsService.NewListAccessGroupRulesOptions(testGroupID) + rulesList, response, err := iamAccessGroupsService.ListAccessGroupRules(listAccessGroupRulesOptions) + if err != nil { + panic(err) + } + b, _ := json.MarshalIndent(rulesList, "", " ") + fmt.Println(string(b)) + + // end-list_access_group_rules + + Expect(err).To(BeNil()) + Expect(response.StatusCode).To(Equal(200)) + Expect(rulesList).ToNot(BeNil()) + + }) + It(`RemoveAccessGroupRule request example`, func() { + // begin-remove_access_group_rule + + removeAccessGroupRuleOptions := iamAccessGroupsService.NewRemoveAccessGroupRuleOptions(testGroupID, testClaimRuleID) + response, err := iamAccessGroupsService.RemoveAccessGroupRule(removeAccessGroupRuleOptions) + if err != nil { + panic(err) + } + + // end-remove_access_group_rule + + Expect(err).To(BeNil()) + Expect(response.StatusCode).To(Equal(204)) + }) + It(`GetAccountSettings request example`, func() { + // begin-get_account_settings + + getAccountSettingsOptions := iamAccessGroupsService.NewGetAccountSettingsOptions(testAccountID) + accountSettings, response, err := iamAccessGroupsService.GetAccountSettings(getAccountSettingsOptions) + if err != nil { + panic(err) + } + b, _ := json.MarshalIndent(accountSettings, "", " ") + fmt.Println(string(b)) + + // end-get_account_settings + + Expect(err).To(BeNil()) + Expect(response.StatusCode).To(Equal(200)) + Expect(accountSettings).ToNot(BeNil()) + + testAccountSettings = accountSettings + }) + It(`UpdateAccountSettings request example`, func() { + // begin-update_account_settings + + updateAccountSettingsOptions := iamAccessGroupsService.NewUpdateAccountSettingsOptions(testAccountID) + updateAccountSettingsOptions.SetPublicAccessEnabled(true) + accountSettings, response, err := iamAccessGroupsService.UpdateAccountSettings(updateAccountSettingsOptions) + if err != nil { + panic(err) + } + b, _ := json.MarshalIndent(accountSettings, "", " ") + fmt.Println(string(b)) + + // end-update_account_settings + + Expect(err).To(BeNil()) + Expect(response.StatusCode).To(Equal(200)) + Expect(accountSettings).ToNot(BeNil()) + }) + It(`DeleteAccessGroup request example`, func() { + // begin-delete_access_group + + deleteAccessGroupOptions := iamAccessGroupsService.NewDeleteAccessGroupOptions(testGroupID) + response, err := iamAccessGroupsService.DeleteAccessGroup(deleteAccessGroupOptions) + if err != nil { + panic(err) + } + + // end-delete_access_group + + Expect(err).To(BeNil()) + Expect(response.StatusCode).To(Equal(204)) + }) + }) +}) diff --git a/iamaccessgroupsv2/iam_access_groups_v2_integration_test.go b/iamaccessgroupsv2/iam_access_groups_v2_integration_test.go index b73f3c9f..d858789d 100644 --- a/iamaccessgroupsv2/iam_access_groups_v2_integration_test.go +++ b/iamaccessgroupsv2/iam_access_groups_v2_integration_test.go @@ -19,7 +19,6 @@ package iamaccessgroupsv2_test import ( - "fmt" "log" "math/rand" "os" @@ -432,12 +431,7 @@ var _ = AfterSuite(func() { // force delete the test group (or any test groups older than 5 minutes) if *group.Name == testGroupName { - createdAt, err := time.Parse(time.RFC3339, *group.CreatedAt) - if err != nil { - fmt.Printf("time.Parse error occurred: %v", err) - fmt.Printf("Cleanup of group (%v) failed", *group.ID) - continue - } + createdAt := time.Time(*group.CreatedAt) fiveMinutesAgo := time.Now().Add(-(time.Duration(5) * time.Minute)) if *group.ID == testGroupID || createdAt.Before(fiveMinutesAgo) { diff --git a/iamaccessgroupsv2/iam_access_groups_v2_test.go b/iamaccessgroupsv2/iam_access_groups_v2_test.go index 7080a528..3743e31d 100644 --- a/iamaccessgroupsv2/iam_access_groups_v2_test.go +++ b/iamaccessgroupsv2/iam_access_groups_v2_test.go @@ -227,7 +227,7 @@ var _ = Describe(`IamAccessGroupsV2`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"id": "ID", "name": "Name", "description": "Description", "account_id": "AccountID", "created_at": "CreatedAt", "created_by_id": "CreatedByID", "last_modified_at": "LastModifiedAt", "last_modified_by_id": "LastModifiedByID", "href": "Href", "is_federated": false}`) + fmt.Fprintf(res, "%s", `{"id": "ID", "name": "Name", "description": "Description", "account_id": "AccountID", "created_at": "2019-01-01T12:00:00", "created_by_id": "CreatedByID", "last_modified_at": "2019-01-01T12:00:00", "last_modified_by_id": "LastModifiedByID", "href": "Href", "is_federated": false}`) })) }) It(`Invoke CreateAccessGroup successfully`, func() { @@ -428,7 +428,7 @@ var _ = Describe(`IamAccessGroupsV2`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - 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": "CreatedAt", "created_by_id": "CreatedByID", "last_modified_at": "LastModifiedAt", "last_modified_by_id": "LastModifiedByID", "href": "Href", "is_federated": false}]}`) + 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", "created_by_id": "CreatedByID", "last_modified_at": "2019-01-01T12:00:00", "last_modified_by_id": "LastModifiedByID", "href": "Href", "is_federated": false}]}`) })) }) It(`Invoke ListAccessGroups successfully`, func() { @@ -606,7 +606,7 @@ var _ = Describe(`IamAccessGroupsV2`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"id": "ID", "name": "Name", "description": "Description", "account_id": "AccountID", "created_at": "CreatedAt", "created_by_id": "CreatedByID", "last_modified_at": "LastModifiedAt", "last_modified_by_id": "LastModifiedByID", "href": "Href", "is_federated": false}`) + fmt.Fprintf(res, "%s", `{"id": "ID", "name": "Name", "description": "Description", "account_id": "AccountID", "created_at": "2019-01-01T12:00:00", "created_by_id": "CreatedByID", "last_modified_at": "2019-01-01T12:00:00", "last_modified_by_id": "LastModifiedByID", "href": "Href", "is_federated": false}`) })) }) It(`Invoke GetAccessGroup successfully`, func() { @@ -790,7 +790,7 @@ var _ = Describe(`IamAccessGroupsV2`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"id": "ID", "name": "Name", "description": "Description", "account_id": "AccountID", "created_at": "CreatedAt", "created_by_id": "CreatedByID", "last_modified_at": "LastModifiedAt", "last_modified_by_id": "LastModifiedByID", "href": "Href", "is_federated": false}`) + fmt.Fprintf(res, "%s", `{"id": "ID", "name": "Name", "description": "Description", "account_id": "AccountID", "created_at": "2019-01-01T12:00:00", "created_by_id": "CreatedByID", "last_modified_at": "2019-01-01T12:00:00", "last_modified_by_id": "LastModifiedByID", "href": "Href", "is_federated": false}`) })) }) It(`Invoke UpdateAccessGroup successfully`, func() { @@ -1144,7 +1144,7 @@ var _ = Describe(`IamAccessGroupsV2`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"account_id": "AccountID", "last_modified_at": "LastModifiedAt", "last_modified_by_id": "LastModifiedByID", "public_access_enabled": false}`) + fmt.Fprintf(res, "%s", `{"account_id": "AccountID", "last_modified_at": "2019-01-01T12:00:00", "last_modified_by_id": "LastModifiedByID", "public_access_enabled": false}`) })) }) It(`Invoke GetAccountSettings successfully`, func() { @@ -1324,7 +1324,7 @@ var _ = Describe(`IamAccessGroupsV2`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"account_id": "AccountID", "last_modified_at": "LastModifiedAt", "last_modified_by_id": "LastModifiedByID", "public_access_enabled": false}`) + fmt.Fprintf(res, "%s", `{"account_id": "AccountID", "last_modified_at": "2019-01-01T12:00:00", "last_modified_by_id": "LastModifiedByID", "public_access_enabled": false}`) })) }) It(`Invoke UpdateAccountSettings successfully`, func() { @@ -1689,7 +1689,7 @@ var _ = Describe(`IamAccessGroupsV2`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(207) - fmt.Fprintf(res, "%s", `{"members": [{"iam_id": "IamID", "type": "Type", "created_at": "CreatedAt", "created_by_id": "CreatedByID", "status_code": 10, "trace": "Trace", "errors": [{"code": "Code", "message": "Message"}]}]}`) + fmt.Fprintf(res, "%s", `{"members": [{"iam_id": "IamID", "type": "Type", "created_at": "2019-01-01T12:00:00", "created_by_id": "CreatedByID", "status_code": 10, "trace": "Trace", "errors": [{"code": "Code", "message": "Message"}]}]}`) })) }) It(`Invoke AddMembersToAccessGroup successfully`, func() { @@ -1891,7 +1891,7 @@ var _ = Describe(`IamAccessGroupsV2`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"limit": 5, "offset": 6, "total_count": 10, "first": {"href": "Href"}, "previous": {"href": "Href"}, "next": {"href": "Href"}, "last": {"href": "Href"}, "members": [{"iam_id": "IamID", "type": "Type", "name": "Name", "email": "Email", "description": "Description", "href": "Href", "created_at": "CreatedAt", "created_by_id": "CreatedByID"}]}`) + fmt.Fprintf(res, "%s", `{"limit": 5, "offset": 6, "total_count": 10, "first": {"href": "Href"}, "previous": {"href": "Href"}, "next": {"href": "Href"}, "last": {"href": "Href"}, "members": [{"iam_id": "IamID", "type": "Type", "name": "Name", "email": "Email", "description": "Description", "href": "Href", "created_at": "2019-01-01T12:00:00", "created_by_id": "CreatedByID"}]}`) })) }) It(`Invoke ListAccessGroupMembers successfully`, func() { @@ -2800,7 +2800,7 @@ var _ = Describe(`IamAccessGroupsV2`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"id": "ID", "name": "Name", "expiration": 10, "realm_name": "RealmName", "access_group_id": "AccessGroupID", "account_id": "AccountID", "conditions": [{"claim": "Claim", "operator": "Operator", "value": "Value"}], "created_at": "CreatedAt", "created_by_id": "CreatedByID", "last_modified_at": "LastModifiedAt", "last_modified_by_id": "LastModifiedByID"}`) + fmt.Fprintf(res, "%s", `{"id": "ID", "name": "Name", "expiration": 10, "realm_name": "RealmName", "access_group_id": "AccessGroupID", "account_id": "AccountID", "conditions": [{"claim": "Claim", "operator": "Operator", "value": "Value"}], "created_at": "2019-01-01T12:00:00", "created_by_id": "CreatedByID", "last_modified_at": "2019-01-01T12:00:00", "last_modified_by_id": "LastModifiedByID"}`) })) }) It(`Invoke AddAccessGroupRule successfully`, func() { @@ -2979,7 +2979,7 @@ var _ = Describe(`IamAccessGroupsV2`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"rules": [{"id": "ID", "name": "Name", "expiration": 10, "realm_name": "RealmName", "access_group_id": "AccessGroupID", "account_id": "AccountID", "conditions": [{"claim": "Claim", "operator": "Operator", "value": "Value"}], "created_at": "CreatedAt", "created_by_id": "CreatedByID", "last_modified_at": "LastModifiedAt", "last_modified_by_id": "LastModifiedByID"}]}`) + fmt.Fprintf(res, "%s", `{"rules": [{"id": "ID", "name": "Name", "expiration": 10, "realm_name": "RealmName", "access_group_id": "AccessGroupID", "account_id": "AccountID", "conditions": [{"claim": "Claim", "operator": "Operator", "value": "Value"}], "created_at": "2019-01-01T12:00:00", "created_by_id": "CreatedByID", "last_modified_at": "2019-01-01T12:00:00", "last_modified_by_id": "LastModifiedByID"}]}`) })) }) It(`Invoke ListAccessGroupRules successfully`, func() { @@ -3139,7 +3139,7 @@ var _ = Describe(`IamAccessGroupsV2`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"id": "ID", "name": "Name", "expiration": 10, "realm_name": "RealmName", "access_group_id": "AccessGroupID", "account_id": "AccountID", "conditions": [{"claim": "Claim", "operator": "Operator", "value": "Value"}], "created_at": "CreatedAt", "created_by_id": "CreatedByID", "last_modified_at": "LastModifiedAt", "last_modified_by_id": "LastModifiedByID"}`) + fmt.Fprintf(res, "%s", `{"id": "ID", "name": "Name", "expiration": 10, "realm_name": "RealmName", "access_group_id": "AccessGroupID", "account_id": "AccountID", "conditions": [{"claim": "Claim", "operator": "Operator", "value": "Value"}], "created_at": "2019-01-01T12:00:00", "created_by_id": "CreatedByID", "last_modified_at": "2019-01-01T12:00:00", "last_modified_by_id": "LastModifiedByID"}`) })) }) It(`Invoke GetAccessGroupRule successfully`, func() { @@ -3332,7 +3332,7 @@ var _ = Describe(`IamAccessGroupsV2`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"id": "ID", "name": "Name", "expiration": 10, "realm_name": "RealmName", "access_group_id": "AccessGroupID", "account_id": "AccountID", "conditions": [{"claim": "Claim", "operator": "Operator", "value": "Value"}], "created_at": "CreatedAt", "created_by_id": "CreatedByID", "last_modified_at": "LastModifiedAt", "last_modified_by_id": "LastModifiedByID"}`) + fmt.Fprintf(res, "%s", `{"id": "ID", "name": "Name", "expiration": 10, "realm_name": "RealmName", "access_group_id": "AccessGroupID", "account_id": "AccountID", "conditions": [{"claim": "Claim", "operator": "Operator", "value": "Value"}], "created_at": "2019-01-01T12:00:00", "created_by_id": "CreatedByID", "last_modified_at": "2019-01-01T12:00:00", "last_modified_by_id": "LastModifiedByID"}`) })) }) It(`Invoke ReplaceAccessGroupRule successfully`, func() {