| 1 | package ecs |
| 2 | |
| 3 | import "github.com/denverdino/aliyungo/common" |
| 4 | |
| 5 | type CreateForwardEntryArgs struct { |
| 6 | RegionId common.Region |
| 7 | ForwardTableId string |
| 8 | ExternalIp string |
| 9 | ExternalPort string |
| 10 | IpProtocol string |
| 11 | InternalIp string |
| 12 | InternalPort string |
| 13 | } |
| 14 | |
| 15 | type CreateForwardEntryResponse struct { |
| 16 | common.Response |
| 17 | ForwardEntryId string |
| 18 | } |
| 19 | |
| 20 | type DescribeForwardTableEntriesArgs struct { |
| 21 | RegionId common.Region |
| 22 | ForwardTableId string |
| 23 | common.Pagination |
| 24 | } |
| 25 | |
| 26 | type ForwardTableEntrySetType struct { |
| 27 | RegionId common.Region |
| 28 | ExternalIp string |
| 29 | ExternalPort string |
| 30 | ForwardEntryId string |
| 31 | ForwardTableId string |
| 32 | InternalIp string |
| 33 | InternalPort string |
| 34 | IpProtocol string |
| 35 | Status string |
| 36 | } |
| 37 | |
| 38 | type DescribeForwardTableEntriesResponse struct { |
| 39 | common.Response |
| 40 | common.PaginationResult |
| 41 | ForwardTableEntries struct { |
| 42 | ForwardTableEntry []ForwardTableEntrySetType |
| 43 | } |
| 44 | } |
| 45 | |
| 46 | type ModifyForwardEntryArgs struct { |
| 47 | RegionId common.Region |
| 48 | ForwardTableId string |
| 49 | ForwardEntryId string |
| 50 | ExternalIp string |
| 51 | IpProtocol string |
| 52 | ExternalPort string |
| 53 | InternalIp string |
| 54 | InternalPort string |
| 55 | } |
| 56 | |
| 57 | type ModifyForwardEntryResponse struct { |
| 58 | common.Response |
| 59 | } |
| 60 | |
| 61 | type DeleteForwardEntryArgs struct { |
| 62 | RegionId common.Region |
| 63 | ForwardTableId string |
| 64 | ForwardEntryId string |
| 65 | } |
| 66 | |
| 67 | type DeleteForwardEntryResponse struct { |
| 68 | common.Response |
| 69 | } |
| 70 | |
| 71 | func (client *Client) CreateForwardEntry(args *CreateForwardEntryArgs) (resp *CreateForwardEntryResponse, err error) { |
| 72 | response := CreateForwardEntryResponse{} |
| 73 | err = client.Invoke("CreateForwardEntry", args, &response) |
| 74 | if err != nil { |
| 75 | return nil, err |
| 76 | } |
| 77 | return &response, err |
| 78 | } |
| 79 | |
| 80 | func (client *Client) DescribeForwardTableEntries(args *DescribeForwardTableEntriesArgs) (forwardTableEntries []ForwardTableEntrySetType, |
| 81 | pagination *common.PaginationResult, err error) { |
| 82 | response, err := client.DescribeForwardTableEntriesWithRaw(args) |
| 83 | if err != nil { |
| 84 | return nil, nil, err |
| 85 | } |
| 86 | |
| 87 | return response.ForwardTableEntries.ForwardTableEntry, &response.PaginationResult, nil |
| 88 | } |
| 89 | |
| 90 | func (client *Client) DescribeForwardTableEntriesWithRaw(args *DescribeForwardTableEntriesArgs) (response *DescribeForwardTableEntriesResponse, err error) { |
| 91 | args.Validate() |
| 92 | response = &DescribeForwardTableEntriesResponse{} |
| 93 | |
| 94 | err = client.Invoke("DescribeForwardTableEntries", args, response) |
| 95 | |
| 96 | if err != nil { |
| 97 | return nil, err |
| 98 | } |
| 99 | |
| 100 | return response, nil |
| 101 | } |
| 102 | |
| 103 | func (client *Client) ModifyForwardEntry(args *ModifyForwardEntryArgs) error { |
| 104 | response := ModifyForwardEntryResponse{} |
| 105 | return client.Invoke("ModifyForwardEntry", args, &response) |
| 106 | } |
| 107 | |
| 108 | func (client *Client) DeleteForwardEntry(args *DeleteForwardEntryArgs) error { |
| 109 | response := DeleteForwardEntryResponse{} |
| 110 | err := client.Invoke("DeleteForwardEntry", args, &response) |
| 111 | return err |
| 112 | } |