Skip to content

create_profile

create_profile(
    name: ResourceName,
    role_arns: RoleArnList,
    *,
    config_overrides: Optional[RolesAnywhereClientConfig] = None,
    require_instance_properties: Optional[bool] = None,
    session_policy: Optional[str] = None,
    managed_policy_arns: Optional[ManagedPolicyList] = None,
    duration_seconds: Optional[int] = None,
    enabled: Optional[bool] = None,
    tags: Optional[TagList] = None,
    accept_role_session_name: Optional[bool] = None,
    alias_name: Optional[AliasName] = None,
    tip_configuration: Optional[TipConfiguration] = None,
) -> ProfileDetailResponse

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.

Parameters:

  • name (ResourceName) –

    The name of the profile.

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

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

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

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

  • role_arns (RoleArnList) –

    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.

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

    Specifies whether the profile is enabled.

  • tags (Optional[TagList], default: None ) –

    The tags to attach to the profile.

  • 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 ) –

    An alias for the profile. When you set an alias, the response includes the alias ARN of the profile in aliasArn.

    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.

    If you omit this parameter or specify an empty string, the resource is created without an alias.

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

    The trusted identity propagation (TIP) settings for the profile. When you enable TIP, sessions from the profile include the identity from the certificate in aws:OriginIdentity condition keys.

    If you omit this parameter, the profile doesn't use TIP.

Raises:

Source code in docs_src/capo_rolesanywhere/_services/roles_anywhere.py
def create_profile(
    self,
    name: "capo_rolesanywhere.types.resource_name.ResourceName",
    role_arns: "capo_rolesanywhere.types.role_arn_list.RoleArnList",
    *,
    config_overrides: Optional[RolesAnywhereClientConfig] = None,
    require_instance_properties: Optional[bool] = None,
    session_policy: Optional[str] = None,
    managed_policy_arns: Optional[
        "capo_rolesanywhere.types.managed_policy_list.ManagedPolicyList"
    ] = None,
    duration_seconds: Optional[int] = None,
    enabled: Optional[bool] = None,
    tags: Optional["capo_rolesanywhere.types.tag_list.TagList"] = 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>Creates a <i>profile</i>, a list of the roles that 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:CreateProfile</code>. </p>

    Args:
        name: <p>The name of the profile.</p>
        require_instance_properties: <p>Unused, saved for future use. Will likely specify whether instance properties are required in temporary credential requests with this 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>
        enabled: <p>Specifies whether the profile is enabled.</p>
        tags: <p>The tags to attach to the profile.</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>An alias for the profile. When you set an alias, the response includes the alias ARN of the profile in <code>aliasArn</code>.</p> <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> <p>If you omit this parameter or specify an empty string, the resource is created without an alias.</p>
        tip_configuration: <p>The trusted identity propagation (TIP) settings for the profile. When you enable TIP, sessions from the profile include the identity from the certificate in <code>aws:OriginIdentity</code> condition keys.</p> <p>If you omit this parameter, the profile doesn't use TIP.</p>

    Raises:
        capo_rolesanywhere.errors.access_denied_exception.AccessDeniedException: <p>You do not have sufficient access to perform this action.</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.create_profile_request.CreateProfileRequest]",
    ) -> OperationResponse[
        "capo_rolesanywhere.types.profile_detail_response.ProfileDetailResponse"
    ]:
        import capo_rolesanywhere._operations.roles_anywhere.create_profile

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

    def _redact_input(
        input_: "capo_rolesanywhere.types.create_profile_request.CreateProfileRequest",
    ) -> dict[str, Any]:
        import capo_rolesanywhere.types.create_profile_request

        return capo_rolesanywhere.types.create_profile_request.redact_sensitive(
            input_
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging("CreateProfile", redact_input=_redact_input),
    )
    input_: capo_rolesanywhere.types.create_profile_request.CreateProfileRequest = {
        "name": name,
        "role_arns": role_arns,
    }
    if require_instance_properties is not None:
        input_["require_instance_properties"] = require_instance_properties
    if session_policy is not None:
        input_["session_policy"] = session_policy
    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 enabled is not None:
        input_["enabled"] = enabled
    if tags is not None:
        input_["tags"] = tags
    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