pub struct OpenwhiskClient<T> {
    pub context: Context,
    pub client: T,
    /* private fields */
}
Expand description

Representation of Openwhisk Client

Fields

context: Context

Openwhisk client context (Properties set for the openwhisk)

client: T

Client represents the http client (OpenwhiskClient takes generic type for http client)

Implementations

To set Openwhisk config for library to interact with Openwhisk API’s

Arguments
  • config - Can be None or Openwhisk Properties defined by User when None is supplied poperties are set by environment
Example
use openwhisk_rust::{NativeClient, OpenwhiskClient, WskProperties};
// setting openwhisk props with user Input
let new_wsk_props = WskProperties::new(
        "your:auth_token".to_string(),
        "host".to_string(),
        true,
        "namespace".to_string()
 );

// creating new client from using the propety

let client = OpenwhiskClient::<NativeClient>::new(Some(&new_wsk_props));
// use initilalised client to interact with openwhisk API

To Access action endpoints from the Openwhisk Client using this method

Returns ActionService

This can be used to call underlying action service methods

  • list - Lists all the actions in the namesapce
Example
use openwhisk_rust::{NativeClient, OpenwhiskClient, WskProperties};
// setting openwhisk props with user Input
let new_wsk_props = WskProperties::new(
        "your:auth_token".to_string(),
        "host".to_string(),
        true,
        "namespace".to_string()
 );

// creating new client from using the propety

let client = OpenwhiskClient::<NativeClient>::new(Some(&new_wsk_props));
// use initilalised client to interact with openwhisk API

// Lists the actions deployed in the openwhisk
let actions = client.actions().list().unwrap();
  • get - Get the action property based on the action name provided as paramter
Example
use openwhisk_rust::{NativeClient, OpenwhiskClient, WskProperties};
// setting openwhisk props with user Input
let new_wsk_props = WskProperties::new(
        "your:auth_token".to_string(),
        "host".to_string(),
        true,
        "namespace".to_string()
 );

// creating new client from using the propety

let client = OpenwhiskClient::<NativeClient>::new(Some(&new_wsk_props));
// use initilalised client to interact with openwhisk API

// get the action properties which is deployed in the openwhisk
let action_property = client.actions().get("action_name").unwrap();
  • delete - Delete action based on the action name
Example
use openwhisk_rust::{NativeClient, OpenwhiskClient, WskProperties};
// setting openwhisk props with user Input
let new_wsk_props = WskProperties::new(
        "your:auth_token".to_string(),
        "host".to_string(),
        true,
        "namespace".to_string()
 );

// creating new client from using the propety

let client = OpenwhiskClient::<NativeClient>::new(Some(&new_wsk_props));
// use initilalised client to interact with openwhisk API

// deletes the action  which is deployed in the openwhisk
let action = client.actions().delete("action_name").unwrap();
  • insert - Insert action and returns new action created
Example
use openwhisk_rust::{NativeClient, OpenwhiskClient, WskProperties};
// setting openwhisk props with user Input
let new_wsk_props = WskProperties::new(
        "your:auth_token".to_string(),
        "host".to_string(),
        true,
        "namespace".to_string()
 );

// creating new client from using the propety

let client = OpenwhiskClient::<NativeClient>::new(Some(&new_wsk_props));
// use initilalised client to interact with openwhisk API

// insert the action and deploys in the openwhisk
let action = client.actions().insert(action,true,true).unwrap();
  • invoke - Invoke action based on the action name and payload for the actions
Example
use openwhisk_rust::{NativeClient, OpenwhiskClient, WskProperties};
// setting openwhisk props with user Input
let new_wsk_props = WskProperties::new(
        "your:auth_token".to_string(),
        "host".to_string(),
        true,
        "namespace".to_string()
 );

// creating new client from using the propety

let client = OpenwhiskClient::<NativeClient>::new(Some(&new_wsk_props));
// use initilalised client to interact with openwhisk API

// invoke the action deployed in the openwhisk
let action_result = client.actions().invoke("action_name","action_payload",true,true).unwrap();

To Access trigger endpoints from the Openwhisk Client using this method

Returns TriggerService This can be used to call underlying action service methods

  • list - Lists all the triggers in the namesapce
Example
use openwhisk_rust::{NativeClient, OpenwhiskClient, WskProperties};
// setting openwhisk props with user Input
let new_wsk_props = WskProperties::new(
        "your:auth_token".to_string(),
        "host".to_string(),
        true,
        "namespace".to_string()
 );

// creating new client from using the propety

let client = OpenwhiskClient::<NativeClient>::new(Some(&new_wsk_props));
// use initilalised client to interact with openwhisk API

// Lists the triggers deployed in the openwhisk
let triggers = client.triggers().list().unwrap();
  • get - Get the trigger property based on the trigger name provided as paramter
Example
use openwhisk_rust::{NativeClient, OpenwhiskClient, WskProperties};
// setting openwhisk props with user Input
let new_wsk_props = WskProperties::new(
        "your:auth_token".to_string(),
        "host".to_string(),
        true,
        "namespace".to_string()
 );

// creating new client from using the propety

let client = OpenwhiskClient::<NativeClient>::new(Some(&new_wsk_props));
// use initilalised client to interact with openwhisk API

// get the trigger properties which is deployed in the openwhisk
let trigger_property = client.triggers().get("trigger_name").unwrap();
  • delete - Delete trigger based on the trigger name
Example
use openwhisk_rust::{NativeClient, OpenwhiskClient, WskProperties};
// setting openwhisk props with user Input
let new_wsk_props = WskProperties::new(
        "your:auth_token".to_string(),
        "host".to_string(),
        true,
        "namespace".to_string()
 );

// creating new client from using the propety

let client = OpenwhiskClient::<NativeClient>::new(Some(&new_wsk_props));
// use initilalised client to interact with openwhisk API

// deletes the trigger  which is deployed in the openwhisk
let trigger = client.triggers().delete("trigger_name").unwrap();
  • insert - Insert trigger and returns new trigger created
Example
use openwhisk_rust::{NativeClient, OpenwhiskClient, WskProperties};
// setting openwhisk props with user Input
let new_wsk_props = WskProperties::new(
        "your:auth_token".to_string(),
        "host".to_string(),
        true,
        "namespace".to_string()
 );

// creating new client from using the propety

let client = OpenwhiskClient::<NativeClient>::new(Some(&new_wsk_props));
// use initilalised client to interact with openwhisk API

// insert the trigger and deploys in the openwhisk
let trigger = client.triggers().insert(trigger,true).unwrap();
  • fire - Fires a trigger to an action
Example
use openwhisk_rust::{NativeClient, OpenwhiskClient, WskProperties};
// setting openwhisk props with user Input
let new_wsk_props = WskProperties::new(
        "your:auth_token".to_string(),
        "host".to_string(),
        true,
        "namespace".to_string()
 );

// creating new client from using the propety

let client = OpenwhiskClient::<NativeClient>::new(Some(&new_wsk_props));
// use initilalised client to interact with openwhisk API

// Fires a trigger to an action
let trigger = client.actions().fire("trigger_name",value).unwrap();

To Access action endpoints from the Openwhisk Client using this method

Returns RuleService This can be used to call underlying action service methods

  • list - Lists all the rules in the namesapce
Example
use openwhisk_rust::{NativeClient, OpenwhiskClient, WskProperties};
// setting openwhisk props with user Input
let new_wsk_props = WskProperties::new(
        "your:auth_token".to_string(),
        "host".to_string(),
        true,
        "namespace".to_string()
 );

// creating new client from using the propety

let client = OpenwhiskClient::<NativeClient>::new(Some(&new_wsk_props));
// use initilalised client to interact with openwhisk API

// Lists the rules deployed in the openwhisk
let rules = client.rules().list().unwrap();
  • get - Get the rule property based on the rule name provided as paramter
Example
use openwhisk_rust::{NativeClient, OpenwhiskClient, WskProperties};
// setting openwhisk props with user Input
let new_wsk_props = WskProperties::new(
        "your:auth_token".to_string(),
        "host".to_string(),
        true,
        "namespace".to_string()
 );

// creating new client from using the propety

let client = OpenwhiskClient::<NativeClient>::new(Some(&new_wsk_props));
// use initilalised client to interact with openwhisk API

// get the rule properties which is deployed in the openwhisk
let rule_property = client.rules().get("rule_name").unwrap();
  • delete - Delete rule based on the rule name
Example
use openwhisk_rust::{NativeClient, OpenwhiskClient, WskProperties};
// setting openwhisk props with user Input
let new_wsk_props = WskProperties::new(
        "your:auth_token".to_string(),
        "host".to_string(),
        true,
        "namespace".to_string()
 );

// creating new client from using the propety

let client = OpenwhiskClient::<NativeClient>::new(Some(&new_wsk_props));
// use initilalised client to interact with openwhisk API

// deletes the rule  which is deployed in the openwhisk
let rule = client.rules().delete("rule_name").unwrap();
  • setstate - Sets the state of the rule
Example
use openwhisk_rust::{NativeClient, OpenwhiskClient, WskProperties};
// setting openwhisk props with user Input
let new_wsk_props = WskProperties::new(
        "your:auth_token".to_string(),
        "host".to_string(),
        true,
        "namespace".to_string()
 );

// creating new client from using the propety

let client = OpenwhiskClient::<NativeClient>::new(Some(&new_wsk_props));
// use initilalised client to interact with openwhisk API

// set state for the rule deployed in the openwhisk
let rule = client.rules().setstate("rule_name","state").unwrap();

To Access namespace endpoints from the Openwhisk Client using this method

Returns NamespaceService

This can be used to call underlying action service methods

  • list - Lists all the actions in the namesapce
Example
use openwhisk_rust::{NativeClient, OpenwhiskClient, WskProperties};
// setting openwhisk props with user Input
let new_wsk_props = WskProperties::new(
        "your:auth_token".to_string(),
        "host".to_string(),
        true,
        "namespace".to_string()
 );

// creating new client from using the propety

let client = OpenwhiskClient::<NativeClient>::new(Some(&new_wsk_props));
// use initilalised client to interact with openwhisk API

// Lists the namespaces available in the openwhisk
let namespaces = client.namespaces().list().unwrap();

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more