1
|
|
|
package ssm |
2
|
|
|
|
3
|
|
|
import ( |
4
|
|
|
"context" |
5
|
|
|
|
6
|
|
|
SDK "github.com/aws/aws-sdk-go-v2/service/ssm" |
7
|
|
|
|
8
|
|
|
"github.com/evalphobia/aws-sdk-go-v2-wrapper/errors" |
9
|
|
|
"github.com/evalphobia/aws-sdk-go-v2-wrapper/private/pointers" |
10
|
|
|
) |
11
|
|
|
|
12
|
|
|
// GetParameterHistory executes `GetParameterHistory` operation. |
13
|
|
|
func (svc *SSM) GetParameterHistory(ctx context.Context, r GetParameterHistoryRequest) (*GetParameterHistoryResult, error) { |
14
|
|
|
out, err := svc.RawGetParameterHistory(ctx, r.ToInput()) |
15
|
|
|
if err != nil { |
16
|
|
|
err = svc.errWrap(errors.ErrorData{ |
17
|
|
|
Err: err, |
18
|
|
|
AWSOperation: "GetParameterHistory", |
19
|
|
|
}) |
20
|
|
|
svc.Errorf(err.Error()) |
|
|
|
|
21
|
|
|
return nil, err |
22
|
|
|
} |
23
|
|
|
return NewGetParameterHistoryResult(out), err |
24
|
|
|
} |
25
|
|
|
|
26
|
|
|
// GetParameterHistoryRequest has parameters for `GetParameterHistory` operation. |
27
|
|
|
type GetParameterHistoryRequest struct { |
28
|
|
|
Name string |
29
|
|
|
|
30
|
|
|
// optional |
31
|
|
|
MaxResults int64 |
32
|
|
|
NextToken string |
33
|
|
|
WithDecryption bool |
34
|
|
|
} |
35
|
|
|
|
36
|
|
|
func (r GetParameterHistoryRequest) ToInput() *SDK.GetParameterHistoryInput { |
|
|
|
|
37
|
|
|
in := &SDK.GetParameterHistoryInput{} |
38
|
|
|
if r.Name != "" { |
39
|
|
|
in.Name = pointers.String(r.Name) |
40
|
|
|
} |
41
|
|
|
if r.MaxResults != 0 { |
42
|
|
|
in.MaxResults = pointers.Long64(r.MaxResults) |
43
|
|
|
} |
44
|
|
|
if r.NextToken != "" { |
45
|
|
|
in.NextToken = pointers.String(r.NextToken) |
46
|
|
|
} |
47
|
|
|
if r.WithDecryption { |
48
|
|
|
in.WithDecryption = pointers.Bool(r.WithDecryption) |
49
|
|
|
} |
50
|
|
|
return in |
51
|
|
|
} |
52
|
|
|
|
53
|
|
|
type GetParameterHistoryResult struct { |
|
|
|
|
54
|
|
|
NextToken string |
55
|
|
|
Parameters []ParameterHistory |
56
|
|
|
} |
57
|
|
|
|
58
|
|
|
func NewGetParameterHistoryResult(o *SDK.GetParameterHistoryResponse) *GetParameterHistoryResult { |
|
|
|
|
59
|
|
|
result := &GetParameterHistoryResult{} |
60
|
|
|
if o == nil { |
61
|
|
|
return result |
62
|
|
|
} |
63
|
|
|
|
64
|
|
|
if o.NextToken != nil { |
65
|
|
|
result.NextToken = *o.NextToken |
66
|
|
|
} |
67
|
|
|
if len(o.Parameters) != 0 { |
68
|
|
|
list := make([]ParameterHistory, len(o.Parameters)) |
69
|
|
|
for i := range o.Parameters { |
70
|
|
|
list[i] = newParameterHistory(&o.Parameters[i]) |
71
|
|
|
} |
72
|
|
|
result.Parameters = list |
73
|
|
|
} |
74
|
|
|
return result |
75
|
|
|
} |
76
|
|
|
|