diff --git a/edgefunctions/.openapi-generator/VERSION b/edgefunctions/.openapi-generator/VERSION
index cd802a1..73a86b1 100644
--- a/edgefunctions/.openapi-generator/VERSION
+++ b/edgefunctions/.openapi-generator/VERSION
@@ -1 +1 @@
-6.6.0
\ No newline at end of file
+7.0.1
\ No newline at end of file
diff --git a/edgefunctions/README.md b/edgefunctions/README.md
index b17925b..4681d0a 100644
--- a/edgefunctions/README.md
+++ b/edgefunctions/README.md
@@ -6,13 +6,10 @@ This C# SDK is automatically generated by the [OpenAPI Generator](https://openap
- API version: 2.0.0
- SDK version: 1.0.0
-- Build package: org.openapitools.codegen.languages.CSharpNetCoreClientCodegen
+- Build package: org.openapitools.codegen.languages.CSharpClientCodegen
## Frameworks supported
-- .NET Core >=1.0
-- .NET Framework >=4.6
-- Mono/Xamarin >=vNext
## Dependencies
@@ -35,7 +32,9 @@ NOTE: RestSharp for .Net Core creates a new socket for each api call, which can
## Installation
-Generate the DLL using your preferred tool (e.g. `dotnet build`)
+Run the following command to generate the DLL
+- [Mac/Linux] `/bin/sh build.sh`
+- [Windows] `build.bat`
Then include the DLL (under the `bin` folder) in the C# project, and use the namespaces:
```csharp
@@ -43,6 +42,19 @@ using edgefunctions.Api;
using edgefunctions.Client;
using edgefunctions.Model;
```
+
+## Packaging
+
+A `.nuspec` is included with the project. You can follow the Nuget quickstart to [create](https://docs.microsoft.com/en-us/nuget/quickstart/create-and-publish-a-package#create-the-package) and [publish](https://docs.microsoft.com/en-us/nuget/quickstart/create-and-publish-a-package#publish-the-package) packages.
+
+This `.nuspec` uses placeholders from the `.csproj`, so build the `.csproj` directly:
+
+```
+nuget pack -Build -OutputDirectory out edgefunctions.csproj
+```
+
+Then, publish to a [local feed](https://docs.microsoft.com/en-us/nuget/hosting-packages/local-feeds) or [other host](https://docs.microsoft.com/en-us/nuget/hosting-packages/overview) and consume the new package via Nuget as usual.
+
## Usage
@@ -81,8 +93,8 @@ namespace Example
var apiInstance = new EdgeFunctionsApi(config);
var page = 789L; // long? | (optional)
var pageSize = 789L; // long? | (optional)
- var sort = "sort_example"; // string | (optional)
- var orderBy = "orderBy_example"; // string | (optional)
+ var sort = "sort_example"; // string? | (optional)
+ var orderBy = "orderBy_example"; // string? | (optional)
try
{
diff --git a/edgefunctions/api/openapi.yaml b/edgefunctions/api/openapi.yaml
index 53c35be..42e3e1c 100644
--- a/edgefunctions/api/openapi.yaml
+++ b/edgefunctions/api/openapi.yaml
@@ -468,6 +468,7 @@ components:
active: true
language: language
json_args: ""
+ initiator_type: edge_application
properties:
name:
type: string
@@ -476,6 +477,11 @@ components:
code:
type: string
json_args: {}
+ initiator_type:
+ enum:
+ - edge_application
+ - edge_firewall
+ type: string
active:
type: boolean
is_proprietary_code:
@@ -528,7 +534,7 @@ components:
active: true
json_args: ""
language: language
- initiator_type: initiator_type
+ initiator_type: edge_application
properties:
name:
type: string
@@ -538,6 +544,9 @@ components:
active:
type: boolean
initiator_type:
+ enum:
+ - edge_application
+ - edge_firewall
type: string
language:
type: string
diff --git a/edgefunctions/docs/CreateEdgeFunctionRequest.md b/edgefunctions/docs/CreateEdgeFunctionRequest.md
index e7facbe..efb2560 100644
--- a/edgefunctions/docs/CreateEdgeFunctionRequest.md
+++ b/edgefunctions/docs/CreateEdgeFunctionRequest.md
@@ -8,6 +8,7 @@ Name | Type | Description | Notes
**Language** | **string** | | [optional]
**Code** | **string** | | [optional]
**JsonArgs** | **Object** | | [optional]
+**InitiatorType** | **string** | | [optional]
**Active** | **bool** | | [optional]
**IsProprietaryCode** | **bool** | | [optional]
diff --git a/edgefunctions/docs/EdgeFunctionsApi.md b/edgefunctions/docs/EdgeFunctionsApi.md
index f955279..6dd647a 100644
--- a/edgefunctions/docs/EdgeFunctionsApi.md
+++ b/edgefunctions/docs/EdgeFunctionsApi.md
@@ -13,7 +13,7 @@ All URIs are relative to *https://api.azionapi.net*
# **EdgeFunctionsGet**
-> ListEdgeFunctionResponse EdgeFunctionsGet (long? page = null, long? pageSize = null, string sort = null, string orderBy = null)
+> ListEdgeFunctionResponse EdgeFunctionsGet (long? page = null, long? pageSize = null, string? sort = null, string? orderBy = null)
edge_functions
@@ -41,8 +41,8 @@ namespace Example
var apiInstance = new EdgeFunctionsApi(config);
var page = 789L; // long? | (optional)
var pageSize = 789L; // long? | (optional)
- var sort = "sort_example"; // string | (optional)
- var orderBy = "orderBy_example"; // string | (optional)
+ var sort = "sort_example"; // string? | (optional)
+ var orderBy = "orderBy_example"; // string? | (optional)
try
{
@@ -87,8 +87,8 @@ catch (ApiException e)
|------|------|-------------|-------|
| **page** | **long?** | | [optional] |
| **pageSize** | **long?** | | [optional] |
-| **sort** | **string** | | [optional] |
-| **orderBy** | **string** | | [optional] |
+| **sort** | **string?** | | [optional] |
+| **orderBy** | **string?** | | [optional] |
### Return type
diff --git a/edgefunctions/edgefunctions.sln b/edgefunctions/edgefunctions.sln
index 4cf38ab..14e3633 100644
--- a/edgefunctions/edgefunctions.sln
+++ b/edgefunctions/edgefunctions.sln
@@ -1,8 +1,8 @@
Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio 14
-VisualStudioVersion = 14.0.25420.1
-MinimumVisualStudioVersion = 10.0.40219.1
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "edgefunctions", "src\edgefunctions\edgefunctions.csproj", "{1A2F6C53-4B1E-4B05-A9A2-422892AC1371}"
+# Visual Studio 2012
+VisualStudioVersion = 12.0.0.0
+MinimumVisualStudioVersion = 10.0.0.1
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "edgefunctions", "src\edgefunctions\edgefunctions.csproj", "{03079AAC-1685-454B-9EAA-F806D4ED754B}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "edgefunctions.Test", "src\edgefunctions.Test\edgefunctions.Test.csproj", "{19F1DEBC-DE5E-4517-8062-F000CD499087}"
EndProject
@@ -12,10 +12,10 @@ Global
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {1A2F6C53-4B1E-4B05-A9A2-422892AC1371}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {1A2F6C53-4B1E-4B05-A9A2-422892AC1371}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {1A2F6C53-4B1E-4B05-A9A2-422892AC1371}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {1A2F6C53-4B1E-4B05-A9A2-422892AC1371}.Release|Any CPU.Build.0 = Release|Any CPU
+ {03079AAC-1685-454B-9EAA-F806D4ED754B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {03079AAC-1685-454B-9EAA-F806D4ED754B}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {03079AAC-1685-454B-9EAA-F806D4ED754B}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {03079AAC-1685-454B-9EAA-F806D4ED754B}.Release|Any CPU.Build.0 = Release|Any CPU
{19F1DEBC-DE5E-4517-8062-F000CD499087}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{19F1DEBC-DE5E-4517-8062-F000CD499087}.Debug|Any CPU.Build.0 = Debug|Any CPU
{19F1DEBC-DE5E-4517-8062-F000CD499087}.Release|Any CPU.ActiveCfg = Release|Any CPU
diff --git a/edgefunctions/src/edgefunctions.Test/edgefunctions.Test.csproj b/edgefunctions/src/edgefunctions.Test/edgefunctions.Test.csproj
index 5188ec6..12d5bc4 100644
--- a/edgefunctions/src/edgefunctions.Test/edgefunctions.Test.csproj
+++ b/edgefunctions/src/edgefunctions.Test/edgefunctions.Test.csproj
@@ -3,14 +3,15 @@
edgefunctions.Test
edgefunctions.Test
- netcoreapp3.1
+ net7.0
false
+ annotations
-
-
-
+
+
+
diff --git a/edgefunctions/src/edgefunctions/Api/EdgeFunctionsApi.cs b/edgefunctions/src/edgefunctions/Api/EdgeFunctionsApi.cs
index b9cedad..e0877cc 100644
--- a/edgefunctions/src/edgefunctions/Api/EdgeFunctionsApi.cs
+++ b/edgefunctions/src/edgefunctions/Api/EdgeFunctionsApi.cs
@@ -36,7 +36,7 @@ public interface IEdgeFunctionsApiSync : IApiAccessor
/// (optional)
/// Index associated with the operation.
/// ListEdgeFunctionResponse
- ListEdgeFunctionResponse EdgeFunctionsGet(long? page = default(long?), long? pageSize = default(long?), string sort = default(string), string orderBy = default(string), int operationIndex = 0);
+ ListEdgeFunctionResponse EdgeFunctionsGet(long? page = default(long?), long? pageSize = default(long?), string? sort = default(string?), string? orderBy = default(string?), int operationIndex = 0);
///
/// edge_functions
@@ -51,7 +51,7 @@ public interface IEdgeFunctionsApiSync : IApiAccessor
/// (optional)
/// Index associated with the operation.
/// ApiResponse of ListEdgeFunctionResponse
- ApiResponse EdgeFunctionsGetWithHttpInfo(long? page = default(long?), long? pageSize = default(long?), string sort = default(string), string orderBy = default(string), int operationIndex = 0);
+ ApiResponse EdgeFunctionsGetWithHttpInfo(long? page = default(long?), long? pageSize = default(long?), string? sort = default(string?), string? orderBy = default(string?), int operationIndex = 0);
///
/// edge_functions
///
@@ -179,7 +179,7 @@ public interface IEdgeFunctionsApiAsync : IApiAccessor
/// Index associated with the operation.
/// Cancellation Token to cancel the request.
/// Task of ListEdgeFunctionResponse
- System.Threading.Tasks.Task EdgeFunctionsGetAsync(long? page = default(long?), long? pageSize = default(long?), string sort = default(string), string orderBy = default(string), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
+ System.Threading.Tasks.Task EdgeFunctionsGetAsync(long? page = default(long?), long? pageSize = default(long?), string? sort = default(string?), string? orderBy = default(string?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
///
/// edge_functions
@@ -195,7 +195,7 @@ public interface IEdgeFunctionsApiAsync : IApiAccessor
/// Index associated with the operation.
/// Cancellation Token to cancel the request.
/// Task of ApiResponse (ListEdgeFunctionResponse)
- System.Threading.Tasks.Task> EdgeFunctionsGetWithHttpInfoAsync(long? page = default(long?), long? pageSize = default(long?), string sort = default(string), string orderBy = default(string), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
+ System.Threading.Tasks.Task> EdgeFunctionsGetWithHttpInfoAsync(long? page = default(long?), long? pageSize = default(long?), string? sort = default(string?), string? orderBy = default(string?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
///
/// edge_functions
///
@@ -455,7 +455,7 @@ public edgefunctions.Client.ExceptionFactory ExceptionFactory
/// (optional)
/// Index associated with the operation.
/// ListEdgeFunctionResponse
- public ListEdgeFunctionResponse EdgeFunctionsGet(long? page = default(long?), long? pageSize = default(long?), string sort = default(string), string orderBy = default(string), int operationIndex = 0)
+ public ListEdgeFunctionResponse EdgeFunctionsGet(long? page = default(long?), long? pageSize = default(long?), string? sort = default(string?), string? orderBy = default(string?), int operationIndex = 0)
{
edgefunctions.Client.ApiResponse localVarResponse = EdgeFunctionsGetWithHttpInfo(page, pageSize, sort, orderBy);
return localVarResponse.Data;
@@ -471,7 +471,7 @@ public edgefunctions.Client.ExceptionFactory ExceptionFactory
/// (optional)
/// Index associated with the operation.
/// ApiResponse of ListEdgeFunctionResponse
- public edgefunctions.Client.ApiResponse EdgeFunctionsGetWithHttpInfo(long? page = default(long?), long? pageSize = default(long?), string sort = default(string), string orderBy = default(string), int operationIndex = 0)
+ public edgefunctions.Client.ApiResponse EdgeFunctionsGetWithHttpInfo(long? page = default(long?), long? pageSize = default(long?), string? sort = default(string?), string? orderBy = default(string?), int operationIndex = 0)
{
edgefunctions.Client.RequestOptions localVarRequestOptions = new edgefunctions.Client.RequestOptions();
@@ -547,7 +547,7 @@ public edgefunctions.Client.ExceptionFactory ExceptionFactory
/// Index associated with the operation.
/// Cancellation Token to cancel the request.
/// Task of ListEdgeFunctionResponse
- public async System.Threading.Tasks.Task EdgeFunctionsGetAsync(long? page = default(long?), long? pageSize = default(long?), string sort = default(string), string orderBy = default(string), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
+ public async System.Threading.Tasks.Task EdgeFunctionsGetAsync(long? page = default(long?), long? pageSize = default(long?), string? sort = default(string?), string? orderBy = default(string?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
{
edgefunctions.Client.ApiResponse localVarResponse = await EdgeFunctionsGetWithHttpInfoAsync(page, pageSize, sort, orderBy, operationIndex, cancellationToken).ConfigureAwait(false);
return localVarResponse.Data;
@@ -564,7 +564,7 @@ public edgefunctions.Client.ExceptionFactory ExceptionFactory
/// Index associated with the operation.
/// Cancellation Token to cancel the request.
/// Task of ApiResponse (ListEdgeFunctionResponse)
- public async System.Threading.Tasks.Task> EdgeFunctionsGetWithHttpInfoAsync(long? page = default(long?), long? pageSize = default(long?), string sort = default(string), string orderBy = default(string), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
+ public async System.Threading.Tasks.Task> EdgeFunctionsGetWithHttpInfoAsync(long? page = default(long?), long? pageSize = default(long?), string? sort = default(string?), string? orderBy = default(string?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
{
edgefunctions.Client.RequestOptions localVarRequestOptions = new edgefunctions.Client.RequestOptions();
diff --git a/edgefunctions/src/edgefunctions/Client/ApiClient.cs b/edgefunctions/src/edgefunctions/Client/ApiClient.cs
index 0853c4a..c81efb6 100644
--- a/edgefunctions/src/edgefunctions/Client/ApiClient.cs
+++ b/edgefunctions/src/edgefunctions/Client/ApiClient.cs
@@ -22,6 +22,7 @@
using System.Threading;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
+using System.Web;
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;
using RestSharp;
@@ -37,7 +38,6 @@ namespace edgefunctions.Client
internal class CustomJsonCodec : IRestSerializer, ISerializer, IDeserializer
{
private readonly IReadableConfiguration _configuration;
- private static readonly string _contentType = "application/json";
private readonly JsonSerializerSettings _serializerSettings = new JsonSerializerSettings
{
// OpenAPI generated types generally hide default constructors.
@@ -150,17 +150,13 @@ internal object Deserialize(RestResponse response, Type type)
public ISerializer Serializer => this;
public IDeserializer Deserializer => this;
- public string[] AcceptedContentTypes => RestSharp.Serializers.ContentType.JsonAccept;
+ public string[] AcceptedContentTypes => RestSharp.ContentType.JsonAccept;
public SupportsContentType SupportsContentType => contentType =>
- contentType.EndsWith("json", StringComparison.InvariantCultureIgnoreCase) ||
- contentType.EndsWith("javascript", StringComparison.InvariantCultureIgnoreCase);
+ contentType.Value.EndsWith("json", StringComparison.InvariantCultureIgnoreCase) ||
+ contentType.Value.EndsWith("javascript", StringComparison.InvariantCultureIgnoreCase);
- public string ContentType
- {
- get { return _contentType; }
- set { throw new InvalidOperationException("Not allowed to set content type."); }
- }
+ public ContentType ContentType { get; set; } = RestSharp.ContentType.Json;
public DataFormat DataFormat => DataFormat.Json;
}
@@ -433,7 +429,7 @@ private ApiResponse ToApiResponse(RestResponse response)
return transformed;
}
- private ApiResponse Exec(RestRequest req, RequestOptions options, IReadableConfiguration configuration)
+ private ApiResponse Exec(RestRequest request, RequestOptions options, IReadableConfiguration configuration)
{
var baseUrl = configuration.GetOperationServerUrl(options.Operation, options.OperationIndex) ?? _baseUrl;
@@ -453,93 +449,95 @@ private ApiResponse Exec(RestRequest req, RequestOptions options, IReadabl
CookieContainer = cookies,
MaxTimeout = configuration.Timeout,
Proxy = configuration.Proxy,
- UserAgent = configuration.UserAgent
+ UserAgent = configuration.UserAgent,
+ UseDefaultCredentials = configuration.UseDefaultCredentials,
+ RemoteCertificateValidationCallback = configuration.RemoteCertificateValidationCallback
};
- RestClient client = new RestClient(clientOptions)
- .UseSerializer(() => new CustomJsonCodec(SerializerSettings, configuration));
-
- InterceptRequest(req);
-
- RestResponse response;
- if (RetryConfiguration.RetryPolicy != null)
+ using (RestClient client = new RestClient(clientOptions,
+ configureSerialization: serializerConfig => serializerConfig.UseSerializer(() => new CustomJsonCodec(SerializerSettings, configuration))))
{
- var policy = RetryConfiguration.RetryPolicy;
- var policyResult = policy.ExecuteAndCapture(() => client.Execute(req));
- response = (policyResult.Outcome == OutcomeType.Successful) ? client.Deserialize(policyResult.Result) : new RestResponse
+ InterceptRequest(request);
+
+ RestResponse response;
+ if (RetryConfiguration.RetryPolicy != null)
{
- Request = req,
- ErrorException = policyResult.FinalException
- };
- }
- else
- {
- response = client.Execute(req);
- }
+ var policy = RetryConfiguration.RetryPolicy;
+ var policyResult = policy.ExecuteAndCapture(() => client.Execute(request));
+ response = (policyResult.Outcome == OutcomeType.Successful) ? client.Deserialize(policyResult.Result) : new RestResponse(request)
+ {
+ ErrorException = policyResult.FinalException
+ };
+ }
+ else
+ {
+ response = client.Execute(request);
+ }
- // if the response type is oneOf/anyOf, call FromJSON to deserialize the data
- if (typeof(edgefunctions.Model.AbstractOpenAPISchema).IsAssignableFrom(typeof(T)))
- {
- try
+ // if the response type is oneOf/anyOf, call FromJSON to deserialize the data
+ if (typeof(edgefunctions.Model.AbstractOpenAPISchema).IsAssignableFrom(typeof(T)))
{
- response.Data = (T) typeof(T).GetMethod("FromJson").Invoke(null, new object[] { response.Content });
+ try
+ {
+ response.Data = (T) typeof(T).GetMethod("FromJson").Invoke(null, new object[] { response.Content });
+ }
+ catch (Exception ex)
+ {
+ throw ex.InnerException != null ? ex.InnerException : ex;
+ }
}
- catch (Exception ex)
+ else if (typeof(T).Name == "Stream") // for binary response
{
- throw ex.InnerException != null ? ex.InnerException : ex;
+ response.Data = (T)(object)new MemoryStream(response.RawBytes);
+ }
+ else if (typeof(T).Name == "Byte[]") // for byte response
+ {
+ response.Data = (T)(object)response.RawBytes;
+ }
+ else if (typeof(T).Name == "String") // for string response
+ {
+ response.Data = (T)(object)response.Content;
}
- }
- else if (typeof(T).Name == "Stream") // for binary response
- {
- response.Data = (T)(object)new MemoryStream(response.RawBytes);
- }
- else if (typeof(T).Name == "Byte[]") // for byte response
- {
- response.Data = (T)(object)response.RawBytes;
- }
- else if (typeof(T).Name == "String") // for string response
- {
- response.Data = (T)(object)response.Content;
- }
- InterceptResponse(req, response);
+ InterceptResponse(request, response);
- var result = ToApiResponse(response);
- if (response.ErrorMessage != null)
- {
- result.ErrorText = response.ErrorMessage;
- }
+ var result = ToApiResponse(response);
+ if (response.ErrorMessage != null)
+ {
+ result.ErrorText = response.ErrorMessage;
+ }
- if (response.Cookies != null && response.Cookies.Count > 0)
- {
- if (result.Cookies == null) result.Cookies = new List();
- foreach (var restResponseCookie in response.Cookies.Cast())
+ if (response.Cookies != null && response.Cookies.Count > 0)
{
- var cookie = new Cookie(
- restResponseCookie.Name,
- restResponseCookie.Value,
- restResponseCookie.Path,
- restResponseCookie.Domain
- )
+ if (result.Cookies == null) result.Cookies = new List();
+ foreach (var restResponseCookie in response.Cookies.Cast())
{
- Comment = restResponseCookie.Comment,
- CommentUri = restResponseCookie.CommentUri,
- Discard = restResponseCookie.Discard,
- Expired = restResponseCookie.Expired,
- Expires = restResponseCookie.Expires,
- HttpOnly = restResponseCookie.HttpOnly,
- Port = restResponseCookie.Port,
- Secure = restResponseCookie.Secure,
- Version = restResponseCookie.Version
- };
-
- result.Cookies.Add(cookie);
+ var cookie = new Cookie(
+ restResponseCookie.Name,
+ restResponseCookie.Value,
+ restResponseCookie.Path,
+ restResponseCookie.Domain
+ )
+ {
+ Comment = restResponseCookie.Comment,
+ CommentUri = restResponseCookie.CommentUri,
+ Discard = restResponseCookie.Discard,
+ Expired = restResponseCookie.Expired,
+ Expires = restResponseCookie.Expires,
+ HttpOnly = restResponseCookie.HttpOnly,
+ Port = restResponseCookie.Port,
+ Secure = restResponseCookie.Secure,
+ Version = restResponseCookie.Version
+ };
+
+ result.Cookies.Add(cookie);
+ }
}
+ return result;
}
- return result;
}
- private async Task> ExecAsync(RestRequest req, RequestOptions options, IReadableConfiguration configuration, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
+ private async Task> ExecAsync(RestRequest request, RequestOptions options, IReadableConfiguration configuration, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
{
var baseUrl = configuration.GetOperationServerUrl(options.Operation, options.OperationIndex) ?? _baseUrl;
@@ -548,79 +546,80 @@ private ApiResponse Exec(RestRequest req, RequestOptions options, IReadabl
ClientCertificates = configuration.ClientCertificates,
MaxTimeout = configuration.Timeout,
Proxy = configuration.Proxy,
- UserAgent = configuration.UserAgent
+ UserAgent = configuration.UserAgent,
+ UseDefaultCredentials = configuration.UseDefaultCredentials
};
- RestClient client = new RestClient(clientOptions)
- .UseSerializer(() => new CustomJsonCodec(SerializerSettings, configuration));
-
- InterceptRequest(req);
-
- RestResponse response;
- if (RetryConfiguration.AsyncRetryPolicy != null)
+ using (RestClient client = new RestClient(clientOptions,
+ configureSerialization: serializerConfig => serializerConfig.UseSerializer(() => new CustomJsonCodec(SerializerSettings, configuration))))
{
- var policy = RetryConfiguration.AsyncRetryPolicy;
- var policyResult = await policy.ExecuteAndCaptureAsync((ct) => client.ExecuteAsync(req, ct), cancellationToken).ConfigureAwait(false);
- response = (policyResult.Outcome == OutcomeType.Successful) ? client.Deserialize(policyResult.Result) : new RestResponse
+ InterceptRequest(request);
+
+ RestResponse response;
+ if (RetryConfiguration.AsyncRetryPolicy != null)
{
- Request = req,
- ErrorException = policyResult.FinalException
- };
- }
- else
- {
- response = await client.ExecuteAsync(req, cancellationToken).ConfigureAwait(false);
- }
+ var policy = RetryConfiguration.AsyncRetryPolicy;
+ var policyResult = await policy.ExecuteAndCaptureAsync((ct) => client.ExecuteAsync(request, ct), cancellationToken).ConfigureAwait(false);
+ response = (policyResult.Outcome == OutcomeType.Successful) ? client.Deserialize(policyResult.Result) : new RestResponse(request)
+ {
+ ErrorException = policyResult.FinalException
+ };
+ }
+ else
+ {
+ response = await client.ExecuteAsync(request, cancellationToken).ConfigureAwait(false);
+ }
- // if the response type is oneOf/anyOf, call FromJSON to deserialize the data
- if (typeof(edgefunctions.Model.AbstractOpenAPISchema).IsAssignableFrom(typeof(T)))
- {
- response.Data = (T) typeof(T).GetMethod("FromJson").Invoke(null, new object[] { response.Content });
- }
- else if (typeof(T).Name == "Stream") // for binary response
- {
- response.Data = (T)(object)new MemoryStream(response.RawBytes);
- }
- else if (typeof(T).Name == "Byte[]") // for byte response
- {
- response.Data = (T)(object)response.RawBytes;
- }
+ // if the response type is oneOf/anyOf, call FromJSON to deserialize the data
+ if (typeof(edgefunctions.Model.AbstractOpenAPISchema).IsAssignableFrom(typeof(T)))
+ {
+ response.Data = (T) typeof(T).GetMethod("FromJson").Invoke(null, new object[] { response.Content });
+ }
+ else if (typeof(T).Name == "Stream") // for binary response
+ {
+ response.Data = (T)(object)new MemoryStream(response.RawBytes);
+ }
+ else if (typeof(T).Name == "Byte[]") // for byte response
+ {
+ response.Data = (T)(object)response.RawBytes;
+ }
- InterceptResponse(req, response);
+ InterceptResponse(request, response);
- var result = ToApiResponse(response);
- if (response.ErrorMessage != null)
- {
- result.ErrorText = response.ErrorMessage;
- }
+ var result = ToApiResponse(response);
+ if (response.ErrorMessage != null)
+ {
+ result.ErrorText = response.ErrorMessage;
+ }
- if (response.Cookies != null && response.Cookies.Count > 0)
- {
- if (result.Cookies == null) result.Cookies = new List();
- foreach (var restResponseCookie in response.Cookies.Cast())
+ if (response.Cookies != null && response.Cookies.Count > 0)
{
- var cookie = new Cookie(
- restResponseCookie.Name,
- restResponseCookie.Value,
- restResponseCookie.Path,
- restResponseCookie.Domain
- )
+ if (result.Cookies == null) result.Cookies = new List();
+ foreach (var restResponseCookie in response.Cookies.Cast())
{
- Comment = restResponseCookie.Comment,
- CommentUri = restResponseCookie.CommentUri,
- Discard = restResponseCookie.Discard,
- Expired = restResponseCookie.Expired,
- Expires = restResponseCookie.Expires,
- HttpOnly = restResponseCookie.HttpOnly,
- Port = restResponseCookie.Port,
- Secure = restResponseCookie.Secure,
- Version = restResponseCookie.Version
- };
-
- result.Cookies.Add(cookie);
+ var cookie = new Cookie(
+ restResponseCookie.Name,
+ restResponseCookie.Value,
+ restResponseCookie.Path,
+ restResponseCookie.Domain
+ )
+ {
+ Comment = restResponseCookie.Comment,
+ CommentUri = restResponseCookie.CommentUri,
+ Discard = restResponseCookie.Discard,
+ Expired = restResponseCookie.Expired,
+ Expires = restResponseCookie.Expires,
+ HttpOnly = restResponseCookie.HttpOnly,
+ Port = restResponseCookie.Port,
+ Secure = restResponseCookie.Secure,
+ Version = restResponseCookie.Version
+ };
+
+ result.Cookies.Add(cookie);
+ }
}
+ return result;
}
- return result;
}
#region IAsynchronousClient
diff --git a/edgefunctions/src/edgefunctions/Client/Configuration.cs b/edgefunctions/src/edgefunctions/Client/Configuration.cs
index 3bf8387..a7acf09 100644
--- a/edgefunctions/src/edgefunctions/Client/Configuration.cs
+++ b/edgefunctions/src/edgefunctions/Client/Configuration.cs
@@ -18,6 +18,7 @@
using System.Security.Cryptography.X509Certificates;
using System.Text;
using System.Net.Http;
+using System.Net.Security;
namespace edgefunctions.Client
{
@@ -57,6 +58,11 @@ public class Configuration : IReadableConfiguration
string.Format("Error calling {0}: {1}", methodName, response.RawContent),
response.RawContent, response.Headers);
}
+ if (status == 0)
+ {
+ return new ApiException(status,
+ string.Format("Error calling {0}: {1}", methodName, response.ErrorText), response.ErrorText);
+ }
return null;
};
@@ -70,6 +76,8 @@ public class Configuration : IReadableConfiguration
///
private string _basePath;
+ private bool _useDefaultCredentials = false;
+
///
/// Gets or sets the API key based on the authentication name.
/// This is the key and value comprising the "secret" for accessing an API.
@@ -175,11 +183,21 @@ public Configuration(
///
/// Gets or sets the base path for API access.
///
- public virtual string BasePath {
+ public virtual string BasePath
+ {
get { return _basePath; }
set { _basePath = value; }
}
+ ///
+ /// Determine whether or not the "default credentials" (e.g. the user account under which the current process is running) will be sent along to the server. The default is false.
+ ///
+ public virtual bool UseDefaultCredentials
+ {
+ get { return _useDefaultCredentials; }
+ set { _useDefaultCredentials = value; }
+ }
+
///
/// Gets or sets the default header.
///
@@ -444,7 +462,7 @@ public string GetOperationServerUrl(string operation, int index)
/// The operation server URL.
public string GetOperationServerUrl(string operation, int index, Dictionary inputVariables)
{
- if (OperationServers.TryGetValue(operation, out var operationServer))
+ if (operation != null && OperationServers.TryGetValue(operation, out var operationServer))
{
return GetServerUrl(operationServer, index, inputVariables);
}
@@ -503,6 +521,11 @@ private string GetServerUrl(IList> servers,
return url;
}
+
+ ///
+ /// Gets and Sets the RemoteCertificateValidationCallback
+ ///
+ public RemoteCertificateValidationCallback RemoteCertificateValidationCallback { get; set; }
#endregion Properties
@@ -579,6 +602,8 @@ public static IReadableConfiguration MergeConfigurations(IReadableConfiguration
TempFolderPath = second.TempFolderPath ?? first.TempFolderPath,
DateTimeFormat = second.DateTimeFormat ?? first.DateTimeFormat,
ClientCertificates = second.ClientCertificates ?? first.ClientCertificates,
+ UseDefaultCredentials = second.UseDefaultCredentials,
+ RemoteCertificateValidationCallback = second.RemoteCertificateValidationCallback ?? first.RemoteCertificateValidationCallback,
};
return config;
}
diff --git a/edgefunctions/src/edgefunctions/Client/IReadableConfiguration.cs b/edgefunctions/src/edgefunctions/Client/IReadableConfiguration.cs
index a3154a2..6aea278 100644
--- a/edgefunctions/src/edgefunctions/Client/IReadableConfiguration.cs
+++ b/edgefunctions/src/edgefunctions/Client/IReadableConfiguration.cs
@@ -11,6 +11,7 @@
using System;
using System.Collections.Generic;
using System.Net;
+using System.Net.Security;
using System.Security.Cryptography.X509Certificates;
namespace edgefunctions.Client
@@ -99,6 +100,11 @@ public interface IReadableConfiguration
/// Password.
string Password { get; }
+ ///
+ /// Determine whether or not the "default credentials" (e.g. the user account under which the current process is running) will be sent along to the server. The default is false.
+ ///
+ bool UseDefaultCredentials { get; }
+
///
/// Get the servers associated with the operation.
///
@@ -125,5 +131,11 @@ public interface IReadableConfiguration
///
/// X509 Certificate collection.
X509CertificateCollection ClientCertificates { get; }
+
+ ///
+ /// Callback function for handling the validation of remote certificates. Useful for certificate pinning and
+ /// overriding certificate errors in the scope of a request.
+ ///
+ RemoteCertificateValidationCallback RemoteCertificateValidationCallback { get; }
}
}
diff --git a/edgefunctions/src/edgefunctions/Model/CreateEdgeFunctionRequest.cs b/edgefunctions/src/edgefunctions/Model/CreateEdgeFunctionRequest.cs
index e053773..e004afd 100644
--- a/edgefunctions/src/edgefunctions/Model/CreateEdgeFunctionRequest.cs
+++ b/edgefunctions/src/edgefunctions/Model/CreateEdgeFunctionRequest.cs
@@ -31,6 +31,31 @@ namespace edgefunctions.Model
[DataContract(Name = "CreateEdgeFunctionRequest")]
public partial class CreateEdgeFunctionRequest : IEquatable, IValidatableObject
{
+ ///
+ /// Defines InitiatorType
+ ///
+ [JsonConverter(typeof(StringEnumConverter))]
+ public enum InitiatorTypeEnum
+ {
+ ///
+ /// Enum Application for value: edge_application
+ ///
+ [EnumMember(Value = "edge_application")]
+ Application = 1,
+
+ ///
+ /// Enum Firewall for value: edge_firewall
+ ///
+ [EnumMember(Value = "edge_firewall")]
+ Firewall = 2
+ }
+
+
+ ///
+ /// Gets or Sets InitiatorType
+ ///
+ [DataMember(Name = "initiator_type", EmitDefaultValue = false)]
+ public InitiatorTypeEnum? InitiatorType { get; set; }
///
/// Initializes a new instance of the class.
///
@@ -38,14 +63,16 @@ public partial class CreateEdgeFunctionRequest : IEquatablelanguage.
/// code.
/// jsonArgs.
+ /// initiatorType.
/// active.
/// isProprietaryCode.
- public CreateEdgeFunctionRequest(string name = default(string), string language = default(string), string code = default(string), Object jsonArgs = default(Object), bool active = default(bool), bool isProprietaryCode = default(bool))
+ public CreateEdgeFunctionRequest(string name = default(string), string language = default(string), string code = default(string), Object jsonArgs = default(Object), InitiatorTypeEnum? initiatorType = default(InitiatorTypeEnum?), bool active = default(bool), bool isProprietaryCode = default(bool))
{
this.Name = name;
this.Language = language;
this.Code = code;
this.JsonArgs = jsonArgs;
+ this.InitiatorType = initiatorType;
this.Active = active;
this.IsProprietaryCode = isProprietaryCode;
}
@@ -98,6 +125,7 @@ public override string ToString()
sb.Append(" Language: ").Append(Language).Append("\n");
sb.Append(" Code: ").Append(Code).Append("\n");
sb.Append(" JsonArgs: ").Append(JsonArgs).Append("\n");
+ sb.Append(" InitiatorType: ").Append(InitiatorType).Append("\n");
sb.Append(" Active: ").Append(Active).Append("\n");
sb.Append(" IsProprietaryCode: ").Append(IsProprietaryCode).Append("\n");
sb.Append("}\n");
@@ -155,6 +183,10 @@ public bool Equals(CreateEdgeFunctionRequest input)
(this.JsonArgs != null &&
this.JsonArgs.Equals(input.JsonArgs))
) &&
+ (
+ this.InitiatorType == input.InitiatorType ||
+ this.InitiatorType.Equals(input.InitiatorType)
+ ) &&
(
this.Active == input.Active ||
this.Active.Equals(input.Active)
@@ -190,6 +222,7 @@ public override int GetHashCode()
{
hashCode = (hashCode * 59) + this.JsonArgs.GetHashCode();
}
+ hashCode = (hashCode * 59) + this.InitiatorType.GetHashCode();
hashCode = (hashCode * 59) + this.Active.GetHashCode();
hashCode = (hashCode * 59) + this.IsProprietaryCode.GetHashCode();
return hashCode;
diff --git a/edgefunctions/src/edgefunctions/Model/PutEdgeFunctionRequest.cs b/edgefunctions/src/edgefunctions/Model/PutEdgeFunctionRequest.cs
index a3b1ef8..2a8cf47 100644
--- a/edgefunctions/src/edgefunctions/Model/PutEdgeFunctionRequest.cs
+++ b/edgefunctions/src/edgefunctions/Model/PutEdgeFunctionRequest.cs
@@ -31,6 +31,31 @@ namespace edgefunctions.Model
[DataContract(Name = "PutEdgeFunctionRequest")]
public partial class PutEdgeFunctionRequest : IEquatable, IValidatableObject
{
+ ///
+ /// Defines InitiatorType
+ ///
+ [JsonConverter(typeof(StringEnumConverter))]
+ public enum InitiatorTypeEnum
+ {
+ ///
+ /// Enum Application for value: edge_application
+ ///
+ [EnumMember(Value = "edge_application")]
+ Application = 1,
+
+ ///
+ /// Enum Firewall for value: edge_firewall
+ ///
+ [EnumMember(Value = "edge_firewall")]
+ Firewall = 2
+ }
+
+
+ ///
+ /// Gets or Sets InitiatorType
+ ///
+ [DataMember(Name = "initiator_type", EmitDefaultValue = false)]
+ public InitiatorTypeEnum? InitiatorType { get; set; }
///
/// Initializes a new instance of the class.
///
@@ -41,7 +66,7 @@ public partial class PutEdgeFunctionRequest : IEquatable
/// initiatorType.
/// language.
/// isProprietaryCode.
- public PutEdgeFunctionRequest(string name = default(string), string code = default(string), Object jsonArgs = default(Object), bool active = default(bool), string initiatorType = default(string), string language = default(string), bool isProprietaryCode = default(bool))
+ public PutEdgeFunctionRequest(string name = default(string), string code = default(string), Object jsonArgs = default(Object), bool active = default(bool), InitiatorTypeEnum? initiatorType = default(InitiatorTypeEnum?), string language = default(string), bool isProprietaryCode = default(bool))
{
this.Name = name;
this.Code = code;
@@ -76,12 +101,6 @@ public partial class PutEdgeFunctionRequest : IEquatable
[DataMember(Name = "active", EmitDefaultValue = true)]
public bool Active { get; set; }
- ///
- /// Gets or Sets InitiatorType
- ///
- [DataMember(Name = "initiator_type", EmitDefaultValue = false)]
- public string InitiatorType { get; set; }
-
///
/// Gets or Sets Language
///
@@ -165,8 +184,7 @@ public bool Equals(PutEdgeFunctionRequest input)
) &&
(
this.InitiatorType == input.InitiatorType ||
- (this.InitiatorType != null &&
- this.InitiatorType.Equals(input.InitiatorType))
+ this.InitiatorType.Equals(input.InitiatorType)
) &&
(
this.Language == input.Language ||
@@ -201,10 +219,7 @@ public override int GetHashCode()
hashCode = (hashCode * 59) + this.JsonArgs.GetHashCode();
}
hashCode = (hashCode * 59) + this.Active.GetHashCode();
- if (this.InitiatorType != null)
- {
- hashCode = (hashCode * 59) + this.InitiatorType.GetHashCode();
- }
+ hashCode = (hashCode * 59) + this.InitiatorType.GetHashCode();
if (this.Language != null)
{
hashCode = (hashCode * 59) + this.Language.GetHashCode();
diff --git a/edgefunctions/src/edgefunctions/edgefunctions.csproj b/edgefunctions/src/edgefunctions/edgefunctions.csproj
index 1e19ec4..9632f1d 100644
--- a/edgefunctions/src/edgefunctions/edgefunctions.csproj
+++ b/edgefunctions/src/edgefunctions/edgefunctions.csproj
@@ -2,7 +2,7 @@
false
- netstandard2.0
+ net7.0
edgefunctions
edgefunctions
Library
@@ -17,14 +17,14 @@
https://github.com/GIT_USER_ID/GIT_REPO_ID.git
git
Minor update
+ annotations
-
+
-