Skip to content

feature: improvement of examples for sqlserverflex and serviceaccount #435

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion examples/serviceaccount/create_serviceaccount.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,5 @@
create_serviceaccount_payload = CreateServiceAccountPayload(
name="my-service-account",
)
client.create_service_account(project_id, create_serviceaccount_payload)
sa = client.create_service_account(project_id, create_serviceaccount_payload)
print(f"Created service-account with email {sa.email}")
8 changes: 3 additions & 5 deletions examples/serviceaccount/delete_service_accounts.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,12 @@
from stackit.core.configuration import Configuration

project_id = os.getenv("PROJECT_ID")
account_mail = "SERVICE_ACCOUNT_MAIL"

# Create a new API client, that uses default authentication and configuration
config = Configuration()
client = DefaultApi(config)

# List all serviceaccounts
response = client.list_service_accounts(project_id)

# Delete all accounts
for account in response.items:
client.delete_service_account(project_id, account.email)
# Delete service account
client.delete_service_account(project_id, account_mail)
4 changes: 3 additions & 1 deletion examples/sqlserverflex/create_instances.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,6 @@
name="my-instance",
flavorId=flavor_response.flavors[0].id,
)
client.create_instance(project_id, create_instance_payload)
instance = client.create_instance(project_id, create_instance_payload)

print(f"Created instance with ID: {instance.id}")
9 changes: 3 additions & 6 deletions examples/sqlserverflex/delete_instances.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,11 @@
from stackit.core.configuration import Configuration

project_id = os.getenv("PROJECT_ID")
instance_id = "INSTANCE_ID"

# Create a new API client, that uses default authentication and configuration
config = Configuration()
client = DefaultApi(config)

# List all sqlserverflex instances
response = client.list_instances(project_id)

# Delete all instances
for instance in response.items:
client.delete_instance(project_id, instance.id)
# Delete the instance
client.delete_instance(project_id, instance_id)
Loading