Commit d744f339 authored by David Diederich's avatar David Diederich
Browse files

Merge remote-tracking branch 'origin/master' into release/0.4

Conflicts:
	.gitlab-ci.yml
parents a4a60518 3a220312
......@@ -24,7 +24,7 @@ include:
- project: "osdu/platform/ci-cd-pipelines"
ref: "v0.4.2"
file: "scanners/fossa.yml"
file: "scanners/fossa-maven.yml"
- project: 'osdu/platform/ci-cd-pipelines'
ref: "v0.4.2"
......
......@@ -7,22 +7,38 @@
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<gitlab-server>community-maven-via-job-token</gitlab-server>
<repo.releases.id>community-maven-repo</repo.releases.id>
<publish.snapshots.id>community-maven-via-job-token</publish.snapshots.id>
<publish.releases.id>community-maven-via-job-token</publish.releases.id>
<repo.releases.url>https://community.opengroup.org/api/v4/groups/17/-/packages/maven</repo.releases.url>
<publish.snapshots.url>https://community.opengroup.org/api/v4/projects/221/packages/maven
</publish.snapshots.url>
<publish.releases.url>https://community.opengroup.org/api/v4/projects/221/packages/maven
</publish.releases.url>
</properties>
</profile>
<profile>
<!-- This profile uses a personal token to authenticate, which is useful for local or manual runs. The
presence of the COMMUNITY_MAVEN_TOKEN variable triggers this and overrides the CI Token
based authentication -->
presence of the COMMUNITY_MAVEN_TOKEN variable triggers this and overrides the CI Token
based authentication -->
<id>GitLab-Authenticate-With-Private-Token</id>
<activation>
<property>
<name>env.COMMUNITY_MAVEN_TOKEN</name>
</property>
<property>
<name>env.COMMUNITY_MAVEN_TOKEN</name>
</property>
</activation>
<properties>
<gitlab-server>community-maven-via-private-token</gitlab-server>
<repo.releases.id>community-maven-repo</repo.releases.id>
<publish.snapshots.id>community-maven-via-private-token</publish.snapshots.id>
<publish.releases.id>community-maven-via-private-token</publish.releases.id>
<repo.releases.url>https://community.opengroup.org/api/v4/groups/17/-/packages/maven</repo.releases.url>
<publish.snapshots.url>https://community.opengroup.org/api/v4/projects/221/packages/maven
</publish.snapshots.url>
<publish.releases.url>https://community.opengroup.org/api/v4/projects/221/packages/maven
</publish.releases.url>
</properties>
</profile>
</profiles>
......@@ -52,15 +68,16 @@
</configuration>
</server>
<server>
<id>azure-auth</id>
<configuration>
<tenant>${env.AZURE_TENANT_ID}</tenant>
<client>${env.AZURE_CLIENT_ID}</client>
<key>${env.AZURE_CLIENT_SECRET}</key>
<environment>AZURE</environment>
</configuration>
</server>
<server>
<id>azure-auth</id>
<configuration>
<tenant>${env.AZURE_TENANT_ID}</tenant>
<client>${env.AZURE_CLIENT_ID}</client>
<key>${env.AZURE_CLIENT_SECRET}</key>
<environment>AZURE</environment>
</configuration>
</server>
</servers>
</settings>
......@@ -11,6 +11,7 @@ The following software have components provided under the terms of this license:
- Cobertura code coverage (from http://cobertura.sourceforge.net)
- Plexus :: Default Container (from )
- Plexus Common Utilities (from http://plexus.codehaus.org/plexus-utils)
- StAX (from http://stax.codehaus.org/)
- oro (from )
========================================================================
......@@ -30,14 +31,10 @@ The following software have components provided under the terms of this license:
- Apache Ant Core (from http://ant.apache.org/)
- Apache Ant Launcher (from http://ant.apache.org/)
- Apache Commons BeanUtils (from http://commons.apache.org/proper/commons-beanutils/)
- Apache Commons BeanUtils (from http://commons.apache.org/proper/commons-beanutils/)
- Apache Commons CLI (from http://commons.apache.org/proper/commons-cli/)
- Apache Commons Codec (from http://commons.apache.org/proper/commons-codec/)
- Apache Commons Collections (from http://commons.apache.org/proper/commons-collections/)
- Apache Commons Lang (from http://commons.apache.org/proper/commons-lang/)
- Apache Commons Logging (from http://commons.apache.org/proper/commons-logging/)
- Apache Commons Text (from http://commons.apache.org/proper/commons-text/)
- Apache Commons Validator (from http://commons.apache.org/proper/commons-validator/)
- Apache Commons Validator (from http://commons.apache.org/proper/commons-validator/)
- Apache HttpClient (from http://hc.apache.org/httpcomponents-client)
- Apache HttpClient Cache (from http://hc.apache.org/httpcomponents-client)
......@@ -60,6 +57,7 @@ The following software have components provided under the terms of this license:
- AssertJ fluent assertions (from )
- Asynchronous Http Client (from )
- Asynchronous Http Client Netty Utils (from )
- Azure AD Spring Security Integration Spring Boot Starter (from https://github.com/Microsoft/azure-spring-boot)
- Azure Metrics Spring Boot Starter (from https://github.com/Microsoft/azure-spring-boot)
- Bean Validation API (from http://beanvalidation.org)
- Byte Buddy (without dependencies) (from )
......@@ -67,7 +65,6 @@ The following software have components provided under the terms of this license:
- ClassMate (from http://github.com/cowtowncoder/java-classmate)
- Cobertura code coverage (from http://cobertura.sourceforge.net)
- Commons Digester (from http://commons.apache.org/digester/)
- Commons Digester (from http://commons.apache.org/digester/)
- Commons IO (from http://commons.apache.org/io/)
- Commons Lang (from http://commons.apache.org/lang/)
- Converter: Jackson (from )
......@@ -88,11 +85,10 @@ The following software have components provided under the terms of this license:
- Guava InternalFutureFailureAccess and InternalFutures (from )
- Guava ListenableFuture only (from )
- Guava: Google Core Libraries for Java (from https://github.com/google/guava.git)
- Guava: Google Core Libraries for Java (from https://github.com/google/guava.git)
- HPPC Collections (from http://labs.carrotsearch.com)
- Hibernate Validator Engine (from )
- IntelliJ IDEA Annotations (from http://www.jetbrains.org)
- J2ObjC Annotations (from https://github.com/google/j2objc/)
- IntelliJ IDEA Annotations (from http://www.jetbrains.org)
- J2ObjC Annotations (from https://github.com/google/j2objc/)
- JBoss Logging 3 (from http://www.jboss.org)
- JCIP Annotations under Apache License (from http://stephenc.github.com/jcip-annotations)
......@@ -110,17 +106,23 @@ The following software have components provided under the terms of this license:
- Jackson-dataformat-YAML (from https://github.com/FasterXML/jackson)
- Jackson-datatype-Joda (from http://wiki.fasterxml.com/JacksonModuleJoda)
- Jackson-datatype-jdk8 (from )
- Jackson-module-Afterburner (from http://wiki.fasterxml.com/JacksonHome)
- Jackson-module-JAXB-annotations (from http://wiki.fasterxml.com/JacksonJAXBAnnotations)
- Jackson-module-parameter-names (from )
- Jakarta Bean Validation API (from https://beanvalidation.org)
- Java Native Access (from https://github.com/java-native-access/jna)
- Java Native Access Platform (from https://github.com/java-native-access/jna)
- Java UUID Generator (from http://wiki.fasterxml.com/JugHome)
- Javassist (from http://www.javassist.org/)
- Jetty Server (from )
- Jetty Utilities (from )
- Joda-Time (from http://www.joda.org/joda-time/)
- Json Path (from https://github.com/jayway/JsonPath)
- KeePassJava2 :: All (from https://repo1.maven.org/maven2/org/linguafranca/pwdb/KeePassJava2)
- KeePassJava2 :: DOM (from https://repo1.maven.org/maven2/org/linguafranca/pwdb/KeePassJava2-dom)
- KeePassJava2 :: JAXB (from https://repo1.maven.org/maven2/org/linguafranca/pwdb/KeePassJava2-jaxb)
- KeePassJava2 :: KDB (from https://repo1.maven.org/maven2/org/linguafranca/pwdb/KeePassJava2-kdb)
- KeePassJava2 :: KDBX (from https://repo1.maven.org/maven2/org/linguafranca/pwdb/KeePassJava2-kdbx)
- KeePassJava2 :: Simple (from https://repo1.maven.org/maven2/org/linguafranca/pwdb/KeePassJava2-simple)
- Lucene Common Analyzers (from )
- Lucene Core (from )
- Lucene Grouping (from )
......@@ -159,24 +161,29 @@ The following software have components provided under the terms of this license:
- Microsoft Application Insights Log4j 2 Appender (from https://github.com/Microsoft/ApplicationInsights-Java)
- Microsoft Azure Netty HTTP Client Library (from https://github.com/Azure/azure-sdk-for-java)
- Microsoft Azure SDK for Key Vault (from https://github.com/Azure/azure-sdk-for-java)
- Microsoft Azure SDK for SQL API of Azure Cosmos DB Service (from https://github.com/Azure/azure-sdk-for-java)
- Microsoft Azure Storage Client SDK (from https://github.com/Azure/azure-storage-java)
- Mockito (from http://mockito.org)
- Mockito (from http://mockito.org)
- Mojo's Maven plugin for Cobertura (from http://mojo.codehaus.org/cobertura-maven-plugin/)
- Netty Reactive Streams Implementation (from )
- Netty/Buffer (from http://netty.io/)
- Netty/Buffer (from http://netty.io/)
- Netty/Codec (from )
- Netty/Codec (from )
- Netty/Codec/DNS (from )
- Netty/Codec/HTTP (from )
- Netty/Codec/HTTP2 (from )
- Netty/Codec/Socks (from )
- Netty/Common (from )
- Netty/Common (from )
- Netty/Handler (from )
- Netty/Handler (from )
- Netty/Handler/Proxy (from )
- Netty/Resolver (from )
- Netty/Resolver/DNS (from )
- Netty/Resolver (from )
- Netty/TomcatNative [BoringSSL - Static] (from )
- Netty/Transport (from http://netty.io/)
- Netty/Transport (from http://netty.io/)
- Netty/Transport/Native/Unix/Common (from )
- Nimbus Content Type (from https://bitbucket.org/connect2id/nimbus-content-type)
- Nimbus JOSE+JWT (from https://bitbucket.org/connect2id/nimbus-jose-jwt)
......@@ -190,6 +197,7 @@ The following software have components provided under the terms of this license:
- Okio (from )
- OpenCensus (from https://github.com/census-instrumentation/opencensus-java)
- OpenCensus (from https://github.com/census-instrumentation/opencensus-java)
- PWDB :: Database (from https://repo1.maven.org/maven2/org/linguafranca/pwdb/database)
- Plexus :: Default Container (from )
- Plexus Common Utilities (from http://plexus.codehaus.org/plexus-utils)
- Plexus Default Interactivity Handler (from )
......@@ -200,6 +208,7 @@ The following software have components provided under the terms of this license:
- Reactive Streams Netty driver (from https://github.com/reactor/reactor-netty)
- Retrofit (from )
- Servlet Specification 2.5 API (from )
- Simple XML (from http://simple.sourceforge.net)
- SnakeYAML (from http://www.snakeyaml.org)
- Spring AOP (from https://github.com/spring-projects/spring-framework)
- Spring Beans (from https://github.com/spring-projects/spring-framework)
......@@ -215,32 +224,35 @@ The following software have components provided under the terms of this license:
- Spring Boot Test (from http://projects.spring.io/spring-boot/)
- Spring Boot Test Auto-Configure (from http://projects.spring.io/spring-boot/)
- Spring Boot Test Starter (from http://projects.spring.io/spring-boot/)
- Spring Boot Tomcat Starter (from http://projects.spring.io/spring-boot/)
- Spring Boot Validation Starter (from http://projects.spring.io/spring-boot/)
- Spring Boot Web Starter (from http://projects.spring.io/spring-boot/)
- Spring Commons Logging Bridge (from https://github.com/spring-projects/spring-framework)
- Spring Context (from https://github.com/spring-projects/spring-framework)
- Spring Core (from https://github.com/spring-projects/spring-framework)
- Spring Data Core (from )
- Spring Expression Language (SpEL) (from https://github.com/spring-projects/spring-framework)
- Spring Plugin - Core (from )
- Spring Plugin - Metadata Extension (from )
- Spring TestContext Framework (from https://github.com/spring-projects/spring-framework)
- Spring Transaction (from https://github.com/spring-projects/spring-framework)
- Spring Web (from https://github.com/spring-projects/spring-framework)
- Spring Web MVC (from https://github.com/spring-projects/spring-framework)
- StAX (from http://stax.codehaus.org/)
- StAX API (from http://stax.codehaus.org/)
- T-Digest (from https://github.com/tdunning/t-digest)
- Woodstox (from https://github.com/FasterXML/woodstox)
- Xerces2-j (from https://xerces.apache.org/xerces2-j/)
- aalto-xml (from )
- aggs-matrix-stats (from https://github.com/elastic/elasticsearch)
- cli (from https://github.com/elastic/elasticsearch)
- commons-collections (from )
- commons-collections (from )
- compiler (from http://github.com/spullara/mustache.java)
- elasticsearch-core (from https://github.com/elastic/elasticsearch)
- elasticsearch-geo (from https://github.com/elastic/elasticsearch)
- error-prone annotations (from )
- error-prone annotations (from )
- io.grpc:grpc-context (from https://github.com/grpc/grpc-java)
- jackson-databind (from http://github.com/FasterXML/jackson)
- javatuples (from http://www.javatuples.org)
- javax.inject (from http://code.google.com/p/atinject/)
- kotlin-stdlib (from )
- lang-mustache (from https://github.com/elastic/elasticsearch)
......@@ -268,7 +280,6 @@ The following software have components provided under the terms of this license:
- rank-eval (from https://github.com/elastic/elasticsearch)
- rest-high-level (from https://github.com/elastic/elasticsearch)
- rxjava (from https://github.com/ReactiveX/RxJava)
- rxjava (from https://github.com/ReactiveX/RxJava)
- secure-sm (from https://github.com/elastic/elasticsearch)
- spring-security-config (from http://spring.io/spring-security)
- spring-security-core (from http://spring.io/spring-security)
......@@ -289,8 +300,6 @@ The following software have components provided under the terms of this license:
- swagger-models (from )
- tomcat-annotations-api (from http://tomcat.apache.org/)
- tomcat-embed-core (from http://tomcat.apache.org/)
- tomcat-embed-core (from http://tomcat.apache.org/)
- tomcat-embed-websocket (from http://tomcat.apache.org/)
- x-content (from https://github.com/elastic/elasticsearch)
- xml-apis (from )
......@@ -305,6 +314,7 @@ The following software have components provided under the terms of this license:
- Lucene Common Analyzers (from )
- Plexus :: Default Container (from )
- Plexus Common Utilities (from http://plexus.codehaus.org/plexus-utils)
- StAX (from http://stax.codehaus.org/)
- Stax2 API (from http://github.com/FasterXML/stax2-api)
- jaxen (from http://jaxen.codehaus.org/)
- oro (from )
......@@ -344,13 +354,6 @@ The following software have components provided under the terms of this license:
- jakarta.xml.bind-api (from )
- jaxen (from http://jaxen.codehaus.org/)
========================================================================
CC-BY-2.5
========================================================================
The following software have components provided under the terms of this license:
- Checker Qual (from https://checkerframework.org)
========================================================================
CC-BY-3.0
========================================================================
......@@ -383,6 +386,7 @@ The following software have components provided under the terms of this license:
- JavaBeans(TM) Activation Framework (from http://java.sun.com/javase/technologies/desktop/javabeans/jaf/index.jsp)
- JavaMail API (from )
- Servlet Specification 2.5 API (from )
- javax.annotation-api (from http://jcp.org/en/jsr/detail?id=250)
========================================================================
CDDL-1.1
......@@ -391,7 +395,6 @@ The following software have components provided under the terms of this license:
- JavaBeans Activation Framework (from )
- tomcat-embed-core (from http://tomcat.apache.org/)
- tomcat-embed-core (from http://tomcat.apache.org/)
========================================================================
EPL-1.0
......@@ -443,7 +446,7 @@ The following software have components provided under the terms of this license:
- JavaBeans Activation Framework (from )
- JavaMail API (from )
- Mojo's Maven plugin for Cobertura (from http://mojo.codehaus.org/cobertura-maven-plugin/)
- tomcat-embed-core (from http://tomcat.apache.org/)
- javax.annotation-api (from http://jcp.org/en/jsr/detail?id=250)
- tomcat-embed-core (from http://tomcat.apache.org/)
========================================================================
......@@ -458,13 +461,12 @@ GPL-2.0-with-classpath-exception
========================================================================
The following software have components provided under the terms of this license:
- Checker Qual (from https://checkerframework.org)
- Cobertura code coverage (from http://cobertura.sourceforge.net)
- Expression Language 3.0 (from https://projects.eclipse.org/projects/ee4j.el)
- JavaBeans Activation Framework (from )
- JavaMail API (from )
- jakarta.annotation-api (from https://projects.eclipse.org/projects/ee4j.ca)
- tomcat-embed-core (from http://tomcat.apache.org/)
- javax.annotation-api (from http://jcp.org/en/jsr/detail?id=250)
- tomcat-embed-core (from http://tomcat.apache.org/)
========================================================================
......@@ -516,14 +518,12 @@ MIT
========================================================================
The following software have components provided under the terms of this license:
- Animal Sniffer Annotations (from )
- Azure AD Spring Security Integration Spring Boot Starter (from https://github.com/Microsoft/azure-spring-boot)
- Azure Java Client Authentication Library for AutoRest (from https://github.com/Azure/autorest-clientruntime-for-java)
- Azure Java Client Runtime for AutoRest (from https://github.com/Azure/autorest-clientruntime-for-java)
- Azure Metrics Spring Boot Starter (from https://github.com/Microsoft/azure-spring-boot)
- Azure Spring Boot AutoConfigure (from https://github.com/Microsoft/azure-spring-boot)
- Checker Qual (from https://checkerframework.org)
- Checker Qual (from https://checkerframework.org)
- Extensions on Apache Proton-J library (from https://github.com/Azure/qpid-proton-j-extensions)
- JOpt Simple (from http://pholser.github.io/jopt-simple)
- JUL to SLF4J bridge (from http://www.slf4j.org)
......@@ -545,20 +545,25 @@ The following software have components provided under the terms of this license:
- Microsoft Azure client library for Identity (from https://github.com/Azure/azure-sdk-for-java)
- Microsoft Azure client library for KeyVault Secrets (from https://github.com/Azure/azure-sdk-for-java)
- Microsoft Azure common module for Storage (from https://github.com/Azure/azure-sdk-for-java)
- Microsoft Azure internal Avro module for Storage (from https://github.com/Azure/azure-sdk-for-java)
- Mockito (from http://mockito.org)
- Mockito (from http://mockito.org)
- Netty/Codec/HTTP (from )
- Netty/Common (from )
- Netty/Common (from )
- Plexus :: Default Container (from )
- Plexus Default Interactivity Handler (from )
- Project Lombok (from https://projectlombok.org)
- Project Lombok (from https://projectlombok.org)
- SLF4J API Module (from http://www.slf4j.org)
- Spongy Castle (from http://rtyley.github.io/spongycastle/)
- Spring Data for Azure Cosmos DB SQL API (from https://github.com/Azure/azure-sdk-for-java/tree/master/sdk/cosmos/azure-spring-data-cosmos)
- adal4j (from https://github.com/AzureAD/azure-activedirectory-library-for-java)
- jwks-rsa (from http://www.auth0.com)
- micrometer-core (from https://github.com/micrometer-metrics/micrometer)
- mockito-junit-jupiter (from https://github.com/mockito/mockito)
- msal4j (from https://github.com/AzureAD/microsoft-authentication-library-for-java)
- msal4j-persistence-extension (from https://github.com/AzureAD/microsoft-authentication-extensions-for-java)
- spring-security-core (from http://spring.io/spring-security)
========================================================================
......@@ -594,6 +599,7 @@ The following software have components provided under the terms of this license:
- JTidy (from http://jtidy.sourceforge.net)
- LatencyUtils (from http://latencyutils.github.io/LatencyUtils/)
- Plexus Common Utilities (from http://plexus.codehaus.org/plexus-utils)
- Spongy Castle (from http://rtyley.github.io/spongycastle/)
- xml-apis (from )
========================================================================
......@@ -608,7 +614,6 @@ SPL-1.0
========================================================================
The following software have components provided under the terms of this license:
- Checker Qual (from https://checkerframework.org)
- Checker Qual (from https://checkerframework.org)
========================================================================
......@@ -634,7 +639,6 @@ The following software have components provided under the terms of this license:
- Asynchronous Http Client (from )
- Guava: Google Core Libraries for Java (from https://github.com/google/guava.git)
- Guava: Google Core Libraries for Java (from https://github.com/google/guava.git)
- HdrHistogram (from http://hdrhistogram.github.io/HdrHistogram/)
- Joda-Time (from http://www.joda.org/joda-time/)
- LatencyUtils (from http://latencyutils.github.io/LatencyUtils/)
......@@ -644,6 +648,7 @@ The following software have components provided under the terms of this license:
- Project Lombok (from https://projectlombok.org)
- Project Lombok (from https://projectlombok.org)
- Spring Web (from https://github.com/spring-projects/spring-framework)
- msal4j (from https://github.com/AzureAD/microsoft-authentication-library-for-java)
- reactive-streams (from http://www.reactive-streams.org/)
========================================================================
......@@ -656,6 +661,7 @@ The following software have components provided under the terms of this license:
- JavaBeans Activation Framework API jar (from )
- JavaMail API (from )
- Servlet Specification 2.5 API (from )
- Spongy Castle (from http://rtyley.github.io/spongycastle/)
- jakarta.xml.bind-api (from )
- org.junit.jupiter:junit-jupiter-api (from http://junit.org/junit5/)
- org.junit.jupiter:junit-jupiter-engine (from http://junit.org/junit5/)
......
......@@ -68,21 +68,6 @@ spec:
configMapKeyRef:
name: osdu-svc-properties
key: ENV_KEYVAULT
- name: AZURE_TENANT_ID
valueFrom:
secretKeyRef:
name: active-directory
key: tenantid
- name: AZURE_CLIENT_ID
valueFrom:
secretKeyRef:
name: active-directory
key: principal-clientid
- name: AZURE_CLIENT_SECRET
valueFrom:
secretKeyRef:
name: active-directory
key: principal-clientpassword
- name: appinsights_key
valueFrom:
secretKeyRef:
......@@ -102,4 +87,3 @@ spec:
value: "api://$(aad_client_id)"
- name: azure_activedirectory_session_stateless
value: "true"
......@@ -156,6 +156,39 @@ paths:
security:
- JWT:
- global
patch:
tags:
- partition-api
summary: update
operationId: updateUsingPATCH
consumes:
- application/json
produces:
- application/json
parameters:
- name: partitionId
in: path
description: partitionId
required: true
type: string
- in: body
name: partitionInfo
description: partitionInfo
required: true
schema:
$ref: '#/definitions/PartitionInfo'
responses:
'204':
description: No Content
'401':
description: Unauthorized
'403':
description: Forbidden
'404':
description: Not Found
security:
- JWT:
- global
delete:
tags:
- partition-api
......@@ -183,12 +216,14 @@ paths:
- global
securityDefinitions:
JWT:
type: oauth2
type: apiKey
name: Authorization
in: header
definitions:
PartitionInfo:
type: object
required:
- properties
properties:
properties:
type: object
......
......@@ -7,6 +7,7 @@
* [APIs](#apis)
* [Get partition details](#get-partition)
* [Create a new partition](#create-partition)
* [Update an existing partition](#update-partition)
* [Delete an existing partition](#delete-partition)
* [List of partitions](#list-partition)
......@@ -128,6 +129,34 @@ curl --request POST \
```
</details>
[Back to Table of Contents](#TOC)
### Update an existing partition<a name="update-partition"></a>
This api is used to update the properties of an existing partition. With this api, we can modify existing properties or add new ones. Deletion of properties can not be achieved, we'll have to delete the partition and re-create it for the same effect.
```
PATCH api/partition/v1/partitions/{partitionId}
```
<details><summary>curl</summary>
```
curl --request PATCH \
--url 'https://<base_url>/api/partition/v1/partitions/mypartition' \
--header 'Authorization: Bearer <JWT>' \
--header 'Content-Type: application/json' \
--data-raw '{
"properties": {
"compliance-ruleset": {
"value": "shared-update-value"
},
"new-key": {
"sensitive": true,
"value": "new-value"
}
}
}'
```
</details>
### Delete an existing partition<a name="delete-partition"></a>
This api is used to delete an existing partition. A plausible use case would be partition teardown infrastructure script.
```
......
......@@ -36,7 +36,6 @@
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.source>1.8</maven.compiler.source>
<springfox-version>2.7.0</springfox-version>
<tomcat_embed_core_version>9.0.21</tomcat_embed_core_version>
<gson_version>2.8.6</gson_version>
<powermock.version>2.0.6</powermock.version>
<mockito.core.version>3.3.3</mockito.core.version>
......@@ -67,11 +66,9 @@
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-core</artifactId>
<version>${tomcat_embed_core_version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
......
......@@ -19,6 +19,7 @@ import org.opengroup.osdu.partition.model.Property;
import org.opengroup.osdu.partition.provider.interfaces.IPartitionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
......@@ -47,6 +48,13 @@ public class PartitionApi {
return ResponseEntity.created(partitionLocation).build();
}
@PatchMapping("/{partitionId}")
@PreAuthorize("@authorizationFilter.hasPermissions()")
@ResponseStatus(HttpStatus.NO_CONTENT)
public void patch(@PathVariable("partitionId") String partitionId, @RequestBody @Valid PartitionInfo partitionInfo) {
this.partitionService.updatePartition(partitionId, partitionInfo);
}
@GetMapping("/{partitionId}")
@PreAuthorize("@authorizationFilter.hasPermissions()")
public ResponseEntity<Map<String, Property>> get(@PathVariable("partitionId") String partitionId) {
......
......@@ -22,6 +22,8 @@ public interface IPartitionService {
PartitionInfo createPartition(String partitionId, PartitionInfo partitionInfo);
PartitionInfo updatePartition(String partitionId, PartitionInfo partitionInfo);
PartitionInfo getPartition(String partitionId);
boolean deletePartition(String partitionId);
......
......@@ -15,7 +15,6 @@
package org.opengroup.osdu.partition.provider.interfaces;
import org.opengroup.osdu.core.common.cache.ICache;
import org.opengroup.osdu.partition.model.PartitionInfo;
public interface IPartitionServiceCache<String, V> extends ICache<String, V> {
}
......@@ -14,6 +14,8 @@
package org.opengroup.osdu.partition.service;
import org.apache.http.HttpStatus;
import org.opengroup.osdu.core.common.model.http.AppException;
import org.opengroup.osdu.partition.model.PartitionInfo;
import org.opengroup.osdu.partition.provider.interfaces.IPartitionService;
import org.opengroup.osdu.partition.provider.interfaces.IPartitionServiceCache;
......@@ -33,13 +35,17 @@ public class CachedPartitionServiceImpl implements IPartitionService {
private IPartitionService partitionService;
@Inject
private IPartitionServiceCache partitionServiceCache;
@Qualifier("partitionServiceCache")
private IPartitionServiceCache<String, PartitionInfo> partitionServiceCache;
@Inject
private IPartitionServiceCache partitionListCache;
@Qualifier("partitionListCache")
private IPartitionServiceCache<String, List<String>> partitionListCache;
@Override
public PartitionInfo createPartition(String partitionId, PartitionInfo partitionInfo) {
if (partitionServiceCache.get(partitionId) != null)
throw new AppException(HttpStatus.SC_CONFLICT, "partition exist", "Partition with same id exist");
PartitionInfo pi = partitionService.createPartition(partitionId, partitionInfo);
if (pi != null) {
......@@ -49,6 +55,17 @@ public class CachedPartitionServiceImpl implements IPartitionService {
return pi;
}
@Override
public PartitionInfo updatePartition(String partitionId, PartitionInfo partitionInfo) {
PartitionInfo pi = partitionService.updatePartition(partitionId, partitionInfo);
if(pi != null) {
partitionServiceCache.put(partitionId, pi);
}
return pi;
}
@Override
public PartitionInfo getPartition(String partitionId) {
PartitionInfo pi = (PartitionInfo) partitionServiceCache.get(partitionId);
......
......@@ -77,6 +77,12 @@ public class PartitionApiTest {
assertNotNull(result.getHeaders().get(HttpHeaders.LOCATION));
}
@Test
public void should_return204_when_givenUpdatingValidPartitionId() {
String partitionId = "partition1";
this.sut.patch(partitionId, partitionInfo);
}