-
Notifications
You must be signed in to change notification settings - Fork 141
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Vamsi Manohar <[email protected]>
- Loading branch information
Showing
24 changed files
with
465 additions
and
298 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
core/src/main/java/org/opensearch/sql/datasource/model/DataSourceStatus.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package org.opensearch.sql.datasource.model; | ||
|
||
public enum DataSourceStatus { | ||
ACTIVE("active"), | ||
DISABLED("disabled"); | ||
|
||
private String text; | ||
|
||
DataSourceStatus(String text) { | ||
this.text = text; | ||
} | ||
|
||
public String getText() { | ||
return this.text; | ||
} | ||
|
||
/** | ||
* Get DataSourceStatus from text. | ||
* | ||
* @param text text. | ||
* @return DataSourceStatus {@link DataSourceStatus}. | ||
*/ | ||
public static DataSourceStatus fromString(String text) { | ||
for (DataSourceStatus dataSourceStatus : DataSourceStatus.values()) { | ||
if (dataSourceStatus.text.equalsIgnoreCase(text)) { | ||
return dataSourceStatus; | ||
} | ||
} | ||
throw new IllegalArgumentException("No DataSourceStatus with text " + text + " found"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
.../src/main/java/org/opensearch/sql/datasources/exceptions/DatasourceDisabledException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package org.opensearch.sql.datasources.exceptions; | ||
|
||
/** Exception for taking actions on a disabled datasource. */ | ||
public class DatasourceDisabledException extends RuntimeException { | ||
public DatasourceDisabledException(String message) { | ||
super(message); | ||
} | ||
Check warning on line 12 in datasources/src/main/java/org/opensearch/sql/datasources/exceptions/DatasourceDisabledException.java Codecov / codecov/patchdatasources/src/main/java/org/opensearch/sql/datasources/exceptions/DatasourceDisabledException.java#L11-L12
|
||
} |
Oops, something went wrong.