removeRoleFromInstanceProfile method

Future<void> removeRoleFromInstanceProfile({
  1. required String instanceProfileName,
  2. required String roleName,
})

Removes the specified IAM role from the specified EC2 instance profile. For more information about IAM roles, go to Working with Roles. For more information about instance profiles, go to About Instance Profiles.

May throw NoSuchEntityException. May throw LimitExceededException. May throw UnmodifiableEntityException. May throw ServiceFailureException.

Parameter instanceProfileName : The name of the instance profile to update.

This parameter allows (through its regex pattern) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-

Parameter roleName : The name of the role to remove.

This parameter allows (through its regex pattern) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-

Implementation

Future<void> removeRoleFromInstanceProfile({
  required String instanceProfileName,
  required String roleName,
}) async {
  ArgumentError.checkNotNull(instanceProfileName, 'instanceProfileName');
  _s.validateStringLength(
    'instanceProfileName',
    instanceProfileName,
    1,
    128,
    isRequired: true,
  );
  ArgumentError.checkNotNull(roleName, 'roleName');
  _s.validateStringLength(
    'roleName',
    roleName,
    1,
    64,
    isRequired: true,
  );
  final $request = <String, dynamic>{};
  $request['InstanceProfileName'] = instanceProfileName;
  $request['RoleName'] = roleName;
  await _protocol.send(
    $request,
    action: 'RemoveRoleFromInstanceProfile',
    version: '2010-05-08',
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    shape: shapes['RemoveRoleFromInstanceProfileRequest'],
    shapes: shapes,
  );
}