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 streamanalytics implements the Azure ARM Streamanalytics service API
// version .
//
// Composite Swagger for Stream Analytics Client
package streamanalytics
// 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.1.0.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 Streamanalytics
DefaultBaseURI = "https://management.azure.com"
)
// ManagementClient is the base client for Streamanalytics.
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,
}
}
@@ -0,0 +1,670 @@
package streamanalytics
// 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.1.0.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"
)
// FunctionsClient is the composite Swagger for Stream Analytics Client
type FunctionsClient struct {
ManagementClient
}
// NewFunctionsClient creates an instance of the FunctionsClient client.
func NewFunctionsClient(subscriptionID string) FunctionsClient {
return NewFunctionsClientWithBaseURI(DefaultBaseURI, subscriptionID)
}
// NewFunctionsClientWithBaseURI creates an instance of the FunctionsClient
// client.
func NewFunctionsClientWithBaseURI(baseURI string, subscriptionID string) FunctionsClient {
return FunctionsClient{NewWithBaseURI(baseURI, subscriptionID)}
}
// CreateOrReplace creates a function or replaces an already existing function
// under an existing streaming job.
//
// function is the definition of the function that will be used to create a new
// function or replace the existing one under the streaming job.
// resourceGroupName is the name of the resource group that contains the
// resource. You can obtain this value from the Azure Resource Manager API or
// the portal. jobName is the name of the streaming job. functionName is the
// name of the function. ifMatch is the ETag of the function. Omit this value
// to always overwrite the current function. Specify the last-seen ETag value
// to prevent accidentally overwritting concurrent changes. ifNoneMatch is set
// to '*' to allow a new function to be created, but to prevent updating an
// existing function. Other values will result in a 412 Pre-condition Failed
// response.
func (client FunctionsClient) CreateOrReplace(function Function, resourceGroupName string, jobName string, functionName string, ifMatch string, ifNoneMatch string) (result Function, err error) {
req, err := client.CreateOrReplacePreparer(function, resourceGroupName, jobName, functionName, ifMatch, ifNoneMatch)
if err != nil {
err = autorest.NewErrorWithError(err, "streamanalytics.FunctionsClient", "CreateOrReplace", nil, "Failure preparing request")
return
}
resp, err := client.CreateOrReplaceSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "streamanalytics.FunctionsClient", "CreateOrReplace", resp, "Failure sending request")
return
}
result, err = client.CreateOrReplaceResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "streamanalytics.FunctionsClient", "CreateOrReplace", resp, "Failure responding to request")
}
return
}
// CreateOrReplacePreparer prepares the CreateOrReplace request.
func (client FunctionsClient) CreateOrReplacePreparer(function Function, resourceGroupName string, jobName string, functionName string, ifMatch string, ifNoneMatch string) (*http.Request, error) {
pathParameters := map[string]interface{}{
"functionName": autorest.Encode("path", functionName),
"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.StreamAnalytics/streamingjobs/{jobName}/functions/{functionName}", pathParameters),
autorest.WithJSON(function),
autorest.WithQueryParameters(queryParameters))
if len(ifMatch) > 0 {
preparer = autorest.DecoratePreparer(preparer,
autorest.WithHeader("If-Match", autorest.String(ifMatch)))
}
if len(ifNoneMatch) > 0 {
preparer = autorest.DecoratePreparer(preparer,
autorest.WithHeader("If-None-Match", autorest.String(ifNoneMatch)))
}
return preparer.Prepare(&http.Request{})
}
// CreateOrReplaceSender sends the CreateOrReplace request. The method will close the
// http.Response Body if it receives an error.
func (client FunctionsClient) CreateOrReplaceSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req)
}
// CreateOrReplaceResponder handles the response to the CreateOrReplace request. The method always
// closes the http.Response Body.
func (client FunctionsClient) CreateOrReplaceResponder(resp *http.Response) (result Function, 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 function from the streaming job.
//
// resourceGroupName is the name of the resource group that contains the
// resource. You can obtain this value from the Azure Resource Manager API or
// the portal. jobName is the name of the streaming job. functionName is the
// name of the function.
func (client FunctionsClient) Delete(resourceGroupName string, jobName string, functionName string) (result autorest.Response, err error) {
req, err := client.DeletePreparer(resourceGroupName, jobName, functionName)
if err != nil {
err = autorest.NewErrorWithError(err, "streamanalytics.FunctionsClient", "Delete", nil, "Failure preparing request")
return
}
resp, err := client.DeleteSender(req)
if err != nil {
result.Response = resp
err = autorest.NewErrorWithError(err, "streamanalytics.FunctionsClient", "Delete", resp, "Failure sending request")
return
}
result, err = client.DeleteResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "streamanalytics.FunctionsClient", "Delete", resp, "Failure responding to request")
}
return
}
// DeletePreparer prepares the Delete request.
func (client FunctionsClient) DeletePreparer(resourceGroupName string, jobName string, functionName string) (*http.Request, error) {
pathParameters := map[string]interface{}{
"functionName": autorest.Encode("path", functionName),
"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.StreamAnalytics/streamingjobs/{jobName}/functions/{functionName}", 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 FunctionsClient) 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 FunctionsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent),
autorest.ByClosing())
result.Response = resp
return
}
// Get gets details about the specified function.
//
// resourceGroupName is the name of the resource group that contains the
// resource. You can obtain this value from the Azure Resource Manager API or
// the portal. jobName is the name of the streaming job. functionName is the
// name of the function.
func (client FunctionsClient) Get(resourceGroupName string, jobName string, functionName string) (result Function, err error) {
req, err := client.GetPreparer(resourceGroupName, jobName, functionName)
if err != nil {
err = autorest.NewErrorWithError(err, "streamanalytics.FunctionsClient", "Get", nil, "Failure preparing request")
return
}
resp, err := client.GetSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "streamanalytics.FunctionsClient", "Get", resp, "Failure sending request")
return
}
result, err = client.GetResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "streamanalytics.FunctionsClient", "Get", resp, "Failure responding to request")
}
return
}
// GetPreparer prepares the Get request.
func (client FunctionsClient) GetPreparer(resourceGroupName string, jobName string, functionName string) (*http.Request, error) {
pathParameters := map[string]interface{}{
"functionName": autorest.Encode("path", functionName),
"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.StreamAnalytics/streamingjobs/{jobName}/functions/{functionName}", 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 FunctionsClient) 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 FunctionsClient) GetResponder(resp *http.Response) (result Function, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
// ListByStreamingJob lists all of the functions under the specified streaming
// job.
//
// resourceGroupName is the name of the resource group that contains the
// resource. You can obtain this value from the Azure Resource Manager API or
// the portal. jobName is the name of the streaming job. selectParameter is the
// $select OData query parameter. This is a comma-separated list of structural
// properties to include in the response, or “*” to include all properties. By
// default, all properties are returned except diagnostics. Currently only
// accepts '*' as a valid value.
func (client FunctionsClient) ListByStreamingJob(resourceGroupName string, jobName string, selectParameter string) (result FunctionListResult, err error) {
req, err := client.ListByStreamingJobPreparer(resourceGroupName, jobName, selectParameter)
if err != nil {
err = autorest.NewErrorWithError(err, "streamanalytics.FunctionsClient", "ListByStreamingJob", nil, "Failure preparing request")
return
}
resp, err := client.ListByStreamingJobSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "streamanalytics.FunctionsClient", "ListByStreamingJob", resp, "Failure sending request")
return
}
result, err = client.ListByStreamingJobResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "streamanalytics.FunctionsClient", "ListByStreamingJob", resp, "Failure responding to request")
}
return
}
// ListByStreamingJobPreparer prepares the ListByStreamingJob request.
func (client FunctionsClient) ListByStreamingJobPreparer(resourceGroupName string, jobName string, selectParameter string) (*http.Request, error) {
pathParameters := map[string]interface{}{
"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 len(selectParameter) > 0 {
queryParameters["$select"] = autorest.Encode("query", selectParameter)
}
preparer := autorest.CreatePreparer(
autorest.AsGet(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/functions", pathParameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{})
}
// ListByStreamingJobSender sends the ListByStreamingJob request. The method will close the
// http.Response Body if it receives an error.
func (client FunctionsClient) ListByStreamingJobSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req)
}
// ListByStreamingJobResponder handles the response to the ListByStreamingJob request. The method always
// closes the http.Response Body.
func (client FunctionsClient) ListByStreamingJobResponder(resp *http.Response) (result FunctionListResult, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
// ListByStreamingJobNextResults retrieves the next set of results, if any.
func (client FunctionsClient) ListByStreamingJobNextResults(lastResults FunctionListResult) (result FunctionListResult, err error) {
req, err := lastResults.FunctionListResultPreparer()
if err != nil {
return result, autorest.NewErrorWithError(err, "streamanalytics.FunctionsClient", "ListByStreamingJob", nil, "Failure preparing next results request")
}
if req == nil {
return
}
resp, err := client.ListByStreamingJobSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "streamanalytics.FunctionsClient", "ListByStreamingJob", resp, "Failure sending next results request")
}
result, err = client.ListByStreamingJobResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "streamanalytics.FunctionsClient", "ListByStreamingJob", resp, "Failure responding to next results request")
}
return
}
// ListByStreamingJobComplete gets all elements from the list without paging.
func (client FunctionsClient) ListByStreamingJobComplete(resourceGroupName string, jobName string, selectParameter string, cancel <-chan struct{}) (<-chan Function, <-chan error) {
resultChan := make(chan Function)
errChan := make(chan error, 1)
go func() {
defer func() {
close(resultChan)
close(errChan)
}()
list, err := client.ListByStreamingJob(resourceGroupName, jobName, selectParameter)
if err != nil {
errChan <- err
return
}
if list.Value != nil {
for _, item := range *list.Value {
select {
case <-cancel:
return
case resultChan <- item:
// Intentionally left blank
}
}
}
for list.NextLink != nil {
list, err = client.ListByStreamingJobNextResults(list)
if err != nil {
errChan <- err
return
}
if list.Value != nil {
for _, item := range *list.Value {
select {
case <-cancel:
return
case resultChan <- item:
// Intentionally left blank
}
}
}
}
}()
return resultChan, errChan
}
// RetrieveDefaultDefinition retrieves the default definition of a function
// based on the parameters specified.
//
// resourceGroupName is the name of the resource group that contains the
// resource. You can obtain this value from the Azure Resource Manager API or
// the portal. jobName is the name of the streaming job. functionName is the
// name of the function. functionRetrieveDefaultDefinitionParameters is
// parameters used to specify the type of function to retrieve the default
// definition for.
func (client FunctionsClient) RetrieveDefaultDefinition(resourceGroupName string, jobName string, functionName string, functionRetrieveDefaultDefinitionParameters *FunctionRetrieveDefaultDefinitionParameters) (result Function, err error) {
req, err := client.RetrieveDefaultDefinitionPreparer(resourceGroupName, jobName, functionName, functionRetrieveDefaultDefinitionParameters)
if err != nil {
err = autorest.NewErrorWithError(err, "streamanalytics.FunctionsClient", "RetrieveDefaultDefinition", nil, "Failure preparing request")
return
}
resp, err := client.RetrieveDefaultDefinitionSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "streamanalytics.FunctionsClient", "RetrieveDefaultDefinition", resp, "Failure sending request")
return
}
result, err = client.RetrieveDefaultDefinitionResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "streamanalytics.FunctionsClient", "RetrieveDefaultDefinition", resp, "Failure responding to request")
}
return
}
// RetrieveDefaultDefinitionPreparer prepares the RetrieveDefaultDefinition request.
func (client FunctionsClient) RetrieveDefaultDefinitionPreparer(resourceGroupName string, jobName string, functionName string, functionRetrieveDefaultDefinitionParameters *FunctionRetrieveDefaultDefinitionParameters) (*http.Request, error) {
pathParameters := map[string]interface{}{
"functionName": autorest.Encode("path", functionName),
"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.AsPost(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/functions/{functionName}/RetrieveDefaultDefinition", pathParameters),
autorest.WithQueryParameters(queryParameters))
if functionRetrieveDefaultDefinitionParameters != nil {
preparer = autorest.DecoratePreparer(preparer,
autorest.WithJSON(functionRetrieveDefaultDefinitionParameters))
}
return preparer.Prepare(&http.Request{})
}
// RetrieveDefaultDefinitionSender sends the RetrieveDefaultDefinition request. The method will close the
// http.Response Body if it receives an error.
func (client FunctionsClient) RetrieveDefaultDefinitionSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req)
}
// RetrieveDefaultDefinitionResponder handles the response to the RetrieveDefaultDefinition request. The method always
// closes the http.Response Body.
func (client FunctionsClient) RetrieveDefaultDefinitionResponder(resp *http.Response) (result Function, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
// Test tests if the information provided for a function is valid. This can
// range from testing the connection to the underlying web service behind the
// function or making sure the function code provided is syntactically correct.
// 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 name of the resource group that contains the
// resource. You can obtain this value from the Azure Resource Manager API or
// the portal. jobName is the name of the streaming job. functionName is the
// name of the function. function is if the function specified does not already
// exist, this parameter must contain the full function definition intended to
// be tested. If the function specified already exists, this parameter can be
// left null to test the existing function as is or if specified, the
// properties specified will overwrite the corresponding properties in the
// existing function (exactly like a PATCH operation) and the resulting
// function will be tested.
func (client FunctionsClient) Test(resourceGroupName string, jobName string, functionName string, function *Function, cancel <-chan struct{}) (<-chan ResourceTestStatus, <-chan error) {
resultChan := make(chan ResourceTestStatus, 1)
errChan := make(chan error, 1)
go func() {
var err error
var result ResourceTestStatus
defer func() {
if err != nil {
errChan <- err
}
resultChan <- result
close(resultChan)
close(errChan)
}()
req, err := client.TestPreparer(resourceGroupName, jobName, functionName, function, cancel)
if err != nil {
err = autorest.NewErrorWithError(err, "streamanalytics.FunctionsClient", "Test", nil, "Failure preparing request")
return
}
resp, err := client.TestSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "streamanalytics.FunctionsClient", "Test", resp, "Failure sending request")
return
}
result, err = client.TestResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "streamanalytics.FunctionsClient", "Test", resp, "Failure responding to request")
}
}()
return resultChan, errChan
}
// TestPreparer prepares the Test request.
func (client FunctionsClient) TestPreparer(resourceGroupName string, jobName string, functionName string, function *Function, cancel <-chan struct{}) (*http.Request, error) {
pathParameters := map[string]interface{}{
"functionName": autorest.Encode("path", functionName),
"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.AsPost(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/functions/{functionName}/test", pathParameters),
autorest.WithQueryParameters(queryParameters))
if function != nil {
preparer = autorest.DecoratePreparer(preparer,
autorest.WithJSON(function))
}
return preparer.Prepare(&http.Request{Cancel: cancel})
}
// TestSender sends the Test request. The method will close the
// http.Response Body if it receives an error.
func (client FunctionsClient) TestSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client,
req,
azure.DoPollForAsynchronous(client.PollingDelay))
}
// TestResponder handles the response to the Test request. The method always
// closes the http.Response Body.
func (client FunctionsClient) TestResponder(resp *http.Response) (result ResourceTestStatus, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
// Update updates an existing function under an existing streaming job. This
// can be used to partially update (ie. update one or two properties) a
// function without affecting the rest the job or function definition.
//
// function is a function object. The properties specified here will overwrite
// the corresponding properties in the existing function (ie. Those properties
// will be updated). Any properties that are set to null here will mean that
// the corresponding property in the existing function will remain the same and
// not change as a result of this PATCH operation. resourceGroupName is the
// name of the resource group that contains the resource. You can obtain this
// value from the Azure Resource Manager API or the portal. jobName is the name
// of the streaming job. functionName is the name of the function. ifMatch is
// the ETag of the function. Omit this value to always overwrite the current
// function. Specify the last-seen ETag value to prevent accidentally
// overwritting concurrent changes.
func (client FunctionsClient) Update(function Function, resourceGroupName string, jobName string, functionName string, ifMatch string) (result Function, err error) {
req, err := client.UpdatePreparer(function, resourceGroupName, jobName, functionName, ifMatch)
if err != nil {
err = autorest.NewErrorWithError(err, "streamanalytics.FunctionsClient", "Update", nil, "Failure preparing request")
return
}
resp, err := client.UpdateSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "streamanalytics.FunctionsClient", "Update", resp, "Failure sending request")
return
}
result, err = client.UpdateResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "streamanalytics.FunctionsClient", "Update", resp, "Failure responding to request")
}
return
}
// UpdatePreparer prepares the Update request.
func (client FunctionsClient) UpdatePreparer(function Function, resourceGroupName string, jobName string, functionName string, ifMatch string) (*http.Request, error) {
pathParameters := map[string]interface{}{
"functionName": autorest.Encode("path", functionName),
"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.StreamAnalytics/streamingjobs/{jobName}/functions/{functionName}", pathParameters),
autorest.WithJSON(function),
autorest.WithQueryParameters(queryParameters))
if len(ifMatch) > 0 {
preparer = autorest.DecoratePreparer(preparer,
autorest.WithHeader("If-Match", autorest.String(ifMatch)))
}
return preparer.Prepare(&http.Request{})
}
// UpdateSender sends the Update request. The method will close the
// http.Response Body if it receives an error.
func (client FunctionsClient) UpdateSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req)
}
// UpdateResponder handles the response to the Update request. The method always
// closes the http.Response Body.
func (client FunctionsClient) UpdateResponder(resp *http.Response) (result Function, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
+588
View File
@@ -0,0 +1,588 @@
package streamanalytics
// 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.1.0.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"
)
// InputsClient is the composite Swagger for Stream Analytics Client
type InputsClient struct {
ManagementClient
}
// NewInputsClient creates an instance of the InputsClient client.
func NewInputsClient(subscriptionID string) InputsClient {
return NewInputsClientWithBaseURI(DefaultBaseURI, subscriptionID)
}
// NewInputsClientWithBaseURI creates an instance of the InputsClient client.
func NewInputsClientWithBaseURI(baseURI string, subscriptionID string) InputsClient {
return InputsClient{NewWithBaseURI(baseURI, subscriptionID)}
}
// CreateOrReplace creates an input or replaces an already existing input under
// an existing streaming job.
//
// input is the definition of the input that will be used to create a new input
// or replace the existing one under the streaming job. resourceGroupName is
// the name of the resource group that contains the resource. You can obtain
// this value from the Azure Resource Manager API or the portal. jobName is the
// name of the streaming job. inputName is the name of the input. ifMatch is
// the ETag of the input. Omit this value to always overwrite the current
// input. Specify the last-seen ETag value to prevent accidentally overwritting
// concurrent changes. ifNoneMatch is set to '*' to allow a new input to be
// created, but to prevent updating an existing input. Other values will result
// in a 412 Pre-condition Failed response.
func (client InputsClient) CreateOrReplace(input Input, resourceGroupName string, jobName string, inputName string, ifMatch string, ifNoneMatch string) (result Input, err error) {
req, err := client.CreateOrReplacePreparer(input, resourceGroupName, jobName, inputName, ifMatch, ifNoneMatch)
if err != nil {
err = autorest.NewErrorWithError(err, "streamanalytics.InputsClient", "CreateOrReplace", nil, "Failure preparing request")
return
}
resp, err := client.CreateOrReplaceSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "streamanalytics.InputsClient", "CreateOrReplace", resp, "Failure sending request")
return
}
result, err = client.CreateOrReplaceResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "streamanalytics.InputsClient", "CreateOrReplace", resp, "Failure responding to request")
}
return
}
// CreateOrReplacePreparer prepares the CreateOrReplace request.
func (client InputsClient) CreateOrReplacePreparer(input Input, resourceGroupName string, jobName string, inputName string, ifMatch string, ifNoneMatch string) (*http.Request, error) {
pathParameters := map[string]interface{}{
"inputName": autorest.Encode("path", inputName),
"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.StreamAnalytics/streamingjobs/{jobName}/inputs/{inputName}", pathParameters),
autorest.WithJSON(input),
autorest.WithQueryParameters(queryParameters))
if len(ifMatch) > 0 {
preparer = autorest.DecoratePreparer(preparer,
autorest.WithHeader("If-Match", autorest.String(ifMatch)))
}
if len(ifNoneMatch) > 0 {
preparer = autorest.DecoratePreparer(preparer,
autorest.WithHeader("If-None-Match", autorest.String(ifNoneMatch)))
}
return preparer.Prepare(&http.Request{})
}
// CreateOrReplaceSender sends the CreateOrReplace request. The method will close the
// http.Response Body if it receives an error.
func (client InputsClient) CreateOrReplaceSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req)
}
// CreateOrReplaceResponder handles the response to the CreateOrReplace request. The method always
// closes the http.Response Body.
func (client InputsClient) CreateOrReplaceResponder(resp *http.Response) (result Input, 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 an input from the streaming job.
//
// resourceGroupName is the name of the resource group that contains the
// resource. You can obtain this value from the Azure Resource Manager API or
// the portal. jobName is the name of the streaming job. inputName is the name
// of the input.
func (client InputsClient) Delete(resourceGroupName string, jobName string, inputName string) (result autorest.Response, err error) {
req, err := client.DeletePreparer(resourceGroupName, jobName, inputName)
if err != nil {
err = autorest.NewErrorWithError(err, "streamanalytics.InputsClient", "Delete", nil, "Failure preparing request")
return
}
resp, err := client.DeleteSender(req)
if err != nil {
result.Response = resp
err = autorest.NewErrorWithError(err, "streamanalytics.InputsClient", "Delete", resp, "Failure sending request")
return
}
result, err = client.DeleteResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "streamanalytics.InputsClient", "Delete", resp, "Failure responding to request")
}
return
}
// DeletePreparer prepares the Delete request.
func (client InputsClient) DeletePreparer(resourceGroupName string, jobName string, inputName string) (*http.Request, error) {
pathParameters := map[string]interface{}{
"inputName": autorest.Encode("path", inputName),
"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.StreamAnalytics/streamingjobs/{jobName}/inputs/{inputName}", 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 InputsClient) 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 InputsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent),
autorest.ByClosing())
result.Response = resp
return
}
// Get gets details about the specified input.
//
// resourceGroupName is the name of the resource group that contains the
// resource. You can obtain this value from the Azure Resource Manager API or
// the portal. jobName is the name of the streaming job. inputName is the name
// of the input.
func (client InputsClient) Get(resourceGroupName string, jobName string, inputName string) (result Input, err error) {
req, err := client.GetPreparer(resourceGroupName, jobName, inputName)
if err != nil {
err = autorest.NewErrorWithError(err, "streamanalytics.InputsClient", "Get", nil, "Failure preparing request")
return
}
resp, err := client.GetSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "streamanalytics.InputsClient", "Get", resp, "Failure sending request")
return
}
result, err = client.GetResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "streamanalytics.InputsClient", "Get", resp, "Failure responding to request")
}
return
}
// GetPreparer prepares the Get request.
func (client InputsClient) GetPreparer(resourceGroupName string, jobName string, inputName string) (*http.Request, error) {
pathParameters := map[string]interface{}{
"inputName": autorest.Encode("path", inputName),
"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.StreamAnalytics/streamingjobs/{jobName}/inputs/{inputName}", 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 InputsClient) 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 InputsClient) GetResponder(resp *http.Response) (result Input, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
// ListByStreamingJob lists all of the inputs under the specified streaming
// job.
//
// resourceGroupName is the name of the resource group that contains the
// resource. You can obtain this value from the Azure Resource Manager API or
// the portal. jobName is the name of the streaming job. selectParameter is the
// $select OData query parameter. This is a comma-separated list of structural
// properties to include in the response, or “*” to include all properties. By
// default, all properties are returned except diagnostics. Currently only
// accepts '*' as a valid value.
func (client InputsClient) ListByStreamingJob(resourceGroupName string, jobName string, selectParameter string) (result InputListResult, err error) {
req, err := client.ListByStreamingJobPreparer(resourceGroupName, jobName, selectParameter)
if err != nil {
err = autorest.NewErrorWithError(err, "streamanalytics.InputsClient", "ListByStreamingJob", nil, "Failure preparing request")
return
}
resp, err := client.ListByStreamingJobSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "streamanalytics.InputsClient", "ListByStreamingJob", resp, "Failure sending request")
return
}
result, err = client.ListByStreamingJobResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "streamanalytics.InputsClient", "ListByStreamingJob", resp, "Failure responding to request")
}
return
}
// ListByStreamingJobPreparer prepares the ListByStreamingJob request.
func (client InputsClient) ListByStreamingJobPreparer(resourceGroupName string, jobName string, selectParameter string) (*http.Request, error) {
pathParameters := map[string]interface{}{
"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 len(selectParameter) > 0 {
queryParameters["$select"] = autorest.Encode("query", selectParameter)
}
preparer := autorest.CreatePreparer(
autorest.AsGet(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/inputs", pathParameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{})
}
// ListByStreamingJobSender sends the ListByStreamingJob request. The method will close the
// http.Response Body if it receives an error.
func (client InputsClient) ListByStreamingJobSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req)
}
// ListByStreamingJobResponder handles the response to the ListByStreamingJob request. The method always
// closes the http.Response Body.
func (client InputsClient) ListByStreamingJobResponder(resp *http.Response) (result InputListResult, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
// ListByStreamingJobNextResults retrieves the next set of results, if any.
func (client InputsClient) ListByStreamingJobNextResults(lastResults InputListResult) (result InputListResult, err error) {
req, err := lastResults.InputListResultPreparer()
if err != nil {
return result, autorest.NewErrorWithError(err, "streamanalytics.InputsClient", "ListByStreamingJob", nil, "Failure preparing next results request")
}
if req == nil {
return
}
resp, err := client.ListByStreamingJobSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "streamanalytics.InputsClient", "ListByStreamingJob", resp, "Failure sending next results request")
}
result, err = client.ListByStreamingJobResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "streamanalytics.InputsClient", "ListByStreamingJob", resp, "Failure responding to next results request")
}
return
}
// ListByStreamingJobComplete gets all elements from the list without paging.
func (client InputsClient) ListByStreamingJobComplete(resourceGroupName string, jobName string, selectParameter string, cancel <-chan struct{}) (<-chan Input, <-chan error) {
resultChan := make(chan Input)
errChan := make(chan error, 1)
go func() {
defer func() {
close(resultChan)
close(errChan)
}()
list, err := client.ListByStreamingJob(resourceGroupName, jobName, selectParameter)
if err != nil {
errChan <- err
return
}
if list.Value != nil {
for _, item := range *list.Value {
select {
case <-cancel:
return
case resultChan <- item:
// Intentionally left blank
}
}
}
for list.NextLink != nil {
list, err = client.ListByStreamingJobNextResults(list)
if err != nil {
errChan <- err
return
}
if list.Value != nil {
for _, item := range *list.Value {
select {
case <-cancel:
return
case resultChan <- item:
// Intentionally left blank
}
}
}
}
}()
return resultChan, errChan
}
// Test tests whether an input’s datasource is reachable and usable by the
// Azure Stream Analytics service. 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 name of the resource group that contains the
// resource. You can obtain this value from the Azure Resource Manager API or
// the portal. jobName is the name of the streaming job. inputName is the name
// of the input. input is if the input specified does not already exist, this
// parameter must contain the full input definition intended to be tested. If
// the input specified already exists, this parameter can be left null to test
// the existing input as is or if specified, the properties specified will
// overwrite the corresponding properties in the existing input (exactly like a
// PATCH operation) and the resulting input will be tested.
func (client InputsClient) Test(resourceGroupName string, jobName string, inputName string, input *Input, cancel <-chan struct{}) (<-chan ResourceTestStatus, <-chan error) {
resultChan := make(chan ResourceTestStatus, 1)
errChan := make(chan error, 1)
go func() {
var err error
var result ResourceTestStatus
defer func() {
if err != nil {
errChan <- err
}
resultChan <- result
close(resultChan)
close(errChan)
}()
req, err := client.TestPreparer(resourceGroupName, jobName, inputName, input, cancel)
if err != nil {
err = autorest.NewErrorWithError(err, "streamanalytics.InputsClient", "Test", nil, "Failure preparing request")
return
}
resp, err := client.TestSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "streamanalytics.InputsClient", "Test", resp, "Failure sending request")
return
}
result, err = client.TestResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "streamanalytics.InputsClient", "Test", resp, "Failure responding to request")
}
}()
return resultChan, errChan
}
// TestPreparer prepares the Test request.
func (client InputsClient) TestPreparer(resourceGroupName string, jobName string, inputName string, input *Input, cancel <-chan struct{}) (*http.Request, error) {
pathParameters := map[string]interface{}{
"inputName": autorest.Encode("path", inputName),
"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.AsPost(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/inputs/{inputName}/test", pathParameters),
autorest.WithQueryParameters(queryParameters))
if input != nil {
preparer = autorest.DecoratePreparer(preparer,
autorest.WithJSON(input))
}
return preparer.Prepare(&http.Request{Cancel: cancel})
}
// TestSender sends the Test request. The method will close the
// http.Response Body if it receives an error.
func (client InputsClient) TestSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client,
req,
azure.DoPollForAsynchronous(client.PollingDelay))
}
// TestResponder handles the response to the Test request. The method always
// closes the http.Response Body.
func (client InputsClient) TestResponder(resp *http.Response) (result ResourceTestStatus, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
// Update updates an existing input under an existing streaming job. This can
// be used to partially update (ie. update one or two properties) an input
// without affecting the rest the job or input definition.
//
// input is an Input object. The properties specified here will overwrite the
// corresponding properties in the existing input (ie. Those properties will be
// updated). Any properties that are set to null here will mean that the
// corresponding property in the existing input will remain the same and not
// change as a result of this PATCH operation. resourceGroupName is the name of
// the resource group that contains the resource. You can obtain this value
// from the Azure Resource Manager API or the portal. jobName is the name of
// the streaming job. inputName is the name of the input. ifMatch is the ETag
// of the input. Omit this value to always overwrite the current input. Specify
// the last-seen ETag value to prevent accidentally overwritting concurrent
// changes.
func (client InputsClient) Update(input Input, resourceGroupName string, jobName string, inputName string, ifMatch string) (result Input, err error) {
req, err := client.UpdatePreparer(input, resourceGroupName, jobName, inputName, ifMatch)
if err != nil {
err = autorest.NewErrorWithError(err, "streamanalytics.InputsClient", "Update", nil, "Failure preparing request")
return
}
resp, err := client.UpdateSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "streamanalytics.InputsClient", "Update", resp, "Failure sending request")
return
}
result, err = client.UpdateResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "streamanalytics.InputsClient", "Update", resp, "Failure responding to request")
}
return
}
// UpdatePreparer prepares the Update request.
func (client InputsClient) UpdatePreparer(input Input, resourceGroupName string, jobName string, inputName string, ifMatch string) (*http.Request, error) {
pathParameters := map[string]interface{}{
"inputName": autorest.Encode("path", inputName),
"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.StreamAnalytics/streamingjobs/{jobName}/inputs/{inputName}", pathParameters),
autorest.WithJSON(input),
autorest.WithQueryParameters(queryParameters))
if len(ifMatch) > 0 {
preparer = autorest.DecoratePreparer(preparer,
autorest.WithHeader("If-Match", autorest.String(ifMatch)))
}
return preparer.Prepare(&http.Request{})
}
// UpdateSender sends the Update request. The method will close the
// http.Response Body if it receives an error.
func (client InputsClient) UpdateSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req)
}
// UpdateResponder handles the response to the Update request. The method always
// closes the http.Response Body.
func (client InputsClient) UpdateResponder(resp *http.Response) (result Input, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
+806
View File
@@ -0,0 +1,806 @@
package streamanalytics
// 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.1.0.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"
)
// CompatibilityLevel enumerates the values for compatibility level.
type CompatibilityLevel string
const (
// OneFullStopZero specifies the one full stop zero state for compatibility
// level.
OneFullStopZero CompatibilityLevel = "1.0"
)
// Encoding enumerates the values for encoding.
type Encoding string
const (
// UTF8 specifies the utf8 state for encoding.
UTF8 Encoding = "UTF8"
)
// EventsOutOfOrderPolicy enumerates the values for events out of order policy.
type EventsOutOfOrderPolicy string
const (
// Adjust specifies the adjust state for events out of order policy.
Adjust EventsOutOfOrderPolicy = "Adjust"
// Drop specifies the drop state for events out of order policy.
Drop EventsOutOfOrderPolicy = "Drop"
)
// JSONOutputSerializationFormat enumerates the values for json output
// serialization format.
type JSONOutputSerializationFormat string
const (
// Array specifies the array state for json output serialization format.
Array JSONOutputSerializationFormat = "Array"
// LineSeparated specifies the line separated state for json output
// serialization format.
LineSeparated JSONOutputSerializationFormat = "LineSeparated"
)
// OutputErrorPolicy enumerates the values for output error policy.
type OutputErrorPolicy string
const (
// OutputErrorPolicyDrop specifies the output error policy drop state for
// output error policy.
OutputErrorPolicyDrop OutputErrorPolicy = "Drop"
// OutputErrorPolicyStop specifies the output error policy stop state for
// output error policy.
OutputErrorPolicyStop OutputErrorPolicy = "Stop"
)
// OutputStartMode enumerates the values for output start mode.
type OutputStartMode string
const (
// CustomTime specifies the custom time state for output start mode.
CustomTime OutputStartMode = "CustomTime"
// JobStartTime specifies the job start time state for output start mode.
JobStartTime OutputStartMode = "JobStartTime"
// LastOutputEventTime specifies the last output event time state for
// output start mode.
LastOutputEventTime OutputStartMode = "LastOutputEventTime"
)
// SkuName enumerates the values for sku name.
type SkuName string
const (
// Standard specifies the standard state for sku name.
Standard SkuName = "Standard"
)
// UdfType enumerates the values for udf type.
type UdfType string
const (
// Scalar specifies the scalar state for udf type.
Scalar UdfType = "Scalar"
)
// AvroSerialization is describes how data from an input is serialized or how
// data is serialized when written to an output in Avro format.
type AvroSerialization struct {
Properties *map[string]interface{} `json:"properties,omitempty"`
}
// AzureMachineLearningWebServiceFunctionBinding is the binding to an Azure
// Machine Learning web service.
type AzureMachineLearningWebServiceFunctionBinding struct {
*AzureMachineLearningWebServiceFunctionBindingProperties `json:"properties,omitempty"`
}
// AzureMachineLearningWebServiceFunctionBindingProperties is the binding
// properties associated with an Azure Machine learning web service.
type AzureMachineLearningWebServiceFunctionBindingProperties struct {
Endpoint *string `json:"endpoint,omitempty"`
APIKey *string `json:"apiKey,omitempty"`
Inputs *AzureMachineLearningWebServiceInputs `json:"inputs,omitempty"`
Outputs *[]AzureMachineLearningWebServiceOutputColumn `json:"outputs,omitempty"`
BatchSize *int32 `json:"batchSize,omitempty"`
}
// AzureMachineLearningWebServiceFunctionBindingRetrievalProperties is the
// binding retrieval properties associated with an Azure Machine learning web
// service.
type AzureMachineLearningWebServiceFunctionBindingRetrievalProperties struct {
ExecuteEndpoint *string `json:"executeEndpoint,omitempty"`
UdfType UdfType `json:"udfType,omitempty"`
}
// AzureMachineLearningWebServiceFunctionRetrieveDefaultDefinitionParameters is
// the parameters needed to retrieve the default function definition for an
// Azure Machine Learning web service function.
type AzureMachineLearningWebServiceFunctionRetrieveDefaultDefinitionParameters struct {
*AzureMachineLearningWebServiceFunctionBindingRetrievalProperties `json:"bindingRetrievalProperties,omitempty"`
}
// AzureMachineLearningWebServiceInputColumn is describes an input column for
// the Azure Machine Learning web service endpoint.
type AzureMachineLearningWebServiceInputColumn struct {
Name *string `json:"name,omitempty"`
DataType *string `json:"dataType,omitempty"`
MapTo *int32 `json:"mapTo,omitempty"`
}
// AzureMachineLearningWebServiceInputs is the inputs for the Azure Machine
// Learning web service endpoint.
type AzureMachineLearningWebServiceInputs struct {
Name *string `json:"name,omitempty"`
ColumnNames *[]AzureMachineLearningWebServiceInputColumn `json:"columnNames,omitempty"`
}
// AzureMachineLearningWebServiceOutputColumn is describes an output column for
// the Azure Machine Learning web service endpoint.
type AzureMachineLearningWebServiceOutputColumn struct {
Name *string `json:"name,omitempty"`
DataType *string `json:"dataType,omitempty"`
}
// AzureSQLDatabaseDataSourceProperties is the properties that are associated
// with an Azure SQL database data source.
type AzureSQLDatabaseDataSourceProperties struct {
Server *string `json:"server,omitempty"`
Database *string `json:"database,omitempty"`
User *string `json:"user,omitempty"`
Password *string `json:"password,omitempty"`
Table *string `json:"table,omitempty"`
}
// AzureSQLDatabaseOutputDataSource is describes an Azure SQL database output
// data source.
type AzureSQLDatabaseOutputDataSource struct {
*AzureSQLDatabaseOutputDataSourceProperties `json:"properties,omitempty"`
}
// AzureSQLDatabaseOutputDataSourceProperties is the properties that are
// associated with an Azure SQL database output.
type AzureSQLDatabaseOutputDataSourceProperties struct {
Server *string `json:"server,omitempty"`
Database *string `json:"database,omitempty"`
User *string `json:"user,omitempty"`
Password *string `json:"password,omitempty"`
Table *string `json:"table,omitempty"`
}
// AzureTableOutputDataSource is describes an Azure Table data source.
type AzureTableOutputDataSource struct {
*AzureTableOutputDataSourceProperties `json:"properties,omitempty"`
}
// AzureTableOutputDataSourceProperties is the properties that are associated
// with an Azure Table output.
type AzureTableOutputDataSourceProperties struct {
AccountName *string `json:"accountName,omitempty"`
AccountKey *string `json:"accountKey,omitempty"`
Table *string `json:"table,omitempty"`
PartitionKey *string `json:"partitionKey,omitempty"`
RowKey *string `json:"rowKey,omitempty"`
ColumnsToRemove *[]string `json:"columnsToRemove,omitempty"`
BatchSize *int32 `json:"batchSize,omitempty"`
}
// BlobDataSourceProperties is the properties that are associated with a blob
// data source.
type BlobDataSourceProperties struct {
StorageAccounts *[]StorageAccount `json:"storageAccounts,omitempty"`
Container *string `json:"container,omitempty"`
PathPattern *string `json:"pathPattern,omitempty"`
DateFormat *string `json:"dateFormat,omitempty"`
TimeFormat *string `json:"timeFormat,omitempty"`
}
// BlobOutputDataSource is describes a blob output data source.
type BlobOutputDataSource struct {
*BlobOutputDataSourceProperties `json:"properties,omitempty"`
}
// BlobOutputDataSourceProperties is the properties that are associated with a
// blob output.
type BlobOutputDataSourceProperties struct {
StorageAccounts *[]StorageAccount `json:"storageAccounts,omitempty"`
Container *string `json:"container,omitempty"`
PathPattern *string `json:"pathPattern,omitempty"`
DateFormat *string `json:"dateFormat,omitempty"`
TimeFormat *string `json:"timeFormat,omitempty"`
}
// BlobReferenceInputDataSource is describes a blob input data source that
// contains reference data.
type BlobReferenceInputDataSource struct {
*BlobReferenceInputDataSourceProperties `json:"properties,omitempty"`
}
// BlobReferenceInputDataSourceProperties is the properties that are associated
// with a blob input containing reference data.
type BlobReferenceInputDataSourceProperties struct {
StorageAccounts *[]StorageAccount `json:"storageAccounts,omitempty"`
Container *string `json:"container,omitempty"`
PathPattern *string `json:"pathPattern,omitempty"`
DateFormat *string `json:"dateFormat,omitempty"`
TimeFormat *string `json:"timeFormat,omitempty"`
}
// BlobStreamInputDataSource is describes a blob input data source that
// contains stream data.
type BlobStreamInputDataSource struct {
*BlobStreamInputDataSourceProperties `json:"properties,omitempty"`
}
// BlobStreamInputDataSourceProperties is the properties that are associated
// with a blob input containing stream data.
type BlobStreamInputDataSourceProperties struct {
StorageAccounts *[]StorageAccount `json:"storageAccounts,omitempty"`
Container *string `json:"container,omitempty"`
PathPattern *string `json:"pathPattern,omitempty"`
DateFormat *string `json:"dateFormat,omitempty"`
TimeFormat *string `json:"timeFormat,omitempty"`
SourcePartitionCount *int32 `json:"sourcePartitionCount,omitempty"`
}
// CsvSerialization is describes how data from an input is serialized or how
// data is serialized when written to an output in CSV format.
type CsvSerialization struct {
*CsvSerializationProperties `json:"properties,omitempty"`
}
// CsvSerializationProperties is the properties that are associated with the
// CSV serialization type.
type CsvSerializationProperties struct {
FieldDelimiter *string `json:"fieldDelimiter,omitempty"`
Encoding Encoding `json:"encoding,omitempty"`
}
// DiagnosticCondition is condition applicable to the resource, or to the job
// overall, that warrant customer attention.
type DiagnosticCondition struct {
Since *string `json:"since,omitempty"`
Code *string `json:"code,omitempty"`
Message *string `json:"message,omitempty"`
}
// Diagnostics is describes conditions applicable to the Input, Output, or the
// job overall, that warrant customer attention.
type Diagnostics struct {
Conditions *[]DiagnosticCondition `json:"conditions,omitempty"`
}
// DocumentDbOutputDataSource is describes a DocumentDB data source.
type DocumentDbOutputDataSource struct {
*DocumentDbOutputDataSourceProperties `json:"properties,omitempty"`
}
// DocumentDbOutputDataSourceProperties is the properties that are associated
// with a DocumentDB output.
type DocumentDbOutputDataSourceProperties struct {
AccountID *string `json:"accountId,omitempty"`
AccountKey *string `json:"accountKey,omitempty"`
Database *string `json:"database,omitempty"`
CollectionNamePattern *string `json:"collectionNamePattern,omitempty"`
PartitionKey *string `json:"partitionKey,omitempty"`
DocumentID *string `json:"documentId,omitempty"`
}
// ErrorResponse is describes the error that occurred.
type ErrorResponse struct {
Code *string `json:"code,omitempty"`
Message *string `json:"message,omitempty"`
}
// EventHubDataSourceProperties is the common properties that are associated
// with Event Hub data sources.
type EventHubDataSourceProperties struct {
ServiceBusNamespace *string `json:"serviceBusNamespace,omitempty"`
SharedAccessPolicyName *string `json:"sharedAccessPolicyName,omitempty"`
SharedAccessPolicyKey *string `json:"sharedAccessPolicyKey,omitempty"`
EventHubName *string `json:"eventHubName,omitempty"`
}
// EventHubOutputDataSource is describes an Event Hub output data source.
type EventHubOutputDataSource struct {
*EventHubOutputDataSourceProperties `json:"properties,omitempty"`
}
// EventHubOutputDataSourceProperties is the properties that are associated
// with an Event Hub output.
type EventHubOutputDataSourceProperties struct {
ServiceBusNamespace *string `json:"serviceBusNamespace,omitempty"`
SharedAccessPolicyName *string `json:"sharedAccessPolicyName,omitempty"`
SharedAccessPolicyKey *string `json:"sharedAccessPolicyKey,omitempty"`
EventHubName *string `json:"eventHubName,omitempty"`
PartitionKey *string `json:"partitionKey,omitempty"`
}
// EventHubStreamInputDataSource is describes an Event Hub input data source
// that contains stream data.
type EventHubStreamInputDataSource struct {
*EventHubStreamInputDataSourceProperties `json:"properties,omitempty"`
}
// EventHubStreamInputDataSourceProperties is the properties that are
// associated with a Event Hub input containing stream data.
type EventHubStreamInputDataSourceProperties struct {
ServiceBusNamespace *string `json:"serviceBusNamespace,omitempty"`
SharedAccessPolicyName *string `json:"sharedAccessPolicyName,omitempty"`
SharedAccessPolicyKey *string `json:"sharedAccessPolicyKey,omitempty"`
EventHubName *string `json:"eventHubName,omitempty"`
ConsumerGroupName *string `json:"consumerGroupName,omitempty"`
}
// Function is a function object, containing all information associated with
// the named function. All functions are contained under a streaming job.
type Function struct {
autorest.Response `json:"-"`
ID *string `json:"id,omitempty"`
Name *string `json:"name,omitempty"`
Type *string `json:"type,omitempty"`
Properties *FunctionProperties `json:"properties,omitempty"`
}
// FunctionBinding is the physical binding of the function. For example, in the
// Azure Machine Learning web service’s case, this describes the endpoint.
type FunctionBinding struct {
}
// FunctionInput is describes one input parameter of a function.
type FunctionInput struct {
DataType *string `json:"dataType,omitempty"`
IsConfigurationParameter *bool `json:"isConfigurationParameter,omitempty"`
}
// FunctionListResult is object containing a list of functions under a
// streaming job.
type FunctionListResult struct {
autorest.Response `json:"-"`
Value *[]Function `json:"value,omitempty"`
NextLink *string `json:"nextLink,omitempty"`
}
// FunctionListResultPreparer prepares a request to retrieve the next set of results. It returns
// nil if no more results exist.
func (client FunctionListResult) FunctionListResultPreparer() (*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)))
}
// FunctionOutput is describes the output of a function.
type FunctionOutput struct {
DataType *string `json:"dataType,omitempty"`
}
// FunctionProperties is the properties that are associated with a function.
type FunctionProperties struct {
Etag *string `json:"etag,omitempty"`
}
// FunctionRetrieveDefaultDefinitionParameters is parameters used to specify
// the type of function to retrieve the default definition for.
type FunctionRetrieveDefaultDefinitionParameters struct {
}
// Input is an input object, containing all information associated with the
// named input. All inputs are contained under a streaming job.
type Input struct {
autorest.Response `json:"-"`
ID *string `json:"id,omitempty"`
Name *string `json:"name,omitempty"`
Type *string `json:"type,omitempty"`
Properties *InputProperties `json:"properties,omitempty"`
}
// InputListResult is object containing a list of inputs under a streaming job.
type InputListResult struct {
autorest.Response `json:"-"`
Value *[]Input `json:"value,omitempty"`
NextLink *string `json:"nextLink,omitempty"`
}
// InputListResultPreparer prepares a request to retrieve the next set of results. It returns
// nil if no more results exist.
func (client InputListResult) InputListResultPreparer() (*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)))
}
// InputProperties is the properties that are associated with an input.
type InputProperties struct {
Serialization *Serialization `json:"serialization,omitempty"`
Diagnostics *Diagnostics `json:"diagnostics,omitempty"`
Etag *string `json:"etag,omitempty"`
}
// IoTHubStreamInputDataSource is describes an IoT Hub input data source that
// contains stream data.
type IoTHubStreamInputDataSource struct {
*IoTHubStreamInputDataSourceProperties `json:"properties,omitempty"`
}
// IoTHubStreamInputDataSourceProperties is the properties that are associated
// with a IoT Hub input containing stream data.
type IoTHubStreamInputDataSourceProperties struct {
IotHubNamespace *string `json:"iotHubNamespace,omitempty"`
SharedAccessPolicyName *string `json:"sharedAccessPolicyName,omitempty"`
SharedAccessPolicyKey *string `json:"sharedAccessPolicyKey,omitempty"`
ConsumerGroupName *string `json:"consumerGroupName,omitempty"`
Endpoint *string `json:"endpoint,omitempty"`
}
// JavaScriptFunctionBinding is the binding to a JavaScript function.
type JavaScriptFunctionBinding struct {
*JavaScriptFunctionBindingProperties `json:"properties,omitempty"`
}
// JavaScriptFunctionBindingProperties is the binding properties associated
// with a JavaScript function.
type JavaScriptFunctionBindingProperties struct {
Script *string `json:"script,omitempty"`
}
// JavaScriptFunctionBindingRetrievalProperties is the binding retrieval
// properties associated with a JavaScript function.
type JavaScriptFunctionBindingRetrievalProperties struct {
Script *string `json:"script,omitempty"`
UdfType UdfType `json:"udfType,omitempty"`
}
// JavaScriptFunctionRetrieveDefaultDefinitionParameters is the parameters
// needed to retrieve the default function definition for a JavaScript
// function.
type JavaScriptFunctionRetrieveDefaultDefinitionParameters struct {
*JavaScriptFunctionBindingRetrievalProperties `json:"bindingRetrievalProperties,omitempty"`
}
// JSONSerialization is describes how data from an input is serialized or how
// data is serialized when written to an output in JSON format.
type JSONSerialization struct {
*JSONSerializationProperties `json:"properties,omitempty"`
}
// JSONSerializationProperties is the properties that are associated with the
// JSON serialization type.
type JSONSerializationProperties struct {
Encoding Encoding `json:"encoding,omitempty"`
Format JSONOutputSerializationFormat `json:"format,omitempty"`
}
// Operation is a Stream Analytics REST API operation
type Operation struct {
Name *string `json:"name,omitempty"`
Display *OperationDisplay `json:"display,omitempty"`
}
// OperationDisplay is contains the localized display information for this
// particular operation / action.
type OperationDisplay struct {
Provider *string `json:"provider,omitempty"`
Resource *string `json:"resource,omitempty"`
Operation *string `json:"operation,omitempty"`
Description *string `json:"description,omitempty"`
}
// OperationListResult is result of the request to list Stream Analytics
// operations. It contains a list of operations and a URL link to get the next
// set of results.
type OperationListResult struct {
autorest.Response `json:"-"`
Value *[]Operation `json:"value,omitempty"`
NextLink *string `json:"nextLink,omitempty"`
}
// OperationListResultPreparer prepares a request to retrieve the next set of results. It returns
// nil if no more results exist.
func (client OperationListResult) OperationListResultPreparer() (*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)))
}
// Output is an output object, containing all information associated with the
// named output. All outputs are contained under a streaming job.
type Output struct {
autorest.Response `json:"-"`
ID *string `json:"id,omitempty"`
Name *string `json:"name,omitempty"`
Type *string `json:"type,omitempty"`
*OutputProperties `json:"properties,omitempty"`
}
// OutputDataSource is describes the data source that output will be written
// to.
type OutputDataSource struct {
}
// OutputListResult is object containing a list of outputs under a streaming
// job.
type OutputListResult struct {
autorest.Response `json:"-"`
Value *[]Output `json:"value,omitempty"`
NextLink *string `json:"nextLink,omitempty"`
}
// OutputListResultPreparer prepares a request to retrieve the next set of results. It returns
// nil if no more results exist.
func (client OutputListResult) OutputListResultPreparer() (*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)))
}
// OutputProperties is the properties that are associated with an output.
type OutputProperties struct {
Datasource *OutputDataSource `json:"datasource,omitempty"`
Serialization *Serialization `json:"serialization,omitempty"`
Diagnostics *Diagnostics `json:"diagnostics,omitempty"`
Etag *string `json:"etag,omitempty"`
}
// ReferenceInputDataSource is describes an input data source that contains
// reference data.
type ReferenceInputDataSource struct {
}
// ReferenceInputProperties is the properties that are associated with an input
// containing reference data.
type ReferenceInputProperties struct {
Serialization *Serialization `json:"serialization,omitempty"`
Diagnostics *Diagnostics `json:"diagnostics,omitempty"`
Etag *string `json:"etag,omitempty"`
Datasource *ReferenceInputDataSource `json:"datasource,omitempty"`
}
// Resource is the base resource model definition.
type Resource struct {
ID *string `json:"id,omitempty"`
Name *string `json:"name,omitempty"`
Type *string `json:"type,omitempty"`
Location *string `json:"location,omitempty"`
Tags *map[string]*string `json:"tags,omitempty"`
}
// ResourceTestStatus is describes the status of the test operation along with
// error information, if applicable.
type ResourceTestStatus struct {
autorest.Response `json:"-"`
Status *string `json:"status,omitempty"`
Error *ErrorResponse `json:"error,omitempty"`
}
// ScalarFunctionConfiguration is describes the configuration of the scalar
// function.
type ScalarFunctionConfiguration struct {
Inputs *[]FunctionInput `json:"inputs,omitempty"`
Output *FunctionOutput `json:"output,omitempty"`
Binding *FunctionBinding `json:"binding,omitempty"`
}
// ScalarFunctionProperties is the properties that are associated with a scalar
// function.
type ScalarFunctionProperties struct {
Etag *string `json:"etag,omitempty"`
*ScalarFunctionConfiguration `json:"properties,omitempty"`
}
// Serialization is describes how data from an input is serialized or how data
// is serialized when written to an output.
type Serialization struct {
}
// ServiceBusDataSourceProperties is the common properties that are associated
// with Service Bus data sources (Queues, Topics, Event Hubs, etc.).
type ServiceBusDataSourceProperties struct {
ServiceBusNamespace *string `json:"serviceBusNamespace,omitempty"`
SharedAccessPolicyName *string `json:"sharedAccessPolicyName,omitempty"`
SharedAccessPolicyKey *string `json:"sharedAccessPolicyKey,omitempty"`
}
// ServiceBusQueueOutputDataSource is describes a Service Bus Queue data
// source.
type ServiceBusQueueOutputDataSource struct {
*ServiceBusQueueOutputDataSourceProperties `json:"properties,omitempty"`
}
// ServiceBusQueueOutputDataSourceProperties is the properties that are
// associated with a Service Bus Queue output.
type ServiceBusQueueOutputDataSourceProperties struct {
ServiceBusNamespace *string `json:"serviceBusNamespace,omitempty"`
SharedAccessPolicyName *string `json:"sharedAccessPolicyName,omitempty"`
SharedAccessPolicyKey *string `json:"sharedAccessPolicyKey,omitempty"`
QueueName *string `json:"queueName,omitempty"`
PropertyColumns *[]string `json:"propertyColumns,omitempty"`
}
// ServiceBusTopicOutputDataSource is describes a Service Bus Topic data
// source.
type ServiceBusTopicOutputDataSource struct {
*ServiceBusTopicOutputDataSourceProperties `json:"properties,omitempty"`
}
// ServiceBusTopicOutputDataSourceProperties is the properties that are
// associated with a Service Bus Topic output.
type ServiceBusTopicOutputDataSourceProperties struct {
ServiceBusNamespace *string `json:"serviceBusNamespace,omitempty"`
SharedAccessPolicyName *string `json:"sharedAccessPolicyName,omitempty"`
SharedAccessPolicyKey *string `json:"sharedAccessPolicyKey,omitempty"`
TopicName *string `json:"topicName,omitempty"`
PropertyColumns *[]string `json:"propertyColumns,omitempty"`
}
// Sku is the properties that are associated with a SKU.
type Sku struct {
Name SkuName `json:"name,omitempty"`
}
// StartStreamingJobParameters is parameters supplied to the Start Streaming
// Job operation.
type StartStreamingJobParameters struct {
OutputStartMode OutputStartMode `json:"outputStartMode,omitempty"`
OutputStartTime *date.Time `json:"outputStartTime,omitempty"`
}
// StorageAccount is the properties that are associated with an Azure Storage
// account
type StorageAccount struct {
AccountName *string `json:"accountName,omitempty"`
AccountKey *string `json:"accountKey,omitempty"`
}
// StreamingJob is a streamng job object, containing all information associated
// with the named streaming job.
type StreamingJob struct {
autorest.Response `json:"-"`
ID *string `json:"id,omitempty"`
Name *string `json:"name,omitempty"`
Type *string `json:"type,omitempty"`
Location *string `json:"location,omitempty"`
Tags *map[string]*string `json:"tags,omitempty"`
*StreamingJobProperties `json:"properties,omitempty"`
}
// StreamingJobListResult is object containing a list of streaming jobs.
type StreamingJobListResult struct {
autorest.Response `json:"-"`
Value *[]StreamingJob `json:"value,omitempty"`
NextLink *string `json:"nextLink,omitempty"`
}
// StreamingJobListResultPreparer prepares a request to retrieve the next set of results. It returns
// nil if no more results exist.
func (client StreamingJobListResult) StreamingJobListResultPreparer() (*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)))
}
// StreamingJobProperties is the properties that are associated with a
// streaming job.
type StreamingJobProperties struct {
Sku *Sku `json:"sku,omitempty"`
JobID *string `json:"jobId,omitempty"`
ProvisioningState *string `json:"provisioningState,omitempty"`
JobState *string `json:"jobState,omitempty"`
OutputStartMode OutputStartMode `json:"outputStartMode,omitempty"`
OutputStartTime *date.Time `json:"outputStartTime,omitempty"`
LastOutputEventTime *date.Time `json:"lastOutputEventTime,omitempty"`
EventsOutOfOrderPolicy EventsOutOfOrderPolicy `json:"eventsOutOfOrderPolicy,omitempty"`
OutputErrorPolicy OutputErrorPolicy `json:"outputErrorPolicy,omitempty"`
EventsOutOfOrderMaxDelayInSeconds *int32 `json:"eventsOutOfOrderMaxDelayInSeconds,omitempty"`
EventsLateArrivalMaxDelayInSeconds *int32 `json:"eventsLateArrivalMaxDelayInSeconds,omitempty"`
DataLocale *string `json:"dataLocale,omitempty"`
CompatibilityLevel CompatibilityLevel `json:"compatibilityLevel,omitempty"`
CreatedDate *date.Time `json:"createdDate,omitempty"`
Inputs *[]Input `json:"inputs,omitempty"`
Transformation *Transformation `json:"transformation,omitempty"`
Outputs *[]Output `json:"outputs,omitempty"`
Functions *[]Function `json:"functions,omitempty"`
Etag *string `json:"etag,omitempty"`
}
// StreamInputDataSource is describes an input data source that contains stream
// data.
type StreamInputDataSource struct {
}
// StreamInputProperties is the properties that are associated with an input
// containing stream data.
type StreamInputProperties struct {
Serialization *Serialization `json:"serialization,omitempty"`
Diagnostics *Diagnostics `json:"diagnostics,omitempty"`
Etag *string `json:"etag,omitempty"`
Datasource *StreamInputDataSource `json:"datasource,omitempty"`
}
// SubResource is the base sub-resource model definition.
type SubResource struct {
ID *string `json:"id,omitempty"`
Name *string `json:"name,omitempty"`
Type *string `json:"type,omitempty"`
}
// SubscriptionQuota is describes the current quota for the subscription.
type SubscriptionQuota struct {
ID *string `json:"id,omitempty"`
Name *string `json:"name,omitempty"`
Type *string `json:"type,omitempty"`
*SubscriptionQuotaProperties `json:"properties,omitempty"`
}
// SubscriptionQuotaProperties is describes the properties of the quota.
type SubscriptionQuotaProperties struct {
MaxCount *int32 `json:"maxCount,omitempty"`
CurrentCount *int32 `json:"currentCount,omitempty"`
}
// SubscriptionQuotasListResult is result of the GetQuotas operation. It
// contains a list of quotas for the subscription in a particular region.
type SubscriptionQuotasListResult struct {
autorest.Response `json:"-"`
Value *[]SubscriptionQuota `json:"value,omitempty"`
}
// Transformation is a transformation object, containing all information
// associated with the named transformation. All transformations are contained
// under a streaming job.
type Transformation struct {
autorest.Response `json:"-"`
ID *string `json:"id,omitempty"`
Name *string `json:"name,omitempty"`
Type *string `json:"type,omitempty"`
*TransformationProperties `json:"properties,omitempty"`
}
// TransformationProperties is the properties that are associated with a
// transformation.
type TransformationProperties struct {
StreamingUnits *int32 `json:"streamingUnits,omitempty"`
Query *string `json:"query,omitempty"`
Etag *string `json:"etag,omitempty"`
}
@@ -0,0 +1,167 @@
package streamanalytics
// 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.1.0.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"
)
// OperationsClient is the composite Swagger for Stream Analytics Client
type OperationsClient struct {
ManagementClient
}
// NewOperationsClient creates an instance of the OperationsClient client.
func NewOperationsClient(subscriptionID string) OperationsClient {
return NewOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID)
}
// NewOperationsClientWithBaseURI creates an instance of the OperationsClient
// client.
func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient {
return OperationsClient{NewWithBaseURI(baseURI, subscriptionID)}
}
// List lists all of the available Stream Analytics related operations.
func (client OperationsClient) List() (result OperationListResult, err error) {
req, err := client.ListPreparer()
if err != nil {
err = autorest.NewErrorWithError(err, "streamanalytics.OperationsClient", "List", nil, "Failure preparing request")
return
}
resp, err := client.ListSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "streamanalytics.OperationsClient", "List", resp, "Failure sending request")
return
}
result, err = client.ListResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "streamanalytics.OperationsClient", "List", resp, "Failure responding to request")
}
return
}
// ListPreparer prepares the List request.
func (client OperationsClient) ListPreparer() (*http.Request, error) {
const APIVersion = "2016-03-01"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsGet(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPath("/providers/Microsoft.StreamAnalytics/operations"),
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 OperationsClient) 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 OperationsClient) ListResponder(resp *http.Response) (result OperationListResult, 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 OperationsClient) ListNextResults(lastResults OperationListResult) (result OperationListResult, err error) {
req, err := lastResults.OperationListResultPreparer()
if err != nil {
return result, autorest.NewErrorWithError(err, "streamanalytics.OperationsClient", "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, "streamanalytics.OperationsClient", "List", resp, "Failure sending next results request")
}
result, err = client.ListResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "streamanalytics.OperationsClient", "List", resp, "Failure responding to next results request")
}
return
}
// ListComplete gets all elements from the list without paging.
func (client OperationsClient) ListComplete(cancel <-chan struct{}) (<-chan Operation, <-chan error) {
resultChan := make(chan Operation)
errChan := make(chan error, 1)
go func() {
defer func() {
close(resultChan)
close(errChan)
}()
list, err := client.List()
if err != nil {
errChan <- err
return
}
if list.Value != nil {
for _, item := range *list.Value {
select {
case <-cancel:
return
case resultChan <- item:
// Intentionally left blank
}
}
}
for list.NextLink != nil {
list, err = client.ListNextResults(list)
if err != nil {
errChan <- err
return
}
if list.Value != nil {
for _, item := range *list.Value {
select {
case <-cancel:
return
case resultChan <- item:
// Intentionally left blank
}
}
}
}
}()
return resultChan, errChan
}
+588
View File
@@ -0,0 +1,588 @@
package streamanalytics
// 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.1.0.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"
)
// OutputsClient is the composite Swagger for Stream Analytics Client
type OutputsClient struct {
ManagementClient
}
// NewOutputsClient creates an instance of the OutputsClient client.
func NewOutputsClient(subscriptionID string) OutputsClient {
return NewOutputsClientWithBaseURI(DefaultBaseURI, subscriptionID)
}
// NewOutputsClientWithBaseURI creates an instance of the OutputsClient client.
func NewOutputsClientWithBaseURI(baseURI string, subscriptionID string) OutputsClient {
return OutputsClient{NewWithBaseURI(baseURI, subscriptionID)}
}
// CreateOrReplace creates an output or replaces an already existing output
// under an existing streaming job.
//
// output is the definition of the output that will be used to create a new
// output or replace the existing one under the streaming job.
// resourceGroupName is the name of the resource group that contains the
// resource. You can obtain this value from the Azure Resource Manager API or
// the portal. jobName is the name of the streaming job. outputName is the name
// of the output. ifMatch is the ETag of the output. Omit this value to always
// overwrite the current output. Specify the last-seen ETag value to prevent
// accidentally overwritting concurrent changes. ifNoneMatch is set to '*' to
// allow a new output to be created, but to prevent updating an existing
// output. Other values will result in a 412 Pre-condition Failed response.
func (client OutputsClient) CreateOrReplace(output Output, resourceGroupName string, jobName string, outputName string, ifMatch string, ifNoneMatch string) (result Output, err error) {
req, err := client.CreateOrReplacePreparer(output, resourceGroupName, jobName, outputName, ifMatch, ifNoneMatch)
if err != nil {
err = autorest.NewErrorWithError(err, "streamanalytics.OutputsClient", "CreateOrReplace", nil, "Failure preparing request")
return
}
resp, err := client.CreateOrReplaceSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "streamanalytics.OutputsClient", "CreateOrReplace", resp, "Failure sending request")
return
}
result, err = client.CreateOrReplaceResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "streamanalytics.OutputsClient", "CreateOrReplace", resp, "Failure responding to request")
}
return
}
// CreateOrReplacePreparer prepares the CreateOrReplace request.
func (client OutputsClient) CreateOrReplacePreparer(output Output, resourceGroupName string, jobName string, outputName string, ifMatch string, ifNoneMatch string) (*http.Request, error) {
pathParameters := map[string]interface{}{
"jobName": autorest.Encode("path", jobName),
"outputName": autorest.Encode("path", outputName),
"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.StreamAnalytics/streamingjobs/{jobName}/outputs/{outputName}", pathParameters),
autorest.WithJSON(output),
autorest.WithQueryParameters(queryParameters))
if len(ifMatch) > 0 {
preparer = autorest.DecoratePreparer(preparer,
autorest.WithHeader("If-Match", autorest.String(ifMatch)))
}
if len(ifNoneMatch) > 0 {
preparer = autorest.DecoratePreparer(preparer,
autorest.WithHeader("If-None-Match", autorest.String(ifNoneMatch)))
}
return preparer.Prepare(&http.Request{})
}
// CreateOrReplaceSender sends the CreateOrReplace request. The method will close the
// http.Response Body if it receives an error.
func (client OutputsClient) CreateOrReplaceSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req)
}
// CreateOrReplaceResponder handles the response to the CreateOrReplace request. The method always
// closes the http.Response Body.
func (client OutputsClient) CreateOrReplaceResponder(resp *http.Response) (result Output, 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 an output from the streaming job.
//
// resourceGroupName is the name of the resource group that contains the
// resource. You can obtain this value from the Azure Resource Manager API or
// the portal. jobName is the name of the streaming job. outputName is the name
// of the output.
func (client OutputsClient) Delete(resourceGroupName string, jobName string, outputName string) (result autorest.Response, err error) {
req, err := client.DeletePreparer(resourceGroupName, jobName, outputName)
if err != nil {
err = autorest.NewErrorWithError(err, "streamanalytics.OutputsClient", "Delete", nil, "Failure preparing request")
return
}
resp, err := client.DeleteSender(req)
if err != nil {
result.Response = resp
err = autorest.NewErrorWithError(err, "streamanalytics.OutputsClient", "Delete", resp, "Failure sending request")
return
}
result, err = client.DeleteResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "streamanalytics.OutputsClient", "Delete", resp, "Failure responding to request")
}
return
}
// DeletePreparer prepares the Delete request.
func (client OutputsClient) DeletePreparer(resourceGroupName string, jobName string, outputName string) (*http.Request, error) {
pathParameters := map[string]interface{}{
"jobName": autorest.Encode("path", jobName),
"outputName": autorest.Encode("path", outputName),
"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.StreamAnalytics/streamingjobs/{jobName}/outputs/{outputName}", 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 OutputsClient) 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 OutputsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent),
autorest.ByClosing())
result.Response = resp
return
}
// Get gets details about the specified output.
//
// resourceGroupName is the name of the resource group that contains the
// resource. You can obtain this value from the Azure Resource Manager API or
// the portal. jobName is the name of the streaming job. outputName is the name
// of the output.
func (client OutputsClient) Get(resourceGroupName string, jobName string, outputName string) (result Output, err error) {
req, err := client.GetPreparer(resourceGroupName, jobName, outputName)
if err != nil {
err = autorest.NewErrorWithError(err, "streamanalytics.OutputsClient", "Get", nil, "Failure preparing request")
return
}
resp, err := client.GetSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "streamanalytics.OutputsClient", "Get", resp, "Failure sending request")
return
}
result, err = client.GetResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "streamanalytics.OutputsClient", "Get", resp, "Failure responding to request")
}
return
}
// GetPreparer prepares the Get request.
func (client OutputsClient) GetPreparer(resourceGroupName string, jobName string, outputName string) (*http.Request, error) {
pathParameters := map[string]interface{}{
"jobName": autorest.Encode("path", jobName),
"outputName": autorest.Encode("path", outputName),
"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.StreamAnalytics/streamingjobs/{jobName}/outputs/{outputName}", 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 OutputsClient) 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 OutputsClient) GetResponder(resp *http.Response) (result Output, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
// ListByStreamingJob lists all of the outputs under the specified streaming
// job.
//
// resourceGroupName is the name of the resource group that contains the
// resource. You can obtain this value from the Azure Resource Manager API or
// the portal. jobName is the name of the streaming job. selectParameter is the
// $select OData query parameter. This is a comma-separated list of structural
// properties to include in the response, or “*” to include all properties. By
// default, all properties are returned except diagnostics. Currently only
// accepts '*' as a valid value.
func (client OutputsClient) ListByStreamingJob(resourceGroupName string, jobName string, selectParameter string) (result OutputListResult, err error) {
req, err := client.ListByStreamingJobPreparer(resourceGroupName, jobName, selectParameter)
if err != nil {
err = autorest.NewErrorWithError(err, "streamanalytics.OutputsClient", "ListByStreamingJob", nil, "Failure preparing request")
return
}
resp, err := client.ListByStreamingJobSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "streamanalytics.OutputsClient", "ListByStreamingJob", resp, "Failure sending request")
return
}
result, err = client.ListByStreamingJobResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "streamanalytics.OutputsClient", "ListByStreamingJob", resp, "Failure responding to request")
}
return
}
// ListByStreamingJobPreparer prepares the ListByStreamingJob request.
func (client OutputsClient) ListByStreamingJobPreparer(resourceGroupName string, jobName string, selectParameter string) (*http.Request, error) {
pathParameters := map[string]interface{}{
"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 len(selectParameter) > 0 {
queryParameters["$select"] = autorest.Encode("query", selectParameter)
}
preparer := autorest.CreatePreparer(
autorest.AsGet(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/outputs", pathParameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{})
}
// ListByStreamingJobSender sends the ListByStreamingJob request. The method will close the
// http.Response Body if it receives an error.
func (client OutputsClient) ListByStreamingJobSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req)
}
// ListByStreamingJobResponder handles the response to the ListByStreamingJob request. The method always
// closes the http.Response Body.
func (client OutputsClient) ListByStreamingJobResponder(resp *http.Response) (result OutputListResult, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
// ListByStreamingJobNextResults retrieves the next set of results, if any.
func (client OutputsClient) ListByStreamingJobNextResults(lastResults OutputListResult) (result OutputListResult, err error) {
req, err := lastResults.OutputListResultPreparer()
if err != nil {
return result, autorest.NewErrorWithError(err, "streamanalytics.OutputsClient", "ListByStreamingJob", nil, "Failure preparing next results request")
}
if req == nil {
return
}
resp, err := client.ListByStreamingJobSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "streamanalytics.OutputsClient", "ListByStreamingJob", resp, "Failure sending next results request")
}
result, err = client.ListByStreamingJobResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "streamanalytics.OutputsClient", "ListByStreamingJob", resp, "Failure responding to next results request")
}
return
}
// ListByStreamingJobComplete gets all elements from the list without paging.
func (client OutputsClient) ListByStreamingJobComplete(resourceGroupName string, jobName string, selectParameter string, cancel <-chan struct{}) (<-chan Output, <-chan error) {
resultChan := make(chan Output)
errChan := make(chan error, 1)
go func() {
defer func() {
close(resultChan)
close(errChan)
}()
list, err := client.ListByStreamingJob(resourceGroupName, jobName, selectParameter)
if err != nil {
errChan <- err
return
}
if list.Value != nil {
for _, item := range *list.Value {
select {
case <-cancel:
return
case resultChan <- item:
// Intentionally left blank
}
}
}
for list.NextLink != nil {
list, err = client.ListByStreamingJobNextResults(list)
if err != nil {
errChan <- err
return
}
if list.Value != nil {
for _, item := range *list.Value {
select {
case <-cancel:
return
case resultChan <- item:
// Intentionally left blank
}
}
}
}
}()
return resultChan, errChan
}
// Test tests whether an output’s datasource is reachable and usable by the
// Azure Stream Analytics service. 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 name of the resource group that contains the
// resource. You can obtain this value from the Azure Resource Manager API or
// the portal. jobName is the name of the streaming job. outputName is the name
// of the output. output is if the output specified does not already exist,
// this parameter must contain the full output definition intended to be
// tested. If the output specified already exists, this parameter can be left
// null to test the existing output as is or if specified, the properties
// specified will overwrite the corresponding properties in the existing output
// (exactly like a PATCH operation) and the resulting output will be tested.
func (client OutputsClient) Test(resourceGroupName string, jobName string, outputName string, output *Output, cancel <-chan struct{}) (<-chan ResourceTestStatus, <-chan error) {
resultChan := make(chan ResourceTestStatus, 1)
errChan := make(chan error, 1)
go func() {
var err error
var result ResourceTestStatus
defer func() {
if err != nil {
errChan <- err
}
resultChan <- result
close(resultChan)
close(errChan)
}()
req, err := client.TestPreparer(resourceGroupName, jobName, outputName, output, cancel)
if err != nil {
err = autorest.NewErrorWithError(err, "streamanalytics.OutputsClient", "Test", nil, "Failure preparing request")
return
}
resp, err := client.TestSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "streamanalytics.OutputsClient", "Test", resp, "Failure sending request")
return
}
result, err = client.TestResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "streamanalytics.OutputsClient", "Test", resp, "Failure responding to request")
}
}()
return resultChan, errChan
}
// TestPreparer prepares the Test request.
func (client OutputsClient) TestPreparer(resourceGroupName string, jobName string, outputName string, output *Output, cancel <-chan struct{}) (*http.Request, error) {
pathParameters := map[string]interface{}{
"jobName": autorest.Encode("path", jobName),
"outputName": autorest.Encode("path", outputName),
"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.AsPost(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/outputs/{outputName}/test", pathParameters),
autorest.WithQueryParameters(queryParameters))
if output != nil {
preparer = autorest.DecoratePreparer(preparer,
autorest.WithJSON(output))
}
return preparer.Prepare(&http.Request{Cancel: cancel})
}
// TestSender sends the Test request. The method will close the
// http.Response Body if it receives an error.
func (client OutputsClient) TestSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client,
req,
azure.DoPollForAsynchronous(client.PollingDelay))
}
// TestResponder handles the response to the Test request. The method always
// closes the http.Response Body.
func (client OutputsClient) TestResponder(resp *http.Response) (result ResourceTestStatus, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
// Update updates an existing output under an existing streaming job. This can
// be used to partially update (ie. update one or two properties) an output
// without affecting the rest the job or output definition.
//
// output is an Output object. The properties specified here will overwrite the
// corresponding properties in the existing output (ie. Those properties will
// be updated). Any properties that are set to null here will mean that the
// corresponding property in the existing output will remain the same and not
// change as a result of this PATCH operation. resourceGroupName is the name of
// the resource group that contains the resource. You can obtain this value
// from the Azure Resource Manager API or the portal. jobName is the name of
// the streaming job. outputName is the name of the output. ifMatch is the ETag
// of the output. Omit this value to always overwrite the current output.
// Specify the last-seen ETag value to prevent accidentally overwritting
// concurrent changes.
func (client OutputsClient) Update(output Output, resourceGroupName string, jobName string, outputName string, ifMatch string) (result Output, err error) {
req, err := client.UpdatePreparer(output, resourceGroupName, jobName, outputName, ifMatch)
if err != nil {
err = autorest.NewErrorWithError(err, "streamanalytics.OutputsClient", "Update", nil, "Failure preparing request")
return
}
resp, err := client.UpdateSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "streamanalytics.OutputsClient", "Update", resp, "Failure sending request")
return
}
result, err = client.UpdateResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "streamanalytics.OutputsClient", "Update", resp, "Failure responding to request")
}
return
}
// UpdatePreparer prepares the Update request.
func (client OutputsClient) UpdatePreparer(output Output, resourceGroupName string, jobName string, outputName string, ifMatch string) (*http.Request, error) {
pathParameters := map[string]interface{}{
"jobName": autorest.Encode("path", jobName),
"outputName": autorest.Encode("path", outputName),
"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.StreamAnalytics/streamingjobs/{jobName}/outputs/{outputName}", pathParameters),
autorest.WithJSON(output),
autorest.WithQueryParameters(queryParameters))
if len(ifMatch) > 0 {
preparer = autorest.DecoratePreparer(preparer,
autorest.WithHeader("If-Match", autorest.String(ifMatch)))
}
return preparer.Prepare(&http.Request{})
}
// UpdateSender sends the Update request. The method will close the
// http.Response Body if it receives an error.
func (client OutputsClient) UpdateSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req)
}
// UpdateResponder handles the response to the Update request. The method always
// closes the http.Response Body.
func (client OutputsClient) UpdateResponder(resp *http.Response) (result Output, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
@@ -0,0 +1,842 @@
package streamanalytics
// 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.1.0.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"
)
// StreamingJobsClient is the composite Swagger for Stream Analytics Client
type StreamingJobsClient struct {
ManagementClient
}
// NewStreamingJobsClient creates an instance of the StreamingJobsClient
// client.
func NewStreamingJobsClient(subscriptionID string) StreamingJobsClient {
return NewStreamingJobsClientWithBaseURI(DefaultBaseURI, subscriptionID)
}
// NewStreamingJobsClientWithBaseURI creates an instance of the
// StreamingJobsClient client.
func NewStreamingJobsClientWithBaseURI(baseURI string, subscriptionID string) StreamingJobsClient {
return StreamingJobsClient{NewWithBaseURI(baseURI, subscriptionID)}
}
// CreateOrReplace creates a streaming job or replaces an already existing
// streaming job. 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.
//
// streamingJob is the definition of the streaming job that will be used to
// create a new streaming job or replace the existing one. resourceGroupName is
// the name of the resource group that contains the resource. You can obtain
// this value from the Azure Resource Manager API or the portal. jobName is the
// name of the streaming job. ifMatch is the ETag of the streaming job. Omit
// this value to always overwrite the current record set. Specify the last-seen
// ETag value to prevent accidentally overwritting concurrent changes.
// ifNoneMatch is set to '*' to allow a new streaming job to be created, but to
// prevent updating an existing record set. Other values will result in a 412
// Pre-condition Failed response.
func (client StreamingJobsClient) CreateOrReplace(streamingJob StreamingJob, resourceGroupName string, jobName string, ifMatch string, ifNoneMatch string, cancel <-chan struct{}) (<-chan StreamingJob, <-chan error) {
resultChan := make(chan StreamingJob, 1)
errChan := make(chan error, 1)
go func() {
var err error
var result StreamingJob
defer func() {
if err != nil {
errChan <- err
}
resultChan <- result
close(resultChan)
close(errChan)
}()
req, err := client.CreateOrReplacePreparer(streamingJob, resourceGroupName, jobName, ifMatch, ifNoneMatch, cancel)
if err != nil {
err = autorest.NewErrorWithError(err, "streamanalytics.StreamingJobsClient", "CreateOrReplace", nil, "Failure preparing request")
return
}
resp, err := client.CreateOrReplaceSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "streamanalytics.StreamingJobsClient", "CreateOrReplace", resp, "Failure sending request")
return
}
result, err = client.CreateOrReplaceResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "streamanalytics.StreamingJobsClient", "CreateOrReplace", resp, "Failure responding to request")
}
}()
return resultChan, errChan
}
// CreateOrReplacePreparer prepares the CreateOrReplace request.
func (client StreamingJobsClient) CreateOrReplacePreparer(streamingJob StreamingJob, resourceGroupName string, jobName string, ifMatch string, ifNoneMatch string, cancel <-chan struct{}) (*http.Request, error) {
pathParameters := map[string]interface{}{
"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.StreamAnalytics/streamingjobs/{jobName}", pathParameters),
autorest.WithJSON(streamingJob),
autorest.WithQueryParameters(queryParameters))
if len(ifMatch) > 0 {
preparer = autorest.DecoratePreparer(preparer,
autorest.WithHeader("If-Match", autorest.String(ifMatch)))
}
if len(ifNoneMatch) > 0 {
preparer = autorest.DecoratePreparer(preparer,
autorest.WithHeader("If-None-Match", autorest.String(ifNoneMatch)))
}
return preparer.Prepare(&http.Request{Cancel: cancel})
}
// CreateOrReplaceSender sends the CreateOrReplace request. The method will close the
// http.Response Body if it receives an error.
func (client StreamingJobsClient) CreateOrReplaceSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client,
req,
azure.DoPollForAsynchronous(client.PollingDelay))
}
// CreateOrReplaceResponder handles the response to the CreateOrReplace request. The method always
// closes the http.Response Body.
func (client StreamingJobsClient) CreateOrReplaceResponder(resp *http.Response) (result StreamingJob, 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 streaming job. 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 name of the resource group that contains the
// resource. You can obtain this value from the Azure Resource Manager API or
// the portal. jobName is the name of the streaming job.
func (client StreamingJobsClient) Delete(resourceGroupName string, jobName 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() {
if err != nil {
errChan <- err
}
resultChan <- result
close(resultChan)
close(errChan)
}()
req, err := client.DeletePreparer(resourceGroupName, jobName, cancel)
if err != nil {
err = autorest.NewErrorWithError(err, "streamanalytics.StreamingJobsClient", "Delete", nil, "Failure preparing request")
return
}
resp, err := client.DeleteSender(req)
if err != nil {
result.Response = resp
err = autorest.NewErrorWithError(err, "streamanalytics.StreamingJobsClient", "Delete", resp, "Failure sending request")
return
}
result, err = client.DeleteResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "streamanalytics.StreamingJobsClient", "Delete", resp, "Failure responding to request")
}
}()
return resultChan, errChan
}
// DeletePreparer prepares the Delete request.
func (client StreamingJobsClient) DeletePreparer(resourceGroupName string, jobName string, cancel <-chan struct{}) (*http.Request, error) {
pathParameters := map[string]interface{}{
"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.StreamAnalytics/streamingjobs/{jobName}", 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 StreamingJobsClient) 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 StreamingJobsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent),
autorest.ByClosing())
result.Response = resp
return
}
// Get gets details about the specified streaming job.
//
// resourceGroupName is the name of the resource group that contains the
// resource. You can obtain this value from the Azure Resource Manager API or
// the portal. jobName is the name of the streaming job. expand is the $expand
// OData query parameter. This is a comma-separated list of additional
// streaming job properties to include in the response, beyond the default set
// returned when this parameter is absent. The default set is all streaming job
// properties other than 'inputs', 'transformation', 'outputs', and
// 'functions'.
func (client StreamingJobsClient) Get(resourceGroupName string, jobName string, expand string) (result StreamingJob, err error) {
req, err := client.GetPreparer(resourceGroupName, jobName, expand)
if err != nil {
err = autorest.NewErrorWithError(err, "streamanalytics.StreamingJobsClient", "Get", nil, "Failure preparing request")
return
}
resp, err := client.GetSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "streamanalytics.StreamingJobsClient", "Get", resp, "Failure sending request")
return
}
result, err = client.GetResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "streamanalytics.StreamingJobsClient", "Get", resp, "Failure responding to request")
}
return
}
// GetPreparer prepares the Get request.
func (client StreamingJobsClient) GetPreparer(resourceGroupName string, jobName string, expand string) (*http.Request, error) {
pathParameters := map[string]interface{}{
"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 len(expand) > 0 {
queryParameters["$expand"] = autorest.Encode("query", expand)
}
preparer := autorest.CreatePreparer(
autorest.AsGet(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{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 StreamingJobsClient) 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 StreamingJobsClient) GetResponder(resp *http.Response) (result StreamingJob, 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 of the streaming jobs in the given subscription.
//
// expand is the $expand OData query parameter. This is a comma-separated list
// of additional streaming job properties to include in the response, beyond
// the default set returned when this parameter is absent. The default set is
// all streaming job properties other than 'inputs', 'transformation',
// 'outputs', and 'functions'.
func (client StreamingJobsClient) List(expand string) (result StreamingJobListResult, err error) {
req, err := client.ListPreparer(expand)
if err != nil {
err = autorest.NewErrorWithError(err, "streamanalytics.StreamingJobsClient", "List", nil, "Failure preparing request")
return
}
resp, err := client.ListSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "streamanalytics.StreamingJobsClient", "List", resp, "Failure sending request")
return
}
result, err = client.ListResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "streamanalytics.StreamingJobsClient", "List", resp, "Failure responding to request")
}
return
}
// ListPreparer prepares the List request.
func (client StreamingJobsClient) ListPreparer(expand string) (*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,
}
if len(expand) > 0 {
queryParameters["$expand"] = autorest.Encode("query", expand)
}
preparer := autorest.CreatePreparer(
autorest.AsGet(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.StreamAnalytics/streamingjobs", 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 StreamingJobsClient) 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 StreamingJobsClient) ListResponder(resp *http.Response) (result StreamingJobListResult, 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 StreamingJobsClient) ListNextResults(lastResults StreamingJobListResult) (result StreamingJobListResult, err error) {
req, err := lastResults.StreamingJobListResultPreparer()
if err != nil {
return result, autorest.NewErrorWithError(err, "streamanalytics.StreamingJobsClient", "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, "streamanalytics.StreamingJobsClient", "List", resp, "Failure sending next results request")
}
result, err = client.ListResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "streamanalytics.StreamingJobsClient", "List", resp, "Failure responding to next results request")
}
return
}
// ListComplete gets all elements from the list without paging.
func (client StreamingJobsClient) ListComplete(expand string, cancel <-chan struct{}) (<-chan StreamingJob, <-chan error) {
resultChan := make(chan StreamingJob)
errChan := make(chan error, 1)
go func() {
defer func() {
close(resultChan)
close(errChan)
}()
list, err := client.List(expand)
if err != nil {
errChan <- err
return
}
if list.Value != nil {
for _, item := range *list.Value {
select {
case <-cancel:
return
case resultChan <- item:
// Intentionally left blank
}
}
}
for list.NextLink != nil {
list, err = client.ListNextResults(list)
if err != nil {
errChan <- err
return
}
if list.Value != nil {
for _, item := range *list.Value {
select {
case <-cancel:
return
case resultChan <- item:
// Intentionally left blank
}
}
}
}
}()
return resultChan, errChan
}
// ListByResourceGroup lists all of the streaming jobs in the specified
// resource group.
//
// resourceGroupName is the name of the resource group that contains the
// resource. You can obtain this value from the Azure Resource Manager API or
// the portal. expand is the $expand OData query parameter. This is a
// comma-separated list of additional streaming job properties to include in
// the response, beyond the default set returned when this parameter is absent.
// The default set is all streaming job properties other than 'inputs',
// 'transformation', 'outputs', and 'functions'.
func (client StreamingJobsClient) ListByResourceGroup(resourceGroupName string, expand string) (result StreamingJobListResult, err error) {
req, err := client.ListByResourceGroupPreparer(resourceGroupName, expand)
if err != nil {
err = autorest.NewErrorWithError(err, "streamanalytics.StreamingJobsClient", "ListByResourceGroup", nil, "Failure preparing request")
return
}
resp, err := client.ListByResourceGroupSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "streamanalytics.StreamingJobsClient", "ListByResourceGroup", resp, "Failure sending request")
return
}
result, err = client.ListByResourceGroupResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "streamanalytics.StreamingJobsClient", "ListByResourceGroup", resp, "Failure responding to request")
}
return
}
// ListByResourceGroupPreparer prepares the ListByResourceGroup request.
func (client StreamingJobsClient) ListByResourceGroupPreparer(resourceGroupName string, expand 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,
}
if len(expand) > 0 {
queryParameters["$expand"] = autorest.Encode("query", expand)
}
preparer := autorest.CreatePreparer(
autorest.AsGet(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs", 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 StreamingJobsClient) 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 StreamingJobsClient) ListByResourceGroupResponder(resp *http.Response) (result StreamingJobListResult, 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 StreamingJobsClient) ListByResourceGroupNextResults(lastResults StreamingJobListResult) (result StreamingJobListResult, err error) {
req, err := lastResults.StreamingJobListResultPreparer()
if err != nil {
return result, autorest.NewErrorWithError(err, "streamanalytics.StreamingJobsClient", "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, "streamanalytics.StreamingJobsClient", "ListByResourceGroup", resp, "Failure sending next results request")
}
result, err = client.ListByResourceGroupResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "streamanalytics.StreamingJobsClient", "ListByResourceGroup", resp, "Failure responding to next results request")
}
return
}
// ListByResourceGroupComplete gets all elements from the list without paging.
func (client StreamingJobsClient) ListByResourceGroupComplete(resourceGroupName string, expand string, cancel <-chan struct{}) (<-chan StreamingJob, <-chan error) {
resultChan := make(chan StreamingJob)
errChan := make(chan error, 1)
go func() {
defer func() {
close(resultChan)
close(errChan)
}()
list, err := client.ListByResourceGroup(resourceGroupName, expand)
if err != nil {
errChan <- err
return
}
if list.Value != nil {
for _, item := range *list.Value {
select {
case <-cancel:
return
case resultChan <- item:
// Intentionally left blank
}
}
}
for list.NextLink != nil {
list, err = client.ListByResourceGroupNextResults(list)
if err != nil {
errChan <- err
return
}
if list.Value != nil {
for _, item := range *list.Value {
select {
case <-cancel:
return
case resultChan <- item:
// Intentionally left blank
}
}
}
}
}()
return resultChan, errChan
}
// Start starts a streaming job. Once a job is started it will start processing
// input events and produce output. 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 name of the resource group that contains the
// resource. You can obtain this value from the Azure Resource Manager API or
// the portal. jobName is the name of the streaming job. startJobParameters is
// parameters applicable to a start streaming job operation.
func (client StreamingJobsClient) Start(resourceGroupName string, jobName string, startJobParameters *StartStreamingJobParameters, 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() {
if err != nil {
errChan <- err
}
resultChan <- result
close(resultChan)
close(errChan)
}()
req, err := client.StartPreparer(resourceGroupName, jobName, startJobParameters, cancel)
if err != nil {
err = autorest.NewErrorWithError(err, "streamanalytics.StreamingJobsClient", "Start", nil, "Failure preparing request")
return
}
resp, err := client.StartSender(req)
if err != nil {
result.Response = resp
err = autorest.NewErrorWithError(err, "streamanalytics.StreamingJobsClient", "Start", resp, "Failure sending request")
return
}
result, err = client.StartResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "streamanalytics.StreamingJobsClient", "Start", resp, "Failure responding to request")
}
}()
return resultChan, errChan
}
// StartPreparer prepares the Start request.
func (client StreamingJobsClient) StartPreparer(resourceGroupName string, jobName string, startJobParameters *StartStreamingJobParameters, cancel <-chan struct{}) (*http.Request, error) {
pathParameters := map[string]interface{}{
"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.AsPost(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/start", pathParameters),
autorest.WithQueryParameters(queryParameters))
if startJobParameters != nil {
preparer = autorest.DecoratePreparer(preparer,
autorest.WithJSON(startJobParameters))
}
return preparer.Prepare(&http.Request{Cancel: cancel})
}
// StartSender sends the Start request. The method will close the
// http.Response Body if it receives an error.
func (client StreamingJobsClient) StartSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client,
req,
azure.DoPollForAsynchronous(client.PollingDelay))
}
// StartResponder handles the response to the Start request. The method always
// closes the http.Response Body.
func (client StreamingJobsClient) StartResponder(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
}
// Stop stops a running streaming job. This will cause a running streaming job
// to stop processing input events and producing output. 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 name of the resource group that contains the
// resource. You can obtain this value from the Azure Resource Manager API or
// the portal. jobName is the name of the streaming job.
func (client StreamingJobsClient) Stop(resourceGroupName string, jobName 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() {
if err != nil {
errChan <- err
}
resultChan <- result
close(resultChan)
close(errChan)
}()
req, err := client.StopPreparer(resourceGroupName, jobName, cancel)
if err != nil {
err = autorest.NewErrorWithError(err, "streamanalytics.StreamingJobsClient", "Stop", nil, "Failure preparing request")
return
}
resp, err := client.StopSender(req)
if err != nil {
result.Response = resp
err = autorest.NewErrorWithError(err, "streamanalytics.StreamingJobsClient", "Stop", resp, "Failure sending request")
return
}
result, err = client.StopResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "streamanalytics.StreamingJobsClient", "Stop", resp, "Failure responding to request")
}
}()
return resultChan, errChan
}
// StopPreparer prepares the Stop request.
func (client StreamingJobsClient) StopPreparer(resourceGroupName string, jobName string, cancel <-chan struct{}) (*http.Request, error) {
pathParameters := map[string]interface{}{
"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.StreamAnalytics/streamingjobs/{jobName}/stop", pathParameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{Cancel: cancel})
}
// StopSender sends the Stop request. The method will close the
// http.Response Body if it receives an error.
func (client StreamingJobsClient) StopSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client,
req,
azure.DoPollForAsynchronous(client.PollingDelay))
}
// StopResponder handles the response to the Stop request. The method always
// closes the http.Response Body.
func (client StreamingJobsClient) StopResponder(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
}
// Update updates an existing streaming job. This can be used to partially
// update (ie. update one or two properties) a streaming job without affecting
// the rest the job definition.
//
// streamingJob is a streaming job object. The properties specified here will
// overwrite the corresponding properties in the existing streaming job (ie.
// Those properties will be updated). Any properties that are set to null here
// will mean that the corresponding property in the existing input will remain
// the same and not change as a result of this PATCH operation.
// resourceGroupName is the name of the resource group that contains the
// resource. You can obtain this value from the Azure Resource Manager API or
// the portal. jobName is the name of the streaming job. ifMatch is the ETag of
// the streaming job. Omit this value to always overwrite the current record
// set. Specify the last-seen ETag value to prevent accidentally overwritting
// concurrent changes.
func (client StreamingJobsClient) Update(streamingJob StreamingJob, resourceGroupName string, jobName string, ifMatch string) (result StreamingJob, err error) {
req, err := client.UpdatePreparer(streamingJob, resourceGroupName, jobName, ifMatch)
if err != nil {
err = autorest.NewErrorWithError(err, "streamanalytics.StreamingJobsClient", "Update", nil, "Failure preparing request")
return
}
resp, err := client.UpdateSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "streamanalytics.StreamingJobsClient", "Update", resp, "Failure sending request")
return
}
result, err = client.UpdateResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "streamanalytics.StreamingJobsClient", "Update", resp, "Failure responding to request")
}
return
}
// UpdatePreparer prepares the Update request.
func (client StreamingJobsClient) UpdatePreparer(streamingJob StreamingJob, resourceGroupName string, jobName string, ifMatch string) (*http.Request, error) {
pathParameters := map[string]interface{}{
"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.StreamAnalytics/streamingjobs/{jobName}", pathParameters),
autorest.WithJSON(streamingJob),
autorest.WithQueryParameters(queryParameters))
if len(ifMatch) > 0 {
preparer = autorest.DecoratePreparer(preparer,
autorest.WithHeader("If-Match", autorest.String(ifMatch)))
}
return preparer.Prepare(&http.Request{})
}
// UpdateSender sends the Update request. The method will close the
// http.Response Body if it receives an error.
func (client StreamingJobsClient) UpdateSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req)
}
// UpdateResponder handles the response to the Update request. The method always
// closes the http.Response Body.
func (client StreamingJobsClient) UpdateResponder(resp *http.Response) (result StreamingJob, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
@@ -0,0 +1,109 @@
package streamanalytics
// 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.1.0.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"
)
// SubscriptionsClient is the composite Swagger for Stream Analytics Client
type SubscriptionsClient struct {
ManagementClient
}
// NewSubscriptionsClient creates an instance of the SubscriptionsClient
// client.
func NewSubscriptionsClient(subscriptionID string) SubscriptionsClient {
return NewSubscriptionsClientWithBaseURI(DefaultBaseURI, subscriptionID)
}
// NewSubscriptionsClientWithBaseURI creates an instance of the
// SubscriptionsClient client.
func NewSubscriptionsClientWithBaseURI(baseURI string, subscriptionID string) SubscriptionsClient {
return SubscriptionsClient{NewWithBaseURI(baseURI, subscriptionID)}
}
// ListQuotas retrieves the subscription's current quota information in a
// particular region.
//
// location is the region in which to retrieve the subscription's quota
// information. You can find out which regions Azure Stream Analytics is
// supported in here: https://azure.microsoft.com/en-us/regions/
func (client SubscriptionsClient) ListQuotas(location string) (result SubscriptionQuotasListResult, err error) {
req, err := client.ListQuotasPreparer(location)
if err != nil {
err = autorest.NewErrorWithError(err, "streamanalytics.SubscriptionsClient", "ListQuotas", nil, "Failure preparing request")
return
}
resp, err := client.ListQuotasSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "streamanalytics.SubscriptionsClient", "ListQuotas", resp, "Failure sending request")
return
}
result, err = client.ListQuotasResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "streamanalytics.SubscriptionsClient", "ListQuotas", resp, "Failure responding to request")
}
return
}
// ListQuotasPreparer prepares the ListQuotas request.
func (client SubscriptionsClient) ListQuotasPreparer(location string) (*http.Request, error) {
pathParameters := map[string]interface{}{
"location": autorest.Encode("path", location),
"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.StreamAnalytics/locations/{location}/quotas", pathParameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{})
}
// ListQuotasSender sends the ListQuotas request. The method will close the
// http.Response Body if it receives an error.
func (client SubscriptionsClient) ListQuotasSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req)
}
// ListQuotasResponder handles the response to the ListQuotas request. The method always
// closes the http.Response Body.
func (client SubscriptionsClient) ListQuotasResponder(resp *http.Response) (result SubscriptionQuotasListResult, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
@@ -0,0 +1,284 @@
package streamanalytics
// 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.1.0.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"
)
// TransformationsClient is the composite Swagger for Stream Analytics Client
type TransformationsClient struct {
ManagementClient
}
// NewTransformationsClient creates an instance of the TransformationsClient
// client.
func NewTransformationsClient(subscriptionID string) TransformationsClient {
return NewTransformationsClientWithBaseURI(DefaultBaseURI, subscriptionID)
}
// NewTransformationsClientWithBaseURI creates an instance of the
// TransformationsClient client.
func NewTransformationsClientWithBaseURI(baseURI string, subscriptionID string) TransformationsClient {
return TransformationsClient{NewWithBaseURI(baseURI, subscriptionID)}
}
// CreateOrReplace creates a transformation or replaces an already existing
// transformation under an existing streaming job.
//
// transformation is the definition of the transformation that will be used to
// create a new transformation or replace the existing one under the streaming
// job. resourceGroupName is the name of the resource group that contains the
// resource. You can obtain this value from the Azure Resource Manager API or
// the portal. jobName is the name of the streaming job. transformationName is
// the name of the transformation. ifMatch is the ETag of the transformation.
// Omit this value to always overwrite the current transformation. Specify the
// last-seen ETag value to prevent accidentally overwritting concurrent
// changes. ifNoneMatch is set to '*' to allow a new transformation to be
// created, but to prevent updating an existing transformation. Other values
// will result in a 412 Pre-condition Failed response.
func (client TransformationsClient) CreateOrReplace(transformation Transformation, resourceGroupName string, jobName string, transformationName string, ifMatch string, ifNoneMatch string) (result Transformation, err error) {
req, err := client.CreateOrReplacePreparer(transformation, resourceGroupName, jobName, transformationName, ifMatch, ifNoneMatch)
if err != nil {
err = autorest.NewErrorWithError(err, "streamanalytics.TransformationsClient", "CreateOrReplace", nil, "Failure preparing request")
return
}
resp, err := client.CreateOrReplaceSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "streamanalytics.TransformationsClient", "CreateOrReplace", resp, "Failure sending request")
return
}
result, err = client.CreateOrReplaceResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "streamanalytics.TransformationsClient", "CreateOrReplace", resp, "Failure responding to request")
}
return
}
// CreateOrReplacePreparer prepares the CreateOrReplace request.
func (client TransformationsClient) CreateOrReplacePreparer(transformation Transformation, resourceGroupName string, jobName string, transformationName string, ifMatch string, ifNoneMatch string) (*http.Request, error) {
pathParameters := map[string]interface{}{
"jobName": autorest.Encode("path", jobName),
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
"transformationName": autorest.Encode("path", transformationName),
}
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.StreamAnalytics/streamingjobs/{jobName}/transformations/{transformationName}", pathParameters),
autorest.WithJSON(transformation),
autorest.WithQueryParameters(queryParameters))
if len(ifMatch) > 0 {
preparer = autorest.DecoratePreparer(preparer,
autorest.WithHeader("If-Match", autorest.String(ifMatch)))
}
if len(ifNoneMatch) > 0 {
preparer = autorest.DecoratePreparer(preparer,
autorest.WithHeader("If-None-Match", autorest.String(ifNoneMatch)))
}
return preparer.Prepare(&http.Request{})
}
// CreateOrReplaceSender sends the CreateOrReplace request. The method will close the
// http.Response Body if it receives an error.
func (client TransformationsClient) CreateOrReplaceSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req)
}
// CreateOrReplaceResponder handles the response to the CreateOrReplace request. The method always
// closes the http.Response Body.
func (client TransformationsClient) CreateOrReplaceResponder(resp *http.Response) (result Transformation, 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
}
// Get gets details about the specified transformation.
//
// resourceGroupName is the name of the resource group that contains the
// resource. You can obtain this value from the Azure Resource Manager API or
// the portal. jobName is the name of the streaming job. transformationName is
// the name of the transformation.
func (client TransformationsClient) Get(resourceGroupName string, jobName string, transformationName string) (result Transformation, err error) {
req, err := client.GetPreparer(resourceGroupName, jobName, transformationName)
if err != nil {
err = autorest.NewErrorWithError(err, "streamanalytics.TransformationsClient", "Get", nil, "Failure preparing request")
return
}
resp, err := client.GetSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "streamanalytics.TransformationsClient", "Get", resp, "Failure sending request")
return
}
result, err = client.GetResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "streamanalytics.TransformationsClient", "Get", resp, "Failure responding to request")
}
return
}
// GetPreparer prepares the Get request.
func (client TransformationsClient) GetPreparer(resourceGroupName string, jobName string, transformationName string) (*http.Request, error) {
pathParameters := map[string]interface{}{
"jobName": autorest.Encode("path", jobName),
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
"transformationName": autorest.Encode("path", transformationName),
}
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.StreamAnalytics/streamingjobs/{jobName}/transformations/{transformationName}", 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 TransformationsClient) 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 TransformationsClient) GetResponder(resp *http.Response) (result Transformation, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
// Update updates an existing transformation under an existing streaming job.
// This can be used to partially update (ie. update one or two properties) a
// transformation without affecting the rest the job or transformation
// definition.
//
// transformation is a Transformation object. The properties specified here
// will overwrite the corresponding properties in the existing transformation
// (ie. Those properties will be updated). Any properties that are set to null
// here will mean that the corresponding property in the existing
// transformation will remain the same and not change as a result of this PATCH
// operation. resourceGroupName is the name of the resource group that contains
// the resource. You can obtain this value from the Azure Resource Manager API
// or the portal. jobName is the name of the streaming job. transformationName
// is the name of the transformation. ifMatch is the ETag of the
// transformation. Omit this value to always overwrite the current
// transformation. Specify the last-seen ETag value to prevent accidentally
// overwritting concurrent changes.
func (client TransformationsClient) Update(transformation Transformation, resourceGroupName string, jobName string, transformationName string, ifMatch string) (result Transformation, err error) {
req, err := client.UpdatePreparer(transformation, resourceGroupName, jobName, transformationName, ifMatch)
if err != nil {
err = autorest.NewErrorWithError(err, "streamanalytics.TransformationsClient", "Update", nil, "Failure preparing request")
return
}
resp, err := client.UpdateSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "streamanalytics.TransformationsClient", "Update", resp, "Failure sending request")
return
}
result, err = client.UpdateResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "streamanalytics.TransformationsClient", "Update", resp, "Failure responding to request")
}
return
}
// UpdatePreparer prepares the Update request.
func (client TransformationsClient) UpdatePreparer(transformation Transformation, resourceGroupName string, jobName string, transformationName string, ifMatch string) (*http.Request, error) {
pathParameters := map[string]interface{}{
"jobName": autorest.Encode("path", jobName),
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
"transformationName": autorest.Encode("path", transformationName),
}
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.StreamAnalytics/streamingjobs/{jobName}/transformations/{transformationName}", pathParameters),
autorest.WithJSON(transformation),
autorest.WithQueryParameters(queryParameters))
if len(ifMatch) > 0 {
preparer = autorest.DecoratePreparer(preparer,
autorest.WithHeader("If-Match", autorest.String(ifMatch)))
}
return preparer.Prepare(&http.Request{})
}
// UpdateSender sends the Update request. The method will close the
// http.Response Body if it receives an error.
func (client TransformationsClient) UpdateSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req)
}
// UpdateResponder handles the response to the Update request. The method always
// closes the http.Response Body.
func (client TransformationsClient) UpdateResponder(resp *http.Response) (result Transformation, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
@@ -0,0 +1,29 @@
package streamanalytics
// 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.1.0.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-streamanalytics/"
}
// Version returns the semantic version (see http://semver.org) of the client.
func Version() string {
return "v10.1.0-beta"
}