Skip to content

Commit

Permalink
fix(IAM Policy Management): update examples format for doc generation (
Browse files Browse the repository at this point in the history
…#299)

Signed-off-by: Shaun Colley <shaun.colley@ibm.com>
  • Loading branch information
swcolley authored Jan 30, 2024
1 parent 2631ed6 commit 8074d5b
Showing 1 changed file with 17 additions and 34 deletions.
51 changes: 17 additions & 34 deletions iampolicymanagementv1/iam_policy_management_v1_examples_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,15 +170,14 @@ var _ = Describe(`IamPolicyManagementV1 Examples Tests`, func() {
panic(err)
}
b, _ := json.MarshalIndent(policy, "", " ")
examplePolicyID = *policy.ID
fmt.Println(string(b))

// end-create_policy

Expect(err).To(BeNil())
Expect(response.StatusCode).To(Equal(201))
Expect(policy).ToNot(BeNil())

examplePolicyID = *policy.ID
})
It(`GetPolicy request example`, func() {
fmt.Println("\nGetPolicy() result:")
Expand All @@ -193,15 +192,14 @@ var _ = Describe(`IamPolicyManagementV1 Examples Tests`, func() {
panic(err)
}
b, _ := json.MarshalIndent(policy, "", " ")
examplePolicyETag = response.GetHeaders().Get("ETag")
fmt.Println(string(b))

// end-get_policy

Expect(err).To(BeNil())
Expect(response.StatusCode).To(Equal(200))
Expect(policy).ToNot(BeNil())

examplePolicyETag = response.GetHeaders().Get("ETag")
})
It(`ReplacePolicy request example`, func() {
fmt.Println("\nReplacePolicy() result:")
Expand Down Expand Up @@ -252,15 +250,14 @@ var _ = Describe(`IamPolicyManagementV1 Examples Tests`, func() {
panic(err)
}
b, _ := json.MarshalIndent(policy, "", " ")
examplePolicyETag = response.GetHeaders().Get("ETag")
fmt.Println(string(b))

// end-replace_policy

Expect(err).To(BeNil())
Expect(response.StatusCode).To(Equal(200))
Expect(policy).ToNot(BeNil())

examplePolicyETag = response.GetHeaders().Get("ETag")
})
It(`UpdatePolicy request example`, func() {
fmt.Println("\nUpdatePolicyState() result:")
Expand Down Expand Up @@ -405,15 +402,14 @@ var _ = Describe(`IamPolicyManagementV1 Examples Tests`, func() {
panic(err)
}
b, _ := json.MarshalIndent(policy, "", " ")
examplePolicyID = *policy.ID
fmt.Println(string(b))

// end-create_v2_policy

Expect(err).To(BeNil())
Expect(response.StatusCode).To(Equal(201))
Expect(policy).ToNot(BeNil())

examplePolicyID = *policy.ID
})
It(`GetV2Policy request example`, func() {
fmt.Println("\nGetV2Policy() result:")
Expand All @@ -428,15 +424,14 @@ var _ = Describe(`IamPolicyManagementV1 Examples Tests`, func() {
panic(err)
}
b, _ := json.MarshalIndent(policy, "", " ")
examplePolicyETag = response.GetHeaders().Get("ETag")
fmt.Println(string(b))

// end-get_v2_policy

Expect(err).To(BeNil())
Expect(response.StatusCode).To(Equal(200))
Expect(policy).ToNot(BeNil())

examplePolicyETag = response.GetHeaders().Get("ETag")
})
It(`ReplaceV2Policy request example`, func() {
fmt.Println("\nReplaceV2Policy() result:")
Expand Down Expand Up @@ -517,8 +512,6 @@ var _ = Describe(`IamPolicyManagementV1 Examples Tests`, func() {
Expect(err).To(BeNil())
Expect(response.StatusCode).To(Equal(200))
Expect(policy).ToNot(BeNil())

examplePolicyETag = response.GetHeaders().Get("ETag")
})
It(`ListV2Policies request example`, func() {
fmt.Println("\nListV2Policies() result:")
Expand Down Expand Up @@ -580,15 +573,14 @@ var _ = Describe(`IamPolicyManagementV1 Examples Tests`, func() {
panic(err)
}
b, _ := json.MarshalIndent(customRole, "", " ")
exampleCustomRoleID = *customRole.ID
fmt.Println(string(b))

// end-create_role

Expect(err).To(BeNil())
Expect(response.StatusCode).To(Equal(201))
Expect(customRole).ToNot(BeNil())

exampleCustomRoleID = *customRole.ID
})
It(`GetRole request example`, func() {
fmt.Println("\nGetRole() result:")
Expand All @@ -603,16 +595,14 @@ var _ = Describe(`IamPolicyManagementV1 Examples Tests`, func() {
panic(err)
}
b, _ := json.MarshalIndent(customRole, "", " ")
exampleCustomRoleETag = response.Headers.Get("ETag")
fmt.Println(string(b))

// end-get_role

Expect(err).To(BeNil())
Expect(response.StatusCode).To(Equal(200))
Expect(customRole).ToNot(BeNil())

exampleCustomRoleETag = response.Headers.Get("ETag")

})
It(`ReplaceRole request example`, func() {
fmt.Println("\nReplaceRole() result:")
Expand Down Expand Up @@ -743,16 +733,14 @@ var _ = Describe(`IamPolicyManagementV1 Examples Tests`, func() {
panic(err)
}
b, _ := json.MarshalIndent(policyTemplate, "", " ")
examplePolicyTemplateID = *policyTemplate.ID
fmt.Println(string(b))

// end-create_policy_template

Expect(err).To(BeNil())
Expect(response.StatusCode).To(Equal(201))
Expect(policyTemplate).ToNot(BeNil())

examplePolicyTemplateID = *policyTemplate.ID

})
It(`GetPolicyTemplate request example`, func() {
fmt.Println("\nGetPolicyTemplate() result:")
Expand All @@ -767,6 +755,7 @@ var _ = Describe(`IamPolicyManagementV1 Examples Tests`, func() {
panic(err)
}
b, _ := json.MarshalIndent(policyTemplate, "", " ")
examplePolicyTemplateETag = response.GetHeaders().Get("ETag")
fmt.Println(string(b))

// end-get_policy_template
Expand All @@ -777,9 +766,6 @@ var _ = Describe(`IamPolicyManagementV1 Examples Tests`, func() {
Expect(policyTemplate.Version).ToNot(BeNil())
Expect(policyTemplate.Name).ToNot(BeNil())
Expect(policyTemplate.Policy).ToNot(BeNil())

examplePolicyTemplateETag = response.GetHeaders().Get("ETag")

})

It(`CreatePolicyTemplateVersion request example`, func() {
Expand Down Expand Up @@ -823,17 +809,15 @@ var _ = Describe(`IamPolicyManagementV1 Examples Tests`, func() {
panic(err)
}
b, _ := json.MarshalIndent(policyTemplate, "", " ")
examplePolicyTemplateETag = response.GetHeaders().Get("ETag")
examplePolicyTemplateVersion = *policyTemplate.Version
fmt.Println(string(b))

// end-create_policy_template_version

Expect(err).To(BeNil())
Expect(response.StatusCode).To(Equal(201))
Expect(policyTemplate).ToNot(BeNil())

examplePolicyTemplateVersion = *policyTemplate.Version
examplePolicyTemplateETag = response.GetHeaders().Get("ETag")

})

It(`ListPolicyTemplateVersions request example`, func() {
Expand Down Expand Up @@ -900,16 +884,15 @@ var _ = Describe(`IamPolicyManagementV1 Examples Tests`, func() {
panic(err)
}
b, _ := json.MarshalIndent(policyTemplate, "", " ")
examplePolicyTemplateVersion = *policyTemplate.Version
examplePolicyTemplateETag = response.GetHeaders().Get("ETag")
fmt.Println(string(b))

// end-replace_policy_template

Expect(err).To(BeNil())
Expect(response.StatusCode).To(Equal(200))
Expect(policyTemplate).ToNot(BeNil())

examplePolicyTemplateVersion = *policyTemplate.Version
examplePolicyTemplateETag = response.GetHeaders().Get("ETag")
})
It(`GetPolicyTemplateVersion request example`, func() {
fmt.Println("\nGetPolicyTemplateVersion() result:")
Expand Down Expand Up @@ -959,7 +942,7 @@ var _ = Describe(`IamPolicyManagementV1 Examples Tests`, func() {

It(`ListPolicyAssignments request example`, func() {
fmt.Println("\nListPolicyAssignments() result:")
// begin-list_Policy Assignments
// begin-list_policy_assignments

listPolicyAssignmentsOptions := iamPolicyManagementService.NewListPolicyAssignmentsOptions(
exampleAccountID,
Expand All @@ -970,9 +953,10 @@ var _ = Describe(`IamPolicyManagementV1 Examples Tests`, func() {
panic(err)
}
b, _ := json.MarshalIndent(polcyTemplateAssignmentCollection, "", " ")
testPolicyAssignmentId = *polcyTemplateAssignmentCollection.Assignments[0].ID
fmt.Println(string(b))

// end-list_Policy Assignments
// end-list_policy_assignments

Expect(err).To(BeNil())
Expect(response.StatusCode).To(Equal(200))
Expand All @@ -993,7 +977,6 @@ var _ = Describe(`IamPolicyManagementV1 Examples Tests`, func() {
Expect(polcyTemplateAssignmentCollection.Assignments[0].LastModifiedByID).ToNot(BeNil())
Expect(polcyTemplateAssignmentCollection.Assignments[0].Href).ToNot(BeNil())

testPolicyAssignmentId = *polcyTemplateAssignmentCollection.Assignments[0].ID
})

It(`GetPolicyAssignment request example`, func() {
Expand All @@ -1009,6 +992,7 @@ var _ = Describe(`IamPolicyManagementV1 Examples Tests`, func() {
panic(err)
}
b, _ := json.MarshalIndent(policyAssignmentRecord, "", " ")
assignmentPolicyID = *policyAssignmentRecord.Resources[0].Policy.ResourceCreated.ID
fmt.Println(string(b))

// end-get_policy_assignment
Expand All @@ -1030,7 +1014,6 @@ var _ = Describe(`IamPolicyManagementV1 Examples Tests`, func() {
Expect(policyAssignmentRecord.LastModifiedAt).ToNot(BeNil())
Expect(policyAssignmentRecord.LastModifiedByID).ToNot(BeNil())
Expect(policyAssignmentRecord.Href).ToNot(BeNil())
assignmentPolicyID = *policyAssignmentRecord.Resources[0].Policy.ResourceCreated.ID
})

It(`GetV2Policy to get Template meta data request example`, func() {
Expand Down

0 comments on commit 8074d5b

Please sign in to comment.