-
Notifications
You must be signed in to change notification settings - Fork 6
/
resource_phonenumber_schema.go
163 lines (161 loc) · 6.1 KB
/
resource_phonenumber_schema.go
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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
package main
import "github.com/hashicorp/terraform/helper/schema"
func resourcePhonenumber() *schema.Resource {
return &schema.Resource{
Schema: map[string]*schema.Schema{
"name": &schema.Schema{
Type: schema.TypeString,
Description: "\"FriendlyName\": A human readable description of the new incoming phone number resource, with maximum length 64 characters",
Required: true,
},
"iso_country_code": &schema.Schema{
Type: schema.TypeString,
Description: "ISO 3166-1 alpha-2 code of country in which to buy a phone number",
Optional: true,
Default: "US",
ForceNew: true,
},
"location": &schema.Schema{
Type: schema.TypeSet,
Description: "Information to use in targetting the number to buy",
Optional: true,
ForceNew: true,
MaxItems: 1,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"near_number": &schema.Schema{
Type: schema.TypeString,
Description: "Given a phone number, find a geographically close number within Distance miles. Distance defaults to 25 miles.",
Optional: true,
},
"near_lat_long": &schema.Schema{
Type: schema.TypeSet,
Description: "Given a latitude/longitude pair lat,long find geographically close numbers within Distance miles.",
Optional: true,
MaxItems: 1,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"latitude": &schema.Schema{
Type: schema.TypeFloat,
Required: true,
},
"longitude": &schema.Schema{
Type: schema.TypeFloat,
Required: true,
},
},
},
},
"distance": &schema.Schema{
Type: schema.TypeInt,
Description: "Specifies the search radius for a Near- query in miles. If not specified this defaults to 25 miles. Maximum searchable distance is 500 miles.",
Optional: true,
Default: 25,
},
"postal_code": &schema.Schema{
Type: schema.TypeString,
Description: "Limit results to a particular postal code. Given a phone number, search within the same postal code as that number.",
Optional: true,
},
"region": &schema.Schema{
Type: schema.TypeString,
Description: "Limit results to a particular region (i.e. State/Province). Given a phone number, search within the same Region as that number.",
Optional: true,
},
"rate_center": &schema.Schema{
Type: schema.TypeString,
Description: "Limit results to a specific rate center, or given a phone number search within the same rate center as that number. Requires InLata to be set as well.",
Optional: true,
},
"lata": &schema.Schema{
Type: schema.TypeString,
Description: "Limit results to a specific Local access and transport area (LATA). Given a phone number, search within the same LATA as that number.",
Optional: true,
},
},
},
},
"phone_number": &schema.Schema{
Type: schema.TypeString,
Description: "The actual phone number purchased",
Computed: true,
},
"api_version": &schema.Schema{
Type: schema.TypeString,
Description: "Calls to this phone number will start a new TwiML session with this API version. Either 2010-04-01 or 2008-08-01.",
Optional: true,
Computed: true,
},
"voice_caller_id_lookup": &schema.Schema{
Type: schema.TypeBool,
Description: "Do a lookup of a caller's name from the CNAM database and post it to your app. Either true or false.",
Optional: true,
Computed: true,
},
"voice_url": &schema.Schema{
Type: schema.TypeString,
Description: "The URL that Twilio should request when somebody dials the phone number",
Optional: true,
Computed: true,
},
"voice_method": &schema.Schema{
Type: schema.TypeString,
Description: "The HTTP method that should be used to request the VoiceUrl. Either GET or POST.",
Optional: true,
Computed: true,
},
"voice_fallback_url": &schema.Schema{
Type: schema.TypeString,
Description: "A URL that Twilio will request if an error occurs requesting or executing the TwiML defined by VoiceUrl.",
Optional: true,
Computed: true,
},
"voice_fallback_method": &schema.Schema{
Type: schema.TypeString,
Description: "The HTTP method that should be used to request the VoiceFallbackUrl. Either GET or POST.",
Optional: true,
Computed: true,
},
"sms_url": &schema.Schema{
Type: schema.TypeString,
Description: "The URL that Twilio should request when somebody sends an SMS to the new phone number.",
Optional: true,
Computed: true,
},
"sms_method": &schema.Schema{
Type: schema.TypeString,
Description: "The HTTP method that should be used to request the SmsUrl. Either GET or POST.",
Optional: true,
Computed: true,
},
"sms_fallback_url": &schema.Schema{
Type: schema.TypeString,
Description: "A URL that Twilio will request if an error occurs requesting or executing the TwiML defined by SmsUrl.",
Optional: true,
Computed: true,
},
"sms_fallback_method": &schema.Schema{
Type: schema.TypeString,
Description: "The HTTP method that should be used to request the SmsFallbackUrl. Either GET or POST.",
Optional: true,
Computed: true,
},
"status_callback": &schema.Schema{
Type: schema.TypeString,
Description: "The URL that Twilio will request to pass status parameters (such as call ended) to your application",
Optional: true,
Computed: true,
},
"status_callback_method": &schema.Schema{
Type: schema.TypeString,
Description: "The HTTP method Twilio will use to make requests to the StatusCallback URL. Either GET or POST",
Optional: true,
Computed: true,
},
},
Create: phonenumberCreate,
Read: phonenumberRead,
Update: phonenumberUpdate,
Delete: phonenumberDelete,
}
}