Giter VIP home page Giter VIP logo

aio-lib-java-cloudmanager's Introduction

Maven Central Build Codecov License

Adobe I/O Java Cloud Manager Library

This is a Java Library wrapping the Adobe Cloud Manager API.

Goals

Provide a set of convenience methods for interacting with the Cloud Manager definitions for a given organization.

Usage

See the docs.

Contributing

Contributions are welcomed! Read the Contributing Guide for more information.

Please run the and include the output from the generate-javadoc Maven profile for any Pull Requests, to keep the documentation up-to-date.

GitHub Actions

Tag & Release

This is the only action that requires a user to activate manually.

Releasing a version of the library can be done by activating the Tag & Release action.

The version is optional, if unspecified it will use whatever Maven determines is the next release.

Snapshot Deploy

Activated on every commit to the main branch.

Automatically deploy a SNAPSHOT of the current build to Maven Central's snapshot repository.

Build & Verify

Activated on every pull request to the main branch.

Automatically run a build and tests for the project.

Update Changelog

Activated on every commit to the main branch.

This will automatically update the Changelog from Pull Requests or Issues, and commit it back to the main branch.

Update JavaDoc

Activated after every successful Tag & Release run. This will run the Maven profile for generating the Project JavaDocs and commit them back to the main branch. This will keep them always up-to-date with the latest release.

Licensing

This project is licensed under the Apache V2 License. See LICENSE for more information.

aio-lib-java-cloudmanager's People

Contributors

bstopp avatar dependabot[bot] avatar justinedelson avatar kwin avatar web-flow avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

aio-lib-java-cloudmanager's Issues

Expose more metadata from CloudManagerApiException

Currently all meta information being passed to the constructor is only used to construct an error message (

public CloudManagerApiException(ErrorType type, String baseUrl, String apiPath, ApiException cause) {
). Sometimes it would be useful for consumers to get the http status code after the exception has been caught.
I propose to also store at least the HTTP status code as field and expose it via a getter. Otherwise error handling apart from logging will be difficult to achieve (because parsing of the error message is necessary then).

Add method to check for a running execution

All methods exposed by CloudManagerApi related to current executions of a pipeline with a given id throw an exception in case no execution is running. It would be handy to have a method like hasCurrentExecution(...) which doesn't rely on exceptions (due to the overhead of dealing with exception)

Update API documentation links and swagger links

The Cloud Manager API docs have been replatformed and as a result all of the URLs have changed. The existing ones still work but it'd be best to update them. More importantly, the default branch has changed to main so the process that downloads the swagger file at build time should be changed to ensure that future updates are incorporated.

Expose both pipeline phase and step type from PipelineExecutionStepState

To be able to visualize a progress log, it would be nice to expose both the action (including optional details) as well as the phase label from https://github.com/adobe/aio-lib-java-cloudmanager/blob/main/src/main/java/io/adobe/cloudmanager/model/PipelineExecutionStepState.java to be able to replicate the visualization in the Cloud Manager UI.

Example phase label = "Build and Code Scanning"
Example action/step label = "Code Scanning"

If you don't want to to expose labels for i18n reasons maybe an enum type for both step and phase can be exposed via get methods.

Align with the Adobe IO Java library.

The AIO Java lib now provides authentication mechanisms and standard API for configuring AIO programs/workspaces.

This library should be updated to align with that design.

CloudManagerApiException message contains double slash in URL

The messages exposed by CloudManagerApiException emit the url

io.adobe.cloudmanager.CloudManagerApiException: Cannot get execution: https://cloudmanager.adobe.io//api/program/.../pipeline/.../execution (404 Not Found)

Expected Behaviour

There should be no double slash in the URL after the host name.

Actual Behaviour

There is a double slash due to the fact that baseUrl ends with a slash and path starts with a slash.

Although the actual request works fine, a correct URL should be used both for the request as well as for the exception.

Calling cancelCurrentExecution followed by startExecution leads to Exception

It seems that CloudManagerApi.cancelCurrentExecution() is asynchronously performed on the backend because even if that request succeeds a call to CloudManagerApi.startExection() with the same program and pipeline id directly afterwards fails with the following exception:

io.adobe.cloudmanager.CloudManagerApiException: Cannot create execution. Pipeline already running.
	at io.adobe.cloudmanager.impl.CloudManagerApiImpl.startExecution(CloudManagerApiImpl.java:151)
	at io.adobe.cloudmanager.impl.CloudManagerApiImpl.startExecution(CloudManagerApiImpl.java:140)

In the best case cancelCurrentExecution should be blocking, in the worst case it should be mentioned explicitly in the javadoc that this operation is performed asynchronously and there should be a poll mechanism being offered to wait for it to succeed.

Expose getDelegate for non-serializable wrappers around Swagger models

Although all Swagger model classes are serializable the wrapper classes in io.adobe.cloudmanager.model are not. E.g. PipelineExecutionStepState contains a reference towards CloudManagerApi which is not serializable. For all those wrapper classes the delegate should be exposed via a public getDelegate() method, because otherwise consumers cannot get hold of the serializable model instance.

Support PEM encoded PKCS#8 private keys

Currently each consumer needs to create the private key instance themself. It would be handy if the AdobeClientCredentials would provide some method which creates a PrivateKey from a given String in the format outlined at https://tools.ietf.org/html/rfc7468#section-10

The code for that is pretty straight-forward actually and one can use an approach like outlined in https://www.baeldung.com/java-read-pem-file-keys#3-get-private-key-from-pem-string.

The only question is whether only RSA keys should be supported or other types (DSA, EC) as well

java.lang.NoSuchMethodError: 'void javax.ws.rs.core.MultivaluedMap.addAll(java.lang.Object, java.lang.Object[])' when used in Jenkins

I use the client in a Jenkins Shared Library via

@Grab(group='io.adobe.cloudmanager', module='aio-lib-cloudmanager', version='0.4.0')

When trying to get the token I run into the following exception

java.lang.NoSuchMethodError: 'void javax.ws.rs.core.MultivaluedMap.addAll(java.lang.Object, java.lang.Object[])'
	at org.glassfish.jersey.client.ClientRequest.accept(ClientRequest.java:322)
	at org.glassfish.jersey.client.JerseyInvocation$Builder.accept(JerseyInvocation.java:224)
	at org.glassfish.jersey.client.JerseyInvocation$Builder.accept(JerseyInvocation.java:147)
	at io.adobe.cloudmanager.jwt.swagger.invoker.ApiClient.invokeAPI(ApiClient.java:696)
	at io.adobe.cloudmanager.jwt.swagger.api.JwtApi.authenticate(JwtApi.java:109)
	at io.adobe.cloudmanager.impl.IdentityManagementApiImpl.authenticate(IdentityManagementApiImpl.java:73)
	at io.adobe.cloudmanager.impl.IdentityManagementApiImpl.authenticate(IdentityManagementApiImpl.java:67)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)
	at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
	at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1213)
	at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1022)
	at org.codehaus.groovy.runtime.callsite.PojoMetaClassSite.call(PojoMetaClassSite.java:47)
	at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125)
	at customGroovyscript.....

The reason for that is that the Java library requires JAX-RS 2.0.0 while Jenkins still seems to ship with JAX-RS 1.1.0 (or older): https://stackoverflow.com/a/44070033.

How to use a proxy to access ims-na1.adobelogin.com ?

Hi!

I need to use the aio-lib-java-cloudmanager on a host where you would need a proxy to access the cloud manager api at ims-na1.adobelogin.com . How can I do this? Unfortunately, setting the system properties -Dhttp.proxyHost=proxy.stw.intra -Dhttp.proxyPort=8080 doesn't seem to do anything there. Is there another way to set a proxy?

Thank you so much, and thanks for this nicely done library!

Best regards,
Hans-Peter

Platform and Version

aio-lib-cloudmanager version 1.0.0 running on OpenJDK 1.8.0_265-b01 on Linux

Sample Code that illustrates the problem

    AdobeClientCredentials credentials = new AdobeClientCredentials(orgId, technicalAccountId, clientIdApiKey, clientSecret, privateKey);
    IdentityManagementApi imApi = IdentityManagementApi.create();
    String token = imApi.authenticate(credentials);

should not work when running it if you set an invalid proxy, -Dhttp.proxyHost=nowhere.neverland -Dhttp.proxyPort=8080 , or whatever way is appropriate to set a proxy. Conversely, if you set a proxy, it should be used. But perhaps there is another, right, way to set a proxy.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.