Bundled Resources

The platform6.bundledresources service manages file (CSV, Excel, WAR or JAR …) that can be included in an application.

Read the user guide of the Bundled Resources service to discover its operating mode.

List the resources identifiers

This resource returns the list of the bundled resources identifiers filtered (if it exists) by an application key.

Parameters

Headers of the request

Header’s key Description Value
platform6.request.action The action to perform (required) list.ids
appKey The application key through which the resources are filtered

Headers of the response

Header’s key Description
platform6.response.value The list of filtered identifiers

Example

If the application key is null, it will return the whole list of bundled resources.

def cm = [ headers: [ 'platform6.request.action': 'list.ids' ] ]

print p6.service.request('platform6.bundledresources', cm).headers['platform6.response.value']
[
   {
      "appKey": "ondiflo",
      "name": "Bundled resource #1"
   },
   {
      "appKey": "",
      "name": "Email template"
   }
]

If the application key is empty, it will return the Platform 6 bundled resources.

def cm = [ 
    headers: [ 
        'platform6.request.action': 'list.ids',
        'appKey': '' 
    ] 
]

print p6.service.request('platform6.bundledresources', cm).headers['platform6.response.value']
[
   {
      "appKey": "",
      "name": "Email template"
   }
]

If the application key is not empty, it will return the bundled resources associated to the application key.

def cm = [ 
    headers: [ 
        'platform6.request.action': 'list.ids',
        'appKey': 'ondiflo' 
    ] 
]

print p6.service.request('platform6.bundledresources', cm).headers['platform6.response.value']
[
   {
      "appKey": "",
      "name": "Email template"
   }
]

Get a resource’s properties

This resource returns a bundled resource’s properties.

Parameters

Headers of the request

Header’s key Description Value
platform6.request.action The action to perform (required) props
id The identifier of the resource (required)

Headers of the response

The list of the bundled resource’s properties.

Example

def cm = [ 
    headers: [ 
        'platform6.request.action': 'props',
        'id': 'Bundled resource #1' 
    ] 
]

print p6.service.request('platform6.bundledresources', cm).headers

If there are any properties, the response will be:

[ENV_NAME:dev]

If there are no properties, the response is null.

If the bundled resource doesn’t exist, it throws an error:

{
    "message" : "Unexpected exception getting the properties of a bundled resource: the bundled resource 'Bundled resource #1' is not found.",
    "stackTrace" : [
        "io.platform6.common.util.P6Exception: Unexpected exception getting the properties of a bundled resource: the bundled resource 'Bundled resource #1' is not found.",
        "    at io.platform6.core.service.applications.BundledResourcesService.notifyRequestMessage(BundledResourcesService.java:131)",
        "    at io.platform6.core.impl.servicecomponent.AbstractServiceComponent.onCommonMessage(AbstractServiceComponent.java:704)",
        "    at io.platform6.core.impl.platform.messagebus.BusQueueController$ServiceQueueRunner.run(BusQueueController.java:183)",
        "    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)",
        "    at java.util.concurrent.FutureTask.run(FutureTask.java:266)",
        "    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)",
        "    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)",
        "    at java.lang.Thread.run(Thread.java:748)"
    ]
}

Check if a resource is deployed

Check whether the resource is deployed or not.

Parameters

Headers of the request

Header’s key Description Value
platform6.request.action The action to perform (required) is.deployed
id The identifier of the resource (required)

Headers of the response

Header’s key Description
platform6.response.status boolean

Example

def cm = [ 
    headers: [ 
        'platform6.request.action': 'is.deployed',
        'id': 'Bundled resource #1' 
    ] 
]

print p6.service.request('platform6.bundledresources', cm).headers['platform6.response.status']

The response will be true if the resource is deployed, false if not.

If the bundled resource doesn’t exist, it will return false.

Deploy a resource

Deploy a bundled resource.

Parameters

Headers of the request

Header’s key Description Value
platform6.request.action The action to perform (required) deploy
id The identifier of the resource (required)

Headers of the response

Header’s key Description
platform6.response.status boolean

Example

def cm = [ 
    headers: [ 
        'platform6.request.action': 'deploy',
        'id': 'Bundled resource #1' 
    ] 
]

print p6.service.request('platform6.bundledresources', cm).headers['platform6.response.status']

The response will be true if the resource is correctly deployed, false if not.

If the bundled resource doesn’t exist, it will return false.

Undeploy a resource

Undeploy a bundled resource.

Parameters

Headers of the request

Header’s key Description Value
platform6.request.action The action to perform (required) undeploy
id The identifier of the resource (required)

Headers of the response

Header’s key Description
platform6.response.status boolean

Example

def cm = [ 
    headers: [ 
        'platform6.request.action': 'undeploy',
        'id': 'Bundled resource #1' 
    ] 
]

print p6.service.request('platform6.bundledresources', cm).headers['platform6.response.status']

The response will be true if the resource is correctly undeployed, false if not.

If the bundled resource doesn’t exist, it will return false.