updateProfile method

Future<ProfileDetailResponse> updateProfile({
  1. required String profileId,
  2. bool? acceptRoleSessionName,
  3. int? durationSeconds,
  4. List<String>? managedPolicyArns,
  5. String? name,
  6. List<String>? roleArns,
  7. String? sessionPolicy,
})

Updates a profile, a list of the roles that IAM Roles Anywhere service is trusted to assume. You use profiles to intersect permissions with IAM managed policies.

Required permissions: rolesanywhere:UpdateProfile.

May throw AccessDeniedException. May throw ResourceNotFoundException. May throw ValidationException.

Parameter profileId : The unique identifier of the profile.

Parameter acceptRoleSessionName : Used to determine if a custom role session name will be accepted in a temporary credential request.

Parameter durationSeconds : Used to determine how long sessions vended using this profile are valid for. See the Expiration section of the CreateSession API documentation page for more details. In requests, if this value is not provided, the default value will be 3600.

Parameter managedPolicyArns : A list of managed policy ARNs that apply to the vended session credentials.

Parameter name : The name of the profile.

Parameter roleArns : A list of IAM roles that this profile can assume in a temporary credential request.

Parameter sessionPolicy : A session policy that applies to the trust boundary of the vended session credentials.

Implementation

Future<ProfileDetailResponse> updateProfile({
  required String profileId,
  bool? acceptRoleSessionName,
  int? durationSeconds,
  List<String>? managedPolicyArns,
  String? name,
  List<String>? roleArns,
  String? sessionPolicy,
}) async {
  final $payload = <String, dynamic>{
    if (acceptRoleSessionName != null)
      'acceptRoleSessionName': acceptRoleSessionName,
    if (durationSeconds != null) 'durationSeconds': durationSeconds,
    if (managedPolicyArns != null) 'managedPolicyArns': managedPolicyArns,
    if (name != null) 'name': name,
    if (roleArns != null) 'roleArns': roleArns,
    if (sessionPolicy != null) 'sessionPolicy': sessionPolicy,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'PATCH',
    requestUri: '/profile/${Uri.encodeComponent(profileId)}',
    exceptionFnMap: _exceptionFns,
  );
  return ProfileDetailResponse.fromJson(response);
}