Lists all the managed policies that are available in your AWS account, including your own customer-defined managed policies and all AWS managed policies.
curl -X GET https://iam.amazonaws.com/ \
-d "Action=ListPolicies" \
-d "Version=2010-05-08"
Dim rest As New Chilkat.Rest
Dim success As Boolean
Dim authAws As New Chilkat.AuthAws
authAws.AccessKey = "AWS_ACCESS_KEY"
authAws.SecretKey = "AWS_SECRET_KEY"
authAws.Region = "us-east-1"
authAws.ServiceName = "iam"
rest.SetAuthAws(authAws)
// URL: https://iam.amazonaws.com/
Dim bTls As Boolean
bTls = True
Dim port As Int32
port = 443
Dim bAutoReconnect As Boolean
bAutoReconnect = True
success = rest.Connect("iam.amazonaws.com",port,bTls,bAutoReconnect)
If (success <> True) Then
System.DebugLog("ConnectFailReason: " + Str(rest.ConnectFailReason))
System.DebugLog(rest.LastErrorText)
Return
End If
rest.AddQueryParam("Action","ListPolicies")
rest.AddQueryParam("Version","2010-05-08")
Dim sbResponseBody As New Chilkat.StringBuilder
success = rest.FullRequestNoBodySb("GET","/",sbResponseBody)
If (success <> True) Then
System.DebugLog(rest.LastErrorText)
Return
End If
Dim respStatusCode As Int32
respStatusCode = rest.ResponseStatusCode
If (respStatusCode >= 400) Then
System.DebugLog("Response Status Code = " + Str(respStatusCode))
System.DebugLog("Response Header:")
System.DebugLog(rest.ResponseHeader)
System.DebugLog("Response Body:")
System.DebugLog(sbResponseBody.GetAsString())
Return
End If
Dim xmlResponse As New Chilkat.Xml
xmlResponse.LoadSb(sbResponseBody,True)
Dim ListPoliciesResponse_xmlns As String
Dim tagPath As String
Dim IsTruncated As String
Dim Marker As String
Dim i As Int32
Dim count_i As Int32
Dim PolicyName As String
Dim DefaultVersionId As String
Dim PolicyId As String
Dim Path As String
Dim Arn As String
Dim AttachmentCount As Int32
Dim CreateDate As String
Dim UpdateDate As String
Dim RequestId As String
ListPoliciesResponse_xmlns = xmlResponse.GetAttrValue("xmlns")
IsTruncated = xmlResponse.GetChildContent("ListPoliciesResult|IsTruncated")
Marker = xmlResponse.GetChildContent("ListPoliciesResult|Marker")
i = 0
count_i = xmlResponse.NumChildrenHavingTag("ListPoliciesResult|Policies|member")
While i < count_i
xmlResponse.I = i
PolicyName = xmlResponse.GetChildContent("ListPoliciesResult|Policies|member[i]|PolicyName")
DefaultVersionId = xmlResponse.GetChildContent("ListPoliciesResult|Policies|member[i]|DefaultVersionId")
PolicyId = xmlResponse.GetChildContent("ListPoliciesResult|Policies|member[i]|PolicyId")
Path = xmlResponse.GetChildContent("ListPoliciesResult|Policies|member[i]|Path")
Arn = xmlResponse.GetChildContent("ListPoliciesResult|Policies|member[i]|Arn")
AttachmentCount = xmlResponse.GetChildIntValue("ListPoliciesResult|Policies|member[i]|AttachmentCount")
CreateDate = xmlResponse.GetChildContent("ListPoliciesResult|Policies|member[i]|CreateDate")
UpdateDate = xmlResponse.GetChildContent("ListPoliciesResult|Policies|member[i]|UpdateDate")
i = i + 1
Wend
RequestId = xmlResponse.GetChildContent("ResponseMetadata|RequestId")
<?xml version="1.0" encoding="utf-8" ?>
<ListPoliciesResponse xmlns="https://iam.amazonaws.com/doc/2010-05-08/">
<ListPoliciesResult>
<IsTruncated>true</IsTruncated>
<Marker>EXAMPLEkakv9BCuUNFDtxWSyfzetYwEx2ADc8dnzfvERF5S6YMvXKx41t6gCl/eeaCX3Jo94/bKqezEAg8TEVS
99EKFLxm3jtbpl25FDWEXAMPLE</Marker>
<Policies>
<member>
<PolicyName>ExamplePolicy</PolicyName>
<DefaultVersionId>v1</DefaultVersionId>
<PolicyId>AGPACKCEVSQ6C2EXAMPLE</PolicyId>
<Path>/</Path>
<Arn>arn:aws:iam::123456789012:policy/ExamplePolicy</Arn>
<AttachmentCount>2</AttachmentCount>
<CreateDate>2014-09-15T17:36:14Z</CreateDate>
<UpdateDate>2014-09-15T20:31:47Z</UpdateDate>
</member>
<member>
<PolicyName>PowerUserAccess</PolicyName>
<DefaultVersionId>v1</DefaultVersionId>
<PolicyId>AGPACKCEVSQ6C2EXAMPLE</PolicyId>
<Path>/</Path>
<Arn>arn:aws:iam::aws:policy/PowerUserAccess</Arn>
<AttachmentCount>0</AttachmentCount>
<CreateDate>2014-08-21T20:25:01Z</CreateDate>
<UpdateDate>2014-08-21T20:25:01Z</UpdateDate>
</member>
<member>
<PolicyName>AdministratorAccess</PolicyName>
<DefaultVersionId>v1</DefaultVersionId>
<PolicyId>AGPACKCEVSQ6C2EXAMPLE</PolicyId>
<Path>/</Path>
<Arn>arn:aws:iam::aws:policy/AdministratorAccess</Arn>
<AttachmentCount>1</AttachmentCount>
<CreateDate>2014-08-21T20:11:25Z</CreateDate>
<UpdateDate>2014-08-21T20:11:25Z</UpdateDate>
</member>
<member>
<PolicyName>ReadOnlyAccess</PolicyName>
<DefaultVersionId>v1</DefaultVersionId>
<PolicyId>AGPACKCEVSQ6C2EXAMPLE</PolicyId>
<Path>/</Path>
<Arn>arn:aws:iam::aws:policy/ReadOnlyAccess</Arn>
<AttachmentCount>6</AttachmentCount>
<CreateDate>2014-08-21T20:31:44Z</CreateDate>
<UpdateDate>2014-08-21T20:31:44Z</UpdateDate>
</member>
</Policies>
</ListPoliciesResult>
<ResponseMetadata>
<RequestId>6207e832-3eb7-11e4-9d0d-6f969EXAMPLE</RequestId>
</ResponseMetadata>
</ListPoliciesResponse>