Skip to content

associate_environment_operations_role

associate_environment_operations_role(
    environment_name: EnvironmentName,
    operations_role: OperationsRole,
    *,
    config_overrides: Optional[ElasticBeanstalkClientConfig] = None,
) -> None

The operations role feature of Elastic Beanstalk is in beta release and is subject to change.

Add or change the operations role used by an environment. After this call is made, Elastic Beanstalk uses the associated operations role for permissions to downstream services during subsequent calls acting on this environment.

Parameters:

  • environment_name (EnvironmentName) –

    The name of the environment to which to set the operations role.

  • operations_role (OperationsRole) –

    The Amazon Resource Name (ARN) of an existing IAM role to be used as the environment's operations role.

Raises:

Source code in docs_src/capo_elastic_beanstalk/_services/elastic_beanstalk.py
def associate_environment_operations_role(
    self,
    environment_name: "capo_elastic_beanstalk.types.environment_name.EnvironmentName",
    operations_role: "capo_elastic_beanstalk.types.operations_role.OperationsRole",
    *,
    config_overrides: Optional[ElasticBeanstalkClientConfig] = None,
) -> None:
    """<important> <p>The operations role feature of Elastic Beanstalk is in beta release and is subject to change.</p> </important> <p>Add or change the operations role used by an environment. After this call is made, Elastic Beanstalk uses the associated operations role for permissions to downstream services during subsequent calls acting on this environment.</p>

    Args:
        environment_name: <p>The name of the environment to which to set the operations role.</p>
        operations_role: <p>The Amazon Resource Name (ARN) of an existing IAM role to be used as the environment's operations role.</p>

    Raises:
        capo_elastic_beanstalk.errors.insufficient_privileges_exception.InsufficientPrivilegesException: <p>The specified account does not have sufficient privileges for one or more Amazon Web Services services.</p>
        capo_elastic_beanstalk.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_elastic_beanstalk.types.associate_environment_operations_role_message.AssociateEnvironmentOperationsRoleMessage]",
    ) -> OperationResponse[None]:
        import capo_elastic_beanstalk._operations.aws_elastic_beanstalk_service.associate_environment_operations_role

        output, http_response = (
            capo_elastic_beanstalk._operations.aws_elastic_beanstalk_service.associate_environment_operations_role.associate_environment_operations_role(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("AssociateEnvironmentOperationsRole")
    )
    input_: capo_elastic_beanstalk.types.associate_environment_operations_role_message.AssociateEnvironmentOperationsRoleMessage = {
        "environment_name": environment_name,
        "operations_role": operations_role,
    }

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