Skip to content

Commit

Permalink
Sync feature release changes (#64)
Browse files Browse the repository at this point in the history
  • Loading branch information
jregistr authored Dec 17, 2024
1 parent 4a42521 commit 9ab12d6
Show file tree
Hide file tree
Showing 23 changed files with 498 additions and 37 deletions.
70 changes: 45 additions & 25 deletions aws-qbusiness-application/aws-qbusiness-application.json
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,27 @@
"enum": [
"AWS_IAM_IDP_SAML",
"AWS_IAM_IDP_OIDC",
"AWS_IAM_IDC"
"AWS_IAM_IDC",
"AWS_QUICKSIGHT_IDP"
]
},
"PersonalizationConfiguration": {
"type": "object",
"properties": {
"PersonalizationControlMode": {
"$ref": "#/definitions/PersonalizationControlMode"
}
},
"required": [
"PersonalizationControlMode"
],
"additionalProperties": false
},
"PersonalizationControlMode": {
"type": "string",
"enum": [
"ENABLED",
"DISABLED"
]
},
"QAppsConfiguration": {
Expand All @@ -91,30 +111,26 @@
"DISABLED"
]
},
"SubscriptionType": {
"type": "string",
"enum": [
"Q_LITE",
"Q_BUSINESS"
]
},
"PersonalizationConfiguration": {
"QuickSightConfiguration": {
"type": "object",
"properties": {
"PersonalizationControlMode": {
"$ref": "#/definitions/PersonalizationControlMode"
"ClientNamespace": {
"type": "string",
"maxLength": 64,
"minLength": 1,
"pattern": "^[a-zA-Z0-9._-]*$"
}
},
"required": [
"PersonalizationControlMode"
"ClientNamespace"
],
"additionalProperties": false
},
"PersonalizationControlMode": {
"SubscriptionType": {
"type": "string",
"enum": [
"ENABLED",
"DISABLED"
"Q_LITE",
"Q_BUSINESS"
]
},
"Tag": {
Expand Down Expand Up @@ -159,7 +175,6 @@
},
"ClientIdsForOIDC": {
"type": "array",
"insertionOrder": false,
"items": {
"type": "string",
"maxLength": 255,
Expand Down Expand Up @@ -198,12 +213,6 @@
"minLength": 10,
"pattern": "^arn:(aws|aws-us-gov|aws-cn|aws-iso|aws-iso-b):sso::\\d{12}:application/(sso)?ins-[a-zA-Z0-9-.]{16}/apl-[a-zA-Z0-9]{16}$"
},
"QAppsConfiguration": {
"$ref": "#/definitions/QAppsConfiguration"
},
"PersonalizationConfiguration": {
"$ref": "#/definitions/PersonalizationConfiguration"
},
"IdentityCenterInstanceArn": {
"type": "string",
"maxLength": 1224,
Expand All @@ -213,6 +222,15 @@
"IdentityType": {
"$ref": "#/definitions/IdentityType"
},
"PersonalizationConfiguration": {
"$ref": "#/definitions/PersonalizationConfiguration"
},
"QAppsConfiguration": {
"$ref": "#/definitions/QAppsConfiguration"
},
"QuickSightConfiguration": {
"$ref": "#/definitions/QuickSightConfiguration"
},
"RoleArn": {
"type": "string",
"maxLength": 1284,
Expand All @@ -224,7 +242,6 @@
},
"Tags": {
"type": "array",
"insertionOrder": false,
"items": {
"$ref": "#/definitions/Tag"
},
Expand Down Expand Up @@ -254,7 +271,8 @@
"/properties/ClientIdsForOIDC",
"/properties/EncryptionConfiguration",
"/properties/IamIdentityProviderArn",
"/properties/IdentityType"
"/properties/IdentityType",
"/properties/QuickSightConfiguration"
],
"primaryIdentifier": [
"/properties/ApplicationId"
Expand All @@ -268,9 +286,11 @@
"kms:DescribeKey",
"qbusiness:CreateApplication",
"qbusiness:GetApplication",
"qbusiness:UpdateApplication",
"qbusiness:ListTagsForResource",
"qbusiness:TagResource",
"qbusiness:UpdateApplication",
"quicksight:DescribeAccountSubscription",
"quicksight:ListNamespaces",
"sso:CreateApplication",
"sso:DeleteApplication",
"sso:DescribeInstance",
Expand Down
2 changes: 2 additions & 0 deletions aws-qbusiness-application/resource-role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ Resources:
- "qbusiness:TagResource"
- "qbusiness:UntagResource"
- "qbusiness:UpdateApplication"
- "quicksight:DescribeAccountSubscription"
- "quicksight:ListNamespaces"
- "sso:CreateApplication"
- "sso:DeleteApplication"
- "sso:DescribeInstance"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ static CreateApplicationRequest translateToCreateRequest(
.tags(merged)
.qAppsConfiguration(toServiceQAppsConfiguration(model.getQAppsConfiguration()))
.personalizationConfiguration(toServicePersonalizationConfiguration(model.getPersonalizationConfiguration()))
.quickSightConfiguration(toQuickSightConfiguration(model.getQuickSightConfiguration()))
.build();
}

Expand Down Expand Up @@ -109,6 +110,7 @@ static ResourceModel translateFromReadResponse(final GetApplicationResponse awsR
.qAppsConfiguration(fromServiceQAppsConfiguration(awsResponse.qAppsConfiguration()))
.personalizationConfiguration(fromServicePersonalizationConfiguration(awsResponse.personalizationConfiguration()))
.autoSubscriptionConfiguration(fromServiceAutoSubscriptionConfiguration(awsResponse.autoSubscriptionConfiguration()))
.quickSightConfiguration(fromQuickSightConfiguration(awsResponse.quickSightConfiguration()))
.build();
// TODO: Workaround. This is a readonly field. But it is only returned if customer is using IDC
// When that's not the case, let's fill it in with N/A
Expand Down Expand Up @@ -221,6 +223,30 @@ static software.amazon.awssdk.services.qbusiness.model.PersonalizationConfigurat
.build();
}

static QuickSightConfiguration fromQuickSightConfiguration(
software.amazon.awssdk.services.qbusiness.model.QuickSightConfiguration quickSightConfiguration
) {
if (quickSightConfiguration == null) {
return null;
}

return QuickSightConfiguration.builder()
.clientNamespace(quickSightConfiguration.clientNamespace())
.build();
}

static software.amazon.awssdk.services.qbusiness.model.QuickSightConfiguration toQuickSightConfiguration(
QuickSightConfiguration modelConfig
) {
if (modelConfig == null) {
return null;
}

return software.amazon.awssdk.services.qbusiness.model.QuickSightConfiguration.builder()
.clientNamespace(modelConfig.getClientNamespace())
.build();
}

static AutoSubscriptionConfiguration fromServiceAutoSubscriptionConfiguration(
software.amazon.awssdk.services.qbusiness.model.AutoSubscriptionConfiguration serviceConfig
) {
Expand Down Expand Up @@ -350,6 +376,7 @@ static List<ResourceModel> translateFromListResponse(final ListApplicationsRespo
.updatedAt(instantToString(application.updatedAt()))
.status(application.statusAsString())
.identityType(application.identityTypeAsString())
.quickSightConfiguration(fromQuickSightConfiguration(application.quickSightConfiguration()))
.build()
)
.toList();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
public class CreateHandlerTest extends AbstractTestBase {

private static final String APP_ID = "a197dafc-2158-4f93-ab0d-b1c361c39838";
private static final String CLIENT_NAMESPACE = "client-namespace";

@Mock
private AmazonWebServicesClientProxy proxy;
Expand Down Expand Up @@ -104,6 +105,9 @@ public void setup() {
.build())
.iamIdentityProviderArn("arn:aws:iam::123456:oidc-provider/trial-123456.okta.com")
.clientIdsForOIDC(List.of("0oaglq4vdnaWau7hW697"))
.quickSightConfiguration(QuickSightConfiguration.builder()
.clientNamespace(CLIENT_NAMESPACE)
.build())
.tags(List.of(
Tag.builder().key("TagA").value("ValueA").build()
))
Expand Down Expand Up @@ -156,6 +160,10 @@ public void handleRequest_SimpleSuccess() {
.description(createModel.getDescription())
.displayName(createModel.getDisplayName())
.roleArn(createModel.getRoleArn())
.quickSightConfiguration(
software.amazon.awssdk.services.qbusiness.model.QuickSightConfiguration.builder()
.clientNamespace(CLIENT_NAMESPACE)
.build())
.build());

// call method under test
Expand All @@ -171,6 +179,7 @@ proxy, testRequest, new CallbackContext(), proxyClient, logger
assertThat(model.getRoleArn()).isEqualTo(createModel.getRoleArn());
assertThat(model.getDescription()).isEqualTo(createModel.getDescription());
assertThat(model.getStatus()).isEqualTo(ApplicationStatus.ACTIVE.toString());
assertThat(model.getQuickSightConfiguration().getClientNamespace()).isEqualTo(CLIENT_NAMESPACE);

ArgumentCaptor<CreateApplicationRequest> createAppReqCaptor = ArgumentCaptor.forClass(CreateApplicationRequest.class);
verify(sdkClient).createApplication(createAppReqCaptor.capture());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import software.amazon.awssdk.services.qbusiness.model.AttachmentsControlMode;
import software.amazon.awssdk.services.qbusiness.model.AutoSubscriptionConfiguration;
import software.amazon.awssdk.services.qbusiness.model.AutoSubscriptionStatus;
import software.amazon.awssdk.services.qbusiness.model.QuickSightConfiguration;
import software.amazon.awssdk.services.qbusiness.model.SubscriptionType;
import software.amazon.awssdk.services.qbusiness.model.EncryptionConfiguration;
import software.amazon.awssdk.services.qbusiness.model.QBusinessException;
Expand Down Expand Up @@ -124,6 +125,9 @@ public void handleRequest_SimpleSuccess() {
.autoSubscribe(AutoSubscriptionStatus.ENABLED.toString())
.defaultSubscriptionType(SubscriptionType.Q_BUSINESS.toString())
.build())
.quickSightConfiguration(QuickSightConfiguration.builder()
.clientNamespace("client-namespace")
.build())
.build());
when(proxyClient.client().listTagsForResource(any(ListTagsForResourceRequest.class)))
.thenReturn(ListTagsForResourceResponse.builder()
Expand Down Expand Up @@ -161,6 +165,7 @@ proxy, testRequest, new CallbackContext(), proxyClient, logger
assertThat(resultModel.getAttachmentsConfiguration().getAttachmentsControlMode()).isEqualTo(AttachmentsControlMode.ENABLED.toString());
assertThat(resultModel.getAutoSubscriptionConfiguration().getAutoSubscribe()).isEqualTo(AutoSubscriptionStatus.ENABLED.toString());
assertThat(resultModel.getAutoSubscriptionConfiguration().getDefaultSubscriptionType()).isEqualTo(SubscriptionType.Q_BUSINESS.toString());
assertThat(resultModel.getQuickSightConfiguration().getClientNamespace()).isEqualTo("client-namespace");


var tags = resultModel.getTags().stream().map(tag -> Map.entry(tag.getKey(), tag.getValue())).toList();
Expand Down
31 changes: 31 additions & 0 deletions aws-qbusiness-datasource/aws-qbusiness-datasource.json
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,34 @@
"BEGINS_WITH"
]
},
"ImageExtractionStatus": {
"type": "string",
"enum": [
"ENABLED",
"DISABLED"
]
},
"ImageExtractionConfiguration": {
"type": "object",
"properties": {
"ImageExtractionStatus": {
"$ref": "#/definitions/ImageExtractionStatus"
}
},
"required": [
"ImageExtractionStatus"
],
"additionalProperties": false
},
"MediaExtractionConfiguration": {
"type": "object",
"properties": {
"ImageExtractionConfiguration": {
"$ref": "#/definitions/ImageExtractionConfiguration"
}
},
"additionalProperties": false
},
"DocumentEnrichmentConfiguration": {
"type": "object",
"properties": {
Expand Down Expand Up @@ -303,6 +331,9 @@
"DocumentEnrichmentConfiguration": {
"$ref": "#/definitions/DocumentEnrichmentConfiguration"
},
"MediaExtractionConfiguration": {
"$ref": "#/definitions/MediaExtractionConfiguration"
},
"IndexId": {
"type": "string",
"maxLength": 36,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
import static software.amazon.qbusiness.datasource.translators.DocumentConverter.convertToMapToDocument;
import static software.amazon.qbusiness.datasource.translators.DocumentEnrichmentTranslator.fromServiceDocEnrichmentConf;
import static software.amazon.qbusiness.datasource.translators.DocumentEnrichmentTranslator.toServiceDocEnrichmentConf;
import static software.amazon.qbusiness.datasource.translators.MediaExtractionConfigurationTranslator.fromServiceMediaExtractionConfiguration;
import static software.amazon.qbusiness.datasource.translators.MediaExtractionConfigurationTranslator.toServiceMediaExtractionConfiguration;

import java.time.Instant;
import java.util.Collection;
Expand Down Expand Up @@ -49,6 +51,7 @@ static CreateDataSourceRequest translateToCreateRequest(final String idempotency
.vpcConfiguration(toServiceDataSourceVpcConfiguration(model.getVpcConfiguration()))
.configuration(convertToMapToDocument(model.getConfiguration()))
.documentEnrichmentConfiguration(toServiceDocEnrichmentConf(model.getDocumentEnrichmentConfiguration()))
.mediaExtractionConfiguration(toServiceMediaExtractionConfiguration(model.getMediaExtractionConfiguration()))
.build();
}

Expand Down Expand Up @@ -89,6 +92,7 @@ static ResourceModel translateFromReadResponse(final GetDataSourceResponse awsRe
.vpcConfiguration(fromServiceDataSourceVpcConfiguration(awsResponse.vpcConfiguration()))
.configuration(convertDocumentToMap(awsResponse.configuration()))
.documentEnrichmentConfiguration(fromServiceDocEnrichmentConf(awsResponse.documentEnrichmentConfiguration()))
.mediaExtractionConfiguration(fromServiceMediaExtractionConfiguration(awsResponse.mediaExtractionConfiguration()))
.build();
}

Expand Down Expand Up @@ -171,6 +175,7 @@ static UpdateDataSourceRequest translateToUpdateRequest(final ResourceModel mode
.vpcConfiguration(toServiceDataSourceVpcConfiguration(model.getVpcConfiguration()))
.configuration(convertToMapToDocument(model.getConfiguration()))
.documentEnrichmentConfiguration(toServiceDocEnrichmentConf(model.getDocumentEnrichmentConfiguration()))
.mediaExtractionConfiguration(toServiceMediaExtractionConfiguration(model.getMediaExtractionConfiguration()))
.build();
}

Expand Down
Loading

0 comments on commit 9ab12d6

Please sign in to comment.