Passed
Push — master ( 2f1af3...a8e5e6 )
by eval
03:46 queued 02:09
created

dynamodb.NewDescribeTableResult   A

Complexity

Conditions 3

Size

Total Lines 10
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 3
eloc 7
nop 1
dl 0
loc 10
rs 10
c 0
b 0
f 0
1
package dynamodb
2
3
import (
4
	"context"
5
6
	SDK "github.com/aws/aws-sdk-go-v2/service/dynamodb"
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
// DescribeTable executes `DescribeTable` operation.
13
func (svc *DynamoDB) DescribeTable(ctx context.Context, r DescribeTableRequest) (*DescribeTableResult, error) {
14
	out, err := svc.RawDescribeTable(ctx, r.ToInput())
15
	if err == nil {
16
		return NewDescribeTableResult(out), nil
17
	}
18
19
	err = svc.errWrap(errors.ErrorData{
20
		Err:          err,
21
		AWSOperation: "DescribeTable",
22
	})
23
	svc.Errorf(err.Error())
0 ignored issues
show
introduced by
can't check non-constant format in call to Errorf
Loading history...
24
	return nil, err
25
}
26
27
// DescribeTableRequest has parameters for `DescribeTable` operation.
28
type DescribeTableRequest struct {
29
	TableName string
30
}
31
32
func (r DescribeTableRequest) ToInput() *SDK.DescribeTableInput {
0 ignored issues
show
introduced by
exported method DescribeTableRequest.ToInput should have comment or be unexported
Loading history...
33
	in := &SDK.DescribeTableInput{}
34
35
	if r.TableName != "" {
36
		in.TableName = pointers.String(r.TableName)
37
	}
38
	return in
39
}
40
41
// DescribeTableResult contains results from `DescribeTable` operation.
42
type DescribeTableResult struct {
43
	Table TableDescription
44
}
45
46
func NewDescribeTableResult(output *SDK.DescribeTableResponse) *DescribeTableResult {
0 ignored issues
show
introduced by
exported function NewDescribeTableResult should have comment or be unexported
Loading history...
47
	r := &DescribeTableResult{}
48
	if output == nil {
49
		return r
50
	}
51
52
	if output.Table != nil {
53
		r.Table = newTableDescription(*output.Table)
54
	}
55
	return r
56
}
57