-
Notifications
You must be signed in to change notification settings - Fork 90
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into docs-cross-account-sns
- Loading branch information
Showing
102 changed files
with
9,193 additions
and
1,497 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
5.3.1 | ||
5.4.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,117 +1,56 @@ | ||
"""Provides admin-only functions for Quilt.""" | ||
"""APIs for Quilt administrators. 'Registry' refers to Quilt stack backend services, including identity management.""" | ||
import typing as T | ||
|
||
from .session import get_registry_url, get_session | ||
|
||
|
||
def create_role(name, arn): | ||
def create_user(*, username: str, email: str): | ||
""" | ||
Create a new role in your registry. Admins only. | ||
Create a new user in the registry. | ||
Required Parameters: | ||
name(string): name of role to create | ||
arn(string): ARN of IAM role to associate with the Quilt role you are creating | ||
Required parameters: | ||
username (str): Username of user to create. | ||
email (str): Email of user to create. | ||
""" | ||
session = get_session() | ||
response = session.post( | ||
"{url}/api/roles".format( | ||
url=get_registry_url() | ||
), | ||
get_registry_url() + "/api/users/create", | ||
json={ | ||
'name': name, | ||
'arn': arn | ||
} | ||
"username": username, | ||
"email": email, | ||
}, | ||
) | ||
|
||
return response.json() | ||
|
||
|
||
def edit_role(role_id, new_name=None, new_arn=None): | ||
def delete_user(*, username: str): | ||
""" | ||
Edit an existing role in your registry. Admins only. | ||
Delete user from the registry. | ||
Required parameters: | ||
role_id(string): ID of role you want to operate on. | ||
Optional paramters: | ||
new_name(string): new name for role | ||
new_arn(string): new ARN for IAM role attached to Quilt role | ||
username (str): Username of user to delete. | ||
""" | ||
session = get_session() | ||
old_data = get_role(role_id) | ||
data = {} | ||
data['name'] = new_name or old_data['name'] | ||
data['arn'] = new_arn or old_data['arn'] | ||
|
||
response = session.put( | ||
"{url}/api/roles/{role_id}".format( | ||
url=get_registry_url(), | ||
role_id=role_id | ||
), | ||
json=data | ||
response = session.post( | ||
get_registry_url() + "/api/users/delete", | ||
json={ | ||
"username": username, | ||
}, | ||
) | ||
|
||
return response.json() | ||
|
||
|
||
def delete_role(role_id): | ||
""" | ||
Delete a role in your registry. Admins only. | ||
Required parameters: | ||
role_id(string): ID of role you want to delete. | ||
""" | ||
session = get_session() | ||
session.delete( | ||
"{url}/api/roles/{role_id}".format( | ||
url=get_registry_url(), | ||
role_id=role_id | ||
) | ||
) | ||
|
||
|
||
def get_role(role_id): | ||
def set_role(*, username: str, role_name: T.Optional[str]): | ||
""" | ||
Get info on a role based on its ID. Admins only. | ||
Set the named Quilt role for a user. | ||
Required parameters: | ||
role_id(string): ID of role you want to get details on. | ||
""" | ||
session = get_session() | ||
response = session.get( | ||
"{url}/api/roles/{role_id}".format( | ||
url=get_registry_url(), | ||
role_id=role_id | ||
) | ||
) | ||
|
||
return response.json() | ||
|
||
|
||
def list_roles(): | ||
""" | ||
List configured roles. Admins only. | ||
username (str): Username of user to update. | ||
role_name (str): Quilt role name assign to the user. Set a `None` value to unassign the role. | ||
""" | ||
session = get_session() | ||
response = session.get( | ||
"{url}/api/roles".format( | ||
url=get_registry_url() | ||
)) | ||
|
||
return response.json()['results'] | ||
|
||
|
||
def set_role(username, role_name=''): | ||
""" | ||
Set which role is associated with a user. | ||
Admins only. | ||
""" | ||
session = get_session() | ||
data = { | ||
'username': username, | ||
'role': role_name | ||
} | ||
session.post( | ||
"{url}/api/users/set_role".format( | ||
url=get_registry_url() | ||
), | ||
json=data | ||
get_registry_url() + "/api/users/set_role", | ||
json={ | ||
"username": username, | ||
"role": role_name or "", | ||
}, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
FROM amazonlinux:2023.2.20230920.1 | ||
FROM amazonlinux:2023.3.20231218.0 | ||
MAINTAINER Quilt Data, Inc. [email protected] | ||
|
||
ENV LC_ALL=C.UTF-8 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.