Skip to content

Commit 50eab2e

Browse files
Merge pull request #17 from localstack-dotnet/1.3.0 [skip ci]
v1.3.0
2 parents cdd91c7 + 229c1d2 commit 50eab2e

File tree

55 files changed

+2332
-333
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+2332
-333
lines changed

LocalStack.sln

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "_Solution Items", "_Solutio
2929
build.sh = build.sh
3030
src\Directory.Build.props = src\Directory.Build.props
3131
.github\workflows\publish-nuget.yml = .github\workflows\publish-nuget.yml
32-
.github\workflows\test-report.yml = .github\workflows\test-report.yml
3332
EndProjectSection
3433
EndProject
3534
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LocalStack.Client.Extensions", "src\LocalStack.Client.Extensions\LocalStack.Client.Extensions.csproj", "{74035094-A726-44E2-9B88-42D6425D8548}"

README.md

Lines changed: 69 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ application development.
2727
- [Installation](#extensions-installation)
2828
- [Usage](#extensions-usage)
2929
- [About AddAwsService](#extensions-usage-about-addawsservice)
30+
- [useServiceUrl Parameter](#useserviceurl)
3031
- [Standalone Initialization](#standalone-initialization)
3132
- [Microsoft.Extensions.DependencyInjection Initialization](#di)
3233
5. [Developing](#developing)
@@ -143,7 +144,9 @@ You can configure `LocalStack.Client` by using entries in the `appsettings.json`
143144
All the entries above are has shown with default values (except `UseLocalStack`, it's `false` by default).
144145
So the above entries do not need to be specified.
145146

146-
What is entered for the aws credential values ​​in the `Session` section does not matter for LocalStack. `RegionName` is important since LocalStack creates resources by spesified region.
147+
What is entered for the aws credential values ​​in the `Session` section does not matter for LocalStack.
148+
149+
<a name="session-regioname"></a>`RegionName` is important since LocalStack creates resources by spesified region.
147150

148151
`Config` section contains important entries for local development. Starting with LocalStack releases after `v0.11.5`, all services are now exposed via the edge service (port 4566) only! If you are using a version of LocalStack lower than v0.11.5, you should set `UseLegacyPorts` to `true`. Edge port can be set to any available port ([see LocalStack configuration section](https://github.com/localstack/localstack#configurations)). If you have made such a change in LocalStack's configuration, be sure to set the same port value to `EdgePort` in the `Config` section. For `LocalStackHost` and `UseSsl` entries, ​​corresponding to the [LocalStack configuration](https://github.com/localstack/localstack#configurations) should be used.
149152

@@ -186,6 +189,28 @@ It is named as `AddAwsService` to avoid name conflict with `AddAWSService`.
186189

187190
<e><b>(Alternatively, `AddAWSServiceLocalStack` method can be used to prevent mix-up with `AddAWSService`.)</b><e>
188191

192+
#### <a name="useserviceurl"></a> useServiceUrl Parameter
193+
194+
LocalStack.NET uses [ClientConfig](https://github.com/aws/aws-sdk-net/blob/master/sdk/src/Core/Amazon.Runtime/ClientConfig.cs) to configure AWS clients to connect LocalStack. `ClientConfig` has two properties called `ServiceUrl` and `RegionEndpoint`, these are mutually exclusive properties. Whichever property is set last will cause the other to automatically be reset to null. LocalStack.NET has given priority to the RegionEndpoint property and the `us-east-1` region is used as the default value (Different regions can be set by using appsettings.json, see [RegionName](#session-regioname) entry. Because of it sets the RegionEndpoint property after the ServiceUrl property, ServiceUrl will be set to null.
195+
196+
To override this behavior, the `useServiceUrl` optional parameter can be set to `true` as below.
197+
198+
```csharp
199+
public void ConfigureServices(IServiceCollection services)
200+
{
201+
// Add framework services.
202+
services.AddMvc();
203+
204+
services.AddLocalStack(Configuration)
205+
services.AddDefaultAWSOptions(Configuration.GetAWSOptions());
206+
services.AddAwsService<IAmazonS3>();
207+
services.AddAwsService<IAmazonMediaStoreData>(useServiceUrl: true)
208+
services.AddAwsService<IAmazonIoTJobsDataPlane>(useServiceUrl: true)
209+
}
210+
```
211+
212+
The `RegionEndpoint` is not applicable for services such as AWS MediaStore, Iot. The optional parameter `useServiceUrl` can be useful for use in such scenarios.
213+
189214
### <a name="standalone-initialization"></a> Standalone Initialization
190215

191216
If you do not want to use any DI library, you have to instantiate `SessionStandalone` as follows.
@@ -226,6 +251,32 @@ var amazonS3Client = session.CreateClientByImplementation<AmazonS3Client>();
226251
var amazonS3Client = session.CreateClientByInterface<IAmazonS3>();
227252
```
228253

254+
### <a name="standalone-useserviceurl"></a><b>useServiceUrl Parameter</b>
255+
256+
LocalStack.NET uses [ClientConfig](https://github.com/aws/aws-sdk-net/blob/master/sdk/src/Core/Amazon.Runtime/ClientConfig.cs) to configure AWS clients to connect LocalStack. `ClientConfig` has two properties called `ServiceUrl` and `RegionEndpoint`, these are mutually exclusive properties. Whichever property is set last will cause the other to automatically be reset to null. LocalStack.NET has given priority to the RegionEndpoint property and the `us-east-1` region is used as the default value (Different regions can be set by using appsettings.json, see [RegionName](#session-regioname) entry. Because of it sets the RegionEndpoint property after the ServiceUrl property, ServiceUrl will be set to null.
257+
258+
To override this behavior, the `useServiceUrl` optional parameter can be set to `true` as below.
259+
260+
```csharp
261+
var sessionOptions = new SessionOptions();
262+
var configOptions = new ConfigOptions();
263+
264+
ISession session = SessionStandalone.Init()
265+
.WithSessionOptions(sessionOptions)
266+
.WithConfigurationOptions(configOptions).Create();
267+
268+
var amazonS3Client = session.CreateClientByImplementation<AmazonMediaStoreDataClient>(true);
269+
var amazonS3Client = session.CreateClientByImplementation<AmazonS3Client>();
270+
```
271+
272+
The `RegionEndpoint` is not applicable for services such as AWS MediaStore, Iot. The optional parameter `useServiceUrl` can be useful for use in such scenarios.
273+
274+
`CreateClientByInterface<TSerice>` method can also be used to create AWS service, as follows
275+
276+
```csharp
277+
var amazonS3Client = session.CreateClientByInterface<IAmazonMediaStoreData>(true);
278+
```
279+
229280
### <a name="di"></a> Microsoft.Extensions.DependencyInjection Initialization
230281

231282
First, you need to install `Microsoft.Extensions.DependencyInjection` nuget package as follows
@@ -343,6 +394,8 @@ ServiceProvider serviceProvider = collection.BuildServiceProvider();
343394
var amazonS3Client = serviceProvider.GetRequiredService<IAmazonS3>();
344395
```
345396

397+
See [useServiceUrl] parameter usage (#standalone-useserviceurl)
398+
346399
## <a name="developing"></a> Developing
347400

348401
We welcome feedback, bug reports, and pull requests!
@@ -387,6 +440,21 @@ Linux
387440

388441
## <a name="changelog"></a> Changelog
389442

443+
### [v1.3.0](https://github.com/localstack-dotnet/localstack-dotnet-client/releases/tag/v1.3.0)
444+
445+
#### 1. New Features
446+
- New endpoints in the official [Localstack Python Client](https://github.com/localstack/localstack-python-client) v1.27 have been added.
447+
- SESv2
448+
- EventBridge ([#14](https://github.com/localstack-dotnet/localstack-dotnet-client/pull/14))
449+
- Tested against LocalStack v0.13.0 container.
450+
#### 2. Enhancements
451+
- `useServiceUrl` parameter added to change client connection behavior. See [useServiceUrl Parameter](#useserviceurl)
452+
- Readme and SourceLink added to Nuget packages
453+
#### 3. Bug Fixes
454+
- Session::RegionName configuration does not honor while creating AWS client ([#15](https://github.com/localstack-dotnet/localstack-dotnet-client/issues/15))
455+
456+
Thanks to [petertownsend](https://github.com/petertownsend) for his contribution
457+
390458
### [v1.2.3](https://github.com/localstack-dotnet/localstack-dotnet-client/releases/tag/v1.2.3)
391459

392460
- New endpoints in the official [Localstack Python Client](https://github.com/localstack/localstack-python-client) v1.25 have been added.

build/LocalStack.Build/LocalStack.Build.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
<NoWarn>CA1303</NoWarn>
88
</PropertyGroup>
99
<ItemGroup>
10+
<PackageReference Include="Cake.Docker" Version="1.0.0" />
1011
<PackageReference Include="Cake.Frosting" Version="1.3.0" />
1112
</ItemGroup>
1213
</Project>

build/LocalStack.Build/Program.cs

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
return new CakeHost()
1+
using Cake.Docker;
2+
3+
return new CakeHost()
24
.UseContext<BuildContext>()
35
.Run(args);
46

@@ -84,6 +86,29 @@ public override void Run(BuildContext context)
8486
context.Warning($"=============Running {targetFramework.ToUpper()} tests for {testProj.AssemblyName}=============");
8587
settings.Framework = targetFramework;
8688

89+
if (testProj.AssemblyName == "LocalStack.Client.Functional.Tests")
90+
{
91+
context.Warning("Deleting running docker containers");
92+
93+
try
94+
{
95+
string psOutput = context.DockerPs(new DockerContainerPsSettings() { All = true, Quiet = true});
96+
97+
if (!string.IsNullOrEmpty(psOutput))
98+
{
99+
context.Warning(psOutput);
100+
101+
string[] containers = psOutput.Split(new[]{ Environment.NewLine }, StringSplitOptions.None);
102+
context.DockerRm(containers);
103+
}
104+
}
105+
catch
106+
{
107+
// ignored
108+
}
109+
}
110+
111+
87112
if (context.IsRunningOnUnix() && targetFramework == "net461")
88113
{
89114
context.RunXUnitUsingMono(targetFramework, $"{testProj.DirectoryPath}/bin/{context.BuildConfiguration}/{targetFramework}/{testProj.AssemblyName}.dll");

src/Directory.Build.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@
55
<Owners>LocalStack.NET</Owners>
66
<PackageProjectUrl>https://github.com/localstack-dotnet/localstack-dotnet-client</PackageProjectUrl>
77
<PackageIcon>localstack-dotnet-square.png</PackageIcon>
8-
<Version>1.2</Version>
8+
<Version>1.3</Version>
99
</PropertyGroup>
1010
</Project>

src/LocalStack.Client.Extensions/GlobalUsings.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
global using System;
22
global using System.Reflection;
3+
34
global using Microsoft.Extensions.Configuration;
45
global using Microsoft.Extensions.DependencyInjection;
56
global using Microsoft.Extensions.DependencyInjection.Extensions;
67
global using Microsoft.Extensions.Options;
8+
9+
global using Amazon;
710
global using Amazon.Extensions.NETCore.Setup;
811
global using Amazon.Runtime;
12+
913
global using LocalStack.Client.Contracts;
1014
global using LocalStack.Client.Extensions.Contracts;
1115
global using LocalStack.Client.Options;

src/LocalStack.Client.Extensions/LocalStack.Client.Extensions.csproj

Lines changed: 17 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,27 @@
66
<AssemblyName>LocalStack.Client.Extensions</AssemblyName>
77
<RootNamespace>LocalStack.Client.Extensions</RootNamespace>
88
<LangVersion>latest</LangVersion>
9+
<Version>1.1.2</Version>
910

1011
<Title>LocalStack.NET Client</Title>
1112
<Description>
1213
Extensions for the LocalStack.NET Client to integrate with .NET Core configuration and dependency injection frameworks. The extensions also provides wrapper around AWSSDK.Extensions.NETCore.Setup to use both LocalStack and AWS side-by-side
1314
</Description>
1415
<PackageTags>aws-sdk, localstack, client-library, dotnet, dotnet-core</PackageTags>
1516
<PackageLicenseFile>LICENSE.txt</PackageLicenseFile>
16-
<Version>1.1.0</Version>
17+
<PackageReadmeFile>README.md</PackageReadmeFile>
18+
<PublishRepositoryUrl>true</PublishRepositoryUrl>
19+
<EmbedUntrackedSources>true</EmbedUntrackedSources>
20+
<AllowedOutputExtensionsInPackageBuildOutputFolder>$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb</AllowedOutputExtensionsInPackageBuildOutputFolder>
21+
</PropertyGroup>
22+
23+
<PropertyGroup Condition="'$(GITHUB_ACTIONS)' == 'true'">
24+
<ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
1725
</PropertyGroup>
1826

1927
<ItemGroup>
2028
<PackageReference Include="AWSSDK.Extensions.NETCore.Setup" Version="3.7.1" />
21-
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.0" PrivateAssets="All" />
29+
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="All" />
2230

2331
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="3.0.0" />
2432
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="3.0.0" />
@@ -27,50 +35,29 @@
2735
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="3.0.0" />
2836
</ItemGroup>
2937

30-
31-
32-
<!--<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0'">
33-
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="3.0.0" />
34-
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="3.0.0" />
35-
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="3.0.0" />
36-
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="3.0.0" />
37-
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="3.0.0" />
38-
</ItemGroup>
39-
40-
<ItemGroup Condition="'$(TargetFramework)' == 'net5.0'">
41-
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="5.0.0" />
42-
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="5.0.0" />
43-
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="5.0.0" />
44-
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="5.0.0" />
45-
</ItemGroup>
46-
47-
<ItemGroup Condition="'$(TargetFramework)' == 'net6.0'">
48-
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="6.0.0" />
49-
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="6.0.0" />
50-
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="6.0.0" />
51-
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="6.0.0" />
52-
</ItemGroup>-->
53-
5438
<Target Name="PreBuild" AfterTargets="PreBuildEvent">
5539
<ItemGroup>
5640
<LicenseFile Include="../../LICENSE" />
5741
</ItemGroup>
42+
<ItemGroup>
43+
<ReadmeFile Include="../../README.md" />
44+
</ItemGroup>
5845
<Copy SourceFiles="@(LicenseFile)" DestinationFiles="@(LicenseFile->'./LICENSE.txt')" SkipUnchangedFiles="true" />
46+
<Copy SourceFiles="@(ReadmeFile)" DestinationFiles="@(ReadmeFile->'./README.md')" SkipUnchangedFiles="true" />
5947
</Target>
6048

6149
<ItemGroup>
6250
<None Include="LICENSE.txt" Pack="true" PackagePath="">
6351
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
6452
</None>
53+
<None Include="README.md" Pack="true" PackagePath="">
54+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
55+
</None>
6556
<None Include="../../assets/localstack-dotnet-square.png" Pack="true" PackagePath="" />
6657
</ItemGroup>
6758

6859
<ItemGroup>
6960
<ProjectReference Include="..\LocalStack.Client\LocalStack.Client.csproj" />
7061
</ItemGroup>
7162

72-
<ItemGroup>
73-
<Folder Include="Contracts\" />
74-
</ItemGroup>
75-
7663
</Project>

0 commit comments

Comments
 (0)