vendor: add github.com/Azure/azure-sdk-for-go and dependencies

This commit is contained in:
Nick Craig-Wood
2017-08-04 22:54:27 +01:00
parent 132f71d504
commit 91cfcc21ff
958 changed files with 320589 additions and 0 deletions
+53
View File
@@ -0,0 +1,53 @@
// Package scheduler implements the Azure ARM Scheduler service API version
// 2016-03-01.
//
//
package scheduler
// Copyright (c) Microsoft and contributors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
import (
"github.com/Azure/go-autorest/autorest"
)
const (
// DefaultBaseURI is the default URI used for the service Scheduler
DefaultBaseURI = "https://management.azure.com"
)
// ManagementClient is the base client for Scheduler.
type ManagementClient struct {
autorest.Client
BaseURI string
SubscriptionID string
}
// New creates an instance of the ManagementClient client.
func New(subscriptionID string) ManagementClient {
return NewWithBaseURI(DefaultBaseURI, subscriptionID)
}
// NewWithBaseURI creates an instance of the ManagementClient client.
func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient {
return ManagementClient{
Client: autorest.NewClientWithUserAgent(UserAgent()),
BaseURI: baseURI,
SubscriptionID: subscriptionID,
}
}
+661
View File
@@ -0,0 +1,661 @@
package scheduler
// Copyright (c) Microsoft and contributors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
import (
"github.com/Azure/go-autorest/autorest"
"github.com/Azure/go-autorest/autorest/azure"
"net/http"
)
// JobCollectionsClient is the client for the JobCollections methods of the
// Scheduler service.
type JobCollectionsClient struct {
ManagementClient
}
// NewJobCollectionsClient creates an instance of the JobCollectionsClient
// client.
func NewJobCollectionsClient(subscriptionID string) JobCollectionsClient {
return NewJobCollectionsClientWithBaseURI(DefaultBaseURI, subscriptionID)
}
// NewJobCollectionsClientWithBaseURI creates an instance of the
// JobCollectionsClient client.
func NewJobCollectionsClientWithBaseURI(baseURI string, subscriptionID string) JobCollectionsClient {
return JobCollectionsClient{NewWithBaseURI(baseURI, subscriptionID)}
}
// CreateOrUpdate provisions a new job collection or updates an existing job
// collection.
//
// resourceGroupName is the resource group name. jobCollectionName is the job
// collection name. jobCollection is the job collection definition.
func (client JobCollectionsClient) CreateOrUpdate(resourceGroupName string, jobCollectionName string, jobCollection JobCollectionDefinition) (result JobCollectionDefinition, err error) {
req, err := client.CreateOrUpdatePreparer(resourceGroupName, jobCollectionName, jobCollection)
if err != nil {
err = autorest.NewErrorWithError(err, "scheduler.JobCollectionsClient", "CreateOrUpdate", nil, "Failure preparing request")
return
}
resp, err := client.CreateOrUpdateSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "scheduler.JobCollectionsClient", "CreateOrUpdate", resp, "Failure sending request")
return
}
result, err = client.CreateOrUpdateResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "scheduler.JobCollectionsClient", "CreateOrUpdate", resp, "Failure responding to request")
}
return
}
// CreateOrUpdatePreparer prepares the CreateOrUpdate request.
func (client JobCollectionsClient) CreateOrUpdatePreparer(resourceGroupName string, jobCollectionName string, jobCollection JobCollectionDefinition) (*http.Request, error) {
pathParameters := map[string]interface{}{
"jobCollectionName": autorest.Encode("path", jobCollectionName),
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2016-03-01"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsJSON(),
autorest.AsPut(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Scheduler/jobCollections/{jobCollectionName}", pathParameters),
autorest.WithJSON(jobCollection),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{})
}
// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the
// http.Response Body if it receives an error.
func (client JobCollectionsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req)
}
// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always
// closes the http.Response Body.
func (client JobCollectionsClient) CreateOrUpdateResponder(resp *http.Response) (result JobCollectionDefinition, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
// Delete deletes a job collection. This method may poll for completion.
// Polling can be canceled by passing the cancel channel argument. The channel
// will be used to cancel polling and any outstanding HTTP requests.
//
// resourceGroupName is the resource group name. jobCollectionName is the job
// collection name.
func (client JobCollectionsClient) Delete(resourceGroupName string, jobCollectionName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) {
resultChan := make(chan autorest.Response, 1)
errChan := make(chan error, 1)
go func() {
var err error
var result autorest.Response
defer func() {
resultChan <- result
errChan <- err
close(resultChan)
close(errChan)
}()
req, err := client.DeletePreparer(resourceGroupName, jobCollectionName, cancel)
if err != nil {
err = autorest.NewErrorWithError(err, "scheduler.JobCollectionsClient", "Delete", nil, "Failure preparing request")
return
}
resp, err := client.DeleteSender(req)
if err != nil {
result.Response = resp
err = autorest.NewErrorWithError(err, "scheduler.JobCollectionsClient", "Delete", resp, "Failure sending request")
return
}
result, err = client.DeleteResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "scheduler.JobCollectionsClient", "Delete", resp, "Failure responding to request")
}
}()
return resultChan, errChan
}
// DeletePreparer prepares the Delete request.
func (client JobCollectionsClient) DeletePreparer(resourceGroupName string, jobCollectionName string, cancel <-chan struct{}) (*http.Request, error) {
pathParameters := map[string]interface{}{
"jobCollectionName": autorest.Encode("path", jobCollectionName),
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2016-03-01"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsDelete(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Scheduler/jobCollections/{jobCollectionName}", pathParameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{Cancel: cancel})
}
// DeleteSender sends the Delete request. The method will close the
// http.Response Body if it receives an error.
func (client JobCollectionsClient) DeleteSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client,
req,
azure.DoPollForAsynchronous(client.PollingDelay))
}
// DeleteResponder handles the response to the Delete request. The method always
// closes the http.Response Body.
func (client JobCollectionsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
autorest.ByClosing())
result.Response = resp
return
}
// Disable disables all of the jobs in the job collection. This method may poll
// for completion. Polling can be canceled by passing the cancel channel
// argument. The channel will be used to cancel polling and any outstanding
// HTTP requests.
//
// resourceGroupName is the resource group name. jobCollectionName is the job
// collection name.
func (client JobCollectionsClient) Disable(resourceGroupName string, jobCollectionName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) {
resultChan := make(chan autorest.Response, 1)
errChan := make(chan error, 1)
go func() {
var err error
var result autorest.Response
defer func() {
resultChan <- result
errChan <- err
close(resultChan)
close(errChan)
}()
req, err := client.DisablePreparer(resourceGroupName, jobCollectionName, cancel)
if err != nil {
err = autorest.NewErrorWithError(err, "scheduler.JobCollectionsClient", "Disable", nil, "Failure preparing request")
return
}
resp, err := client.DisableSender(req)
if err != nil {
result.Response = resp
err = autorest.NewErrorWithError(err, "scheduler.JobCollectionsClient", "Disable", resp, "Failure sending request")
return
}
result, err = client.DisableResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "scheduler.JobCollectionsClient", "Disable", resp, "Failure responding to request")
}
}()
return resultChan, errChan
}
// DisablePreparer prepares the Disable request.
func (client JobCollectionsClient) DisablePreparer(resourceGroupName string, jobCollectionName string, cancel <-chan struct{}) (*http.Request, error) {
pathParameters := map[string]interface{}{
"jobCollectionName": autorest.Encode("path", jobCollectionName),
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2016-03-01"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsPost(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Scheduler/jobCollections/{jobCollectionName}/disable", pathParameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{Cancel: cancel})
}
// DisableSender sends the Disable request. The method will close the
// http.Response Body if it receives an error.
func (client JobCollectionsClient) DisableSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client,
req,
azure.DoPollForAsynchronous(client.PollingDelay))
}
// DisableResponder handles the response to the Disable request. The method always
// closes the http.Response Body.
func (client JobCollectionsClient) DisableResponder(resp *http.Response) (result autorest.Response, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
autorest.ByClosing())
result.Response = resp
return
}
// Enable enables all of the jobs in the job collection. This method may poll
// for completion. Polling can be canceled by passing the cancel channel
// argument. The channel will be used to cancel polling and any outstanding
// HTTP requests.
//
// resourceGroupName is the resource group name. jobCollectionName is the job
// collection name.
func (client JobCollectionsClient) Enable(resourceGroupName string, jobCollectionName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) {
resultChan := make(chan autorest.Response, 1)
errChan := make(chan error, 1)
go func() {
var err error
var result autorest.Response
defer func() {
resultChan <- result
errChan <- err
close(resultChan)
close(errChan)
}()
req, err := client.EnablePreparer(resourceGroupName, jobCollectionName, cancel)
if err != nil {
err = autorest.NewErrorWithError(err, "scheduler.JobCollectionsClient", "Enable", nil, "Failure preparing request")
return
}
resp, err := client.EnableSender(req)
if err != nil {
result.Response = resp
err = autorest.NewErrorWithError(err, "scheduler.JobCollectionsClient", "Enable", resp, "Failure sending request")
return
}
result, err = client.EnableResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "scheduler.JobCollectionsClient", "Enable", resp, "Failure responding to request")
}
}()
return resultChan, errChan
}
// EnablePreparer prepares the Enable request.
func (client JobCollectionsClient) EnablePreparer(resourceGroupName string, jobCollectionName string, cancel <-chan struct{}) (*http.Request, error) {
pathParameters := map[string]interface{}{
"jobCollectionName": autorest.Encode("path", jobCollectionName),
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2016-03-01"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsPost(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Scheduler/jobCollections/{jobCollectionName}/enable", pathParameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{Cancel: cancel})
}
// EnableSender sends the Enable request. The method will close the
// http.Response Body if it receives an error.
func (client JobCollectionsClient) EnableSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client,
req,
azure.DoPollForAsynchronous(client.PollingDelay))
}
// EnableResponder handles the response to the Enable request. The method always
// closes the http.Response Body.
func (client JobCollectionsClient) EnableResponder(resp *http.Response) (result autorest.Response, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
autorest.ByClosing())
result.Response = resp
return
}
// Get gets a job collection.
//
// resourceGroupName is the resource group name. jobCollectionName is the job
// collection name.
func (client JobCollectionsClient) Get(resourceGroupName string, jobCollectionName string) (result JobCollectionDefinition, err error) {
req, err := client.GetPreparer(resourceGroupName, jobCollectionName)
if err != nil {
err = autorest.NewErrorWithError(err, "scheduler.JobCollectionsClient", "Get", nil, "Failure preparing request")
return
}
resp, err := client.GetSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "scheduler.JobCollectionsClient", "Get", resp, "Failure sending request")
return
}
result, err = client.GetResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "scheduler.JobCollectionsClient", "Get", resp, "Failure responding to request")
}
return
}
// GetPreparer prepares the Get request.
func (client JobCollectionsClient) GetPreparer(resourceGroupName string, jobCollectionName string) (*http.Request, error) {
pathParameters := map[string]interface{}{
"jobCollectionName": autorest.Encode("path", jobCollectionName),
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2016-03-01"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsGet(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Scheduler/jobCollections/{jobCollectionName}", pathParameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{})
}
// GetSender sends the Get request. The method will close the
// http.Response Body if it receives an error.
func (client JobCollectionsClient) GetSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req)
}
// GetResponder handles the response to the Get request. The method always
// closes the http.Response Body.
func (client JobCollectionsClient) GetResponder(resp *http.Response) (result JobCollectionDefinition, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
// ListByResourceGroup gets all job collections under specified resource group.
//
// resourceGroupName is the resource group name.
func (client JobCollectionsClient) ListByResourceGroup(resourceGroupName string) (result JobCollectionListResult, err error) {
req, err := client.ListByResourceGroupPreparer(resourceGroupName)
if err != nil {
err = autorest.NewErrorWithError(err, "scheduler.JobCollectionsClient", "ListByResourceGroup", nil, "Failure preparing request")
return
}
resp, err := client.ListByResourceGroupSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "scheduler.JobCollectionsClient", "ListByResourceGroup", resp, "Failure sending request")
return
}
result, err = client.ListByResourceGroupResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "scheduler.JobCollectionsClient", "ListByResourceGroup", resp, "Failure responding to request")
}
return
}
// ListByResourceGroupPreparer prepares the ListByResourceGroup request.
func (client JobCollectionsClient) ListByResourceGroupPreparer(resourceGroupName string) (*http.Request, error) {
pathParameters := map[string]interface{}{
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2016-03-01"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsGet(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Scheduler/jobCollections", pathParameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{})
}
// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the
// http.Response Body if it receives an error.
func (client JobCollectionsClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req)
}
// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always
// closes the http.Response Body.
func (client JobCollectionsClient) ListByResourceGroupResponder(resp *http.Response) (result JobCollectionListResult, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
// ListByResourceGroupNextResults retrieves the next set of results, if any.
func (client JobCollectionsClient) ListByResourceGroupNextResults(lastResults JobCollectionListResult) (result JobCollectionListResult, err error) {
req, err := lastResults.JobCollectionListResultPreparer()
if err != nil {
return result, autorest.NewErrorWithError(err, "scheduler.JobCollectionsClient", "ListByResourceGroup", nil, "Failure preparing next results request")
}
if req == nil {
return
}
resp, err := client.ListByResourceGroupSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "scheduler.JobCollectionsClient", "ListByResourceGroup", resp, "Failure sending next results request")
}
result, err = client.ListByResourceGroupResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "scheduler.JobCollectionsClient", "ListByResourceGroup", resp, "Failure responding to next results request")
}
return
}
// ListBySubscription gets all job collections under specified subscription.
func (client JobCollectionsClient) ListBySubscription() (result JobCollectionListResult, err error) {
req, err := client.ListBySubscriptionPreparer()
if err != nil {
err = autorest.NewErrorWithError(err, "scheduler.JobCollectionsClient", "ListBySubscription", nil, "Failure preparing request")
return
}
resp, err := client.ListBySubscriptionSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "scheduler.JobCollectionsClient", "ListBySubscription", resp, "Failure sending request")
return
}
result, err = client.ListBySubscriptionResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "scheduler.JobCollectionsClient", "ListBySubscription", resp, "Failure responding to request")
}
return
}
// ListBySubscriptionPreparer prepares the ListBySubscription request.
func (client JobCollectionsClient) ListBySubscriptionPreparer() (*http.Request, error) {
pathParameters := map[string]interface{}{
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2016-03-01"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsGet(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Scheduler/jobCollections", pathParameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{})
}
// ListBySubscriptionSender sends the ListBySubscription request. The method will close the
// http.Response Body if it receives an error.
func (client JobCollectionsClient) ListBySubscriptionSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req)
}
// ListBySubscriptionResponder handles the response to the ListBySubscription request. The method always
// closes the http.Response Body.
func (client JobCollectionsClient) ListBySubscriptionResponder(resp *http.Response) (result JobCollectionListResult, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
// ListBySubscriptionNextResults retrieves the next set of results, if any.
func (client JobCollectionsClient) ListBySubscriptionNextResults(lastResults JobCollectionListResult) (result JobCollectionListResult, err error) {
req, err := lastResults.JobCollectionListResultPreparer()
if err != nil {
return result, autorest.NewErrorWithError(err, "scheduler.JobCollectionsClient", "ListBySubscription", nil, "Failure preparing next results request")
}
if req == nil {
return
}
resp, err := client.ListBySubscriptionSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "scheduler.JobCollectionsClient", "ListBySubscription", resp, "Failure sending next results request")
}
result, err = client.ListBySubscriptionResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "scheduler.JobCollectionsClient", "ListBySubscription", resp, "Failure responding to next results request")
}
return
}
// Patch patches an existing job collection.
//
// resourceGroupName is the resource group name. jobCollectionName is the job
// collection name. jobCollection is the job collection definition.
func (client JobCollectionsClient) Patch(resourceGroupName string, jobCollectionName string, jobCollection JobCollectionDefinition) (result JobCollectionDefinition, err error) {
req, err := client.PatchPreparer(resourceGroupName, jobCollectionName, jobCollection)
if err != nil {
err = autorest.NewErrorWithError(err, "scheduler.JobCollectionsClient", "Patch", nil, "Failure preparing request")
return
}
resp, err := client.PatchSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "scheduler.JobCollectionsClient", "Patch", resp, "Failure sending request")
return
}
result, err = client.PatchResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "scheduler.JobCollectionsClient", "Patch", resp, "Failure responding to request")
}
return
}
// PatchPreparer prepares the Patch request.
func (client JobCollectionsClient) PatchPreparer(resourceGroupName string, jobCollectionName string, jobCollection JobCollectionDefinition) (*http.Request, error) {
pathParameters := map[string]interface{}{
"jobCollectionName": autorest.Encode("path", jobCollectionName),
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2016-03-01"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsJSON(),
autorest.AsPatch(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Scheduler/jobCollections/{jobCollectionName}", pathParameters),
autorest.WithJSON(jobCollection),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{})
}
// PatchSender sends the Patch request. The method will close the
// http.Response Body if it receives an error.
func (client JobCollectionsClient) PatchSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req)
}
// PatchResponder handles the response to the Patch request. The method always
// closes the http.Response Body.
func (client JobCollectionsClient) PatchResponder(resp *http.Response) (result JobCollectionDefinition, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
+600
View File
@@ -0,0 +1,600 @@
package scheduler
// Copyright (c) Microsoft and contributors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
import (
"github.com/Azure/go-autorest/autorest"
"github.com/Azure/go-autorest/autorest/azure"
"github.com/Azure/go-autorest/autorest/validation"
"net/http"
)
// JobsClient is the client for the Jobs methods of the Scheduler service.
type JobsClient struct {
ManagementClient
}
// NewJobsClient creates an instance of the JobsClient client.
func NewJobsClient(subscriptionID string) JobsClient {
return NewJobsClientWithBaseURI(DefaultBaseURI, subscriptionID)
}
// NewJobsClientWithBaseURI creates an instance of the JobsClient client.
func NewJobsClientWithBaseURI(baseURI string, subscriptionID string) JobsClient {
return JobsClient{NewWithBaseURI(baseURI, subscriptionID)}
}
// CreateOrUpdate provisions a new job or updates an existing job.
//
// resourceGroupName is the resource group name. jobCollectionName is the job
// collection name. jobName is the job name. job is the job definition.
func (client JobsClient) CreateOrUpdate(resourceGroupName string, jobCollectionName string, jobName string, job JobDefinition) (result JobDefinition, err error) {
req, err := client.CreateOrUpdatePreparer(resourceGroupName, jobCollectionName, jobName, job)
if err != nil {
err = autorest.NewErrorWithError(err, "scheduler.JobsClient", "CreateOrUpdate", nil, "Failure preparing request")
return
}
resp, err := client.CreateOrUpdateSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "scheduler.JobsClient", "CreateOrUpdate", resp, "Failure sending request")
return
}
result, err = client.CreateOrUpdateResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "scheduler.JobsClient", "CreateOrUpdate", resp, "Failure responding to request")
}
return
}
// CreateOrUpdatePreparer prepares the CreateOrUpdate request.
func (client JobsClient) CreateOrUpdatePreparer(resourceGroupName string, jobCollectionName string, jobName string, job JobDefinition) (*http.Request, error) {
pathParameters := map[string]interface{}{
"jobCollectionName": autorest.Encode("path", jobCollectionName),
"jobName": autorest.Encode("path", jobName),
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2016-03-01"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsJSON(),
autorest.AsPut(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Scheduler/jobCollections/{jobCollectionName}/jobs/{jobName}", pathParameters),
autorest.WithJSON(job),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{})
}
// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the
// http.Response Body if it receives an error.
func (client JobsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req)
}
// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always
// closes the http.Response Body.
func (client JobsClient) CreateOrUpdateResponder(resp *http.Response) (result JobDefinition, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
// Delete deletes a job.
//
// resourceGroupName is the resource group name. jobCollectionName is the job
// collection name. jobName is the job name.
func (client JobsClient) Delete(resourceGroupName string, jobCollectionName string, jobName string) (result autorest.Response, err error) {
req, err := client.DeletePreparer(resourceGroupName, jobCollectionName, jobName)
if err != nil {
err = autorest.NewErrorWithError(err, "scheduler.JobsClient", "Delete", nil, "Failure preparing request")
return
}
resp, err := client.DeleteSender(req)
if err != nil {
result.Response = resp
err = autorest.NewErrorWithError(err, "scheduler.JobsClient", "Delete", resp, "Failure sending request")
return
}
result, err = client.DeleteResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "scheduler.JobsClient", "Delete", resp, "Failure responding to request")
}
return
}
// DeletePreparer prepares the Delete request.
func (client JobsClient) DeletePreparer(resourceGroupName string, jobCollectionName string, jobName string) (*http.Request, error) {
pathParameters := map[string]interface{}{
"jobCollectionName": autorest.Encode("path", jobCollectionName),
"jobName": autorest.Encode("path", jobName),
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2016-03-01"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsDelete(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Scheduler/jobCollections/{jobCollectionName}/jobs/{jobName}", pathParameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{})
}
// DeleteSender sends the Delete request. The method will close the
// http.Response Body if it receives an error.
func (client JobsClient) DeleteSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req)
}
// DeleteResponder handles the response to the Delete request. The method always
// closes the http.Response Body.
func (client JobsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByClosing())
result.Response = resp
return
}
// Get gets a job.
//
// resourceGroupName is the resource group name. jobCollectionName is the job
// collection name. jobName is the job name.
func (client JobsClient) Get(resourceGroupName string, jobCollectionName string, jobName string) (result JobDefinition, err error) {
req, err := client.GetPreparer(resourceGroupName, jobCollectionName, jobName)
if err != nil {
err = autorest.NewErrorWithError(err, "scheduler.JobsClient", "Get", nil, "Failure preparing request")
return
}
resp, err := client.GetSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "scheduler.JobsClient", "Get", resp, "Failure sending request")
return
}
result, err = client.GetResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "scheduler.JobsClient", "Get", resp, "Failure responding to request")
}
return
}
// GetPreparer prepares the Get request.
func (client JobsClient) GetPreparer(resourceGroupName string, jobCollectionName string, jobName string) (*http.Request, error) {
pathParameters := map[string]interface{}{
"jobCollectionName": autorest.Encode("path", jobCollectionName),
"jobName": autorest.Encode("path", jobName),
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2016-03-01"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsGet(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Scheduler/jobCollections/{jobCollectionName}/jobs/{jobName}", pathParameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{})
}
// GetSender sends the Get request. The method will close the
// http.Response Body if it receives an error.
func (client JobsClient) GetSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req)
}
// GetResponder handles the response to the Get request. The method always
// closes the http.Response Body.
func (client JobsClient) GetResponder(resp *http.Response) (result JobDefinition, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
// List lists all jobs under the specified job collection.
//
// resourceGroupName is the resource group name. jobCollectionName is the job
// collection name. top is the number of jobs to request, in the of range of
// [1..100]. skip is the (0-based) index of the job history list from which to
// begin requesting entries. filter is the filter to apply on the job state.
func (client JobsClient) List(resourceGroupName string, jobCollectionName string, top *int32, skip *int32, filter string) (result JobListResult, err error) {
if err := validation.Validate([]validation.Validation{
{TargetValue: top,
Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false,
Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMaximum, Rule: 100, Chain: nil},
{Target: "top", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil},
}}}}}); err != nil {
return result, validation.NewErrorWithValidationError(err, "scheduler.JobsClient", "List")
}
req, err := client.ListPreparer(resourceGroupName, jobCollectionName, top, skip, filter)
if err != nil {
err = autorest.NewErrorWithError(err, "scheduler.JobsClient", "List", nil, "Failure preparing request")
return
}
resp, err := client.ListSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "scheduler.JobsClient", "List", resp, "Failure sending request")
return
}
result, err = client.ListResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "scheduler.JobsClient", "List", resp, "Failure responding to request")
}
return
}
// ListPreparer prepares the List request.
func (client JobsClient) ListPreparer(resourceGroupName string, jobCollectionName string, top *int32, skip *int32, filter string) (*http.Request, error) {
pathParameters := map[string]interface{}{
"jobCollectionName": autorest.Encode("path", jobCollectionName),
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2016-03-01"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
if top != nil {
queryParameters["$top"] = autorest.Encode("query", *top)
}
if skip != nil {
queryParameters["$skip"] = autorest.Encode("query", *skip)
}
if len(filter) > 0 {
queryParameters["$filter"] = autorest.Encode("query", filter)
}
preparer := autorest.CreatePreparer(
autorest.AsGet(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Scheduler/jobCollections/{jobCollectionName}/jobs", pathParameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{})
}
// ListSender sends the List request. The method will close the
// http.Response Body if it receives an error.
func (client JobsClient) ListSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req)
}
// ListResponder handles the response to the List request. The method always
// closes the http.Response Body.
func (client JobsClient) ListResponder(resp *http.Response) (result JobListResult, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
// ListNextResults retrieves the next set of results, if any.
func (client JobsClient) ListNextResults(lastResults JobListResult) (result JobListResult, err error) {
req, err := lastResults.JobListResultPreparer()
if err != nil {
return result, autorest.NewErrorWithError(err, "scheduler.JobsClient", "List", nil, "Failure preparing next results request")
}
if req == nil {
return
}
resp, err := client.ListSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "scheduler.JobsClient", "List", resp, "Failure sending next results request")
}
result, err = client.ListResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "scheduler.JobsClient", "List", resp, "Failure responding to next results request")
}
return
}
// ListJobHistory lists job history.
//
// resourceGroupName is the resource group name. jobCollectionName is the job
// collection name. jobName is the job name. top is the number of job history
// to request, in the of range of [1..100]. skip is the (0-based) index of the
// job history list from which to begin requesting entries. filter is the
// filter to apply on the job state.
func (client JobsClient) ListJobHistory(resourceGroupName string, jobCollectionName string, jobName string, top *int32, skip *int32, filter string) (result JobHistoryListResult, err error) {
if err := validation.Validate([]validation.Validation{
{TargetValue: top,
Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false,
Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMaximum, Rule: 100, Chain: nil},
{Target: "top", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil},
}}}}}); err != nil {
return result, validation.NewErrorWithValidationError(err, "scheduler.JobsClient", "ListJobHistory")
}
req, err := client.ListJobHistoryPreparer(resourceGroupName, jobCollectionName, jobName, top, skip, filter)
if err != nil {
err = autorest.NewErrorWithError(err, "scheduler.JobsClient", "ListJobHistory", nil, "Failure preparing request")
return
}
resp, err := client.ListJobHistorySender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "scheduler.JobsClient", "ListJobHistory", resp, "Failure sending request")
return
}
result, err = client.ListJobHistoryResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "scheduler.JobsClient", "ListJobHistory", resp, "Failure responding to request")
}
return
}
// ListJobHistoryPreparer prepares the ListJobHistory request.
func (client JobsClient) ListJobHistoryPreparer(resourceGroupName string, jobCollectionName string, jobName string, top *int32, skip *int32, filter string) (*http.Request, error) {
pathParameters := map[string]interface{}{
"jobCollectionName": autorest.Encode("path", jobCollectionName),
"jobName": autorest.Encode("path", jobName),
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2016-03-01"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
if top != nil {
queryParameters["$top"] = autorest.Encode("query", *top)
}
if skip != nil {
queryParameters["$skip"] = autorest.Encode("query", *skip)
}
if len(filter) > 0 {
queryParameters["$filter"] = autorest.Encode("query", filter)
}
preparer := autorest.CreatePreparer(
autorest.AsGet(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Scheduler/jobCollections/{jobCollectionName}/jobs/{jobName}/history", pathParameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{})
}
// ListJobHistorySender sends the ListJobHistory request. The method will close the
// http.Response Body if it receives an error.
func (client JobsClient) ListJobHistorySender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req)
}
// ListJobHistoryResponder handles the response to the ListJobHistory request. The method always
// closes the http.Response Body.
func (client JobsClient) ListJobHistoryResponder(resp *http.Response) (result JobHistoryListResult, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
// ListJobHistoryNextResults retrieves the next set of results, if any.
func (client JobsClient) ListJobHistoryNextResults(lastResults JobHistoryListResult) (result JobHistoryListResult, err error) {
req, err := lastResults.JobHistoryListResultPreparer()
if err != nil {
return result, autorest.NewErrorWithError(err, "scheduler.JobsClient", "ListJobHistory", nil, "Failure preparing next results request")
}
if req == nil {
return
}
resp, err := client.ListJobHistorySender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "scheduler.JobsClient", "ListJobHistory", resp, "Failure sending next results request")
}
result, err = client.ListJobHistoryResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "scheduler.JobsClient", "ListJobHistory", resp, "Failure responding to next results request")
}
return
}
// Patch patches an existing job.
//
// resourceGroupName is the resource group name. jobCollectionName is the job
// collection name. jobName is the job name. job is the job definition.
func (client JobsClient) Patch(resourceGroupName string, jobCollectionName string, jobName string, job JobDefinition) (result JobDefinition, err error) {
req, err := client.PatchPreparer(resourceGroupName, jobCollectionName, jobName, job)
if err != nil {
err = autorest.NewErrorWithError(err, "scheduler.JobsClient", "Patch", nil, "Failure preparing request")
return
}
resp, err := client.PatchSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "scheduler.JobsClient", "Patch", resp, "Failure sending request")
return
}
result, err = client.PatchResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "scheduler.JobsClient", "Patch", resp, "Failure responding to request")
}
return
}
// PatchPreparer prepares the Patch request.
func (client JobsClient) PatchPreparer(resourceGroupName string, jobCollectionName string, jobName string, job JobDefinition) (*http.Request, error) {
pathParameters := map[string]interface{}{
"jobCollectionName": autorest.Encode("path", jobCollectionName),
"jobName": autorest.Encode("path", jobName),
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2016-03-01"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsJSON(),
autorest.AsPatch(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Scheduler/jobCollections/{jobCollectionName}/jobs/{jobName}", pathParameters),
autorest.WithJSON(job),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{})
}
// PatchSender sends the Patch request. The method will close the
// http.Response Body if it receives an error.
func (client JobsClient) PatchSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req)
}
// PatchResponder handles the response to the Patch request. The method always
// closes the http.Response Body.
func (client JobsClient) PatchResponder(resp *http.Response) (result JobDefinition, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
// Run runs a job.
//
// resourceGroupName is the resource group name. jobCollectionName is the job
// collection name. jobName is the job name.
func (client JobsClient) Run(resourceGroupName string, jobCollectionName string, jobName string) (result autorest.Response, err error) {
req, err := client.RunPreparer(resourceGroupName, jobCollectionName, jobName)
if err != nil {
err = autorest.NewErrorWithError(err, "scheduler.JobsClient", "Run", nil, "Failure preparing request")
return
}
resp, err := client.RunSender(req)
if err != nil {
result.Response = resp
err = autorest.NewErrorWithError(err, "scheduler.JobsClient", "Run", resp, "Failure sending request")
return
}
result, err = client.RunResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "scheduler.JobsClient", "Run", resp, "Failure responding to request")
}
return
}
// RunPreparer prepares the Run request.
func (client JobsClient) RunPreparer(resourceGroupName string, jobCollectionName string, jobName string) (*http.Request, error) {
pathParameters := map[string]interface{}{
"jobCollectionName": autorest.Encode("path", jobCollectionName),
"jobName": autorest.Encode("path", jobName),
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2016-03-01"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsPost(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Scheduler/jobCollections/{jobCollectionName}/jobs/{jobName}/run", pathParameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{})
}
// RunSender sends the Run request. The method will close the
// http.Response Body if it receives an error.
func (client JobsClient) RunSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req)
}
// RunResponder handles the response to the Run request. The method always
// closes the http.Response Body.
func (client JobsClient) RunResponder(resp *http.Response) (result autorest.Response, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByClosing())
result.Response = resp
return
}
+536
View File
@@ -0,0 +1,536 @@
package scheduler
// Copyright (c) Microsoft and contributors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
import (
"github.com/Azure/go-autorest/autorest"
"github.com/Azure/go-autorest/autorest/date"
"github.com/Azure/go-autorest/autorest/to"
"net/http"
)
// DayOfWeek enumerates the values for day of week.
type DayOfWeek string
const (
// Friday specifies the friday state for day of week.
Friday DayOfWeek = "Friday"
// Monday specifies the monday state for day of week.
Monday DayOfWeek = "Monday"
// Saturday specifies the saturday state for day of week.
Saturday DayOfWeek = "Saturday"
// Sunday specifies the sunday state for day of week.
Sunday DayOfWeek = "Sunday"
// Thursday specifies the thursday state for day of week.
Thursday DayOfWeek = "Thursday"
// Tuesday specifies the tuesday state for day of week.
Tuesday DayOfWeek = "Tuesday"
// Wednesday specifies the wednesday state for day of week.
Wednesday DayOfWeek = "Wednesday"
)
// HTTPAuthenticationType enumerates the values for http authentication type.
type HTTPAuthenticationType string
const (
// ActiveDirectoryOAuth specifies the active directory o auth state for
// http authentication type.
ActiveDirectoryOAuth HTTPAuthenticationType = "ActiveDirectoryOAuth"
// Basic specifies the basic state for http authentication type.
Basic HTTPAuthenticationType = "Basic"
// ClientCertificate specifies the client certificate state for http
// authentication type.
ClientCertificate HTTPAuthenticationType = "ClientCertificate"
// NotSpecified specifies the not specified state for http authentication
// type.
NotSpecified HTTPAuthenticationType = "NotSpecified"
)
// JobActionType enumerates the values for job action type.
type JobActionType string
const (
// HTTP specifies the http state for job action type.
HTTP JobActionType = "Http"
// HTTPS specifies the https state for job action type.
HTTPS JobActionType = "Https"
// ServiceBusQueue specifies the service bus queue state for job action
// type.
ServiceBusQueue JobActionType = "ServiceBusQueue"
// ServiceBusTopic specifies the service bus topic state for job action
// type.
ServiceBusTopic JobActionType = "ServiceBusTopic"
// StorageQueue specifies the storage queue state for job action type.
StorageQueue JobActionType = "StorageQueue"
)
// JobCollectionState enumerates the values for job collection state.
type JobCollectionState string
const (
// Deleted specifies the deleted state for job collection state.
Deleted JobCollectionState = "Deleted"
// Disabled specifies the disabled state for job collection state.
Disabled JobCollectionState = "Disabled"
// Enabled specifies the enabled state for job collection state.
Enabled JobCollectionState = "Enabled"
// Suspended specifies the suspended state for job collection state.
Suspended JobCollectionState = "Suspended"
)
// JobExecutionStatus enumerates the values for job execution status.
type JobExecutionStatus string
const (
// Completed specifies the completed state for job execution status.
Completed JobExecutionStatus = "Completed"
// Failed specifies the failed state for job execution status.
Failed JobExecutionStatus = "Failed"
// Postponed specifies the postponed state for job execution status.
Postponed JobExecutionStatus = "Postponed"
)
// JobHistoryActionName enumerates the values for job history action name.
type JobHistoryActionName string
const (
// ErrorAction specifies the error action state for job history action
// name.
ErrorAction JobHistoryActionName = "ErrorAction"
// MainAction specifies the main action state for job history action name.
MainAction JobHistoryActionName = "MainAction"
)
// JobScheduleDay enumerates the values for job schedule day.
type JobScheduleDay string
const (
// JobScheduleDayFriday specifies the job schedule day friday state for job
// schedule day.
JobScheduleDayFriday JobScheduleDay = "Friday"
// JobScheduleDayMonday specifies the job schedule day monday state for job
// schedule day.
JobScheduleDayMonday JobScheduleDay = "Monday"
// JobScheduleDaySaturday specifies the job schedule day saturday state for
// job schedule day.
JobScheduleDaySaturday JobScheduleDay = "Saturday"
// JobScheduleDaySunday specifies the job schedule day sunday state for job
// schedule day.
JobScheduleDaySunday JobScheduleDay = "Sunday"
// JobScheduleDayThursday specifies the job schedule day thursday state for
// job schedule day.
JobScheduleDayThursday JobScheduleDay = "Thursday"
// JobScheduleDayTuesday specifies the job schedule day tuesday state for
// job schedule day.
JobScheduleDayTuesday JobScheduleDay = "Tuesday"
// JobScheduleDayWednesday specifies the job schedule day wednesday state
// for job schedule day.
JobScheduleDayWednesday JobScheduleDay = "Wednesday"
)
// JobState enumerates the values for job state.
type JobState string
const (
// JobStateCompleted specifies the job state completed state for job state.
JobStateCompleted JobState = "Completed"
// JobStateDisabled specifies the job state disabled state for job state.
JobStateDisabled JobState = "Disabled"
// JobStateEnabled specifies the job state enabled state for job state.
JobStateEnabled JobState = "Enabled"
// JobStateFaulted specifies the job state faulted state for job state.
JobStateFaulted JobState = "Faulted"
)
// RecurrenceFrequency enumerates the values for recurrence frequency.
type RecurrenceFrequency string
const (
// Day specifies the day state for recurrence frequency.
Day RecurrenceFrequency = "Day"
// Hour specifies the hour state for recurrence frequency.
Hour RecurrenceFrequency = "Hour"
// Minute specifies the minute state for recurrence frequency.
Minute RecurrenceFrequency = "Minute"
// Month specifies the month state for recurrence frequency.
Month RecurrenceFrequency = "Month"
// Week specifies the week state for recurrence frequency.
Week RecurrenceFrequency = "Week"
)
// RetryType enumerates the values for retry type.
type RetryType string
const (
// Fixed specifies the fixed state for retry type.
Fixed RetryType = "Fixed"
// None specifies the none state for retry type.
None RetryType = "None"
)
// ServiceBusAuthenticationType enumerates the values for service bus
// authentication type.
type ServiceBusAuthenticationType string
const (
// ServiceBusAuthenticationTypeNotSpecified specifies the service bus
// authentication type not specified state for service bus authentication
// type.
ServiceBusAuthenticationTypeNotSpecified ServiceBusAuthenticationType = "NotSpecified"
// ServiceBusAuthenticationTypeSharedAccessKey specifies the service bus
// authentication type shared access key state for service bus
// authentication type.
ServiceBusAuthenticationTypeSharedAccessKey ServiceBusAuthenticationType = "SharedAccessKey"
)
// ServiceBusTransportType enumerates the values for service bus transport
// type.
type ServiceBusTransportType string
const (
// ServiceBusTransportTypeAMQP specifies the service bus transport type
// amqp state for service bus transport type.
ServiceBusTransportTypeAMQP ServiceBusTransportType = "AMQP"
// ServiceBusTransportTypeNetMessaging specifies the service bus transport
// type net messaging state for service bus transport type.
ServiceBusTransportTypeNetMessaging ServiceBusTransportType = "NetMessaging"
// ServiceBusTransportTypeNotSpecified specifies the service bus transport
// type not specified state for service bus transport type.
ServiceBusTransportTypeNotSpecified ServiceBusTransportType = "NotSpecified"
)
// SkuDefinition enumerates the values for sku definition.
type SkuDefinition string
const (
// Free specifies the free state for sku definition.
Free SkuDefinition = "Free"
// P10Premium specifies the p10 premium state for sku definition.
P10Premium SkuDefinition = "P10Premium"
// P20Premium specifies the p20 premium state for sku definition.
P20Premium SkuDefinition = "P20Premium"
// Standard specifies the standard state for sku definition.
Standard SkuDefinition = "Standard"
)
// BasicAuthentication is
type BasicAuthentication struct {
Type HTTPAuthenticationType `json:"type,omitempty"`
Username *string `json:"username,omitempty"`
Password *string `json:"password,omitempty"`
}
// ClientCertAuthentication is
type ClientCertAuthentication struct {
Type HTTPAuthenticationType `json:"type,omitempty"`
Password *string `json:"password,omitempty"`
Pfx *string `json:"pfx,omitempty"`
CertificateThumbprint *string `json:"certificateThumbprint,omitempty"`
CertificateExpirationDate *date.Time `json:"certificateExpirationDate,omitempty"`
CertificateSubjectName *string `json:"certificateSubjectName,omitempty"`
}
// HTTPAuthentication is
type HTTPAuthentication struct {
Type HTTPAuthenticationType `json:"type,omitempty"`
}
// HTTPRequest is
type HTTPRequest struct {
Authentication *HTTPAuthentication `json:"authentication,omitempty"`
URI *string `json:"uri,omitempty"`
Method *string `json:"method,omitempty"`
Body *string `json:"body,omitempty"`
Headers *map[string]*string `json:"headers,omitempty"`
}
// JobAction is
type JobAction struct {
Type JobActionType `json:"type,omitempty"`
Request *HTTPRequest `json:"request,omitempty"`
QueueMessage *StorageQueueMessage `json:"queueMessage,omitempty"`
ServiceBusQueueMessage *ServiceBusQueueMessage `json:"serviceBusQueueMessage,omitempty"`
ServiceBusTopicMessage *ServiceBusTopicMessage `json:"serviceBusTopicMessage,omitempty"`
RetryPolicy *RetryPolicy `json:"retryPolicy,omitempty"`
ErrorAction *JobErrorAction `json:"errorAction,omitempty"`
}
// JobCollectionDefinition is
type JobCollectionDefinition struct {
autorest.Response `json:"-"`
ID *string `json:"id,omitempty"`
Type *string `json:"type,omitempty"`
Name *string `json:"name,omitempty"`
Location *string `json:"location,omitempty"`
Tags *map[string]*string `json:"tags,omitempty"`
Properties *JobCollectionProperties `json:"properties,omitempty"`
}
// JobCollectionListResult is
type JobCollectionListResult struct {
autorest.Response `json:"-"`
Value *[]JobCollectionDefinition `json:"value,omitempty"`
NextLink *string `json:"nextLink,omitempty"`
}
// JobCollectionListResultPreparer prepares a request to retrieve the next set of results. It returns
// nil if no more results exist.
func (client JobCollectionListResult) JobCollectionListResultPreparer() (*http.Request, error) {
if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 {
return nil, nil
}
return autorest.Prepare(&http.Request{},
autorest.AsJSON(),
autorest.AsGet(),
autorest.WithBaseURL(to.String(client.NextLink)))
}
// JobCollectionProperties is
type JobCollectionProperties struct {
Sku *Sku `json:"sku,omitempty"`
State JobCollectionState `json:"state,omitempty"`
Quota *JobCollectionQuota `json:"quota,omitempty"`
}
// JobCollectionQuota is
type JobCollectionQuota struct {
MaxJobCount *int32 `json:"maxJobCount,omitempty"`
MaxJobOccurrence *int32 `json:"maxJobOccurrence,omitempty"`
MaxRecurrence *JobMaxRecurrence `json:"maxRecurrence,omitempty"`
}
// JobDefinition is
type JobDefinition struct {
autorest.Response `json:"-"`
ID *string `json:"id,omitempty"`
Type *string `json:"type,omitempty"`
Name *string `json:"name,omitempty"`
Properties *JobProperties `json:"properties,omitempty"`
}
// JobErrorAction is
type JobErrorAction struct {
Type JobActionType `json:"type,omitempty"`
Request *HTTPRequest `json:"request,omitempty"`
QueueMessage *StorageQueueMessage `json:"queueMessage,omitempty"`
ServiceBusQueueMessage *ServiceBusQueueMessage `json:"serviceBusQueueMessage,omitempty"`
ServiceBusTopicMessage *ServiceBusTopicMessage `json:"serviceBusTopicMessage,omitempty"`
RetryPolicy *RetryPolicy `json:"retryPolicy,omitempty"`
}
// JobHistoryDefinition is
type JobHistoryDefinition struct {
ID *string `json:"id,omitempty"`
Type *string `json:"type,omitempty"`
Name *string `json:"name,omitempty"`
Properties *JobHistoryDefinitionProperties `json:"properties,omitempty"`
}
// JobHistoryDefinitionProperties is
type JobHistoryDefinitionProperties struct {
StartTime *date.Time `json:"startTime,omitempty"`
EndTime *date.Time `json:"endTime,omitempty"`
ExpectedExecutionTime *date.Time `json:"expectedExecutionTime,omitempty"`
ActionName JobHistoryActionName `json:"actionName,omitempty"`
Status JobExecutionStatus `json:"status,omitempty"`
Message *string `json:"message,omitempty"`
RetryCount *int32 `json:"retryCount,omitempty"`
RepeatCount *int32 `json:"repeatCount,omitempty"`
}
// JobHistoryFilter is
type JobHistoryFilter struct {
Status JobExecutionStatus `json:"status,omitempty"`
}
// JobHistoryListResult is
type JobHistoryListResult struct {
autorest.Response `json:"-"`
Value *[]JobHistoryDefinition `json:"value,omitempty"`
NextLink *string `json:"nextLink,omitempty"`
}
// JobHistoryListResultPreparer prepares a request to retrieve the next set of results. It returns
// nil if no more results exist.
func (client JobHistoryListResult) JobHistoryListResultPreparer() (*http.Request, error) {
if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 {
return nil, nil
}
return autorest.Prepare(&http.Request{},
autorest.AsJSON(),
autorest.AsGet(),
autorest.WithBaseURL(to.String(client.NextLink)))
}
// JobListResult is
type JobListResult struct {
autorest.Response `json:"-"`
Value *[]JobDefinition `json:"value,omitempty"`
NextLink *string `json:"nextLink,omitempty"`
}
// JobListResultPreparer prepares a request to retrieve the next set of results. It returns
// nil if no more results exist.
func (client JobListResult) JobListResultPreparer() (*http.Request, error) {
if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 {
return nil, nil
}
return autorest.Prepare(&http.Request{},
autorest.AsJSON(),
autorest.AsGet(),
autorest.WithBaseURL(to.String(client.NextLink)))
}
// JobMaxRecurrence is
type JobMaxRecurrence struct {
Frequency RecurrenceFrequency `json:"frequency,omitempty"`
Interval *int32 `json:"interval,omitempty"`
}
// JobProperties is
type JobProperties struct {
StartTime *date.Time `json:"startTime,omitempty"`
Action *JobAction `json:"action,omitempty"`
Recurrence *JobRecurrence `json:"recurrence,omitempty"`
State JobState `json:"state,omitempty"`
Status *JobStatus `json:"status,omitempty"`
}
// JobRecurrence is
type JobRecurrence struct {
Frequency RecurrenceFrequency `json:"frequency,omitempty"`
Interval *int32 `json:"interval,omitempty"`
Count *int32 `json:"count,omitempty"`
EndTime *date.Time `json:"endTime,omitempty"`
Schedule *JobRecurrenceSchedule `json:"schedule,omitempty"`
}
// JobRecurrenceSchedule is
type JobRecurrenceSchedule struct {
WeekDays *[]DayOfWeek `json:"weekDays,omitempty"`
Hours *[]int32 `json:"hours,omitempty"`
Minutes *[]int32 `json:"minutes,omitempty"`
MonthDays *[]int32 `json:"monthDays,omitempty"`
MonthlyOccurrences *[]JobRecurrenceScheduleMonthlyOccurrence `json:"monthlyOccurrences,omitempty"`
}
// JobRecurrenceScheduleMonthlyOccurrence is
type JobRecurrenceScheduleMonthlyOccurrence struct {
Day JobScheduleDay `json:"day,omitempty"`
Occurrence *int32 `json:"Occurrence,omitempty"`
}
// JobStateFilter is
type JobStateFilter struct {
State JobState `json:"state,omitempty"`
}
// JobStatus is
type JobStatus struct {
ExecutionCount *int32 `json:"executionCount,omitempty"`
FailureCount *int32 `json:"failureCount,omitempty"`
FaultedCount *int32 `json:"faultedCount,omitempty"`
LastExecutionTime *date.Time `json:"lastExecutionTime,omitempty"`
NextExecutionTime *date.Time `json:"nextExecutionTime,omitempty"`
}
// OAuthAuthentication is
type OAuthAuthentication struct {
Type HTTPAuthenticationType `json:"type,omitempty"`
Secret *string `json:"secret,omitempty"`
Tenant *string `json:"tenant,omitempty"`
Audience *string `json:"audience,omitempty"`
ClientID *string `json:"clientId,omitempty"`
}
// RetryPolicy is
type RetryPolicy struct {
RetryType RetryType `json:"retryType,omitempty"`
RetryInterval *string `json:"retryInterval,omitempty"`
RetryCount *int32 `json:"retryCount,omitempty"`
}
// ServiceBusAuthentication is
type ServiceBusAuthentication struct {
SasKey *string `json:"sasKey,omitempty"`
SasKeyName *string `json:"sasKeyName,omitempty"`
Type ServiceBusAuthenticationType `json:"type,omitempty"`
}
// ServiceBusBrokeredMessageProperties is
type ServiceBusBrokeredMessageProperties struct {
ContentType *string `json:"contentType,omitempty"`
CorrelationID *string `json:"correlationId,omitempty"`
ForcePersistence *bool `json:"forcePersistence,omitempty"`
Label *string `json:"label,omitempty"`
MessageID *string `json:"messageId,omitempty"`
PartitionKey *string `json:"partitionKey,omitempty"`
ReplyTo *string `json:"replyTo,omitempty"`
ReplyToSessionID *string `json:"replyToSessionId,omitempty"`
ScheduledEnqueueTimeUtc *date.Time `json:"scheduledEnqueueTimeUtc,omitempty"`
SessionID *string `json:"sessionId,omitempty"`
TimeToLive *string `json:"timeToLive,omitempty"`
To *string `json:"to,omitempty"`
ViaPartitionKey *string `json:"viaPartitionKey,omitempty"`
}
// ServiceBusMessage is
type ServiceBusMessage struct {
Authentication *ServiceBusAuthentication `json:"authentication,omitempty"`
BrokeredMessageProperties *ServiceBusBrokeredMessageProperties `json:"brokeredMessageProperties,omitempty"`
CustomMessageProperties *map[string]*string `json:"customMessageProperties,omitempty"`
Message *string `json:"message,omitempty"`
Namespace *string `json:"namespace,omitempty"`
TransportType ServiceBusTransportType `json:"transportType,omitempty"`
}
// ServiceBusQueueMessage is
type ServiceBusQueueMessage struct {
Authentication *ServiceBusAuthentication `json:"authentication,omitempty"`
BrokeredMessageProperties *ServiceBusBrokeredMessageProperties `json:"brokeredMessageProperties,omitempty"`
CustomMessageProperties *map[string]*string `json:"customMessageProperties,omitempty"`
Message *string `json:"message,omitempty"`
Namespace *string `json:"namespace,omitempty"`
TransportType ServiceBusTransportType `json:"transportType,omitempty"`
QueueName *string `json:"queueName,omitempty"`
}
// ServiceBusTopicMessage is
type ServiceBusTopicMessage struct {
Authentication *ServiceBusAuthentication `json:"authentication,omitempty"`
BrokeredMessageProperties *ServiceBusBrokeredMessageProperties `json:"brokeredMessageProperties,omitempty"`
CustomMessageProperties *map[string]*string `json:"customMessageProperties,omitempty"`
Message *string `json:"message,omitempty"`
Namespace *string `json:"namespace,omitempty"`
TransportType ServiceBusTransportType `json:"transportType,omitempty"`
TopicPath *string `json:"topicPath,omitempty"`
}
// Sku is
type Sku struct {
Name SkuDefinition `json:"name,omitempty"`
}
// StorageQueueMessage is
type StorageQueueMessage struct {
StorageAccount *string `json:"storageAccount,omitempty"`
QueueName *string `json:"queueName,omitempty"`
SasToken *string `json:"sasToken,omitempty"`
Message *string `json:"message,omitempty"`
}
+29
View File
@@ -0,0 +1,29 @@
package scheduler
// Copyright (c) Microsoft and contributors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
// UserAgent returns the UserAgent string to use when sending http.Requests.
func UserAgent() string {
return "Azure-SDK-For-Go/v10.1.0-beta arm-scheduler/2016-03-01"
}
// Version returns the semantic version (see http://semver.org) of the client.
func Version() string {
return "v10.1.0-beta"
}