3
// Copyright (c) Microsoft and contributors. All rights reserved.
5
// Licensed under the Apache License, Version 2.0 (the "License");
6
// you may not use this file except in compliance with the License.
7
// You may obtain a copy of the License at
8
// http://www.apache.org/licenses/LICENSE-2.0
10
// Unless required by applicable law or agreed to in writing, software
11
// distributed under the License is distributed on an "AS IS" BASIS,
12
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
// See the License for the specific language governing permissions and
15
// limitations under the License.
17
// Code generated by Microsoft (R) AutoRest Code Generator 0.12.0.0
18
// Changes may cause incorrect behavior and will be lost if the code is
22
"github.com/Azure/azure-sdk-for-go/Godeps/_workspace/src/github.com/Azure/go-autorest/autorest"
27
// PublicIPAddressesClient is the the Windows Azure Network management API
28
// provides a RESTful set of web services that interact with Windows Azure
29
// Networks service to manage your network resrources. The API has entities
30
// that capture the relationship between an end user and the Windows Azure
32
type PublicIPAddressesClient struct {
36
// NewPublicIPAddressesClient creates an instance of the
37
// PublicIPAddressesClient client.
38
func NewPublicIPAddressesClient(subscriptionID string) PublicIPAddressesClient {
39
return NewPublicIPAddressesClientWithBaseURI(DefaultBaseURI, subscriptionID)
42
// NewPublicIPAddressesClientWithBaseURI creates an instance of the
43
// PublicIPAddressesClient client.
44
func NewPublicIPAddressesClientWithBaseURI(baseURI string, subscriptionID string) PublicIPAddressesClient {
45
return PublicIPAddressesClient{NewWithBaseURI(baseURI, subscriptionID)}
48
// CreateOrUpdate the Put PublicIPAddress operation creates/updates a
49
// stable/dynamic PublicIP address
51
// resourceGroupName is the name of the resource group. publicIPAddressName is
52
// the name of the publicIpAddress. parameters is parameters supplied to the
53
// create/update PublicIPAddress operation
54
func (client PublicIPAddressesClient) CreateOrUpdate(resourceGroupName string, publicIPAddressName string, parameters PublicIPAddress) (result PublicIPAddress, ae error) {
55
req, err := client.CreateOrUpdatePreparer(resourceGroupName, publicIPAddressName, parameters)
57
return result, autorest.NewErrorWithError(err, "network/PublicIPAddressesClient", "CreateOrUpdate", "Failure preparing request")
60
resp, err := client.CreateOrUpdateSender(req)
62
result.Response = autorest.Response{Response: resp}
63
return result, autorest.NewErrorWithError(err, "network/PublicIPAddressesClient", "CreateOrUpdate", "Failure sending request")
66
result, err = client.CreateOrUpdateResponder(resp)
68
ae = autorest.NewErrorWithError(err, "network/PublicIPAddressesClient", "CreateOrUpdate", "Failure responding to request")
74
// CreateOrUpdatePreparer prepares the CreateOrUpdate request.
75
func (client PublicIPAddressesClient) CreateOrUpdatePreparer(resourceGroupName string, publicIPAddressName string, parameters PublicIPAddress) (*http.Request, error) {
76
pathParameters := map[string]interface{}{
77
"publicIpAddressName": url.QueryEscape(publicIPAddressName),
78
"resourceGroupName": url.QueryEscape(resourceGroupName),
79
"subscriptionId": url.QueryEscape(client.SubscriptionID),
82
queryParameters := map[string]interface{}{
83
"api-version": APIVersion,
86
return autorest.Prepare(&http.Request{},
89
autorest.WithBaseURL(client.BaseURI),
90
autorest.WithPath("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPAddresses/{publicIpAddressName}/"),
91
autorest.WithJSON(parameters),
92
autorest.WithPathParameters(pathParameters),
93
autorest.WithQueryParameters(queryParameters))
96
// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the
97
// http.Response Body if it receives an error.
98
func (client PublicIPAddressesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) {
99
return client.Send(req, http.StatusCreated, http.StatusOK)
102
// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always
103
// closes the http.Response Body.
104
func (client PublicIPAddressesClient) CreateOrUpdateResponder(resp *http.Response) (result PublicIPAddress, err error) {
105
err = autorest.Respond(
107
client.ByInspecting(),
108
autorest.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK),
109
autorest.ByUnmarshallingJSON(&result),
110
autorest.ByClosing())
111
result.Response = autorest.Response{Response: resp}
115
// Delete the delete publicIpAddress operation deletes the specified
118
// resourceGroupName is the name of the resource group. publicIPAddressName is
119
// the name of the subnet.
120
func (client PublicIPAddressesClient) Delete(resourceGroupName string, publicIPAddressName string) (result autorest.Response, ae error) {
121
req, err := client.DeletePreparer(resourceGroupName, publicIPAddressName)
123
return result, autorest.NewErrorWithError(err, "network/PublicIPAddressesClient", "Delete", "Failure preparing request")
126
resp, err := client.DeleteSender(req)
128
result.Response = resp
129
return result, autorest.NewErrorWithError(err, "network/PublicIPAddressesClient", "Delete", "Failure sending request")
132
result, err = client.DeleteResponder(resp)
134
ae = autorest.NewErrorWithError(err, "network/PublicIPAddressesClient", "Delete", "Failure responding to request")
140
// DeletePreparer prepares the Delete request.
141
func (client PublicIPAddressesClient) DeletePreparer(resourceGroupName string, publicIPAddressName string) (*http.Request, error) {
142
pathParameters := map[string]interface{}{
143
"publicIpAddressName": url.QueryEscape(publicIPAddressName),
144
"resourceGroupName": url.QueryEscape(resourceGroupName),
145
"subscriptionId": url.QueryEscape(client.SubscriptionID),
148
queryParameters := map[string]interface{}{
149
"api-version": APIVersion,
152
return autorest.Prepare(&http.Request{},
155
autorest.WithBaseURL(client.BaseURI),
156
autorest.WithPath("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPAddresses/{publicIpAddressName}/"),
157
autorest.WithPathParameters(pathParameters),
158
autorest.WithQueryParameters(queryParameters))
161
// DeleteSender sends the Delete request. The method will close the
162
// http.Response Body if it receives an error.
163
func (client PublicIPAddressesClient) DeleteSender(req *http.Request) (*http.Response, error) {
164
return client.Send(req, http.StatusNoContent, http.StatusAccepted, http.StatusOK)
167
// DeleteResponder handles the response to the Delete request. The method always
168
// closes the http.Response Body.
169
func (client PublicIPAddressesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) {
170
err = autorest.Respond(
172
client.ByInspecting(),
173
autorest.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusAccepted, http.StatusOK),
174
autorest.ByClosing())
175
result.Response = resp
179
// Get the Get publicIpAddress operation retreives information about the
180
// specified pubicIpAddress
182
// resourceGroupName is the name of the resource group. publicIPAddressName is
183
// the name of the subnet.
184
func (client PublicIPAddressesClient) Get(resourceGroupName string, publicIPAddressName string) (result PublicIPAddress, ae error) {
185
req, err := client.GetPreparer(resourceGroupName, publicIPAddressName)
187
return result, autorest.NewErrorWithError(err, "network/PublicIPAddressesClient", "Get", "Failure preparing request")
190
resp, err := client.GetSender(req)
192
result.Response = autorest.Response{Response: resp}
193
return result, autorest.NewErrorWithError(err, "network/PublicIPAddressesClient", "Get", "Failure sending request")
196
result, err = client.GetResponder(resp)
198
ae = autorest.NewErrorWithError(err, "network/PublicIPAddressesClient", "Get", "Failure responding to request")
204
// GetPreparer prepares the Get request.
205
func (client PublicIPAddressesClient) GetPreparer(resourceGroupName string, publicIPAddressName string) (*http.Request, error) {
206
pathParameters := map[string]interface{}{
207
"publicIpAddressName": url.QueryEscape(publicIPAddressName),
208
"resourceGroupName": url.QueryEscape(resourceGroupName),
209
"subscriptionId": url.QueryEscape(client.SubscriptionID),
212
queryParameters := map[string]interface{}{
213
"api-version": APIVersion,
216
return autorest.Prepare(&http.Request{},
219
autorest.WithBaseURL(client.BaseURI),
220
autorest.WithPath("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPAddresses/{publicIpAddressName}/"),
221
autorest.WithPathParameters(pathParameters),
222
autorest.WithQueryParameters(queryParameters))
225
// GetSender sends the Get request. The method will close the
226
// http.Response Body if it receives an error.
227
func (client PublicIPAddressesClient) GetSender(req *http.Request) (*http.Response, error) {
228
return client.Send(req, http.StatusOK)
231
// GetResponder handles the response to the Get request. The method always
232
// closes the http.Response Body.
233
func (client PublicIPAddressesClient) GetResponder(resp *http.Response) (result PublicIPAddress, err error) {
234
err = autorest.Respond(
236
client.ByInspecting(),
237
autorest.WithErrorUnlessStatusCode(http.StatusOK),
238
autorest.ByUnmarshallingJSON(&result),
239
autorest.ByClosing())
240
result.Response = autorest.Response{Response: resp}
244
// List the List publicIpAddress opertion retrieves all the publicIpAddresses
245
// in a resource group.
247
// resourceGroupName is the name of the resource group.
248
func (client PublicIPAddressesClient) List(resourceGroupName string) (result PublicIPAddressListResult, ae error) {
249
req, err := client.ListPreparer(resourceGroupName)
251
return result, autorest.NewErrorWithError(err, "network/PublicIPAddressesClient", "List", "Failure preparing request")
254
resp, err := client.ListSender(req)
256
result.Response = autorest.Response{Response: resp}
257
return result, autorest.NewErrorWithError(err, "network/PublicIPAddressesClient", "List", "Failure sending request")
260
result, err = client.ListResponder(resp)
262
ae = autorest.NewErrorWithError(err, "network/PublicIPAddressesClient", "List", "Failure responding to request")
268
// ListPreparer prepares the List request.
269
func (client PublicIPAddressesClient) ListPreparer(resourceGroupName string) (*http.Request, error) {
270
pathParameters := map[string]interface{}{
271
"resourceGroupName": url.QueryEscape(resourceGroupName),
272
"subscriptionId": url.QueryEscape(client.SubscriptionID),
275
queryParameters := map[string]interface{}{
276
"api-version": APIVersion,
279
return autorest.Prepare(&http.Request{},
282
autorest.WithBaseURL(client.BaseURI),
283
autorest.WithPath("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPAddresses"),
284
autorest.WithPathParameters(pathParameters),
285
autorest.WithQueryParameters(queryParameters))
288
// ListSender sends the List request. The method will close the
289
// http.Response Body if it receives an error.
290
func (client PublicIPAddressesClient) ListSender(req *http.Request) (*http.Response, error) {
291
return client.Send(req, http.StatusOK)
294
// ListResponder handles the response to the List request. The method always
295
// closes the http.Response Body.
296
func (client PublicIPAddressesClient) ListResponder(resp *http.Response) (result PublicIPAddressListResult, err error) {
297
err = autorest.Respond(
299
client.ByInspecting(),
300
autorest.WithErrorUnlessStatusCode(http.StatusOK),
301
autorest.ByUnmarshallingJSON(&result),
302
autorest.ByClosing())
303
result.Response = autorest.Response{Response: resp}
307
// ListNextResults retrieves the next set of results, if any.
308
func (client PublicIPAddressesClient) ListNextResults(lastResults PublicIPAddressListResult) (result PublicIPAddressListResult, ae error) {
309
req, err := lastResults.PublicIPAddressListResultPreparer()
311
return result, autorest.NewErrorWithError(err, "network/PublicIPAddressesClient", "List", "Failure preparing next results request request")
317
resp, err := client.ListSender(req)
319
result.Response = autorest.Response{Response: resp}
320
return result, autorest.NewErrorWithError(err, "network/PublicIPAddressesClient", "List", "Failure sending next results request request")
323
result, err = client.ListResponder(resp)
325
ae = autorest.NewErrorWithError(err, "network/PublicIPAddressesClient", "List", "Failure responding to next results request request")
331
// ListAll the List publicIpAddress opertion retrieves all the
332
// publicIpAddresses in a subscription.
333
func (client PublicIPAddressesClient) ListAll() (result PublicIPAddressListResult, ae error) {
334
req, err := client.ListAllPreparer()
336
return result, autorest.NewErrorWithError(err, "network/PublicIPAddressesClient", "ListAll", "Failure preparing request")
339
resp, err := client.ListAllSender(req)
341
result.Response = autorest.Response{Response: resp}
342
return result, autorest.NewErrorWithError(err, "network/PublicIPAddressesClient", "ListAll", "Failure sending request")
345
result, err = client.ListAllResponder(resp)
347
ae = autorest.NewErrorWithError(err, "network/PublicIPAddressesClient", "ListAll", "Failure responding to request")
353
// ListAllPreparer prepares the ListAll request.
354
func (client PublicIPAddressesClient) ListAllPreparer() (*http.Request, error) {
355
pathParameters := map[string]interface{}{
356
"subscriptionId": url.QueryEscape(client.SubscriptionID),
359
queryParameters := map[string]interface{}{
360
"api-version": APIVersion,
363
return autorest.Prepare(&http.Request{},
366
autorest.WithBaseURL(client.BaseURI),
367
autorest.WithPath("/subscriptions/{subscriptionId}/providers/Microsoft.Network/publicIPAddresses"),
368
autorest.WithPathParameters(pathParameters),
369
autorest.WithQueryParameters(queryParameters))
372
// ListAllSender sends the ListAll request. The method will close the
373
// http.Response Body if it receives an error.
374
func (client PublicIPAddressesClient) ListAllSender(req *http.Request) (*http.Response, error) {
375
return client.Send(req, http.StatusOK)
378
// ListAllResponder handles the response to the ListAll request. The method always
379
// closes the http.Response Body.
380
func (client PublicIPAddressesClient) ListAllResponder(resp *http.Response) (result PublicIPAddressListResult, err error) {
381
err = autorest.Respond(
383
client.ByInspecting(),
384
autorest.WithErrorUnlessStatusCode(http.StatusOK),
385
autorest.ByUnmarshallingJSON(&result),
386
autorest.ByClosing())
387
result.Response = autorest.Response{Response: resp}
391
// ListAllNextResults retrieves the next set of results, if any.
392
func (client PublicIPAddressesClient) ListAllNextResults(lastResults PublicIPAddressListResult) (result PublicIPAddressListResult, ae error) {
393
req, err := lastResults.PublicIPAddressListResultPreparer()
395
return result, autorest.NewErrorWithError(err, "network/PublicIPAddressesClient", "ListAll", "Failure preparing next results request request")
401
resp, err := client.ListAllSender(req)
403
result.Response = autorest.Response{Response: resp}
404
return result, autorest.NewErrorWithError(err, "network/PublicIPAddressesClient", "ListAll", "Failure sending next results request request")
407
result, err = client.ListAllResponder(resp)
409
ae = autorest.NewErrorWithError(err, "network/PublicIPAddressesClient", "ListAll", "Failure responding to next results request request")