summaryrefslogtreecommitdiff
path: root/vendor/github.com/mitchellh/packer/vendor/github.com/denverdino/aliyungo/ecs/snat_entry.go
blob: aa75574c37e3f78fa1c418bc873742e8d2dcd0a6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
package ecs

import "github.com/denverdino/aliyungo/common"

type CreateSnatEntryArgs struct {
	RegionId        common.Region
	SnatTableId     string
	SourceVSwitchId string
	SnatIp          string
}

type CreateSnatEntryResponse struct {
	common.Response
	SnatEntryId string
}

type SnatEntrySetType struct {
	RegionId        common.Region
	SnatEntryId     string
	SnatIp          string
	SnatTableId     string
	SourceCIDR      string
	SourceVSwitchId string
	Status          string
}

type DescribeSnatTableEntriesArgs struct {
	RegionId    common.Region
	SnatTableId string
	common.Pagination
}

type DescribeSnatTableEntriesResponse struct {
	common.Response
	common.PaginationResult
	SnatTableEntries struct {
		SnatTableEntry []SnatEntrySetType
	}
}

type ModifySnatEntryArgs struct {
	RegionId    common.Region
	SnatTableId string
	SnatEntryId string
	SnatIp      string
}

type ModifySnatEntryResponse struct {
	common.Response
}

type DeleteSnatEntryArgs struct {
	RegionId    common.Region
	SnatTableId string
	SnatEntryId string
}

type DeleteSnatEntryResponse struct {
	common.Response
}

func (client *Client) CreateSnatEntry(args *CreateSnatEntryArgs) (resp *CreateSnatEntryResponse, err error) {
	response := CreateSnatEntryResponse{}
	err = client.Invoke("CreateSnatEntry", args, &response)
	if err != nil {
		return nil, err
	}
	return &response, err
}

func (client *Client) DescribeSnatTableEntries(args *DescribeSnatTableEntriesArgs) (snatTableEntries []SnatEntrySetType,
	pagination *common.PaginationResult, err error) {

	args.Validate()
	response := DescribeSnatTableEntriesResponse{}

	err = client.Invoke("DescribeSnatTableEntries", args, &response)

	if err != nil {
		return nil, nil, err
	}

	return response.SnatTableEntries.SnatTableEntry, &response.PaginationResult, nil
}

func (client *Client) ModifySnatEntry(args *ModifySnatEntryArgs) error {
	response := ModifySnatEntryResponse{}
	return client.Invoke("ModifySnatEntry", args, &response)
}

func (client *Client) DeleteSnatEntry(args *DeleteSnatEntryArgs) error {
	response := DeleteSnatEntryResponse{}
	err := client.Invoke("DeleteSnatEntry", args, &response)
	return err
}