Skip to content

update_role_alias

update_role_alias(
    role_alias: RoleAlias,
    *,
    config_overrides: Optional[IoTClientConfig] = None,
    role_arn: Optional[RoleArn] = None,
    credential_duration_seconds: Optional[CredentialDurationSeconds] = None,
) -> UpdateRoleAliasResponse

Updates a role alias.

Requires permission to access the UpdateRoleAlias action.

The value of credentialDurationSeconds must be less than or equal to the maximum session duration of the IAM role that the role alias references. For more information, see Modifying a role maximum session duration (Amazon Web Services API) from the Amazon Web Services Identity and Access Management User Guide.

Parameters:

  • role_alias (RoleAlias) –

    The role alias to update.

  • role_arn (Optional[RoleArn], default: None ) –

    The role ARN.

  • credential_duration_seconds (Optional[CredentialDurationSeconds], default: None ) –

    The number of seconds the credential will be valid.

    This value must be less than or equal to the maximum session duration of the IAM role that the role alias references.

Raises:

Source code in docs_src/capo_iot/_services/io_t.py
def update_role_alias(
    self,
    role_alias: "capo_iot.types.role_alias.RoleAlias",
    *,
    config_overrides: Optional[IoTClientConfig] = None,
    role_arn: Optional["capo_iot.types.role_arn.RoleArn"] = None,
    credential_duration_seconds: Optional[
        "capo_iot.types.credential_duration_seconds.CredentialDurationSeconds"
    ] = None,
) -> "capo_iot.types.update_role_alias_response.UpdateRoleAliasResponse":
    """<p>Updates a role alias.</p> <p>Requires permission to access the <a href="https://docs.aws.amazon.com/service-authorization/latest/reference/list_awsiot.html#awsiot-actions-as-permissions">UpdateRoleAlias</a> action.</p> <important> <p>The value of <a href="https://docs.aws.amazon.com/iot/latest/apireference/API_UpdateRoleAlias.html#iot-UpdateRoleAlias-request-credentialDurationSeconds"> <code>credentialDurationSeconds</code> </a> must be less than or equal to the maximum session duration of the IAM role that the role alias references. For more information, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/roles-managingrole-editing-api.html#roles-modify_max-session-duration-api"> Modifying a role maximum session duration (Amazon Web Services API)</a> from the Amazon Web Services Identity and Access Management User Guide.</p> </important>

    Args:
        role_alias: <p>The role alias to update.</p>
        role_arn: <p>The role ARN.</p>
        credential_duration_seconds: <p>The number of seconds the credential will be valid.</p> <p>This value must be less than or equal to the maximum session duration of the IAM role that the role alias references.</p>

    Raises:
        capo_iot.errors.internal_failure_exception.InternalFailureException: <p>An unexpected error has occurred.</p>
        capo_iot.errors.invalid_request_exception.InvalidRequestException: <p>The request is not valid.</p>
        capo_iot.errors.resource_not_found_exception.ResourceNotFoundException: <p>The specified resource does not exist.</p>
        capo_iot.errors.service_unavailable_exception.ServiceUnavailableException: <p>The service is temporarily unavailable.</p>
        capo_iot.errors.throttling_exception.ThrottlingException: <p>The rate exceeds the limit.</p>
        capo_iot.errors.unauthorized_exception.UnauthorizedException: <p>You are not authorized to perform this operation.</p>
        capo_iot.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_iot.types.update_role_alias_request.UpdateRoleAliasRequest]",
    ) -> OperationResponse[
        "capo_iot.types.update_role_alias_response.UpdateRoleAliasResponse"
    ]:
        import capo_iot._operations.aws_iot_service.update_role_alias

        output, http_response = (
            capo_iot._operations.aws_iot_service.update_role_alias.update_role_alias(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("UpdateRoleAlias")
    )
    input_: capo_iot.types.update_role_alias_request.UpdateRoleAliasRequest = {
        "role_alias": role_alias
    }
    if role_arn is not None:
        input_["role_arn"] = role_arn
    if credential_duration_seconds is not None:
        input_["credential_duration_seconds"] = credential_duration_seconds

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