def list_instance_profiles(self, max_items=None, path_prefix=None, marker=None): request = Request() request.set_action(u'ListInstanceProfiles') if max_items is not None: request.set_max_items(max_items) if path_prefix is not None: request.set_path_prefix(path_prefix) if marker is not None: request.set_marker(marker) try: response = self.call(request) except AwsServiceException: raise results = response[u'ListInstanceProfilesResponse']\ [u'ListInstanceProfilesResult'][u'InstanceProfiles'] request_id = response[u'ListInstanceProfilesResponse']\ [u'ResponseMetadata'][u'RequestId'] profiles = [] for result in results: profiles.append(InstanceProfile.from_json(result)) return Response(request_id, profiles)
def put_role_policy(self, role_name, policy_name, policy_document): request = Request() request.set_action(u'PutRolePolicy') request.set_role_name(role_name) request.set_policy_name(policy_name) request.set_policy_document(policy_document) try: response = self.call(request) except AwsServiceException: raise request_id = response[u'PutRolePolicyResponse']\ [u'ResponseMetadata'][u'RequestId'] return Response(request_id)
def create_role(self, role_name, assume_role_policy_document, path = None): request = Request() request.set_action(u'CreateRole') request.set_role_name(role_name) request.set_assume_role_policy_document(assume_role_policy_document) if path is not None: request.set_path(path) try: response = self.call(request) except AwsServiceException: raise role = Role.from_json(response[u'CreateRoleResponse'][u'CreateRoleResult'][u'Role']) request_id = response[u'CreateRoleResponse'][u'ResponseMetadata'][u'RequestId'] return Response(request_id, role)
def add_role_to_instance_profile(self, role_name, instance_profile_name): request = Request() request.set_action(u'AddRoleToInstanceProfile') request.set_role_name(role_name) request.set_instance_profile_name(instance_profile_name) try: response = self.call(request) except AwsServiceException: raise request_id = response[u'AddRoleToInstanceProfileResponse']\ [u'ResponseMetadata'][u'RequestId'] return Response(request_id)
def create_instance_profile(self, instance_profile_name, path = None): request = Request() request.set_action(u'CreateInstanceProfile') request.set_instance_profile_name(instance_profile_name) if path is not None: request.set_path(path) try: response = self.call(request) except AwsServiceException: raise profile = InstanceProfile.from_json(response[u'CreateInstanceProfileResponse']\ [u'CreateInstanceProfileResult'][u'InstanceProfile']) request_id = response[u'CreateInstanceProfileResponse']\ [u'ResponseMetadata'][u'RequestId'] return Response(request_id, profile)
def list_instance_profiles(self, max_items = None, path_prefix = None, marker = None): request = Request() request.set_action(u'ListInstanceProfiles') if max_items is not None: request.set_max_items(max_items) if path_prefix is not None: request.set_path_prefix(path_prefix) if marker is not None: request.set_marker(marker) try: response = self.call(request) except AwsServiceException: raise results = response[u'ListInstanceProfilesResponse']\ [u'ListInstanceProfilesResult'][u'InstanceProfiles'] request_id = response[u'ListInstanceProfilesResponse']\ [u'ResponseMetadata'][u'RequestId'] profiles = [] for result in results: profiles.append(InstanceProfile.from_json(result)) return Response(request_id, profiles)