Commit e6ca91ff authored by Rucha Deshpande's avatar Rucha Deshpande
Browse files

AWS Provider Implementation of Schema Service

commit e11d47ad 
Author: Rucha Deshpande <deshruch@amazon.com> 
Date: Thu Aug 27 2020 11:14:00 GMT-0500 (Central Daylight Time) 

    Adding/ correcting license and copyright stmts


commit 867ac626 
Author: Rucha Deshpande <deshruch@amazon.com> 
Date: Wed Aug 26 2020 16:56:37 GMT-0500 (Central Daylight Time) 

    reverting changes to schema-test-core pom. Copying parent pon to dist


commit 75c0b35a 
Author: Rucha Deshpande <deshruch@amazon.com> 
Date: Wed Aug 26 2020 16:30:03 GMT-0500 (Central Daylight Time) 

    removing reference to parent pom


commit 299af126 
Author: Rucha Deshpande <deshruch@amazon.com> 
Date: Wed Aug 26 2020 13:24:36 GMT-0500 (Central Daylight Time) 

    Adding year to the copyright stmt


commit bfe718c3 
Author: Rucha Deshpande <deshruch@amazon.com> 
Date: Wed Aug 26 2020 13:07:15 GMT-0500 (Central Daylight Time) 

    Adding year to the copyright stmt


commit d25cf483 
Author: Rucha Deshpande <deshruch@amazon.com> 
Date: Wed Aug 26 2020 10:38:59 GMT-0500 (Central Daylight Time) 

    updates after schema-service repo renamed to os-schema


commit 7912e76f 
Author: Rucha Deshpande <deshruch@amazon.com> 
Date: Wed Aug 26 2020 10:30:45 GMT-0500 (Central Daylight Time) 

    reverting changes to ENTITLEMENT_SERVICE_GROUP_VIEWERS and ENTITLEMENT_SERVICE_GROUP_EDITORS


commit 588010b0 
Author: Rucha Deshpande <deshruch@amazon.com> 
Date: Tue Aug 25 2020 17:18:35 GMT-0500 (Central Daylight Time) 

    Fix alignment


commit 0cbc05cc 
Author: Rucha Deshpande <deshruch@amazon.com> 
Date: Tue Aug 25 2020 16:57:48 GMT-0500 (Central Daylight Time) 

    Added chmod for prepare-dist.sh


commit 1886b818 
Author: Rucha Deshpande <deshruch@amazon.com> 
Date: Tue Aug 25 2020 16:48:10 GMT-0500 (Central Daylight Time) 

    Fix alignment


commit c7035327 
Author: Rucha Deshpande <deshruch@amazon.com> 
Date: Tue Aug 25 2020 16:02:08 GMT-0500 (Central Daylight Time) 

    Removed unnecessary comments


commit 4488e85d 
Author: Rucha Deshpande <deshruch@amazon.com> 
Date: Tue Aug 25 2020 15:53:17 GMT-0500 (Central Daylight Time) 

    Adding int. tests to cicd


commit 5340b697 
Author: Rucha Deshpande <deshruch@amazon.com> 
Date: Tue Aug 25 2020 10:06:08 GMT-0500 (Central Daylight Time) 

    Commented @SchemaService tag for the flawed int. test to ignore it


commit be7f6e77 
Author: Rucha Deshpande <deshruch@amazon.com> 
Date: Tue Aug 25 2020 09:58:21 GMT-0500 (Central Daylight Time) 

    reusing schemaInfo object


commit 6db59c3b 
Author: Rucha Deshpande <deshruch@amazon.com> 
Date: Tue Aug 25 2020 09:57:58 GMT-0500 (Central Daylight Time) 

    adding os-core-lib-aws


commit d34b61b4 
Author: Rucha Deshpande <deshruch@amazon.com> 
Date: Sat Aug 22 2020 15:16:11 GMT-0500 (Central Daylight Time) 

    Added gsiPartitionKey to the SchemaInfoDoc model


commit 05faa6db 
Author: Rucha Deshpande <deshruch@amazon.com> 
Date: Sat Aug 22 2020 14:34:55 GMT-0500 (Central Daylight Time) 

    Bug Fix: Int tests fail because  since PUT operation does not set createdBy and dateCreated in upateSchemaInfo


commit 501b8ad2 
Author: Rucha Deshpande <deshruch@amazon.com> 
Date: Thu Aug 20 2020 16:09:09 GMT-0500 (Central Daylight Time) 

    Removed some print statements


commit 6935ccfc 
Author: Rucha Deshpande <deshruch@amazon.com> 
Date: Thu Aug 20 2020 16:06:14 GMT-0500 (Central Daylight Time) 

    Bug Fix: fixed the GSI query by passing the correct partitionKey


commit 85917e67 
Author: Rucha Deshpande <deshruch@amazon.com> 
Date: Thu Aug 20 2020 09:48:23 GMT-0500 (Central Daylight Time) 

    Bug Fix: Throw BadRequestException "Invalid SupersededBy id"  if the supersededBy schema does not exist


commit 329f760c 
Author: Rucha Deshpande <deshruch@amazon.com> 
Date: Tue Aug 18 2020 09:55:11 GMT-0500 (Central Daylight Time) 

    update Entitlements URL


commit 9fb8e97e 
Author: Rucha Deshpande <deshruch@amazon.com> 
Date: Mon Aug 17 2020 13:35:31 GMT-0500 (Central Daylight Time) 

    ad int tests
parent 559ab088
# Copyright © Amazon Web Services
# Copyright © 2020 Amazon Web Services
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
......
# Copyright © 2020 Amazon Web Services
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import boto3
import json
import os
......
# Copyright © Amazon Web Services
# Copyright © 2020 Amazon Web Services
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
......@@ -59,8 +59,10 @@ phases:
# - cp ./provider/delivery-aws/target/*spring-boot.jar ${OUTPUT_DIR}/bin # copy aws jars
# - cp ./delivery-core/target/*.jar ${OUTPUT_DIR}/bin # copy core jar
# - echo "Building integration testing assemblies and gathering artifacts..."
# - ./testing/schema-test-aws/build-aws/prepare-dist.sh
- echo "Building integration testing assemblies and gathering artifacts..."
#Needed to add this for Windows
- chmod +x ./testing/schema-test-aws/build-aws/prepare-dist.sh
- ./testing/schema-test-aws/build-aws/prepare-dist.sh
- echo "Building docker image..."
- docker build -f provider/schema-aws/build-aws/Dockerfile -t ${ECR_IMAGE} .
......@@ -74,12 +76,12 @@ phases:
python provider/schema-aws/build-aws/build-info.py --branch ${CODEBUILD_SOURCE_VERSION} --commit ${CODEBUILD_RESOLVED_SOURCE_VERSION} \
--buildid ${CODEBUILD_BUILD_ID} --buildnumber ${CODEBUILD_BUILD_NUMBER} --reponame ${REPO_NAME} --outdir ${OUTPUT_DIR} \
--artifact ${ECR_IMAGE}
#reports:
# SurefireReports: # CodeBuild will create a report group called "SurefireReports".
# files: #Store all of the files
# - "schema-core/target/surefire-reports/**/*"
# - "provider/schema-aws/target/surefire-reports/**/*"
# base-directory: "." # Location of the reports
reports:
SurefireReports: # CodeBuild will create a report group called "SurefireReports".
files: #Store all of the files
- "schema-core/target/surefire-reports/**/*"
- "provider/schema-aws/target/surefire-reports/**/*"
base-directory: "." # Location of the reports
artifacts:
files:
- "**/*"
......
{
"name": "schema-service",
"description": "Build of the os-delivery repository",
"name": "os-schema",
"description": "Build of the os-schema repository",
"source": {
"type": "CODECOMMIT",
"location": "https://git-codecommit.us-east-1.amazonaws.com/v1/repos/schema-service",
"location": "https://git-codecommit.us-east-1.amazonaws.com/v1/repos/os-schema",
"gitCloneDepth": 1,
"gitSubmodulesConfig": {
"fetchSubmodules": false
......@@ -17,9 +17,9 @@
"artifacts": {
"type": "S3",
"location": "888733619319-devops-build-artifacts",
"path": "schema-service",
"path": "os-schema",
"namespaceType": "NONE",
"name": "schema-service",
"name": "os-schema",
"packaging": "ZIP",
"overrideArtifactName": true,
"encryptionDisabled": false
......@@ -38,7 +38,7 @@
"environmentVariables": [
{
"name": "ECR_REGISTRY",
"value": "888733619319.dkr.ecr.us-east-1.amazonaws.com/schema-service_dev",
"value": "888733619319.dkr.ecr.us-east-1.amazonaws.com/os-schema_dev",
"type": "PLAINTEXT"
},
{
......
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright © Amazon Web Services
Copyright © 2020 Amazon Web Services
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
......
<!--
Copyright © 2020 Amazon Web Services
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
......
// Copyright © 2020 Amazon Web Services
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package org.opengroup.osdu.schema.provider.aws;
import org.springframework.boot.SpringApplication;
......
// Copyright © Amazon Web Services
// Copyright © 2020 Amazon Web Services
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
......@@ -64,8 +64,8 @@ public class AwsServiceConfig {
@Setter(AccessLevel.PROTECTED)
public Boolean ssmEnabled;
@Inject
protected JaxRsDpsLog logger;
/*@Inject
protected JaxRsDpsLog logger;*/
@PostConstruct
public void init() {
......@@ -77,7 +77,8 @@ public class AwsServiceConfig {
try {
s3DataBucket = ssm.getProperty(s3DataBucketParameter).toString();
} catch (Exception e) {
logger.error(String.format("SSM property %s not found", s3DataBucketParameter));
//logger.error(String.format("SSM property %s not found", s3DataBucketParameter));
System.out.println(String.format("SSM property %s not found", s3DataBucketParameter));
}
}
}
......
// Copyright © 2020 Amazon Web Services
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package org.opengroup.osdu.schema.provider.aws.impl.schemainfostore;
import org.opengroup.osdu.core.aws.dynamodb.DynamoDBQueryHelper;
......
// Copyright © 2020 Amazon Web Services
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package org.opengroup.osdu.schema.provider.aws.impl.schemainfostore;
import org.opengroup.osdu.core.aws.dynamodb.DynamoDBQueryHelper;
......
// Copyright © 2020 Amazon Web Services
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package org.opengroup.osdu.schema.provider.aws.impl.schemainfostore;
import com.amazonaws.services.dynamodbv2.datamodeling.PaginatedQueryList;
......@@ -6,6 +19,8 @@ import org.joda.time.DateTime;
import org.opengroup.osdu.core.aws.dynamodb.DynamoDBQueryHelper;
import org.opengroup.osdu.core.common.logging.JaxRsDpsLog;
import org.opengroup.osdu.core.common.model.http.DpsHeaders;
import org.opengroup.osdu.core.common.model.tenant.TenantInfo;
import org.opengroup.osdu.core.common.provider.interfaces.ITenantFactory;
import org.opengroup.osdu.schema.constants.SchemaConstants;
import org.opengroup.osdu.schema.exceptions.ApplicationException;
import org.opengroup.osdu.schema.exceptions.BadRequestException;
......@@ -19,6 +34,7 @@ import org.opengroup.osdu.schema.provider.aws.models.SchemaInfoDoc;
import org.opengroup.osdu.schema.provider.interfaces.schemainfostore.ISchemaInfoStore;
import org.opengroup.osdu.schema.provider.interfaces.schemastore.ISchemaStore;
import org.opengroup.osdu.schema.util.VersionHierarchyUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import javax.annotation.PostConstruct;
......@@ -33,6 +49,9 @@ public class AwsSchemaInfoStore implements ISchemaInfoStore {
@Inject
private DpsHeaders headers;
@Autowired
private ITenantFactory tenantFactory;
@Inject
private JaxRsDpsLog log;
......@@ -74,15 +93,17 @@ public class AwsSchemaInfoStore implements ISchemaInfoStore {
// Set Audit properties
SchemaInfo schemaInfo = schema.getSchemaInfo();
SchemaInfoDoc schemaInfoDoc = SchemaInfoDoc.mapFrom(schema.getSchemaInfo(), partitionId);
schemaInfoDoc.setDataPartitionId(partitionId);
schemaInfo.setCreatedBy(userEmail);
schemaInfo.setDateCreated(DateTime.now().toDate());
SchemaInfoDoc schemaInfoDoc = SchemaInfoDoc.mapFrom(schemaInfo, partitionId);
schemaInfoDoc.setId(id);
throwExceptionIfSupersedingSchemaIsNotFoundInDb(schemaInfo.getSupersededBy(), partitionId);
validateSupersededById(schemaInfo.getSupersededBy(), partitionId);
try {
queryHelper.save(schemaInfoDoc);
} catch (Exception ex) {
log.error(MessageFormat.format(SchemaConstants.OBJECT_INVALID, ex.getMessage()));
throw new ApplicationException(SchemaConstants.SCHEMA_CREATION_FAILED_INVALID_OBJECT);
......@@ -103,10 +124,13 @@ public class AwsSchemaInfoStore implements ISchemaInfoStore {
schemaInfo.setDateCreated(DateTime.now().toDate());
SchemaInfoDoc schemaInfoDoc = SchemaInfoDoc.mapFrom(schema.getSchemaInfo(), partitionId);
schemaInfoDoc.setDataPartitionId(partitionId);
schemaInfoDoc.setId(id);
throwExceptionIfSupersedingSchemaIsNotFoundInDb(schemaInfo.getSupersededBy(), partitionId);
if(queryHelper.keyExistsInTable(SchemaInfoDoc.class, schemaInfoDoc) == true) {
throw new BadRequestException("Schema " + id + " already exist. Can't create again.");
}
validateSupersededById(schemaInfo.getSupersededBy(), partitionId);
try {
queryHelper.save(schemaInfoDoc);
......@@ -122,18 +146,12 @@ public class AwsSchemaInfoStore implements ISchemaInfoStore {
public String getLatestMinorVerSchema(SchemaInfo schemaInfo) throws ApplicationException {
String dataPartitionId = headers.getPartitionId();
SchemaInfoDoc fullSchemaInfoDoc = SchemaInfoDoc.mapFrom(schemaInfo, headers.getPartitionId());
// remap to another object only containing the partial key
SchemaInfoDoc query = SchemaInfoDoc.builder()
.dataPartitionId(fullSchemaInfoDoc.getDataPartitionId())
.authority(fullSchemaInfoDoc.getAuthority())
.scope(fullSchemaInfoDoc.getScope())
.entityType(fullSchemaInfoDoc.getEntityType())
.build();
PaginatedQueryList<SchemaInfoDoc> results = queryHelper.queryByGSI(SchemaInfoDoc.class,
query,
"MajorVersion",
fullSchemaInfoDoc.getMajorVersion());
SchemaInfoDoc gsiQuery = new SchemaInfoDoc();
gsiQuery.setGsiPartitionKey(fullSchemaInfoDoc.getGsiPartitionKey());
PaginatedQueryList<SchemaInfoDoc> results = queryHelper.queryByGSI(SchemaInfoDoc.class,gsiQuery,"MajorVersion",fullSchemaInfoDoc.getMajorVersion());
TreeMap<Long, SchemaInfoDoc> sortedMap = new TreeMap<>(Collections.reverseOrder());
......@@ -220,12 +238,29 @@ public class AwsSchemaInfoStore implements ISchemaInfoStore {
return toReturn;
}
@Override
@Override
public boolean isUnique(String schemaId, String tenantId) throws ApplicationException {
String id = tenantId + ":" + schemaId;
SchemaInfoDoc schemaInfoDoc = new SchemaInfoDoc();
schemaInfoDoc.setId(id);
return !queryHelper.keyExistsInTable(SchemaInfoDoc.class, schemaInfoDoc);
Set<String> tenantList = new HashSet<>();
tenantList.add(SchemaConstants.ACCOUNT_ID_COMMON_PROJECT);
tenantList.add(tenantId);
// code to call check uniqueness
if (tenantId.equalsIgnoreCase(SchemaConstants.ACCOUNT_ID_COMMON_PROJECT)) {
List<String> privateTenantList = tenantFactory.listTenantInfo().stream().map(TenantInfo::getDataPartitionId)
.collect(Collectors.toList());
tenantList.addAll(privateTenantList);
}
for (String tenant : tenantList) {
String id = tenant + ":" + schemaId;
SchemaInfoDoc schemaInfoDoc = new SchemaInfoDoc();
schemaInfoDoc.setId(id);
if(queryHelper.keyExistsInTable(SchemaInfoDoc.class, schemaInfoDoc) == true){ // the schemaId exists and hence is not unique
return false;
}
}
return true;
}
@Override
......@@ -243,14 +278,22 @@ public class AwsSchemaInfoStore implements ISchemaInfoStore {
}
}
private void throwExceptionIfSupersedingSchemaIsNotFoundInDb(SchemaIdentity schema, String tenantId) throws ApplicationException, BadRequestException {
if (schema != null) {
if (!isUnique(schema.getId(), tenantId)) {
throw new BadRequestException(SchemaConstants.INVALID_SUPERSEDEDBY_ID);
private void validateSupersededById(SchemaIdentity superseding_schema, String tenantId) throws ApplicationException, BadRequestException {
if (superseding_schema != null) {
String id = tenantId + ":" + superseding_schema.getId();
SchemaInfoDoc schemaInfoDoc = new SchemaInfoDoc();
schemaInfoDoc.setId(id);
if(queryHelper.keyExistsInTable(SchemaInfoDoc.class, schemaInfoDoc) == false) // superseding schema does ot exist in the db
{
throw new BadRequestException(SchemaConstants.INVALID_SUPERSEDEDBY_ID);
}
}
}
private List<SchemaInfo> getLatestVersionSchemaList(List<SchemaInfo> filteredSchemaList) {
List<SchemaInfo> latestSchemaList = new LinkedList<>();
SchemaInfo previousSchemaInfo = null;
......
// Copyright © 2020 Amazon Web Services
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package org.opengroup.osdu.schema.provider.aws.impl.schemainfostore;
import org.opengroup.osdu.core.aws.dynamodb.DynamoDBQueryHelper;
......
// Copyright © 2020 Amazon Web Services
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package org.opengroup.osdu.schema.provider.aws.impl.schemastore;
import com.amazonaws.services.s3.AmazonS3;
......
// Copyright © 2020 Amazon Web Services
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package org.opengroup.osdu.schema.provider.aws.models;
import com.amazonaws.services.dynamodbv2.datamodeling.*;
......
// Copyright © 2020 Amazon Web Services
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package org.opengroup.osdu.schema.provider.aws.models;
import com.amazonaws.services.dynamodbv2.datamodeling.*;
......
// Copyright © 2020 Amazon Web Services
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package org.opengroup.osdu.schema.provider.aws.models;
import com.amazonaws.services.dynamodbv2.datamodeling.*;
......@@ -32,18 +45,10 @@ public class SchemaInfoDoc {
@DynamoDBAttribute(attributeName = "SchemaEntityType")
private String entityType;
@DynamoDBIndexHashKey(globalSecondaryIndexName = "major-version-index")
@DynamoDBAttribute(attributeName = "PartitionAuthoritySourceEntityType")
public String getPartialKey() {
return String.format("%s:%s:%s:%s", getDataPartitionId(),
getAuthority(),
getSource(),
getEntityType());
}
public void setPartialKey(String value) {}
@DynamoDBIndexHashKey(attributeName = "PartitionAuthoritySourceEntityType", globalSecondaryIndexName = "major-version-index")
private String gsiPartitionKey;
@DynamoDBIndexRangeKey(globalSecondaryIndexName = "major-version-index")
@DynamoDBAttribute(attributeName = "MajorVersion")
@DynamoDBIndexRangeKey(attributeName = "MajorVersion",globalSecondaryIndexName = "major-version-index")
private Long majorVersion;
@DynamoDBAttribute(attributeName = "MinorVersion")
......@@ -102,7 +107,8 @@ public class SchemaInfoDoc {
.status(schemaStatus.name())
.majorVersion(schemaIdentity.getSchemaVersionMajor())
.minorVersion(schemaIdentity.getSchemaVersionMinor())
.patchVersion(schemaIdentity.getSchemaVersionPatch());
.patchVersion(schemaIdentity.getSchemaVersionPatch())
.gsiPartitionKey(String.format("%s:%s:%s:%s",dataPartitionId,schemaIdentity.getAuthority(),schemaIdentity.getSource(),schemaIdentity.getEntityType()));
return schemaInfoDocBuilder.build();
}
......
// Copyright © 2020 Amazon Web Services
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package org.opengroup.osdu.schema.provider.aws.models;
import com.amazonaws.services.dynamodbv2.datamodeling.*;
......
# Copyright 2020 Amazon Web Services
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
server.servlet.context-path=/api/schema-service/v1
logging.level.org.springframework.web=${LOG_LEVEL:INFO}
server.port=${APPLICATION_PORT:8080}
aws.resource.prefix=${ENVIRONMENT}
aws.ssm=${SSM_ENABLED:True}
AUTHORIZE_API=${ENTITLEMENTS_URL:http://localhost:8081}
AUTHORIZE_API=${ENTITLEMENTS_BASE_URL}/api/entitlements/v1
AUTHORIZE_API_KEY=
LOG_PREFIX=schema
......@@ -19,8 +33,6 @@ aws.dynamodb.table.prefix=${aws.resource.prefix}-
aws.region=${AWS_REGION}
aws.dynamodb.endpoint=dynamodb.${AWS_REGION}.amazonaws.com
## AWS Lambda configuration
aws.lambda.get-groups-function-name=${aws.resource.prefix}-os-entitlements-GroupsFunction
# if this is turned on then the service tries to connect to elastic search
management.health.elasticsearch.enabled=false
// Copyright © 2020 Amazon Web Services
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package org.opengroup.osdu.schema.provider.aws.impl.schemainfostore;
import org.junit.Assert;
......
// Copyright © 2020 Amazon Web Services
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//