Skip to content

Add creation of IAM integrations #1976

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

Conversation

paulnoirel
Copy link
Contributor

@paulnoirel paulnoirel commented May 29, 2025

Description

This PR adds methods to create and update IAM integrations.

Create

import labelbox as lb
from labelbox.schema.iam_integration import (
    AwsIamIntegrationSettings,
    GcpIamIntegrationSettings,
    AzureIamIntegrationSettings,
)

organization = client.get_organization()

# AWS
aws_settings = AwsIamIntegrationSettings(
    role_arn="arn:aws:iam::123456789012:role/LabelboxDelegatedAccess",
    read_bucket="my-s3-bucket"  # Optional
)

aws_integration = organization.create_iam_integration(
    name="My AWS Integration",
    settings=aws_settings
)

# GCP
gcp_settings = GcpIamIntegrationSettings(
    read_bucket="gs://my-gcp-bucket"
)

gcp_integration = organization.create_iam_integration(
    name="My GCP Integration",
    settings=gcp_settings
)

# Azure
azure_settings = AzureIamIntegrationSettings(
    read_container_url="https://mystorageaccount.blob.core.windows.net/mycontainer",
    tenant_id="your-tenant-id",
    client_id="your-client-id",  # Optional for creation
    client_secret="your-client-secret"  # Optional for creation
)


azure_integration = organization.create_iam_integration(
    name="My Azure Integration",
    settings=azure_settings
)

Update

# AWS
updated_aws_settings = AwsIamIntegrationSettings(
    role_arn="arn:aws:iam::123456789012:role/UpdatedLabelboxRole",
    read_bucket="my-updated-s3-bucket"
)


aws_integration.update(
    name="Updated AWS Integration",
    settings=updated_aws_settings
)

# GCP
updated_gcp_settings = GcpIamIntegrationSettings(
    read_bucket="gs://my-updated-gcp-bucket"
)

gcp_integration.update(
    name="Updated GCP Integration",
    settings=updated_gcp_settings
)

# Azure
updated_azure_settings = AzureIamIntegrationSettings(
    read_container_url="https://updatedstorageaccount.blob.core.windows.net/mycontainer",
    tenant_id="updated-tenant-id"
)

azure_integration.update(
    name="Updated Azure Integration",
    settings=updated_azure_settings
)

Validate

gcp_integration.validate()

Set as default

gcp_integration.set_as_default()

Fixes # (issue)

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Document change (fix typo or modifying any markdown files, code comments or anything in the examples folder only)

All Submissions

  • Have you followed the guidelines in our Contributing document?
  • Have you provided a description?
  • Are your changes properly formatted?

New Feature Submissions

  • Does your submission pass tests?
  • Have you added thorough tests for your new feature?
  • Have you commented your code, particularly in hard-to-understand areas?
  • Have you added a Docstring?

Changes to Core Features

  • Have you written new tests for your core changes, as applicable?
  • Have you successfully run tests with your changes locally?
  • Have you updated any code comments, as applicable?

@paulnoirel paulnoirel force-pushed the pno/PLT-2479-Create-new-cloud-integration-via-SDK branch from bc2f5b1 to 9bb2be2 Compare May 29, 2025 20:21
@paulnoirel paulnoirel force-pushed the pno/PLT-2479-Create-new-cloud-integration-via-SDK branch from 9bb2be2 to 753c0d7 Compare May 29, 2025 20:23
@paulnoirel paulnoirel force-pushed the pno/PLT-2479-Create-new-cloud-integration-via-SDK branch from 753c0d7 to ccc2362 Compare May 29, 2025 20:23
@paulnoirel paulnoirel force-pushed the pno/PLT-2479-Create-new-cloud-integration-via-SDK branch from cc24e0e to da1ad90 Compare May 29, 2025 21:06
@paulnoirel paulnoirel force-pushed the pno/PLT-2479-Create-new-cloud-integration-via-SDK branch from da1ad90 to b58f547 Compare May 29, 2025 21:39
@paulnoirel paulnoirel marked this pull request as ready for review May 29, 2025 22:15
@paulnoirel paulnoirel requested a review from a team as a code owner May 29, 2025 22:15
@paulnoirel paulnoirel merged commit 0bb159d into develop Jun 5, 2025
41 of 64 checks passed
@paulnoirel paulnoirel deleted the pno/PLT-2479-Create-new-cloud-integration-via-SDK branch June 5, 2025 17:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants