diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/Discovery.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/Discovery.java index a84bae4d44..58e2944818 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/Discovery.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/Discovery.java @@ -2673,7 +2673,10 @@ public ServiceCall createCredentials( .toJsonTree(createCredentialsOptions.credentialDetails())); } if (createCredentialsOptions.status() != null) { - contentJson.addProperty("status", createCredentialsOptions.status()); + contentJson.add( + "status", + com.ibm.cloud.sdk.core.util.GsonSingleton.getGson() + .toJsonTree(createCredentialsOptions.status())); } builder.bodyJson(contentJson); ResponseConverter responseConverter = @@ -2760,7 +2763,10 @@ public ServiceCall updateCredentials( .toJsonTree(updateCredentialsOptions.credentialDetails())); } if (updateCredentialsOptions.status() != null) { - contentJson.addProperty("status", updateCredentialsOptions.status()); + contentJson.add( + "status", + com.ibm.cloud.sdk.core.util.GsonSingleton.getGson() + .toJsonTree(updateCredentialsOptions.status())); } builder.bodyJson(contentJson); ResponseConverter responseConverter = diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/CreateCredentialsOptions.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/CreateCredentialsOptions.java index 3f3e585e7e..2d7965ec8e 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/CreateCredentialsOptions.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/CreateCredentialsOptions.java @@ -38,30 +38,17 @@ public interface SourceType { String CLOUD_OBJECT_STORAGE = "cloud_object_storage"; } - /** - * The current status of this set of credentials. `connected` indicates that the credentials are - * available to use with the source configuration of a collection. `invalid` refers to the - * credentials (for example, the password provided has expired) and must be corrected before they - * can be used with a collection. - */ - public interface Status { - /** connected. */ - String CONNECTED = "connected"; - /** invalid. */ - String INVALID = "invalid"; - } - protected String environmentId; protected String sourceType; protected CredentialDetails credentialDetails; - protected String status; + protected StatusDetails status; /** Builder. */ public static class Builder { private String environmentId; private String sourceType; private CredentialDetails credentialDetails; - private String status; + private StatusDetails status; private Builder(CreateCredentialsOptions createCredentialsOptions) { this.environmentId = createCredentialsOptions.environmentId; @@ -130,7 +117,7 @@ public Builder credentialDetails(CredentialDetails credentialDetails) { * @param status the status * @return the CreateCredentialsOptions builder */ - public Builder status(String status) { + public Builder status(StatusDetails status) { this.status = status; return this; } @@ -210,14 +197,11 @@ public CredentialDetails credentialDetails() { /** * Gets the status. * - *

The current status of this set of credentials. `connected` indicates that the credentials - * are available to use with the source configuration of a collection. `invalid` refers to the - * credentials (for example, the password provided has expired) and must be corrected before they - * can be used with a collection. + *

Object that contains details about the status of the authentication process. * * @return the status */ - public String status() { + public StatusDetails status() { return status; } } diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/Credentials.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/Credentials.java index 515ff8331b..a6c2a45fe0 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/Credentials.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/Credentials.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2018, 2020. + * (C) Copyright IBM Corp. 2021. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -39,19 +39,6 @@ public interface SourceType { String CLOUD_OBJECT_STORAGE = "cloud_object_storage"; } - /** - * The current status of this set of credentials. `connected` indicates that the credentials are - * available to use with the source configuration of a collection. `invalid` refers to the - * credentials (for example, the password provided has expired) and must be corrected before they - * can be used with a collection. - */ - public interface Status { - /** connected. */ - String CONNECTED = "connected"; - /** invalid. */ - String INVALID = "invalid"; - } - @SerializedName("credential_id") protected String credentialId; @@ -61,13 +48,13 @@ public interface Status { @SerializedName("credential_details") protected CredentialDetails credentialDetails; - protected String status; + protected StatusDetails status; /** Builder. */ public static class Builder { private String sourceType; private CredentialDetails credentialDetails; - private String status; + private StatusDetails status; private Builder(Credentials credentials) { this.sourceType = credentials.sourceType; @@ -115,7 +102,7 @@ public Builder credentialDetails(CredentialDetails credentialDetails) { * @param status the status * @return the Credentials builder */ - public Builder status(String status) { + public Builder status(StatusDetails status) { this.status = status; return this; } @@ -179,14 +166,11 @@ public CredentialDetails credentialDetails() { /** * Gets the status. * - *

The current status of this set of credentials. `connected` indicates that the credentials - * are available to use with the source configuration of a collection. `invalid` refers to the - * credentials (for example, the password provided has expired) and must be corrected before they - * can be used with a collection. + *

Object that contains details about the status of the authentication process. * * @return the status */ - public String status() { + public StatusDetails status() { return status; } } diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/StatusDetails.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/StatusDetails.java new file mode 100644 index 0000000000..99b796c6fb --- /dev/null +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/StatusDetails.java @@ -0,0 +1,106 @@ +/* + * (C) Copyright IBM Corp. 2021. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.ibm.watson.discovery.v1.model; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** Object that contains details about the status of the authentication process. */ +public class StatusDetails extends GenericModel { + + protected Boolean authentication; + + @SerializedName("error_message") + protected String errorMessage; + + /** Builder. */ + public static class Builder { + private Boolean authentication; + private String errorMessage; + + private Builder(StatusDetails statusDetails) { + this.authentication = statusDetails.authentication; + this.errorMessage = statusDetails.errorMessage; + } + + /** Instantiates a new builder. */ + public Builder() {} + + /** + * Builds a StatusDetails. + * + * @return the new StatusDetails instance + */ + public StatusDetails build() { + return new StatusDetails(this); + } + + /** + * Set the authentication. + * + * @param authentication the authentication + * @return the StatusDetails builder + */ + public Builder authentication(Boolean authentication) { + this.authentication = authentication; + return this; + } + + /** + * Set the errorMessage. + * + * @param errorMessage the errorMessage + * @return the StatusDetails builder + */ + public Builder errorMessage(String errorMessage) { + this.errorMessage = errorMessage; + return this; + } + } + + protected StatusDetails(Builder builder) { + authentication = builder.authentication; + errorMessage = builder.errorMessage; + } + + /** + * New builder. + * + * @return a StatusDetails builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the authentication. + * + *

Indicates whether the credential is accepted by the target data source. + * + * @return the authentication + */ + public Boolean authentication() { + return authentication; + } + + /** + * Gets the errorMessage. + * + *

If `authentication` is `false`, a message describes why the authentication was unsuccessful. + * + * @return the errorMessage + */ + public String errorMessage() { + return errorMessage; + } +} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/UpdateCredentialsOptions.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/UpdateCredentialsOptions.java index 40ca85448c..e2145734a4 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/UpdateCredentialsOptions.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/UpdateCredentialsOptions.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2018, 2020. + * (C) Copyright IBM Corp. 2021. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -38,24 +38,11 @@ public interface SourceType { String CLOUD_OBJECT_STORAGE = "cloud_object_storage"; } - /** - * The current status of this set of credentials. `connected` indicates that the credentials are - * available to use with the source configuration of a collection. `invalid` refers to the - * credentials (for example, the password provided has expired) and must be corrected before they - * can be used with a collection. - */ - public interface Status { - /** connected. */ - String CONNECTED = "connected"; - /** invalid. */ - String INVALID = "invalid"; - } - protected String environmentId; protected String credentialId; protected String sourceType; protected CredentialDetails credentialDetails; - protected String status; + protected StatusDetails status; /** Builder. */ public static class Builder { @@ -63,7 +50,7 @@ public static class Builder { private String credentialId; private String sourceType; private CredentialDetails credentialDetails; - private String status; + private StatusDetails status; private Builder(UpdateCredentialsOptions updateCredentialsOptions) { this.environmentId = updateCredentialsOptions.environmentId; @@ -146,7 +133,7 @@ public Builder credentialDetails(CredentialDetails credentialDetails) { * @param status the status * @return the UpdateCredentialsOptions builder */ - public Builder status(String status) { + public Builder status(StatusDetails status) { this.status = status; return this; } @@ -240,14 +227,11 @@ public CredentialDetails credentialDetails() { /** * Gets the status. * - *

The current status of this set of credentials. `connected` indicates that the credentials - * are available to use with the source configuration of a collection. `invalid` refers to the - * credentials (for example, the password provided has expired) and must be corrected before they - * can be used with a collection. + *

Object that contains details about the status of the authentication process. * * @return the status */ - public String status() { + public StatusDetails status() { return status; } }