~nskaggs/+junk/xenial-test

« back to all changes in this revision

Viewing changes to src/github.com/Azure/azure-sdk-for-go/arm/network/publicipaddresses.go

  • Committer: Nicholas Skaggs
  • Date: 2016-10-24 20:56:05 UTC
  • Revision ID: nicholas.skaggs@canonical.com-20161024205605-z8lta0uvuhtxwzwl
Initi with beta15

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
package network
 
2
 
 
3
// Copyright (c) Microsoft and contributors.  All rights reserved.
 
4
//
 
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
 
9
//
 
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.
 
13
//
 
14
// See the License for the specific language governing permissions and
 
15
// limitations under the License.
 
16
//
 
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
 
19
// regenerated.
 
20
 
 
21
import (
 
22
        "github.com/Azure/azure-sdk-for-go/Godeps/_workspace/src/github.com/Azure/go-autorest/autorest"
 
23
        "net/http"
 
24
        "net/url"
 
25
)
 
26
 
 
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
 
31
// Networks service.
 
32
type PublicIPAddressesClient struct {
 
33
        ManagementClient
 
34
}
 
35
 
 
36
// NewPublicIPAddressesClient creates an instance of the
 
37
// PublicIPAddressesClient client.
 
38
func NewPublicIPAddressesClient(subscriptionID string) PublicIPAddressesClient {
 
39
        return NewPublicIPAddressesClientWithBaseURI(DefaultBaseURI, subscriptionID)
 
40
}
 
41
 
 
42
// NewPublicIPAddressesClientWithBaseURI creates an instance of the
 
43
// PublicIPAddressesClient client.
 
44
func NewPublicIPAddressesClientWithBaseURI(baseURI string, subscriptionID string) PublicIPAddressesClient {
 
45
        return PublicIPAddressesClient{NewWithBaseURI(baseURI, subscriptionID)}
 
46
}
 
47
 
 
48
// CreateOrUpdate the Put PublicIPAddress operation creates/updates a
 
49
// stable/dynamic PublicIP address
 
50
//
 
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)
 
56
        if err != nil {
 
57
                return result, autorest.NewErrorWithError(err, "network/PublicIPAddressesClient", "CreateOrUpdate", "Failure preparing request")
 
58
        }
 
59
 
 
60
        resp, err := client.CreateOrUpdateSender(req)
 
61
        if err != nil {
 
62
                result.Response = autorest.Response{Response: resp}
 
63
                return result, autorest.NewErrorWithError(err, "network/PublicIPAddressesClient", "CreateOrUpdate", "Failure sending request")
 
64
        }
 
65
 
 
66
        result, err = client.CreateOrUpdateResponder(resp)
 
67
        if err != nil {
 
68
                ae = autorest.NewErrorWithError(err, "network/PublicIPAddressesClient", "CreateOrUpdate", "Failure responding to request")
 
69
        }
 
70
 
 
71
        return
 
72
}
 
73
 
 
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),
 
80
        }
 
81
 
 
82
        queryParameters := map[string]interface{}{
 
83
                "api-version": APIVersion,
 
84
        }
 
85
 
 
86
        return autorest.Prepare(&http.Request{},
 
87
                autorest.AsJSON(),
 
88
                autorest.AsPut(),
 
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))
 
94
}
 
95
 
 
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)
 
100
}
 
101
 
 
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(
 
106
                resp,
 
107
                client.ByInspecting(),
 
108
                autorest.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK),
 
109
                autorest.ByUnmarshallingJSON(&result),
 
110
                autorest.ByClosing())
 
111
        result.Response = autorest.Response{Response: resp}
 
112
        return
 
113
}
 
114
 
 
115
// Delete the delete publicIpAddress operation deletes the specified
 
116
// publicIpAddress.
 
117
//
 
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)
 
122
        if err != nil {
 
123
                return result, autorest.NewErrorWithError(err, "network/PublicIPAddressesClient", "Delete", "Failure preparing request")
 
124
        }
 
125
 
 
126
        resp, err := client.DeleteSender(req)
 
127
        if err != nil {
 
128
                result.Response = resp
 
129
                return result, autorest.NewErrorWithError(err, "network/PublicIPAddressesClient", "Delete", "Failure sending request")
 
130
        }
 
131
 
 
132
        result, err = client.DeleteResponder(resp)
 
133
        if err != nil {
 
134
                ae = autorest.NewErrorWithError(err, "network/PublicIPAddressesClient", "Delete", "Failure responding to request")
 
135
        }
 
136
 
 
137
        return
 
138
}
 
139
 
 
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),
 
146
        }
 
147
 
 
148
        queryParameters := map[string]interface{}{
 
149
                "api-version": APIVersion,
 
150
        }
 
151
 
 
152
        return autorest.Prepare(&http.Request{},
 
153
                autorest.AsJSON(),
 
154
                autorest.AsDelete(),
 
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))
 
159
}
 
160
 
 
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)
 
165
}
 
166
 
 
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(
 
171
                resp,
 
172
                client.ByInspecting(),
 
173
                autorest.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusAccepted, http.StatusOK),
 
174
                autorest.ByClosing())
 
175
        result.Response = resp
 
176
        return
 
177
}
 
178
 
 
179
// Get the Get publicIpAddress operation retreives information about the
 
180
// specified pubicIpAddress
 
181
//
 
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)
 
186
        if err != nil {
 
187
                return result, autorest.NewErrorWithError(err, "network/PublicIPAddressesClient", "Get", "Failure preparing request")
 
188
        }
 
189
 
 
190
        resp, err := client.GetSender(req)
 
191
        if err != nil {
 
192
                result.Response = autorest.Response{Response: resp}
 
193
                return result, autorest.NewErrorWithError(err, "network/PublicIPAddressesClient", "Get", "Failure sending request")
 
194
        }
 
195
 
 
196
        result, err = client.GetResponder(resp)
 
197
        if err != nil {
 
198
                ae = autorest.NewErrorWithError(err, "network/PublicIPAddressesClient", "Get", "Failure responding to request")
 
199
        }
 
200
 
 
201
        return
 
202
}
 
203
 
 
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),
 
210
        }
 
211
 
 
212
        queryParameters := map[string]interface{}{
 
213
                "api-version": APIVersion,
 
214
        }
 
215
 
 
216
        return autorest.Prepare(&http.Request{},
 
217
                autorest.AsJSON(),
 
218
                autorest.AsGet(),
 
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))
 
223
}
 
224
 
 
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)
 
229
}
 
230
 
 
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(
 
235
                resp,
 
236
                client.ByInspecting(),
 
237
                autorest.WithErrorUnlessStatusCode(http.StatusOK),
 
238
                autorest.ByUnmarshallingJSON(&result),
 
239
                autorest.ByClosing())
 
240
        result.Response = autorest.Response{Response: resp}
 
241
        return
 
242
}
 
243
 
 
244
// List the List publicIpAddress opertion retrieves all the publicIpAddresses
 
245
// in a resource group.
 
246
//
 
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)
 
250
        if err != nil {
 
251
                return result, autorest.NewErrorWithError(err, "network/PublicIPAddressesClient", "List", "Failure preparing request")
 
252
        }
 
253
 
 
254
        resp, err := client.ListSender(req)
 
255
        if err != nil {
 
256
                result.Response = autorest.Response{Response: resp}
 
257
                return result, autorest.NewErrorWithError(err, "network/PublicIPAddressesClient", "List", "Failure sending request")
 
258
        }
 
259
 
 
260
        result, err = client.ListResponder(resp)
 
261
        if err != nil {
 
262
                ae = autorest.NewErrorWithError(err, "network/PublicIPAddressesClient", "List", "Failure responding to request")
 
263
        }
 
264
 
 
265
        return
 
266
}
 
267
 
 
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),
 
273
        }
 
274
 
 
275
        queryParameters := map[string]interface{}{
 
276
                "api-version": APIVersion,
 
277
        }
 
278
 
 
279
        return autorest.Prepare(&http.Request{},
 
280
                autorest.AsJSON(),
 
281
                autorest.AsGet(),
 
282
                autorest.WithBaseURL(client.BaseURI),
 
283
                autorest.WithPath("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPAddresses"),
 
284
                autorest.WithPathParameters(pathParameters),
 
285
                autorest.WithQueryParameters(queryParameters))
 
286
}
 
287
 
 
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)
 
292
}
 
293
 
 
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(
 
298
                resp,
 
299
                client.ByInspecting(),
 
300
                autorest.WithErrorUnlessStatusCode(http.StatusOK),
 
301
                autorest.ByUnmarshallingJSON(&result),
 
302
                autorest.ByClosing())
 
303
        result.Response = autorest.Response{Response: resp}
 
304
        return
 
305
}
 
306
 
 
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()
 
310
        if err != nil {
 
311
                return result, autorest.NewErrorWithError(err, "network/PublicIPAddressesClient", "List", "Failure preparing next results request request")
 
312
        }
 
313
        if req == nil {
 
314
                return
 
315
        }
 
316
 
 
317
        resp, err := client.ListSender(req)
 
318
        if err != nil {
 
319
                result.Response = autorest.Response{Response: resp}
 
320
                return result, autorest.NewErrorWithError(err, "network/PublicIPAddressesClient", "List", "Failure sending next results request request")
 
321
        }
 
322
 
 
323
        result, err = client.ListResponder(resp)
 
324
        if err != nil {
 
325
                ae = autorest.NewErrorWithError(err, "network/PublicIPAddressesClient", "List", "Failure responding to next results request request")
 
326
        }
 
327
 
 
328
        return
 
329
}
 
330
 
 
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()
 
335
        if err != nil {
 
336
                return result, autorest.NewErrorWithError(err, "network/PublicIPAddressesClient", "ListAll", "Failure preparing request")
 
337
        }
 
338
 
 
339
        resp, err := client.ListAllSender(req)
 
340
        if err != nil {
 
341
                result.Response = autorest.Response{Response: resp}
 
342
                return result, autorest.NewErrorWithError(err, "network/PublicIPAddressesClient", "ListAll", "Failure sending request")
 
343
        }
 
344
 
 
345
        result, err = client.ListAllResponder(resp)
 
346
        if err != nil {
 
347
                ae = autorest.NewErrorWithError(err, "network/PublicIPAddressesClient", "ListAll", "Failure responding to request")
 
348
        }
 
349
 
 
350
        return
 
351
}
 
352
 
 
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),
 
357
        }
 
358
 
 
359
        queryParameters := map[string]interface{}{
 
360
                "api-version": APIVersion,
 
361
        }
 
362
 
 
363
        return autorest.Prepare(&http.Request{},
 
364
                autorest.AsJSON(),
 
365
                autorest.AsGet(),
 
366
                autorest.WithBaseURL(client.BaseURI),
 
367
                autorest.WithPath("/subscriptions/{subscriptionId}/providers/Microsoft.Network/publicIPAddresses"),
 
368
                autorest.WithPathParameters(pathParameters),
 
369
                autorest.WithQueryParameters(queryParameters))
 
370
}
 
371
 
 
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)
 
376
}
 
377
 
 
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(
 
382
                resp,
 
383
                client.ByInspecting(),
 
384
                autorest.WithErrorUnlessStatusCode(http.StatusOK),
 
385
                autorest.ByUnmarshallingJSON(&result),
 
386
                autorest.ByClosing())
 
387
        result.Response = autorest.Response{Response: resp}
 
388
        return
 
389
}
 
390
 
 
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()
 
394
        if err != nil {
 
395
                return result, autorest.NewErrorWithError(err, "network/PublicIPAddressesClient", "ListAll", "Failure preparing next results request request")
 
396
        }
 
397
        if req == nil {
 
398
                return
 
399
        }
 
400
 
 
401
        resp, err := client.ListAllSender(req)
 
402
        if err != nil {
 
403
                result.Response = autorest.Response{Response: resp}
 
404
                return result, autorest.NewErrorWithError(err, "network/PublicIPAddressesClient", "ListAll", "Failure sending next results request request")
 
405
        }
 
406
 
 
407
        result, err = client.ListAllResponder(resp)
 
408
        if err != nil {
 
409
                ae = autorest.NewErrorWithError(err, "network/PublicIPAddressesClient", "ListAll", "Failure responding to next results request request")
 
410
        }
 
411
 
 
412
        return
 
413
}