Skip to content
This repository has been archived by the owner on Nov 13, 2023. It is now read-only.

43 apiml integration #104

Merged
merged 16 commits into from
Nov 7, 2018
Merged

43 apiml integration #104

merged 16 commits into from
Nov 7, 2018

Conversation

tucker01
Copy link
Contributor

@tucker01 tucker01 commented Nov 6, 2018

Overview

Implements the ability to specify "basePath" in the rest client session object. See the Swagger doc for details on "base path".

In summary, the "base path" is used/configured by API mediation layers and API Gateways to identify a service (and versioning).

Directly to the service:
https://host:port/pets

Gateway:
https://host:port/api/v1/pet_service/pets

In the above example, api/v1/pet_service would be the "base path".

CLI implementations which perform HTTP/REST calls can take advantage of this capability in order to be simultaneously compatible with a Gateway and going directly to a service.

Additional Improvements

Adds additional fields/properties to the rest client error for debugging/diagnostics. The additional fields are also formatted into a printable error response (found in the additionalDetails property of the ImperativeError) and automatically formatted/surface if a RestClientError is thrown from a handler and caught by the Imperative command processor (normal error handling for command handlers).

Gene Johnston and others added 15 commits October 24, 2018 18:40
…request().

Compiles and a sanity test works ok.

Signed-off-by: Gene Johnston <Eugene.Johnston@ca.com>
Signed-off-by: ChrisBoehmCA <Christopher.Boehm@ca.com>
…nd end with a slash (or not).

Also ensure that no leading or trailing spaces are included.

Signed-off-by: Gene Johnston <Eugene.Johnston@ca.com>
Signed-off-by: ChrisBoehmCA <Christopher.Boehm@ca.com>
Signed-off-by: Gene Johnston <Eugene.Johnston@ca.com>
Signed-off-by: Jason <jason.tucker@ca.com>
Signed-off-by: Jason <jason.tucker@ca.com>
… - tests will fail

Signed-off-by: Jason <jason.tucker@ca.com>
Signed-off-by: Jason <jason.tucker@ca.com>
Signed-off-by: Jason <jason.tucker@ca.com>
Signed-off-by: Jason <jason.tucker@ca.com>
Signed-off-by: Jason <jason.tucker@ca.com>
Signed-off-by: Jason <jason.tucker@ca.com>
@ghost ghost assigned tucker01 Nov 6, 2018
@ghost ghost added in progress labels Nov 6, 2018
Copy link
Contributor

@ChrisBoehmCA ChrisBoehmCA left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. This provides the ability to optionally use a base path, explains the concept well, and worked well when tested with Zowe CLI.

"\nResource: " + finalError.resource +
"\nRequest: " + finalError.request +
"\nHeaders: " + headerDetails +
"\nPayload: " + payloadDetails;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This increased amount of information should hopefully be helpful to the user 👍

* @type {string}
* @memberof ISession
*/
basePath?: string;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice thorough explanation of the concept of base path 👍

@@ -185,17 +188,11 @@ export abstract class AbstractRestClient {
* Invoke any onError method whenever an error occurs on writing
*/
clientRequest.on("error", (errorResponse: any) => {
let impError: IImperativeError = {
reject(this.populateError({
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool that we now get more details in the case of client request errors

@@ -522,7 +522,7 @@ export class CommandProcessor {
args._ = commandArguments._;

// Log for debugging
this.log.debug(`Full argument object constructed:\n${inspect(args)}`);
this.log.trace(`Full argument object constructed:\n${inspect(args)}`);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for fixing this to not output password populated into the arguments

@JTonda JTonda removed the in progress label Nov 6, 2018
@tucker01 tucker01 merged commit f6e83dc into master Nov 7, 2018
@ghost ghost removed the review label Nov 7, 2018
@tucker01 tucker01 deleted the 43_APIML_integration_ branch November 7, 2018 13:49
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants