/// <inheritdoc /> /// <summary> /// Create a rule Rules define which actions to run when a given event verifies the specified condition. Full list of predicates and other type of expressions can be found at GET /bre/expressions/. <br><br><b>Permissions Needed:</b> BRE_RULE_ENGINE_RULES_ADMIN /// </summary> /// <param name="breRule">The BRE rule object</param> public void CreateBRERule(BreRule breRule) { mWebCallEvent.WebPath = "/bre/rules"; if (!string.IsNullOrEmpty(mWebCallEvent.WebPath)) { mWebCallEvent.WebPath = mWebCallEvent.WebPath.Replace("{format}", "json"); } mWebCallEvent.HeaderParams.Clear(); mWebCallEvent.QueryParams.Clear(); mWebCallEvent.AuthSettings.Clear(); mWebCallEvent.PostBody = null; mWebCallEvent.PostBody = KnetikClient.Serialize(breRule); // http body (model) parameter // authentication settings mWebCallEvent.AuthSettings.Add("oauth2_client_credentials_grant"); // authentication settings mWebCallEvent.AuthSettings.Add("oauth2_password_grant"); // make the HTTP request mCreateBRERuleStartTime = DateTime.Now; mWebCallEvent.Context = mCreateBRERuleResponseContext; mWebCallEvent.RequestType = KnetikRequestType.POST; KnetikLogger.LogRequest(mCreateBRERuleStartTime, "CreateBRERule", "Sending server request..."); KnetikGlobalEventSystem.Publish(mWebCallEvent); }
private void OnUpdateBRERuleResponse(KnetikRestResponse response) { if (!string.IsNullOrEmpty(response.Error)) { throw new KnetikException("Error calling UpdateBRERule: " + response.Error); } UpdateBRERuleData = (BreRule)KnetikClient.Deserialize(response.Content, typeof(BreRule), response.Headers); KnetikLogger.LogResponse(mUpdateBRERuleStartTime, "UpdateBRERule", string.Format("Response received successfully:\n{0}", UpdateBRERuleData)); if (UpdateBRERuleComplete != null) { UpdateBRERuleComplete(response.ResponseCode, UpdateBRERuleData); } }
/// <inheritdoc /> /// <summary> /// Update a rule Cannot update system rules. <br><br><b>Permissions Needed:</b> BRE_RULE_ENGINE_RULES_ADMIN /// </summary> /// <param name="id">The id of the rule</param> /// <param name="breRule">The BRE rule object</param> public void UpdateBRERule(string id, BreRule breRule) { // verify the required parameter 'id' is set if (id == null) { throw new KnetikException(400, "Missing required parameter 'id' when calling UpdateBRERule"); } mWebCallEvent.WebPath = "/bre/rules/{id}"; if (!string.IsNullOrEmpty(mWebCallEvent.WebPath)) { mWebCallEvent.WebPath = mWebCallEvent.WebPath.Replace("{format}", "json"); } mWebCallEvent.WebPath = mWebCallEvent.WebPath.Replace("{" + "id" + "}", KnetikClient.ParameterToString(id)); mWebCallEvent.HeaderParams.Clear(); mWebCallEvent.QueryParams.Clear(); mWebCallEvent.AuthSettings.Clear(); mWebCallEvent.PostBody = null; mWebCallEvent.PostBody = KnetikClient.Serialize(breRule); // http body (model) parameter // authentication settings mWebCallEvent.AuthSettings.Add("oauth2_client_credentials_grant"); // authentication settings mWebCallEvent.AuthSettings.Add("oauth2_password_grant"); // make the HTTP request mUpdateBRERuleStartTime = DateTime.Now; mWebCallEvent.Context = mUpdateBRERuleResponseContext; mWebCallEvent.RequestType = KnetikRequestType.PUT; KnetikLogger.LogRequest(mUpdateBRERuleStartTime, "UpdateBRERule", "Sending server request..."); KnetikGlobalEventSystem.Publish(mWebCallEvent); }
/// <summary> /// Update a rule Cannot update system rules. <br><br><b>Permissions Needed:</b> BRE_RULE_ENGINE_RULES_ADMIN /// </summary> /// <exception cref="com.knetikcloud.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="id">The id of the rule</param> /// <param name="breRule">The BRE rule object (optional)</param> /// <returns>ApiResponse of BreRule</returns> public ApiResponse <BreRule> UpdateBRERuleWithHttpInfo(string id, BreRule breRule = null) { // verify the required parameter 'id' is set if (id == null) { throw new ApiException(400, "Missing required parameter 'id' when calling Rule_Engine_RulesApi->UpdateBRERule"); } var localVarPath = "/bre/rules/{id}"; var localVarPathParams = new Dictionary <String, String>(); var localVarQueryParams = new List <KeyValuePair <String, String> >(); var localVarHeaderParams = new Dictionary <String, String>(Configuration.DefaultHeader); var localVarFormParams = new Dictionary <String, String>(); var localVarFileParams = new Dictionary <String, FileParameter>(); Object localVarPostBody = null; // to determine the Content-Type header String[] localVarHttpContentTypes = new String[] { "application/json" }; String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); // to determine the Accept header String[] localVarHttpHeaderAccepts = new String[] { "application/json" }; String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); if (localVarHttpHeaderAccept != null) { localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); } if (id != null) { localVarPathParams.Add("id", Configuration.ApiClient.ParameterToString(id)); // path parameter } if (breRule != null && breRule.GetType() != typeof(byte[])) { localVarPostBody = Configuration.ApiClient.Serialize(breRule); // http body (model) parameter } else { localVarPostBody = breRule; // byte array } // authentication (oauth2_client_credentials_grant) required // oauth required if (!String.IsNullOrEmpty(Configuration.AccessToken)) { localVarHeaderParams["Authorization"] = "Bearer " + Configuration.AccessToken; } // authentication (oauth2_password_grant) required // oauth required if (!String.IsNullOrEmpty(Configuration.AccessToken)) { localVarHeaderParams["Authorization"] = "Bearer " + Configuration.AccessToken; } // make the HTTP request IRestResponse localVarResponse = (IRestResponse)Configuration.ApiClient.CallApi(localVarPath, Method.PUT, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, localVarPathParams, localVarHttpContentType); int localVarStatusCode = (int)localVarResponse.StatusCode; if (ExceptionFactory != null) { Exception exception = ExceptionFactory("UpdateBRERule", localVarResponse); if (exception != null) { throw exception; } } return(new ApiResponse <BreRule>(localVarStatusCode, localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()), (BreRule)Configuration.ApiClient.Deserialize(localVarResponse, typeof(BreRule)))); }
/// <summary> /// Update a rule Cannot update system rules. <br><br><b>Permissions Needed:</b> BRE_RULE_ENGINE_RULES_ADMIN /// </summary> /// <exception cref="com.knetikcloud.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="id">The id of the rule</param> /// <param name="breRule">The BRE rule object (optional)</param> /// <returns>BreRule</returns> public BreRule UpdateBRERule(string id, BreRule breRule = null) { ApiResponse <BreRule> localVarResponse = UpdateBRERuleWithHttpInfo(id, breRule); return(localVarResponse.Data); }
/// <summary> /// Create a rule Rules define which actions to run when a given event verifies the specified condition. Full list of predicates and other type of expressions can be found at GET /bre/expressions/. <br><br><b>Permissions Needed:</b> BRE_RULE_ENGINE_RULES_ADMIN /// </summary> /// <exception cref="com.knetikcloud.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="breRule">The BRE rule object (optional)</param> /// <returns>BreRule</returns> public BreRule CreateBRERule(BreRule breRule = null) { ApiResponse <BreRule> localVarResponse = CreateBRERuleWithHttpInfo(breRule); return(localVarResponse.Data); }