~nskaggs/+junk/xenial-test

« back to all changes in this revision

Viewing changes to src/github.com/Azure/azure-sdk-for-go/arm/scheduler/jobcollections.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 scheduler
 
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
// JobCollectionsClient is the client for the JobCollections methods of the
 
28
// Scheduler service.
 
29
type JobCollectionsClient struct {
 
30
        ManagementClient
 
31
}
 
32
 
 
33
// NewJobCollectionsClient creates an instance of the JobCollectionsClient
 
34
// client.
 
35
func NewJobCollectionsClient(subscriptionID string) JobCollectionsClient {
 
36
        return NewJobCollectionsClientWithBaseURI(DefaultBaseURI, subscriptionID)
 
37
}
 
38
 
 
39
// NewJobCollectionsClientWithBaseURI creates an instance of the
 
40
// JobCollectionsClient client.
 
41
func NewJobCollectionsClientWithBaseURI(baseURI string, subscriptionID string) JobCollectionsClient {
 
42
        return JobCollectionsClient{NewWithBaseURI(baseURI, subscriptionID)}
 
43
}
 
44
 
 
45
// CreateOrUpdate provisions a new job collection or updates an existing job
 
46
// collection.
 
47
//
 
48
// resourceGroupName is the resource group name. jobCollectionName is the job
 
49
// collection name. jobCollection is the job collection definition.
 
50
func (client JobCollectionsClient) CreateOrUpdate(resourceGroupName string, jobCollectionName string, jobCollection JobCollectionDefinition) (result JobCollectionDefinition, ae error) {
 
51
        req, err := client.CreateOrUpdatePreparer(resourceGroupName, jobCollectionName, jobCollection)
 
52
        if err != nil {
 
53
                return result, autorest.NewErrorWithError(err, "scheduler/JobCollectionsClient", "CreateOrUpdate", "Failure preparing request")
 
54
        }
 
55
 
 
56
        resp, err := client.CreateOrUpdateSender(req)
 
57
        if err != nil {
 
58
                result.Response = autorest.Response{Response: resp}
 
59
                return result, autorest.NewErrorWithError(err, "scheduler/JobCollectionsClient", "CreateOrUpdate", "Failure sending request")
 
60
        }
 
61
 
 
62
        result, err = client.CreateOrUpdateResponder(resp)
 
63
        if err != nil {
 
64
                ae = autorest.NewErrorWithError(err, "scheduler/JobCollectionsClient", "CreateOrUpdate", "Failure responding to request")
 
65
        }
 
66
 
 
67
        return
 
68
}
 
69
 
 
70
// CreateOrUpdatePreparer prepares the CreateOrUpdate request.
 
71
func (client JobCollectionsClient) CreateOrUpdatePreparer(resourceGroupName string, jobCollectionName string, jobCollection JobCollectionDefinition) (*http.Request, error) {
 
72
        pathParameters := map[string]interface{}{
 
73
                "jobCollectionName": url.QueryEscape(jobCollectionName),
 
74
                "resourceGroupName": url.QueryEscape(resourceGroupName),
 
75
                "subscriptionId":    url.QueryEscape(client.SubscriptionID),
 
76
        }
 
77
 
 
78
        queryParameters := map[string]interface{}{
 
79
                "api-version": APIVersion,
 
80
        }
 
81
 
 
82
        return autorest.Prepare(&http.Request{},
 
83
                autorest.AsJSON(),
 
84
                autorest.AsPut(),
 
85
                autorest.WithBaseURL(client.BaseURI),
 
86
                autorest.WithPath("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Scheduler/jobCollections/{jobCollectionName}"),
 
87
                autorest.WithJSON(jobCollection),
 
88
                autorest.WithPathParameters(pathParameters),
 
89
                autorest.WithQueryParameters(queryParameters))
 
90
}
 
91
 
 
92
// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the
 
93
// http.Response Body if it receives an error.
 
94
func (client JobCollectionsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) {
 
95
        return client.Send(req, http.StatusOK, http.StatusCreated)
 
96
}
 
97
 
 
98
// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always
 
99
// closes the http.Response Body.
 
100
func (client JobCollectionsClient) CreateOrUpdateResponder(resp *http.Response) (result JobCollectionDefinition, err error) {
 
101
        err = autorest.Respond(
 
102
                resp,
 
103
                client.ByInspecting(),
 
104
                autorest.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated),
 
105
                autorest.ByUnmarshallingJSON(&result),
 
106
                autorest.ByClosing())
 
107
        result.Response = autorest.Response{Response: resp}
 
108
        return
 
109
}
 
110
 
 
111
// Delete deletes a job collection.
 
112
//
 
113
// resourceGroupName is the resource group name. jobCollectionName is the job
 
114
// collection name.
 
115
func (client JobCollectionsClient) Delete(resourceGroupName string, jobCollectionName string) (result autorest.Response, ae error) {
 
116
        req, err := client.DeletePreparer(resourceGroupName, jobCollectionName)
 
117
        if err != nil {
 
118
                return result, autorest.NewErrorWithError(err, "scheduler/JobCollectionsClient", "Delete", "Failure preparing request")
 
119
        }
 
120
 
 
121
        resp, err := client.DeleteSender(req)
 
122
        if err != nil {
 
123
                result.Response = resp
 
124
                return result, autorest.NewErrorWithError(err, "scheduler/JobCollectionsClient", "Delete", "Failure sending request")
 
125
        }
 
126
 
 
127
        result, err = client.DeleteResponder(resp)
 
128
        if err != nil {
 
129
                ae = autorest.NewErrorWithError(err, "scheduler/JobCollectionsClient", "Delete", "Failure responding to request")
 
130
        }
 
131
 
 
132
        return
 
133
}
 
134
 
 
135
// DeletePreparer prepares the Delete request.
 
136
func (client JobCollectionsClient) DeletePreparer(resourceGroupName string, jobCollectionName string) (*http.Request, error) {
 
137
        pathParameters := map[string]interface{}{
 
138
                "jobCollectionName": url.QueryEscape(jobCollectionName),
 
139
                "resourceGroupName": url.QueryEscape(resourceGroupName),
 
140
                "subscriptionId":    url.QueryEscape(client.SubscriptionID),
 
141
        }
 
142
 
 
143
        queryParameters := map[string]interface{}{
 
144
                "api-version": APIVersion,
 
145
        }
 
146
 
 
147
        return autorest.Prepare(&http.Request{},
 
148
                autorest.AsJSON(),
 
149
                autorest.AsDelete(),
 
150
                autorest.WithBaseURL(client.BaseURI),
 
151
                autorest.WithPath("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Scheduler/jobCollections/{jobCollectionName}"),
 
152
                autorest.WithPathParameters(pathParameters),
 
153
                autorest.WithQueryParameters(queryParameters))
 
154
}
 
155
 
 
156
// DeleteSender sends the Delete request. The method will close the
 
157
// http.Response Body if it receives an error.
 
158
func (client JobCollectionsClient) DeleteSender(req *http.Request) (*http.Response, error) {
 
159
        return client.Send(req, http.StatusOK)
 
160
}
 
161
 
 
162
// DeleteResponder handles the response to the Delete request. The method always
 
163
// closes the http.Response Body.
 
164
func (client JobCollectionsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) {
 
165
        err = autorest.Respond(
 
166
                resp,
 
167
                client.ByInspecting(),
 
168
                autorest.WithErrorUnlessStatusCode(http.StatusOK),
 
169
                autorest.ByClosing())
 
170
        result.Response = resp
 
171
        return
 
172
}
 
173
 
 
174
// Disable disables all of the jobs in the job collection.
 
175
//
 
176
// resourceGroupName is the resource group name. jobCollectionName is the job
 
177
// collection name.
 
178
func (client JobCollectionsClient) Disable(resourceGroupName string, jobCollectionName string) (result autorest.Response, ae error) {
 
179
        req, err := client.DisablePreparer(resourceGroupName, jobCollectionName)
 
180
        if err != nil {
 
181
                return result, autorest.NewErrorWithError(err, "scheduler/JobCollectionsClient", "Disable", "Failure preparing request")
 
182
        }
 
183
 
 
184
        resp, err := client.DisableSender(req)
 
185
        if err != nil {
 
186
                result.Response = resp
 
187
                return result, autorest.NewErrorWithError(err, "scheduler/JobCollectionsClient", "Disable", "Failure sending request")
 
188
        }
 
189
 
 
190
        result, err = client.DisableResponder(resp)
 
191
        if err != nil {
 
192
                ae = autorest.NewErrorWithError(err, "scheduler/JobCollectionsClient", "Disable", "Failure responding to request")
 
193
        }
 
194
 
 
195
        return
 
196
}
 
197
 
 
198
// DisablePreparer prepares the Disable request.
 
199
func (client JobCollectionsClient) DisablePreparer(resourceGroupName string, jobCollectionName string) (*http.Request, error) {
 
200
        pathParameters := map[string]interface{}{
 
201
                "jobCollectionName": url.QueryEscape(jobCollectionName),
 
202
                "resourceGroupName": url.QueryEscape(resourceGroupName),
 
203
                "subscriptionId":    url.QueryEscape(client.SubscriptionID),
 
204
        }
 
205
 
 
206
        queryParameters := map[string]interface{}{
 
207
                "api-version": APIVersion,
 
208
        }
 
209
 
 
210
        return autorest.Prepare(&http.Request{},
 
211
                autorest.AsJSON(),
 
212
                autorest.AsPost(),
 
213
                autorest.WithBaseURL(client.BaseURI),
 
214
                autorest.WithPath("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Scheduler/jobCollections/{jobCollectionName}/disable"),
 
215
                autorest.WithPathParameters(pathParameters),
 
216
                autorest.WithQueryParameters(queryParameters))
 
217
}
 
218
 
 
219
// DisableSender sends the Disable request. The method will close the
 
220
// http.Response Body if it receives an error.
 
221
func (client JobCollectionsClient) DisableSender(req *http.Request) (*http.Response, error) {
 
222
        return client.Send(req, http.StatusOK)
 
223
}
 
224
 
 
225
// DisableResponder handles the response to the Disable request. The method always
 
226
// closes the http.Response Body.
 
227
func (client JobCollectionsClient) DisableResponder(resp *http.Response) (result autorest.Response, err error) {
 
228
        err = autorest.Respond(
 
229
                resp,
 
230
                client.ByInspecting(),
 
231
                autorest.WithErrorUnlessStatusCode(http.StatusOK),
 
232
                autorest.ByClosing())
 
233
        result.Response = resp
 
234
        return
 
235
}
 
236
 
 
237
// Enable enables all of the jobs in the job collection.
 
238
//
 
239
// resourceGroupName is the resource group name. jobCollectionName is the job
 
240
// collection name.
 
241
func (client JobCollectionsClient) Enable(resourceGroupName string, jobCollectionName string) (result autorest.Response, ae error) {
 
242
        req, err := client.EnablePreparer(resourceGroupName, jobCollectionName)
 
243
        if err != nil {
 
244
                return result, autorest.NewErrorWithError(err, "scheduler/JobCollectionsClient", "Enable", "Failure preparing request")
 
245
        }
 
246
 
 
247
        resp, err := client.EnableSender(req)
 
248
        if err != nil {
 
249
                result.Response = resp
 
250
                return result, autorest.NewErrorWithError(err, "scheduler/JobCollectionsClient", "Enable", "Failure sending request")
 
251
        }
 
252
 
 
253
        result, err = client.EnableResponder(resp)
 
254
        if err != nil {
 
255
                ae = autorest.NewErrorWithError(err, "scheduler/JobCollectionsClient", "Enable", "Failure responding to request")
 
256
        }
 
257
 
 
258
        return
 
259
}
 
260
 
 
261
// EnablePreparer prepares the Enable request.
 
262
func (client JobCollectionsClient) EnablePreparer(resourceGroupName string, jobCollectionName string) (*http.Request, error) {
 
263
        pathParameters := map[string]interface{}{
 
264
                "jobCollectionName": url.QueryEscape(jobCollectionName),
 
265
                "resourceGroupName": url.QueryEscape(resourceGroupName),
 
266
                "subscriptionId":    url.QueryEscape(client.SubscriptionID),
 
267
        }
 
268
 
 
269
        queryParameters := map[string]interface{}{
 
270
                "api-version": APIVersion,
 
271
        }
 
272
 
 
273
        return autorest.Prepare(&http.Request{},
 
274
                autorest.AsJSON(),
 
275
                autorest.AsPost(),
 
276
                autorest.WithBaseURL(client.BaseURI),
 
277
                autorest.WithPath("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Scheduler/jobCollections/{jobCollectionName}/enable"),
 
278
                autorest.WithPathParameters(pathParameters),
 
279
                autorest.WithQueryParameters(queryParameters))
 
280
}
 
281
 
 
282
// EnableSender sends the Enable request. The method will close the
 
283
// http.Response Body if it receives an error.
 
284
func (client JobCollectionsClient) EnableSender(req *http.Request) (*http.Response, error) {
 
285
        return client.Send(req, http.StatusOK)
 
286
}
 
287
 
 
288
// EnableResponder handles the response to the Enable request. The method always
 
289
// closes the http.Response Body.
 
290
func (client JobCollectionsClient) EnableResponder(resp *http.Response) (result autorest.Response, err error) {
 
291
        err = autorest.Respond(
 
292
                resp,
 
293
                client.ByInspecting(),
 
294
                autorest.WithErrorUnlessStatusCode(http.StatusOK),
 
295
                autorest.ByClosing())
 
296
        result.Response = resp
 
297
        return
 
298
}
 
299
 
 
300
// Get gets a job collection.
 
301
//
 
302
// resourceGroupName is the resource group name. jobCollectionName is the job
 
303
// collection name.
 
304
func (client JobCollectionsClient) Get(resourceGroupName string, jobCollectionName string) (result JobCollectionDefinition, ae error) {
 
305
        req, err := client.GetPreparer(resourceGroupName, jobCollectionName)
 
306
        if err != nil {
 
307
                return result, autorest.NewErrorWithError(err, "scheduler/JobCollectionsClient", "Get", "Failure preparing request")
 
308
        }
 
309
 
 
310
        resp, err := client.GetSender(req)
 
311
        if err != nil {
 
312
                result.Response = autorest.Response{Response: resp}
 
313
                return result, autorest.NewErrorWithError(err, "scheduler/JobCollectionsClient", "Get", "Failure sending request")
 
314
        }
 
315
 
 
316
        result, err = client.GetResponder(resp)
 
317
        if err != nil {
 
318
                ae = autorest.NewErrorWithError(err, "scheduler/JobCollectionsClient", "Get", "Failure responding to request")
 
319
        }
 
320
 
 
321
        return
 
322
}
 
323
 
 
324
// GetPreparer prepares the Get request.
 
325
func (client JobCollectionsClient) GetPreparer(resourceGroupName string, jobCollectionName string) (*http.Request, error) {
 
326
        pathParameters := map[string]interface{}{
 
327
                "jobCollectionName": url.QueryEscape(jobCollectionName),
 
328
                "resourceGroupName": url.QueryEscape(resourceGroupName),
 
329
                "subscriptionId":    url.QueryEscape(client.SubscriptionID),
 
330
        }
 
331
 
 
332
        queryParameters := map[string]interface{}{
 
333
                "api-version": APIVersion,
 
334
        }
 
335
 
 
336
        return autorest.Prepare(&http.Request{},
 
337
                autorest.AsJSON(),
 
338
                autorest.AsGet(),
 
339
                autorest.WithBaseURL(client.BaseURI),
 
340
                autorest.WithPath("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Scheduler/jobCollections/{jobCollectionName}"),
 
341
                autorest.WithPathParameters(pathParameters),
 
342
                autorest.WithQueryParameters(queryParameters))
 
343
}
 
344
 
 
345
// GetSender sends the Get request. The method will close the
 
346
// http.Response Body if it receives an error.
 
347
func (client JobCollectionsClient) GetSender(req *http.Request) (*http.Response, error) {
 
348
        return client.Send(req, http.StatusOK)
 
349
}
 
350
 
 
351
// GetResponder handles the response to the Get request. The method always
 
352
// closes the http.Response Body.
 
353
func (client JobCollectionsClient) GetResponder(resp *http.Response) (result JobCollectionDefinition, err error) {
 
354
        err = autorest.Respond(
 
355
                resp,
 
356
                client.ByInspecting(),
 
357
                autorest.WithErrorUnlessStatusCode(http.StatusOK),
 
358
                autorest.ByUnmarshallingJSON(&result),
 
359
                autorest.ByClosing())
 
360
        result.Response = autorest.Response{Response: resp}
 
361
        return
 
362
}
 
363
 
 
364
// ListByResourceGroup gets all job collections under specified resource group.
 
365
//
 
366
// resourceGroupName is the resource group name.
 
367
func (client JobCollectionsClient) ListByResourceGroup(resourceGroupName string) (result JobCollectionListResult, ae error) {
 
368
        req, err := client.ListByResourceGroupPreparer(resourceGroupName)
 
369
        if err != nil {
 
370
                return result, autorest.NewErrorWithError(err, "scheduler/JobCollectionsClient", "ListByResourceGroup", "Failure preparing request")
 
371
        }
 
372
 
 
373
        resp, err := client.ListByResourceGroupSender(req)
 
374
        if err != nil {
 
375
                result.Response = autorest.Response{Response: resp}
 
376
                return result, autorest.NewErrorWithError(err, "scheduler/JobCollectionsClient", "ListByResourceGroup", "Failure sending request")
 
377
        }
 
378
 
 
379
        result, err = client.ListByResourceGroupResponder(resp)
 
380
        if err != nil {
 
381
                ae = autorest.NewErrorWithError(err, "scheduler/JobCollectionsClient", "ListByResourceGroup", "Failure responding to request")
 
382
        }
 
383
 
 
384
        return
 
385
}
 
386
 
 
387
// ListByResourceGroupPreparer prepares the ListByResourceGroup request.
 
388
func (client JobCollectionsClient) ListByResourceGroupPreparer(resourceGroupName string) (*http.Request, error) {
 
389
        pathParameters := map[string]interface{}{
 
390
                "resourceGroupName": url.QueryEscape(resourceGroupName),
 
391
                "subscriptionId":    url.QueryEscape(client.SubscriptionID),
 
392
        }
 
393
 
 
394
        queryParameters := map[string]interface{}{
 
395
                "api-version": APIVersion,
 
396
        }
 
397
 
 
398
        return autorest.Prepare(&http.Request{},
 
399
                autorest.AsJSON(),
 
400
                autorest.AsGet(),
 
401
                autorest.WithBaseURL(client.BaseURI),
 
402
                autorest.WithPath("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Scheduler/jobCollections"),
 
403
                autorest.WithPathParameters(pathParameters),
 
404
                autorest.WithQueryParameters(queryParameters))
 
405
}
 
406
 
 
407
// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the
 
408
// http.Response Body if it receives an error.
 
409
func (client JobCollectionsClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) {
 
410
        return client.Send(req, http.StatusOK)
 
411
}
 
412
 
 
413
// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always
 
414
// closes the http.Response Body.
 
415
func (client JobCollectionsClient) ListByResourceGroupResponder(resp *http.Response) (result JobCollectionListResult, err error) {
 
416
        err = autorest.Respond(
 
417
                resp,
 
418
                client.ByInspecting(),
 
419
                autorest.WithErrorUnlessStatusCode(http.StatusOK),
 
420
                autorest.ByUnmarshallingJSON(&result),
 
421
                autorest.ByClosing())
 
422
        result.Response = autorest.Response{Response: resp}
 
423
        return
 
424
}
 
425
 
 
426
// ListByResourceGroupNextResults retrieves the next set of results, if any.
 
427
func (client JobCollectionsClient) ListByResourceGroupNextResults(lastResults JobCollectionListResult) (result JobCollectionListResult, ae error) {
 
428
        req, err := lastResults.JobCollectionListResultPreparer()
 
429
        if err != nil {
 
430
                return result, autorest.NewErrorWithError(err, "scheduler/JobCollectionsClient", "ListByResourceGroup", "Failure preparing next results request request")
 
431
        }
 
432
        if req == nil {
 
433
                return
 
434
        }
 
435
 
 
436
        resp, err := client.ListByResourceGroupSender(req)
 
437
        if err != nil {
 
438
                result.Response = autorest.Response{Response: resp}
 
439
                return result, autorest.NewErrorWithError(err, "scheduler/JobCollectionsClient", "ListByResourceGroup", "Failure sending next results request request")
 
440
        }
 
441
 
 
442
        result, err = client.ListByResourceGroupResponder(resp)
 
443
        if err != nil {
 
444
                ae = autorest.NewErrorWithError(err, "scheduler/JobCollectionsClient", "ListByResourceGroup", "Failure responding to next results request request")
 
445
        }
 
446
 
 
447
        return
 
448
}
 
449
 
 
450
// ListBySubscription gets all job collections under specified subscription.
 
451
func (client JobCollectionsClient) ListBySubscription() (result JobCollectionListResult, ae error) {
 
452
        req, err := client.ListBySubscriptionPreparer()
 
453
        if err != nil {
 
454
                return result, autorest.NewErrorWithError(err, "scheduler/JobCollectionsClient", "ListBySubscription", "Failure preparing request")
 
455
        }
 
456
 
 
457
        resp, err := client.ListBySubscriptionSender(req)
 
458
        if err != nil {
 
459
                result.Response = autorest.Response{Response: resp}
 
460
                return result, autorest.NewErrorWithError(err, "scheduler/JobCollectionsClient", "ListBySubscription", "Failure sending request")
 
461
        }
 
462
 
 
463
        result, err = client.ListBySubscriptionResponder(resp)
 
464
        if err != nil {
 
465
                ae = autorest.NewErrorWithError(err, "scheduler/JobCollectionsClient", "ListBySubscription", "Failure responding to request")
 
466
        }
 
467
 
 
468
        return
 
469
}
 
470
 
 
471
// ListBySubscriptionPreparer prepares the ListBySubscription request.
 
472
func (client JobCollectionsClient) ListBySubscriptionPreparer() (*http.Request, error) {
 
473
        pathParameters := map[string]interface{}{
 
474
                "subscriptionId": url.QueryEscape(client.SubscriptionID),
 
475
        }
 
476
 
 
477
        queryParameters := map[string]interface{}{
 
478
                "api-version": APIVersion,
 
479
        }
 
480
 
 
481
        return autorest.Prepare(&http.Request{},
 
482
                autorest.AsJSON(),
 
483
                autorest.AsGet(),
 
484
                autorest.WithBaseURL(client.BaseURI),
 
485
                autorest.WithPath("/subscriptions/{subscriptionId}/providers/Microsoft.Scheduler/jobCollections"),
 
486
                autorest.WithPathParameters(pathParameters),
 
487
                autorest.WithQueryParameters(queryParameters))
 
488
}
 
489
 
 
490
// ListBySubscriptionSender sends the ListBySubscription request. The method will close the
 
491
// http.Response Body if it receives an error.
 
492
func (client JobCollectionsClient) ListBySubscriptionSender(req *http.Request) (*http.Response, error) {
 
493
        return client.Send(req, http.StatusOK)
 
494
}
 
495
 
 
496
// ListBySubscriptionResponder handles the response to the ListBySubscription request. The method always
 
497
// closes the http.Response Body.
 
498
func (client JobCollectionsClient) ListBySubscriptionResponder(resp *http.Response) (result JobCollectionListResult, err error) {
 
499
        err = autorest.Respond(
 
500
                resp,
 
501
                client.ByInspecting(),
 
502
                autorest.WithErrorUnlessStatusCode(http.StatusOK),
 
503
                autorest.ByUnmarshallingJSON(&result),
 
504
                autorest.ByClosing())
 
505
        result.Response = autorest.Response{Response: resp}
 
506
        return
 
507
}
 
508
 
 
509
// ListBySubscriptionNextResults retrieves the next set of results, if any.
 
510
func (client JobCollectionsClient) ListBySubscriptionNextResults(lastResults JobCollectionListResult) (result JobCollectionListResult, ae error) {
 
511
        req, err := lastResults.JobCollectionListResultPreparer()
 
512
        if err != nil {
 
513
                return result, autorest.NewErrorWithError(err, "scheduler/JobCollectionsClient", "ListBySubscription", "Failure preparing next results request request")
 
514
        }
 
515
        if req == nil {
 
516
                return
 
517
        }
 
518
 
 
519
        resp, err := client.ListBySubscriptionSender(req)
 
520
        if err != nil {
 
521
                result.Response = autorest.Response{Response: resp}
 
522
                return result, autorest.NewErrorWithError(err, "scheduler/JobCollectionsClient", "ListBySubscription", "Failure sending next results request request")
 
523
        }
 
524
 
 
525
        result, err = client.ListBySubscriptionResponder(resp)
 
526
        if err != nil {
 
527
                ae = autorest.NewErrorWithError(err, "scheduler/JobCollectionsClient", "ListBySubscription", "Failure responding to next results request request")
 
528
        }
 
529
 
 
530
        return
 
531
}
 
532
 
 
533
// Patch patches an existing job collection.
 
534
//
 
535
// resourceGroupName is the resource group name. jobCollectionName is the job
 
536
// collection name. jobCollection is the job collection definition.
 
537
func (client JobCollectionsClient) Patch(resourceGroupName string, jobCollectionName string, jobCollection JobCollectionDefinition) (result JobCollectionDefinition, ae error) {
 
538
        req, err := client.PatchPreparer(resourceGroupName, jobCollectionName, jobCollection)
 
539
        if err != nil {
 
540
                return result, autorest.NewErrorWithError(err, "scheduler/JobCollectionsClient", "Patch", "Failure preparing request")
 
541
        }
 
542
 
 
543
        resp, err := client.PatchSender(req)
 
544
        if err != nil {
 
545
                result.Response = autorest.Response{Response: resp}
 
546
                return result, autorest.NewErrorWithError(err, "scheduler/JobCollectionsClient", "Patch", "Failure sending request")
 
547
        }
 
548
 
 
549
        result, err = client.PatchResponder(resp)
 
550
        if err != nil {
 
551
                ae = autorest.NewErrorWithError(err, "scheduler/JobCollectionsClient", "Patch", "Failure responding to request")
 
552
        }
 
553
 
 
554
        return
 
555
}
 
556
 
 
557
// PatchPreparer prepares the Patch request.
 
558
func (client JobCollectionsClient) PatchPreparer(resourceGroupName string, jobCollectionName string, jobCollection JobCollectionDefinition) (*http.Request, error) {
 
559
        pathParameters := map[string]interface{}{
 
560
                "jobCollectionName": url.QueryEscape(jobCollectionName),
 
561
                "resourceGroupName": url.QueryEscape(resourceGroupName),
 
562
                "subscriptionId":    url.QueryEscape(client.SubscriptionID),
 
563
        }
 
564
 
 
565
        queryParameters := map[string]interface{}{
 
566
                "api-version": APIVersion,
 
567
        }
 
568
 
 
569
        return autorest.Prepare(&http.Request{},
 
570
                autorest.AsJSON(),
 
571
                autorest.AsPatch(),
 
572
                autorest.WithBaseURL(client.BaseURI),
 
573
                autorest.WithPath("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Scheduler/jobCollections/{jobCollectionName}"),
 
574
                autorest.WithJSON(jobCollection),
 
575
                autorest.WithPathParameters(pathParameters),
 
576
                autorest.WithQueryParameters(queryParameters))
 
577
}
 
578
 
 
579
// PatchSender sends the Patch request. The method will close the
 
580
// http.Response Body if it receives an error.
 
581
func (client JobCollectionsClient) PatchSender(req *http.Request) (*http.Response, error) {
 
582
        return client.Send(req, http.StatusOK)
 
583
}
 
584
 
 
585
// PatchResponder handles the response to the Patch request. The method always
 
586
// closes the http.Response Body.
 
587
func (client JobCollectionsClient) PatchResponder(resp *http.Response) (result JobCollectionDefinition, err error) {
 
588
        err = autorest.Respond(
 
589
                resp,
 
590
                client.ByInspecting(),
 
591
                autorest.WithErrorUnlessStatusCode(http.StatusOK),
 
592
                autorest.ByUnmarshallingJSON(&result),
 
593
                autorest.ByClosing())
 
594
        result.Response = autorest.Response{Response: resp}
 
595
        return
 
596
}