All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.projectodd.openwhisk.api.ActionsApi Maven / Gradle / Ivy

There is a newer version: 0.8
Show newest version
package org.projectodd.openwhisk.api;

import org.projectodd.openwhisk.invoker.ApiException;
import org.projectodd.openwhisk.invoker.ApiClient;
import org.projectodd.openwhisk.invoker.Configuration;
import org.projectodd.openwhisk.invoker.Pair;

import javax.ws.rs.core.GenericType;

import org.projectodd.openwhisk.model.Action;
import org.projectodd.openwhisk.model.ActionPut;
import org.projectodd.openwhisk.model.Activation;
import org.projectodd.openwhisk.model.EntityBrief;
import org.projectodd.openwhisk.model.ErrorMessage;
import org.projectodd.openwhisk.model.ItemId;
import org.projectodd.openwhisk.model.KeyValue;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;


public class ActionsApi {
  private ApiClient apiClient;

  public ActionsApi() {
    this(Configuration.getDefaultApiClient());
  }

  public ActionsApi(ApiClient apiClient) {
    this.apiClient = apiClient;
  }

  public ApiClient getApiClient() {
    return apiClient;
  }

  public void setApiClient(ApiClient apiClient) {
    this.apiClient = apiClient;
  }

  /**
   * Delete an action
   * Delete an action
   * @param namespace The entity namespace (required)
   * @param actionName Name of action (required)
   * @throws ApiException if fails to make API call
   */
  public void deleteAction(String namespace, String actionName) throws ApiException {
    Object localVarPostBody = null;
    
    // verify the required parameter 'namespace' is set
    if (namespace == null) {
      throw new ApiException(400, "Missing the required parameter 'namespace' when calling deleteAction");
    }
    
    // verify the required parameter 'actionName' is set
    if (actionName == null) {
      throw new ApiException(400, "Missing the required parameter 'actionName' when calling deleteAction");
    }
    
    // create path and map variables
    String localVarPath = "/namespaces/{namespace}/actions/{actionName}"
      .replaceAll("\\{" + "namespace" + "\\}", apiClient.escapeString(namespace.toString()))
      .replaceAll("\\{" + "actionName" + "\\}", apiClient.escapeString(actionName.toString()));

    // query params
    List localVarQueryParams = new ArrayList();
    Map localVarHeaderParams = new HashMap();
    Map localVarFormParams = new HashMap();


    
    
    final String[] localVarAccepts = {
      "application/json"
    };
    final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);

    final String[] localVarContentTypes = {
      
    };
    final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);

    String[] localVarAuthNames = new String[] {  };


    apiClient.invokeAPI(localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null);
  }
  /**
   * Get action information
   * Get action information.
   * @param namespace The entity namespace (required)
   * @param actionName Name of action to fetch (required)
   * @param code Include action code in the result (optional)
   * @return Action
   * @throws ApiException if fails to make API call
   */
  public Action getActionByName(String namespace, String actionName, Boolean code) throws ApiException {
    Object localVarPostBody = null;
    
    // verify the required parameter 'namespace' is set
    if (namespace == null) {
      throw new ApiException(400, "Missing the required parameter 'namespace' when calling getActionByName");
    }
    
    // verify the required parameter 'actionName' is set
    if (actionName == null) {
      throw new ApiException(400, "Missing the required parameter 'actionName' when calling getActionByName");
    }
    
    // create path and map variables
    String localVarPath = "/namespaces/{namespace}/actions/{actionName}"
      .replaceAll("\\{" + "namespace" + "\\}", apiClient.escapeString(namespace.toString()))
      .replaceAll("\\{" + "actionName" + "\\}", apiClient.escapeString(actionName.toString()));

    // query params
    List localVarQueryParams = new ArrayList();
    Map localVarHeaderParams = new HashMap();
    Map localVarFormParams = new HashMap();

    localVarQueryParams.addAll(apiClient.parameterToPairs("", "code", code));

    
    
    final String[] localVarAccepts = {
      "application/json"
    };
    final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);

    final String[] localVarContentTypes = {
      
    };
    final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);

    String[] localVarAuthNames = new String[] {  };

    GenericType localVarReturnType = new GenericType() {};
    return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
      }
  /**
   * Get all actions
   * Get all actions
   * @param namespace The entity namespace (required)
   * @param limit Number of entities to include in the result (0-200). The default limit is 30. A value of 0 sets the limit to the maximum. (optional)
   * @param skip Number of entities to skip in the result. (optional)
   * @return List<EntityBrief>
   * @throws ApiException if fails to make API call
   */
  public List getAllActions(String namespace, Integer limit, Integer skip) throws ApiException {
    Object localVarPostBody = null;
    
    // verify the required parameter 'namespace' is set
    if (namespace == null) {
      throw new ApiException(400, "Missing the required parameter 'namespace' when calling getAllActions");
    }
    
    // create path and map variables
    String localVarPath = "/namespaces/{namespace}/actions"
      .replaceAll("\\{" + "namespace" + "\\}", apiClient.escapeString(namespace.toString()));

    // query params
    List localVarQueryParams = new ArrayList();
    Map localVarHeaderParams = new HashMap();
    Map localVarFormParams = new HashMap();

    localVarQueryParams.addAll(apiClient.parameterToPairs("", "limit", limit));
    localVarQueryParams.addAll(apiClient.parameterToPairs("", "skip", skip));

    
    
    final String[] localVarAccepts = {
      "application/json"
    };
    final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);

    final String[] localVarContentTypes = {
      
    };
    final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);

    String[] localVarAuthNames = new String[] {  };

    GenericType> localVarReturnType = new GenericType>() {};
    return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
      }
  /**
   * Invoke an action
   * Invoke an action
   * @param namespace The entity namespace (required)
   * @param actionName Name of action (required)
   * @param payload The parameters for the action being invoked (required)
   * @param blocking Blocking or non-blocking invocation. Default is non-blocking. (optional)
   * @param result Return only the result of a blocking activation. Default is false. (optional)
   * @param timeout Wait no more than specified duration in milliseconds for a blocking response. Default value and max allowed timeout are 60000. (optional)
   * @return Activation
   * @throws ApiException if fails to make API call
   */
  public Activation invokeAction(String namespace, String actionName, KeyValue payload, Boolean blocking, Boolean result, Integer timeout) throws ApiException {
    Object localVarPostBody = payload;
    
    // verify the required parameter 'namespace' is set
    if (namespace == null) {
      throw new ApiException(400, "Missing the required parameter 'namespace' when calling invokeAction");
    }
    
    // verify the required parameter 'actionName' is set
    if (actionName == null) {
      throw new ApiException(400, "Missing the required parameter 'actionName' when calling invokeAction");
    }
    
    // verify the required parameter 'payload' is set
    if (payload == null) {
      throw new ApiException(400, "Missing the required parameter 'payload' when calling invokeAction");
    }
    
    // create path and map variables
    String localVarPath = "/namespaces/{namespace}/actions/{actionName}"
      .replaceAll("\\{" + "namespace" + "\\}", apiClient.escapeString(namespace.toString()))
      .replaceAll("\\{" + "actionName" + "\\}", apiClient.escapeString(actionName.toString()));

    // query params
    List localVarQueryParams = new ArrayList();
    Map localVarHeaderParams = new HashMap();
    Map localVarFormParams = new HashMap();

    localVarQueryParams.addAll(apiClient.parameterToPairs("", "blocking", blocking));
    localVarQueryParams.addAll(apiClient.parameterToPairs("", "result", result));
    localVarQueryParams.addAll(apiClient.parameterToPairs("", "timeout", timeout));

    
    
    final String[] localVarAccepts = {
      "application/json"
    };
    final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);

    final String[] localVarContentTypes = {
      
    };
    final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);

    String[] localVarAuthNames = new String[] {  };

    GenericType localVarReturnType = new GenericType() {};
    return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
      }
  /**
   * Create or update an action
   * Create or update an action
   * @param namespace The entity namespace (required)
   * @param actionName Name of action (required)
   * @param action The action being updated (required)
   * @param overwrite Overwrite item if it exists. Default is false. (optional)
   * @return ActionPut
   * @throws ApiException if fails to make API call
   */
  public ActionPut updateAction(String namespace, String actionName, ActionPut action, Boolean overwrite) throws ApiException {
    Object localVarPostBody = action;
    
    // verify the required parameter 'namespace' is set
    if (namespace == null) {
      throw new ApiException(400, "Missing the required parameter 'namespace' when calling updateAction");
    }
    
    // verify the required parameter 'actionName' is set
    if (actionName == null) {
      throw new ApiException(400, "Missing the required parameter 'actionName' when calling updateAction");
    }
    
    // verify the required parameter 'action' is set
    if (action == null) {
      throw new ApiException(400, "Missing the required parameter 'action' when calling updateAction");
    }
    
    // create path and map variables
    String localVarPath = "/namespaces/{namespace}/actions/{actionName}"
      .replaceAll("\\{" + "namespace" + "\\}", apiClient.escapeString(namespace.toString()))
      .replaceAll("\\{" + "actionName" + "\\}", apiClient.escapeString(actionName.toString()));

    // query params
    List localVarQueryParams = new ArrayList();
    Map localVarHeaderParams = new HashMap();
    Map localVarFormParams = new HashMap();

    localVarQueryParams.addAll(apiClient.parameterToPairs("", "overwrite", overwrite));

    
    
    final String[] localVarAccepts = {
      "application/json"
    };
    final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);

    final String[] localVarContentTypes = {
      "application/json"
    };
    final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);

    String[] localVarAuthNames = new String[] {  };

    GenericType localVarReturnType = new GenericType() {};
    return apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
      }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy