Skip to content

Commit

Permalink
Re-generate generated API to add new r/w/d organization role. (#644)
Browse files Browse the repository at this point in the history
* Re-generate the generated API.

This adds the newly-introduced read/write/delete organization role,
along with an unrelated change to the spec.

I re-generated the API by running:

    ./update_generated.sh /path/to/TileDB-Cloud-API-Spec

* Use GNU sed on macOS.

This makes it possible to run update_generated.sh on macOS without
modifications.
  • Loading branch information
NullHypothesis authored Oct 30, 2024
1 parent ef512ad commit 74f0601
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/tiledb/cloud/_common/api_v2/docs/AccessCredential.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ A union type which may contain a credential to access any one cloud provider.

| Name | Type | Description | Notes |
| -------------------- | --------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------- |
| **uuid** | **str** | The UUID of the credential | [optional] |
| **name** | **str** | A user-specified name for the key | [optional] |
| **provider** | [**CloudProvider**](CloudProvider.md) | | [optional] |
| **provider_default** | **bool** | True if this is the namespace's default credential to be used when connecting to the given cloud provider. There can be at most one default for each unique provider. | [optional] |
Expand Down
29 changes: 29 additions & 0 deletions src/tiledb/cloud/_common/api_v2/models/access_credential.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ class AccessCredential(object):
and the value is json key in definition.
"""
openapi_types = {
"uuid": "str",
"name": "str",
"provider": "CloudProvider",
"provider_default": "bool",
Expand All @@ -45,6 +46,7 @@ class AccessCredential(object):
}

attribute_map = {
"uuid": "uuid",
"name": "name",
"provider": "provider",
"provider_default": "provider_default",
Expand All @@ -58,6 +60,7 @@ class AccessCredential(object):

def __init__(
self,
uuid=None,
name=None,
provider=None,
provider_default=None,
Expand All @@ -74,6 +77,7 @@ def __init__(
local_vars_configuration = Configuration()
self.local_vars_configuration = local_vars_configuration

self._uuid = None
self._name = None
self._provider = None
self._provider_default = None
Expand All @@ -85,6 +89,8 @@ def __init__(
self._token = None
self.discriminator = None

if uuid is not None:
self.uuid = uuid
if name is not None:
self.name = name
if provider is not None:
Expand All @@ -102,6 +108,29 @@ def __init__(
if token is not None:
self.token = token

@property
def uuid(self):
"""Gets the uuid of this AccessCredential. # noqa: E501
The UUID of the credential # noqa: E501
:return: The uuid of this AccessCredential. # noqa: E501
:rtype: str
"""
return self._uuid

@uuid.setter
def uuid(self, uuid):
"""Sets the uuid of this AccessCredential.
The UUID of the credential # noqa: E501
:param uuid: The uuid of this AccessCredential. # noqa: E501
:type: str
"""

self._uuid = uuid

@property
def name(self):
"""Gets the name of this AccessCredential. # noqa: E501
Expand Down
9 changes: 8 additions & 1 deletion src/tiledb/cloud/rest_api/models/organization_roles.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,17 @@ class OrganizationRoles(object):
"""
OWNER = "owner"
ADMIN = "admin"
READ_WRITE_DELETE = "read_write_delete"
READ_WRITE = "read_write"
READ_ONLY = "read_only"

allowable_values = [OWNER, ADMIN, READ_WRITE, READ_ONLY] # noqa: E501
allowable_values = [
OWNER,
ADMIN,
READ_WRITE_DELETE,
READ_WRITE,
READ_ONLY,
] # noqa: E501

"""
Attributes:
Expand Down
9 changes: 7 additions & 2 deletions update_generated.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

set -euo pipefail

SED=sed
if [[ "$OSTYPE" =~ "darwin" ]]; then
SED=gsed # Use GNU sed on macOS.
fi

USAGE='
Usage:
Expand Down Expand Up @@ -83,7 +88,7 @@ generate_api() {
find "${TEMP_PATH}" \
-type f \
-execdir \
sed --in-place \
"$SED" --in-place \
-e "s/${TEMP_PACKAGE_NAME}\./tiledb.cloud.${PACKAGE_NAME}./g" \
-e "s/\\(from\\|import\\) ${TEMP_PACKAGE_NAME}/\\1 tiledb.cloud.${PACKAGE_NAME}/g" \
-e "s/${TEMP_PACKAGE_NAME}/${PACKAGE_NAME}/g" \
Expand All @@ -92,7 +97,7 @@ generate_api() {
'+'

# Fix up links in README.
sed --in-place -e "s/](${PACKAGE_NAME}\\//](/g" "${TEMP_PATH}/${TEMP_PACKAGE_NAME}_README.md"
"$SED" --in-place -e "s/](${PACKAGE_NAME}\\//](/g" "${TEMP_PATH}/${TEMP_PACKAGE_NAME}_README.md"

# Get TARGET_PATH out of the way (if present).
if [ -e "$TARGET_PATH/$PACKAGE_NAME_SLASHY" ]; then
Expand Down

0 comments on commit 74f0601

Please sign in to comment.