mik-laj commented on a change in pull request #16571: URL: https://github.com/apache/airflow/pull/16571#discussion_r670801679
########## File path: airflow/providers/amazon/aws/sensors/eks.py ########## @@ -0,0 +1,129 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# +"""Tracking the state of EKS Clusters and Nodegroups.""" + +from typing import Optional + +from airflow.providers.amazon.aws.hooks.eks import EKSHook +from airflow.sensors.base import BaseSensorOperator +from airflow.utils.decorators import apply_defaults + +CONN_ID = "eks" +TARGET_STATE = 'ACTIVE' + + +class EKSClusterStateSensor(BaseSensorOperator): + """ + Check the state of an Amazon EKS Cluster until the state of the Cluster equals the target state. + + :param cluster_name: The name of the Cluster to watch. + :type cluster_name: str + :param target_state: Target state of the Cluster. + :type target_state: str + """ + + template_fields = ("target_state", "cluster_name") + ui_color = "#ff9900" + ui_fgcolor = "#232F3E" + valid_states = ["CREATING", "ACTIVE", "DELETING", "FAILED", "UPDATING"] + + @apply_defaults + def __init__( + self, + *, + cluster_name: str, + target_state: Optional[str] = TARGET_STATE, + conn_id: Optional[str] = CONN_ID, Review comment: ```suggestion aws_conn_id: Optional[str] = CONN_ID, ``` All AWS operators use this name. For consistency, we should follow this convention. -- 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]
