apache-airflow-providers-amazon 8.16.0rc1__py3-none-any.whl → 8.17.0rc2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- airflow/providers/amazon/__init__.py +1 -1
- airflow/providers/amazon/aws/auth_manager/avp/entities.py +1 -0
- airflow/providers/amazon/aws/auth_manager/avp/facade.py +34 -19
- airflow/providers/amazon/aws/auth_manager/aws_auth_manager.py +44 -1
- airflow/providers/amazon/aws/auth_manager/cli/__init__.py +16 -0
- airflow/providers/amazon/aws/auth_manager/cli/avp_commands.py +178 -0
- airflow/providers/amazon/aws/auth_manager/cli/definition.py +62 -0
- airflow/providers/amazon/aws/auth_manager/cli/schema.json +171 -0
- airflow/providers/amazon/aws/auth_manager/constants.py +1 -0
- airflow/providers/amazon/aws/executors/ecs/ecs_executor.py +77 -23
- airflow/providers/amazon/aws/executors/ecs/ecs_executor_config.py +17 -0
- airflow/providers/amazon/aws/executors/ecs/utils.py +1 -1
- airflow/providers/amazon/aws/executors/utils/__init__.py +16 -0
- airflow/providers/amazon/aws/executors/utils/exponential_backoff_retry.py +60 -0
- airflow/providers/amazon/aws/hooks/athena_sql.py +168 -0
- airflow/providers/amazon/aws/hooks/base_aws.py +14 -0
- airflow/providers/amazon/aws/hooks/quicksight.py +33 -18
- airflow/providers/amazon/aws/hooks/redshift_data.py +66 -17
- airflow/providers/amazon/aws/hooks/redshift_sql.py +1 -1
- airflow/providers/amazon/aws/hooks/s3.py +18 -4
- airflow/providers/amazon/aws/log/cloudwatch_task_handler.py +2 -2
- airflow/providers/amazon/aws/operators/batch.py +33 -15
- airflow/providers/amazon/aws/operators/cloud_formation.py +37 -26
- airflow/providers/amazon/aws/operators/datasync.py +19 -18
- airflow/providers/amazon/aws/operators/dms.py +57 -69
- airflow/providers/amazon/aws/operators/ec2.py +19 -5
- airflow/providers/amazon/aws/operators/emr.py +30 -10
- airflow/providers/amazon/aws/operators/eventbridge.py +57 -80
- airflow/providers/amazon/aws/operators/quicksight.py +17 -24
- airflow/providers/amazon/aws/operators/redshift_data.py +68 -19
- airflow/providers/amazon/aws/operators/s3.py +1 -1
- airflow/providers/amazon/aws/operators/sagemaker.py +42 -12
- airflow/providers/amazon/aws/sensors/cloud_formation.py +30 -25
- airflow/providers/amazon/aws/sensors/dms.py +31 -24
- airflow/providers/amazon/aws/sensors/dynamodb.py +15 -15
- airflow/providers/amazon/aws/sensors/quicksight.py +34 -24
- airflow/providers/amazon/aws/sensors/redshift_cluster.py +41 -3
- airflow/providers/amazon/aws/sensors/s3.py +13 -8
- airflow/providers/amazon/aws/triggers/redshift_cluster.py +54 -2
- airflow/providers/amazon/aws/triggers/redshift_data.py +113 -0
- airflow/providers/amazon/aws/triggers/s3.py +9 -4
- airflow/providers/amazon/get_provider_info.py +55 -16
- {apache_airflow_providers_amazon-8.16.0rc1.dist-info → apache_airflow_providers_amazon-8.17.0rc2.dist-info}/METADATA +15 -13
- {apache_airflow_providers_amazon-8.16.0rc1.dist-info → apache_airflow_providers_amazon-8.17.0rc2.dist-info}/RECORD +46 -38
- {apache_airflow_providers_amazon-8.16.0rc1.dist-info → apache_airflow_providers_amazon-8.17.0rc2.dist-info}/WHEEL +0 -0
- {apache_airflow_providers_amazon-8.16.0rc1.dist-info → apache_airflow_providers_amazon-8.17.0rc2.dist-info}/entry_points.txt +0 -0
@@ -17,7 +17,7 @@
|
|
17
17
|
from __future__ import annotations
|
18
18
|
|
19
19
|
from functools import cached_property
|
20
|
-
from typing import TYPE_CHECKING
|
20
|
+
from typing import TYPE_CHECKING
|
21
21
|
|
22
22
|
from airflow.configuration import conf
|
23
23
|
from airflow.exceptions import AirflowException
|
@@ -25,9 +25,11 @@ from airflow.providers.amazon.aws.auth_manager.avp.entities import AvpEntities,
|
|
25
25
|
from airflow.providers.amazon.aws.auth_manager.constants import (
|
26
26
|
CONF_AVP_POLICY_STORE_ID_KEY,
|
27
27
|
CONF_CONN_ID_KEY,
|
28
|
+
CONF_REGION_NAME_KEY,
|
28
29
|
CONF_SECTION_NAME,
|
29
30
|
)
|
30
31
|
from airflow.providers.amazon.aws.hooks.verified_permissions import VerifiedPermissionsHook
|
32
|
+
from airflow.utils.helpers import prune_dict
|
31
33
|
from airflow.utils.log.logging_mixin import LoggingMixin
|
32
34
|
|
33
35
|
if TYPE_CHECKING:
|
@@ -46,7 +48,8 @@ class AwsAuthManagerAmazonVerifiedPermissionsFacade(LoggingMixin):
|
|
46
48
|
def avp_client(self):
|
47
49
|
"""Build Amazon Verified Permissions client."""
|
48
50
|
aws_conn_id = conf.get(CONF_SECTION_NAME, CONF_CONN_ID_KEY)
|
49
|
-
|
51
|
+
region_name = conf.get(CONF_SECTION_NAME, CONF_REGION_NAME_KEY)
|
52
|
+
return VerifiedPermissionsHook(aws_conn_id=aws_conn_id, region_name=region_name).conn
|
50
53
|
|
51
54
|
@cached_property
|
52
55
|
def avp_policy_store_id(self):
|
@@ -58,9 +61,9 @@ class AwsAuthManagerAmazonVerifiedPermissionsFacade(LoggingMixin):
|
|
58
61
|
*,
|
59
62
|
method: ResourceMethod,
|
60
63
|
entity_type: AvpEntities,
|
61
|
-
user: AwsAuthManagerUser,
|
64
|
+
user: AwsAuthManagerUser | None,
|
62
65
|
entity_id: str | None = None,
|
63
|
-
|
66
|
+
context: dict | None = None,
|
64
67
|
) -> bool:
|
65
68
|
"""
|
66
69
|
Make an authorization decision against Amazon Verified Permissions.
|
@@ -72,14 +75,12 @@ class AwsAuthManagerAmazonVerifiedPermissionsFacade(LoggingMixin):
|
|
72
75
|
:param user: the user
|
73
76
|
:param entity_id: the entity ID the user accesses. If not provided, all entities of the type will be
|
74
77
|
considered.
|
75
|
-
:param
|
76
|
-
Permissions. Only needed if some resource properties are used in the policies (e.g. DAG folder).
|
78
|
+
:param context: optional additional context to pass to Amazon Verified Permissions.
|
77
79
|
"""
|
80
|
+
if user is None:
|
81
|
+
return False
|
82
|
+
|
78
83
|
entity_list = self._get_user_role_entities(user)
|
79
|
-
if entity_fetcher and entity_id:
|
80
|
-
# If no entity ID is provided, there is no need to fetch entities.
|
81
|
-
# We just need to know whether the user has permissions to access all resources from this type
|
82
|
-
entity_list += entity_fetcher()
|
83
84
|
|
84
85
|
self.log.debug(
|
85
86
|
"Making authorization request for user=%s, method=%s, entity_type=%s, entity_id=%s",
|
@@ -89,17 +90,22 @@ class AwsAuthManagerAmazonVerifiedPermissionsFacade(LoggingMixin):
|
|
89
90
|
entity_id,
|
90
91
|
)
|
91
92
|
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
"
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
93
|
+
request_params = prune_dict(
|
94
|
+
{
|
95
|
+
"policyStoreId": self.avp_policy_store_id,
|
96
|
+
"principal": {"entityType": get_entity_type(AvpEntities.USER), "entityId": user.get_id()},
|
97
|
+
"action": {
|
98
|
+
"actionType": get_entity_type(AvpEntities.ACTION),
|
99
|
+
"actionId": get_action_id(entity_type, method),
|
100
|
+
},
|
101
|
+
"resource": {"entityType": get_entity_type(entity_type), "entityId": entity_id or "*"},
|
102
|
+
"entities": {"entityList": entity_list},
|
103
|
+
"context": self._build_context(context),
|
104
|
+
}
|
101
105
|
)
|
102
106
|
|
107
|
+
resp = self.avp_client.is_authorized(**request_params)
|
108
|
+
|
103
109
|
self.log.debug("Authorization response: %s", resp)
|
104
110
|
|
105
111
|
if len(resp.get("errors", [])) > 0:
|
@@ -124,3 +130,12 @@ class AwsAuthManagerAmazonVerifiedPermissionsFacade(LoggingMixin):
|
|
124
130
|
for group in user.get_groups()
|
125
131
|
]
|
126
132
|
return [user_entity, *role_entities]
|
133
|
+
|
134
|
+
@staticmethod
|
135
|
+
def _build_context(context: dict | None) -> dict | None:
|
136
|
+
if context is None or len(context) == 0:
|
137
|
+
return None
|
138
|
+
|
139
|
+
return {
|
140
|
+
"contextMap": context,
|
141
|
+
}
|
@@ -16,15 +16,20 @@
|
|
16
16
|
# under the License.
|
17
17
|
from __future__ import annotations
|
18
18
|
|
19
|
+
import argparse
|
19
20
|
from functools import cached_property
|
20
21
|
from typing import TYPE_CHECKING
|
21
22
|
|
22
23
|
from flask import session, url_for
|
23
24
|
|
25
|
+
from airflow.cli.cli_config import CLICommand, DefaultHelpParser, GroupCommand
|
24
26
|
from airflow.configuration import conf
|
25
27
|
from airflow.exceptions import AirflowOptionalProviderFeatureException
|
26
28
|
from airflow.providers.amazon.aws.auth_manager.avp.entities import AvpEntities
|
27
29
|
from airflow.providers.amazon.aws.auth_manager.avp.facade import AwsAuthManagerAmazonVerifiedPermissionsFacade
|
30
|
+
from airflow.providers.amazon.aws.auth_manager.cli.definition import (
|
31
|
+
AWS_AUTH_MANAGER_COMMANDS,
|
32
|
+
)
|
28
33
|
from airflow.providers.amazon.aws.auth_manager.constants import (
|
29
34
|
CONF_ENABLE_KEY,
|
30
35
|
CONF_SECTION_NAME,
|
@@ -122,7 +127,23 @@ class AwsAuthManager(BaseAuthManager):
|
|
122
127
|
details: DagDetails | None = None,
|
123
128
|
user: BaseUser | None = None,
|
124
129
|
) -> bool:
|
125
|
-
|
130
|
+
dag_id = details.id if details else None
|
131
|
+
context = (
|
132
|
+
None
|
133
|
+
if access_entity is None
|
134
|
+
else {
|
135
|
+
"dag_entity": {
|
136
|
+
"string": access_entity.value,
|
137
|
+
},
|
138
|
+
}
|
139
|
+
)
|
140
|
+
return self.avp_facade.is_authorized(
|
141
|
+
method=method,
|
142
|
+
entity_type=AvpEntities.DAG,
|
143
|
+
user=user or self.get_user(),
|
144
|
+
entity_id=dag_id,
|
145
|
+
context=context,
|
146
|
+
)
|
126
147
|
|
127
148
|
def is_authorized_dataset(
|
128
149
|
self, *, method: ResourceMethod, details: DatasetDetails | None = None, user: BaseUser | None = None
|
@@ -179,3 +200,25 @@ class AwsAuthManager(BaseAuthManager):
|
|
179
200
|
@cached_property
|
180
201
|
def security_manager(self) -> AwsSecurityManagerOverride:
|
181
202
|
return AwsSecurityManagerOverride(self.appbuilder)
|
203
|
+
|
204
|
+
@staticmethod
|
205
|
+
def get_cli_commands() -> list[CLICommand]:
|
206
|
+
"""Vends CLI commands to be included in Airflow CLI."""
|
207
|
+
return [
|
208
|
+
GroupCommand(
|
209
|
+
name="aws-auth-manager",
|
210
|
+
help="Manage resources used by AWS auth manager",
|
211
|
+
subcommands=AWS_AUTH_MANAGER_COMMANDS,
|
212
|
+
),
|
213
|
+
]
|
214
|
+
|
215
|
+
|
216
|
+
def get_parser() -> argparse.ArgumentParser:
|
217
|
+
"""Generate documentation; used by Sphinx argparse."""
|
218
|
+
from airflow.cli.cli_parser import AirflowHelpFormatter, _add_command
|
219
|
+
|
220
|
+
parser = DefaultHelpParser(prog="airflow", formatter_class=AirflowHelpFormatter)
|
221
|
+
subparsers = parser.add_subparsers(dest="subcommand", metavar="GROUP_OR_COMMAND")
|
222
|
+
for group_command in AwsAuthManager.get_cli_commands():
|
223
|
+
_add_command(subparsers, group_command)
|
224
|
+
return parser
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# Licensed to the Apache Software Foundation (ASF) under one
|
2
|
+
# or more contributor license agreements. See the NOTICE file
|
3
|
+
# distributed with this work for additional information
|
4
|
+
# regarding copyright ownership. The ASF licenses this file
|
5
|
+
# to you under the Apache License, Version 2.0 (the
|
6
|
+
# "License"); you may not use this file except in compliance
|
7
|
+
# with the License. You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing,
|
12
|
+
# software distributed under the License is distributed on an
|
13
|
+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
14
|
+
# KIND, either express or implied. See the License for the
|
15
|
+
# specific language governing permissions and limitations
|
16
|
+
# under the License.
|
@@ -0,0 +1,178 @@
|
|
1
|
+
# Licensed to the Apache Software Foundation (ASF) under one
|
2
|
+
# or more contributor license agreements. See the NOTICE file
|
3
|
+
# distributed with this work for additional information
|
4
|
+
# regarding copyright ownership. The ASF licenses this file
|
5
|
+
# to you under the Apache License, Version 2.0 (the
|
6
|
+
# "License"); you may not use this file except in compliance
|
7
|
+
# with the License. You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing,
|
12
|
+
# software distributed under the License is distributed on an
|
13
|
+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
14
|
+
# KIND, either express or implied. See the License for the
|
15
|
+
# specific language governing permissions and limitations
|
16
|
+
# under the License.
|
17
|
+
"""User sub-commands."""
|
18
|
+
from __future__ import annotations
|
19
|
+
|
20
|
+
import json
|
21
|
+
import logging
|
22
|
+
from pathlib import Path
|
23
|
+
from typing import TYPE_CHECKING
|
24
|
+
|
25
|
+
import boto3
|
26
|
+
|
27
|
+
from airflow.configuration import conf
|
28
|
+
from airflow.exceptions import AirflowOptionalProviderFeatureException
|
29
|
+
from airflow.providers.amazon.aws.auth_manager.constants import CONF_REGION_NAME_KEY, CONF_SECTION_NAME
|
30
|
+
from airflow.utils import cli as cli_utils
|
31
|
+
|
32
|
+
try:
|
33
|
+
from airflow.utils.providers_configuration_loader import providers_configuration_loaded
|
34
|
+
except ImportError:
|
35
|
+
raise AirflowOptionalProviderFeatureException(
|
36
|
+
"Failed to import avp_commands. This feature is only available in Airflow "
|
37
|
+
"version >= 2.8.0 where Auth Managers are introduced."
|
38
|
+
)
|
39
|
+
|
40
|
+
if TYPE_CHECKING:
|
41
|
+
from botocore.client import BaseClient
|
42
|
+
|
43
|
+
log = logging.getLogger(__name__)
|
44
|
+
|
45
|
+
|
46
|
+
@cli_utils.action_cli
|
47
|
+
@providers_configuration_loaded
|
48
|
+
def init_avp(args):
|
49
|
+
"""Initialize Amazon Verified Permissions resources."""
|
50
|
+
client = _get_client()
|
51
|
+
|
52
|
+
# Create the policy store if needed
|
53
|
+
policy_store_id, is_new_policy_store = _create_policy_store(client, args)
|
54
|
+
|
55
|
+
if not is_new_policy_store:
|
56
|
+
print(
|
57
|
+
f"Since an existing policy store with description '{args.policy_store_description}' has been found in Amazon Verified Permissions, "
|
58
|
+
"the CLI nade no changes to this policy store for security reasons. "
|
59
|
+
"Any modification to this policy store must be done manually.",
|
60
|
+
)
|
61
|
+
else:
|
62
|
+
# Set the schema
|
63
|
+
_set_schema(client, policy_store_id, args)
|
64
|
+
|
65
|
+
if not args.dry_run:
|
66
|
+
print("Amazon Verified Permissions resources created successfully.")
|
67
|
+
print("Please set them in Airflow configuration under AIRFLOW__AWS_AUTH_MANAGER__<config name>.")
|
68
|
+
print(json.dumps({"avp_policy_store_id": policy_store_id}, indent=4))
|
69
|
+
|
70
|
+
|
71
|
+
@cli_utils.action_cli
|
72
|
+
@providers_configuration_loaded
|
73
|
+
def update_schema(args):
|
74
|
+
"""Update Amazon Verified Permissions policy store schema."""
|
75
|
+
client = _get_client()
|
76
|
+
_set_schema(client, args.policy_store_id, args)
|
77
|
+
|
78
|
+
if not args.dry_run:
|
79
|
+
print("Amazon Verified Permissions policy store schema updated successfully.")
|
80
|
+
|
81
|
+
|
82
|
+
def _get_client():
|
83
|
+
"""Returns Amazon Verified Permissions client."""
|
84
|
+
region_name = conf.get(CONF_SECTION_NAME, CONF_REGION_NAME_KEY)
|
85
|
+
return boto3.client("verifiedpermissions", region_name=region_name)
|
86
|
+
|
87
|
+
|
88
|
+
def _create_policy_store(client: BaseClient, args) -> tuple[str | None, bool]:
|
89
|
+
"""
|
90
|
+
Create if needed the policy store.
|
91
|
+
|
92
|
+
This function returns two elements:
|
93
|
+
- the policy store ID
|
94
|
+
- whether the policy store ID returned refers to a newly created policy store.
|
95
|
+
"""
|
96
|
+
paginator = client.get_paginator("list_policy_stores")
|
97
|
+
pages = paginator.paginate()
|
98
|
+
policy_stores = [application for page in pages for application in page["policyStores"]]
|
99
|
+
existing_policy_stores = [
|
100
|
+
policy_store
|
101
|
+
for policy_store in policy_stores
|
102
|
+
if policy_store.get("description") == args.policy_store_description
|
103
|
+
]
|
104
|
+
|
105
|
+
if args.verbose:
|
106
|
+
log.debug("Policy stores found: %s", policy_stores)
|
107
|
+
log.debug("Existing policy stores found: %s", existing_policy_stores)
|
108
|
+
|
109
|
+
if len(existing_policy_stores) > 0:
|
110
|
+
print(
|
111
|
+
f"There is already a policy store with description '{args.policy_store_description}' in Amazon Verified Permissions: '{existing_policy_stores[0]['policyStoreId']}'."
|
112
|
+
)
|
113
|
+
return existing_policy_stores[0]["policyStoreId"], False
|
114
|
+
else:
|
115
|
+
print(f"No policy store with description '{args.policy_store_description}' found, creating one.")
|
116
|
+
if args.dry_run:
|
117
|
+
print(
|
118
|
+
"Dry run, not creating the policy store with description '{args.policy_store_description}'."
|
119
|
+
)
|
120
|
+
return None, True
|
121
|
+
|
122
|
+
response = client.create_policy_store(
|
123
|
+
validationSettings={
|
124
|
+
"mode": "OFF",
|
125
|
+
},
|
126
|
+
description=args.policy_store_description,
|
127
|
+
)
|
128
|
+
if args.verbose:
|
129
|
+
log.debug("Response from create_policy_store: %s", response)
|
130
|
+
|
131
|
+
print(f"Policy store created: '{response['policyStoreId']}'")
|
132
|
+
|
133
|
+
return response["policyStoreId"], True
|
134
|
+
|
135
|
+
|
136
|
+
def _set_schema(client: BaseClient, policy_store_id: str, args) -> None:
|
137
|
+
"""Set the policy store schema."""
|
138
|
+
if args.dry_run:
|
139
|
+
print(f"Dry run, not updating the schema of the policy store with ID '{policy_store_id}'.")
|
140
|
+
return
|
141
|
+
|
142
|
+
if args.verbose:
|
143
|
+
log.debug("Disabling schema validation before updating schema")
|
144
|
+
|
145
|
+
response = client.update_policy_store(
|
146
|
+
policyStoreId=policy_store_id,
|
147
|
+
validationSettings={
|
148
|
+
"mode": "OFF",
|
149
|
+
},
|
150
|
+
)
|
151
|
+
|
152
|
+
if args.verbose:
|
153
|
+
log.debug("Response from update_policy_store: %s", response)
|
154
|
+
|
155
|
+
schema_path = Path(__file__).parents[0].joinpath("schema.json").resolve()
|
156
|
+
with open(schema_path) as schema_file:
|
157
|
+
response = client.put_schema(
|
158
|
+
policyStoreId=policy_store_id,
|
159
|
+
definition={
|
160
|
+
"cedarJson": schema_file.read(),
|
161
|
+
},
|
162
|
+
)
|
163
|
+
|
164
|
+
if args.verbose:
|
165
|
+
log.debug("Response from put_schema: %s", response)
|
166
|
+
|
167
|
+
if args.verbose:
|
168
|
+
log.debug("Enabling schema validation after updating schema")
|
169
|
+
|
170
|
+
response = client.update_policy_store(
|
171
|
+
policyStoreId=policy_store_id,
|
172
|
+
validationSettings={
|
173
|
+
"mode": "STRICT",
|
174
|
+
},
|
175
|
+
)
|
176
|
+
|
177
|
+
if args.verbose:
|
178
|
+
log.debug("Response from update_policy_store: %s", response)
|
@@ -0,0 +1,62 @@
|
|
1
|
+
# Licensed to the Apache Software Foundation (ASF) under one
|
2
|
+
# or more contributor license agreements. See the NOTICE file
|
3
|
+
# distributed with this work for additional information
|
4
|
+
# regarding copyright ownership. The ASF licenses this file
|
5
|
+
# to you under the Apache License, Version 2.0 (the
|
6
|
+
# "License"); you may not use this file except in compliance
|
7
|
+
# with the License. You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing,
|
12
|
+
# software distributed under the License is distributed on an
|
13
|
+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
14
|
+
# KIND, either express or implied. See the License for the
|
15
|
+
# specific language governing permissions and limitations
|
16
|
+
# under the License.
|
17
|
+
|
18
|
+
from __future__ import annotations
|
19
|
+
|
20
|
+
from airflow.cli.cli_config import (
|
21
|
+
ActionCommand,
|
22
|
+
Arg,
|
23
|
+
lazy_load_command,
|
24
|
+
)
|
25
|
+
|
26
|
+
############
|
27
|
+
# # ARGS # #
|
28
|
+
############
|
29
|
+
|
30
|
+
ARG_VERBOSE = Arg(("-v", "--verbose"), help="Make logging output more verbose", action="store_true")
|
31
|
+
|
32
|
+
ARG_DRY_RUN = Arg(
|
33
|
+
("--dry-run",),
|
34
|
+
help="Perform a dry run",
|
35
|
+
action="store_true",
|
36
|
+
)
|
37
|
+
|
38
|
+
# Amazon Verified Permissions
|
39
|
+
ARG_POLICY_STORE_DESCRIPTION = Arg(
|
40
|
+
("--policy-store-description",), help="Policy store description", default="Airflow"
|
41
|
+
)
|
42
|
+
ARG_POLICY_STORE_ID = Arg(("--policy-store-id",), help="Policy store ID")
|
43
|
+
|
44
|
+
|
45
|
+
################
|
46
|
+
# # COMMANDS # #
|
47
|
+
################
|
48
|
+
|
49
|
+
AWS_AUTH_MANAGER_COMMANDS = (
|
50
|
+
ActionCommand(
|
51
|
+
name="init-avp",
|
52
|
+
help="Initialize Amazon Verified resources to be used by AWS manager",
|
53
|
+
func=lazy_load_command("airflow.providers.amazon.aws.auth_manager.cli.avp_commands.init_avp"),
|
54
|
+
args=(ARG_POLICY_STORE_DESCRIPTION, ARG_DRY_RUN, ARG_VERBOSE),
|
55
|
+
),
|
56
|
+
ActionCommand(
|
57
|
+
name="update-avp-schema",
|
58
|
+
help="Update Amazon Verified permissions policy store schema to the latest version in 'airflow/providers/amazon/aws/auth_manager/cli/schema.json'",
|
59
|
+
func=lazy_load_command("airflow.providers.amazon.aws.auth_manager.cli.avp_commands.update_schema"),
|
60
|
+
args=(ARG_POLICY_STORE_ID, ARG_DRY_RUN, ARG_VERBOSE),
|
61
|
+
),
|
62
|
+
)
|
@@ -0,0 +1,171 @@
|
|
1
|
+
{
|
2
|
+
"Airflow": {
|
3
|
+
"actions": {
|
4
|
+
"Connection::DELETE": {
|
5
|
+
"appliesTo": {
|
6
|
+
"principalTypes": ["User"],
|
7
|
+
"resourceTypes": ["Connection"]
|
8
|
+
}
|
9
|
+
},
|
10
|
+
"Connection::GET": {
|
11
|
+
"appliesTo": {
|
12
|
+
"principalTypes": ["User"],
|
13
|
+
"resourceTypes": ["Connection"]
|
14
|
+
}
|
15
|
+
},
|
16
|
+
"Connection::POST": {
|
17
|
+
"appliesTo": {
|
18
|
+
"principalTypes": ["User"],
|
19
|
+
"resourceTypes": ["Connection"]
|
20
|
+
}
|
21
|
+
},
|
22
|
+
"Connection::PUT": {
|
23
|
+
"appliesTo": {
|
24
|
+
"principalTypes": ["User"],
|
25
|
+
"resourceTypes": ["Connection"]
|
26
|
+
}
|
27
|
+
},
|
28
|
+
"Configuration::GET": {
|
29
|
+
"appliesTo": {
|
30
|
+
"principalTypes": ["User"],
|
31
|
+
"resourceTypes": ["Configuration"]
|
32
|
+
}
|
33
|
+
},
|
34
|
+
"Dag::DELETE": {
|
35
|
+
"appliesTo": {
|
36
|
+
"principalTypes": ["User"],
|
37
|
+
"resourceTypes": ["Dag"],
|
38
|
+
"context": {
|
39
|
+
"attributes": {
|
40
|
+
"dag_entity": {
|
41
|
+
"type": "String",
|
42
|
+
"required": false
|
43
|
+
}
|
44
|
+
},
|
45
|
+
"type": "Record"
|
46
|
+
}
|
47
|
+
}
|
48
|
+
},
|
49
|
+
"Dag::GET": {
|
50
|
+
"appliesTo": {
|
51
|
+
"principalTypes": ["User"],
|
52
|
+
"resourceTypes": ["Dag"],
|
53
|
+
"context": {
|
54
|
+
"attributes": {
|
55
|
+
"dag_entity": {
|
56
|
+
"required": false,
|
57
|
+
"type": "String"
|
58
|
+
}
|
59
|
+
},
|
60
|
+
"type": "Record"
|
61
|
+
}
|
62
|
+
}
|
63
|
+
},
|
64
|
+
"Dag::POST": {
|
65
|
+
"appliesTo": {
|
66
|
+
"principalTypes": ["User"],
|
67
|
+
"resourceTypes": ["Dag"],
|
68
|
+
"context": {
|
69
|
+
"attributes": {
|
70
|
+
"dag_entity": {
|
71
|
+
"required": false,
|
72
|
+
"type": "String"
|
73
|
+
}
|
74
|
+
},
|
75
|
+
"type": "Record"
|
76
|
+
}
|
77
|
+
}
|
78
|
+
},
|
79
|
+
"Dag::PUT": {
|
80
|
+
"appliesTo": {
|
81
|
+
"principalTypes": ["User"],
|
82
|
+
"resourceTypes": ["Dag"],
|
83
|
+
"context": {
|
84
|
+
"attributes": {
|
85
|
+
"dag_entity": {
|
86
|
+
"required": false,
|
87
|
+
"type": "String"
|
88
|
+
}
|
89
|
+
},
|
90
|
+
"type": "Record"
|
91
|
+
}
|
92
|
+
}
|
93
|
+
},
|
94
|
+
"Dataset::GET": {
|
95
|
+
"appliesTo": {
|
96
|
+
"principalTypes": ["User"],
|
97
|
+
"resourceTypes": ["Dataset"]
|
98
|
+
}
|
99
|
+
},
|
100
|
+
"Pool::DELETE": {
|
101
|
+
"appliesTo": {
|
102
|
+
"principalTypes": ["User"],
|
103
|
+
"resourceTypes": ["Pool"]
|
104
|
+
}
|
105
|
+
},
|
106
|
+
"Pool::GET": {
|
107
|
+
"appliesTo": {
|
108
|
+
"principalTypes": ["User"],
|
109
|
+
"resourceTypes": ["Pool"]
|
110
|
+
}
|
111
|
+
},
|
112
|
+
"Pool::POST": {
|
113
|
+
"appliesTo": {
|
114
|
+
"principalTypes": ["User"],
|
115
|
+
"resourceTypes": ["Pool"]
|
116
|
+
}
|
117
|
+
},
|
118
|
+
"Pool::PUT": {
|
119
|
+
"appliesTo": {
|
120
|
+
"principalTypes": ["User"],
|
121
|
+
"resourceTypes": ["Pool"]
|
122
|
+
}
|
123
|
+
},
|
124
|
+
"Variable::DELETE": {
|
125
|
+
"appliesTo": {
|
126
|
+
"principalTypes": ["User"],
|
127
|
+
"resourceTypes": ["Variable"]
|
128
|
+
}
|
129
|
+
},
|
130
|
+
"Variable::GET": {
|
131
|
+
"appliesTo": {
|
132
|
+
"principalTypes": ["User"],
|
133
|
+
"resourceTypes": ["Variable"]
|
134
|
+
}
|
135
|
+
},
|
136
|
+
"Variable::POST": {
|
137
|
+
"appliesTo": {
|
138
|
+
"principalTypes": ["User"],
|
139
|
+
"resourceTypes": ["Variable"]
|
140
|
+
}
|
141
|
+
},
|
142
|
+
"Variable::PUT": {
|
143
|
+
"appliesTo": {
|
144
|
+
"principalTypes": ["User"],
|
145
|
+
"resourceTypes": ["Variable"]
|
146
|
+
}
|
147
|
+
},
|
148
|
+
"View::GET": {
|
149
|
+
"appliesTo": {
|
150
|
+
"principalTypes": ["User"],
|
151
|
+
"resourceTypes": ["View"]
|
152
|
+
}
|
153
|
+
}
|
154
|
+
},
|
155
|
+
"entityTypes": {
|
156
|
+
"Configuration": {},
|
157
|
+
"Connection": {},
|
158
|
+
"Dag": {},
|
159
|
+
"Dataset": {},
|
160
|
+
"Pool": {},
|
161
|
+
"Role": {},
|
162
|
+
"User": {
|
163
|
+
"memberOfTypes": [
|
164
|
+
"Role"
|
165
|
+
]
|
166
|
+
},
|
167
|
+
"Variable": {},
|
168
|
+
"View": {}
|
169
|
+
}
|
170
|
+
}
|
171
|
+
}
|
@@ -21,5 +21,6 @@ from __future__ import annotations
|
|
21
21
|
CONF_ENABLE_KEY = "enable"
|
22
22
|
CONF_SECTION_NAME = "aws_auth_manager"
|
23
23
|
CONF_CONN_ID_KEY = "conn_id"
|
24
|
+
CONF_REGION_NAME_KEY = "region_name"
|
24
25
|
CONF_SAML_METADATA_URL_KEY = "saml_metadata_url"
|
25
26
|
CONF_AVP_POLICY_STORE_ID_KEY = "avp_policy_store_id"
|