Ejemplo n.º 1
0
 def test_expand_role(self):
     conn = boto3.client('iam', region_name='us-east-1')
     conn.create_role(RoleName='test-role', AssumeRolePolicyDocument='some policy')
     hook = AwsBaseHook(aws_conn_id='aws_default', client_type='airflow_test')
     arn = hook.expand_role('test-role')
     expect_arn = conn.get_role(RoleName='test-role').get('Role').get('Arn')
     self.assertEqual(arn, expect_arn)
Ejemplo n.º 2
0
 def expand_role(self):
     if 'Model' not in self.config:
         return
     config = self.config['Model']
     if 'ExecutionRoleArn' in config:
         hook = AwsBaseHook(self.aws_conn_id, client_type='iam')
         config['ExecutionRoleArn'] = hook.expand_role(config['ExecutionRoleArn'])
Ejemplo n.º 3
0
 def expand_role(self) -> None:
     """Expands an IAM role name into an ARN."""
     if 'TrainingJobDefinition' in self.config:
         config = self.config['TrainingJobDefinition']
         if 'RoleArn' in config:
             hook = AwsBaseHook(self.aws_conn_id, client_type='iam')
             config['RoleArn'] = hook.expand_role(config['RoleArn'])
Ejemplo n.º 4
0
 def expand_role(self):
     if 'Model' not in self.config:
         return
     hook = AwsBaseHook(self.aws_conn_id)
     config = self.config['Model']
     if 'ExecutionRoleArn' in config:
         config['ExecutionRoleArn'] = hook.expand_role(
             config['ExecutionRoleArn'])
Ejemplo n.º 5
0
 def expand_role(self) -> None:
     """Expands an IAM role name into an ARN."""
     if 'Model' not in self.config:
         return
     config = self.config['Model']
     if 'ExecutionRoleArn' in config:
         hook = AwsBaseHook(self.aws_conn_id, client_type='iam')
         config['ExecutionRoleArn'] = hook.expand_role(config['ExecutionRoleArn'])
Ejemplo n.º 6
0
 def expand_role(self) -> None:
     if 'ExecutionRoleArn' in self.config:
         hook = AwsBaseHook(self.aws_conn_id, client_type='iam')
         self.config['ExecutionRoleArn'] = hook.expand_role(
             self.config['ExecutionRoleArn'])
 def expand_role(self):
     if 'RoleArn' in self.config:
         hook = AwsBaseHook(self.aws_conn_id, client_type='iam')
         self.config['RoleArn'] = hook.expand_role(self.config['RoleArn'])
Ejemplo n.º 8
0
 def expand_role(self):
     if 'TrainingJobDefinition' in self.config:
         config = self.config['TrainingJobDefinition']
         if 'RoleArn' in config:
             hook = AwsBaseHook(self.aws_conn_id, client_type='iam')
             config['RoleArn'] = hook.expand_role(config['RoleArn'])
 def expand_role(self):
     if 'RoleArn' in self.config:
         hook = AwsBaseHook(self.aws_conn_id)
         self.config['RoleArn'] = hook.expand_role(self.config['RoleArn'])
Ejemplo n.º 10
0
 def expand_role(self) -> None:
     """Expands an IAM role name into an ARN."""
     if 'RoleArn' in self.config:
         hook = AwsBaseHook(self.aws_conn_id, client_type='iam')
         self.config['RoleArn'] = hook.expand_role(self.config['RoleArn'])