common.go raw
1 package protocol
2
3 //go:generate python doc2struct.py
4
5 import (
6 "fmt"
7 "reflect"
8 )
9
10 type CommonArg interface {
11 APIName() string
12 Method() string
13 URI() string
14 Document() string
15 JPName() string
16 }
17
18 type CommonResponse struct {
19 RequestId string
20 ErrorResponse struct {
21 RequestId string
22 ErrorType string
23 ErrorMessage string
24 }
25 }
26
27 var APIlist []CommonArg
28
29 var TypeMap = map[string]reflect.Type{}
30
31 type ResourceRecord struct {
32 Id string `json:",omitempty"`
33 Status string
34 Owner string
35 TTL string
36 RecordType string
37 RData string
38 }
39
40 func (r *ResourceRecord) String() string {
41 return fmt.Sprintf("%s %s IN %s %s", r.Owner, r.TTL, r.RecordType, r.RData)
42 }
43
44 func (r *ResourceRecord) FQDN(zone string) string {
45 return fmt.Sprintf("%s.%s %s IN %s %s", r.Owner, zone, r.TTL, r.RecordType, r.RData)
46 }
47
48 const (
49 UNCAHNGED = "UNCHANGED"
50 ADDING = "ADDING"
51 DELETING = "DELETING"
52 DELETED = "DELETED"
53 )
54