kazanzhy commented on code in PR #27076:
URL: https://github.com/apache/airflow/pull/27076#discussion_r996487826
##########
airflow/providers/amazon/aws/operators/rds.py:
##########
@@ -672,6 +682,135 @@ def execute(self, context: Context) -> str:
return json.dumps(delete_db_instance, default=str)
+class RdsStartDbOperator(RdsBaseOperator):
+ """
+ Starts an RDS DB instance / cluster
+
+ .. seealso::
+ For more information on how to use this operator, take a look at the
guide:
+ :ref:`howto/operator:RdsStartDbOperator`
+
+ :param db_identifier: The AWS identifier of the DB to start
+ :param db_type: Type of the DB - either "instance" or "cluster" (default:
"instance")
+ :param aws_conn_id: The Airflow connection used for AWS credentials.
(default: "aws_default")
+ :param wait_for_completion: If True, waits for DB to start. (default:
True)
+ """
+
+ template_fields = ("db_identifier", "db_type")
+
+ def __init__(
+ self,
+ *,
+ db_identifier: str,
+ db_type: str = "instance",
+ aws_conn_id: str = "aws_default",
+ wait_for_completion: bool = True,
+ **kwargs,
+ ):
+ super().__init__(aws_conn_id=aws_conn_id, **kwargs)
+ self.db_identifier = db_identifier
+ self.db_type = db_type
+ self.wait_for_completion = wait_for_completion
+
+ def execute(self, context: Context) -> str:
+ self.db_type = RdsDbType(self.db_type)
Review Comment:
Can you describe the reason for making `db_type` a templated field?
It could be either `instance` or `cluster` so do we need to make it more
complex?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]