/// <summary> /// Apply or dry run an influx package /// </summary> /// <exception cref="InfluxDB.Client.Api.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="pkgApply"></param> /// <returns>ApiResponse of PkgSummary</returns> public RestRequest ApplyPkgWithRestRequest(PkgApply pkgApply) { // verify the required parameter 'pkgApply' is set if (pkgApply == null) { throw new ApiException(400, "Missing required parameter 'pkgApply' when calling InfluxPackagesService->ApplyPkg"); } var localVarPath = "/api/v2/packages/apply"; var localVarPathParams = new Dictionary <String, String>(); var localVarQueryParams = new List <KeyValuePair <String, String> >(); var localVarHeaderParams = new Dictionary <String, String>(this.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", "text/yml" }; String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); if (pkgApply != null && pkgApply.GetType() != typeof(byte[])) { localVarPostBody = this.Configuration.ApiClient.Serialize(pkgApply); // http body (model) parameter } else { localVarPostBody = pkgApply; // byte array } // to determine the Accept header String[] localVarHttpHeaderAccepts = new String[] { "application/json" }; String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); if (localVarHttpHeaderAccept != null && !localVarHeaderParams.ContainsKey("Accept")) { localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); } return(this.Configuration.ApiClient.PrepareRequest(localVarPath, Method.POST, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, localVarPathParams, localVarHttpContentType)); }
/// <summary> /// Apply or dry run an influx package /// </summary> /// <exception cref="InfluxDB.Client.Api.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="pkgApply"></param> /// <returns>Task of ApiResponse (PkgSummary)</returns> public async System.Threading.Tasks.Task <ApiResponse <PkgSummary> > ApplyPkgAsyncWithHttpInfo(PkgApply pkgApply) { // make the HTTP request IRestResponse localVarResponse = await ApplyPkgAsyncWithIRestResponse(pkgApply); int localVarStatusCode = (int)localVarResponse.StatusCode; if (ExceptionFactory != null) { Exception exception = ExceptionFactory("ApplyPkg", localVarResponse); if (exception != null) { throw exception; } } return(new ApiResponse <PkgSummary>(localVarStatusCode, localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()), (PkgSummary)this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(PkgSummary)))); }
/// <summary> /// Apply or dry run an influx package /// </summary> /// <exception cref="InfluxDB.Client.Api.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="pkgApply"></param> /// <returns>Task of PkgSummary</returns> public async System.Threading.Tasks.Task <PkgSummary> ApplyPkgAsync(PkgApply pkgApply) { ApiResponse <PkgSummary> localVarResponse = await ApplyPkgAsyncWithHttpInfo(pkgApply); return(localVarResponse.Data); }
/// <summary> /// Apply or dry run an influx package /// </summary> /// <exception cref="InfluxDB.Client.Api.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="pkgApply"></param> /// <returns>ApiResponse of PkgSummary</returns> public async System.Threading.Tasks.Task <IRestResponse> ApplyPkgWithIRestResponseAsync(PkgApply pkgApply) { // verify the required parameter 'pkgApply' is set if (pkgApply == null) { throw new ApiException(400, "Missing required parameter 'pkgApply' when calling InfluxPackagesService->ApplyPkg"); } var localVarPath = "/api/v2/packages/apply"; var localVarPathParams = new Dictionary <String, String>(); var localVarQueryParams = new List <KeyValuePair <String, String> >(); var localVarHeaderParams = new Dictionary <String, String>(this.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", "text/yml" }; String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); if (pkgApply != null && pkgApply.GetType() != typeof(byte[])) { localVarPostBody = this.Configuration.ApiClient.Serialize(pkgApply); // http body (model) parameter } else { localVarPostBody = pkgApply; // byte array } // to determine the Accept header String[] localVarHttpHeaderAccepts = new String[] { "application/json" }; String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); if (localVarHttpHeaderAccept != null && !localVarHeaderParams.ContainsKey("Accept")) { localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); } // make the HTTP request IRestResponse localVarResponse = (IRestResponse)await this.Configuration.ApiClient.CallApiAsync(localVarPath, Method.POST, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, localVarPathParams, localVarHttpContentType); int localVarStatusCode = (int)localVarResponse.StatusCode; if (ExceptionFactory != null) { Exception exception = ExceptionFactory("ApplyPkg", localVarResponse); if (exception != null) { throw exception; } } return(localVarResponse); }
/// <summary> /// Apply or dry run an influx package /// </summary> /// <exception cref="InfluxDB.Client.Api.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="pkgApply"></param> /// <returns>PkgSummary</returns> public PkgSummary ApplyPkg(PkgApply pkgApply) { ApiResponse <PkgSummary> localVarResponse = ApplyPkgWithHttpInfo(pkgApply); return(localVarResponse.Data); }