AWS SDK for C++

AWS SDK for C++ Version 1.11.440

Loading...
Searching...
No Matches
AccessManagementClient.h
1
5#pragma once
6
7#include <aws/access-management/AccessManagement_EXPORTS.h>
8
9#include <aws/core/utils/memory/AWSMemory.h>
10#include <aws/core/utils/memory/stl/AWSString.h>
11
12#include <functional>
13
14namespace Aws
15{
16namespace CognitoIdentity
17{
18
19class CognitoIdentityClient;
20
21} // namespace CognitoIdentity;
22
23namespace IAM
24{
25
26class IAMClient;
27
28namespace Model
29{
30class Group;
31class Policy;
32class Role;
33class User;
34
35} // Model
36} // namespace IAM
37
38namespace AccessManagement
39{
40
41enum class QueryResult
42{
43 YES,
44 NO,
46};
47
49{
52};
53
54class AWS_ACCESS_MANAGEMENT_API AccessManagementClient
55{
56 public:
57
58 AccessManagementClient(std::shared_ptr< Aws::IAM::IAMClient >& iamClient, std::shared_ptr< Aws::CognitoIdentity::CognitoIdentityClient >& cognitoClient);
60
61 using PolicyGeneratorFunction = std::function< Aws::String(void) >;
62
63 // Misc
65
66 // Compound Operation API for IAM
67 bool GetOrCreateGroup (const Aws::String& groupName, Aws::IAM::Model::Group& groupData);
68 bool GetOrCreatePolicy(const Aws::String& policyName, const PolicyGeneratorFunction& policyGenerator, Aws::IAM::Model::Policy& policyData);
69 bool GetOrCreateRole (const Aws::String& roleName, const PolicyGeneratorFunction& assumedPolicyGenerator, Aws::IAM::Model::Role& roleData);
70 bool GetOrCreateUser (const Aws::String& userName, Aws::IAM::Model::User& userData);
72
73 bool AttachPolicyToGroupIfNot(const Aws::IAM::Model::Policy& policyData, const Aws::String& groupName);
74 bool AttachPolicyToRoleIfNot (const Aws::IAM::Model::Policy& policyData, const Aws::String& roleName);
75 bool AttachPolicyToUserIfNot (const Aws::IAM::Model::Policy& policyData, const Aws::String& userName);
76
77 bool AddUserToGroupIfNot(const Aws::String& userName, const Aws::String& groupName);
78
79 bool VerifyOrCreateCredentialsFileForUser(const Aws::String& credentialsFilename, const Aws::String& userName);
80
81 // Compound Operation API for Cognito
82 bool GetOrCreateIdentityPool(const Aws::String& poolName, bool allowUnauthenticated, Aws::String& identityPoolId);
83
84 bool BindRoleToIdentityPoolIfNot(const Aws::String& identityPoolId, const Aws::String& roleArn, IdentityPoolRoleBindingType roleKey);
85
86
87 // Simple IAM API
88 // State query
93
94 // Creation
95 bool CreateGroup (const Aws::String& groupName, Aws::IAM::Model::Group& groupData);
96 bool CreatePolicy(const Aws::String& policyName, const Aws::String& policyDocument, Aws::IAM::Model::Policy& policyData);
97 bool CreateRole (const Aws::String& roleName, const Aws::String& assumedPolicyDocument, Aws::IAM::Model::Role& roleData);
98 bool CreateUser (const Aws::String& userName, Aws::IAM::Model::User& userData);
99
100 // Policy-Principal Relations
101 bool AttachPolicyToGroup(const Aws::String& policyArn, const Aws::String& groupName);
102 bool AttachPolicyToRole (const Aws::String& policyArn, const Aws::String& roleName);
103 bool AttachPolicyToUser (const Aws::String& policyArn, const Aws::String& userName);
104
105 bool DetachPolicyFromGroup(const Aws::String& policyArn, const Aws::String& groupName);
106 bool DetachPolicyFromRole (const Aws::String& policyArn, const Aws::String& roleName);
107 bool DetachPolicyFromUser (const Aws::String& policyArn, const Aws::String& userName);
108
109 QueryResult IsPolicyAttachedToGroup(const Aws::String& policyName, const Aws::String& groupName);
110 QueryResult IsPolicyAttachedToRole (const Aws::String& policyName, const Aws::String& roleName);
111 QueryResult IsPolicyAttachedToUser (const Aws::String& policyName, const Aws::String& userName);
112
113 // User-Group Relations
114 QueryResult IsUserInGroup(const Aws::String& userName, const Aws::String& groupName);
115 bool AddUserToGroup (const Aws::String& userName, const Aws::String& groupName);
116 bool RemoveUserFromGroup (const Aws::String& userName, const Aws::String& groupName);
117
118 // Deletion
119 bool DeleteGroup (const Aws::String& groupName);
120 bool DeletePolicy(const Aws::String& policyName);
121 bool DeleteRole (const Aws::String& roleName);
122 bool DeleteUser (const Aws::String& userName);
123
124 bool DoesCredentialsFileExist (const Aws::String& credentialsFilename);
125 bool CreateCredentialsFileForUser(const Aws::String& credentialsFilename, const Aws::String& userName);
126
127 //
128 // Cognito integration
129 QueryResult GetIdentityPool (const Aws::String& poolName, Aws::String& identityPoolId);
130 bool CreateIdentityPool(const Aws::String& poolName, bool allowUnauthenticated, Aws::String& identityPoolId);
131 bool DeleteIdentityPool(const Aws::String& poolName);
132
133
135 bool BindRoleToIdentityPool (const Aws::String& identityPoolId, const Aws::String& roleArn, IdentityPoolRoleBindingType roleKey);
136
137 private:
138
139 bool RemoveUsersFromGroup(const Aws::String& groupName);
140 bool DetachPoliciesFromGroup(const Aws::String& groupName);
141 bool DeleteInlinePoliciesFromGroup(const Aws::String& groupName);
142
143 bool DeleteAccessKeysForUser(const Aws::String& userName);
144 bool RemoveUserFromGroups(const Aws::String& userName);
145 bool RemoveCertificatesFromUser(const Aws::String& userName);
146 bool RemovePasswordFromUser(const Aws::String& userName);
147 bool DeleteInlinePoliciesFromUser(const Aws::String& userName);
148 bool RemoveMFAFromUser(const Aws::String& userName);
149 bool DetachPoliciesFromUser(const Aws::String& userName);
150
151 bool RemovePolicyFromEntities(const Aws::String& policyArn);
152
153 bool RemoveRoleFromInstanceProfiles(const Aws::String& roleName);
154 bool DeleteInlinePoliciesFromRole(const Aws::String& roleName);
155 bool DetachPoliciesFromRole(const Aws::String& roleName);
156
157 std::shared_ptr< Aws::IAM::IAMClient > m_iamClient;
158 std::shared_ptr< Aws::CognitoIdentity::CognitoIdentityClient > m_cognitoClient;
159
160};
161
162
163
164
165} // namespace AccessManagement
166} // namespace Aws
QueryResult IsUserInGroup(const Aws::String &userName, const Aws::String &groupName)
bool AddUserToGroupIfNot(const Aws::String &userName, const Aws::String &groupName)
bool GetOrCreateGroup(const Aws::String &groupName, Aws::IAM::Model::Group &groupData)
bool GetOrCreatePolicy(const Aws::String &policyName, const PolicyGeneratorFunction &policyGenerator, Aws::IAM::Model::Policy &policyData)
bool BindRoleToIdentityPool(const Aws::String &identityPoolId, const Aws::String &roleArn, IdentityPoolRoleBindingType roleKey)
bool CreateIdentityPool(const Aws::String &poolName, bool allowUnauthenticated, Aws::String &identityPoolId)
AccessManagementClient(std::shared_ptr< Aws::IAM::IAMClient > &iamClient, std::shared_ptr< Aws::CognitoIdentity::CognitoIdentityClient > &cognitoClient)
bool CreateCredentialsFileForUser(const Aws::String &credentialsFilename, const Aws::String &userName)
QueryResult GetUser(const Aws::String &userName, Aws::IAM::Model::User &userData)
static Aws::String ExtractAccountIdFromArn(const Aws::String &arn)
bool GetOrCreateRole(const Aws::String &roleName, const PolicyGeneratorFunction &assumedPolicyGenerator, Aws::IAM::Model::Role &roleData)
bool DetachPolicyFromGroup(const Aws::String &policyArn, const Aws::String &groupName)
bool CreatePolicy(const Aws::String &policyName, const Aws::String &policyDocument, Aws::IAM::Model::Policy &policyData)
bool GetOrCreateUser(const Aws::String &userName, Aws::IAM::Model::User &userData)
bool DeletePolicy(const Aws::String &policyName)
std::function< Aws::String(void) > PolicyGeneratorFunction
QueryResult IsPolicyAttachedToGroup(const Aws::String &policyName, const Aws::String &groupName)
bool DoesCredentialsFileExist(const Aws::String &credentialsFilename)
QueryResult GetIdentityPool(const Aws::String &poolName, Aws::String &identityPoolId)
QueryResult GetPolicy(const Aws::String &policyName, Aws::IAM::Model::Policy &policyData)
bool AttachPolicyToRole(const Aws::String &policyArn, const Aws::String &roleName)
bool DeleteRole(const Aws::String &roleName)
bool DeleteIdentityPool(const Aws::String &poolName)
bool AttachPolicyToGroup(const Aws::String &policyArn, const Aws::String &groupName)
bool CreateRole(const Aws::String &roleName, const Aws::String &assumedPolicyDocument, Aws::IAM::Model::Role &roleData)
bool CreateUser(const Aws::String &userName, Aws::IAM::Model::User &userData)
QueryResult GetGroup(const Aws::String &groupName, Aws::IAM::Model::Group &groupData)
bool AddUserToGroup(const Aws::String &userName, const Aws::String &groupName)
bool DeleteGroup(const Aws::String &groupName)
bool AttachPolicyToGroupIfNot(const Aws::IAM::Model::Policy &policyData, const Aws::String &groupName)
bool DetachPolicyFromUser(const Aws::String &policyArn, const Aws::String &userName)
bool AttachPolicyToRoleIfNot(const Aws::IAM::Model::Policy &policyData, const Aws::String &roleName)
bool AttachPolicyToUserIfNot(const Aws::IAM::Model::Policy &policyData, const Aws::String &userName)
QueryResult GetRole(const Aws::String &roleName, Aws::IAM::Model::Role &roleData)
bool RemoveUserFromGroup(const Aws::String &userName, const Aws::String &groupName)
bool DeleteUser(const Aws::String &userName)
bool GetOrCreateIdentityPool(const Aws::String &poolName, bool allowUnauthenticated, Aws::String &identityPoolId)
bool BindRoleToIdentityPoolIfNot(const Aws::String &identityPoolId, const Aws::String &roleArn, IdentityPoolRoleBindingType roleKey)
QueryResult IsPolicyAttachedToUser(const Aws::String &policyName, const Aws::String &userName)
QueryResult IsPolicyAttachedToRole(const Aws::String &policyName, const Aws::String &roleName)
bool VerifyOrCreateCredentialsFileForUser(const Aws::String &credentialsFilename, const Aws::String &userName)
bool CreateGroup(const Aws::String &groupName, Aws::IAM::Model::Group &groupData)
bool AttachPolicyToUser(const Aws::String &policyArn, const Aws::String &userName)
bool DetachPolicyFromRole(const Aws::String &policyArn, const Aws::String &roleName)
QueryResult IsRoleBoundToIdentityPool(const Aws::String &identityPoolId, const Aws::String &roleArn, IdentityPoolRoleBindingType roleKey)
std::basic_string< char, std::char_traits< char >, Aws::Allocator< char > > String