Skip to content

Commit

Permalink
Merge pull request #25 from rursprung/initial-featureset
Browse files Browse the repository at this point in the history
implement first version (basic HTTP actions support, basic auth)
  • Loading branch information
filipelautert authored Sep 13, 2024
2 parents 18ea706 + d7b8d16 commit aa59f36
Show file tree
Hide file tree
Showing 42 changed files with 2,538 additions and 232 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ buildNumber.properties
# https://github.com/takari/maven-wrapper#usage-without-binary-jar
.mvn/wrapper/maven-wrapper.jar
*.iml
.idea
.idea
build/
91 changes: 82 additions & 9 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.liquibase</groupId>
<artifactId>liquibase-parent-pom</artifactId>
<version>0.4.5</version> <!-- Replace with the desired version -->
<version>0.4.5</version>
</parent>

<groupId>org.liquibase.ext</groupId>
Expand All @@ -15,22 +15,22 @@
<name>Liquibase Opensearch Extension</name>
<packaging>jar</packaging>

<description>Describe your extension here.</description>
<url>https://docs.liquibase.com</url>
<description>Liquibase extension to manage changesets for OpenSearch.</description>
<url>https://github.com/liquibase/liquibase-opensearch</url>

<licenses>
<license>
<name>Liquibase EULA</name>
<url>https://www.liquibase.com/eula</url>
<url>https://www.apache.org/licenses/LICENSE-2.0</url>
<name>Apache License, Version 2.0</name>
</license>
</licenses>

<developers>
<developer>
<name>Your Name</name>
<email>youremail@example.com</email>
<organization>Liquibase</organization>
<organizationUrl>https://www.liquibase.com/</organizationUrl>
<name>Ralph Ursprung</name>
<email>ralph.ursprung@avaloq.com</email>
<organization>Avaloq Group AG</organization>
<organizationUrl>https://www.avaloq.com/</organizationUrl>
</developer>
</developers>

Expand Down Expand Up @@ -61,15 +61,88 @@
<artifactId>liquibase-core</artifactId>
<version>${liquibase.version}</version>
</dependency>
<dependency>
<groupId>org.opensearch.client</groupId>
<artifactId>opensearch-java</artifactId>
<version>2.14.0</version>
<exclusions>
<exclusion>
<groupId>org.opensearch.client</groupId>
<artifactId>opensearch-rest-client</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.32</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>2.17.2</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.17.2</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents.core5</groupId>
<artifactId>httpcore5</artifactId>
<version>5.2.5</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents.client5</groupId>
<artifactId>httpclient5</artifactId>
<version>5.3.1</version>
</dependency>

<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>5.10.3</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<version>3.26.3</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>testcontainers</artifactId>
<version>1.20.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.opensearch</groupId>
<artifactId>opensearch-testcontainers</artifactId>
<version>2.1.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>2.0.16</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>2.0.16</version>
<scope>test</scope>
</dependency>
</dependencies>

<build>
<resources>
<resource>
<directory>${project.basedir}/src/main/resources</directory>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.sonarsource.scanner.maven</groupId>
Expand Down
57 changes: 0 additions & 57 deletions src/main/java/com/example/change/ClearPasswordsChange.java

This file was deleted.

32 changes: 0 additions & 32 deletions src/main/java/com/example/change/PrefixedCreateTableChange.java

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
package liquibase.ext.opensearch.change;

import liquibase.change.AbstractChange;
import liquibase.change.ChangeMetaData;
import liquibase.change.DatabaseChange;
import liquibase.database.Database;
import liquibase.ext.opensearch.statement.HttpRequestStatement;
import liquibase.statement.SqlStatement;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

import java.util.Optional;

@DatabaseChange(name = "httpRequest",
description = "Execute an arbitrary HTTP request with the provided payload",
priority = ChangeMetaData.PRIORITY_DATABASE)
@NoArgsConstructor
@Getter
@Setter
public class HttpRequestChange extends AbstractChange {

private String method;
private String path;
private String body;

@Override
public String getConfirmationMessage() {
return String.format("executed the HTTP %s request against %s (with a body of size %d)",
this.getMethod(),
this.getPath(),
Optional.ofNullable(this.getBody()).map(String::length).orElse(0));
}

@Override
public SqlStatement[] generateStatements(final Database database) {
return new SqlStatement[] {
new HttpRequestStatement(this.getMethod(), this.getPath(), this.getBody())
};
}
}
Loading

0 comments on commit aa59f36

Please sign in to comment.