Install the composer
module with npm:
$ npm -g install @ibm-functions/composer@index
Create actions named condition
, success
, and failure
as described in
bootcamp/README.md#your-first-composition.
Create a file named demo_if.js
:
import Foundation | |
// get current date as a series of integers | |
// (could be done differently...) | |
var theTime = time(nil) | |
var timeStruct = tm() | |
gmtime_r(&theTime, &timeStruct) | |
let wday = Int(timeStruct.tm_wday) | |
let mday = Int(timeStruct.tm_mday) |
extension String { | |
/// The base address of the contiguous buffer containing the String elements | |
/// if the String is backed by a contiguous buffer. | |
/// | |
/// There is no guarantee that the String is backed by a contiguous buffer. | |
/// Even if it is, there is no guarantee that the buffer is writable. | |
public var baseAddress: UnsafeRawPointer? { | |
return UnsafeRawPointer(self._core._baseAddress) | |
} |
extension String { | |
/// The base address of the contiguous buffer containing the String elements | |
/// if the String is backed by a contiguous buffer. | |
/// | |
/// There is no guarantee that the String is backed by a contiguous buffer. | |
/// Even if it is, there is no guarantee that the buffer is writable. | |
public var baseAddress: UnsafeRawPointer? { | |
return UnsafeRawPointer(self._core._baseAddress) | |
} | |
Install the composer
module with npm:
$ npm -g install @ibm-functions/composer@index
Create actions named condition
, success
, and failure
as described in
bootcamp/README.md#your-first-composition.
Create a file named demo_if.js
:
let { Bundle, ContainerizedService } = require('solsa') | |
let bundle = new Bundle() | |
bundle.service = new ContainerizedService({ | |
name: 'hello-world', | |
image: 'docker.io/ibmcom/kn-helloworld', | |
port: 8080 | |
}) | |
bundle.ingress = new bundle.service.Ingress() | |
module.exports = bundle |
apiVersion: v1 | |
kind: Service | |
metadata: | |
name: hello-world | |
spec: | |
ports: | |
- port: 8080 | |
targetPort: 8080 | |
selector: | |
solsa.ibm.com/pod: hello-world |
apiVersion: extensions/v1beta1 | |
kind: Ingress | |
metadata: | |
name: hello-world | |
spec: | |
rules: | |
- host: hello-world.mycluster-123456.us-south.containers.appdomain.cloud | |
http: | |
paths: | |
- backend: |
let { Bundle, EventStreams } = require('solsa') | |
let bundle = new Bundle() | |
bundle.kafka = new EventStreams({ name: 'kafka', plan: 'standard' }) | |
bundle.topic = new bundle.kafka.Topic({ name: 'topic', topicName: 'MyTopic' }) | |
module.exports = bundle |
apiVersion: ibmcloud.ibm.com/v1alpha1 | |
kind: Topic | |
metadata: | |
name: topic | |
spec: | |
bindingFrom: | |
name: kafka | |
topicName: MyTopic |
let { Bundle, EventStreams } = require('solsa') | |
let bundle = new Bundle() | |
bundle.kafka = new EventStreams({ name: 'kafka', plan: 'standard' }) | |
bundle.topic = new bundle.kafka.Topic({ name: 'topic', topicName: 'MyTopic' }) | |
bundle.source = new bundle.topic.Source({ name: 'source', sink: { name: 'test-sink' } }) | |
module.exports = bundle |