Skip to content

I want to add IAmazonApiGatewayManagementApi in IoC container and configure it. #2572

@igigiberia

Description

@igigiberia

Describe the feature

There is a way for most of the services to add them with extension method TryAddAwsService / TryAddAWSService, depending whether there's usage of LocalStack involved or not, but not for IAmazonApiGatewayManagementApi... As I couldn't find a way to configure ServiceURL, except explicitly adding the service as a Transient and providing new object initialization lambda definition as a parameter as shown in example:

    public static IServiceCollection AddService(this IServiceCollection services, IConfiguration configuration)
    {
        return services
            .AddLocalStack(configuration)
            .AddDefaultAWSOptions(configuration.GetAWSOptions())
            .AddTransient<IAmazonApiGatewayManagementApi>(_ => 
                new AmazonApiGatewayManagementApiClient(
                    new AmazonApiGatewayManagementApiConfig
                    {
                        ServiceURL = "wss://someurl"
                    }));
    }

Is there more authentic way to add the interface in a service collection using TryAddAwsService and configure ServiceURL ?

I'm searching for something similar to this:

    public static IServiceCollection AddService(this IServiceCollection services, IConfiguration configuration)
    {
        return services
            .AddLocalStack(configuration)
            .AddDefaultAwsOptions(configuration.GetAWSOptions())
            .Configure<AmazonApiGatewayManagementApiConfig>(config =>
            {
                config.ServiceURL = "wss://someurl";
            })
            .TryAddAwsService<IAmazonApiGatewayManagementApi>(ServiceLifetime.Transient);
    }

But obviously this code doesn't work....

Use Case

I want to add IAmazonApiGatewayManagementApi in IoC container and configure it.

Proposed Solution

No response

Other Information

No response

Acknowledgements

  • I may be able to implement this feature request
  • This feature might incur a breaking change

AWS .NET SDK and/or Package version used

Latest

Targeted .NET Platform

.NET 6

Operating System and version

Any

Metadata

Metadata

Assignees

Labels

feature-requestA feature should be added or improved.p2This is a standard priority issuepending-releaseThis issue will be fixed by an approved PR that hasn't been released yet.

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions