Skip to content

useragent: Simplify data structure, context helpers #1397

@jar-b

Description

@jar-b

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Description

The final design for provider_meta support in the standard and AWSCC provider contains a user_agent argument which is a list of strings. Once the AWSCC provider reaches version 2.0.0 and the list of objects user_agent schema is replaced with a list of strings, all upstream libraries will have simplified the representation of additional User-Agent values to string types.

This simplification means that the data structures in this library for representing User-Agent data can also be simplified. This includes.

  • Data structures in internal/config:

type UserAgentProduct struct {
Name string
Version string
Comment string
}
type UserAgentProducts []UserAgentProduct

  • Context helpers in useragent:

func Context(ctx context.Context, products config.UserAgentProducts) context.Context {
return context.WithValue(ctx, contextScopedUserAgent, products)
}

These types and function arguments can be replaced with a slice of strings, aligning with the upstream representation.

References

https://hashicorp.github.io/terraform-provider-aws/design-decisions/provider_meta/
Relates hashicorp/terraform-provider-aws#45464
Relates hashicorp/terraform-provider-awscc#474

Metadata

Metadata

Assignees

No one assigned

    Labels

    breaking-changeA breaking change to the libraryenhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions