1// Code generated by github.com/aws/aws-sdk-go-v2/internal/codegen/cmd/defaultsmode. DO NOT EDIT.
2
3package aws
4
5import (
6 "strings"
7)
8
9// DefaultsMode is the SDK defaults mode setting.
10type DefaultsMode string
11
12// The DefaultsMode constants.
13const (
14 // DefaultsModeAuto is an experimental mode that builds on the standard mode.
15 // The SDK will attempt to discover the execution environment to determine the
16 // appropriate settings automatically.
17 //
18 // Note that the auto detection is heuristics-based and does not guarantee 100%
19 // accuracy. STANDARD mode will be used if the execution environment cannot
20 // be determined. The auto detection might query EC2 Instance Metadata service
21 // (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-metadata.html),
22 // which might introduce latency. Therefore we recommend choosing an explicit
23 // defaults_mode instead if startup latency is critical to your application
24 DefaultsModeAuto DefaultsMode = "auto"
25
26 // DefaultsModeCrossRegion builds on the standard mode and includes optimization
27 // tailored for applications which call AWS services in a different region
28 //
29 // Note that the default values vended from this mode might change as best practices
30 // may evolve. As a result, it is encouraged to perform tests when upgrading
31 // the SDK
32 DefaultsModeCrossRegion DefaultsMode = "cross-region"
33
34 // DefaultsModeInRegion builds on the standard mode and includes optimization
35 // tailored for applications which call AWS services from within the same AWS
36 // region
37 //
38 // Note that the default values vended from this mode might change as best practices
39 // may evolve. As a result, it is encouraged to perform tests when upgrading
40 // the SDK
41 DefaultsModeInRegion DefaultsMode = "in-region"
42
43 // DefaultsModeLegacy provides default settings that vary per SDK and were used
44 // prior to establishment of defaults_mode
45 DefaultsModeLegacy DefaultsMode = "legacy"
46
47 // DefaultsModeMobile builds on the standard mode and includes optimization
48 // tailored for mobile applications
49 //
50 // Note that the default values vended from this mode might change as best practices
51 // may evolve. As a result, it is encouraged to perform tests when upgrading
52 // the SDK
53 DefaultsModeMobile DefaultsMode = "mobile"
54
55 // DefaultsModeStandard provides the latest recommended default values that
56 // should be safe to run in most scenarios
57 //
58 // Note that the default values vended from this mode might change as best practices
59 // may evolve. As a result, it is encouraged to perform tests when upgrading
60 // the SDK
61 DefaultsModeStandard DefaultsMode = "standard"
62)
63
64// SetFromString sets the DefaultsMode value to one of the pre-defined constants that matches
65// the provided string when compared using EqualFold. If the value does not match a known
66// constant it will be set to as-is and the function will return false. As a special case, if the
67// provided value is a zero-length string, the mode will be set to LegacyDefaultsMode.
68func (d *DefaultsMode) SetFromString(v string) (ok bool) {
69 switch {
70 case strings.EqualFold(v, string(DefaultsModeAuto)):
71 *d = DefaultsModeAuto
72 ok = true
73 case strings.EqualFold(v, string(DefaultsModeCrossRegion)):
74 *d = DefaultsModeCrossRegion
75 ok = true
76 case strings.EqualFold(v, string(DefaultsModeInRegion)):
77 *d = DefaultsModeInRegion
78 ok = true
79 case strings.EqualFold(v, string(DefaultsModeLegacy)):
80 *d = DefaultsModeLegacy
81 ok = true
82 case strings.EqualFold(v, string(DefaultsModeMobile)):
83 *d = DefaultsModeMobile
84 ok = true
85 case strings.EqualFold(v, string(DefaultsModeStandard)):
86 *d = DefaultsModeStandard
87 ok = true
88 case len(v) == 0:
89 *d = DefaultsModeLegacy
90 ok = true
91 default:
92 *d = DefaultsMode(v)
93 }
94 return ok
95}