AWS SDK for Go: Second version packages service clients as individual Go modules
Source: Heise.de added 20th Jan 2021Amazon Web Services (AWS) has released the second major version of its Software Development Kit (SDK) for the Go programming language. According to the publisher, user feedback from the first version was incorporated and new features of the language were taken into account.
Modularize service clients The revised modularization is new: Version 2 of the SDK packages each AWS Service Client as an independent Go module. This should enable developers to model service dependencies in their applications. Feature updates and the service client for app control can thus be handled separately and the size of individual modules shrinks. Go modules have been around since Go 1. 13, the innovation in the SDK follows the general versioning strategy for Go.
Configuration and API client methods are simplified or unified: Instead of numerous ways to call an API, version 2 offers a single API client to call services . Service operations can be called directly on the client, with each method taking the API input along with the context and then returning the response or the error.
Less Pointer for API parameters required The pointers for API parameters have also been streamlined. In the new version, the SDK requires fewer pointer references than before. Types can be converted into values whenever this is possible according to the API model data. Apparently this also applies to the map and slice data. Enums are now part of the type string aliases, can be generated as constants and can be used directly in the code.
According to the AWS team, this simplifies the type support for enums in the IDE ( Integrated Development Environment). With a code example, the team illustrates how value types for the API filters of the DescribeInstance in the Amazon Elastic Cloud let set. Filters and Values become value types instead of pointers (as in version 1 of the SDK):
result, err: = client.DescribeInstances (context.TODO (), & ec2.DescribeInstancesInput {Filters: types.Filter {{Name: aws.String (“instance-state-name”), Values: string {“running”, “pending”, “stopped”,},},},}) Configuring with a single config type The new SDK version for Go sees a single Config – Type before what the interaction between session – and Config – type simplified. The SDK developers have moved the configuration flags specific to each service to the area of individual service client options. According to the blog entry, this is intended to make it easier to find configuration values that the Service Client supports.
With the command LoadDefaultConfig developers can obviously define the standard configuration values in the configuration package and load configuration values from external sources. It could look like the following example code – details on this can be found in the developer guide for the AWS SDK for Go.
// Load SDK configuration with shared config profile. cfg, err: = config.LoadDefaultConfig (context.TODO (), config.WithSharedConfigProfile (“profile-name”),) // Create Amazon S3 API client using path style addressing. client: = s3.NewFromConfig (cfg, func (o s3.Options) {o.UsePathStyle = true}) Cross-page pagination Call-back functions are no longer used in pagination with a single context across all paginated service calls, which made error handling more difficult in the past. Instead, the new SDK version provides the context page by page and allows iteration over API results that can span several pages. According to the publisher, performance should also be increased, so the AWS team refers to its own benchmark program and a half-cut CPU load.
The AttributeValue and Expression packages are also new Package from Amazon DynamoDB and Amazon S3 Transfer Manager for transferring large files in smaller portions, using goroutines.
More information can be found in the migration guide. Further code examples and more detailed information can be found in the release notification in the AWS blog.
(sih )
brands: Amazon CODE Command First It longer New Profile Team Value media: Heise.de keywords: Amazon App Cloud Software
Related posts
Notice: Undefined variable: all_related in /var/www/vhosts/rondea.com/httpdocs/wp-content/themes/rondea-2-0/single-article.php on line 88
Notice: Undefined variable: all_related in /var/www/vhosts/rondea.com/httpdocs/wp-content/themes/rondea-2-0/single-article.php on line 88
Related Products
Notice: Undefined variable: all_related in /var/www/vhosts/rondea.com/httpdocs/wp-content/themes/rondea-2-0/single-article.php on line 91
Warning: Invalid argument supplied for foreach() in /var/www/vhosts/rondea.com/httpdocs/wp-content/themes/rondea-2-0/single-article.php on line 91