Code Monkey home page Code Monkey logo

slipstreamclojureapi's Introduction

SlipStream is now deprecated -> replaced by https://github.com/nuvla

SlipStream

Developed by SixSq, SlipStream is a multi-cloud application management platform. See the SlipStream product page for more detailed information.

Release Notes

The release notes are available from the main SlipStream documentation website. Stable releases are those that have been validated and are supported. Candidate releases are (usually) the result of each development iteration and may or may not be stable. These can be used but are not supported.

Getting started

See the Developer Guide on the main SlipStream documentation website. This contains the full, supported build procedure for SlipStream, including the required build tools and dependencies.

License and copyright

Copyright (C) 2017 SixSq Sarl (sixsq.com)

The code in the public repositories is licensed under the Apache license.

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.

slipstreamclojureapi's People

Contributors

0xbase12 avatar konstan avatar schaubl avatar sixsq-hudson avatar st avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

slipstreamclojureapi's Issues

Hardcoded ACL in CIMI async lifecycle test

The lifecycle test would fail whenever you login as a user which is not the same as the one hardcoded in example event
NB : the lifecycle test is successful if you login as super user

refactor run api for clojurescript

Refactor the run API so that it runs on ClojureScript. Also rationalize the namespaces to make the code organization of the various APIs consistent.

ensure body is included in exception message

When rethrowing an exception with data (typically an http response) ensure that both the status and body (if it exists) is included in the rethrown exception's message. This helps with tools that display the message but not the associated data.

cache credentials

Optionally cache user credentials to allow automatic re-authentication.

rethink explicit token handling

When using the API via clojurescript in the browser, the authentication cookie cannot be set or retrieved. This is a security feature of browsers and cannot be overridden.

The cookies are handled implicitly by the browser and to keep this platform-independent, this should also be the case for the clojure library (Aleph).

If the cookie handling can be made implicit on all platforms, then there will be the need for a "logout" function and probably also a "identity" resource on the server to echo the user's identity (if he has a valid cookie).

option to turn off certificate checking

Test deployments typically have self-signed certificates. To make testing more convenient, add an option to create client instances that do not check these certificates.

provide a complete set of methods to control the abort status of a run

Following @loomis's suggestion

The API should also provide a complete set of methods to control the abort status of a run. I'd suggest:

  • (abort id reason) to abort a run (with reason being optional)
  • (continue id) instead of (cancel-abort) to clear the abort flag and continue
  • (get-abort-reason id) (or message if you prefer) instead of (get-abort). This should return nil if the run is not aborted and the reason (or empty string) if it is.
  • (aborted? id) to return true/false on whether the run is aborted.

refactor and update documentation

  • create run-impl namespace and move there private functions from run
  • update public function names and parameters to stop referring to component as node
  • update documentation and the demo following the above changes

provide json representation of run

To provide a format that is easier to consume and a cushion against changes in the server format, create functions within the client API that return JSON rather than the underlying XML.

When deciding on the schema for the JSON representation, the CIMI system and machine resources should be taken into account along with feedback from PAChA based on use of the run for calculating application prices.

use json run/module lists

Update the Clojure(Script) API to use the JSON representations of the run and module resources. To simplify the API, remove the XML processing code. Also for modules, provide more information (name, description, logo, and module type) in the "child" list for projects.

Add SSE support to clojure API

Use case: a client should be able to filter run parameters (standard CIMI request) and add as an option that the server establishes an SSE session.

re-implement global library configuration via dynamic variable *config*

Requirements come from @loomis comment

Currently, the code reads the API's configuration from a file and puts the information into a global var that is read (directly or indirectly) from every function. There are two problems with this:

  • Reading from a file will not be possible when using this API from ClojureScript in a browser.
  • This does not play well with concurrency where multiple threads may want to access different servers or different runs.

Although dynamic vars are a bit discouraged at the moment, global library configuration is one place where they still make sense. I would recommend:

  • Adding a dynamic variable to the config namespace that provides the map of configuration parameters for the full API. (This should not be in the run/run-impl namespaces as this is global to the full API.)
  • The configuration map should include the SlipStream server endpoint, user credentials, and HTTP connection parameters.
  • The configuration should not include things like the run id, which are specific to a particular resource.
  • The root value for the configuration dynamic variable should only contain parameters that have a reasonable default, like whether the HTTP connections should be insecure (which should be false by default).
  • Adding utility functions which allow the root binding or a thread-local binding to be merged with additional parameters.

Many people shun dynamic variable, so you should add an optional final parameter to all calls that takes an options/configuration map that will be merged with the value of the dynamic configuration var.

The documentation for the var should include all of the keys that are used in the configuration and what the appropriate values are.

clean up dependencies and build

Clean up the dependencies for the Clojure client in preparation of splitting the API in to a core CIMI component and one for the legacy run.

The generated uberjar and RPM appear not to be used anywhere. Remove those modules from the buld.

add CRUD actions for CIMI resources

Add initial SCRUD actions for CIMI resources to the client API. To handle the search and create actions, the CloudEntryPoint must be retrieved to find the appropriate collection URL. The user should be able to specify either the Pascal or kebab case name for the collection.

update functions waiting for the run state transition

Following @loomis's suggestion

For the wait functionality, I'm wondering whether or not anyone will want to wait for anything other than the "ready" state.

  • If so, then I think that you should expose the wait-state function (probably as just wait) with a flag indicating which state to wait for.
  • If not, then just rename wait-state to wait.

The timeout should be a global option in the configuration that can be overridden through the method call. The private function should be moved to the run-impl namespace in any case.

extend signature of the functions in the API to accept run ID as the first parameter

Following @loomis's suggestion

Putting the run id into the configuration is problematic as many clients will be managing more that one run and probably from multiple threads.

I would suggest adding an explicit run id (probably named "id") to all of the functions. This would then allow a sequence of actions to be performed on a single run through the threading operator (->) and also allow the use of partial to create functions that have the run id specified as a closure.

remove test-cljs workarounds

In the latest versions of the test-cljs boot task, changes to support pass options to doo and better exit behavior on errors have been added. Upgrade to this version and remove workarounds in build.boot file.

Wrong content-type used to log in

Suggestion: use x-www-form-urlencoded as content-type in login-async function of sixsq.slipstream.client.api.authn

Remark: the current implementation works when default login url is used.

allow url to be used in add operation

Currently only the collection name tag (as a string or keyword) can be used with the add operation. This is inconvenient because the user who has navigated to the collection, only has the collection URL. Allow the URL to be used to identify the collection.

In all cases, if a collection cannot be identified, then an exception must be thrown.

Jenkins build issue because of phantomjs test

;; ======================================================================
;; Testing with Phantom:

Installing slipstream-ring-container-3.34-SNAPSHOT.jar...

Testing sixsq.slipstream.client.api.impl.run-test

Testing sixsq.slipstream.client.api.cimi-async-lifecycle-test

Testing sixsq.slipstream.client.api.utils.utils-test

Testing sixsq.slipstream.client.api.utils.http-utils-test

Testing sixsq.slipstream.client.api.cimi.utils-test

Testing sixsq.slipstream.client.api.utils.wait-test

Testing sixsq.slipstream.client.api.utils.common-test

Testing sixsq.slipstream.client.api.utils.error-test

Testing sixsq.slipstream.client.api.utils.json-test

Ran 23 tests containing 118 assertions.
0 failures, 0 errors.
TypeError: undefined is not an object (evaluating 'b.a')

phantomjs://code/phantom6484167367852844384.js:81 in onError
java.lang.Thread.run Thread.java: 748
java.util.concurrent.ThreadPoolExecutor$Worker.run ThreadPoolExecutor.java: 617
java.util.concurrent.ThreadPoolExecutor.runWorker ThreadPoolExecutor.java: 1142
java.util.concurrent.FutureTask.run FutureTask.java: 266
...
clojure.core/binding-conveyor-fn/fn core.clj: 2027
boot.core/boot/fn core.clj: 1029
boot.core/run-tasks core.clj: 1019
crisptrutski.boot-cljs-test/eval1539/fn/fn/fn boot_cljs_test.clj: 187
boot.task.built-in/fn/fn/fn/fn built_in.clj: 738
crisptrutski.boot-cljs-test/eval1575/fn/fn/fn boot_cljs_test.clj: 198
adzerk.boot-test/eval308/fn/fn/fn boot_test.clj: 105
boot.task.built-in/fn/fn/fn/fn built_in.clj: 382
adzerk.boot-test/eval373/fn/fn/fn boot_test.clj: 180
crisptrutski.boot-cljs-test/eval1351/fn/fn/fn boot_cljs_test.clj: 96
adzerk.boot-cljs/eval576/fn/fn/fn boot_cljs.clj: 137
adzerk.boot-cljs/eval633/fn/fn/fn boot_cljs.clj: 217
crisptrutski.boot-cljs-test/eval1423/fn/fn/fn boot_cljs_test.clj: 166
crisptrutski.boot-cljs-test/run-tests! boot_cljs_test.clj: 147
crisptrutski.boot-cljs-test/run-tests!/fn boot_cljs_test.clj: 122
java.lang.RuntimeException: Testing sixsq.slipstream.client.api.impl.run-testTesting sixsq.slipstream.client.api.cimi-async-lifecycle-testTesting sixsq.slipstream.client.api.utils.utils-testTesting sixsq.slipstream.client.api.utils.http-utils-testTesting sixsq.slipstream.client.api.cimi.utils-testTesting sixsq.slipstream.client.api.utils.wait-testTesting sixsq.slipstream.client.api.utils.common-testTesting sixsq.slipstream.client.api.utils.error-testTesting sixsq.slipstream.client.api.utils.json-testRan 23 tests containing 118 assertions.0 failures, 0 errors.TypeError: undefined is not an object (evaluating 'b.a') phantomjs://code/phantom6484167367852844384.js:81 in onError
clojure.lang.ExceptionInfo: Testing sixsq.slipstream.client.api.impl.run-testTesting sixsq.slipstream.client.api.cimi-async-lifecycle-testTesting sixsq.slipstream.client.api.utils.utils-testTesting sixsq.slipstream.client.api.utils.http-utils-testTesting sixsq.slipstream.client.api.cimi.utils-testTesting sixsq.slipstream.client.api.utils.wait-testTesting sixsq.slipstream.client.api.utils.common-testTesting sixsq.slipstream.client.api.utils.error-testTesting sixsq.slipstream.client.api.utils.json-testRan 23 tests containing 118 assertions.0 failures, 0 errors.TypeError: undefined is not an object (evaluating 'b.a') phantomjs://code/phantom6484167367852844384.js:81 in onError
file: "/tmp/boot.user5640306971002492609.clj"
line: 41

switch to codox

The most recent version of codox now provides a boot task. Switch to codox to avoid a problem where not all namespaces were documented in codeina and where source links couldn't be generated.

switch from clj-json to clojure.data.json

This affects the following files:

  • jar/project.clj
  • jar/resources/deps.edn
  • ./jar/src/cljc/sixsq/slipstream/client/api/impl/cimi.cljc
  • jar/src/cljc/sixsq/slipstream/client/api/impl/crud.cljc

add CRUD actions for events

Add the basic CRUD actions for the event resource to the API. Use the CloudEntryPoint to obtain the necessary resource URL.

harmonize return formats

Within the browser, the API is returning raw JSON (without keywordized keys). This is not the case in clojure. As the lookup of resource URLs relies on keywords, make sure that this is consistent on all platforms.

use sessions for authentication

Use the session resources to authenticate with a SlipStream server. This should also provide utility functions to determine if the user is logged in (i.e. sees a session when listing session resources) and to log out. As the URLs will be determined from the cloud-entry-point, the separate configuration URLs should be removed.

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.