Skip to content

update_profile

update_profile(
    profile_id: ProfileIdentifier,
    *,
    config_overrides: Optional[RolesAnywhereClientConfig] = None,
    name: Optional[ResourceName] = None,
    session_policy: Optional[str] = None,
    role_arns: Optional[RoleArnList] = None,
    managed_policy_arns: Optional[ManagedPolicyList] = None,
    duration_seconds: Optional[int] = None,
    accept_role_session_name: Optional[bool] = None,
    alias_name: Optional[AliasName] = None,
    tip_configuration: Optional[TipConfiguration] = None,
) -> ProfileDetailResponse

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.

Parameters:

  • profile_id (ProfileIdentifier) –

    The profile to act on. You can specify one of the following:

    • The profile ID.

    • The profile ARN.

    • The alias ARN of the profile.

    An ARN must be for a profile in your account and Region.

  • name (Optional[ResourceName], default: None ) –

    The name of the profile.

  • session_policy (Optional[str], default: None ) –

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

  • role_arns (Optional[RoleArnList], default: None ) –

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

  • managed_policy_arns (Optional[ManagedPolicyList], default: None ) –

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

  • duration_seconds (Optional[int], default: None ) –

    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.

  • accept_role_session_name (Optional[bool], default: None ) –

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

  • alias_name (Optional[AliasName], default: None ) –

    The alias for the profile.

    You can use this parameter in the following ways:

    • To set or change the alias, specify the new alias name. After the change, the previous alias ARN no longer identifies the resource. You can then assign the previous alias to another resource of the same type. A change can take a short time to take effect for requests that use an alias ARN.

    • To remove the alias, specify an empty string.

    • To keep the current alias, omit this parameter.

    An alias name contains 1 to 256 characters. It must begin with a letter (A-Z or a-z). It can contain only letters (A-Z and a-z), numbers (0-9), underscores (_), hyphens (-), and forward slashes (/). A forward slash can appear only between two other characters, so an alias name can't end with a forward slash or contain two in a row. Alias names that begin with aws/, in any combination of uppercase and lowercase letters, are reserved. Alias names are case sensitive.

    The alias name must be unique among resources of the same type in your account and Region. If another resource of the same type already has the alias, the request fails with a ValidationException. An invalid or reserved alias name also causes a ValidationException.

  • tip_configuration (Optional[TipConfiguration], default: None ) –

    The trusted identity propagation (TIP) settings for the profile. The settings that you specify replace the current settings, and a field that you omit returns to its default. If you omit this parameter, the TIP settings don't change.

Raises:

Source code in docs_src/capo_rolesanywhere/_services/roles_anywhere.py
def update_profile(
    self,
    profile_id: "capo_rolesanywhere.types.profile_identifier.ProfileIdentifier",
    *,
    config_overrides: Optional[RolesAnywhereClientConfig] = None,
    name: Optional["capo_rolesanywhere.types.resource_name.ResourceName"] = None,
    session_policy: Optional[str] = None,
    role_arns: Optional[
        "capo_rolesanywhere.types.role_arn_list.RoleArnList"
    ] = None,
    managed_policy_arns: Optional[
        "capo_rolesanywhere.types.managed_policy_list.ManagedPolicyList"
    ] = None,
    duration_seconds: Optional[int] = None,
    accept_role_session_name: Optional[bool] = None,
    alias_name: Optional["capo_rolesanywhere.types.alias_name.AliasName"] = None,
    tip_configuration: Optional[
        "capo_rolesanywhere.types.tip_configuration.TipConfiguration"
    ] = None,
) -> "capo_rolesanywhere.types.profile_detail_response.ProfileDetailResponse":
    """<p>Updates a <i>profile</i>, a list of the roles that IAM Roles Anywhere service is trusted to assume. You use profiles to intersect permissions with IAM managed policies.</p> <p> <b>Required permissions: </b> <code>rolesanywhere:UpdateProfile</code>. </p>

    Args:
        profile_id: <p>The profile to act on. You can specify one of the following:</p> <ul> <li> <p>The profile ID.</p> </li> <li> <p>The profile ARN.</p> </li> <li> <p>The alias ARN of the profile.</p> </li> </ul> <p>An ARN must be for a profile in your account and Region.</p>
        name: <p>The name of the profile.</p>
        session_policy: <p>A session policy that applies to the trust boundary of the vended session credentials. </p>
        role_arns: <p>A list of IAM roles that this profile can assume in a temporary credential request.</p>
        managed_policy_arns: <p>A list of managed policy ARNs that apply to the vended session credentials. </p>
        duration_seconds: <p> Used to determine how long sessions vended using this profile are valid for. See the <code>Expiration</code> section of the <a href="https://docs.aws.amazon.com/rolesanywhere/latest/userguide/authentication-create-session.html#credentials-object">CreateSession API documentation</a> page for more details. In requests, if this value is not provided, the default value will be 3600. </p>
        accept_role_session_name: <p>Used to determine if a custom role session name will be accepted in a temporary credential request.</p>
        alias_name: <p>The alias for the profile.</p> <p>You can use this parameter in the following ways:</p> <ul> <li> <p>To set or change the alias, specify the new alias name. After the change, the previous alias ARN no longer identifies the resource. You can then assign the previous alias to another resource of the same type. A change can take a short time to take effect for requests that use an alias ARN.</p> </li> <li> <p>To remove the alias, specify an empty string.</p> </li> <li> <p>To keep the current alias, omit this parameter.</p> </li> </ul> <p>An alias name contains 1 to 256 characters. It must begin with a letter (A-Z or a-z). It can contain only letters (A-Z and a-z), numbers (0-9), underscores (_), hyphens (-), and forward slashes (/). A forward slash can appear only between two other characters, so an alias name can't end with a forward slash or contain two in a row. Alias names that begin with <code>aws/</code>, in any combination of uppercase and lowercase letters, are reserved. Alias names are case sensitive.</p> <p>The alias name must be unique among resources of the same type in your account and Region. If another resource of the same type already has the alias, the request fails with a <code>ValidationException</code>. An invalid or reserved alias name also causes a <code>ValidationException</code>.</p>
        tip_configuration: <p>The trusted identity propagation (TIP) settings for the profile. The settings that you specify replace the current settings, and a field that you omit returns to its default. If you omit this parameter, the TIP settings don't change.</p>

    Raises:
        capo_rolesanywhere.errors.access_denied_exception.AccessDeniedException: <p>You do not have sufficient access to perform this action.</p>
        capo_rolesanywhere.errors.resource_not_found_exception.ResourceNotFoundException: <p>The resource could not be found.</p>
        capo_rolesanywhere.errors.service_unavailable_exception.ServiceUnavailableException: <p>The request has failed due to a temporary failure of the service.</p>
        capo_rolesanywhere.errors.validation_exception.ValidationException: <p>Validation exception error.</p>
        capo_rolesanywhere.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_rolesanywhere.types.update_profile_request.UpdateProfileRequest]",
    ) -> OperationResponse[
        "capo_rolesanywhere.types.profile_detail_response.ProfileDetailResponse"
    ]:
        import capo_rolesanywhere._operations.roles_anywhere.update_profile

        output, http_response = (
            capo_rolesanywhere._operations.roles_anywhere.update_profile.update_profile(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("UpdateProfile")
    )
    input_: capo_rolesanywhere.types.update_profile_request.UpdateProfileRequest = {
        "profile_id": profile_id
    }
    if name is not None:
        input_["name"] = name
    if session_policy is not None:
        input_["session_policy"] = session_policy
    if role_arns is not None:
        input_["role_arns"] = role_arns
    if managed_policy_arns is not None:
        input_["managed_policy_arns"] = managed_policy_arns
    if duration_seconds is not None:
        input_["duration_seconds"] = duration_seconds
    if accept_role_session_name is not None:
        input_["accept_role_session_name"] = accept_role_session_name
    if alias_name is not None:
        input_["alias_name"] = alias_name
    if tip_configuration is not None:
        input_["tip_configuration"] = tip_configuration

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output