createProfile method

Future<ProfileDetailResponse> createProfile({
  1. required String name,
  2. required List<String> roleArns,
  3. bool? acceptRoleSessionName,
  4. int? durationSeconds,
  5. bool? enabled,
  6. List<String>? managedPolicyArns,
  7. bool? requireInstanceProperties,
  8. String? sessionPolicy,
  9. List<Tag>? tags,
})

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

Required permissions: rolesanywhere:CreateProfile.

May throw AccessDeniedException. May throw ValidationException.

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 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 enabled : Specifies whether the profile is enabled.

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

Parameter requireInstanceProperties : Unused, saved for future use. Will likely specify whether instance properties are required in temporary credential requests with this profile.

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

Parameter tags : The tags to attach to the profile.

Implementation

Future<ProfileDetailResponse> createProfile({
  required String name,
  required List<String> roleArns,
  bool? acceptRoleSessionName,
  int? durationSeconds,
  bool? enabled,
  List<String>? managedPolicyArns,
  bool? requireInstanceProperties,
  String? sessionPolicy,
  List<Tag>? tags,
}) async {
  final $payload = <String, dynamic>{
    'name': name,
    'roleArns': roleArns,
    if (acceptRoleSessionName != null)
      'acceptRoleSessionName': acceptRoleSessionName,
    if (durationSeconds != null) 'durationSeconds': durationSeconds,
    if (enabled != null) 'enabled': enabled,
    if (managedPolicyArns != null) 'managedPolicyArns': managedPolicyArns,
    if (requireInstanceProperties != null)
      'requireInstanceProperties': requireInstanceProperties,
    if (sessionPolicy != null) 'sessionPolicy': sessionPolicy,
    if (tags != null) 'tags': tags,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri: '/profiles',
    exceptionFnMap: _exceptionFns,
  );
  return ProfileDetailResponse.fromJson(response);
}