Skip to content

Commit 1b76fc1

Browse files
author
Matt Sokoloff
committed
wip
1 parent a7904b9 commit 1b76fc1

File tree

3 files changed

+34
-4
lines changed

3 files changed

+34
-4
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ test-local: build
1212
test-staging: build
1313
docker run -it -v ${PWD}:/usr/src -w /usr/src \
1414
-e LABELBOX_TEST_ENVIRON="staging" \
15-
-e LABELBOX_TEST_API_KEY_STAGING=${LABELBOX_TEST_API_KEY_STAGING} \
15+
-e LABELBOX_TEST_API_KEY_STAGING=${LLT} \
1616
local/labelbox-python:test pytest $(PATH_TO_TEST) -svvx
1717

1818
test-prod: build

labelbox/schema/iam_integration.py

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,31 @@
1+
from labelbox.utils import camel_case
2+
from pydantic import BaseModel
3+
14
from labelbox.orm.db_object import DbObject
25
from labelbox.orm.model import Field
36

47

8+
9+
10+
11+
class AwsIamIntegrationSettings(BaseModel):
12+
role_arn: str
13+
14+
class Config:
15+
allow_population_by_field_name = True
16+
alias_generator = camel_case
17+
18+
19+
class GcpIamIntegrationSettings(BaseModel):
20+
service_account_email_id: str
21+
read_bucket: str
22+
23+
class Config:
24+
allow_population_by_field_name = True
25+
alias_generator = camel_case
26+
27+
28+
529
class IAMIntegration(DbObject):
630
""" Represents an IAM integration for delegated access
731
@@ -17,7 +41,13 @@ class IAMIntegration(DbObject):
1741
"""
1842

1943
def __init__(self, client, data):
20-
self.settings = data.pop('settings', {})
44+
settings = data.pop('settings', {})
45+
type_name = settings.pop('__typename')
46+
if type_name == "GcpIamIntegrationSettings":
47+
self.settings = GcpIamIntegrationSettings(**settings)
48+
elif type_name == "AwsIamIntegrationSettings":
49+
self.settings = AwsIamIntegrationSettings(**settings)
50+
2151
super().__init__(client, data)
2252

2353
_DEFAULT = "DEFAULT"

tests/integration/test_delegated_access.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import pytest
33

44

5-
@pytest.mark.skip("Can only be tested in specific organizations.")
5+
#@pytest.mark.skip("Can only be tested in specific organizations.")
66
def test_default_integration(client):
77
# This tests assumes the following:
88
# 1. gcp delegated access is configured to work with utkarsh-da-test-bucket
@@ -17,7 +17,7 @@ def test_default_integration(client):
1717
ds.delete()
1818

1919

20-
@pytest.mark.skip("Can only be tested in specific organizations.")
20+
#@pytest.mark.skip("Can only be tested in specific organizations.")
2121
def test_non_default_integration(client):
2222
# This tests assumes the following:
2323
# 1. aws delegated access is configured to work with lbox-test-bucket

0 commit comments

Comments
 (0)