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

org.projectodd.openwhisk.api.TriggersApi 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.ActionPut;
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 org.projectodd.openwhisk.model.Trigger;
import org.projectodd.openwhisk.model.TriggerPut;

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


public class TriggersApi {
  private ApiClient apiClient;

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

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

  public ApiClient getApiClient() {
    return apiClient;
  }

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

  /**
   * Delete a trigger
   * Delete a trigger
   * @param namespace The entity namespace (required)
   * @param triggerName Name of trigger to delete (required)
   * @throws ApiException if fails to make API call
   */
  public void deleteTrigger(String namespace, String triggerName) 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 deleteTrigger");
    }
    
    // verify the required parameter 'triggerName' is set
    if (triggerName == null) {
      throw new ApiException(400, "Missing the required parameter 'triggerName' when calling deleteTrigger");
    }
    
    // create path and map variables
    String localVarPath = "/namespaces/{namespace}/triggers/{triggerName}"
      .replaceAll("\\{" + "namespace" + "\\}", apiClient.escapeString(namespace.toString()))
      .replaceAll("\\{" + "triggerName" + "\\}", apiClient.escapeString(triggerName.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);
  }
  /**
   * Fire a trigger
   * Fire a trigger
   * @param namespace The entity namespace (required)
   * @param triggerName Name of trigger being fired (required)
   * @param payload The trigger payload (required)
   * @return ItemId
   * @throws ApiException if fails to make API call
   */
  public ItemId fireTrigger(String namespace, String triggerName, KeyValue payload) 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 fireTrigger");
    }
    
    // verify the required parameter 'triggerName' is set
    if (triggerName == null) {
      throw new ApiException(400, "Missing the required parameter 'triggerName' when calling fireTrigger");
    }
    
    // verify the required parameter 'payload' is set
    if (payload == null) {
      throw new ApiException(400, "Missing the required parameter 'payload' when calling fireTrigger");
    }
    
    // create path and map variables
    String localVarPath = "/namespaces/{namespace}/triggers/{triggerName}"
      .replaceAll("\\{" + "namespace" + "\\}", apiClient.escapeString(namespace.toString()))
      .replaceAll("\\{" + "triggerName" + "\\}", apiClient.escapeString(triggerName.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[] {  };

    GenericType localVarReturnType = new GenericType() {};
    return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
      }
  /**
   * Get all triggers
   * Get all triggers
   * @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 getAllTriggers(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 getAllTriggers");
    }
    
    // create path and map variables
    String localVarPath = "/namespaces/{namespace}/triggers"
      .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);
      }
  /**
   * Get trigger information
   * Get trigger information
   * @param namespace The entity namespace (required)
   * @param triggerName Name of trigger to fetch (required)
   * @return Trigger
   * @throws ApiException if fails to make API call
   */
  public Trigger getTriggerByName(String namespace, String triggerName) 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 getTriggerByName");
    }
    
    // verify the required parameter 'triggerName' is set
    if (triggerName == null) {
      throw new ApiException(400, "Missing the required parameter 'triggerName' when calling getTriggerByName");
    }
    
    // create path and map variables
    String localVarPath = "/namespaces/{namespace}/triggers/{triggerName}"
      .replaceAll("\\{" + "namespace" + "\\}", apiClient.escapeString(namespace.toString()))
      .replaceAll("\\{" + "triggerName" + "\\}", apiClient.escapeString(triggerName.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[] {  };

    GenericType localVarReturnType = new GenericType() {};
    return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
      }
  /**
   * Update a trigger
   * Update a trigger
   * @param namespace The entity namespace (required)
   * @param triggerName Name of trigger to update (required)
   * @param trigger The trigger 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 updateTrigger(String namespace, String triggerName, TriggerPut trigger, Boolean overwrite) throws ApiException {
    Object localVarPostBody = trigger;
    
    // verify the required parameter 'namespace' is set
    if (namespace == null) {
      throw new ApiException(400, "Missing the required parameter 'namespace' when calling updateTrigger");
    }
    
    // verify the required parameter 'triggerName' is set
    if (triggerName == null) {
      throw new ApiException(400, "Missing the required parameter 'triggerName' when calling updateTrigger");
    }
    
    // verify the required parameter 'trigger' is set
    if (trigger == null) {
      throw new ApiException(400, "Missing the required parameter 'trigger' when calling updateTrigger");
    }
    
    // create path and map variables
    String localVarPath = "/namespaces/{namespace}/triggers/{triggerName}"
      .replaceAll("\\{" + "namespace" + "\\}", apiClient.escapeString(namespace.toString()))
      .replaceAll("\\{" + "triggerName" + "\\}", apiClient.escapeString(triggerName.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