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

org.projectodd.openwhisk.api.RulesApi 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.Rule;
import org.projectodd.openwhisk.model.RulePut;

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


public class RulesApi {
  private ApiClient apiClient;

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

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

  public ApiClient getApiClient() {
    return apiClient;
  }

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

  /**
   * Delete a rule
   * Delete a rule
   * @param namespace The entity namespace (required)
   * @param ruleName Name of rule to delete (required)
   * @throws ApiException if fails to make API call
   */
  public void deleteRule(String namespace, String ruleName) 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 deleteRule");
    }
    
    // verify the required parameter 'ruleName' is set
    if (ruleName == null) {
      throw new ApiException(400, "Missing the required parameter 'ruleName' when calling deleteRule");
    }
    
    // create path and map variables
    String localVarPath = "/namespaces/{namespace}/rules/{ruleName}"
      .replaceAll("\\{" + "namespace" + "\\}", apiClient.escapeString(namespace.toString()))
      .replaceAll("\\{" + "ruleName" + "\\}", apiClient.escapeString(ruleName.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 all rules
   * Get all rules
   * @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 getAllRules(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 getAllRules");
    }
    
    // create path and map variables
    String localVarPath = "/namespaces/{namespace}/rules"
      .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 rule information
   * Get rule information
   * @param namespace The entity namespace (required)
   * @param ruleName Name of rule to fetch (required)
   * @return Rule
   * @throws ApiException if fails to make API call
   */
  public Rule getRuleByName(String namespace, String ruleName) 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 getRuleByName");
    }
    
    // verify the required parameter 'ruleName' is set
    if (ruleName == null) {
      throw new ApiException(400, "Missing the required parameter 'ruleName' when calling getRuleByName");
    }
    
    // create path and map variables
    String localVarPath = "/namespaces/{namespace}/rules/{ruleName}"
      .replaceAll("\\{" + "namespace" + "\\}", apiClient.escapeString(namespace.toString()))
      .replaceAll("\\{" + "ruleName" + "\\}", apiClient.escapeString(ruleName.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);
      }
  /**
   * Enable or disable a rule
   * Enable or disable a rule
   * @param namespace The entity namespace (required)
   * @param ruleName Name of rule to update (required)
   * @param state Set state to enable or disable (required)
   * @return ActionPut
   * @throws ApiException if fails to make API call
   */
  public ActionPut setState(String namespace, String ruleName, String state) 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 setState");
    }
    
    // verify the required parameter 'ruleName' is set
    if (ruleName == null) {
      throw new ApiException(400, "Missing the required parameter 'ruleName' when calling setState");
    }
    
    // verify the required parameter 'state' is set
    if (state == null) {
      throw new ApiException(400, "Missing the required parameter 'state' when calling setState");
    }
    
    // create path and map variables
    String localVarPath = "/namespaces/{namespace}/rules/{ruleName}"
      .replaceAll("\\{" + "namespace" + "\\}", apiClient.escapeString(namespace.toString()))
      .replaceAll("\\{" + "ruleName" + "\\}", apiClient.escapeString(ruleName.toString()));

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

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

    
    
    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);
      }
  /**
   * Update a rule
   * Update a rule
   * @param namespace The entity namespace (required)
   * @param ruleName Name of rule to update (required)
   * @param rule The rule 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 updateRule(String namespace, String ruleName, RulePut rule, Boolean overwrite) throws ApiException {
    Object localVarPostBody = rule;
    
    // verify the required parameter 'namespace' is set
    if (namespace == null) {
      throw new ApiException(400, "Missing the required parameter 'namespace' when calling updateRule");
    }
    
    // verify the required parameter 'ruleName' is set
    if (ruleName == null) {
      throw new ApiException(400, "Missing the required parameter 'ruleName' when calling updateRule");
    }
    
    // verify the required parameter 'rule' is set
    if (rule == null) {
      throw new ApiException(400, "Missing the required parameter 'rule' when calling updateRule");
    }
    
    // create path and map variables
    String localVarPath = "/namespaces/{namespace}/rules/{ruleName}"
      .replaceAll("\\{" + "namespace" + "\\}", apiClient.escapeString(namespace.toString()))
      .replaceAll("\\{" + "ruleName" + "\\}", apiClient.escapeString(ruleName.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 - 2025 Weber Informatics LLC | Privacy Policy