/// <inheritdoc /> /// <summary> /// Create a global definition Once created you can then use in a custom rule. Note that global definitions cannot be modified or deleted if in use. <br><br><b>Permissions Needed:</b> BRE_RULE_ENGINE_GLOBALS_ADMIN /// </summary> /// <param name="breGlobalResource">The BRE global resource object</param> public void CreateBREGlobal(BreGlobalResource breGlobalResource) { mWebCallEvent.WebPath = "/bre/globals/definitions"; 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(breGlobalResource); // 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 mCreateBREGlobalStartTime = DateTime.Now; mWebCallEvent.Context = mCreateBREGlobalResponseContext; mWebCallEvent.RequestType = KnetikRequestType.POST; KnetikLogger.LogRequest(mCreateBREGlobalStartTime, "CreateBREGlobal", "Sending server request..."); KnetikGlobalEventSystem.Publish(mWebCallEvent); }
private void OnUpdateBREGlobalResponse(KnetikRestResponse response) { if (!string.IsNullOrEmpty(response.Error)) { throw new KnetikException("Error calling UpdateBREGlobal: " + response.Error); } UpdateBREGlobalData = (BreGlobalResource)KnetikClient.Deserialize(response.Content, typeof(BreGlobalResource), response.Headers); KnetikLogger.LogResponse(mUpdateBREGlobalStartTime, "UpdateBREGlobal", string.Format("Response received successfully:\n{0}", UpdateBREGlobalData)); if (UpdateBREGlobalComplete != null) { UpdateBREGlobalComplete(response.ResponseCode, UpdateBREGlobalData); } }
/// <inheritdoc /> /// <summary> /// Update a global definition May fail if new parameters mismatch requirements of existing rules. Cannot update core globals. <br><br><b>Permissions Needed:</b> BRE_RULE_ENGINE_GLOBALS_ADMIN /// </summary> /// <param name="id">The id of the global definition</param> /// <param name="breGlobalResource">The BRE global resource object</param> public void UpdateBREGlobal(string id, BreGlobalResource breGlobalResource) { // verify the required parameter 'id' is set if (id == null) { throw new KnetikException(400, "Missing required parameter 'id' when calling UpdateBREGlobal"); } mWebCallEvent.WebPath = "/bre/globals/definitions/{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(breGlobalResource); // 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 mUpdateBREGlobalStartTime = DateTime.Now; mWebCallEvent.Context = mUpdateBREGlobalResponseContext; mWebCallEvent.RequestType = KnetikRequestType.PUT; KnetikLogger.LogRequest(mUpdateBREGlobalStartTime, "UpdateBREGlobal", "Sending server request..."); KnetikGlobalEventSystem.Publish(mWebCallEvent); }
/// <summary> /// Update a global definition May fail if new parameters mismatch requirements of existing rules. Cannot update core globals. <br><br><b>Permissions Needed:</b> BRE_RULE_ENGINE_GLOBALS_ADMIN /// </summary> /// <exception cref="com.knetikcloud.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="id">The id of the global definition</param> /// <param name="breGlobalResource">The BRE global resource object (optional)</param> /// <returns>ApiResponse of BreGlobalResource</returns> public ApiResponse <BreGlobalResource> UpdateBREGlobalWithHttpInfo(string id, BreGlobalResource breGlobalResource = null) { // verify the required parameter 'id' is set if (id == null) { throw new ApiException(400, "Missing required parameter 'id' when calling Rule_Engine_GlobalsApi->UpdateBREGlobal"); } var localVarPath = "/bre/globals/definitions/{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 (breGlobalResource != null && breGlobalResource.GetType() != typeof(byte[])) { localVarPostBody = Configuration.ApiClient.Serialize(breGlobalResource); // http body (model) parameter } else { localVarPostBody = breGlobalResource; // 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("UpdateBREGlobal", localVarResponse); if (exception != null) { throw exception; } } return(new ApiResponse <BreGlobalResource>(localVarStatusCode, localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()), (BreGlobalResource)Configuration.ApiClient.Deserialize(localVarResponse, typeof(BreGlobalResource)))); }
/// <summary> /// Update a global definition May fail if new parameters mismatch requirements of existing rules. Cannot update core globals. <br><br><b>Permissions Needed:</b> BRE_RULE_ENGINE_GLOBALS_ADMIN /// </summary> /// <exception cref="com.knetikcloud.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="id">The id of the global definition</param> /// <param name="breGlobalResource">The BRE global resource object (optional)</param> /// <returns>BreGlobalResource</returns> public BreGlobalResource UpdateBREGlobal(string id, BreGlobalResource breGlobalResource = null) { ApiResponse <BreGlobalResource> localVarResponse = UpdateBREGlobalWithHttpInfo(id, breGlobalResource); return(localVarResponse.Data); }
/// <summary> /// Create a global definition Once created you can then use in a custom rule. Note that global definitions cannot be modified or deleted if in use. <br><br><b>Permissions Needed:</b> BRE_RULE_ENGINE_GLOBALS_ADMIN /// </summary> /// <exception cref="com.knetikcloud.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="breGlobalResource">The BRE global resource object (optional)</param> /// <returns>BreGlobalResource</returns> public BreGlobalResource CreateBREGlobal(BreGlobalResource breGlobalResource = null) { ApiResponse <BreGlobalResource> localVarResponse = CreateBREGlobalWithHttpInfo(breGlobalResource); return(localVarResponse.Data); }