Skip to content

Add creation of IAM integrations#1976

Merged
lb-pno merged 1 commit intodevelopfrom
pno/PLT-2479-Create-new-cloud-integration-via-SDK
Jun 5, 2025
Merged

Add creation of IAM integrations#1976
lb-pno merged 1 commit intodevelopfrom
pno/PLT-2479-Create-new-cloud-integration-via-SDK

Conversation

@lb-pno
Copy link
Contributor

@lb-pno lb-pno 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?

Loading
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