Skip to content

Commit

Permalink
changes made to show fields in upgrade.
Browse files Browse the repository at this point in the history
  • Loading branch information
vikasrathee-cs committed Mar 20, 2024
1 parent ecf6993 commit c19a90f
Show file tree
Hide file tree
Showing 12 changed files with 36 additions and 32 deletions.
3 changes: 2 additions & 1 deletion docs/GoogleDrive-batchsink.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ OAuth2 client credentials can be generated on Google Cloud
[Credentials Page](https://console.cloud.google.com/apis/credentials)

**OAuth Method:** The method used to get OAuth access tokens. The oauth access token can be directly provided,
or a client id, client secret, and refresh token can be provided.
or a client id, client secret, and refresh token can be provided. Access Token can be used if user wants to
provide access token directly or oauthAccessToken macro.

**Access Token:** Short lived access token for connect.

Expand Down
3 changes: 2 additions & 1 deletion docs/GoogleDrive-batchsource.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ OAuth2 client credentials can be generated on Google Cloud
[Credentials Page](https://console.cloud.google.com/apis/credentials)

**OAuth Method:** The method used to get OAuth access tokens. The oauth access token can be directly provided,
or a client id, client secret, and refresh token can be provided.
or a client id, client secret, and refresh token can be provided. Access Token can be used if user wants to
provide access token directly or oauthAccessToken macro.

**Access Token:** Short lived access token for connect.

Expand Down
3 changes: 2 additions & 1 deletion docs/GoogleSheets-batchsink.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ OAuth2 client credentials can be generated on Google Cloud
[Credentials Page](https://console.cloud.google.com/apis/credentials)

**OAuth Method:** The method used to get OAuth access tokens. The oauth access token can be directly provided,
or a client id, client secret, and refresh token can be provided.
or a client id, client secret, and refresh token can be provided. Access Token can be used if user wants to
provide access token directly or oauthAccessToken macro.

**Access Token:** Short lived access token for connect.

Expand Down
3 changes: 2 additions & 1 deletion docs/GoogleSheets-batchsource.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ OAuth2 client credentials can be generated on Google Cloud
[Credentials Page](https://console.cloud.google.com/apis/credentials)

**OAuth Method:** The method used to get OAuth access tokens. The oauth access token can be directly provided,
or a client id, client secret, and refresh token can be provided.
or a client id, client secret, and refresh token can be provided. Access Token can be used if user wants to
provide access token directly or oauthAccessToken macro.

**Access Token:** Short lived access token for connect.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public abstract class GoogleAuthBaseConfig extends PluginConfig {
public static final String SCHEMA = "schema";
public static final String ACCESS_TOKEN = "accessToken";
public static final String ACCESS_TOKEN_LABEL = "Access token";
public static final String OAUTH_METHOD = "oauthMethod";
public static final String OAUTH_METHOD = "oAuthMethod";

private static final String IS_SET_FAILURE_MESSAGE_PATTERN = "'%s' property is empty or macro is not available.";

Expand Down Expand Up @@ -85,7 +85,7 @@ public abstract class GoogleAuthBaseConfig extends PluginConfig {
@Description("The method used to get OAuth access tokens. "
+ "The oauth access token can be directly provided, "
+ "or a client id, client secret, and refresh token can be provided.")
private String oauthMethod;
private String oAuthMethod;

@Nullable
@Macro
Expand Down Expand Up @@ -314,8 +314,8 @@ public void setRefreshToken(String refreshToken) {
this.refreshToken = refreshToken;
}

public void setOauthMethod(String oauthMethod) {
this.oauthMethod = oauthMethod;
public void setoAuthMethod(String oAuthMethod) {
this.oAuthMethod = oAuthMethod;
}

public void setAccessToken(String accessToken) {
Expand Down Expand Up @@ -383,13 +383,13 @@ public Boolean isServiceAccountFilePath() {
}

public OAuthMethod getOAuthMethod() {
if (oauthMethod == null) {
if (oAuthMethod == null) {
return OAuthMethod.REFRESH_TOKEN;
}
try {
return OAuthMethod.valueOf(oauthMethod.toUpperCase());
return OAuthMethod.valueOf(oAuthMethod.toUpperCase());
} catch (IllegalArgumentException e) {
throw new IllegalArgumentException("Invalid oauth method " + oauthMethod);
throw new IllegalArgumentException("Invalid oAuth method " + oAuthMethod);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ public static GoogleDriveSourceConfig of(JsonObject properties) throws IOExcepti
googleDriveSourceConfig.setAccessToken(properties.get(GoogleDriveSourceConfig.ACCESS_TOKEN).getAsString());
}
if (properties.has(GoogleDriveSourceConfig.OAUTH_METHOD)) {
googleDriveSourceConfig.setOauthMethod(properties.get(GoogleDriveSourceConfig.OAUTH_METHOD).getAsString());
googleDriveSourceConfig.setoAuthMethod(properties.get(GoogleDriveSourceConfig.OAUTH_METHOD).getAsString());
}
return googleDriveSourceConfig;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1261,10 +1261,10 @@ public static GoogleSheetsSourceConfig of(JsonObject properties) throws IOExcept
}

if (properties.has(GoogleSheetsSourceConfig.OAUTH_METHOD)) {
googleSheetsSourceConfig.setOauthMethod(
googleSheetsSourceConfig.setoAuthMethod(
properties.get(GoogleSheetsSourceConfig.OAUTH_METHOD).getAsString());
}

if (properties.has(GoogleSheetsSourceConfig.ACCESS_TOKEN)) {
googleSheetsSourceConfig.setAccessToken(
properties.get(GoogleSheetsSourceConfig.ACCESS_TOKEN).getAsString());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public void testValidationOauthWithoutAccessToken() {
GoogleDriveSourceConfig config = new GoogleDriveSourceConfig("ref");
config.setReferenceName("validationErrorFilePath");
config.setAuthType("oAuth2");
config.setOauthMethod(OAuthMethod.ACCESS_TOKEN.name());
config.setoAuthMethod(OAuthMethod.ACCESS_TOKEN.name());
config.setModificationDateRange("today");
config.getBodyFormat("string");
config.setStartDate("today");
Expand All @@ -108,7 +108,7 @@ public void testValidationOauthWithoutRefreshToken() {
GoogleDriveSourceConfig config = new GoogleDriveSourceConfig(null);
config.setReferenceName("validationErrorFilePath");
config.setAuthType("oAuth2");
config.setOauthMethod(OAuthMethod.REFRESH_TOKEN.name());
config.setoAuthMethod(OAuthMethod.REFRESH_TOKEN.name());
config.setModificationDateRange("today");
config.getBodyFormat("string");
config.setStartDate("today");
Expand Down
8 changes: 4 additions & 4 deletions widgets/GoogleDrive-batchsink.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
}
},
{
"name": "oauthMethod",
"name": "oAuthMethod",
"label": "OAuth Method",
"widget-type": "radio-group",
"widget-attributes": {
Expand Down Expand Up @@ -144,15 +144,15 @@
},
"show": [
{
"name": "oauthMethod",
"name": "oAuthMethod",
"type": "property"
}
]
},
{
"name": "Authenticate with OAuth2 Access Token",
"condition": {
"expression": "oauthMethod == 'ACCESS_TOKEN' && authType == 'oAuth2'"
"expression": "oAuthMethod == 'ACCESS_TOKEN' && authType == 'oAuth2'"
},
"show": [
{
Expand All @@ -164,7 +164,7 @@
{
"name": "Authenticate with OAuth2 Refresh Token",
"condition": {
"expression": "oauthMethod == 'REFRESH_TOKEN' && authType == 'oAuth2'"
"expression": "oAuthMethod == null || (oAuthMethod != 'ACCESS_TOKEN' && authType == 'oAuth2')"
},
"show": [
{
Expand Down
8 changes: 4 additions & 4 deletions widgets/GoogleDrive-batchsource.json
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@
}
},
{
"name": "oauthMethod",
"name": "oAuthMethod",
"label": "OAuth Method",
"widget-type": "radio-group",
"widget-attributes": {
Expand Down Expand Up @@ -517,15 +517,15 @@
},
"show": [
{
"name": "oauthMethod",
"name": "oAuthMethod",
"type": "property"
}
]
},
{
"name": "Authenticate with OAuth2 Access Token",
"condition": {
"expression": "oauthMethod == 'ACCESS_TOKEN' && authType == 'oAuth2'"
"expression": "oAuthMethod == 'ACCESS_TOKEN' && authType == 'oAuth2'"
},
"show": [
{
Expand All @@ -537,7 +537,7 @@
{
"name": "Authenticate with OAuth2 Refresh Token",
"condition": {
"expression": "oauthMethod == 'REFRESH_TOKEN' && authType == 'oAuth2'"
"expression": "oAuthMethod == null || (oAuthMethod != 'ACCESS_TOKEN' && authType == 'oAuth2')"
},
"show": [
{
Expand Down
8 changes: 4 additions & 4 deletions widgets/GoogleSheets-batchsink.json
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@
"name": "serviceAccountJSON"
},
{
"name": "oauthMethod",
"name": "oAuthMethod",
"label": "OAuth Method",
"widget-type": "radio-group",
"widget-attributes": {
Expand Down Expand Up @@ -267,15 +267,15 @@
},
"show": [
{
"name": "oauthMethod",
"name": "oAuthMethod",
"type": "property"
}
]
},
{
"name": "Authenticate with OAuth2 Access Token",
"condition": {
"expression": "oauthMethod == 'ACCESS_TOKEN' && authType == 'oAuth2'"
"expression": "oAuthMethod == 'ACCESS_TOKEN' && authType == 'oAuth2'"
},
"show": [
{
Expand All @@ -287,7 +287,7 @@
{
"name": "Authenticate with OAuth2 Refresh Token",
"condition": {
"expression": "oauthMethod == 'REFRESH_TOKEN' && authType == 'oAuth2'"
"expression": "oAuthMethod == null || (oAuthMethod != 'ACCESS_TOKEN' && authType == 'oAuth2')"
},
"show": [
{
Expand Down
8 changes: 4 additions & 4 deletions widgets/GoogleSheets-batchsource.json
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@
"name": "serviceAccountJSON"
},
{
"name": "oauthMethod",
"name": "oAuthMethod",
"label": "OAuth Method",
"widget-type": "radio-group",
"widget-attributes": {
Expand Down Expand Up @@ -434,15 +434,15 @@
},
"show": [
{
"name": "oauthMethod",
"name": "oAuthMethod",
"type": "property"
}
]
},
{
"name": "Authenticate with OAuth2 Access Token",
"condition": {
"expression": "oauthMethod == 'ACCESS_TOKEN' && authType == 'oAuth2'"
"expression": "oAuthMethod == 'ACCESS_TOKEN' && authType == 'oAuth2'"
},
"show": [
{
Expand All @@ -454,7 +454,7 @@
{
"name": "Authenticate with OAuth2 Refresh Token",
"condition": {
"expression": "oauthMethod == 'REFRESH_TOKEN' && authType == 'oAuth2'"
"expression": "oAuthMethod == null || (oAuthMethod != 'ACCESS_TOKEN' && authType == 'oAuth2')"
},
"show": [
{
Expand Down

0 comments on commit c19a90f

Please sign in to comment.