本文整理汇总了Python中airflow.contrib.hooks.aws_hook.AwsHook.expand_role方法的典型用法代码示例。如果您正苦于以下问题:Python AwsHook.expand_role方法的具体用法?Python AwsHook.expand_role怎么用?Python AwsHook.expand_role使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类airflow.contrib.hooks.aws_hook.AwsHook
的用法示例。
在下文中一共展示了AwsHook.expand_role方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: expand_role
# 需要导入模块: from airflow.contrib.hooks.aws_hook import AwsHook [as 别名]
# 或者: from airflow.contrib.hooks.aws_hook.AwsHook import expand_role [as 别名]
def expand_role(self):
if 'Model' not in self.config:
return
hook = AwsHook(self.aws_conn_id)
config = self.config['Model']
if 'ExecutionRoleArn' in config:
config['ExecutionRoleArn'] = hook.expand_role(config['ExecutionRoleArn'])
示例2: test_expand_role
# 需要导入模块: from airflow.contrib.hooks.aws_hook import AwsHook [as 别名]
# 或者: from airflow.contrib.hooks.aws_hook.AwsHook import expand_role [as 别名]
def test_expand_role(self):
conn = boto3.client('iam', region_name='us-east-1')
conn.create_role(RoleName='test-role', AssumeRolePolicyDocument='some policy')
hook = AwsHook()
arn = hook.expand_role('test-role')
expect_arn = conn.get_role(RoleName='test-role').get('Role').get('Arn')
self.assertEqual(arn, expect_arn)
示例3: expand_role
# 需要导入模块: from airflow.contrib.hooks.aws_hook import AwsHook [as 别名]
# 或者: from airflow.contrib.hooks.aws_hook.AwsHook import expand_role [as 别名]
def expand_role(self):
if 'TrainingJobDefinition' in self.config:
config = self.config['TrainingJobDefinition']
if 'RoleArn' in config:
hook = AwsHook(self.aws_conn_id)
config['RoleArn'] = hook.expand_role(config['RoleArn'])
示例4: expand_role
# 需要导入模块: from airflow.contrib.hooks.aws_hook import AwsHook [as 别名]
# 或者: from airflow.contrib.hooks.aws_hook.AwsHook import expand_role [as 别名]
def expand_role(self):
if 'ExecutionRoleArn' in self.config:
hook = AwsHook(self.aws_conn_id)
self.config['ExecutionRoleArn'] = hook.expand_role(self.config['ExecutionRoleArn'])