Struct: session.Session
Overview
A Session provides a central location to create service clients from and store configurations and request handlers for those services.
Sessions are safe to create service clients concurrently, but it is not safe to mutate the Session concurrently.
The Session satisfies the service client's client.ConfigProvider.
Implemented Interfaces
s3crypto.Cipher, client.ConfigNoResolveEndpointProvider, client.ConfigProvider, s3manager.ReadSeekerWriteTo, s3manager.WriterReadFrom
Structure Field Summary collapse
Constructor Functions collapse
-
func Must(sess *Session, err error) *Session
Must is a helper function to ensure the Session is valid and there was no error when calling a NewSession function.
Method Summary collapse
-
func (s *Session) ClientConfig(service string, cfgs ...*aws.Config) client.Config
ClientConfig satisfies the client.ConfigProvider interface and is used to configure the service client instances.
-
func (s *Session) ClientConfigNoResolveEndpoint(cfgs ...*aws.Config) client.Config
ClientConfigNoResolveEndpoint is the same as ClientConfig with the exception that the EndpointResolver will not be used to resolve the endpoint.
-
func (s *Session) Copy(cfgs ...*aws.Config) *Session
Copy creates and returns a copy of the current Session, copying the config and handlers.
Function Details
func Must(sess *Session, err error) *Session
Must is a helper function to ensure the Session is valid and there was no error when calling a NewSession function.
This helper is intended to be used in variable initialization to load the Session and configuration at startup. Such as:
var sess = session.Must(session.NewSession())
303 304 305 306 307 308 309 |
// File 'aws/session/session.go', line 303
|
Method Details
func (s *Session) ClientConfig(service string, cfgs ...*aws.Config) client.Config
ClientConfig satisfies the client.ConfigProvider interface and is used to configure the service client instances. Passing the Session to the service client's constructor (New) will use this method to configure the client.
648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 |
// File 'aws/session/session.go', line 648
|
func (s *Session) ClientConfigNoResolveEndpoint(cfgs ...*aws.Config) client.Config
ClientConfigNoResolveEndpoint is the same as ClientConfig with the exception that the EndpointResolver will not be used to resolve the endpoint. The only endpoint set must come from the aws.Config.Endpoint field.
719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 |
// File 'aws/session/session.go', line 719
|
func (s *Session) Copy(cfgs ...*aws.Config) *Session
Copy creates and returns a copy of the current Session, copying the config and handlers. If any additional configs are provided they will be merged on top of the Session's copied config.
// Create a copy of the current Session, configured for the us-west-2 region.
sess.Copy(&aws.Config{Region: aws.String("us-west-2")})
633 634 635 636 637 638 639 640 641 642 643 |
// File 'aws/session/session.go', line 633
|