From 2b3c6b1bfe050249d923fe4cbc1e23b0a83d7bcf Mon Sep 17 00:00:00 2001 From: SaladTechnologies <415806+seniorquico@users.noreply.github.com> Date: Sat, 5 Oct 2024 04:01:05 +0000 Subject: [PATCH] liblab SDK update for version v0.9.0-alpha.4 --- .manifest.json | 25 +++++++++++++------------ PyPI_README.md | 4 ++-- README.md | 4 ++-- examples/install.cmd | 2 +- examples/install.sh | 2 +- install.cmd | 2 +- install.sh | 2 +- pyproject.toml | 2 +- src/salad_cloud_imds_sdk/sdk.py | 23 +++++++++++++++++++---- 9 files changed, 41 insertions(+), 25 deletions(-) diff --git a/.manifest.json b/.manifest.json index 752ece6..b251757 100644 --- a/.manifest.json +++ b/.manifest.json @@ -1,10 +1,10 @@ { - "liblabVersion": "2.4.0", - "date": "2024-09-17T04:36:05.362Z", + "liblabVersion": "2.5.1", + "date": "2024-10-05T04:00:40.746Z", "config": { "apiId": 1126, "sdkName": "salad-cloud-imds-sdk", - "sdkVersion": "0.9.0-alpha.3", + "sdkVersion": "0.9.0-alpha.4", "liblabVersion": "2", "deliveryMethods": ["zip"], "languages": ["python"], @@ -33,7 +33,7 @@ "githubRepoName": "salad-cloud-imds-sdk-go", "ignoreFiles": [".gitignore", "./LICENSE"], "liblabVersion": "2", - "sdkVersion": "0.9.0-alpha.3", + "sdkVersion": "0.9.0-alpha.4", "targetBranch": "main" }, "java": { @@ -57,11 +57,11 @@ "homepage": "https://github.com/saladtechnologies/salad-cloud-imds-sdk-java", "ignoreFiles": [".gitignore", "./LICENSE"], "liblabVersion": "2", - "sdkVersion": "0.9.0-alpha.3", + "sdkVersion": "0.9.0-alpha.4", "targetBranch": "main" }, "python": { - "alwaysInitializeOptionals": true, + "alwaysInitializeOptionals": false, "classifiers": [ "Development Status :: 3 - Alpha", "Intended Audience :: Developers", @@ -100,7 +100,7 @@ "githubRepoName": "salad-cloud-imds-sdk-python", "ignoreFiles": [".gitignore", "./LICENSE"], "liblabVersion": "2", - "sdkVersion": "0.9.0-alpha.3", + "sdkVersion": "0.9.0-alpha.4", "targetBranch": "main" }, "typescript": { @@ -123,8 +123,9 @@ "homepage": "https://github.com/saladtechnologies/salad-cloud-imds-sdk-javascript", "ignoreFiles": [".gitignore", "./LICENSE"], "liblabVersion": "2", - "sdkVersion": "0.9.0-alpha.3", - "targetBranch": "main" + "sdkVersion": "0.9.0-alpha.4", + "targetBranch": "main", + "generateEnumAs": "enum" } }, "publishing": { @@ -155,11 +156,11 @@ }, "multiTenant": true, "hooksLocation": { - "bucketKey": "7207/hooks.zip", + "bucketKey": "7538/hooks.zip", "bucketName": "prod-liblab-api-stack-hooks" }, "includeWatermark": false, - "alwaysInitializeOptionals": true, + "alwaysInitializeOptionals": false, "classifiers": [ "Development Status :: 3 - Alpha", "Intended Audience :: Developers", @@ -211,7 +212,7 @@ "httpLibrary": { "name": "axios", "packages": { - "axios": "^1.7.4" + "axios": "^1.7.7" }, "languages": ["typescript"] }, diff --git a/PyPI_README.md b/PyPI_README.md index 216338c..d2e251c 100644 --- a/PyPI_README.md +++ b/PyPI_README.md @@ -1,11 +1,11 @@ -# SaladCloudImdsSdk Python SDK 0.9.0-alpha.3 +# SaladCloudImdsSdk Python SDK 0.9.0-alpha.4 Welcome to the SaladCloudImdsSdk SDK documentation. This guide will help you get started with integrating and using the SaladCloudImdsSdk SDK in your project. ## Versions - API version: `0.9.0-alpha.1` -- SDK version: `0.9.0-alpha.3` +- SDK version: `0.9.0-alpha.4` ## About the API diff --git a/README.md b/README.md index af18f94..6f39867 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,11 @@ -# SaladCloudImdsSdk Python SDK 0.9.0-alpha.3 +# SaladCloudImdsSdk Python SDK 0.9.0-alpha.4 Welcome to the SaladCloudImdsSdk SDK documentation. This guide will help you get started with integrating and using the SaladCloudImdsSdk SDK in your project. ## Versions - API version: `0.9.0-alpha.1` -- SDK version: `0.9.0-alpha.3` +- SDK version: `0.9.0-alpha.4` ## About the API diff --git a/examples/install.cmd b/examples/install.cmd index fca1b65..62df74a 100644 --- a/examples/install.cmd +++ b/examples/install.cmd @@ -2,4 +2,4 @@ python -m venv .venv call .venv\Scripts\activate pip install build python -m build --outdir dist ..\ -pip install dist\salad_cloud_imds_sdk-0.9.0-alpha.3-py3-none-any.whl --force-reinstall +pip install dist\salad_cloud_imds_sdk-0.9.0-alpha.4-py3-none-any.whl --force-reinstall diff --git a/examples/install.sh b/examples/install.sh index 5635773..ae04955 100644 --- a/examples/install.sh +++ b/examples/install.sh @@ -2,4 +2,4 @@ python -m venv .venv . .venv/bin/activate pip install build python -m build --outdir dist ../ -pip install dist/salad_cloud_imds_sdk-0.9.0-alpha.3-py3-none-any.whl --force-reinstall +pip install dist/salad_cloud_imds_sdk-0.9.0-alpha.4-py3-none-any.whl --force-reinstall diff --git a/install.cmd b/install.cmd index d01db5e..8d5561f 100644 --- a/install.cmd +++ b/install.cmd @@ -15,7 +15,7 @@ if "%USE_VENV%"=="1" ( pip install build python -m build --outdir dist . -pip install dist\salad_cloud_imds_sdk-0.9.0-alpha.3-py3-none-any.whl --force-reinstall +pip install dist\salad_cloud_imds_sdk-0.9.0-alpha.4-py3-none-any.whl --force-reinstall if "%USE_VENV%"=="1" ( deactivate diff --git a/install.sh b/install.sh index c8a2305..6cc1094 100644 --- a/install.sh +++ b/install.sh @@ -19,7 +19,7 @@ fi pip install build python -m build --outdir dist . -pip install dist/salad_cloud_imds_sdk-0.9.0-alpha.3-py3-none-any.whl --force-reinstall +pip install dist/salad_cloud_imds_sdk-0.9.0-alpha.4-py3-none-any.whl --force-reinstall if [ "$USE_VENV" -eq 1 ]; then deactivate diff --git a/pyproject.toml b/pyproject.toml index d5580c0..0517e5d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "salad-cloud-imds-sdk" -version = "0.9.0-alpha.3" +version = "0.9.0-alpha.4" license = { text = "MIT" } description = """The SaladCloud Instance Metadata Service (IMDS). Please refer to the [SaladCloud API Documentation](https://docs.salad.com/api-reference) for more details.""" readme = "PyPI_README.md" diff --git a/src/salad_cloud_imds_sdk/sdk.py b/src/salad_cloud_imds_sdk/sdk.py index 1c9d089..d81cdd6 100644 --- a/src/salad_cloud_imds_sdk/sdk.py +++ b/src/salad_cloud_imds_sdk/sdk.py @@ -1,21 +1,36 @@ +from typing import Union from .services.metadata import MetadataService from .net.environment import Environment class SaladCloudImdsSdk: - def __init__(self, base_url: str = Environment.DEFAULT.value, timeout: int = 60000): + def __init__( + self, + base_url: Union[Environment, str] = Environment.DEFAULT, + timeout: int = 60000, + ): """ Initializes SaladCloudImdsSdk the SDK class. """ - self.metadata = MetadataService(base_url=base_url) + self._base_url = ( + base_url.value if isinstance(base_url, Environment) else base_url + ) + self.metadata = MetadataService(base_url=self._base_url) self.set_timeout(timeout) - def set_base_url(self, base_url): + def set_base_url(self, base_url: Union[Environment, str]): """ Sets the base URL for the entire SDK. + + :param Union[Environment, str] base_url: The base URL to be set. + :return: The SDK instance. """ - self.metadata.set_base_url(base_url) + self._base_url = ( + base_url.value if isinstance(base_url, Environment) else base_url + ) + + self.metadata.set_base_url(self._base_url) return self