Skip to content

Commit a487a85

Browse files
committed
Samples
1 parent 58eb324 commit a487a85

File tree

32 files changed

+1872
-180
lines changed

32 files changed

+1872
-180
lines changed

astra-sdk-devops/pom.xml

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,22 @@
1111
</parent>
1212

1313
<dependencies>
14+
15+
<!-- Core Libs -->
16+
<dependency>
17+
<groupId>org.slf4j</groupId>
18+
<artifactId>slf4j-api</artifactId>
19+
</dependency>
1420
<dependency>
1521
<groupId>org.apache.httpcomponents.client5</groupId>
1622
<artifactId>httpclient5</artifactId>
1723
</dependency>
24+
<dependency>
25+
<groupId>org.projectlombok</groupId>
26+
<artifactId>lombok</artifactId>
27+
</dependency>
28+
29+
<!-- Jackson -->
1830
<dependency>
1931
<groupId>com.fasterxml.jackson</groupId>
2032
<artifactId>jackson-bom</artifactId>
@@ -38,23 +50,28 @@
3850
<groupId>com.fasterxml.jackson.datatype</groupId>
3951
<artifactId>jackson-datatype-jsr310</artifactId>
4052
</dependency>
53+
54+
<!-- Testing -->
4155
<dependency>
4256
<groupId>org.junit.jupiter</groupId>
4357
<artifactId>junit-jupiter-engine</artifactId>
4458
<scope>test</scope>
4559
</dependency>
46-
<dependency>
47-
<groupId>org.slf4j</groupId>
48-
<artifactId>slf4j-api</artifactId>
49-
</dependency>
5060
<dependency>
5161
<groupId>ch.qos.logback</groupId>
5262
<artifactId>logback-classic</artifactId>
63+
<scope>test</scope>
5364
</dependency>
54-
<dependency>
55-
<groupId>org.projectlombok</groupId>
56-
<artifactId>lombok</artifactId>
57-
</dependency>
65+
5866
</dependencies>
5967

68+
<licenses>
69+
<license>
70+
<name>Apache-2.0</name>
71+
<url>https://www.apache.org/licenses/LICENSE-2.0.txt</url>
72+
<distribution>repo</distribution>
73+
<comments>A business-friendly OSS license</comments>
74+
</license>
75+
</licenses>
76+
6077
</project>

astra-sdk-devops/src/main/java/com/dtsx/astra/sdk/db/domain/DatabaseCreationRequest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public DatabaseCreationRequest() {}
6767

6868
/**
6969
* Constructor with the builder.
70-
*
70+
*o
7171
* @param builder
7272
* current builder
7373
*/

astra-sdk-devops/src/main/java/com/dtsx/astra/sdk/utils/ApiLocator.java

Lines changed: 39 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77
*/
88
public class ApiLocator {
99

10-
11-
1210
/** Building Astra base URL. */
1311
public static final String HTTPS = "https://";
1412

@@ -17,15 +15,17 @@ public class ApiLocator {
1715
*/
1816
private ApiLocator() {}
1917

18+
// -- Devops --
19+
2020
/**
2121
* Get the Devops endpoint.
2222
*
2323
* @return
2424
* the devops URL.
2525
*/
26-
//public static String getApiDevopsEndpoint() {
27-
// return getApiDevopsEndpoint(AstraEnvironment.PROD);
28-
//}
26+
public static String getApiDevopsEndpoint() {
27+
return getApiDevopsEndpoint(AstraEnvironment.PROD);
28+
}
2929

3030
/**
3131
* Get the Devops endpoint.
@@ -49,7 +49,7 @@ public static String getApiDevopsEndpoint(AstraEnvironment env) {
4949
* @return
5050
* the url to invoke
5151
*/
52-
public static final String getApiRestEndpoint(String dbId, String dbRegion) {
52+
public static String getApiRestEndpoint(String dbId, String dbRegion) {
5353
return getApiRestEndpoint(AstraEnvironment.PROD, dbId, dbRegion);
5454
}
5555

@@ -65,7 +65,7 @@ public static final String getApiRestEndpoint(String dbId, String dbRegion) {
6565
* @return
6666
* the url to invoke
6767
*/
68-
public static final String getApiRestEndpoint(AstraEnvironment env, String dbId, String dbRegion) {
68+
public static String getApiRestEndpoint(AstraEnvironment env, String dbId, String dbRegion) {
6969
Assert.hasLength(dbId, "dbId");
7070
Assert.hasLength(dbRegion, "dbRegion");
7171
return new StringBuilder(HTTPS)
@@ -75,6 +75,38 @@ public static final String getApiRestEndpoint(AstraEnvironment env, String dbId,
7575
.toString();
7676
}
7777

78+
/**
79+
* REST and DOCUMENT endpoint for a database and region.
80+
*
81+
* @param dbId
82+
* database identifier
83+
* @param dbRegion
84+
* region identifier
85+
* @return
86+
* the url to invoke
87+
*/
88+
public static String getApiJsonEndpoint(String dbId, String dbRegion) {
89+
return getApiJsonEndpoint(AstraEnvironment.PROD, dbId, dbRegion);
90+
}
91+
92+
/**
93+
* END Point for the Json API
94+
*
95+
* @param env
96+
* target environment
97+
* @param dbId
98+
* database identifier
99+
* @param dbRegion
100+
* region identifier
101+
* @return
102+
* the url to invoke
103+
*/
104+
public static String getApiJsonEndpoint(AstraEnvironment env, String dbId, String dbRegion) {
105+
Assert.hasLength(dbId, "dbId");
106+
Assert.hasLength(dbRegion, "dbRegion");
107+
return HTTPS + dbId + "-" + dbRegion + env.getAppsSuffix() + "/api/json";
108+
}
109+
78110
/**
79111
* Document endpoint.
80112
*

astra-sdk-pulsar/pom.xml

Lines changed: 22 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,11 @@
1313

1414
<dependencies>
1515

16-
<!-- ASTRA STREAMING -->
16+
<!-- Core Libs -->
17+
<dependency>
18+
<groupId>org.slf4j</groupId>
19+
<artifactId>slf4j-api</artifactId>
20+
</dependency>
1721
<dependency>
1822
<groupId>org.apache.pulsar</groupId>
1923
<artifactId>pulsar-client-admin</artifactId>
@@ -22,37 +26,32 @@
2226
<groupId>org.apache.pulsar</groupId>
2327
<artifactId>pulsar-client</artifactId>
2428
</dependency>
25-
26-
<dependency>
27-
<groupId>org.slf4j</groupId>
28-
<artifactId>slf4j-api</artifactId>
29-
</dependency>
3029
<dependency>
31-
<groupId>ch.qos.logback</groupId>
32-
<artifactId>logback-core</artifactId>
33-
<scope>test</scope>
34-
</dependency>
35-
<dependency>
36-
<groupId>ch.qos.logback</groupId>
37-
<artifactId>logback-classic</artifactId>
38-
<scope>test</scope>
30+
<groupId>com.datastax.astra</groupId>
31+
<artifactId>astra-sdk-devops</artifactId>
32+
<version>${project.version}</version>
3933
</dependency>
34+
35+
<!-- Tests -->
4036
<dependency>
4137
<groupId>org.junit.jupiter</groupId>
4238
<artifactId>junit-jupiter-engine</artifactId>
4339
<scope>test</scope>
4440
</dependency>
4541
<dependency>
46-
<groupId>com.datastax.astra</groupId>
47-
<artifactId>astra-sdk-devops</artifactId>
48-
<version>${project.version}</version>
42+
<groupId>ch.qos.logback</groupId>
43+
<artifactId>logback-classic</artifactId>
4944
<scope>test</scope>
5045
</dependency>
51-
<dependency>
52-
<groupId>com.datastax.astra</groupId>
53-
<artifactId>astra-sdk-devops</artifactId>
54-
<version>0.6.12-SNAPSHOT</version>
55-
<scope>compile</scope>
56-
</dependency>
5746
</dependencies>
47+
48+
<licenses>
49+
<license>
50+
<name>Apache-2.0</name>
51+
<url>https://www.apache.org/licenses/LICENSE-2.0.txt</url>
52+
<distribution>repo</distribution>
53+
<comments>A business-friendly OSS license</comments>
54+
</license>
55+
</licenses>
56+
5857
</project>

astra-sdk-vector/pom.xml

Lines changed: 46 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,16 @@
2020
<groupId>org.slf4j</groupId>
2121
<artifactId>slf4j-api</artifactId>
2222
</dependency>
23+
2324
<dependency>
24-
<groupId>ch.qos.logback</groupId>
25-
<artifactId>logback-classic</artifactId>
25+
<groupId>org.projectlombok</groupId>
26+
<artifactId>lombok</artifactId>
27+
</dependency>
28+
29+
<!-- Help creating index -->
30+
<dependency>
31+
<groupId>com.datastax.oss</groupId>
32+
<artifactId>java-driver-query-builder</artifactId>
2633
</dependency>
2734

2835
<dependency>
@@ -37,34 +44,58 @@
3744
</exclusions>
3845
</dependency>
3946

47+
48+
<!-- TEST -->
4049
<dependency>
41-
<groupId>org.projectlombok</groupId>
42-
<artifactId>lombok</artifactId>
43-
<scope>provided</scope>
50+
<groupId>org.junit.jupiter</groupId>
51+
<artifactId>junit-jupiter-engine</artifactId>
52+
<scope>test</scope>
4453
</dependency>
45-
4654
<dependency>
47-
<groupId>com.datastax.oss</groupId>
48-
<artifactId>java-driver-query-builder</artifactId>
55+
<groupId>ch.qos.logback</groupId>
56+
<artifactId>logback-classic</artifactId>
57+
<scope>test</scope>
4958
</dependency>
50-
51-
<!-- Testing with OpenAI -->
5259
<dependency>
5360
<groupId>com.theokanning.openai-gpt3-java</groupId>
5461
<artifactId>service</artifactId>
5562
<version>${openai-java.version}</version>
5663
<scope>test</scope>
5764
</dependency>
5865
<dependency>
59-
<groupId>org.junit.jupiter</groupId>
60-
<artifactId>junit-jupiter-engine</artifactId>
66+
<groupId>dev.langchain4j</groupId>
67+
<artifactId>langchain4j-open-ai</artifactId>
68+
<version>0.23.0</version>
6169
<scope>test</scope>
6270
</dependency>
6371
<dependency>
64-
<groupId>org.apache.pulsar</groupId>
65-
<artifactId>pulsar-client-admin-api</artifactId>
66-
<version>2.11.1</version>
72+
<groupId>dev.langchain4j</groupId>
73+
<artifactId>langchain4j-hugging-face</artifactId>
74+
<version>0.23.0</version>
6775
<scope>test</scope>
6876
</dependency>
6977
</dependencies>
78+
79+
<build>
80+
<plugins>
81+
<plugin>
82+
<groupId>org.apache.maven.plugins</groupId>
83+
<artifactId>maven-compiler-plugin</artifactId>
84+
<configuration>
85+
<source>11</source>
86+
<target>11</target>
87+
</configuration>
88+
</plugin>
89+
</plugins>
90+
</build>
91+
92+
<licenses>
93+
<license>
94+
<name>Apache-2.0</name>
95+
<url>https://www.apache.org/licenses/LICENSE-2.0.txt</url>
96+
<distribution>repo</distribution>
97+
<comments>A business-friendly OSS license</comments>
98+
</license>
99+
</licenses>
100+
70101
</project>

0 commit comments

Comments
 (0)