Commit 597e24c0 authored by Rucha Deshpande's avatar Rucha Deshpande
Browse files

remove other cp files that do not exist in master

commit a46e6995 
Author: Rucha Deshpande <deshruch@amazon.com> 
Date: Tue Sep 15 2020 09:55:07 GMT-0500 (Central Daylight Time) 

    deleting azure files that no longer exist in master


commit b3d55583 
Author: Rucha Deshpande <deshruch@amazon.com> 
Date: Tue Sep 15 2020 09:48:46 GMT-0500 (Central Daylight Time) 

    Merge branch 'dev' of codecommit::us-east-1://osdu-dev@os-schema into dev


commit eeb492ea 
Author: Matt Wise <wsmatth@amazon.com> 
Date: Tue Sep 01 2020 13:38:29 GMT-0500 (Central Daylight Time) 

    use env var for code artifact domain. dynamically use current account as repo owner


commit 2041f1ee 
Author: Rucha Deshpande <deshruch@amazon.com> 
Date: Thu Aug 27 2020 11:33:19 GMT-0500 (Central Daylight Time) 

    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



commit 546aad1a 
Author: Brandt Beal <bealbran@amazon.com> 
Date: Mon Aug 10 2020 10:01:53 GMT-0500 (Central Daylight Time) 

    feat: add aws provider

commit 6a134c90 
Author: Matt Wise <wsmatth@amazon.com> 
Date: Fri Jul 24 2020 11:18:17 GMT-0500 (Central Daylight Time) 

    docker branch latest tag


commit 98aa87c9 
Author: Brandt Beal <babeal@outlook.com> 
Date: Thu Jul 23 2020 23:35:02 GMT-0500 (Central Daylight Time) 

    feat: initial aws provider implementation
parent e12ec1bb
// Copyright © Microsoft Corporation
//
// 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.azure.di;
import org.opengroup.osdu.azure.CosmosStore;
import org.opengroup.osdu.core.common.cache.ICache;
import org.opengroup.osdu.core.common.model.http.DpsHeaders;
import org.opengroup.osdu.core.common.provider.interfaces.ITenantFactory;
import org.opengroup.osdu.core.common.model.tenant.TenantInfo;
import org.opengroup.osdu.schema.azure.definitions.TenantInfoDoc;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
@Component
public class TenantFactoryImpl implements ITenantFactory {
@Autowired
private String tenantInfoContainer;
@Autowired
private CosmosStore cosmosStore;
@Autowired
private String cosmosDBName;
@Autowired
private DpsHeaders headers;
private Map<String, TenantInfo> tenants;
public boolean exists(String tenantName)
{
if (this.tenants == null)
initTenants();
return this.tenants.containsKey(tenantName);
}
public TenantInfo getTenantInfo(String tenantName) {
if (this.tenants == null)
initTenants();
return this.tenants.get(tenantName);
}
public Collection<TenantInfo> listTenantInfo() {
if (this.tenants == null)
initTenants();
return this.tenants.values();
}
public <V> ICache<String, V> createCache(String tenantName, String host, int port, int expireTimeSeconds, Class<V> classOfV)
{
return null;
}
public void flushCache() {}
private void initTenants() {
this.tenants = new HashMap<>();
cosmosStore.findAllItems( headers.getPartitionId(), cosmosDBName, tenantInfoContainer, TenantInfoDoc.class)
.forEach(doc -> {
TenantInfo ti = new TenantInfo();
String tenantName = doc.getId();
ti.setName(tenantName);
String complianceRuleSet = doc.getComplianceRuleSet();
ti.setComplianceRuleSet(complianceRuleSet);
this.tenants.put(tenantName, ti) ;
});
}
}
// Copyright © Microsoft Corporation
//
// 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.azure.utils;
import com.azure.storage.blob.BlobContainerClient;
import com.azure.storage.blob.specialized.BlockBlobClient;
import org.opengroup.osdu.core.common.logging.JaxRsDpsLog;
import org.opengroup.osdu.core.common.model.http.DpsHeaders;
import org.opengroup.osdu.schema.exceptions.ApplicationException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import java.io.ByteArrayOutputStream;
import java.io.ByteArrayInputStream;
import java.nio.charset.StandardCharsets;
@Repository
public class OSDUAzureBlobStorageImpl {
@Autowired
private DpsHeaders headers;
@Autowired
private BlobContainerClient blobContainerClient;
@Autowired
JaxRsDpsLog log;
public String readFromBlob(String filePath) throws ApplicationException {
String content = "";
BlockBlobClient blockBlobClient = blobContainerClient.getBlobClient(filePath).getBlockBlobClient();
try (ByteArrayOutputStream downloadStream = new ByteArrayOutputStream()) {
blockBlobClient.download(downloadStream);
content = downloadStream.toString(StandardCharsets.UTF_8.name());
return content;
} catch (Exception ex) {
log.warning(ex.getMessage());
throw new ApplicationException(ex.getMessage());
}
}
public boolean deleteFromBlob(String filePath) throws ApplicationException {
BlockBlobClient blockBlobClient = blobContainerClient.getBlobClient(filePath).getBlockBlobClient();
try
{
blockBlobClient.delete();
return true;
}
catch (Exception ex)
{
log.warning(ex.getMessage());
throw new ApplicationException("Error deleting file.");
}
}
public String writeToBlob(String filePath, String content) throws ApplicationException {
byte[] bytes = content.getBytes(StandardCharsets.UTF_8);
int bytesSize = bytes.length;
BlockBlobClient blockBlobClient = blobContainerClient.getBlobClient(filePath).getBlockBlobClient();
if (blockBlobClient.exists())
{
// we need to clean up the previous schema content.
log.info("Cleaning up the previously existing blob");
this.deleteFromBlob(filePath);
}
BlockBlobClient newBlockBlobClient = blobContainerClient.getBlobClient(filePath).getBlockBlobClient();
try (ByteArrayInputStream dataStream = new ByteArrayInputStream(bytes)) {
newBlockBlobClient.upload(dataStream, bytesSize);
} catch (Exception ex) {
log.warning(ex.getMessage());
throw new ApplicationException("Write to blob failed");
}
// Get the blobname
return newBlockBlobClient.getBlobName();
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment