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
// JobCollectionsClient is the client for the JobCollections methods of the
29
type JobCollectionsClient struct {
33
// NewJobCollectionsClient creates an instance of the JobCollectionsClient
35
func NewJobCollectionsClient(subscriptionID string) JobCollectionsClient {
36
return NewJobCollectionsClientWithBaseURI(DefaultBaseURI, subscriptionID)
39
// NewJobCollectionsClientWithBaseURI creates an instance of the
40
// JobCollectionsClient client.
41
func NewJobCollectionsClientWithBaseURI(baseURI string, subscriptionID string) JobCollectionsClient {
42
return JobCollectionsClient{NewWithBaseURI(baseURI, subscriptionID)}
45
// CreateOrUpdate provisions a new job collection or updates an existing job
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)
53
return result, autorest.NewErrorWithError(err, "scheduler/JobCollectionsClient", "CreateOrUpdate", "Failure preparing request")
56
resp, err := client.CreateOrUpdateSender(req)
58
result.Response = autorest.Response{Response: resp}
59
return result, autorest.NewErrorWithError(err, "scheduler/JobCollectionsClient", "CreateOrUpdate", "Failure sending request")
62
result, err = client.CreateOrUpdateResponder(resp)
64
ae = autorest.NewErrorWithError(err, "scheduler/JobCollectionsClient", "CreateOrUpdate", "Failure responding to request")
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),
78
queryParameters := map[string]interface{}{
79
"api-version": APIVersion,
82
return autorest.Prepare(&http.Request{},
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))
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)
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(
103
client.ByInspecting(),
104
autorest.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated),
105
autorest.ByUnmarshallingJSON(&result),
106
autorest.ByClosing())
107
result.Response = autorest.Response{Response: resp}
111
// Delete deletes a job collection.
113
// resourceGroupName is the resource group name. jobCollectionName is the job
115
func (client JobCollectionsClient) Delete(resourceGroupName string, jobCollectionName string) (result autorest.Response, ae error) {
116
req, err := client.DeletePreparer(resourceGroupName, jobCollectionName)
118
return result, autorest.NewErrorWithError(err, "scheduler/JobCollectionsClient", "Delete", "Failure preparing request")
121
resp, err := client.DeleteSender(req)
123
result.Response = resp
124
return result, autorest.NewErrorWithError(err, "scheduler/JobCollectionsClient", "Delete", "Failure sending request")
127
result, err = client.DeleteResponder(resp)
129
ae = autorest.NewErrorWithError(err, "scheduler/JobCollectionsClient", "Delete", "Failure responding to request")
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),
143
queryParameters := map[string]interface{}{
144
"api-version": APIVersion,
147
return autorest.Prepare(&http.Request{},
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))
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)
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(
167
client.ByInspecting(),
168
autorest.WithErrorUnlessStatusCode(http.StatusOK),
169
autorest.ByClosing())
170
result.Response = resp
174
// Disable disables all of the jobs in the job collection.
176
// resourceGroupName is the resource group name. jobCollectionName is the job
178
func (client JobCollectionsClient) Disable(resourceGroupName string, jobCollectionName string) (result autorest.Response, ae error) {
179
req, err := client.DisablePreparer(resourceGroupName, jobCollectionName)
181
return result, autorest.NewErrorWithError(err, "scheduler/JobCollectionsClient", "Disable", "Failure preparing request")
184
resp, err := client.DisableSender(req)
186
result.Response = resp
187
return result, autorest.NewErrorWithError(err, "scheduler/JobCollectionsClient", "Disable", "Failure sending request")
190
result, err = client.DisableResponder(resp)
192
ae = autorest.NewErrorWithError(err, "scheduler/JobCollectionsClient", "Disable", "Failure responding to request")
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),
206
queryParameters := map[string]interface{}{
207
"api-version": APIVersion,
210
return autorest.Prepare(&http.Request{},
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))
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)
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(
230
client.ByInspecting(),
231
autorest.WithErrorUnlessStatusCode(http.StatusOK),
232
autorest.ByClosing())
233
result.Response = resp
237
// Enable enables all of the jobs in the job collection.
239
// resourceGroupName is the resource group name. jobCollectionName is the job
241
func (client JobCollectionsClient) Enable(resourceGroupName string, jobCollectionName string) (result autorest.Response, ae error) {
242
req, err := client.EnablePreparer(resourceGroupName, jobCollectionName)
244
return result, autorest.NewErrorWithError(err, "scheduler/JobCollectionsClient", "Enable", "Failure preparing request")
247
resp, err := client.EnableSender(req)
249
result.Response = resp
250
return result, autorest.NewErrorWithError(err, "scheduler/JobCollectionsClient", "Enable", "Failure sending request")
253
result, err = client.EnableResponder(resp)
255
ae = autorest.NewErrorWithError(err, "scheduler/JobCollectionsClient", "Enable", "Failure responding to request")
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),
269
queryParameters := map[string]interface{}{
270
"api-version": APIVersion,
273
return autorest.Prepare(&http.Request{},
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))
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)
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(
293
client.ByInspecting(),
294
autorest.WithErrorUnlessStatusCode(http.StatusOK),
295
autorest.ByClosing())
296
result.Response = resp
300
// Get gets a job collection.
302
// resourceGroupName is the resource group name. jobCollectionName is the job
304
func (client JobCollectionsClient) Get(resourceGroupName string, jobCollectionName string) (result JobCollectionDefinition, ae error) {
305
req, err := client.GetPreparer(resourceGroupName, jobCollectionName)
307
return result, autorest.NewErrorWithError(err, "scheduler/JobCollectionsClient", "Get", "Failure preparing request")
310
resp, err := client.GetSender(req)
312
result.Response = autorest.Response{Response: resp}
313
return result, autorest.NewErrorWithError(err, "scheduler/JobCollectionsClient", "Get", "Failure sending request")
316
result, err = client.GetResponder(resp)
318
ae = autorest.NewErrorWithError(err, "scheduler/JobCollectionsClient", "Get", "Failure responding to request")
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),
332
queryParameters := map[string]interface{}{
333
"api-version": APIVersion,
336
return autorest.Prepare(&http.Request{},
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))
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)
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(
356
client.ByInspecting(),
357
autorest.WithErrorUnlessStatusCode(http.StatusOK),
358
autorest.ByUnmarshallingJSON(&result),
359
autorest.ByClosing())
360
result.Response = autorest.Response{Response: resp}
364
// ListByResourceGroup gets all job collections under specified resource group.
366
// resourceGroupName is the resource group name.
367
func (client JobCollectionsClient) ListByResourceGroup(resourceGroupName string) (result JobCollectionListResult, ae error) {
368
req, err := client.ListByResourceGroupPreparer(resourceGroupName)
370
return result, autorest.NewErrorWithError(err, "scheduler/JobCollectionsClient", "ListByResourceGroup", "Failure preparing request")
373
resp, err := client.ListByResourceGroupSender(req)
375
result.Response = autorest.Response{Response: resp}
376
return result, autorest.NewErrorWithError(err, "scheduler/JobCollectionsClient", "ListByResourceGroup", "Failure sending request")
379
result, err = client.ListByResourceGroupResponder(resp)
381
ae = autorest.NewErrorWithError(err, "scheduler/JobCollectionsClient", "ListByResourceGroup", "Failure responding to request")
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),
394
queryParameters := map[string]interface{}{
395
"api-version": APIVersion,
398
return autorest.Prepare(&http.Request{},
401
autorest.WithBaseURL(client.BaseURI),
402
autorest.WithPath("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Scheduler/jobCollections"),
403
autorest.WithPathParameters(pathParameters),
404
autorest.WithQueryParameters(queryParameters))
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)
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(
418
client.ByInspecting(),
419
autorest.WithErrorUnlessStatusCode(http.StatusOK),
420
autorest.ByUnmarshallingJSON(&result),
421
autorest.ByClosing())
422
result.Response = autorest.Response{Response: resp}
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()
430
return result, autorest.NewErrorWithError(err, "scheduler/JobCollectionsClient", "ListByResourceGroup", "Failure preparing next results request request")
436
resp, err := client.ListByResourceGroupSender(req)
438
result.Response = autorest.Response{Response: resp}
439
return result, autorest.NewErrorWithError(err, "scheduler/JobCollectionsClient", "ListByResourceGroup", "Failure sending next results request request")
442
result, err = client.ListByResourceGroupResponder(resp)
444
ae = autorest.NewErrorWithError(err, "scheduler/JobCollectionsClient", "ListByResourceGroup", "Failure responding to next results request request")
450
// ListBySubscription gets all job collections under specified subscription.
451
func (client JobCollectionsClient) ListBySubscription() (result JobCollectionListResult, ae error) {
452
req, err := client.ListBySubscriptionPreparer()
454
return result, autorest.NewErrorWithError(err, "scheduler/JobCollectionsClient", "ListBySubscription", "Failure preparing request")
457
resp, err := client.ListBySubscriptionSender(req)
459
result.Response = autorest.Response{Response: resp}
460
return result, autorest.NewErrorWithError(err, "scheduler/JobCollectionsClient", "ListBySubscription", "Failure sending request")
463
result, err = client.ListBySubscriptionResponder(resp)
465
ae = autorest.NewErrorWithError(err, "scheduler/JobCollectionsClient", "ListBySubscription", "Failure responding to request")
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),
477
queryParameters := map[string]interface{}{
478
"api-version": APIVersion,
481
return autorest.Prepare(&http.Request{},
484
autorest.WithBaseURL(client.BaseURI),
485
autorest.WithPath("/subscriptions/{subscriptionId}/providers/Microsoft.Scheduler/jobCollections"),
486
autorest.WithPathParameters(pathParameters),
487
autorest.WithQueryParameters(queryParameters))
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)
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(
501
client.ByInspecting(),
502
autorest.WithErrorUnlessStatusCode(http.StatusOK),
503
autorest.ByUnmarshallingJSON(&result),
504
autorest.ByClosing())
505
result.Response = autorest.Response{Response: resp}
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()
513
return result, autorest.NewErrorWithError(err, "scheduler/JobCollectionsClient", "ListBySubscription", "Failure preparing next results request request")
519
resp, err := client.ListBySubscriptionSender(req)
521
result.Response = autorest.Response{Response: resp}
522
return result, autorest.NewErrorWithError(err, "scheduler/JobCollectionsClient", "ListBySubscription", "Failure sending next results request request")
525
result, err = client.ListBySubscriptionResponder(resp)
527
ae = autorest.NewErrorWithError(err, "scheduler/JobCollectionsClient", "ListBySubscription", "Failure responding to next results request request")
533
// Patch patches an existing job collection.
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)
540
return result, autorest.NewErrorWithError(err, "scheduler/JobCollectionsClient", "Patch", "Failure preparing request")
543
resp, err := client.PatchSender(req)
545
result.Response = autorest.Response{Response: resp}
546
return result, autorest.NewErrorWithError(err, "scheduler/JobCollectionsClient", "Patch", "Failure sending request")
549
result, err = client.PatchResponder(resp)
551
ae = autorest.NewErrorWithError(err, "scheduler/JobCollectionsClient", "Patch", "Failure responding to request")
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),
565
queryParameters := map[string]interface{}{
566
"api-version": APIVersion,
569
return autorest.Prepare(&http.Request{},
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))
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)
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(
590
client.ByInspecting(),
591
autorest.WithErrorUnlessStatusCode(http.StatusOK),
592
autorest.ByUnmarshallingJSON(&result),
593
autorest.ByClosing())
594
result.Response = autorest.Response{Response: resp}