Skip to content

Commit

Permalink
Version 7.0.3 - AWSOptions setup
Browse files Browse the repository at this point in the history
  • Loading branch information
bcuff committed Nov 13, 2019
1 parent 2ae0cd6 commit 22a7ff4
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 15 deletions.
31 changes: 22 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
Add-on to [elasticsearch-net / NEST](https://github.com/elastic/elasticsearch-net) for using AWS's elasticsearch service.

## Install Package
On Nuget

On Nuget:

* [Current Version 5.0+](https://www.nuget.org/packages/Elasticsearch.Net.Aws/)
* [NEST / Elasticsearch.Net 2.X](https://www.nuget.org/packages/bcuff.Elasticsearch.Net.Aws-v2/)
* [NEST / Elasticsearch.Net 1.X](https://www.nuget.org/packages/Elasticsearch.Net.Aws-v1/)
Expand All @@ -27,36 +29,47 @@ dotnet add package Elasticsearch.Net.Aws-v1

## Setup

#### Elasticsearch.Net Version >= 2.0.2
### Elasticsearch.Net Version >= 2.0.2

**Use Package Elasticsearch.Net.Aws**
Use Package [Elasticsearch.Net.Aws](https://www.nuget.org/packages/Elasticsearch.Net.Aws/).

#### Typical Setup

```csharp
// for NEST
// if using app.config, environment variables, or roles
// This constructor will look up AWS credentials in the
// same way that the AWSSDK does automatically.
var httpConnection = new AwsHttpConnection("us-east-1");
var httpConnection = new AwsHttpConnection();

var pool = new SingleNodeConnectionPool(new Uri("http://localhost:9200"));
var config = new ConnectionSettings(pool, httpConnection);
var client = new ElasticClient(config);
```

#### .NET Core Applications using IConfiguration

```csharp
IConfiguration config = Configuration;
var options = config.GetAWSOptions();
var httpConnection = new AwsHttpConnection(options);

// same as above
```

#### Elasticsearch.Net Version 1.7.1

**Use Package Elasticsearch.Net.Aws-v1**
Use Package [Elasticsearch.Net.Aws-v1](https://www.nuget.org/packages/Elasticsearch.Net.Aws-v1)

Source for this version is maintained on the version-1 branch

```csharp
// for NEST
var client = new ElasticClient(settings, connection: new AwsHttpConnection(settings, new AwsSettings
{
AccessKey = "My AWS access key",
SecretKey = "My AWS secret key",
Region = "us-east-1",
AccessKey = "My AWS access key",
SecretKey = "My AWS secret key",
Region = "us-east-1",
}));
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
using System.Net.Http;
using Amazon;
using Amazon.Runtime;
#if NETSTANDARD
using Amazon.Extensions.NETCore.Setup;
#endif

namespace Elasticsearch.Net.Aws
{
Expand All @@ -15,6 +18,13 @@ public class AwsHttpConnection : HttpConnection
private readonly AWSCredentials _credentials;
private readonly RegionEndpoint _region;

#if NETSTANDARD
public AwsHttpConnection(AWSOptions options)
: this(options.Credentials, options.Region)
{
}
#endif

/// <summary>
/// Initializes a new instance of the AwsHttpConnection class with the specified AccessKey, SecretKey and Token.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<VersionPrefix>7.0.2</VersionPrefix>
<VersionPrefix>7.0.3</VersionPrefix>
<TargetFrameworks>netstandard2.0;net461</TargetFrameworks>
<AssemblyName>Elasticsearch.Net.Aws</AssemblyName>
<PackageId>Elasticsearch.Net.Aws</PackageId>
<PackageVersion>7.0.2</PackageVersion>
<PackageVersion>7.0.3</PackageVersion>
<Authors>Brandon Cuff</Authors>
<Description>Enables request signing necessary for using the AWS Elasticsearch service.</Description>
<Copyright>Copyright 2015</Copyright>
<PackageLicenseUrl>https://raw.githubusercontent.com/bcuff/elasticsearch-net-aws/master/LICENSE</PackageLicenseUrl>
<PackageProjectUrl>https://github.com/bcuff/elasticsearch-net-aws</PackageProjectUrl>
<PackageReleaseNotes>Support NET Framework 4.6.1</PackageReleaseNotes>
<PackageReleaseNotes>Added AWSOptions overload.</PackageReleaseNotes>
<PackageTags>elasticsearch elastic search aws amazon</PackageTags>
<RepositoryUrl>https://github.com/bcuff/elasticsearch-net-aws</RepositoryUrl>
<AssemblyVersion>7.0.2</AssemblyVersion>
<FileVersion>7.0.2</FileVersion>
<Version>7.0.2</Version>
<AssemblyVersion>7.0.3</AssemblyVersion>
<FileVersion>7.0.3</FileVersion>
<Version>7.0.3</Version>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)' == 'Release'">
Expand All @@ -25,6 +25,10 @@
<PublicSign Condition="'$(OS)' != 'Windows_NT'">true</PublicSign>
</PropertyGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0'">
<PackageReference Include="AWSSDK.Extensions.NETCore.Setup" Version="3.3.*" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.WebUtilities" Version="2.1.1" />
<PackageReference Include="AWSSDK.Core" Version="3.3.*" />
Expand Down

0 comments on commit 22a7ff4

Please sign in to comment.