YAML Deploy

Example: Packages with NodeJS and Python (with params, sequences)

ibmcloud fn deploy -m manifest-example-bookclub.yaml
packages:
    packageNodeJS:
        actions:
            helloNodejs-1:
                function: actions/hello.js
                runtime: nodejs:8
                inputs:
                    name:
                        type: string
                        description: name of a person
                    place:
                        type: string
                        description: location of a person
                outputs:
                    payload:
                        type: string
                        description: a simple greeting message, Hello World!
            helloNodejs-2:
                function: actions/hello.js
                runtime: nodejs:10
            helloNodejs-3:
                function: actions/hello.js
                runtime: nodejs:10
                inputs:
                    name:
                        type: string
                        description: name of a person
                    place:
                        type: string
                        description: location of a person
        sequences:
            helloworldnodejs-series:
                actions: helloNodejs-1, helloNodejs-2, helloNodejs-3 #, hellowhisk/greeting, hellowhisk/httpGet, myhelloworlds/hello-js
        triggers:
            triggerNodeJS1:
        rules:
            ruleNodeJS1:
                trigger: triggerNodeJS1
                action: helloworldnodejs-series
    packagePython:
        actions:
            helloPython-1:
                function: actions/hello.py
                runtime: python
                inputs:
                    name:
                        type: string
                        description: name of a person
                outputs:
                    payload:
                        type: string
                        description: a simple greeting message, Hello Henry!
            helloPython-2:
                function: actions/hello.py
                runtime: python
                inputs:
                    name:
                        type: string
                        description: name of a person
                outputs:
                    payload:
                        type: string
                        description: a simple greeting message, Hello Alex!
            helloPython-3:
                function: actions/hello.py
                runtime: python
        sequences:
            helloworldpython-series:
                actions: helloPython-1, helloPython-2, helloPython-3 #, hellowhisk/greeting, hellowhisk/httpGet, helloworlds/hello-js
        triggers:
            triggerPython:
        rules:
            rulePython:
                trigger: triggerPython
                action: helloworldpython-series

Example: "Book Club" APIs

ibmcloud fn deploy -m manifest-example-apis.yaml

where manifest.yaml has contents:

packages:
    api-gateway-test-with-params:
        version: 1.0
        license: Apache-2.0
        actions:
            getBooksWithISBN:
                function: src/get-books.js
            putBooksWithParams:
                function: src/put-books.js
            deleteBooksWithDuplicateParams:
                function: src/delete-books.js
        # new top-level key for defining groups of named APIs
        apis:
            book-club-with-params:
                club-with-params:
                    booksWithISBN/{isbn}:
                        getBooksWithISBN:
                            method: GET
                            response: http
                    booksWithParams/path/{params}/more/{params1}/:
                        putBooksWithParams:
                            method: PUT
                    booksWithDuplicateParams/path/{params}/more/{params}/:
                        deleteBooksWithDuplicateParams:
                            method: DELETE

Last updated

Was this helpful?