Skip to content

Commit

Permalink
Merge pull request #133 from admsteck/feature/add-proxy-support-to-co…
Browse files Browse the repository at this point in the history
…smos

Add proxy support to the Cosmos Extension
  • Loading branch information
markjbrown committed Sep 5, 2024
2 parents 3fc3f32 + 55662ea commit c306799
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using System.Reflection;
using Azure.Core;
using System.Text.RegularExpressions;
using System.Net;

namespace Cosmos.DataTransfer.CosmosExtension
{
Expand All @@ -31,6 +32,10 @@ public static CosmosClient CreateClient(CosmosSettingsBase settings, string disp
EnableContentResponseOnWrite = false,
Serializer = cosmosSerializer,
};

if (!string.IsNullOrEmpty(settings.WebProxy)){
clientOptions.WebProxy = new WebProxy(settings.WebProxy);
}

CosmosClient? cosmosClient;
if (settings.UseRbacAuth)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public abstract class CosmosSettingsBase : IValidatableObject
[Required]
public string? Container { get; set; }
public ConnectionMode ConnectionMode { get; set; } = ConnectionMode.Gateway;

public string? WebProxy { get; set; }
public bool UseRbacAuth { get; set; }
public string? AccountEndpoint { get; set; }
public bool EnableInteractiveCredentials { get; set; } = true;
Expand Down
8 changes: 5 additions & 3 deletions Extensions/Cosmos/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Source and sink settings also both require parameters to specify the data locati
- `Database`
- `Container`

Source supports an optional `IncludeMetadataFields` parameter (`false` by default) to enable inclusion of built-in Cosmos fields prefixed with `"_"`, for example `"_etag"` and `"_ts"`. An optional PartitionKeyValue setting allows for filtering to a single partition. The optional Query setting allows further filtering using a Cosmos SQL statement.
Source supports an optional `IncludeMetadataFields` parameter (`false` by default) to enable inclusion of built-in Cosmos fields prefixed with `"_"`, for example `"_etag"` and `"_ts"`. An optional PartitionKeyValue setting allows for filtering to a single partition. The optional Query setting allows further filtering using a Cosmos SQL statement. An optional `WebProxy` parameter (`null` by default) enables connections through a proxy.

### Source

Expand All @@ -25,7 +25,8 @@ Source supports an optional `IncludeMetadataFields` parameter (`false` by defaul
"Container":"myContainer",
"IncludeMetadataFields": false,
"PartitionKeyValue":"123",
"Query":"SELECT * FROM c WHERE c.category='event'"
"Query":"SELECT * FROM c WHERE c.category='event'",
"WebProxy":"http://yourproxy.server.com/"
}
```

Expand All @@ -40,7 +41,8 @@ Or with RBAC:
"Container":"myContainer",
"IncludeMetadataFields": false,
"PartitionKeyValue":"123",
"Query":"SELECT * FROM c WHERE c.category='event'"
"Query":"SELECT * FROM c WHERE c.category='event'",
"WebProxy":"http://yourproxy.server.com/"
}
```

Expand Down

0 comments on commit c306799

Please sign in to comment.