From 4cf0f41544414d4be244975ff7d23b002d584637 Mon Sep 17 00:00:00 2001 From: JiahuiPeng <46921893+804873052@users.noreply.github.com> Date: Tue, 26 Oct 2021 16:08:50 +0800 Subject: [PATCH] Release sdk/resourcemanager/streamanalytics/armstreamanalytics v0.1.0 (#15840) * [Release] sdk/resourcemanager/streamanalytics/armstreamanalytics/0.1.0 generation from spec commit: 3c16aae50c7110e1aad241ac93995621d4093d46 * fix * Update CHANGELOG.md * Update CHANGELOG.md Co-authored-by: Arcturus --- .../armstreamanalytics/CHANGELOG.md | 5 + .../armstreamanalytics/LICENSE.txt | 21 + .../armstreamanalytics/README.md | 76 + .../armstreamanalytics/autorest.md | 12 + .../armstreamanalytics/build.go | 7 + .../streamanalytics/armstreamanalytics/ci.yml | 27 + .../streamanalytics/armstreamanalytics/go.mod | 8 + .../streamanalytics/armstreamanalytics/go.sum | 30 + .../armstreamanalytics/go_mod_tidy_hack.go | 13 + .../zz_generated_clusters_client.go | 514 ++ .../zz_generated_constants.go | 435 ++ .../zz_generated_functions_client.go | 547 +++ .../zz_generated_inputs_client.go | 470 ++ .../armstreamanalytics/zz_generated_models.go | 4329 +++++++++++++++++ .../zz_generated_operations_client.go | 81 + .../zz_generated_outputs_client.go | 470 ++ .../armstreamanalytics/zz_generated_pagers.go | 558 +++ .../zz_generated_pollers.go | 661 +++ .../zz_generated_polymorphic_helpers.go | 367 ++ .../zz_generated_privateendpoints_client.go | 322 ++ .../zz_generated_response_types.go | 1143 +++++ .../zz_generated_streamingjobs_client.go | 610 +++ .../zz_generated_subscriptions_client.go | 446 ++ .../zz_generated_time_rfc3339.go | 58 + .../zz_generated_transformations_client.go | 262 + 25 files changed, 11472 insertions(+) create mode 100644 sdk/resourcemanager/streamanalytics/armstreamanalytics/CHANGELOG.md create mode 100644 sdk/resourcemanager/streamanalytics/armstreamanalytics/LICENSE.txt create mode 100644 sdk/resourcemanager/streamanalytics/armstreamanalytics/README.md create mode 100644 sdk/resourcemanager/streamanalytics/armstreamanalytics/autorest.md create mode 100644 sdk/resourcemanager/streamanalytics/armstreamanalytics/build.go create mode 100644 sdk/resourcemanager/streamanalytics/armstreamanalytics/ci.yml create mode 100644 sdk/resourcemanager/streamanalytics/armstreamanalytics/go.mod create mode 100644 sdk/resourcemanager/streamanalytics/armstreamanalytics/go.sum create mode 100644 sdk/resourcemanager/streamanalytics/armstreamanalytics/go_mod_tidy_hack.go create mode 100644 sdk/resourcemanager/streamanalytics/armstreamanalytics/zz_generated_clusters_client.go create mode 100644 sdk/resourcemanager/streamanalytics/armstreamanalytics/zz_generated_constants.go create mode 100644 sdk/resourcemanager/streamanalytics/armstreamanalytics/zz_generated_functions_client.go create mode 100644 sdk/resourcemanager/streamanalytics/armstreamanalytics/zz_generated_inputs_client.go create mode 100644 sdk/resourcemanager/streamanalytics/armstreamanalytics/zz_generated_models.go create mode 100644 sdk/resourcemanager/streamanalytics/armstreamanalytics/zz_generated_operations_client.go create mode 100644 sdk/resourcemanager/streamanalytics/armstreamanalytics/zz_generated_outputs_client.go create mode 100644 sdk/resourcemanager/streamanalytics/armstreamanalytics/zz_generated_pagers.go create mode 100644 sdk/resourcemanager/streamanalytics/armstreamanalytics/zz_generated_pollers.go create mode 100644 sdk/resourcemanager/streamanalytics/armstreamanalytics/zz_generated_polymorphic_helpers.go create mode 100644 sdk/resourcemanager/streamanalytics/armstreamanalytics/zz_generated_privateendpoints_client.go create mode 100644 sdk/resourcemanager/streamanalytics/armstreamanalytics/zz_generated_response_types.go create mode 100644 sdk/resourcemanager/streamanalytics/armstreamanalytics/zz_generated_streamingjobs_client.go create mode 100644 sdk/resourcemanager/streamanalytics/armstreamanalytics/zz_generated_subscriptions_client.go create mode 100644 sdk/resourcemanager/streamanalytics/armstreamanalytics/zz_generated_time_rfc3339.go create mode 100644 sdk/resourcemanager/streamanalytics/armstreamanalytics/zz_generated_transformations_client.go diff --git a/sdk/resourcemanager/streamanalytics/armstreamanalytics/CHANGELOG.md b/sdk/resourcemanager/streamanalytics/armstreamanalytics/CHANGELOG.md new file mode 100644 index 000000000000..f3d80a0b8362 --- /dev/null +++ b/sdk/resourcemanager/streamanalytics/armstreamanalytics/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 0.1.0 (2021-10-26) + +- Initial preview release. diff --git a/sdk/resourcemanager/streamanalytics/armstreamanalytics/LICENSE.txt b/sdk/resourcemanager/streamanalytics/armstreamanalytics/LICENSE.txt new file mode 100644 index 000000000000..dc0c2ffb3dc1 --- /dev/null +++ b/sdk/resourcemanager/streamanalytics/armstreamanalytics/LICENSE.txt @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) Microsoft Corporation. All rights reserved. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/sdk/resourcemanager/streamanalytics/armstreamanalytics/README.md b/sdk/resourcemanager/streamanalytics/armstreamanalytics/README.md new file mode 100644 index 000000000000..617f623bd192 --- /dev/null +++ b/sdk/resourcemanager/streamanalytics/armstreamanalytics/README.md @@ -0,0 +1,76 @@ +# Azure Stream Analytics Module for Go + +[![PkgGoDev](https://pkg.go.dev/badge/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/streamanalytics/armstreamanalytics)](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/streamanalytics/armstreamanalytics) + +The `armstreamanalytics` module provides operations for working with Azure Stream Analytics. + +[Source code](https://github.com/Azure/azure-sdk-for-go/tree/main/sdk/resourcemanager/streamanalytics/armstreamanalytics) + +# Getting started + +## Prerequisites + +- an [Azure subscription](https://azure.microsoft.com/free/) +- Go 1.13 or above + +## Install the package + +This project uses [Go modules](https://github.com/golang/go/wiki/Modules) for versioning and dependency management. + +Install the Azure Stream Analytics module: + +```sh +go get github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/streamanalytics/armstreamanalytics +``` + +## Authorization + +When creating a client, you will need to provide a credential for authenticating with Azure Stream Analytics. The `azidentity` module provides facilities for various ways of authenticating with Azure including client/secret, certificate, managed identity, and more. + +```go +cred, err := azidentity.NewDefaultAzureCredential(nil) +``` + +For more information on authentication, please see the documentation for `azidentity` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity). + +## Connecting to Azure Stream Analytics + +Once you have a credential, create a connection to the desired ARM endpoint. The `github.com/Azure/azure-sdk-for-go/sdk/azcore/arm` package provides facilities for connecting with ARM endpoints including public and sovereign clouds as well as Azure Stack. + +```go +con := arm.NewDefaultConnection(cred, nil) +``` + +For more information on ARM connections, please see the documentation for `azcore` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore). + +## Clients + +Azure Stream Analytics modules consist of one or more clients. A client groups a set of related APIs, providing access to its functionality within the specified subscription. Create one or more clients to access the APIs you require using your `arm.Connection`. + +```go +client := armstreamanalytics.NewInputsClient(con, "") +``` + +## Provide Feedback + +If you encounter bugs or have suggestions, please +[open an issue](https://github.com/Azure/azure-sdk-for-go/issues) and assign the `Stream Analytics` label. + +# Contributing + +This project welcomes contributions and suggestions. Most contributions require +you to agree to a Contributor License Agreement (CLA) declaring that you have +the right to, and actually do, grant us the rights to use your contribution. +For details, visit [https://cla.microsoft.com](https://cla.microsoft.com). + +When you submit a pull request, a CLA-bot will automatically determine whether +you need to provide a CLA and decorate the PR appropriately (e.g., label, +comment). Simply follow the instructions provided by the bot. You will only +need to do this once across all repos using our CLA. + +This project has adopted the +[Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). +For more information, see the +[Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) +or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any +additional questions or comments. \ No newline at end of file diff --git a/sdk/resourcemanager/streamanalytics/armstreamanalytics/autorest.md b/sdk/resourcemanager/streamanalytics/armstreamanalytics/autorest.md new file mode 100644 index 000000000000..b318cda0e9d2 --- /dev/null +++ b/sdk/resourcemanager/streamanalytics/armstreamanalytics/autorest.md @@ -0,0 +1,12 @@ +### AutoRest Configuration + +> see https://aka.ms/autorest + +``` yaml +azure-arm: true +require: +- https://github.com/Azure/azure-rest-api-specs/blob/3c16aae50c7110e1aad241ac93995621d4093d46/specification/streamanalytics/resource-manager/readme.md +- https://github.com/Azure/azure-rest-api-specs/blob/3c16aae50c7110e1aad241ac93995621d4093d46/specification/streamanalytics/resource-manager/readme.go.md +license-header: MICROSOFT_MIT_NO_VERSION +module-version: 0.1.0 +``` \ No newline at end of file diff --git a/sdk/resourcemanager/streamanalytics/armstreamanalytics/build.go b/sdk/resourcemanager/streamanalytics/armstreamanalytics/build.go new file mode 100644 index 000000000000..ad0aa60360a4 --- /dev/null +++ b/sdk/resourcemanager/streamanalytics/armstreamanalytics/build.go @@ -0,0 +1,7 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. + +// This file enables 'go generate' to regenerate this specific SDK +//go:generate pwsh.exe ../../../../eng/scripts/build.ps1 -skipBuild -cleanGenerated -format -tidy -generate resourcemanager/streamanalytics/armstreamanalytics + +package armstreamanalytics diff --git a/sdk/resourcemanager/streamanalytics/armstreamanalytics/ci.yml b/sdk/resourcemanager/streamanalytics/armstreamanalytics/ci.yml new file mode 100644 index 000000000000..51e23c7f0f85 --- /dev/null +++ b/sdk/resourcemanager/streamanalytics/armstreamanalytics/ci.yml @@ -0,0 +1,27 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. +trigger: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/resourcemanager/streamanalytics/armstreamanalytics/ + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/resourcemanager/streamanalytics/armstreamanalytics/ + +stages: +- template: /eng/pipelines/templates/jobs/archetype-sdk-client.yml + parameters: + ServiceDirectory: 'resourcemanager/streamanalytics/armstreamanalytics' diff --git a/sdk/resourcemanager/streamanalytics/armstreamanalytics/go.mod b/sdk/resourcemanager/streamanalytics/armstreamanalytics/go.mod new file mode 100644 index 000000000000..1ddfef90c162 --- /dev/null +++ b/sdk/resourcemanager/streamanalytics/armstreamanalytics/go.mod @@ -0,0 +1,8 @@ +module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/streamanalytics/armstreamanalytics + +go 1.16 + +require ( + github.com/Azure/azure-sdk-for-go v58.2.0+incompatible + github.com/Azure/azure-sdk-for-go/sdk/azcore v0.19.0 +) diff --git a/sdk/resourcemanager/streamanalytics/armstreamanalytics/go.sum b/sdk/resourcemanager/streamanalytics/armstreamanalytics/go.sum new file mode 100644 index 000000000000..c8ff7a2143ad --- /dev/null +++ b/sdk/resourcemanager/streamanalytics/armstreamanalytics/go.sum @@ -0,0 +1,30 @@ +github.com/Azure/azure-sdk-for-go v58.2.0+incompatible h1:iCb2tuoEm3N7ZpUDOvu1Yxl1B3iOVDmaD6weaRuIPzs= +github.com/Azure/azure-sdk-for-go v58.2.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= +github.com/Azure/azure-sdk-for-go/sdk/azcore v0.19.0 h1:lhSJz9RMbJcTgxifR1hUNJnn6CNYtbgEDtQV22/9RBA= +github.com/Azure/azure-sdk-for-go/sdk/azcore v0.19.0/go.mod h1:h6H6c8enJmmocHUbLiiGY6sx7f9i+X3m1CHdd5c6Rdw= +github.com/Azure/azure-sdk-for-go/sdk/internal v0.7.0 h1:v9p9TfTbf7AwNb5NYQt7hI41IfPoLFiFkLtb+bmGjT0= +github.com/Azure/azure-sdk-for-go/sdk/internal v0.7.0/go.mod h1:yqy467j36fJxcRV2TzfVZ1pCb5vxm4BtZPUdYWe/Xo8= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/dnaeon/go-vcr v1.2.0/go.mod h1:R4UdLID7HZT3taECzJs4YgbbH6PIGXB6W/sc5OLb6RQ= +github.com/modocache/gover v0.0.0-20171022184752-b58185e213c5/go.mod h1:caMODM3PzxT8aQXRPkAt8xlV/e7d7w8GM5g0fa5F0D8= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= +github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +golang.org/x/net v0.0.0-20210610132358-84b48f89b13b h1:k+E048sYJHyVnsr1GDrRZWQ32D2C7lWs9JRc0bel53A= +golang.org/x/net v0.0.0-20210610132358-84b48f89b13b/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M= +golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= +gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/sdk/resourcemanager/streamanalytics/armstreamanalytics/go_mod_tidy_hack.go b/sdk/resourcemanager/streamanalytics/armstreamanalytics/go_mod_tidy_hack.go new file mode 100644 index 000000000000..5cf900630852 --- /dev/null +++ b/sdk/resourcemanager/streamanalytics/armstreamanalytics/go_mod_tidy_hack.go @@ -0,0 +1,13 @@ +//go:build modhack +// +build modhack + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. + +// This file, and the github.com/Azure/azure-sdk-for-go import, won't actually become part of +// the resultant binary. + +package armstreamanalytics + +// Necessary for safely adding multi-module repo. See: https://github.com/golang/go/wiki/Modules#is-it-possible-to-add-a-module-to-a-multi-module-repository +import _ "github.com/Azure/azure-sdk-for-go" diff --git a/sdk/resourcemanager/streamanalytics/armstreamanalytics/zz_generated_clusters_client.go b/sdk/resourcemanager/streamanalytics/armstreamanalytics/zz_generated_clusters_client.go new file mode 100644 index 000000000000..a4f06cd922d1 --- /dev/null +++ b/sdk/resourcemanager/streamanalytics/armstreamanalytics/zz_generated_clusters_client.go @@ -0,0 +1,514 @@ +//go:build go1.16 +// +build go1.16 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armstreamanalytics + +import ( + "context" + "errors" + "fmt" + "net/http" + "net/url" + "strings" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" +) + +// ClustersClient contains the methods for the Clusters group. +// Don't use this type directly, use NewClustersClient() instead. +type ClustersClient struct { + ep string + pl runtime.Pipeline + subscriptionID string +} + +// NewClustersClient creates a new instance of ClustersClient with the specified values. +func NewClustersClient(con *arm.Connection, subscriptionID string) *ClustersClient { + return &ClustersClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +} + +// BeginCreateOrUpdate - Creates a Stream Analytics Cluster or replaces an already existing cluster. +// If the operation fails it returns the *Error error type. +func (client *ClustersClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, clusterName string, cluster Cluster, options *ClustersBeginCreateOrUpdateOptions) (ClustersCreateOrUpdatePollerResponse, error) { + resp, err := client.createOrUpdate(ctx, resourceGroupName, clusterName, cluster, options) + if err != nil { + return ClustersCreateOrUpdatePollerResponse{}, err + } + result := ClustersCreateOrUpdatePollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("ClustersClient.CreateOrUpdate", "", resp, client.pl, client.createOrUpdateHandleError) + if err != nil { + return ClustersCreateOrUpdatePollerResponse{}, err + } + result.Poller = &ClustersCreateOrUpdatePoller{ + pt: pt, + } + return result, nil +} + +// CreateOrUpdate - Creates a Stream Analytics Cluster or replaces an already existing cluster. +// If the operation fails it returns the *Error error type. +func (client *ClustersClient) createOrUpdate(ctx context.Context, resourceGroupName string, clusterName string, cluster Cluster, options *ClustersBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, clusterName, cluster, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return nil, client.createOrUpdateHandleError(resp) + } + return resp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *ClustersClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, cluster Cluster, options *ClustersBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/clusters/{clusterName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if clusterName == "" { + return nil, errors.New("parameter clusterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2020-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + if options != nil && options.IfMatch != nil { + req.Raw().Header.Set("If-Match", *options.IfMatch) + } + if options != nil && options.IfNoneMatch != nil { + req.Raw().Header.Set("If-None-Match", *options.IfNoneMatch) + } + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, cluster) +} + +// createOrUpdateHandleError handles the CreateOrUpdate error response. +func (client *ClustersClient) createOrUpdateHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := Error{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// BeginDelete - Deletes the specified cluster. +// If the operation fails it returns the *Error error type. +func (client *ClustersClient) BeginDelete(ctx context.Context, resourceGroupName string, clusterName string, options *ClustersBeginDeleteOptions) (ClustersDeletePollerResponse, error) { + resp, err := client.deleteOperation(ctx, resourceGroupName, clusterName, options) + if err != nil { + return ClustersDeletePollerResponse{}, err + } + result := ClustersDeletePollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("ClustersClient.Delete", "", resp, client.pl, client.deleteHandleError) + if err != nil { + return ClustersDeletePollerResponse{}, err + } + result.Poller = &ClustersDeletePoller{ + pt: pt, + } + return result, nil +} + +// Delete - Deletes the specified cluster. +// If the operation fails it returns the *Error error type. +func (client *ClustersClient) deleteOperation(ctx context.Context, resourceGroupName string, clusterName string, options *ClustersBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, clusterName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + return nil, client.deleteHandleError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *ClustersClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, options *ClustersBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/clusters/{clusterName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if clusterName == "" { + return nil, errors.New("parameter clusterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2020-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// deleteHandleError handles the Delete error response. +func (client *ClustersClient) deleteHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := Error{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// Get - Gets information about the specified cluster. +// If the operation fails it returns the *Error error type. +func (client *ClustersClient) Get(ctx context.Context, resourceGroupName string, clusterName string, options *ClustersGetOptions) (ClustersGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, clusterName, options) + if err != nil { + return ClustersGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ClustersGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ClustersGetResponse{}, client.getHandleError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *ClustersClient) getCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, options *ClustersGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/clusters/{clusterName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if clusterName == "" { + return nil, errors.New("parameter clusterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2020-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *ClustersClient) getHandleResponse(resp *http.Response) (ClustersGetResponse, error) { + result := ClustersGetResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.Cluster); err != nil { + return ClustersGetResponse{}, err + } + return result, nil +} + +// getHandleError handles the Get error response. +func (client *ClustersClient) getHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := Error{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// ListByResourceGroup - Lists all of the clusters in the given resource group. +// If the operation fails it returns the *Error error type. +func (client *ClustersClient) ListByResourceGroup(resourceGroupName string, options *ClustersListByResourceGroupOptions) *ClustersListByResourceGroupPager { + return &ClustersListByResourceGroupPager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { + return client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) + }, + advancer: func(ctx context.Context, resp ClustersListByResourceGroupResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.ClusterListResult.NextLink) + }, + } +} + +// listByResourceGroupCreateRequest creates the ListByResourceGroup request. +func (client *ClustersClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *ClustersListByResourceGroupOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/clusters" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2020-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// listByResourceGroupHandleResponse handles the ListByResourceGroup response. +func (client *ClustersClient) listByResourceGroupHandleResponse(resp *http.Response) (ClustersListByResourceGroupResponse, error) { + result := ClustersListByResourceGroupResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.ClusterListResult); err != nil { + return ClustersListByResourceGroupResponse{}, err + } + return result, nil +} + +// listByResourceGroupHandleError handles the ListByResourceGroup error response. +func (client *ClustersClient) listByResourceGroupHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := Error{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// ListBySubscription - Lists all of the clusters in the given subscription. +// If the operation fails it returns the *Error error type. +func (client *ClustersClient) ListBySubscription(options *ClustersListBySubscriptionOptions) *ClustersListBySubscriptionPager { + return &ClustersListBySubscriptionPager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { + return client.listBySubscriptionCreateRequest(ctx, options) + }, + advancer: func(ctx context.Context, resp ClustersListBySubscriptionResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.ClusterListResult.NextLink) + }, + } +} + +// listBySubscriptionCreateRequest creates the ListBySubscription request. +func (client *ClustersClient) listBySubscriptionCreateRequest(ctx context.Context, options *ClustersListBySubscriptionOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.StreamAnalytics/clusters" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2020-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// listBySubscriptionHandleResponse handles the ListBySubscription response. +func (client *ClustersClient) listBySubscriptionHandleResponse(resp *http.Response) (ClustersListBySubscriptionResponse, error) { + result := ClustersListBySubscriptionResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.ClusterListResult); err != nil { + return ClustersListBySubscriptionResponse{}, err + } + return result, nil +} + +// listBySubscriptionHandleError handles the ListBySubscription error response. +func (client *ClustersClient) listBySubscriptionHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := Error{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// ListStreamingJobs - Lists all of the streaming jobs in the given cluster. +// If the operation fails it returns the *Error error type. +func (client *ClustersClient) ListStreamingJobs(resourceGroupName string, clusterName string, options *ClustersListStreamingJobsOptions) *ClustersListStreamingJobsPager { + return &ClustersListStreamingJobsPager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { + return client.listStreamingJobsCreateRequest(ctx, resourceGroupName, clusterName, options) + }, + advancer: func(ctx context.Context, resp ClustersListStreamingJobsResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.ClusterJobListResult.NextLink) + }, + } +} + +// listStreamingJobsCreateRequest creates the ListStreamingJobs request. +func (client *ClustersClient) listStreamingJobsCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, options *ClustersListStreamingJobsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/clusters/{clusterName}/listStreamingJobs" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if clusterName == "" { + return nil, errors.New("parameter clusterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2020-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// listStreamingJobsHandleResponse handles the ListStreamingJobs response. +func (client *ClustersClient) listStreamingJobsHandleResponse(resp *http.Response) (ClustersListStreamingJobsResponse, error) { + result := ClustersListStreamingJobsResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.ClusterJobListResult); err != nil { + return ClustersListStreamingJobsResponse{}, err + } + return result, nil +} + +// listStreamingJobsHandleError handles the ListStreamingJobs error response. +func (client *ClustersClient) listStreamingJobsHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := Error{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// BeginUpdate - Updates an existing cluster. This can be used to partially update (ie. update one or two properties) a cluster without affecting the rest +// of the cluster definition. +// If the operation fails it returns the *Error error type. +func (client *ClustersClient) BeginUpdate(ctx context.Context, resourceGroupName string, clusterName string, cluster Cluster, options *ClustersBeginUpdateOptions) (ClustersUpdatePollerResponse, error) { + resp, err := client.update(ctx, resourceGroupName, clusterName, cluster, options) + if err != nil { + return ClustersUpdatePollerResponse{}, err + } + result := ClustersUpdatePollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("ClustersClient.Update", "", resp, client.pl, client.updateHandleError) + if err != nil { + return ClustersUpdatePollerResponse{}, err + } + result.Poller = &ClustersUpdatePoller{ + pt: pt, + } + return result, nil +} + +// Update - Updates an existing cluster. This can be used to partially update (ie. update one or two properties) a cluster without affecting the rest of +// the cluster definition. +// If the operation fails it returns the *Error error type. +func (client *ClustersClient) update(ctx context.Context, resourceGroupName string, clusterName string, cluster Cluster, options *ClustersBeginUpdateOptions) (*http.Response, error) { + req, err := client.updateCreateRequest(ctx, resourceGroupName, clusterName, cluster, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, client.updateHandleError(resp) + } + return resp, nil +} + +// updateCreateRequest creates the Update request. +func (client *ClustersClient) updateCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, cluster Cluster, options *ClustersBeginUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/clusters/{clusterName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if clusterName == "" { + return nil, errors.New("parameter clusterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2020-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + if options != nil && options.IfMatch != nil { + req.Raw().Header.Set("If-Match", *options.IfMatch) + } + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, cluster) +} + +// updateHandleError handles the Update error response. +func (client *ClustersClient) updateHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := Error{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} diff --git a/sdk/resourcemanager/streamanalytics/armstreamanalytics/zz_generated_constants.go b/sdk/resourcemanager/streamanalytics/armstreamanalytics/zz_generated_constants.go new file mode 100644 index 000000000000..77c237dfc0e0 --- /dev/null +++ b/sdk/resourcemanager/streamanalytics/armstreamanalytics/zz_generated_constants.go @@ -0,0 +1,435 @@ +//go:build go1.16 +// +build go1.16 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armstreamanalytics + +const ( + module = "armstreamanalytics" + version = "v0.1.0" +) + +// AuthenticationMode - Authentication Mode. Valid modes are ConnectionString, Msi and 'UserToken'. +type AuthenticationMode string + +const ( + AuthenticationModeConnectionString AuthenticationMode = "ConnectionString" + AuthenticationModeMsi AuthenticationMode = "Msi" + AuthenticationModeUserToken AuthenticationMode = "UserToken" +) + +// PossibleAuthenticationModeValues returns the possible values for the AuthenticationMode const type. +func PossibleAuthenticationModeValues() []AuthenticationMode { + return []AuthenticationMode{ + AuthenticationModeConnectionString, + AuthenticationModeMsi, + AuthenticationModeUserToken, + } +} + +// ToPtr returns a *AuthenticationMode pointing to the current value. +func (c AuthenticationMode) ToPtr() *AuthenticationMode { + return &c +} + +// ClusterProvisioningState - The status of the cluster provisioning. The three terminal states are: Succeeded, Failed and Canceled +type ClusterProvisioningState string + +const ( + // ClusterProvisioningStateCanceled - The cluster provisioning was canceled. + ClusterProvisioningStateCanceled ClusterProvisioningState = "Canceled" + // ClusterProvisioningStateFailed - The cluster provisioning failed. + ClusterProvisioningStateFailed ClusterProvisioningState = "Failed" + // ClusterProvisioningStateInProgress - The cluster provisioning was inprogress. + ClusterProvisioningStateInProgress ClusterProvisioningState = "InProgress" + // ClusterProvisioningStateSucceeded - The cluster provisioning succeeded. + ClusterProvisioningStateSucceeded ClusterProvisioningState = "Succeeded" +) + +// PossibleClusterProvisioningStateValues returns the possible values for the ClusterProvisioningState const type. +func PossibleClusterProvisioningStateValues() []ClusterProvisioningState { + return []ClusterProvisioningState{ + ClusterProvisioningStateCanceled, + ClusterProvisioningStateFailed, + ClusterProvisioningStateInProgress, + ClusterProvisioningStateSucceeded, + } +} + +// ToPtr returns a *ClusterProvisioningState pointing to the current value. +func (c ClusterProvisioningState) ToPtr() *ClusterProvisioningState { + return &c +} + +// ClusterSKUName - Specifies the SKU name of the cluster. Required on PUT (CreateOrUpdate) requests. +type ClusterSKUName string + +const ( + // ClusterSKUNameDefault - The default SKU. + ClusterSKUNameDefault ClusterSKUName = "Default" +) + +// PossibleClusterSKUNameValues returns the possible values for the ClusterSKUName const type. +func PossibleClusterSKUNameValues() []ClusterSKUName { + return []ClusterSKUName{ + ClusterSKUNameDefault, + } +} + +// ToPtr returns a *ClusterSKUName pointing to the current value. +func (c ClusterSKUName) ToPtr() *ClusterSKUName { + return &c +} + +// CompatibilityLevel - Controls certain runtime behaviors of the streaming job. +type CompatibilityLevel string + +const ( + CompatibilityLevelOne0 CompatibilityLevel = "1.0" +) + +// PossibleCompatibilityLevelValues returns the possible values for the CompatibilityLevel const type. +func PossibleCompatibilityLevelValues() []CompatibilityLevel { + return []CompatibilityLevel{ + CompatibilityLevelOne0, + } +} + +// ToPtr returns a *CompatibilityLevel pointing to the current value. +func (c CompatibilityLevel) ToPtr() *CompatibilityLevel { + return &c +} + +// ContentStoragePolicy - Valid values are JobStorageAccount and SystemAccount. If set to JobStorageAccount, this requires the user to also specify jobStorageAccount +// property. . +type ContentStoragePolicy string + +const ( + ContentStoragePolicyJobStorageAccount ContentStoragePolicy = "JobStorageAccount" + ContentStoragePolicySystemAccount ContentStoragePolicy = "SystemAccount" +) + +// PossibleContentStoragePolicyValues returns the possible values for the ContentStoragePolicy const type. +func PossibleContentStoragePolicyValues() []ContentStoragePolicy { + return []ContentStoragePolicy{ + ContentStoragePolicyJobStorageAccount, + ContentStoragePolicySystemAccount, + } +} + +// ToPtr returns a *ContentStoragePolicy pointing to the current value. +func (c ContentStoragePolicy) ToPtr() *ContentStoragePolicy { + return &c +} + +// Encoding - Specifies the encoding of the incoming data in the case of input and the encoding of outgoing data in the case of output. +type Encoding string + +const ( + EncodingUTF8 Encoding = "UTF8" +) + +// PossibleEncodingValues returns the possible values for the Encoding const type. +func PossibleEncodingValues() []Encoding { + return []Encoding{ + EncodingUTF8, + } +} + +// ToPtr returns a *Encoding pointing to the current value. +func (c Encoding) ToPtr() *Encoding { + return &c +} + +// EventSerializationType - Indicates the type of serialization that the input or output uses. Required on PUT (CreateOrReplace) requests. +type EventSerializationType string + +const ( + EventSerializationTypeAvro EventSerializationType = "Avro" + EventSerializationTypeCSV EventSerializationType = "Csv" + EventSerializationTypeCustomClr EventSerializationType = "CustomClr" + EventSerializationTypeJSON EventSerializationType = "Json" + EventSerializationTypeParquet EventSerializationType = "Parquet" +) + +// PossibleEventSerializationTypeValues returns the possible values for the EventSerializationType const type. +func PossibleEventSerializationTypeValues() []EventSerializationType { + return []EventSerializationType{ + EventSerializationTypeAvro, + EventSerializationTypeCSV, + EventSerializationTypeCustomClr, + EventSerializationTypeJSON, + EventSerializationTypeParquet, + } +} + +// ToPtr returns a *EventSerializationType pointing to the current value. +func (c EventSerializationType) ToPtr() *EventSerializationType { + return &c +} + +// EventsOutOfOrderPolicy - Indicates the policy to apply to events that arrive out of order in the input event stream. +type EventsOutOfOrderPolicy string + +const ( + EventsOutOfOrderPolicyAdjust EventsOutOfOrderPolicy = "Adjust" + EventsOutOfOrderPolicyDrop EventsOutOfOrderPolicy = "Drop" +) + +// PossibleEventsOutOfOrderPolicyValues returns the possible values for the EventsOutOfOrderPolicy const type. +func PossibleEventsOutOfOrderPolicyValues() []EventsOutOfOrderPolicy { + return []EventsOutOfOrderPolicy{ + EventsOutOfOrderPolicyAdjust, + EventsOutOfOrderPolicyDrop, + } +} + +// ToPtr returns a *EventsOutOfOrderPolicy pointing to the current value. +func (c EventsOutOfOrderPolicy) ToPtr() *EventsOutOfOrderPolicy { + return &c +} + +// JSONOutputSerializationFormat - Specifies the format of the JSON the output will be written in. The currently supported values are 'lineSeparated' indicating +// the output will be formatted by having each JSON object separated by a new +// line and 'array' indicating the output will be formatted as an array of JSON objects. +type JSONOutputSerializationFormat string + +const ( + JSONOutputSerializationFormatArray JSONOutputSerializationFormat = "Array" + JSONOutputSerializationFormatLineSeparated JSONOutputSerializationFormat = "LineSeparated" +) + +// PossibleJSONOutputSerializationFormatValues returns the possible values for the JSONOutputSerializationFormat const type. +func PossibleJSONOutputSerializationFormatValues() []JSONOutputSerializationFormat { + return []JSONOutputSerializationFormat{ + JSONOutputSerializationFormatArray, + JSONOutputSerializationFormatLineSeparated, + } +} + +// ToPtr returns a *JSONOutputSerializationFormat pointing to the current value. +func (c JSONOutputSerializationFormat) ToPtr() *JSONOutputSerializationFormat { + return &c +} + +// JobState - The current execution state of the streaming job. +type JobState string + +const ( + // JobStateCreated - The job is currently in the Created state. + JobStateCreated JobState = "Created" + // JobStateDegraded - The job is currently in the Degraded state. + JobStateDegraded JobState = "Degraded" + // JobStateDeleting - The job is currently in the Deleting state. + JobStateDeleting JobState = "Deleting" + // JobStateFailed - The job is currently in the Failed state. + JobStateFailed JobState = "Failed" + // JobStateRestarting - The job is currently in the Restarting state. + JobStateRestarting JobState = "Restarting" + // JobStateRunning - The job is currently in the Running state. + JobStateRunning JobState = "Running" + // JobStateScaling - The job is currently in the Scaling state. + JobStateScaling JobState = "Scaling" + // JobStateStarting - The job is currently in the Starting state. + JobStateStarting JobState = "Starting" + // JobStateStopped - The job is currently in the Stopped state. + JobStateStopped JobState = "Stopped" + // JobStateStopping - The job is currently in the Stopping state. + JobStateStopping JobState = "Stopping" +) + +// PossibleJobStateValues returns the possible values for the JobState const type. +func PossibleJobStateValues() []JobState { + return []JobState{ + JobStateCreated, + JobStateDegraded, + JobStateDeleting, + JobStateFailed, + JobStateRestarting, + JobStateRunning, + JobStateScaling, + JobStateStarting, + JobStateStopped, + JobStateStopping, + } +} + +// ToPtr returns a *JobState pointing to the current value. +func (c JobState) ToPtr() *JobState { + return &c +} + +// JobType - Describes the type of the job. Valid modes are Cloud and 'Edge'. +type JobType string + +const ( + JobTypeCloud JobType = "Cloud" + JobTypeEdge JobType = "Edge" +) + +// PossibleJobTypeValues returns the possible values for the JobType const type. +func PossibleJobTypeValues() []JobType { + return []JobType{ + JobTypeCloud, + JobTypeEdge, + } +} + +// ToPtr returns a *JobType pointing to the current value. +func (c JobType) ToPtr() *JobType { + return &c +} + +// OutputErrorPolicy - Indicates the policy to apply to events that arrive at the output and cannot be written to the external storage due to being malformed +// (missing column values, column values of wrong type or size). +type OutputErrorPolicy string + +const ( + OutputErrorPolicyDrop OutputErrorPolicy = "Drop" + OutputErrorPolicyStop OutputErrorPolicy = "Stop" +) + +// PossibleOutputErrorPolicyValues returns the possible values for the OutputErrorPolicy const type. +func PossibleOutputErrorPolicyValues() []OutputErrorPolicy { + return []OutputErrorPolicy{ + OutputErrorPolicyDrop, + OutputErrorPolicyStop, + } +} + +// ToPtr returns a *OutputErrorPolicy pointing to the current value. +func (c OutputErrorPolicy) ToPtr() *OutputErrorPolicy { + return &c +} + +// OutputStartMode - Value may be JobStartTime, CustomTime, or LastOutputEventTime to indicate whether the starting point of the output event stream should +// start whenever the job is started, start at a custom user time +// stamp specified via the outputStartTime property, or start from the last event output time. +type OutputStartMode string + +const ( + OutputStartModeCustomTime OutputStartMode = "CustomTime" + OutputStartModeJobStartTime OutputStartMode = "JobStartTime" + OutputStartModeLastOutputEventTime OutputStartMode = "LastOutputEventTime" +) + +// PossibleOutputStartModeValues returns the possible values for the OutputStartMode const type. +func PossibleOutputStartModeValues() []OutputStartMode { + return []OutputStartMode{ + OutputStartModeCustomTime, + OutputStartModeJobStartTime, + OutputStartModeLastOutputEventTime, + } +} + +// ToPtr returns a *OutputStartMode pointing to the current value. +func (c OutputStartMode) ToPtr() *OutputStartMode { + return &c +} + +// QueryTestingResultStatus - The status of the query testing request. +type QueryTestingResultStatus string + +const ( + // QueryTestingResultStatusCompilerError - The query testing operation failed due to a compiler error. + QueryTestingResultStatusCompilerError QueryTestingResultStatus = "CompilerError" + // QueryTestingResultStatusRuntimeError - The query testing operation failed due to a runtime error. + QueryTestingResultStatusRuntimeError QueryTestingResultStatus = "RuntimeError" + // QueryTestingResultStatusStarted - The query testing operation was initiated. + QueryTestingResultStatusStarted QueryTestingResultStatus = "Started" + // QueryTestingResultStatusSuccess - The query testing operation succeeded. + QueryTestingResultStatusSuccess QueryTestingResultStatus = "Success" + // QueryTestingResultStatusTimeout - The query testing operation failed due to a timeout. + QueryTestingResultStatusTimeout QueryTestingResultStatus = "Timeout" + // QueryTestingResultStatusUnknownError - The query testing operation failed due to an unknown error . + QueryTestingResultStatusUnknownError QueryTestingResultStatus = "UnknownError" +) + +// PossibleQueryTestingResultStatusValues returns the possible values for the QueryTestingResultStatus const type. +func PossibleQueryTestingResultStatusValues() []QueryTestingResultStatus { + return []QueryTestingResultStatus{ + QueryTestingResultStatusCompilerError, + QueryTestingResultStatusRuntimeError, + QueryTestingResultStatusStarted, + QueryTestingResultStatusSuccess, + QueryTestingResultStatusTimeout, + QueryTestingResultStatusUnknownError, + } +} + +// ToPtr returns a *QueryTestingResultStatus pointing to the current value. +func (c QueryTestingResultStatus) ToPtr() *QueryTestingResultStatus { + return &c +} + +// SampleInputResultStatus - The status of the sample input request. +type SampleInputResultStatus string + +const ( + // SampleInputResultStatusErrorConnectingToInput - The sample input operation failed to connect to the input. + SampleInputResultStatusErrorConnectingToInput SampleInputResultStatus = "ErrorConnectingToInput" + // SampleInputResultStatusNoEventsFoundInRange - The sample input operation found no events in the range. + SampleInputResultStatusNoEventsFoundInRange SampleInputResultStatus = "NoEventsFoundInRange" + // SampleInputResultStatusReadAllEventsInRange - The sample input operation successfully read all the events in the range. + SampleInputResultStatusReadAllEventsInRange SampleInputResultStatus = "ReadAllEventsInRange" +) + +// PossibleSampleInputResultStatusValues returns the possible values for the SampleInputResultStatus const type. +func PossibleSampleInputResultStatusValues() []SampleInputResultStatus { + return []SampleInputResultStatus{ + SampleInputResultStatusErrorConnectingToInput, + SampleInputResultStatusNoEventsFoundInRange, + SampleInputResultStatusReadAllEventsInRange, + } +} + +// ToPtr returns a *SampleInputResultStatus pointing to the current value. +func (c SampleInputResultStatus) ToPtr() *SampleInputResultStatus { + return &c +} + +// StreamingJobSKUName - The name of the SKU. Required on PUT (CreateOrReplace) requests. +type StreamingJobSKUName string + +const ( + StreamingJobSKUNameStandard StreamingJobSKUName = "Standard" +) + +// PossibleStreamingJobSKUNameValues returns the possible values for the StreamingJobSKUName const type. +func PossibleStreamingJobSKUNameValues() []StreamingJobSKUName { + return []StreamingJobSKUName{ + StreamingJobSKUNameStandard, + } +} + +// ToPtr returns a *StreamingJobSKUName pointing to the current value. +func (c StreamingJobSKUName) ToPtr() *StreamingJobSKUName { + return &c +} + +// TestDatasourceResultStatus - The status of the test input or output request. +type TestDatasourceResultStatus string + +const ( + // TestDatasourceResultStatusTestFailed - The test datasource operation failed. + TestDatasourceResultStatusTestFailed TestDatasourceResultStatus = "TestFailed" + // TestDatasourceResultStatusTestSucceeded - The test datasource operation succeeded. + TestDatasourceResultStatusTestSucceeded TestDatasourceResultStatus = "TestSucceeded" +) + +// PossibleTestDatasourceResultStatusValues returns the possible values for the TestDatasourceResultStatus const type. +func PossibleTestDatasourceResultStatusValues() []TestDatasourceResultStatus { + return []TestDatasourceResultStatus{ + TestDatasourceResultStatusTestFailed, + TestDatasourceResultStatusTestSucceeded, + } +} + +// ToPtr returns a *TestDatasourceResultStatus pointing to the current value. +func (c TestDatasourceResultStatus) ToPtr() *TestDatasourceResultStatus { + return &c +} diff --git a/sdk/resourcemanager/streamanalytics/armstreamanalytics/zz_generated_functions_client.go b/sdk/resourcemanager/streamanalytics/armstreamanalytics/zz_generated_functions_client.go new file mode 100644 index 000000000000..c19cd4198f42 --- /dev/null +++ b/sdk/resourcemanager/streamanalytics/armstreamanalytics/zz_generated_functions_client.go @@ -0,0 +1,547 @@ +//go:build go1.16 +// +build go1.16 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armstreamanalytics + +import ( + "context" + "errors" + "fmt" + "net/http" + "net/url" + "strings" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" +) + +// FunctionsClient contains the methods for the Functions group. +// Don't use this type directly, use NewFunctionsClient() instead. +type FunctionsClient struct { + ep string + pl runtime.Pipeline + subscriptionID string +} + +// NewFunctionsClient creates a new instance of FunctionsClient with the specified values. +func NewFunctionsClient(con *arm.Connection, subscriptionID string) *FunctionsClient { + return &FunctionsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +} + +// CreateOrReplace - Creates a function or replaces an already existing function under an existing streaming job. +// If the operation fails it returns the *Error error type. +func (client *FunctionsClient) CreateOrReplace(ctx context.Context, resourceGroupName string, jobName string, functionName string, function Function, options *FunctionsCreateOrReplaceOptions) (FunctionsCreateOrReplaceResponse, error) { + req, err := client.createOrReplaceCreateRequest(ctx, resourceGroupName, jobName, functionName, function, options) + if err != nil { + return FunctionsCreateOrReplaceResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return FunctionsCreateOrReplaceResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return FunctionsCreateOrReplaceResponse{}, client.createOrReplaceHandleError(resp) + } + return client.createOrReplaceHandleResponse(resp) +} + +// createOrReplaceCreateRequest creates the CreateOrReplace request. +func (client *FunctionsClient) createOrReplaceCreateRequest(ctx context.Context, resourceGroupName string, jobName string, functionName string, function Function, options *FunctionsCreateOrReplaceOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/functions/{functionName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if jobName == "" { + return nil, errors.New("parameter jobName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{jobName}", url.PathEscape(jobName)) + if functionName == "" { + return nil, errors.New("parameter functionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{functionName}", url.PathEscape(functionName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2017-04-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + if options != nil && options.IfMatch != nil { + req.Raw().Header.Set("If-Match", *options.IfMatch) + } + if options != nil && options.IfNoneMatch != nil { + req.Raw().Header.Set("If-None-Match", *options.IfNoneMatch) + } + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, function) +} + +// createOrReplaceHandleResponse handles the CreateOrReplace response. +func (client *FunctionsClient) createOrReplaceHandleResponse(resp *http.Response) (FunctionsCreateOrReplaceResponse, error) { + result := FunctionsCreateOrReplaceResponse{RawResponse: resp} + if val := resp.Header.Get("ETag"); val != "" { + result.ETag = &val + } + if err := runtime.UnmarshalAsJSON(resp, &result.Function); err != nil { + return FunctionsCreateOrReplaceResponse{}, err + } + return result, nil +} + +// createOrReplaceHandleError handles the CreateOrReplace error response. +func (client *FunctionsClient) createOrReplaceHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := Error{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// Delete - Deletes a function from the streaming job. +// If the operation fails it returns the *Error error type. +func (client *FunctionsClient) Delete(ctx context.Context, resourceGroupName string, jobName string, functionName string, options *FunctionsDeleteOptions) (FunctionsDeleteResponse, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, jobName, functionName, options) + if err != nil { + return FunctionsDeleteResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return FunctionsDeleteResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { + return FunctionsDeleteResponse{}, client.deleteHandleError(resp) + } + return FunctionsDeleteResponse{RawResponse: resp}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *FunctionsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, jobName string, functionName string, options *FunctionsDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/functions/{functionName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if jobName == "" { + return nil, errors.New("parameter jobName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{jobName}", url.PathEscape(jobName)) + if functionName == "" { + return nil, errors.New("parameter functionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{functionName}", url.PathEscape(functionName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2017-04-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// deleteHandleError handles the Delete error response. +func (client *FunctionsClient) deleteHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := Error{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// Get - Gets details about the specified function. +// If the operation fails it returns the *Error error type. +func (client *FunctionsClient) Get(ctx context.Context, resourceGroupName string, jobName string, functionName string, options *FunctionsGetOptions) (FunctionsGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, jobName, functionName, options) + if err != nil { + return FunctionsGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return FunctionsGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return FunctionsGetResponse{}, client.getHandleError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *FunctionsClient) getCreateRequest(ctx context.Context, resourceGroupName string, jobName string, functionName string, options *FunctionsGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/functions/{functionName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if jobName == "" { + return nil, errors.New("parameter jobName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{jobName}", url.PathEscape(jobName)) + if functionName == "" { + return nil, errors.New("parameter functionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{functionName}", url.PathEscape(functionName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2017-04-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *FunctionsClient) getHandleResponse(resp *http.Response) (FunctionsGetResponse, error) { + result := FunctionsGetResponse{RawResponse: resp} + if val := resp.Header.Get("ETag"); val != "" { + result.ETag = &val + } + if err := runtime.UnmarshalAsJSON(resp, &result.Function); err != nil { + return FunctionsGetResponse{}, err + } + return result, nil +} + +// getHandleError handles the Get error response. +func (client *FunctionsClient) getHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := Error{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// ListByStreamingJob - Lists all of the functions under the specified streaming job. +// If the operation fails it returns the *Error error type. +func (client *FunctionsClient) ListByStreamingJob(resourceGroupName string, jobName string, options *FunctionsListByStreamingJobOptions) *FunctionsListByStreamingJobPager { + return &FunctionsListByStreamingJobPager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { + return client.listByStreamingJobCreateRequest(ctx, resourceGroupName, jobName, options) + }, + advancer: func(ctx context.Context, resp FunctionsListByStreamingJobResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.FunctionListResult.NextLink) + }, + } +} + +// listByStreamingJobCreateRequest creates the ListByStreamingJob request. +func (client *FunctionsClient) listByStreamingJobCreateRequest(ctx context.Context, resourceGroupName string, jobName string, options *FunctionsListByStreamingJobOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/functions" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if jobName == "" { + return nil, errors.New("parameter jobName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{jobName}", url.PathEscape(jobName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + if options != nil && options.Select != nil { + reqQP.Set("$select", *options.Select) + } + reqQP.Set("api-version", "2017-04-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// listByStreamingJobHandleResponse handles the ListByStreamingJob response. +func (client *FunctionsClient) listByStreamingJobHandleResponse(resp *http.Response) (FunctionsListByStreamingJobResponse, error) { + result := FunctionsListByStreamingJobResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.FunctionListResult); err != nil { + return FunctionsListByStreamingJobResponse{}, err + } + return result, nil +} + +// listByStreamingJobHandleError handles the ListByStreamingJob error response. +func (client *FunctionsClient) listByStreamingJobHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := Error{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// RetrieveDefaultDefinition - Retrieves the default definition of a function based on the parameters specified. +// If the operation fails it returns the *Error error type. +func (client *FunctionsClient) RetrieveDefaultDefinition(ctx context.Context, resourceGroupName string, jobName string, functionName string, options *FunctionsRetrieveDefaultDefinitionOptions) (FunctionsRetrieveDefaultDefinitionResponse, error) { + req, err := client.retrieveDefaultDefinitionCreateRequest(ctx, resourceGroupName, jobName, functionName, options) + if err != nil { + return FunctionsRetrieveDefaultDefinitionResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return FunctionsRetrieveDefaultDefinitionResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return FunctionsRetrieveDefaultDefinitionResponse{}, client.retrieveDefaultDefinitionHandleError(resp) + } + return client.retrieveDefaultDefinitionHandleResponse(resp) +} + +// retrieveDefaultDefinitionCreateRequest creates the RetrieveDefaultDefinition request. +func (client *FunctionsClient) retrieveDefaultDefinitionCreateRequest(ctx context.Context, resourceGroupName string, jobName string, functionName string, options *FunctionsRetrieveDefaultDefinitionOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/functions/{functionName}/retrieveDefaultDefinition" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if jobName == "" { + return nil, errors.New("parameter jobName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{jobName}", url.PathEscape(jobName)) + if functionName == "" { + return nil, errors.New("parameter functionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{functionName}", url.PathEscape(functionName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2017-04-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + if options != nil && options.FunctionRetrieveDefaultDefinitionParameters != nil { + return req, runtime.MarshalAsJSON(req, options.FunctionRetrieveDefaultDefinitionParameters) + } + return req, nil +} + +// retrieveDefaultDefinitionHandleResponse handles the RetrieveDefaultDefinition response. +func (client *FunctionsClient) retrieveDefaultDefinitionHandleResponse(resp *http.Response) (FunctionsRetrieveDefaultDefinitionResponse, error) { + result := FunctionsRetrieveDefaultDefinitionResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.Function); err != nil { + return FunctionsRetrieveDefaultDefinitionResponse{}, err + } + return result, nil +} + +// retrieveDefaultDefinitionHandleError handles the RetrieveDefaultDefinition error response. +func (client *FunctionsClient) retrieveDefaultDefinitionHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := Error{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// BeginTest - 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. +// If the operation fails it returns the *Error error type. +func (client *FunctionsClient) BeginTest(ctx context.Context, resourceGroupName string, jobName string, functionName string, options *FunctionsBeginTestOptions) (FunctionsTestPollerResponse, error) { + resp, err := client.test(ctx, resourceGroupName, jobName, functionName, options) + if err != nil { + return FunctionsTestPollerResponse{}, err + } + result := FunctionsTestPollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("FunctionsClient.Test", "", resp, client.pl, client.testHandleError) + if err != nil { + return FunctionsTestPollerResponse{}, err + } + result.Poller = &FunctionsTestPoller{ + pt: pt, + } + return result, nil +} + +// 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. +// If the operation fails it returns the *Error error type. +func (client *FunctionsClient) test(ctx context.Context, resourceGroupName string, jobName string, functionName string, options *FunctionsBeginTestOptions) (*http.Response, error) { + req, err := client.testCreateRequest(ctx, resourceGroupName, jobName, functionName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, client.testHandleError(resp) + } + return resp, nil +} + +// testCreateRequest creates the Test request. +func (client *FunctionsClient) testCreateRequest(ctx context.Context, resourceGroupName string, jobName string, functionName string, options *FunctionsBeginTestOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/functions/{functionName}/test" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if jobName == "" { + return nil, errors.New("parameter jobName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{jobName}", url.PathEscape(jobName)) + if functionName == "" { + return nil, errors.New("parameter functionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{functionName}", url.PathEscape(functionName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2017-04-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + if options != nil && options.Function != nil { + return req, runtime.MarshalAsJSON(req, *options.Function) + } + return req, nil +} + +// testHandleError handles the Test error response. +func (client *FunctionsClient) testHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := Error{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// 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. +// If the operation fails it returns the *Error error type. +func (client *FunctionsClient) Update(ctx context.Context, resourceGroupName string, jobName string, functionName string, function Function, options *FunctionsUpdateOptions) (FunctionsUpdateResponse, error) { + req, err := client.updateCreateRequest(ctx, resourceGroupName, jobName, functionName, function, options) + if err != nil { + return FunctionsUpdateResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return FunctionsUpdateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return FunctionsUpdateResponse{}, client.updateHandleError(resp) + } + return client.updateHandleResponse(resp) +} + +// updateCreateRequest creates the Update request. +func (client *FunctionsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, jobName string, functionName string, function Function, options *FunctionsUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/functions/{functionName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if jobName == "" { + return nil, errors.New("parameter jobName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{jobName}", url.PathEscape(jobName)) + if functionName == "" { + return nil, errors.New("parameter functionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{functionName}", url.PathEscape(functionName)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2017-04-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + if options != nil && options.IfMatch != nil { + req.Raw().Header.Set("If-Match", *options.IfMatch) + } + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, function) +} + +// updateHandleResponse handles the Update response. +func (client *FunctionsClient) updateHandleResponse(resp *http.Response) (FunctionsUpdateResponse, error) { + result := FunctionsUpdateResponse{RawResponse: resp} + if val := resp.Header.Get("ETag"); val != "" { + result.ETag = &val + } + if err := runtime.UnmarshalAsJSON(resp, &result.Function); err != nil { + return FunctionsUpdateResponse{}, err + } + return result, nil +} + +// updateHandleError handles the Update error response. +func (client *FunctionsClient) updateHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := Error{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} diff --git a/sdk/resourcemanager/streamanalytics/armstreamanalytics/zz_generated_inputs_client.go b/sdk/resourcemanager/streamanalytics/armstreamanalytics/zz_generated_inputs_client.go new file mode 100644 index 000000000000..782928f31013 --- /dev/null +++ b/sdk/resourcemanager/streamanalytics/armstreamanalytics/zz_generated_inputs_client.go @@ -0,0 +1,470 @@ +//go:build go1.16 +// +build go1.16 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armstreamanalytics + +import ( + "context" + "errors" + "fmt" + "net/http" + "net/url" + "strings" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" +) + +// InputsClient contains the methods for the Inputs group. +// Don't use this type directly, use NewInputsClient() instead. +type InputsClient struct { + ep string + pl runtime.Pipeline + subscriptionID string +} + +// NewInputsClient creates a new instance of InputsClient with the specified values. +func NewInputsClient(con *arm.Connection, subscriptionID string) *InputsClient { + return &InputsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +} + +// CreateOrReplace - Creates an input or replaces an already existing input under an existing streaming job. +// If the operation fails it returns the *Error error type. +func (client *InputsClient) CreateOrReplace(ctx context.Context, resourceGroupName string, jobName string, inputName string, input Input, options *InputsCreateOrReplaceOptions) (InputsCreateOrReplaceResponse, error) { + req, err := client.createOrReplaceCreateRequest(ctx, resourceGroupName, jobName, inputName, input, options) + if err != nil { + return InputsCreateOrReplaceResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return InputsCreateOrReplaceResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return InputsCreateOrReplaceResponse{}, client.createOrReplaceHandleError(resp) + } + return client.createOrReplaceHandleResponse(resp) +} + +// createOrReplaceCreateRequest creates the CreateOrReplace request. +func (client *InputsClient) createOrReplaceCreateRequest(ctx context.Context, resourceGroupName string, jobName string, inputName string, input Input, options *InputsCreateOrReplaceOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/inputs/{inputName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if jobName == "" { + return nil, errors.New("parameter jobName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{jobName}", url.PathEscape(jobName)) + if inputName == "" { + return nil, errors.New("parameter inputName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{inputName}", url.PathEscape(inputName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2017-04-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + if options != nil && options.IfMatch != nil { + req.Raw().Header.Set("If-Match", *options.IfMatch) + } + if options != nil && options.IfNoneMatch != nil { + req.Raw().Header.Set("If-None-Match", *options.IfNoneMatch) + } + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, input) +} + +// createOrReplaceHandleResponse handles the CreateOrReplace response. +func (client *InputsClient) createOrReplaceHandleResponse(resp *http.Response) (InputsCreateOrReplaceResponse, error) { + result := InputsCreateOrReplaceResponse{RawResponse: resp} + if val := resp.Header.Get("ETag"); val != "" { + result.ETag = &val + } + if err := runtime.UnmarshalAsJSON(resp, &result.Input); err != nil { + return InputsCreateOrReplaceResponse{}, err + } + return result, nil +} + +// createOrReplaceHandleError handles the CreateOrReplace error response. +func (client *InputsClient) createOrReplaceHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := Error{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// Delete - Deletes an input from the streaming job. +// If the operation fails it returns the *Error error type. +func (client *InputsClient) Delete(ctx context.Context, resourceGroupName string, jobName string, inputName string, options *InputsDeleteOptions) (InputsDeleteResponse, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, jobName, inputName, options) + if err != nil { + return InputsDeleteResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return InputsDeleteResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { + return InputsDeleteResponse{}, client.deleteHandleError(resp) + } + return InputsDeleteResponse{RawResponse: resp}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *InputsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, jobName string, inputName string, options *InputsDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/inputs/{inputName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if jobName == "" { + return nil, errors.New("parameter jobName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{jobName}", url.PathEscape(jobName)) + if inputName == "" { + return nil, errors.New("parameter inputName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{inputName}", url.PathEscape(inputName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2017-04-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// deleteHandleError handles the Delete error response. +func (client *InputsClient) deleteHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := Error{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// Get - Gets details about the specified input. +// If the operation fails it returns the *Error error type. +func (client *InputsClient) Get(ctx context.Context, resourceGroupName string, jobName string, inputName string, options *InputsGetOptions) (InputsGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, jobName, inputName, options) + if err != nil { + return InputsGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return InputsGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return InputsGetResponse{}, client.getHandleError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *InputsClient) getCreateRequest(ctx context.Context, resourceGroupName string, jobName string, inputName string, options *InputsGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/inputs/{inputName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if jobName == "" { + return nil, errors.New("parameter jobName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{jobName}", url.PathEscape(jobName)) + if inputName == "" { + return nil, errors.New("parameter inputName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{inputName}", url.PathEscape(inputName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2017-04-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *InputsClient) getHandleResponse(resp *http.Response) (InputsGetResponse, error) { + result := InputsGetResponse{RawResponse: resp} + if val := resp.Header.Get("ETag"); val != "" { + result.ETag = &val + } + if err := runtime.UnmarshalAsJSON(resp, &result.Input); err != nil { + return InputsGetResponse{}, err + } + return result, nil +} + +// getHandleError handles the Get error response. +func (client *InputsClient) getHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := Error{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// ListByStreamingJob - Lists all of the inputs under the specified streaming job. +// If the operation fails it returns the *Error error type. +func (client *InputsClient) ListByStreamingJob(resourceGroupName string, jobName string, options *InputsListByStreamingJobOptions) *InputsListByStreamingJobPager { + return &InputsListByStreamingJobPager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { + return client.listByStreamingJobCreateRequest(ctx, resourceGroupName, jobName, options) + }, + advancer: func(ctx context.Context, resp InputsListByStreamingJobResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.InputListResult.NextLink) + }, + } +} + +// listByStreamingJobCreateRequest creates the ListByStreamingJob request. +func (client *InputsClient) listByStreamingJobCreateRequest(ctx context.Context, resourceGroupName string, jobName string, options *InputsListByStreamingJobOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/inputs" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if jobName == "" { + return nil, errors.New("parameter jobName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{jobName}", url.PathEscape(jobName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + if options != nil && options.Select != nil { + reqQP.Set("$select", *options.Select) + } + reqQP.Set("api-version", "2017-04-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// listByStreamingJobHandleResponse handles the ListByStreamingJob response. +func (client *InputsClient) listByStreamingJobHandleResponse(resp *http.Response) (InputsListByStreamingJobResponse, error) { + result := InputsListByStreamingJobResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.InputListResult); err != nil { + return InputsListByStreamingJobResponse{}, err + } + return result, nil +} + +// listByStreamingJobHandleError handles the ListByStreamingJob error response. +func (client *InputsClient) listByStreamingJobHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := Error{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// BeginTest - Tests whether an input’s datasource is reachable and usable by the Azure Stream Analytics service. +// If the operation fails it returns the *Error error type. +func (client *InputsClient) BeginTest(ctx context.Context, resourceGroupName string, jobName string, inputName string, options *InputsBeginTestOptions) (InputsTestPollerResponse, error) { + resp, err := client.test(ctx, resourceGroupName, jobName, inputName, options) + if err != nil { + return InputsTestPollerResponse{}, err + } + result := InputsTestPollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("InputsClient.Test", "", resp, client.pl, client.testHandleError) + if err != nil { + return InputsTestPollerResponse{}, err + } + result.Poller = &InputsTestPoller{ + pt: pt, + } + return result, nil +} + +// Test - Tests whether an input’s datasource is reachable and usable by the Azure Stream Analytics service. +// If the operation fails it returns the *Error error type. +func (client *InputsClient) test(ctx context.Context, resourceGroupName string, jobName string, inputName string, options *InputsBeginTestOptions) (*http.Response, error) { + req, err := client.testCreateRequest(ctx, resourceGroupName, jobName, inputName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, client.testHandleError(resp) + } + return resp, nil +} + +// testCreateRequest creates the Test request. +func (client *InputsClient) testCreateRequest(ctx context.Context, resourceGroupName string, jobName string, inputName string, options *InputsBeginTestOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/inputs/{inputName}/test" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if jobName == "" { + return nil, errors.New("parameter jobName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{jobName}", url.PathEscape(jobName)) + if inputName == "" { + return nil, errors.New("parameter inputName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{inputName}", url.PathEscape(inputName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2017-04-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + if options != nil && options.Input != nil { + return req, runtime.MarshalAsJSON(req, *options.Input) + } + return req, nil +} + +// testHandleError handles the Test error response. +func (client *InputsClient) testHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := Error{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// 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. +// If the operation fails it returns the *Error error type. +func (client *InputsClient) Update(ctx context.Context, resourceGroupName string, jobName string, inputName string, input Input, options *InputsUpdateOptions) (InputsUpdateResponse, error) { + req, err := client.updateCreateRequest(ctx, resourceGroupName, jobName, inputName, input, options) + if err != nil { + return InputsUpdateResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return InputsUpdateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return InputsUpdateResponse{}, client.updateHandleError(resp) + } + return client.updateHandleResponse(resp) +} + +// updateCreateRequest creates the Update request. +func (client *InputsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, jobName string, inputName string, input Input, options *InputsUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/inputs/{inputName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if jobName == "" { + return nil, errors.New("parameter jobName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{jobName}", url.PathEscape(jobName)) + if inputName == "" { + return nil, errors.New("parameter inputName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{inputName}", url.PathEscape(inputName)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2017-04-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + if options != nil && options.IfMatch != nil { + req.Raw().Header.Set("If-Match", *options.IfMatch) + } + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, input) +} + +// updateHandleResponse handles the Update response. +func (client *InputsClient) updateHandleResponse(resp *http.Response) (InputsUpdateResponse, error) { + result := InputsUpdateResponse{RawResponse: resp} + if val := resp.Header.Get("ETag"); val != "" { + result.ETag = &val + } + if err := runtime.UnmarshalAsJSON(resp, &result.Input); err != nil { + return InputsUpdateResponse{}, err + } + return result, nil +} + +// updateHandleError handles the Update error response. +func (client *InputsClient) updateHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := Error{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} diff --git a/sdk/resourcemanager/streamanalytics/armstreamanalytics/zz_generated_models.go b/sdk/resourcemanager/streamanalytics/armstreamanalytics/zz_generated_models.go new file mode 100644 index 000000000000..d71222ea8ba2 --- /dev/null +++ b/sdk/resourcemanager/streamanalytics/armstreamanalytics/zz_generated_models.go @@ -0,0 +1,4329 @@ +//go:build go1.16 +// +build go1.16 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armstreamanalytics + +import ( + "encoding/json" + "reflect" + "time" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore" +) + +// AggregateFunctionProperties - The properties that are associated with an aggregate function. +type AggregateFunctionProperties struct { + FunctionProperties +} + +// MarshalJSON implements the json.Marshaller interface for type AggregateFunctionProperties. +func (a AggregateFunctionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + a.FunctionProperties.marshalInternal(objectMap, "Aggregate") + return json.Marshal(objectMap) +} + +// AvroSerialization - Describes how data from an input is serialized or how data is serialized when written to an output in Avro format. +type AvroSerialization struct { + Serialization + // The properties that are associated with the Avro serialization type. Required on PUT (CreateOrReplace) requests. + Properties map[string]interface{} `json:"properties,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type AvroSerialization. +func (a AvroSerialization) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + a.Serialization.marshalInternal(objectMap, EventSerializationTypeAvro) + populate(objectMap, "properties", a.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AvroSerialization. +func (a *AvroSerialization) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, &a.Properties) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + if err := a.Serialization.unmarshalInternal(rawMsg); err != nil { + return err + } + return nil +} + +// AzureDataLakeStoreOutputDataSource - Describes an Azure Data Lake Store output data source. +type AzureDataLakeStoreOutputDataSource struct { + OutputDataSource + // The properties that are associated with an Azure Data Lake Store output. Required on PUT (CreateOrReplace) requests. + Properties *AzureDataLakeStoreOutputDataSourceProperties `json:"properties,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type AzureDataLakeStoreOutputDataSource. +func (a AzureDataLakeStoreOutputDataSource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + a.OutputDataSource.marshalInternal(objectMap, "Microsoft.DataLake/Accounts") + populate(objectMap, "properties", a.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureDataLakeStoreOutputDataSource. +func (a *AzureDataLakeStoreOutputDataSource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, &a.Properties) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + if err := a.OutputDataSource.unmarshalInternal(rawMsg); err != nil { + return err + } + return nil +} + +// AzureDataLakeStoreOutputDataSourceProperties - The properties that are associated with an Azure Data Lake Store. +type AzureDataLakeStoreOutputDataSourceProperties struct { + OAuthBasedDataSourceProperties + // The name of the Azure Data Lake Store account. Required on PUT (CreateOrReplace) requests. + AccountName *string `json:"accountName,omitempty"` + + // Authentication Mode. + AuthenticationMode *AuthenticationMode `json:"authenticationMode,omitempty"` + + // The date format. Wherever {date} appears in filePathPrefix, the value of this property is used as the date format instead. + DateFormat *string `json:"dateFormat,omitempty"` + + // The location of the file to which the output should be written to. Required on PUT (CreateOrReplace) requests. + FilePathPrefix *string `json:"filePathPrefix,omitempty"` + + // The tenant id of the user used to obtain the refresh token. Required on PUT (CreateOrReplace) requests. + TenantID *string `json:"tenantId,omitempty"` + + // The time format. Wherever {time} appears in filePathPrefix, the value of this property is used as the time format instead. + TimeFormat *string `json:"timeFormat,omitempty"` +} + +// AzureFunctionOutputDataSource - Defines the metadata of AzureFunctionOutputDataSource +type AzureFunctionOutputDataSource struct { + OutputDataSource + // The properties that are associated with a Azure Function output. Required on PUT (CreateOrReplace) requests. + Properties *AzureFunctionOutputDataSourceProperties `json:"properties,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type AzureFunctionOutputDataSource. +func (a AzureFunctionOutputDataSource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + a.OutputDataSource.marshalInternal(objectMap, "Microsoft.AzureFunction") + populate(objectMap, "properties", a.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureFunctionOutputDataSource. +func (a *AzureFunctionOutputDataSource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, &a.Properties) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + if err := a.OutputDataSource.unmarshalInternal(rawMsg); err != nil { + return err + } + return nil +} + +// AzureFunctionOutputDataSourceProperties - The properties that are associated with a DocumentDB output. +type AzureFunctionOutputDataSourceProperties struct { + // If you want to use an Azure Function from another subscription, you can do so by providing the key to access your function. + APIKey *string `json:"apiKey,omitempty"` + + // The name of your Azure Functions app. + FunctionAppName *string `json:"functionAppName,omitempty"` + + // The name of the function in your Azure Functions app. + FunctionName *string `json:"functionName,omitempty"` + + // A property that lets you specify the maximum number of events in each batch that's sent to Azure Functions. The default value is 100. + MaxBatchCount *float32 `json:"maxBatchCount,omitempty"` + + // A property that lets you set the maximum size for each output batch that's sent to your Azure function. The input unit is in bytes. By default, this + // value is 262,144 bytes (256 KB). + MaxBatchSize *float32 `json:"maxBatchSize,omitempty"` +} + +// AzureMachineLearningServiceFunctionBinding - The binding to an Azure Machine Learning web service. +type AzureMachineLearningServiceFunctionBinding struct { + FunctionBinding + // The binding properties associated with an Azure Machine learning web service. + Properties *AzureMachineLearningServiceFunctionBindingProperties `json:"properties,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type AzureMachineLearningServiceFunctionBinding. +func (a AzureMachineLearningServiceFunctionBinding) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + a.FunctionBinding.marshalInternal(objectMap, "Microsoft.MachineLearningServices") + populate(objectMap, "properties", a.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureMachineLearningServiceFunctionBinding. +func (a *AzureMachineLearningServiceFunctionBinding) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, &a.Properties) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + if err := a.FunctionBinding.unmarshalInternal(rawMsg); err != nil { + return err + } + return nil +} + +// AzureMachineLearningServiceFunctionBindingProperties - The binding properties associated with an Azure Machine learning web service. +type AzureMachineLearningServiceFunctionBindingProperties struct { + // The API key used to authenticate with Request-Response endpoint. + APIKey *string `json:"apiKey,omitempty"` + + // Number between 1 and 10000 describing maximum number of rows for every Azure ML RRS execute request. Default is 1000. + BatchSize *int32 `json:"batchSize,omitempty"` + + // The Request-Response execute endpoint of the Azure Machine Learning web service. + Endpoint *string `json:"endpoint,omitempty"` + + // The inputs for the Azure Machine Learning web service endpoint. + Inputs []*AzureMachineLearningServiceInputColumn `json:"inputs,omitempty"` + + // The number of parallel requests that will be sent per partition of your job to the machine learning service. Default is 1. + NumberOfParallelRequests *int32 `json:"numberOfParallelRequests,omitempty"` + + // A list of outputs from the Azure Machine Learning web service endpoint execution. + Outputs []*AzureMachineLearningServiceOutputColumn `json:"outputs,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type AzureMachineLearningServiceFunctionBindingProperties. +func (a AzureMachineLearningServiceFunctionBindingProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "apiKey", a.APIKey) + populate(objectMap, "batchSize", a.BatchSize) + populate(objectMap, "endpoint", a.Endpoint) + populate(objectMap, "inputs", a.Inputs) + populate(objectMap, "numberOfParallelRequests", a.NumberOfParallelRequests) + populate(objectMap, "outputs", a.Outputs) + return json.Marshal(objectMap) +} + +// AzureMachineLearningServiceFunctionBindingRetrievalProperties - The binding retrieval properties associated with an Azure Machine learning web service. +type AzureMachineLearningServiceFunctionBindingRetrievalProperties struct { + // The Request-Response execute endpoint of the Azure Machine Learning web service. + ExecuteEndpoint *string `json:"executeEndpoint,omitempty"` + + // The function type. + UdfType *string `json:"udfType,omitempty"` +} + +// AzureMachineLearningServiceFunctionRetrieveDefaultDefinitionParameters - The parameters needed to retrieve the default function definition for an Azure +// Machine Learning web service function. +type AzureMachineLearningServiceFunctionRetrieveDefaultDefinitionParameters struct { + FunctionRetrieveDefaultDefinitionParameters + // The binding retrieval properties associated with an Azure Machine learning web service. + BindingRetrievalProperties *AzureMachineLearningServiceFunctionBindingRetrievalProperties `json:"bindingRetrievalProperties,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type AzureMachineLearningServiceFunctionRetrieveDefaultDefinitionParameters. +func (a AzureMachineLearningServiceFunctionRetrieveDefaultDefinitionParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + a.FunctionRetrieveDefaultDefinitionParameters.marshalInternal(objectMap, "Microsoft.MachineLearningServices") + populate(objectMap, "bindingRetrievalProperties", a.BindingRetrievalProperties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureMachineLearningServiceFunctionRetrieveDefaultDefinitionParameters. +func (a *AzureMachineLearningServiceFunctionRetrieveDefaultDefinitionParameters) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "bindingRetrievalProperties": + err = unpopulate(val, &a.BindingRetrievalProperties) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + if err := a.FunctionRetrieveDefaultDefinitionParameters.unmarshalInternal(rawMsg); err != nil { + return err + } + return nil +} + +// AzureMachineLearningServiceInputColumn - Describes an input column for the Azure Machine Learning web service endpoint. +type AzureMachineLearningServiceInputColumn struct { + // The (Azure Machine Learning supported) data type of the input column. + DataType *string `json:"dataType,omitempty"` + + // The zero based index of the function parameter this input maps to. + MapTo *int32 `json:"mapTo,omitempty"` + + // The name of the input column. + Name *string `json:"name,omitempty"` +} + +// AzureMachineLearningServiceInputs - The inputs for the Azure Machine Learning web service endpoint. +type AzureMachineLearningServiceInputs struct { + // A list of input columns for the Azure Machine Learning web service endpoint. + ColumnNames []*AzureMachineLearningServiceInputColumn `json:"columnNames,omitempty"` + + // The name of the input. This is the name provided while authoring the endpoint. + Name *string `json:"name,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type AzureMachineLearningServiceInputs. +func (a AzureMachineLearningServiceInputs) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "columnNames", a.ColumnNames) + populate(objectMap, "name", a.Name) + return json.Marshal(objectMap) +} + +// AzureMachineLearningServiceOutputColumn - Describes an output column for the Azure Machine Learning web service endpoint. +type AzureMachineLearningServiceOutputColumn struct { + // The (Azure Machine Learning supported) data type of the output column. + DataType *string `json:"dataType,omitempty"` + + // The zero based index of the function parameter this input maps to. + MapTo *int32 `json:"mapTo,omitempty"` + + // The name of the output column. + Name *string `json:"name,omitempty"` +} + +// AzureMachineLearningStudioFunctionBinding - The binding to an Azure Machine Learning Studio. +type AzureMachineLearningStudioFunctionBinding struct { + FunctionBinding + // The binding properties associated with an Azure Machine learning Studio. + Properties *AzureMachineLearningStudioFunctionBindingProperties `json:"properties,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type AzureMachineLearningStudioFunctionBinding. +func (a AzureMachineLearningStudioFunctionBinding) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + a.FunctionBinding.marshalInternal(objectMap, "Microsoft.MachineLearning/WebService") + populate(objectMap, "properties", a.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureMachineLearningStudioFunctionBinding. +func (a *AzureMachineLearningStudioFunctionBinding) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, &a.Properties) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + if err := a.FunctionBinding.unmarshalInternal(rawMsg); err != nil { + return err + } + return nil +} + +// AzureMachineLearningStudioFunctionBindingProperties - The binding properties associated with an Azure Machine learning Studio. +type AzureMachineLearningStudioFunctionBindingProperties struct { + // The API key used to authenticate with Request-Response endpoint. + APIKey *string `json:"apiKey,omitempty"` + + // Number between 1 and 10000 describing maximum number of rows for every Azure ML RRS execute request. Default is 1000. + BatchSize *int32 `json:"batchSize,omitempty"` + + // The Request-Response execute endpoint of the Azure Machine Learning Studio. Find out more here: + // https://docs.microsoft.com/en-us/azure/machine-learning/machine-learning-consume-web-services#request-response-service-rrs + Endpoint *string `json:"endpoint,omitempty"` + + // The inputs for the Azure Machine Learning Studio endpoint. + Inputs *AzureMachineLearningStudioInputs `json:"inputs,omitempty"` + + // A list of outputs from the Azure Machine Learning Studio endpoint execution. + Outputs []*AzureMachineLearningStudioOutputColumn `json:"outputs,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type AzureMachineLearningStudioFunctionBindingProperties. +func (a AzureMachineLearningStudioFunctionBindingProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "apiKey", a.APIKey) + populate(objectMap, "batchSize", a.BatchSize) + populate(objectMap, "endpoint", a.Endpoint) + populate(objectMap, "inputs", a.Inputs) + populate(objectMap, "outputs", a.Outputs) + return json.Marshal(objectMap) +} + +// AzureMachineLearningStudioFunctionBindingRetrievalProperties - The binding retrieval properties associated with an Azure Machine learning Studio. +type AzureMachineLearningStudioFunctionBindingRetrievalProperties struct { + // The Request-Response execute endpoint of the Azure Machine Learning Studio. Find out more here: + // https://docs.microsoft.com/en-us/azure/machine-learning/machine-learning-consume-web-services#request-response-service-rrs + ExecuteEndpoint *string `json:"executeEndpoint,omitempty"` + + // The function type. + UdfType *string `json:"udfType,omitempty"` +} + +// AzureMachineLearningStudioFunctionRetrieveDefaultDefinitionParameters - The parameters needed to retrieve the default function definition for an Azure +// Machine Learning Studio function. +type AzureMachineLearningStudioFunctionRetrieveDefaultDefinitionParameters struct { + FunctionRetrieveDefaultDefinitionParameters + // The binding retrieval properties associated with an Azure Machine learning Studio. + BindingRetrievalProperties *AzureMachineLearningStudioFunctionBindingRetrievalProperties `json:"bindingRetrievalProperties,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type AzureMachineLearningStudioFunctionRetrieveDefaultDefinitionParameters. +func (a AzureMachineLearningStudioFunctionRetrieveDefaultDefinitionParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + a.FunctionRetrieveDefaultDefinitionParameters.marshalInternal(objectMap, "Microsoft.MachineLearning/WebService") + populate(objectMap, "bindingRetrievalProperties", a.BindingRetrievalProperties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureMachineLearningStudioFunctionRetrieveDefaultDefinitionParameters. +func (a *AzureMachineLearningStudioFunctionRetrieveDefaultDefinitionParameters) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "bindingRetrievalProperties": + err = unpopulate(val, &a.BindingRetrievalProperties) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + if err := a.FunctionRetrieveDefaultDefinitionParameters.unmarshalInternal(rawMsg); err != nil { + return err + } + return nil +} + +// AzureMachineLearningStudioInputColumn - Describes an input column for the Azure Machine Learning Studio endpoint. +type AzureMachineLearningStudioInputColumn struct { + // The (Azure Machine Learning supported) data type of the input column. A list of valid Azure Machine Learning data types are described at https://msdn.microsoft.com/en-us/library/azure/dn905923.aspx + // . + DataType *string `json:"dataType,omitempty"` + + // The zero based index of the function parameter this input maps to. + MapTo *int32 `json:"mapTo,omitempty"` + + // The name of the input column. + Name *string `json:"name,omitempty"` +} + +// AzureMachineLearningStudioInputs - The inputs for the Azure Machine Learning Studio endpoint. +type AzureMachineLearningStudioInputs struct { + // A list of input columns for the Azure Machine Learning Studio endpoint. + ColumnNames []*AzureMachineLearningStudioInputColumn `json:"columnNames,omitempty"` + + // The name of the input. This is the name provided while authoring the endpoint. + Name *string `json:"name,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type AzureMachineLearningStudioInputs. +func (a AzureMachineLearningStudioInputs) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "columnNames", a.ColumnNames) + populate(objectMap, "name", a.Name) + return json.Marshal(objectMap) +} + +// AzureMachineLearningStudioOutputColumn - Describes an output column for the Azure Machine Learning Studio endpoint. +type AzureMachineLearningStudioOutputColumn struct { + // The (Azure Machine Learning supported) data type of the output column. A list of valid Azure Machine Learning data types are described at https://msdn.microsoft.com/en-us/library/azure/dn905923.aspx + // . + DataType *string `json:"dataType,omitempty"` + + // The name of the output column. + Name *string `json:"name,omitempty"` +} + +// AzureSQLDatabaseDataSourceProperties - The properties that are associated with an Azure SQL database data source. +type AzureSQLDatabaseDataSourceProperties struct { + // Authentication Mode. + AuthenticationMode *AuthenticationMode `json:"authenticationMode,omitempty"` + + // The name of the Azure SQL database. Required on PUT (CreateOrReplace) requests. + Database *string `json:"database,omitempty"` + + // Max Batch count for write to Sql database, the default value is 10,000. Optional on PUT requests. + MaxBatchCount *float32 `json:"maxBatchCount,omitempty"` + + // Max Write r count, currently only 1(single writer) and 0(based on query partition) are available. Optional on PUT requests. + MaxWriterCount *float32 `json:"maxWriterCount,omitempty"` + + // The password that will be used to connect to the Azure SQL database. Required on PUT (CreateOrReplace) requests. + Password *string `json:"password,omitempty"` + + // The name of the SQL server containing the Azure SQL database. Required on PUT (CreateOrReplace) requests. + Server *string `json:"server,omitempty"` + + // The name of the table in the Azure SQL database. Required on PUT (CreateOrReplace) requests. + Table *string `json:"table,omitempty"` + + // The user name that will be used to connect to the Azure SQL database. Required on PUT (CreateOrReplace) requests. + User *string `json:"user,omitempty"` +} + +// AzureSQLDatabaseOutputDataSource - Describes an Azure SQL database output data source. +type AzureSQLDatabaseOutputDataSource struct { + OutputDataSource + // The properties that are associated with an Azure SQL database output. Required on PUT (CreateOrReplace) requests. + Properties *AzureSQLDatabaseOutputDataSourceProperties `json:"properties,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type AzureSQLDatabaseOutputDataSource. +func (a AzureSQLDatabaseOutputDataSource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + a.OutputDataSource.marshalInternal(objectMap, "Microsoft.Sql/Server/Database") + populate(objectMap, "properties", a.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureSQLDatabaseOutputDataSource. +func (a *AzureSQLDatabaseOutputDataSource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, &a.Properties) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + if err := a.OutputDataSource.unmarshalInternal(rawMsg); err != nil { + return err + } + return nil +} + +// AzureSQLDatabaseOutputDataSourceProperties - The properties that are associated with an Azure SQL database output. +type AzureSQLDatabaseOutputDataSourceProperties struct { + AzureSQLDatabaseDataSourceProperties +} + +// AzureSQLReferenceInputDataSource - Describes an Azure SQL database reference input data source. +type AzureSQLReferenceInputDataSource struct { + ReferenceInputDataSource + // Describes Azure SQL database reference input data source properties. + Properties *AzureSQLReferenceInputDataSourceProperties `json:"properties,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type AzureSQLReferenceInputDataSource. +func (a AzureSQLReferenceInputDataSource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + a.ReferenceInputDataSource.marshalInternal(objectMap, "Microsoft.Sql/Server/Database") + populate(objectMap, "properties", a.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureSQLReferenceInputDataSource. +func (a *AzureSQLReferenceInputDataSource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, &a.Properties) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + if err := a.ReferenceInputDataSource.unmarshalInternal(rawMsg); err != nil { + return err + } + return nil +} + +// AzureSQLReferenceInputDataSourceProperties - Describes Azure SQL database reference input data source properties. +type AzureSQLReferenceInputDataSourceProperties struct { + // This element is associated with the datasource element. This is the name of the database that output will be written to. + Database *string `json:"database,omitempty"` + + // This element is associated with the datasource element. This query is used to fetch incremental changes from the SQL database. To use this option, we + // recommend using temporal tables in Azure SQL + // Database. + DeltaSnapshotQuery *string `json:"deltaSnapshotQuery,omitempty"` + + // This element is associated with the datasource element. This query is used to fetch data from the sql database. + FullSnapshotQuery *string `json:"fullSnapshotQuery,omitempty"` + + // This element is associated with the datasource element. This is the password that will be used to connect to the SQL Database instance. + Password *string `json:"password,omitempty"` + + // This element is associated with the datasource element. This indicates how frequently the data will be fetched from the database. It is of DateTime format. + RefreshRate *string `json:"refreshRate,omitempty"` + + // This element is associated with the datasource element. This element is of enum type. It indicates what kind of data refresh option do we want to + // use:Static/RefreshPeriodicallyWithFull/RefreshPeriodicallyWithDelta + RefreshType *string `json:"refreshType,omitempty"` + + // This element is associated with the datasource element. This is the name of the server that contains the database that will be written to. + Server *string `json:"server,omitempty"` + + // This element is associated with the datasource element. The name of the table in the Azure SQL database.. + Table *string `json:"table,omitempty"` + + // This element is associated with the datasource element. This is the user name that will be used to connect to the SQL Database instance. + User *string `json:"user,omitempty"` +} + +// AzureSynapseDataSourceProperties - The properties that are associated with an Azure SQL database data source. +type AzureSynapseDataSourceProperties struct { + // The name of the Azure SQL database. Required on PUT (CreateOrReplace) requests. + Database *string `json:"database,omitempty"` + + // The password that will be used to connect to the Azure SQL database. Required on PUT (CreateOrReplace) requests. + Password *string `json:"password,omitempty"` + + // The name of the SQL server containing the Azure SQL database. Required on PUT (CreateOrReplace) requests. + Server *string `json:"server,omitempty"` + + // The name of the table in the Azure SQL database. Required on PUT (CreateOrReplace) requests. + Table *string `json:"table,omitempty"` + + // The user name that will be used to connect to the Azure SQL database. Required on PUT (CreateOrReplace) requests. + User *string `json:"user,omitempty"` +} + +// AzureSynapseOutputDataSource - Describes an Azure Synapse output data source. +type AzureSynapseOutputDataSource struct { + OutputDataSource + // The properties that are associated with an Azure Synapse output. Required on PUT (CreateOrReplace) requests. + Properties *AzureSynapseOutputDataSourceProperties `json:"properties,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type AzureSynapseOutputDataSource. +func (a AzureSynapseOutputDataSource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + a.OutputDataSource.marshalInternal(objectMap, "Microsoft.Sql/Server/DataWarehouse") + populate(objectMap, "properties", a.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureSynapseOutputDataSource. +func (a *AzureSynapseOutputDataSource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, &a.Properties) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + if err := a.OutputDataSource.unmarshalInternal(rawMsg); err != nil { + return err + } + return nil +} + +// AzureSynapseOutputDataSourceProperties - The properties that are associated with an Azure Synapse output. +type AzureSynapseOutputDataSourceProperties struct { + AzureSynapseDataSourceProperties +} + +// AzureTableOutputDataSource - Describes an Azure Table output data source. +type AzureTableOutputDataSource struct { + OutputDataSource + // The properties that are associated with an Azure Table output. Required on PUT (CreateOrReplace) requests. + Properties *AzureTableOutputDataSourceProperties `json:"properties,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type AzureTableOutputDataSource. +func (a AzureTableOutputDataSource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + a.OutputDataSource.marshalInternal(objectMap, "Microsoft.Storage/Table") + populate(objectMap, "properties", a.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureTableOutputDataSource. +func (a *AzureTableOutputDataSource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, &a.Properties) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + if err := a.OutputDataSource.unmarshalInternal(rawMsg); err != nil { + return err + } + return nil +} + +// AzureTableOutputDataSourceProperties - The properties that are associated with an Azure Table output. +type AzureTableOutputDataSourceProperties struct { + // The account key for the Azure Storage account. Required on PUT (CreateOrReplace) requests. + AccountKey *string `json:"accountKey,omitempty"` + + // The name of the Azure Storage account. Required on PUT (CreateOrReplace) requests. + AccountName *string `json:"accountName,omitempty"` + + // The number of rows to write to the Azure Table at a time. + BatchSize *int32 `json:"batchSize,omitempty"` + + // If specified, each item in the array is the name of a column to remove (if present) from output event entities. + ColumnsToRemove []*string `json:"columnsToRemove,omitempty"` + + // This element indicates the name of a column from the SELECT statement in the query that will be used as the partition key for the Azure Table. Required + // on PUT (CreateOrReplace) requests. + PartitionKey *string `json:"partitionKey,omitempty"` + + // This element indicates the name of a column from the SELECT statement in the query that will be used as the row key for the Azure Table. Required on + // PUT (CreateOrReplace) requests. + RowKey *string `json:"rowKey,omitempty"` + + // The name of the Azure Table. Required on PUT (CreateOrReplace) requests. + Table *string `json:"table,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type AzureTableOutputDataSourceProperties. +func (a AzureTableOutputDataSourceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "accountKey", a.AccountKey) + populate(objectMap, "accountName", a.AccountName) + populate(objectMap, "batchSize", a.BatchSize) + populate(objectMap, "columnsToRemove", a.ColumnsToRemove) + populate(objectMap, "partitionKey", a.PartitionKey) + populate(objectMap, "rowKey", a.RowKey) + populate(objectMap, "table", a.Table) + return json.Marshal(objectMap) +} + +// BlobDataSourceProperties - The properties that are associated with a blob data source. +type BlobDataSourceProperties struct { + // The name of a container within the associated Storage account. This container contains either the blob(s) to be read from or written to. Required on + // PUT (CreateOrReplace) requests. + Container *string `json:"container,omitempty"` + + // The date format. Wherever {date} appears in pathPattern, the value of this property is used as the date format instead. + DateFormat *string `json:"dateFormat,omitempty"` + + // The blob path pattern. Not a regular expression. It represents a pattern against which blob names will be matched to determine whether or not they should + // be included as input or output to the job. See + // https://docs.microsoft.com/en-us/rest/api/streamanalytics/stream-analytics-input or https://docs.microsoft.com/en-us/rest/api/streamanalytics/stream-analytics-output + // for a more detailed explanation + // and example. + PathPattern *string `json:"pathPattern,omitempty"` + + // A list of one or more Azure Storage accounts. Required on PUT (CreateOrReplace) requests. + StorageAccounts []*StorageAccount `json:"storageAccounts,omitempty"` + + // The time format. Wherever {time} appears in pathPattern, the value of this property is used as the time format instead. + TimeFormat *string `json:"timeFormat,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type BlobDataSourceProperties. +func (b BlobDataSourceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + b.marshalInternal(objectMap) + return json.Marshal(objectMap) +} + +func (b BlobDataSourceProperties) marshalInternal(objectMap map[string]interface{}) { + populate(objectMap, "container", b.Container) + populate(objectMap, "dateFormat", b.DateFormat) + populate(objectMap, "pathPattern", b.PathPattern) + populate(objectMap, "storageAccounts", b.StorageAccounts) + populate(objectMap, "timeFormat", b.TimeFormat) +} + +// BlobOutputDataSource - Describes a blob output data source. +type BlobOutputDataSource struct { + OutputDataSource + // The properties that are associated with a blob output. Required on PUT (CreateOrReplace) requests. + Properties *BlobOutputDataSourceProperties `json:"properties,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type BlobOutputDataSource. +func (b BlobOutputDataSource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + b.OutputDataSource.marshalInternal(objectMap, "Microsoft.Storage/Blob") + populate(objectMap, "properties", b.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BlobOutputDataSource. +func (b *BlobOutputDataSource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, &b.Properties) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + if err := b.OutputDataSource.unmarshalInternal(rawMsg); err != nil { + return err + } + return nil +} + +// BlobOutputDataSourceProperties - The properties that are associated with a blob output. +type BlobOutputDataSourceProperties struct { + BlobDataSourceProperties + // Authentication Mode. + AuthenticationMode *AuthenticationMode `json:"authenticationMode,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type BlobOutputDataSourceProperties. +func (b BlobOutputDataSourceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + b.BlobDataSourceProperties.marshalInternal(objectMap) + populate(objectMap, "authenticationMode", b.AuthenticationMode) + return json.Marshal(objectMap) +} + +// BlobReferenceInputDataSource - Describes a blob input data source that contains reference data. +type BlobReferenceInputDataSource struct { + ReferenceInputDataSource + // The properties that are associated with a blob input containing reference data. Required on PUT (CreateOrReplace) requests. + Properties *BlobReferenceInputDataSourceProperties `json:"properties,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type BlobReferenceInputDataSource. +func (b BlobReferenceInputDataSource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + b.ReferenceInputDataSource.marshalInternal(objectMap, "Microsoft.Storage/Blob") + populate(objectMap, "properties", b.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BlobReferenceInputDataSource. +func (b *BlobReferenceInputDataSource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, &b.Properties) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + if err := b.ReferenceInputDataSource.unmarshalInternal(rawMsg); err != nil { + return err + } + return nil +} + +// BlobReferenceInputDataSourceProperties - The properties that are associated with a blob input containing reference data. +type BlobReferenceInputDataSourceProperties struct { + BlobDataSourceProperties +} + +// BlobStreamInputDataSource - Describes a blob input data source that contains stream data. +type BlobStreamInputDataSource struct { + StreamInputDataSource + // The properties that are associated with a blob input containing stream data. Required on PUT (CreateOrReplace) requests. + Properties *BlobStreamInputDataSourceProperties `json:"properties,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type BlobStreamInputDataSource. +func (b BlobStreamInputDataSource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + b.StreamInputDataSource.marshalInternal(objectMap, "Microsoft.Storage/Blob") + populate(objectMap, "properties", b.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BlobStreamInputDataSource. +func (b *BlobStreamInputDataSource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, &b.Properties) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + if err := b.StreamInputDataSource.unmarshalInternal(rawMsg); err != nil { + return err + } + return nil +} + +// BlobStreamInputDataSourceProperties - The properties that are associated with a blob input containing stream data. +type BlobStreamInputDataSourceProperties struct { + BlobDataSourceProperties + // The partition count of the blob input data source. Range 1 - 256. + SourcePartitionCount *int32 `json:"sourcePartitionCount,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type BlobStreamInputDataSourceProperties. +func (b BlobStreamInputDataSourceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + b.BlobDataSourceProperties.marshalInternal(objectMap) + populate(objectMap, "sourcePartitionCount", b.SourcePartitionCount) + return json.Marshal(objectMap) +} + +// CSVSerialization - Describes how data from an input is serialized or how data is serialized when written to an output in CSV format. +type CSVSerialization struct { + Serialization + // The properties that are associated with the CSV serialization type. Required on PUT (CreateOrReplace) requests. + Properties *CSVSerializationProperties `json:"properties,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type CSVSerialization. +func (c CSVSerialization) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + c.Serialization.marshalInternal(objectMap, EventSerializationTypeCSV) + populate(objectMap, "properties", c.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CSVSerialization. +func (c *CSVSerialization) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, &c.Properties) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + if err := c.Serialization.unmarshalInternal(rawMsg); err != nil { + return err + } + return nil +} + +// CSVSerializationProperties - The properties that are associated with the CSV serialization type. +type CSVSerializationProperties struct { + // Specifies the encoding of the incoming data in the case of input and the encoding of outgoing data in the case of output. Required on PUT (CreateOrReplace) + // requests. + Encoding *Encoding `json:"encoding,omitempty"` + + // Specifies the delimiter that will be used to separate comma-separated value (CSV) records. See https://docs.microsoft.com/en-us/rest/api/streamanalytics/stream-analytics-input + // or + // https://docs.microsoft.com/en-us/rest/api/streamanalytics/stream-analytics-output for a list of supported values. Required on PUT (CreateOrReplace) requests. + FieldDelimiter *string `json:"fieldDelimiter,omitempty"` +} + +// CSharpFunctionBinding - The binding to a CSharp function. +type CSharpFunctionBinding struct { + FunctionBinding + // The binding properties associated with a CSharp function. + Properties *CSharpFunctionBindingProperties `json:"properties,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type CSharpFunctionBinding. +func (c CSharpFunctionBinding) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + c.FunctionBinding.marshalInternal(objectMap, "Microsoft.StreamAnalytics/CLRUdf") + populate(objectMap, "properties", c.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CSharpFunctionBinding. +func (c *CSharpFunctionBinding) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, &c.Properties) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + if err := c.FunctionBinding.unmarshalInternal(rawMsg); err != nil { + return err + } + return nil +} + +// CSharpFunctionBindingProperties - The binding properties associated with a CSharp function. +type CSharpFunctionBindingProperties struct { + // The Csharp code containing a single function definition. + Class *string `json:"class,omitempty"` + + // The Csharp code containing a single function definition. + DllPath *string `json:"dllPath,omitempty"` + + // The Csharp code containing a single function definition. + Method *string `json:"method,omitempty"` + + // The Csharp code containing a single function definition. + Script *string `json:"script,omitempty"` +} + +// CSharpFunctionBindingRetrievalProperties - The binding retrieval properties associated with a CSharp function. +type CSharpFunctionBindingRetrievalProperties struct { + // The CSharp code containing a single function definition. + Script *string `json:"script,omitempty"` + + // The function type. + UdfType *string `json:"udfType,omitempty"` +} + +// CSharpFunctionRetrieveDefaultDefinitionParameters - The parameters needed to retrieve the default function definition for a CSharp function. +type CSharpFunctionRetrieveDefaultDefinitionParameters struct { + FunctionRetrieveDefaultDefinitionParameters + // The binding retrieval properties associated with a CSharp function. + BindingRetrievalProperties *CSharpFunctionBindingRetrievalProperties `json:"bindingRetrievalProperties,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type CSharpFunctionRetrieveDefaultDefinitionParameters. +func (c CSharpFunctionRetrieveDefaultDefinitionParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + c.FunctionRetrieveDefaultDefinitionParameters.marshalInternal(objectMap, "Microsoft.StreamAnalytics/CLRUdf") + populate(objectMap, "bindingRetrievalProperties", c.BindingRetrievalProperties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CSharpFunctionRetrieveDefaultDefinitionParameters. +func (c *CSharpFunctionRetrieveDefaultDefinitionParameters) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "bindingRetrievalProperties": + err = unpopulate(val, &c.BindingRetrievalProperties) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + if err := c.FunctionRetrieveDefaultDefinitionParameters.unmarshalInternal(rawMsg); err != nil { + return err + } + return nil +} + +// Cluster - A Stream Analytics Cluster object +type Cluster struct { + TrackedResource + // The properties associated with a Stream Analytics cluster. + Properties *ClusterProperties `json:"properties,omitempty"` + + // The SKU of the cluster. This determines the size/capacity of the cluster. Required on PUT (CreateOrUpdate) requests. + SKU *ClusterSKU `json:"sku,omitempty"` + + // READ-ONLY; The current entity tag for the cluster. This is an opaque string. You can use it to detect whether the resource has changed between requests. + // You can also use it in the If-Match or If-None-Match + // headers for write operations for optimistic concurrency. + Etag *string `json:"etag,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type Cluster. +func (c Cluster) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + c.TrackedResource.marshalInternal(objectMap) + populate(objectMap, "etag", c.Etag) + populate(objectMap, "properties", c.Properties) + populate(objectMap, "sku", c.SKU) + return json.Marshal(objectMap) +} + +// ClusterInfo - The properties associated with a Stream Analytics cluster. +type ClusterInfo struct { + // The resource id of cluster. + ID *string `json:"id,omitempty"` +} + +// ClusterJob - A streaming job. +type ClusterJob struct { + // READ-ONLY; Resource ID of the streaming job. + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; The current execution state of the streaming job. + JobState *JobState `json:"jobState,omitempty" azure:"ro"` + + // READ-ONLY; The number of streaming units that are used by the streaming job. + StreamingUnits *int32 `json:"streamingUnits,omitempty" azure:"ro"` +} + +// ClusterJobListResult - A list of streaming jobs. Populated by a List operation. +type ClusterJobListResult struct { + // READ-ONLY; The URL to fetch the next set of streaming jobs. + NextLink *string `json:"nextLink,omitempty" azure:"ro"` + + // READ-ONLY; A list of streaming jobs. + Value []*ClusterJob `json:"value,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type ClusterJobListResult. +func (c ClusterJobListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", c.NextLink) + populate(objectMap, "value", c.Value) + return json.Marshal(objectMap) +} + +// ClusterListResult - A list of clusters populated by a 'list' operation. +type ClusterListResult struct { + // READ-ONLY; The URL to fetch the next set of clusters. + NextLink *string `json:"nextLink,omitempty" azure:"ro"` + + // READ-ONLY; A list of clusters. + Value []*Cluster `json:"value,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type ClusterListResult. +func (c ClusterListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", c.NextLink) + populate(objectMap, "value", c.Value) + return json.Marshal(objectMap) +} + +// ClusterProperties - The properties associated with a Stream Analytics cluster. +type ClusterProperties struct { + // READ-ONLY; Represents the number of streaming units currently being used on the cluster. + CapacityAllocated *int32 `json:"capacityAllocated,omitempty" azure:"ro"` + + // READ-ONLY; Represents the sum of the SUs of all streaming jobs associated with the cluster. If all of the jobs were running, this would be the capacity + // allocated. + CapacityAssigned *int32 `json:"capacityAssigned,omitempty" azure:"ro"` + + // READ-ONLY; Unique identifier for the cluster. + ClusterID *string `json:"clusterId,omitempty" azure:"ro"` + + // READ-ONLY; The date this cluster was created. + CreatedDate *time.Time `json:"createdDate,omitempty" azure:"ro"` + + // READ-ONLY; The status of the cluster provisioning. The three terminal states are: Succeeded, Failed and Canceled + ProvisioningState *ClusterProvisioningState `json:"provisioningState,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type ClusterProperties. +func (c ClusterProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "capacityAllocated", c.CapacityAllocated) + populate(objectMap, "capacityAssigned", c.CapacityAssigned) + populate(objectMap, "clusterId", c.ClusterID) + populate(objectMap, "createdDate", (*timeRFC3339)(c.CreatedDate)) + populate(objectMap, "provisioningState", c.ProvisioningState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ClusterProperties. +func (c *ClusterProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "capacityAllocated": + err = unpopulate(val, &c.CapacityAllocated) + delete(rawMsg, key) + case "capacityAssigned": + err = unpopulate(val, &c.CapacityAssigned) + delete(rawMsg, key) + case "clusterId": + err = unpopulate(val, &c.ClusterID) + delete(rawMsg, key) + case "createdDate": + var aux timeRFC3339 + err = unpopulate(val, &aux) + c.CreatedDate = (*time.Time)(&aux) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, &c.ProvisioningState) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// ClusterSKU - The SKU of the cluster. This determines the size/capacity of the cluster. Required on PUT (CreateOrUpdate) requests. +type ClusterSKU struct { + // Denotes the number of streaming units the cluster can support. Valid values for this property are multiples of 36 with a minimum value of 36 and maximum + // value of 216. Required on PUT (CreateOrUpdate) + // requests. + Capacity *int32 `json:"capacity,omitempty"` + + // Specifies the SKU name of the cluster. Required on PUT (CreateOrUpdate) requests. + Name *ClusterSKUName `json:"name,omitempty"` +} + +// ClustersBeginCreateOrUpdateOptions contains the optional parameters for the Clusters.BeginCreateOrUpdate method. +type ClustersBeginCreateOrUpdateOptions struct { + // The ETag of the resource. Omit this value to always overwrite the current record set. Specify the last-seen ETag value to prevent accidentally overwriting + // concurrent changes. + IfMatch *string + // Set to '*' to allow a new resource to be created, but to prevent updating an existing record set. Other values will result in a 412 Pre-condition Failed + // response. + IfNoneMatch *string +} + +// ClustersBeginDeleteOptions contains the optional parameters for the Clusters.BeginDelete method. +type ClustersBeginDeleteOptions struct { + // placeholder for future optional parameters +} + +// ClustersBeginUpdateOptions contains the optional parameters for the Clusters.BeginUpdate method. +type ClustersBeginUpdateOptions struct { + // The ETag of the resource. Omit this value to always overwrite the current record set. Specify the last-seen ETag value to prevent accidentally overwriting + // concurrent changes. + IfMatch *string +} + +// ClustersGetOptions contains the optional parameters for the Clusters.Get method. +type ClustersGetOptions struct { + // placeholder for future optional parameters +} + +// ClustersListByResourceGroupOptions contains the optional parameters for the Clusters.ListByResourceGroup method. +type ClustersListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// ClustersListBySubscriptionOptions contains the optional parameters for the Clusters.ListBySubscription method. +type ClustersListBySubscriptionOptions struct { + // placeholder for future optional parameters +} + +// ClustersListStreamingJobsOptions contains the optional parameters for the Clusters.ListStreamingJobs method. +type ClustersListStreamingJobsOptions struct { + // placeholder for future optional parameters +} + +// CompileQuery - The query compilation object which defines the input, output, and transformation for the query compilation. +type CompileQuery struct { + // REQUIRED; Describes the type of the job. Valid values are Cloud and 'Edge'. + JobType *JobType `json:"jobType,omitempty"` + + // REQUIRED; The query to compile. + Query *string `json:"query,omitempty"` + + // The query to compile. + CompatibilityLevel *CompatibilityLevel `json:"compatibilityLevel,omitempty"` + + // The functions for the query compilation. + Functions []*QueryFunction `json:"functions,omitempty"` + + // The inputs for the query compilation. + Inputs []*QueryInput `json:"inputs,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type CompileQuery. +func (c CompileQuery) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "compatibilityLevel", c.CompatibilityLevel) + populate(objectMap, "functions", c.Functions) + populate(objectMap, "inputs", c.Inputs) + populate(objectMap, "jobType", c.JobType) + populate(objectMap, "query", c.Query) + return json.Marshal(objectMap) +} + +// Compression - Describes how input data is compressed +type Compression struct { + // REQUIRED + Type *string `json:"type,omitempty"` +} + +// CustomClrSerialization - Describes how data from an input is serialized or how data is serialized when written to an output in custom format. +type CustomClrSerialization struct { + Serialization + // The properties that are associated with the CustomClr serialization type. Required on PUT (CreateOrReplace) requests. + Properties *CustomClrSerializationProperties `json:"properties,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type CustomClrSerialization. +func (c CustomClrSerialization) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + c.Serialization.marshalInternal(objectMap, EventSerializationTypeCustomClr) + populate(objectMap, "properties", c.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CustomClrSerialization. +func (c *CustomClrSerialization) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, &c.Properties) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + if err := c.Serialization.unmarshalInternal(rawMsg); err != nil { + return err + } + return nil +} + +// CustomClrSerializationProperties - The properties that are associated with the CustomClr serialization type. +type CustomClrSerializationProperties struct { + // The serialization class name. + SerializationClassName *string `json:"serializationClassName,omitempty"` + + // The serialization library path. + SerializationDllPath *string `json:"serializationDllPath,omitempty"` +} + +// DiagnosticCondition - Condition applicable to the resource, or to the job overall, that warrant customer attention. +type DiagnosticCondition struct { + // READ-ONLY; The opaque diagnostic code. + Code *string `json:"code,omitempty" azure:"ro"` + + // READ-ONLY; The human-readable message describing the condition in detail. Localized in the Accept-Language of the client request. + Message *string `json:"message,omitempty" azure:"ro"` + + // READ-ONLY; The UTC timestamp of when the condition started. Customers should be able to find a corresponding event in the ops log around this time. + Since *string `json:"since,omitempty" azure:"ro"` +} + +// Diagnostics - Describes conditions applicable to the Input, Output, or the job overall, that warrant customer attention. +type Diagnostics struct { + // READ-ONLY; A collection of zero or more conditions applicable to the resource, or to the job overall, that warrant customer attention. + Conditions []*DiagnosticCondition `json:"conditions,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type Diagnostics. +func (d Diagnostics) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "conditions", d.Conditions) + return json.Marshal(objectMap) +} + +// DocumentDbOutputDataSource - Describes a DocumentDB output data source. +type DocumentDbOutputDataSource struct { + OutputDataSource + // The properties that are associated with a DocumentDB output. Required on PUT (CreateOrReplace) requests. + Properties *DocumentDbOutputDataSourceProperties `json:"properties,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type DocumentDbOutputDataSource. +func (d DocumentDbOutputDataSource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + d.OutputDataSource.marshalInternal(objectMap, "Microsoft.Storage/DocumentDB") + populate(objectMap, "properties", d.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DocumentDbOutputDataSource. +func (d *DocumentDbOutputDataSource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, &d.Properties) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + if err := d.OutputDataSource.unmarshalInternal(rawMsg); err != nil { + return err + } + return nil +} + +// DocumentDbOutputDataSourceProperties - The properties that are associated with a DocumentDB output. +type DocumentDbOutputDataSourceProperties struct { + // The DocumentDB account name or ID. Required on PUT (CreateOrReplace) requests. + AccountID *string `json:"accountId,omitempty"` + + // The account key for the DocumentDB account. Required on PUT (CreateOrReplace) requests. + AccountKey *string `json:"accountKey,omitempty"` + + // The collection name pattern for the collections to be used. The collection name format can be constructed using the optional {partition} token, where + // partitions start from 0. See the DocumentDB + // section of https://docs.microsoft.com/en-us/rest/api/streamanalytics/stream-analytics-output for more information. Required on PUT (CreateOrReplace) + // requests. + CollectionNamePattern *string `json:"collectionNamePattern,omitempty"` + + // The name of the DocumentDB database. Required on PUT (CreateOrReplace) requests. + Database *string `json:"database,omitempty"` + + // The name of the field in output events used to specify the primary key which insert or update operations are based on. + DocumentID *string `json:"documentId,omitempty"` + + // The name of the field in output events used to specify the key for partitioning output across collections. If 'collectionNamePattern' contains the {partition} + // token, this property is required to be + // specified. + PartitionKey *string `json:"partitionKey,omitempty"` +} + +// Error - Common error representation. +// Implements the error and azcore.HTTPResponse interfaces. +type Error struct { + raw string + // Error definition properties. + InnerError *ErrorError `json:"error,omitempty"` +} + +// Error implements the error interface for type Error. +// The contents of the error text are not contractual and subject to change. +func (e Error) Error() string { + return e.raw +} + +// ErrorDetails - Common error details representation. +type ErrorDetails struct { + // Error code. + Code *string `json:"code,omitempty"` + + // Error message. + Message *string `json:"message,omitempty"` + + // Error target. + Target *string `json:"target,omitempty"` +} + +// ErrorError - Error definition properties. +type ErrorError struct { + // Error code. + Code *string `json:"code,omitempty"` + + // Error details. + Details []*ErrorDetails `json:"details,omitempty"` + + // Error message. + Message *string `json:"message,omitempty"` + + // Error target. + Target *string `json:"target,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type ErrorError. +func (e ErrorError) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "code", e.Code) + populate(objectMap, "details", e.Details) + populate(objectMap, "message", e.Message) + populate(objectMap, "target", e.Target) + return json.Marshal(objectMap) +} + +// ErrorResponse - Describes the error that occurred. +type ErrorResponse struct { + // READ-ONLY; Error code associated with the error that occurred. + Code *string `json:"code,omitempty" azure:"ro"` + + // READ-ONLY; Describes the error in detail. + Message *string `json:"message,omitempty" azure:"ro"` +} + +// EventHubDataSourceProperties - The common properties that are associated with Event Hub data sources. +type EventHubDataSourceProperties struct { + ServiceBusDataSourceProperties + // The name of the Event Hub. Required on PUT (CreateOrReplace) requests. + EventHubName *string `json:"eventHubName,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type EventHubDataSourceProperties. +func (e EventHubDataSourceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + e.marshalInternal(objectMap) + return json.Marshal(objectMap) +} + +func (e EventHubDataSourceProperties) marshalInternal(objectMap map[string]interface{}) { + e.ServiceBusDataSourceProperties.marshalInternal(objectMap) + populate(objectMap, "eventHubName", e.EventHubName) +} + +// EventHubOutputDataSource - Describes an Event Hub output data source. +type EventHubOutputDataSource struct { + OutputDataSource + // The properties that are associated with an Event Hub output. Required on PUT (CreateOrReplace) requests. + Properties *EventHubOutputDataSourceProperties `json:"properties,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type EventHubOutputDataSource. +func (e EventHubOutputDataSource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + e.OutputDataSource.marshalInternal(objectMap, "Microsoft.ServiceBus/EventHub") + populate(objectMap, "properties", e.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EventHubOutputDataSource. +func (e *EventHubOutputDataSource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, &e.Properties) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + if err := e.OutputDataSource.unmarshalInternal(rawMsg); err != nil { + return err + } + return nil +} + +// EventHubOutputDataSourceProperties - The properties that are associated with an Event Hub output. +type EventHubOutputDataSourceProperties struct { + EventHubDataSourceProperties + // The key/column that is used to determine to which partition to send event data. + PartitionKey *string `json:"partitionKey,omitempty"` + PropertyColumns []*string `json:"propertyColumns,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type EventHubOutputDataSourceProperties. +func (e EventHubOutputDataSourceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + e.EventHubDataSourceProperties.marshalInternal(objectMap) + populate(objectMap, "partitionKey", e.PartitionKey) + populate(objectMap, "propertyColumns", e.PropertyColumns) + return json.Marshal(objectMap) +} + +// EventHubStreamInputDataSource - Describes an Event Hub input data source that contains stream data. +type EventHubStreamInputDataSource struct { + StreamInputDataSource + // The properties that are associated with an Event Hub input containing stream data. Required on PUT (CreateOrReplace) requests. + Properties *EventHubStreamInputDataSourceProperties `json:"properties,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type EventHubStreamInputDataSource. +func (e EventHubStreamInputDataSource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + e.StreamInputDataSource.marshalInternal(objectMap, "Microsoft.ServiceBus/EventHub") + populate(objectMap, "properties", e.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EventHubStreamInputDataSource. +func (e *EventHubStreamInputDataSource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, &e.Properties) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + if err := e.StreamInputDataSource.unmarshalInternal(rawMsg); err != nil { + return err + } + return nil +} + +// EventHubStreamInputDataSourceProperties - The properties that are associated with a Event Hub input containing stream data. +type EventHubStreamInputDataSourceProperties struct { + EventHubDataSourceProperties + // The name of an Event Hub Consumer Group that should be used to read events from the Event Hub. Specifying distinct consumer group names for multiple + // inputs allows each of those inputs to receive the + // same events from the Event Hub. If not specified, the input uses the Event Hub’s default consumer group. + ConsumerGroupName *string `json:"consumerGroupName,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type EventHubStreamInputDataSourceProperties. +func (e EventHubStreamInputDataSourceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + e.EventHubDataSourceProperties.marshalInternal(objectMap) + populate(objectMap, "consumerGroupName", e.ConsumerGroupName) + return json.Marshal(objectMap) +} + +// EventHubV2OutputDataSource - Describes an Event Hub output data source. +type EventHubV2OutputDataSource struct { + OutputDataSource + // The properties that are associated with an Event Hub output. Required on PUT (CreateOrReplace) requests. + Properties *EventHubOutputDataSourceProperties `json:"properties,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type EventHubV2OutputDataSource. +func (e EventHubV2OutputDataSource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + e.OutputDataSource.marshalInternal(objectMap, "Microsoft.EventHub/EventHub") + populate(objectMap, "properties", e.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EventHubV2OutputDataSource. +func (e *EventHubV2OutputDataSource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, &e.Properties) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + if err := e.OutputDataSource.unmarshalInternal(rawMsg); err != nil { + return err + } + return nil +} + +// EventHubV2StreamInputDataSource - Describes an Event Hub input data source that contains stream data. +type EventHubV2StreamInputDataSource struct { + StreamInputDataSource + // The properties that are associated with an Event Hub input containing stream data. Required on PUT (CreateOrReplace) requests. + Properties *EventHubStreamInputDataSourceProperties `json:"properties,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type EventHubV2StreamInputDataSource. +func (e EventHubV2StreamInputDataSource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + e.StreamInputDataSource.marshalInternal(objectMap, "Microsoft.EventHub/EventHub") + populate(objectMap, "properties", e.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EventHubV2StreamInputDataSource. +func (e *EventHubV2StreamInputDataSource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, &e.Properties) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + if err := e.StreamInputDataSource.unmarshalInternal(rawMsg); err != nil { + return err + } + return nil +} + +// External - The storage account where the custom code artifacts are located. +type External struct { + Container *string `json:"container,omitempty"` + Path *string `json:"path,omitempty"` + + // The properties that are associated with an Azure Storage account + StorageAccount *StorageAccount `json:"storageAccount,omitempty"` +} + +// Function - A function object, containing all information associated with the named function. All functions are contained under a streaming job. +type Function struct { + SubResource + // The properties that are associated with a function. + Properties FunctionPropertiesClassification `json:"properties,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type Function. +func (f Function) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + f.SubResource.marshalInternal(objectMap) + populate(objectMap, "properties", f.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Function. +func (f *Function) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + f.Properties, err = unmarshalFunctionPropertiesClassification(val) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + if err := f.SubResource.unmarshalInternal(rawMsg); err != nil { + return err + } + return nil +} + +// FunctionBindingClassification provides polymorphic access to related types. +// Call the interface's GetFunctionBinding() method to access the common type. +// Use a type switch to determine the concrete type. The possible types are: +// - *AzureMachineLearningServiceFunctionBinding, *AzureMachineLearningStudioFunctionBinding, *CSharpFunctionBinding, *FunctionBinding, +// - *JavaScriptFunctionBinding +type FunctionBindingClassification interface { + // GetFunctionBinding returns the FunctionBinding content of the underlying type. + GetFunctionBinding() *FunctionBinding +} + +// FunctionBinding - The physical binding of the function. For example, in the Azure Machine Learning web service’s case, this describes the endpoint. +type FunctionBinding struct { + // REQUIRED; Indicates the function binding type. + Type *string `json:"type,omitempty"` +} + +// GetFunctionBinding implements the FunctionBindingClassification interface for type FunctionBinding. +func (f *FunctionBinding) GetFunctionBinding() *FunctionBinding { return f } + +// UnmarshalJSON implements the json.Unmarshaller interface for type FunctionBinding. +func (f *FunctionBinding) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + return f.unmarshalInternal(rawMsg) +} + +func (f FunctionBinding) marshalInternal(objectMap map[string]interface{}, discValue string) { + f.Type = &discValue + objectMap["type"] = f.Type +} + +func (f *FunctionBinding) unmarshalInternal(rawMsg map[string]json.RawMessage) error { + for key, val := range rawMsg { + var err error + switch key { + case "type": + err = unpopulate(val, &f.Type) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +type FunctionConfiguration struct { + // The physical binding of the function. For example, in the Azure Machine Learning web service’s case, this describes the endpoint. + Binding FunctionBindingClassification `json:"binding,omitempty"` + Inputs []*FunctionInput `json:"inputs,omitempty"` + + // Describes the output of a function. + Output *FunctionOutput `json:"output,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type FunctionConfiguration. +func (f FunctionConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "binding", f.Binding) + populate(objectMap, "inputs", f.Inputs) + populate(objectMap, "output", f.Output) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FunctionConfiguration. +func (f *FunctionConfiguration) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "binding": + f.Binding, err = unmarshalFunctionBindingClassification(val) + delete(rawMsg, key) + case "inputs": + err = unpopulate(val, &f.Inputs) + delete(rawMsg, key) + case "output": + err = unpopulate(val, &f.Output) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// FunctionInput - Describes one input parameter of a function. +type FunctionInput struct { + // The (Azure Stream Analytics supported) data type of the function input parameter. A list of valid Azure Stream Analytics data types are described at + // https://msdn.microsoft.com/en-us/library/azure/dn835065.aspx + DataType *string `json:"dataType,omitempty"` + + // A flag indicating if the parameter is a configuration parameter. True if this input parameter is expected to be a constant. Default is false. + IsConfigurationParameter *bool `json:"isConfigurationParameter,omitempty"` +} + +// FunctionListResult - Object containing a list of functions under a streaming job. +type FunctionListResult struct { + // READ-ONLY; The link (url) to the next page of results. + NextLink *string `json:"nextLink,omitempty" azure:"ro"` + + // READ-ONLY; A list of functions under a streaming job. Populated by a 'List' operation. + Value []*Function `json:"value,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type FunctionListResult. +func (f FunctionListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", f.NextLink) + populate(objectMap, "value", f.Value) + return json.Marshal(objectMap) +} + +// FunctionOutput - Describes the output of a function. +type FunctionOutput struct { + // The (Azure Stream Analytics supported) data type of the function output. A list of valid Azure Stream Analytics data types are described at https://msdn.microsoft.com/en-us/library/azure/dn835065.aspx + DataType *string `json:"dataType,omitempty"` +} + +// FunctionPropertiesClassification provides polymorphic access to related types. +// Call the interface's GetFunctionProperties() method to access the common type. +// Use a type switch to determine the concrete type. The possible types are: +// - *AggregateFunctionProperties, *FunctionProperties, *ScalarFunctionProperties +type FunctionPropertiesClassification interface { + // GetFunctionProperties returns the FunctionProperties content of the underlying type. + GetFunctionProperties() *FunctionProperties +} + +// FunctionProperties - The properties that are associated with a function. +type FunctionProperties struct { + // REQUIRED; Indicates the type of function. + Type *string `json:"type,omitempty"` + Properties *FunctionConfiguration `json:"properties,omitempty"` + + // READ-ONLY; The current entity tag for the function. This is an opaque string. You can use it to detect whether the resource has changed between requests. + // You can also use it in the If-Match or If-None-Match + // headers for write operations for optimistic concurrency. + Etag *string `json:"etag,omitempty" azure:"ro"` +} + +// GetFunctionProperties implements the FunctionPropertiesClassification interface for type FunctionProperties. +func (f *FunctionProperties) GetFunctionProperties() *FunctionProperties { return f } + +// UnmarshalJSON implements the json.Unmarshaller interface for type FunctionProperties. +func (f *FunctionProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + return f.unmarshalInternal(rawMsg) +} + +func (f FunctionProperties) marshalInternal(objectMap map[string]interface{}, discValue string) { + populate(objectMap, "etag", f.Etag) + populate(objectMap, "properties", f.Properties) + f.Type = &discValue + objectMap["type"] = f.Type +} + +func (f *FunctionProperties) unmarshalInternal(rawMsg map[string]json.RawMessage) error { + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, &f.Etag) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, &f.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, &f.Type) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// FunctionRetrieveDefaultDefinitionParametersClassification provides polymorphic access to related types. +// Call the interface's GetFunctionRetrieveDefaultDefinitionParameters() method to access the common type. +// Use a type switch to determine the concrete type. The possible types are: +// - *AzureMachineLearningServiceFunctionRetrieveDefaultDefinitionParameters, *AzureMachineLearningStudioFunctionRetrieveDefaultDefinitionParameters, +// - *CSharpFunctionRetrieveDefaultDefinitionParameters, *FunctionRetrieveDefaultDefinitionParameters, *JavaScriptFunctionRetrieveDefaultDefinitionParameters +type FunctionRetrieveDefaultDefinitionParametersClassification interface { + // GetFunctionRetrieveDefaultDefinitionParameters returns the FunctionRetrieveDefaultDefinitionParameters content of the underlying type. + GetFunctionRetrieveDefaultDefinitionParameters() *FunctionRetrieveDefaultDefinitionParameters +} + +// FunctionRetrieveDefaultDefinitionParameters - Parameters used to specify the type of function to retrieve the default definition for. +type FunctionRetrieveDefaultDefinitionParameters struct { + // REQUIRED; Indicates the function binding type. + BindingType *string `json:"bindingType,omitempty"` +} + +// GetFunctionRetrieveDefaultDefinitionParameters implements the FunctionRetrieveDefaultDefinitionParametersClassification interface for type FunctionRetrieveDefaultDefinitionParameters. +func (f *FunctionRetrieveDefaultDefinitionParameters) GetFunctionRetrieveDefaultDefinitionParameters() *FunctionRetrieveDefaultDefinitionParameters { + return f +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FunctionRetrieveDefaultDefinitionParameters. +func (f *FunctionRetrieveDefaultDefinitionParameters) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + return f.unmarshalInternal(rawMsg) +} + +func (f FunctionRetrieveDefaultDefinitionParameters) marshalInternal(objectMap map[string]interface{}, discValue string) { + f.BindingType = &discValue + objectMap["bindingType"] = f.BindingType +} + +func (f *FunctionRetrieveDefaultDefinitionParameters) unmarshalInternal(rawMsg map[string]json.RawMessage) error { + for key, val := range rawMsg { + var err error + switch key { + case "bindingType": + err = unpopulate(val, &f.BindingType) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// FunctionsBeginTestOptions contains the optional parameters for the Functions.BeginTest method. +type FunctionsBeginTestOptions struct { + // 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. + Function *Function +} + +// FunctionsCreateOrReplaceOptions contains the optional parameters for the Functions.CreateOrReplace method. +type FunctionsCreateOrReplaceOptions struct { + // The ETag of the function. Omit this value to always overwrite the current function. Specify the last-seen ETag value to prevent accidentally overwriting + // concurrent changes. + IfMatch *string + // 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. + IfNoneMatch *string +} + +// FunctionsDeleteOptions contains the optional parameters for the Functions.Delete method. +type FunctionsDeleteOptions struct { + // placeholder for future optional parameters +} + +// FunctionsGetOptions contains the optional parameters for the Functions.Get method. +type FunctionsGetOptions struct { + // placeholder for future optional parameters +} + +// FunctionsListByStreamingJobOptions contains the optional parameters for the Functions.ListByStreamingJob method. +type FunctionsListByStreamingJobOptions struct { + // 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. + Select *string +} + +// FunctionsRetrieveDefaultDefinitionOptions contains the optional parameters for the Functions.RetrieveDefaultDefinition method. +type FunctionsRetrieveDefaultDefinitionOptions struct { + // Parameters used to specify the type of function to retrieve the default definition for. + FunctionRetrieveDefaultDefinitionParameters FunctionRetrieveDefaultDefinitionParametersClassification +} + +// FunctionsUpdateOptions contains the optional parameters for the Functions.Update method. +type FunctionsUpdateOptions struct { + // The ETag of the function. Omit this value to always overwrite the current function. Specify the last-seen ETag value to prevent accidentally overwriting + // concurrent changes. + IfMatch *string +} + +// Identity - Describes how identity is verified +type Identity struct { + PrincipalID *string `json:"principalId,omitempty"` + TenantID *string `json:"tenantId,omitempty"` + Type *string `json:"type,omitempty"` +} + +// Input - An input object, containing all information associated with the named input. All inputs are contained under a streaming job. +type Input struct { + SubResource + // The properties that are associated with an input. Required on PUT (CreateOrReplace) requests. + Properties InputPropertiesClassification `json:"properties,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type Input. +func (i Input) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + i.SubResource.marshalInternal(objectMap) + populate(objectMap, "properties", i.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Input. +func (i *Input) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + i.Properties, err = unmarshalInputPropertiesClassification(val) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + if err := i.SubResource.unmarshalInternal(rawMsg); err != nil { + return err + } + return nil +} + +// InputListResult - Object containing a list of inputs under a streaming job. +type InputListResult struct { + // READ-ONLY; The link (url) to the next page of results. + NextLink *string `json:"nextLink,omitempty" azure:"ro"` + + // READ-ONLY; A list of inputs under a streaming job. Populated by a 'List' operation. + Value []*Input `json:"value,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type InputListResult. +func (i InputListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", i.NextLink) + populate(objectMap, "value", i.Value) + return json.Marshal(objectMap) +} + +// InputPropertiesClassification provides polymorphic access to related types. +// Call the interface's GetInputProperties() method to access the common type. +// Use a type switch to determine the concrete type. The possible types are: +// - *InputProperties, *ReferenceInputProperties, *StreamInputProperties +type InputPropertiesClassification interface { + // GetInputProperties returns the InputProperties content of the underlying type. + GetInputProperties() *InputProperties +} + +// InputProperties - The properties that are associated with an input. +type InputProperties struct { + // REQUIRED; Indicates whether the input is a source of reference data or stream data. Required on PUT (CreateOrReplace) requests. + Type *string `json:"type,omitempty"` + + // Describes how input data is compressed + Compression *Compression `json:"compression,omitempty"` + + // partitionKey Describes a key in the input data which is used for partitioning the input data + PartitionKey *string `json:"partitionKey,omitempty"` + + // Describes how data from an input is serialized or how data is serialized when written to an output. Required on PUT (CreateOrReplace) requests. + Serialization SerializationClassification `json:"serialization,omitempty"` + + // READ-ONLY; Describes conditions applicable to the Input, Output, or the job overall, that warrant customer attention. + Diagnostics *Diagnostics `json:"diagnostics,omitempty" azure:"ro"` + + // READ-ONLY; The current entity tag for the input. This is an opaque string. You can use it to detect whether the resource has changed between requests. + // You can also use it in the If-Match or If-None-Match headers + // for write operations for optimistic concurrency. + Etag *string `json:"etag,omitempty" azure:"ro"` +} + +// GetInputProperties implements the InputPropertiesClassification interface for type InputProperties. +func (i *InputProperties) GetInputProperties() *InputProperties { return i } + +// UnmarshalJSON implements the json.Unmarshaller interface for type InputProperties. +func (i *InputProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + return i.unmarshalInternal(rawMsg) +} + +func (i InputProperties) marshalInternal(objectMap map[string]interface{}, discValue string) { + populate(objectMap, "compression", i.Compression) + populate(objectMap, "diagnostics", i.Diagnostics) + populate(objectMap, "etag", i.Etag) + populate(objectMap, "partitionKey", i.PartitionKey) + populate(objectMap, "serialization", i.Serialization) + i.Type = &discValue + objectMap["type"] = i.Type +} + +func (i *InputProperties) unmarshalInternal(rawMsg map[string]json.RawMessage) error { + for key, val := range rawMsg { + var err error + switch key { + case "compression": + err = unpopulate(val, &i.Compression) + delete(rawMsg, key) + case "diagnostics": + err = unpopulate(val, &i.Diagnostics) + delete(rawMsg, key) + case "etag": + err = unpopulate(val, &i.Etag) + delete(rawMsg, key) + case "partitionKey": + err = unpopulate(val, &i.PartitionKey) + delete(rawMsg, key) + case "serialization": + i.Serialization, err = unmarshalSerializationClassification(val) + delete(rawMsg, key) + case "type": + err = unpopulate(val, &i.Type) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// InputsBeginTestOptions contains the optional parameters for the Inputs.BeginTest method. +type InputsBeginTestOptions struct { + // 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. + Input *Input +} + +// InputsCreateOrReplaceOptions contains the optional parameters for the Inputs.CreateOrReplace method. +type InputsCreateOrReplaceOptions struct { + // The ETag of the input. Omit this value to always overwrite the current input. Specify the last-seen ETag value to prevent accidentally overwriting concurrent + // changes. + IfMatch *string + // 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. + IfNoneMatch *string +} + +// InputsDeleteOptions contains the optional parameters for the Inputs.Delete method. +type InputsDeleteOptions struct { + // placeholder for future optional parameters +} + +// InputsGetOptions contains the optional parameters for the Inputs.Get method. +type InputsGetOptions struct { + // placeholder for future optional parameters +} + +// InputsListByStreamingJobOptions contains the optional parameters for the Inputs.ListByStreamingJob method. +type InputsListByStreamingJobOptions struct { + // 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. + Select *string +} + +// InputsUpdateOptions contains the optional parameters for the Inputs.Update method. +type InputsUpdateOptions struct { + // The ETag of the input. Omit this value to always overwrite the current input. Specify the last-seen ETag value to prevent accidentally overwriting concurrent + // changes. + IfMatch *string +} + +// IoTHubStreamInputDataSource - Describes an IoT Hub input data source that contains stream data. +type IoTHubStreamInputDataSource struct { + StreamInputDataSource + // The properties that are associated with an IoT Hub input containing stream data. Required on PUT (CreateOrReplace) requests. + Properties *IoTHubStreamInputDataSourceProperties `json:"properties,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type IoTHubStreamInputDataSource. +func (i IoTHubStreamInputDataSource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + i.StreamInputDataSource.marshalInternal(objectMap, "Microsoft.Devices/IotHubs") + populate(objectMap, "properties", i.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type IoTHubStreamInputDataSource. +func (i *IoTHubStreamInputDataSource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, &i.Properties) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + if err := i.StreamInputDataSource.unmarshalInternal(rawMsg); err != nil { + return err + } + return nil +} + +// IoTHubStreamInputDataSourceProperties - The properties that are associated with a IoT Hub input containing stream data. +type IoTHubStreamInputDataSourceProperties struct { + // The name of an IoT Hub Consumer Group that should be used to read events from the IoT Hub. If not specified, the input uses the Iot Hub’s default consumer + // group. + ConsumerGroupName *string `json:"consumerGroupName,omitempty"` + + // The IoT Hub endpoint to connect to (ie. messages/events, messages/operationsMonitoringEvents, etc.). + Endpoint *string `json:"endpoint,omitempty"` + + // The name or the URI of the IoT Hub. Required on PUT (CreateOrReplace) requests. + IotHubNamespace *string `json:"iotHubNamespace,omitempty"` + + // The shared access policy key for the specified shared access policy. Required on PUT (CreateOrReplace) requests. + SharedAccessPolicyKey *string `json:"sharedAccessPolicyKey,omitempty"` + + // The shared access policy name for the IoT Hub. This policy must contain at least the Service connect permission. Required on PUT (CreateOrReplace) requests. + SharedAccessPolicyName *string `json:"sharedAccessPolicyName,omitempty"` +} + +// JSONSerialization - Describes how data from an input is serialized or how data is serialized when written to an output in JSON format. +type JSONSerialization struct { + Serialization + // The properties that are associated with the JSON serialization type. Required on PUT (CreateOrReplace) requests. + Properties *JSONSerializationProperties `json:"properties,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type JSONSerialization. +func (j JSONSerialization) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + j.Serialization.marshalInternal(objectMap, EventSerializationTypeJSON) + populate(objectMap, "properties", j.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type JSONSerialization. +func (j *JSONSerialization) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, &j.Properties) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + if err := j.Serialization.unmarshalInternal(rawMsg); err != nil { + return err + } + return nil +} + +// JSONSerializationProperties - The properties that are associated with the JSON serialization type. +type JSONSerializationProperties struct { + // Specifies the encoding of the incoming data in the case of input and the encoding of outgoing data in the case of output. Required on PUT (CreateOrReplace) + // requests. + Encoding *Encoding `json:"encoding,omitempty"` + + // This property only applies to JSON serialization of outputs only. It is not applicable to inputs. This property specifies the format of the JSON the + // output will be written in. The currently supported + // values are 'lineSeparated' indicating the output will be formatted by having each JSON object separated by a new line and 'array' indicating the output + // will be formatted as an array of JSON objects. + // Default value is 'lineSeparated' if left null. + Format *JSONOutputSerializationFormat `json:"format,omitempty"` +} + +// JavaScriptFunctionBinding - The binding to a JavaScript function. +type JavaScriptFunctionBinding struct { + FunctionBinding + // The binding properties associated with a JavaScript function. + Properties *JavaScriptFunctionBindingProperties `json:"properties,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type JavaScriptFunctionBinding. +func (j JavaScriptFunctionBinding) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + j.FunctionBinding.marshalInternal(objectMap, "Microsoft.StreamAnalytics/JavascriptUdf") + populate(objectMap, "properties", j.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type JavaScriptFunctionBinding. +func (j *JavaScriptFunctionBinding) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, &j.Properties) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + if err := j.FunctionBinding.unmarshalInternal(rawMsg); err != nil { + return err + } + return nil +} + +// JavaScriptFunctionBindingProperties - The binding properties associated with a JavaScript function. +type JavaScriptFunctionBindingProperties struct { + // The JavaScript code containing a single function definition. For example: 'function (x, y) { return x + y; }' + Script *string `json:"script,omitempty"` +} + +// JavaScriptFunctionBindingRetrievalProperties - The binding retrieval properties associated with a JavaScript function. +type JavaScriptFunctionBindingRetrievalProperties struct { + // The JavaScript code containing a single function definition. For example: 'function (x, y) { return x + y; }'. + Script *string `json:"script,omitempty"` + + // The function type. + UdfType *string `json:"udfType,omitempty"` +} + +// JavaScriptFunctionRetrieveDefaultDefinitionParameters - The parameters needed to retrieve the default function definition for a JavaScript function. +type JavaScriptFunctionRetrieveDefaultDefinitionParameters struct { + FunctionRetrieveDefaultDefinitionParameters + // The binding retrieval properties associated with a JavaScript function. + BindingRetrievalProperties *JavaScriptFunctionBindingRetrievalProperties `json:"bindingRetrievalProperties,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type JavaScriptFunctionRetrieveDefaultDefinitionParameters. +func (j JavaScriptFunctionRetrieveDefaultDefinitionParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + j.FunctionRetrieveDefaultDefinitionParameters.marshalInternal(objectMap, "Microsoft.StreamAnalytics/JavascriptUdf") + populate(objectMap, "bindingRetrievalProperties", j.BindingRetrievalProperties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type JavaScriptFunctionRetrieveDefaultDefinitionParameters. +func (j *JavaScriptFunctionRetrieveDefaultDefinitionParameters) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "bindingRetrievalProperties": + err = unpopulate(val, &j.BindingRetrievalProperties) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + if err := j.FunctionRetrieveDefaultDefinitionParameters.unmarshalInternal(rawMsg); err != nil { + return err + } + return nil +} + +// JobStorageAccount - The properties that are associated with an Azure Storage account with MSI +type JobStorageAccount struct { + StorageAccount + // Authentication Mode. + AuthenticationMode *AuthenticationMode `json:"authenticationMode,omitempty"` +} + +// OAuthBasedDataSourceProperties - The properties that are associated with data sources that use OAuth as their authentication model. +type OAuthBasedDataSourceProperties struct { + // A refresh token that can be used to obtain a valid access token that can then be used to authenticate with the data source. A valid refresh token is + // currently only obtainable via the Azure Portal. It + // is recommended to put a dummy string value here when creating the data source and then going to the Azure Portal to authenticate the data source which + // will update this property with a valid refresh + // token. Required on PUT (CreateOrReplace) requests. + RefreshToken *string `json:"refreshToken,omitempty"` + + // The user display name of the user that was used to obtain the refresh token. Use this property to help remember which user was used to obtain the refresh + // token. + TokenUserDisplayName *string `json:"tokenUserDisplayName,omitempty"` + + // The user principal name (UPN) of the user that was used to obtain the refresh token. Use this property to help remember which user was used to obtain + // the refresh token. + TokenUserPrincipalName *string `json:"tokenUserPrincipalName,omitempty"` +} + +// Operation - A Stream Analytics REST API operation +type Operation struct { + // READ-ONLY; Contains the localized display information for this particular operation / action. + Display *OperationDisplay `json:"display,omitempty" azure:"ro"` + + // READ-ONLY; The name of the operation being performed on this particular object. + Name *string `json:"name,omitempty" azure:"ro"` +} + +// OperationDisplay - Contains the localized display information for this particular operation / action. +type OperationDisplay struct { + // READ-ONLY; The localized friendly description for the operation. + Description *string `json:"description,omitempty" azure:"ro"` + + // READ-ONLY; The localized friendly name for the operation. + Operation *string `json:"operation,omitempty" azure:"ro"` + + // READ-ONLY; The localized friendly form of the resource provider name. + Provider *string `json:"provider,omitempty" azure:"ro"` + + // READ-ONLY; The localized friendly form of the resource type related to this action/operation. + Resource *string `json:"resource,omitempty" azure:"ro"` +} + +// OperationListResult - 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 { + // READ-ONLY; URL to get the next set of operation list results if there are any. + NextLink *string `json:"nextLink,omitempty" azure:"ro"` + + // READ-ONLY; List of Stream Analytics operations supported by the Microsoft.StreamAnalytics resource provider. + Value []*Operation `json:"value,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type OperationListResult. +func (o OperationListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", o.NextLink) + populate(objectMap, "value", o.Value) + return json.Marshal(objectMap) +} + +// OperationsListOptions contains the optional parameters for the Operations.List method. +type OperationsListOptions struct { + // placeholder for future optional parameters +} + +// Output - An output object, containing all information associated with the named output. All outputs are contained under a streaming job. +type Output struct { + SubResource + // The properties that are associated with an output. Required on PUT (CreateOrReplace) requests. + Properties *OutputProperties `json:"properties,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type Output. +func (o Output) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + o.SubResource.marshalInternal(objectMap) + populate(objectMap, "properties", o.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Output. +func (o *Output) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, &o.Properties) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + if err := o.SubResource.unmarshalInternal(rawMsg); err != nil { + return err + } + return nil +} + +// OutputDataSourceClassification provides polymorphic access to related types. +// Call the interface's GetOutputDataSource() method to access the common type. +// Use a type switch to determine the concrete type. The possible types are: +// - *AzureDataLakeStoreOutputDataSource, *AzureFunctionOutputDataSource, *AzureSqlDatabaseOutputDataSource, *AzureSynapseOutputDataSource, +// - *AzureTableOutputDataSource, *BlobOutputDataSource, *DocumentDbOutputDataSource, *EventHubOutputDataSource, *EventHubV2OutputDataSource, +// - *OutputDataSource, *PowerBIOutputDataSource, *RawOutputDatasource, *ServiceBusQueueOutputDataSource, *ServiceBusTopicOutputDataSource +type OutputDataSourceClassification interface { + // GetOutputDataSource returns the OutputDataSource content of the underlying type. + GetOutputDataSource() *OutputDataSource +} + +// OutputDataSource - Describes the data source that output will be written to. +type OutputDataSource struct { + // REQUIRED; Indicates the type of data source output will be written to. Required on PUT (CreateOrReplace) requests. + Type *string `json:"type,omitempty"` +} + +// GetOutputDataSource implements the OutputDataSourceClassification interface for type OutputDataSource. +func (o *OutputDataSource) GetOutputDataSource() *OutputDataSource { return o } + +// UnmarshalJSON implements the json.Unmarshaller interface for type OutputDataSource. +func (o *OutputDataSource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + return o.unmarshalInternal(rawMsg) +} + +func (o OutputDataSource) marshalInternal(objectMap map[string]interface{}, discValue string) { + o.Type = &discValue + objectMap["type"] = o.Type +} + +func (o *OutputDataSource) unmarshalInternal(rawMsg map[string]json.RawMessage) error { + for key, val := range rawMsg { + var err error + switch key { + case "type": + err = unpopulate(val, &o.Type) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// OutputListResult - Object containing a list of outputs under a streaming job. +type OutputListResult struct { + // READ-ONLY; The link (url) to the next page of results. + NextLink *string `json:"nextLink,omitempty" azure:"ro"` + + // READ-ONLY; A list of outputs under a streaming job. Populated by a 'List' operation. + Value []*Output `json:"value,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type OutputListResult. +func (o OutputListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", o.NextLink) + populate(objectMap, "value", o.Value) + return json.Marshal(objectMap) +} + +// OutputProperties - The properties that are associated with an output. +type OutputProperties struct { + // Describes the data source that output will be written to. Required on PUT (CreateOrReplace) requests. + Datasource OutputDataSourceClassification `json:"datasource,omitempty"` + + // Describes how data from an input is serialized or how data is serialized when written to an output. Required on PUT (CreateOrReplace) requests. + Serialization SerializationClassification `json:"serialization,omitempty"` + SizeWindow *float32 `json:"sizeWindow,omitempty"` + TimeWindow *string `json:"timeWindow,omitempty"` + + // READ-ONLY; Describes conditions applicable to the Input, Output, or the job overall, that warrant customer attention. + Diagnostics *Diagnostics `json:"diagnostics,omitempty" azure:"ro"` + + // READ-ONLY; The current entity tag for the output. This is an opaque string. You can use it to detect whether the resource has changed between requests. + // You can also use it in the If-Match or If-None-Match + // headers for write operations for optimistic concurrency. + Etag *string `json:"etag,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type OutputProperties. +func (o OutputProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "datasource", o.Datasource) + populate(objectMap, "diagnostics", o.Diagnostics) + populate(objectMap, "etag", o.Etag) + populate(objectMap, "serialization", o.Serialization) + populate(objectMap, "sizeWindow", o.SizeWindow) + populate(objectMap, "timeWindow", o.TimeWindow) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OutputProperties. +func (o *OutputProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "datasource": + o.Datasource, err = unmarshalOutputDataSourceClassification(val) + delete(rawMsg, key) + case "diagnostics": + err = unpopulate(val, &o.Diagnostics) + delete(rawMsg, key) + case "etag": + err = unpopulate(val, &o.Etag) + delete(rawMsg, key) + case "serialization": + o.Serialization, err = unmarshalSerializationClassification(val) + delete(rawMsg, key) + case "sizeWindow": + err = unpopulate(val, &o.SizeWindow) + delete(rawMsg, key) + case "timeWindow": + err = unpopulate(val, &o.TimeWindow) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// OutputsBeginTestOptions contains the optional parameters for the Outputs.BeginTest method. +type OutputsBeginTestOptions struct { + // 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. + Output *Output +} + +// OutputsCreateOrReplaceOptions contains the optional parameters for the Outputs.CreateOrReplace method. +type OutputsCreateOrReplaceOptions struct { + // The ETag of the output. Omit this value to always overwrite the current output. Specify the last-seen ETag value to prevent accidentally overwriting + // concurrent changes. + IfMatch *string + // 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. + IfNoneMatch *string +} + +// OutputsDeleteOptions contains the optional parameters for the Outputs.Delete method. +type OutputsDeleteOptions struct { + // placeholder for future optional parameters +} + +// OutputsGetOptions contains the optional parameters for the Outputs.Get method. +type OutputsGetOptions struct { + // placeholder for future optional parameters +} + +// OutputsListByStreamingJobOptions contains the optional parameters for the Outputs.ListByStreamingJob method. +type OutputsListByStreamingJobOptions struct { + // 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. + Select *string +} + +// OutputsUpdateOptions contains the optional parameters for the Outputs.Update method. +type OutputsUpdateOptions struct { + // The ETag of the output. Omit this value to always overwrite the current output. Specify the last-seen ETag value to prevent accidentally overwriting + // concurrent changes. + IfMatch *string +} + +// ParquetSerialization - Describes how data from an input is serialized or how data is serialized when written to an output in Parquet format. +type ParquetSerialization struct { + Serialization + // The properties that are associated with the Parquet serialization type. Required on PUT (CreateOrReplace) requests. + Properties map[string]interface{} `json:"properties,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type ParquetSerialization. +func (p ParquetSerialization) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + p.Serialization.marshalInternal(objectMap, EventSerializationTypeParquet) + populate(objectMap, "properties", p.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ParquetSerialization. +func (p *ParquetSerialization) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, &p.Properties) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + if err := p.Serialization.unmarshalInternal(rawMsg); err != nil { + return err + } + return nil +} + +// PowerBIOutputDataSource - Describes a Power BI output data source. +type PowerBIOutputDataSource struct { + OutputDataSource + // The properties that are associated with a Power BI output. Required on PUT (CreateOrReplace) requests. + Properties *PowerBIOutputDataSourceProperties `json:"properties,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type PowerBIOutputDataSource. +func (p PowerBIOutputDataSource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + p.OutputDataSource.marshalInternal(objectMap, "PowerBI") + populate(objectMap, "properties", p.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PowerBIOutputDataSource. +func (p *PowerBIOutputDataSource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, &p.Properties) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + if err := p.OutputDataSource.unmarshalInternal(rawMsg); err != nil { + return err + } + return nil +} + +// PowerBIOutputDataSourceProperties - The properties that are associated with a Power BI output. +type PowerBIOutputDataSourceProperties struct { + OAuthBasedDataSourceProperties + // Authentication Mode. + AuthenticationMode *AuthenticationMode `json:"authenticationMode,omitempty"` + + // The name of the Power BI dataset. Required on PUT (CreateOrReplace) requests. + Dataset *string `json:"dataset,omitempty"` + + // The ID of the Power BI group. + GroupID *string `json:"groupId,omitempty"` + + // The name of the Power BI group. Use this property to help remember which specific Power BI group id was used. + GroupName *string `json:"groupName,omitempty"` + + // The name of the Power BI table under the specified dataset. Required on PUT (CreateOrReplace) requests. + Table *string `json:"table,omitempty"` +} + +// PrivateEndpoint - Complete information about the private endpoint. +type PrivateEndpoint struct { + ProxyResource + // The properties associated with a private endpoint. + Properties *PrivateEndpointProperties `json:"properties,omitempty"` + + // READ-ONLY; Unique opaque string (generally a GUID) that represents the metadata state of the resource (private endpoint) and changes whenever the resource + // is updated. Required on PUT (CreateOrUpdate) requests. + Etag *string `json:"etag,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateEndpoint. +func (p PrivateEndpoint) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + p.ProxyResource.marshalInternal(objectMap) + populate(objectMap, "etag", p.Etag) + populate(objectMap, "properties", p.Properties) + return json.Marshal(objectMap) +} + +// PrivateEndpointListResult - A list of private endpoints. +type PrivateEndpointListResult struct { + // READ-ONLY; The URL to fetch the next set of private endpoints. + NextLink *string `json:"nextLink,omitempty" azure:"ro"` + + // READ-ONLY; A list of private endpoints. + Value []*PrivateEndpoint `json:"value,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointListResult. +func (p PrivateEndpointListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", p.NextLink) + populate(objectMap, "value", p.Value) + return json.Marshal(objectMap) +} + +// PrivateEndpointProperties - The properties associated with a private endpoint. +type PrivateEndpointProperties struct { + // A list of connections to the remote resource. Immutable after it is set. + ManualPrivateLinkServiceConnections []*PrivateLinkServiceConnection `json:"manualPrivateLinkServiceConnections,omitempty"` + + // READ-ONLY; The date when this private endpoint was created. + CreatedDate *string `json:"createdDate,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointProperties. +func (p PrivateEndpointProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "createdDate", p.CreatedDate) + populate(objectMap, "manualPrivateLinkServiceConnections", p.ManualPrivateLinkServiceConnections) + return json.Marshal(objectMap) +} + +// PrivateEndpointsBeginDeleteOptions contains the optional parameters for the PrivateEndpoints.BeginDelete method. +type PrivateEndpointsBeginDeleteOptions struct { + // placeholder for future optional parameters +} + +// PrivateEndpointsCreateOrUpdateOptions contains the optional parameters for the PrivateEndpoints.CreateOrUpdate method. +type PrivateEndpointsCreateOrUpdateOptions struct { + // The ETag of the resource. Omit this value to always overwrite the current record set. Specify the last-seen ETag value to prevent accidentally overwriting + // concurrent changes. + IfMatch *string + // Set to '*' to allow a new resource to be created, but to prevent updating an existing record set. Other values will result in a 412 Pre-condition Failed + // response. + IfNoneMatch *string +} + +// PrivateEndpointsGetOptions contains the optional parameters for the PrivateEndpoints.Get method. +type PrivateEndpointsGetOptions struct { + // placeholder for future optional parameters +} + +// PrivateEndpointsListByClusterOptions contains the optional parameters for the PrivateEndpoints.ListByCluster method. +type PrivateEndpointsListByClusterOptions struct { + // placeholder for future optional parameters +} + +// PrivateLinkConnectionState - A collection of read-only information about the state of the connection to the private remote resource. +type PrivateLinkConnectionState struct { + // READ-ONLY; A message indicating if changes on the service provider require any updates on the consumer. + ActionsRequired *string `json:"actionsRequired,omitempty" azure:"ro"` + + // READ-ONLY; The reason for approval/rejection of the connection. + Description *string `json:"description,omitempty" azure:"ro"` + + // READ-ONLY; Indicates whether the connection has been Approved/Rejected/Removed by the owner of the remote resource/service. + Status *string `json:"status,omitempty" azure:"ro"` +} + +// PrivateLinkServiceConnection - A grouping of information about the connection to the remote resource. +type PrivateLinkServiceConnection struct { + // Bag of properties defining a privatelinkServiceConnection. + Properties *PrivateLinkServiceConnectionProperties `json:"properties,omitempty"` +} + +// PrivateLinkServiceConnectionProperties - Bag of properties defining a privatelinkServiceConnection. +type PrivateLinkServiceConnectionProperties struct { + // The ID(s) of the group(s) obtained from the remote resource that this private endpoint should connect to. Required on PUT (CreateOrUpdate) requests. + GroupIDs []*string `json:"groupIds,omitempty"` + + // A collection of read-only information about the state of the connection to the private remote resource. + PrivateLinkServiceConnectionState *PrivateLinkConnectionState `json:"privateLinkServiceConnectionState,omitempty"` + + // The resource id of the private link service. Required on PUT (CreateOrUpdate) requests. + PrivateLinkServiceID *string `json:"privateLinkServiceId,omitempty"` + + // A message passed to the owner of the remote resource with this connection request. Restricted to 140 chars. + RequestMessage *string `json:"requestMessage,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateLinkServiceConnectionProperties. +func (p PrivateLinkServiceConnectionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "groupIds", p.GroupIDs) + populate(objectMap, "privateLinkServiceConnectionState", p.PrivateLinkServiceConnectionState) + populate(objectMap, "privateLinkServiceId", p.PrivateLinkServiceID) + populate(objectMap, "requestMessage", p.RequestMessage) + return json.Marshal(objectMap) +} + +// ProxyResource - The resource model definition for a ARM proxy resource. It will have everything other than required location and tags +type ProxyResource struct { + Resource +} + +func (p ProxyResource) marshalInternal(objectMap map[string]interface{}) { + p.Resource.marshalInternal(objectMap) +} + +// QueryCompilationError - An error produced by the compiler. +type QueryCompilationError struct { + // READ-ONLY; Describes the error location in the original query. Not set if isGlobal is true. + EndColumn *int32 `json:"endColumn,omitempty" azure:"ro"` + + // READ-ONLY; Describes the error location in the original query. Not set if isGlobal is true. + EndLine *int32 `json:"endLine,omitempty" azure:"ro"` + + // READ-ONLY; Whether the error is not for a specific part but for the entire query. + IsGlobal *bool `json:"isGlobal,omitempty" azure:"ro"` + + // READ-ONLY; The content of the error message. + Message *string `json:"message,omitempty" azure:"ro"` + + // READ-ONLY; Describes the error location in the original query. Not set if isGlobal is true. + StartColumn *int32 `json:"startColumn,omitempty" azure:"ro"` + + // READ-ONLY; Describes the error location in the original query. Not set if isGlobal is true. + StartLine *int32 `json:"startLine,omitempty" azure:"ro"` +} + +// QueryCompilationResult - The result of the query compilation request. +type QueryCompilationResult struct { + // READ-ONLY; Error messages produced by the compiler. + Errors []*QueryCompilationError `json:"errors,omitempty" azure:"ro"` + + // READ-ONLY; All function names used by the query. + Functions []*string `json:"functions,omitempty" azure:"ro"` + + // READ-ONLY; All input names used by the query. + Inputs []*string `json:"inputs,omitempty" azure:"ro"` + + // READ-ONLY; All output names used by the query. + Outputs []*string `json:"outputs,omitempty" azure:"ro"` + + // READ-ONLY; Warning messages produced by the compiler. + Warnings []*string `json:"warnings,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type QueryCompilationResult. +func (q QueryCompilationResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "errors", q.Errors) + populate(objectMap, "functions", q.Functions) + populate(objectMap, "inputs", q.Inputs) + populate(objectMap, "outputs", q.Outputs) + populate(objectMap, "warnings", q.Warnings) + return json.Marshal(objectMap) +} + +// QueryFunction - A function for the query compilation. +type QueryFunction struct { + // REQUIRED; The type of the function binding. + BindingType *string `json:"bindingType,omitempty"` + + // REQUIRED; The inputs for the function. + Inputs []*FunctionInput `json:"inputs,omitempty"` + + // REQUIRED; The name of the function. + Name *string `json:"name,omitempty"` + + // REQUIRED; An output for the function. + Output *FunctionOutput `json:"output,omitempty"` + + // REQUIRED; The type of the function. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type QueryFunction. +func (q QueryFunction) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "bindingType", q.BindingType) + populate(objectMap, "inputs", q.Inputs) + populate(objectMap, "name", q.Name) + populate(objectMap, "output", q.Output) + populate(objectMap, "type", q.Type) + return json.Marshal(objectMap) +} + +// QueryInput - An input for the query compilation. +type QueryInput struct { + // REQUIRED; The name of the input. + Name *string `json:"name,omitempty"` + + // REQUIRED; The type of the input, can be Stream or Reference. + Type *string `json:"type,omitempty"` +} + +// QueryTestingResult - The result of the query testing request. +type QueryTestingResult struct { + Error + // READ-ONLY; The SAS URL to the outputs payload. + OutputURI *string `json:"outputUri,omitempty" azure:"ro"` + + // READ-ONLY; The status of the query testing request. + Status *QueryTestingResultStatus `json:"status,omitempty" azure:"ro"` +} + +// RawInputDatasourceProperties - The properties that are associated with a raw input. +type RawInputDatasourceProperties struct { + // The JSON serialized content of the input data. Either payload or payloadUri must be set, but not both. + Payload *string `json:"payload,omitempty"` + + // The SAS URL to a blob containing the JSON serialized content of the input data. Either payload or payloadUri must be set, but not both. + PayloadURI *string `json:"payloadUri,omitempty"` +} + +// RawOutputDatasource - Describes a raw output data source. This data source type is only applicable/usable when using the query testing API. You cannot +// create a job with this data source type or add an output of this data +// source type to an existing job. +type RawOutputDatasource struct { + OutputDataSource + // The properties that are associated with a raw output. Required on PUT (CreateOrReplace) requests. + Properties *RawOutputDatasourceProperties `json:"properties,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type RawOutputDatasource. +func (r RawOutputDatasource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + r.OutputDataSource.marshalInternal(objectMap, "Raw") + populate(objectMap, "properties", r.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RawOutputDatasource. +func (r *RawOutputDatasource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, &r.Properties) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + if err := r.OutputDataSource.unmarshalInternal(rawMsg); err != nil { + return err + } + return nil +} + +// RawOutputDatasourceProperties - The properties that are associated with a raw output. +type RawOutputDatasourceProperties struct { + // The SAS URL to a blob where the output should be written. If this property is not set, output data will be written into a temporary storage, and a SAS + // URL to that temporary storage will be included in + // the result. + PayloadURI *string `json:"payloadUri,omitempty"` +} + +// RawReferenceInputDataSource - Describes a raw input data source that contains reference data. This data source type is only applicable/usable when using +// the query testing API. You cannot create a job with this data source type or +// add an input of this data source type to an existing job. +type RawReferenceInputDataSource struct { + ReferenceInputDataSource + // The properties that are associated with a raw input containing reference data. Required on PUT (CreateOrReplace) requests. + Properties *RawInputDatasourceProperties `json:"properties,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type RawReferenceInputDataSource. +func (r RawReferenceInputDataSource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + r.ReferenceInputDataSource.marshalInternal(objectMap, "Raw") + populate(objectMap, "properties", r.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RawReferenceInputDataSource. +func (r *RawReferenceInputDataSource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, &r.Properties) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + if err := r.ReferenceInputDataSource.unmarshalInternal(rawMsg); err != nil { + return err + } + return nil +} + +// RawStreamInputDataSource - Describes a raw input data source that contains stream data. This data source type is only applicable/usable when using the +// query testing API. You cannot create a job with this data source type or add +// an input of this data source type to an existing job. +type RawStreamInputDataSource struct { + StreamInputDataSource + // The properties that are associated with a raw input. Required on PUT (CreateOrReplace) requests. + Properties *RawInputDatasourceProperties `json:"properties,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type RawStreamInputDataSource. +func (r RawStreamInputDataSource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + r.StreamInputDataSource.marshalInternal(objectMap, "Raw") + populate(objectMap, "properties", r.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RawStreamInputDataSource. +func (r *RawStreamInputDataSource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, &r.Properties) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + if err := r.StreamInputDataSource.unmarshalInternal(rawMsg); err != nil { + return err + } + return nil +} + +// ReferenceInputDataSourceClassification provides polymorphic access to related types. +// Call the interface's GetReferenceInputDataSource() method to access the common type. +// Use a type switch to determine the concrete type. The possible types are: +// - *AzureSqlReferenceInputDataSource, *BlobReferenceInputDataSource, *RawReferenceInputDataSource, *ReferenceInputDataSource +type ReferenceInputDataSourceClassification interface { + // GetReferenceInputDataSource returns the ReferenceInputDataSource content of the underlying type. + GetReferenceInputDataSource() *ReferenceInputDataSource +} + +// ReferenceInputDataSource - Describes an input data source that contains reference data. +type ReferenceInputDataSource struct { + // REQUIRED; Indicates the type of input data source containing reference data. Required on PUT (CreateOrReplace) requests. + Type *string `json:"type,omitempty"` +} + +// GetReferenceInputDataSource implements the ReferenceInputDataSourceClassification interface for type ReferenceInputDataSource. +func (r *ReferenceInputDataSource) GetReferenceInputDataSource() *ReferenceInputDataSource { return r } + +// UnmarshalJSON implements the json.Unmarshaller interface for type ReferenceInputDataSource. +func (r *ReferenceInputDataSource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + return r.unmarshalInternal(rawMsg) +} + +func (r ReferenceInputDataSource) marshalInternal(objectMap map[string]interface{}, discValue string) { + r.Type = &discValue + objectMap["type"] = r.Type +} + +func (r *ReferenceInputDataSource) unmarshalInternal(rawMsg map[string]json.RawMessage) error { + for key, val := range rawMsg { + var err error + switch key { + case "type": + err = unpopulate(val, &r.Type) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// ReferenceInputProperties - The properties that are associated with an input containing reference data. +type ReferenceInputProperties struct { + InputProperties + // Describes an input data source that contains reference data. Required on PUT (CreateOrReplace) requests. + Datasource ReferenceInputDataSourceClassification `json:"datasource,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type ReferenceInputProperties. +func (r ReferenceInputProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + r.InputProperties.marshalInternal(objectMap, "Reference") + populate(objectMap, "datasource", r.Datasource) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ReferenceInputProperties. +func (r *ReferenceInputProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "datasource": + r.Datasource, err = unmarshalReferenceInputDataSourceClassification(val) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + if err := r.InputProperties.unmarshalInternal(rawMsg); err != nil { + return err + } + return nil +} + +// Resource - The base resource definition +type Resource struct { + // READ-ONLY; Fully qualified resource Id for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; The name of the resource + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; The type of the resource. Ex- Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type Resource. +func (r Resource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + r.marshalInternal(objectMap) + return json.Marshal(objectMap) +} + +func (r Resource) marshalInternal(objectMap map[string]interface{}) { + populate(objectMap, "id", r.ID) + populate(objectMap, "name", r.Name) + populate(objectMap, "type", r.Type) +} + +// ResourceTestStatus - Describes the status of the test operation along with error information, if applicable. +type ResourceTestStatus struct { + // READ-ONLY; Describes the error that occurred. + Error *ErrorResponse `json:"error,omitempty" azure:"ro"` + + // READ-ONLY; The status of the test operation. + Status *string `json:"status,omitempty" azure:"ro"` +} + +// SampleInput - The stream analytics input to sample. +type SampleInput struct { + // Defaults to the default ASA job compatibility level. Today it is 1.2 + CompatibilityLevel *string `json:"compatibilityLevel,omitempty"` + + // Defaults to en-US. + DataLocale *string `json:"dataLocale,omitempty"` + + // The SAS URI of the storage blob for service to write the sampled events to. If this parameter is not provided, service will write events to he system + // account and share a temporary SAS URI to it. + EventsURI *string `json:"eventsUri,omitempty"` + + // The stream analytics input to sample. + Input *Input `json:"input,omitempty"` +} + +// SampleInputResult - The result of the sample input request. +type SampleInputResult struct { + Error + // READ-ONLY; Diagnostics messages. E.g. message indicating some partitions from the input have no data. + Diagnostics []*string `json:"diagnostics,omitempty" azure:"ro"` + + // READ-ONLY; A SAS URL to download the sampled input data. + EventsDownloadURL *string `json:"eventsDownloadUrl,omitempty" azure:"ro"` + + // READ-ONLY; The timestamp for the last event in the data. It is in DateTime format. + LastArrivalTime *string `json:"lastArrivalTime,omitempty" azure:"ro"` + + // READ-ONLY; The status of the sample input request. + Status *SampleInputResultStatus `json:"status,omitempty" azure:"ro"` +} + +// ScalarFunctionProperties - The properties that are associated with a scalar function. +type ScalarFunctionProperties struct { + FunctionProperties +} + +// MarshalJSON implements the json.Marshaller interface for type ScalarFunctionProperties. +func (s ScalarFunctionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + s.FunctionProperties.marshalInternal(objectMap, "Scalar") + return json.Marshal(objectMap) +} + +// SerializationClassification provides polymorphic access to related types. +// Call the interface's GetSerialization() method to access the common type. +// Use a type switch to determine the concrete type. The possible types are: +// - *AvroSerialization, *CsvSerialization, *CustomClrSerialization, *JsonSerialization, *ParquetSerialization, *Serialization +type SerializationClassification interface { + // GetSerialization returns the Serialization content of the underlying type. + GetSerialization() *Serialization +} + +// Serialization - Describes how data from an input is serialized or how data is serialized when written to an output. +type Serialization struct { + // REQUIRED; Indicates the type of serialization that the input or output uses. Required on PUT (CreateOrReplace) requests. + Type *EventSerializationType `json:"type,omitempty"` +} + +// GetSerialization implements the SerializationClassification interface for type Serialization. +func (s *Serialization) GetSerialization() *Serialization { return s } + +// UnmarshalJSON implements the json.Unmarshaller interface for type Serialization. +func (s *Serialization) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + return s.unmarshalInternal(rawMsg) +} + +func (s Serialization) marshalInternal(objectMap map[string]interface{}, discValue EventSerializationType) { + s.Type = &discValue + objectMap["type"] = s.Type +} + +func (s *Serialization) unmarshalInternal(rawMsg map[string]json.RawMessage) error { + for key, val := range rawMsg { + var err error + switch key { + case "type": + err = unpopulate(val, &s.Type) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// ServiceBusDataSourceProperties - The common properties that are associated with Service Bus data sources (Queues, Topics, Event Hubs, etc.). +type ServiceBusDataSourceProperties struct { + // Authentication Mode. + AuthenticationMode *AuthenticationMode `json:"authenticationMode,omitempty"` + + // The namespace that is associated with the desired Event Hub, Service Bus Queue, Service Bus Topic, etc. Required on PUT (CreateOrReplace) requests. + ServiceBusNamespace *string `json:"serviceBusNamespace,omitempty"` + + // The shared access policy key for the specified shared access policy. Required on PUT (CreateOrReplace) requests. + SharedAccessPolicyKey *string `json:"sharedAccessPolicyKey,omitempty"` + + // The shared access policy name for the Event Hub, Service Bus Queue, Service Bus Topic, etc. Required on PUT (CreateOrReplace) requests. + SharedAccessPolicyName *string `json:"sharedAccessPolicyName,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type ServiceBusDataSourceProperties. +func (s ServiceBusDataSourceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + s.marshalInternal(objectMap) + return json.Marshal(objectMap) +} + +func (s ServiceBusDataSourceProperties) marshalInternal(objectMap map[string]interface{}) { + populate(objectMap, "authenticationMode", s.AuthenticationMode) + populate(objectMap, "serviceBusNamespace", s.ServiceBusNamespace) + populate(objectMap, "sharedAccessPolicyKey", s.SharedAccessPolicyKey) + populate(objectMap, "sharedAccessPolicyName", s.SharedAccessPolicyName) +} + +// ServiceBusQueueOutputDataSource - Describes a Service Bus Queue output data source. +type ServiceBusQueueOutputDataSource struct { + OutputDataSource + // The properties that are associated with a Service Bus Queue output. Required on PUT (CreateOrReplace) requests. + Properties *ServiceBusQueueOutputDataSourceProperties `json:"properties,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type ServiceBusQueueOutputDataSource. +func (s ServiceBusQueueOutputDataSource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + s.OutputDataSource.marshalInternal(objectMap, "Microsoft.ServiceBus/Queue") + populate(objectMap, "properties", s.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ServiceBusQueueOutputDataSource. +func (s *ServiceBusQueueOutputDataSource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, &s.Properties) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + if err := s.OutputDataSource.unmarshalInternal(rawMsg); err != nil { + return err + } + return nil +} + +// ServiceBusQueueOutputDataSourceProperties - The properties that are associated with a Service Bus Queue output. +type ServiceBusQueueOutputDataSourceProperties struct { + ServiceBusDataSourceProperties + // A string array of the names of output columns to be attached to Service Bus messages as custom properties. + PropertyColumns []*string `json:"propertyColumns,omitempty"` + + // The name of the Service Bus Queue. Required on PUT (CreateOrReplace) requests. + QueueName *string `json:"queueName,omitempty"` + + // Dictionary of + SystemPropertyColumns map[string]*string `json:"systemPropertyColumns,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type ServiceBusQueueOutputDataSourceProperties. +func (s ServiceBusQueueOutputDataSourceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + s.ServiceBusDataSourceProperties.marshalInternal(objectMap) + populate(objectMap, "propertyColumns", s.PropertyColumns) + populate(objectMap, "queueName", s.QueueName) + populate(objectMap, "systemPropertyColumns", s.SystemPropertyColumns) + return json.Marshal(objectMap) +} + +// ServiceBusTopicOutputDataSource - Describes a Service Bus Topic output data source. +type ServiceBusTopicOutputDataSource struct { + OutputDataSource + // The properties that are associated with a Service Bus Topic output. Required on PUT (CreateOrReplace) requests. + Properties *ServiceBusTopicOutputDataSourceProperties `json:"properties,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type ServiceBusTopicOutputDataSource. +func (s ServiceBusTopicOutputDataSource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + s.OutputDataSource.marshalInternal(objectMap, "Microsoft.ServiceBus/Topic") + populate(objectMap, "properties", s.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ServiceBusTopicOutputDataSource. +func (s *ServiceBusTopicOutputDataSource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, &s.Properties) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + if err := s.OutputDataSource.unmarshalInternal(rawMsg); err != nil { + return err + } + return nil +} + +// ServiceBusTopicOutputDataSourceProperties - The properties that are associated with a Service Bus Topic output. +type ServiceBusTopicOutputDataSourceProperties struct { + ServiceBusDataSourceProperties + // A string array of the names of output columns to be attached to Service Bus messages as custom properties. + PropertyColumns []*string `json:"propertyColumns,omitempty"` + + // Dictionary of + SystemPropertyColumns map[string]*string `json:"systemPropertyColumns,omitempty"` + + // The name of the Service Bus Topic. Required on PUT (CreateOrReplace) requests. + TopicName *string `json:"topicName,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type ServiceBusTopicOutputDataSourceProperties. +func (s ServiceBusTopicOutputDataSourceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + s.ServiceBusDataSourceProperties.marshalInternal(objectMap) + populate(objectMap, "propertyColumns", s.PropertyColumns) + populate(objectMap, "systemPropertyColumns", s.SystemPropertyColumns) + populate(objectMap, "topicName", s.TopicName) + return json.Marshal(objectMap) +} + +// StartStreamingJobParameters - Parameters supplied to the Start Streaming Job operation. +type StartStreamingJobParameters struct { + // Value may be JobStartTime, CustomTime, or LastOutputEventTime to indicate whether the starting point of the output event stream should start whenever + // the job is started, start at a custom user time + // stamp specified via the outputStartTime property, or start from the last event output time. + OutputStartMode *OutputStartMode `json:"outputStartMode,omitempty"` + + // Value is either an ISO-8601 formatted time stamp that indicates the starting point of the output event stream, or null to indicate that the output event + // stream will start whenever the streaming job is + // started. This property must have a value if outputStartMode is set to CustomTime. + OutputStartTime *time.Time `json:"outputStartTime,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type StartStreamingJobParameters. +func (s StartStreamingJobParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "outputStartMode", s.OutputStartMode) + populate(objectMap, "outputStartTime", (*timeRFC3339)(s.OutputStartTime)) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type StartStreamingJobParameters. +func (s *StartStreamingJobParameters) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "outputStartMode": + err = unpopulate(val, &s.OutputStartMode) + delete(rawMsg, key) + case "outputStartTime": + var aux timeRFC3339 + err = unpopulate(val, &aux) + s.OutputStartTime = (*time.Time)(&aux) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// StorageAccount - The properties that are associated with an Azure Storage account +type StorageAccount struct { + // The account key for the Azure Storage account. Required on PUT (CreateOrReplace) requests. + AccountKey *string `json:"accountKey,omitempty"` + + // The name of the Azure Storage account. Required on PUT (CreateOrReplace) requests. + AccountName *string `json:"accountName,omitempty"` +} + +// StreamInputDataSourceClassification provides polymorphic access to related types. +// Call the interface's GetStreamInputDataSource() method to access the common type. +// Use a type switch to determine the concrete type. The possible types are: +// - *BlobStreamInputDataSource, *EventHubStreamInputDataSource, *EventHubV2StreamInputDataSource, *IoTHubStreamInputDataSource, +// - *RawStreamInputDataSource, *StreamInputDataSource +type StreamInputDataSourceClassification interface { + // GetStreamInputDataSource returns the StreamInputDataSource content of the underlying type. + GetStreamInputDataSource() *StreamInputDataSource +} + +// StreamInputDataSource - Describes an input data source that contains stream data. +type StreamInputDataSource struct { + // REQUIRED; Indicates the type of input data source containing stream data. Required on PUT (CreateOrReplace) requests. + Type *string `json:"type,omitempty"` +} + +// GetStreamInputDataSource implements the StreamInputDataSourceClassification interface for type StreamInputDataSource. +func (s *StreamInputDataSource) GetStreamInputDataSource() *StreamInputDataSource { return s } + +// UnmarshalJSON implements the json.Unmarshaller interface for type StreamInputDataSource. +func (s *StreamInputDataSource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + return s.unmarshalInternal(rawMsg) +} + +func (s StreamInputDataSource) marshalInternal(objectMap map[string]interface{}, discValue string) { + s.Type = &discValue + objectMap["type"] = s.Type +} + +func (s *StreamInputDataSource) unmarshalInternal(rawMsg map[string]json.RawMessage) error { + for key, val := range rawMsg { + var err error + switch key { + case "type": + err = unpopulate(val, &s.Type) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// StreamInputProperties - The properties that are associated with an input containing stream data. +type StreamInputProperties struct { + InputProperties + // Describes an input data source that contains stream data. Required on PUT (CreateOrReplace) requests. + Datasource StreamInputDataSourceClassification `json:"datasource,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type StreamInputProperties. +func (s StreamInputProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + s.InputProperties.marshalInternal(objectMap, "Stream") + populate(objectMap, "datasource", s.Datasource) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type StreamInputProperties. +func (s *StreamInputProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "datasource": + s.Datasource, err = unmarshalStreamInputDataSourceClassification(val) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + if err := s.InputProperties.unmarshalInternal(rawMsg); err != nil { + return err + } + return nil +} + +// StreamingJob - A streaming job object, containing all information associated with the named streaming job. +type StreamingJob struct { + TrackedResource + // Describes the system-assigned managed identity assigned to this job that can be used to authenticate with inputs and outputs. + Identity *Identity `json:"identity,omitempty"` + + // The properties that are associated with a streaming job. Required on PUT (CreateOrReplace) requests. + Properties *StreamingJobProperties `json:"properties,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type StreamingJob. +func (s StreamingJob) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + s.TrackedResource.marshalInternal(objectMap) + populate(objectMap, "identity", s.Identity) + populate(objectMap, "properties", s.Properties) + return json.Marshal(objectMap) +} + +// StreamingJobListResult - Object containing a list of streaming jobs. +type StreamingJobListResult struct { + // READ-ONLY; The link (url) to the next page of results. + NextLink *string `json:"nextLink,omitempty" azure:"ro"` + + // READ-ONLY; A list of streaming jobs. Populated by a 'List' operation. + Value []*StreamingJob `json:"value,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type StreamingJobListResult. +func (s StreamingJobListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", s.NextLink) + populate(objectMap, "value", s.Value) + return json.Marshal(objectMap) +} + +// StreamingJobProperties - The properties that are associated with a streaming job. +type StreamingJobProperties struct { + // The cluster which streaming jobs will run on. + Cluster *ClusterInfo `json:"cluster,omitempty"` + + // Controls certain runtime behaviors of the streaming job. + CompatibilityLevel *CompatibilityLevel `json:"compatibilityLevel,omitempty"` + + // Valid values are JobStorageAccount and SystemAccount. If set to JobStorageAccount, this requires the user to also specify jobStorageAccount property. + // . + ContentStoragePolicy *ContentStoragePolicy `json:"contentStoragePolicy,omitempty"` + + // The data locale of the stream analytics job. Value should be the name of a supported .NET Culture from the set + // https://msdn.microsoft.com/en-us/library/system.globalization.culturetypes(v=vs.110).aspx. Defaults to 'en-US' if none specified. + DataLocale *string `json:"dataLocale,omitempty"` + + // The maximum tolerable delay in seconds where events arriving late could be included. Supported range is -1 to 1814399 (20.23:59:59 days) and -1 is used + // to specify wait indefinitely. If the property is + // absent, it is interpreted to have a value of -1. + EventsLateArrivalMaxDelayInSeconds *int32 `json:"eventsLateArrivalMaxDelayInSeconds,omitempty"` + + // The maximum tolerable delay in seconds where out-of-order events can be adjusted to be back in order. + EventsOutOfOrderMaxDelayInSeconds *int32 `json:"eventsOutOfOrderMaxDelayInSeconds,omitempty"` + + // Indicates the policy to apply to events that arrive out of order in the input event stream. + EventsOutOfOrderPolicy *EventsOutOfOrderPolicy `json:"eventsOutOfOrderPolicy,omitempty"` + + // The storage account where the custom code artifacts are located. + Externals *External `json:"externals,omitempty"` + + // A list of one or more functions for the streaming job. The name property for each function is required when specifying this property in a PUT request. + // This property cannot be modify via a PATCH + // operation. You must use the PATCH API available for the individual transformation. + Functions []*Function `json:"functions,omitempty"` + + // A list of one or more inputs to the streaming job. The name property for each input is required when specifying this property in a PUT request. This + // property cannot be modify via a PATCH operation. + // You must use the PATCH API available for the individual input. + Inputs []*Input `json:"inputs,omitempty"` + + // The properties that are associated with an Azure Storage account with MSI + JobStorageAccount *JobStorageAccount `json:"jobStorageAccount,omitempty"` + + // Describes the type of the job. Valid modes are Cloud and 'Edge'. + JobType *JobType `json:"jobType,omitempty"` + + // Indicates the policy to apply to events that arrive at the output and cannot be written to the external storage due to being malformed (missing column + // values, column values of wrong type or size). + OutputErrorPolicy *OutputErrorPolicy `json:"outputErrorPolicy,omitempty"` + + // This property should only be utilized when it is desired that the job be started immediately upon creation. Value may be JobStartTime, CustomTime, or + // LastOutputEventTime to indicate whether the + // starting point of the output event stream should start whenever the job is started, start at a custom user time stamp specified via the outputStartTime + // property, or start from the last event output + // time. + OutputStartMode *OutputStartMode `json:"outputStartMode,omitempty"` + + // Value is either an ISO-8601 formatted time stamp that indicates the starting point of the output event stream, or null to indicate that the output event + // stream will start whenever the streaming job is + // started. This property must have a value if outputStartMode is set to CustomTime. + OutputStartTime *time.Time `json:"outputStartTime,omitempty"` + + // A list of one or more outputs for the streaming job. The name property for each output is required when specifying this property in a PUT request. This + // property cannot be modify via a PATCH operation. + // You must use the PATCH API available for the individual output. + Outputs []*Output `json:"outputs,omitempty"` + + // Describes the SKU of the streaming job. Required on PUT (CreateOrReplace) requests. + SKU *StreamingJobSKU `json:"sku,omitempty"` + + // Indicates the query and the number of streaming units to use for the streaming job. The name property of the transformation is required when specifying + // this property in a PUT request. This property + // cannot be modify via a PATCH operation. You must use the PATCH API available for the individual transformation. + Transformation *Transformation `json:"transformation,omitempty"` + + // READ-ONLY; Value is an ISO-8601 formatted UTC timestamp indicating when the streaming job was created. + CreatedDate *time.Time `json:"createdDate,omitempty" azure:"ro"` + + // READ-ONLY; The current entity tag for the streaming job. This is an opaque string. You can use it to detect whether the resource has changed between + // requests. You can also use it in the If-Match or If-None-Match + // headers for write operations for optimistic concurrency. + Etag *string `json:"etag,omitempty" azure:"ro"` + + // READ-ONLY; A GUID uniquely identifying the streaming job. This GUID is generated upon creation of the streaming job. + JobID *string `json:"jobId,omitempty" azure:"ro"` + + // READ-ONLY; Describes the state of the streaming job. + JobState *string `json:"jobState,omitempty" azure:"ro"` + + // READ-ONLY; Value is either an ISO-8601 formatted timestamp indicating the last output event time of the streaming job or null indicating that output + // has not yet been produced. In case of multiple outputs or + // multiple streams, this shows the latest value in that set. + LastOutputEventTime *time.Time `json:"lastOutputEventTime,omitempty" azure:"ro"` + + // READ-ONLY; Describes the provisioning status of the streaming job. + ProvisioningState *string `json:"provisioningState,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type StreamingJobProperties. +func (s StreamingJobProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "cluster", s.Cluster) + populate(objectMap, "compatibilityLevel", s.CompatibilityLevel) + populate(objectMap, "contentStoragePolicy", s.ContentStoragePolicy) + populate(objectMap, "createdDate", (*timeRFC3339)(s.CreatedDate)) + populate(objectMap, "dataLocale", s.DataLocale) + populate(objectMap, "etag", s.Etag) + populate(objectMap, "eventsLateArrivalMaxDelayInSeconds", s.EventsLateArrivalMaxDelayInSeconds) + populate(objectMap, "eventsOutOfOrderMaxDelayInSeconds", s.EventsOutOfOrderMaxDelayInSeconds) + populate(objectMap, "eventsOutOfOrderPolicy", s.EventsOutOfOrderPolicy) + populate(objectMap, "externals", s.Externals) + populate(objectMap, "functions", s.Functions) + populate(objectMap, "inputs", s.Inputs) + populate(objectMap, "jobId", s.JobID) + populate(objectMap, "jobState", s.JobState) + populate(objectMap, "jobStorageAccount", s.JobStorageAccount) + populate(objectMap, "jobType", s.JobType) + populate(objectMap, "lastOutputEventTime", (*timeRFC3339)(s.LastOutputEventTime)) + populate(objectMap, "outputErrorPolicy", s.OutputErrorPolicy) + populate(objectMap, "outputStartMode", s.OutputStartMode) + populate(objectMap, "outputStartTime", (*timeRFC3339)(s.OutputStartTime)) + populate(objectMap, "outputs", s.Outputs) + populate(objectMap, "provisioningState", s.ProvisioningState) + populate(objectMap, "sku", s.SKU) + populate(objectMap, "transformation", s.Transformation) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type StreamingJobProperties. +func (s *StreamingJobProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "cluster": + err = unpopulate(val, &s.Cluster) + delete(rawMsg, key) + case "compatibilityLevel": + err = unpopulate(val, &s.CompatibilityLevel) + delete(rawMsg, key) + case "contentStoragePolicy": + err = unpopulate(val, &s.ContentStoragePolicy) + delete(rawMsg, key) + case "createdDate": + var aux timeRFC3339 + err = unpopulate(val, &aux) + s.CreatedDate = (*time.Time)(&aux) + delete(rawMsg, key) + case "dataLocale": + err = unpopulate(val, &s.DataLocale) + delete(rawMsg, key) + case "etag": + err = unpopulate(val, &s.Etag) + delete(rawMsg, key) + case "eventsLateArrivalMaxDelayInSeconds": + err = unpopulate(val, &s.EventsLateArrivalMaxDelayInSeconds) + delete(rawMsg, key) + case "eventsOutOfOrderMaxDelayInSeconds": + err = unpopulate(val, &s.EventsOutOfOrderMaxDelayInSeconds) + delete(rawMsg, key) + case "eventsOutOfOrderPolicy": + err = unpopulate(val, &s.EventsOutOfOrderPolicy) + delete(rawMsg, key) + case "externals": + err = unpopulate(val, &s.Externals) + delete(rawMsg, key) + case "functions": + err = unpopulate(val, &s.Functions) + delete(rawMsg, key) + case "inputs": + err = unpopulate(val, &s.Inputs) + delete(rawMsg, key) + case "jobId": + err = unpopulate(val, &s.JobID) + delete(rawMsg, key) + case "jobState": + err = unpopulate(val, &s.JobState) + delete(rawMsg, key) + case "jobStorageAccount": + err = unpopulate(val, &s.JobStorageAccount) + delete(rawMsg, key) + case "jobType": + err = unpopulate(val, &s.JobType) + delete(rawMsg, key) + case "lastOutputEventTime": + var aux timeRFC3339 + err = unpopulate(val, &aux) + s.LastOutputEventTime = (*time.Time)(&aux) + delete(rawMsg, key) + case "outputErrorPolicy": + err = unpopulate(val, &s.OutputErrorPolicy) + delete(rawMsg, key) + case "outputStartMode": + err = unpopulate(val, &s.OutputStartMode) + delete(rawMsg, key) + case "outputStartTime": + var aux timeRFC3339 + err = unpopulate(val, &aux) + s.OutputStartTime = (*time.Time)(&aux) + delete(rawMsg, key) + case "outputs": + err = unpopulate(val, &s.Outputs) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, &s.ProvisioningState) + delete(rawMsg, key) + case "sku": + err = unpopulate(val, &s.SKU) + delete(rawMsg, key) + case "transformation": + err = unpopulate(val, &s.Transformation) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// StreamingJobSKU - The properties that are associated with a SKU. +type StreamingJobSKU struct { + // The name of the SKU. Required on PUT (CreateOrReplace) requests. + Name *StreamingJobSKUName `json:"name,omitempty"` +} + +// StreamingJobsBeginCreateOrReplaceOptions contains the optional parameters for the StreamingJobs.BeginCreateOrReplace method. +type StreamingJobsBeginCreateOrReplaceOptions struct { + // 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 overwriting + // concurrent changes. + IfMatch *string + // 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. + IfNoneMatch *string +} + +// StreamingJobsBeginDeleteOptions contains the optional parameters for the StreamingJobs.BeginDelete method. +type StreamingJobsBeginDeleteOptions struct { + // placeholder for future optional parameters +} + +// StreamingJobsBeginStartOptions contains the optional parameters for the StreamingJobs.BeginStart method. +type StreamingJobsBeginStartOptions struct { + // Parameters applicable to a start streaming job operation. + StartJobParameters *StartStreamingJobParameters +} + +// StreamingJobsBeginStopOptions contains the optional parameters for the StreamingJobs.BeginStop method. +type StreamingJobsBeginStopOptions struct { + // placeholder for future optional parameters +} + +// StreamingJobsGetOptions contains the optional parameters for the StreamingJobs.Get method. +type StreamingJobsGetOptions struct { + // 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'. + Expand *string +} + +// StreamingJobsListByResourceGroupOptions contains the optional parameters for the StreamingJobs.ListByResourceGroup method. +type StreamingJobsListByResourceGroupOptions struct { + // 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'. + Expand *string +} + +// StreamingJobsListOptions contains the optional parameters for the StreamingJobs.List method. +type StreamingJobsListOptions struct { + // 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'. + Expand *string +} + +// StreamingJobsUpdateOptions contains the optional parameters for the StreamingJobs.Update method. +type StreamingJobsUpdateOptions struct { + // 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 overwriting + // concurrent changes. + IfMatch *string +} + +// SubResource - The base sub-resource model definition. +type SubResource struct { + // Resource name + Name *string `json:"name,omitempty"` + + // READ-ONLY; Resource Id + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; Resource type + Type *string `json:"type,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type SubResource. +func (s SubResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + s.marshalInternal(objectMap) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SubResource. +func (s *SubResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + return s.unmarshalInternal(rawMsg) +} + +func (s SubResource) marshalInternal(objectMap map[string]interface{}) { + populate(objectMap, "id", s.ID) + populate(objectMap, "name", s.Name) + populate(objectMap, "type", s.Type) +} + +func (s *SubResource) unmarshalInternal(rawMsg map[string]json.RawMessage) error { + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, &s.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, &s.Name) + delete(rawMsg, key) + case "type": + err = unpopulate(val, &s.Type) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// SubscriptionQuota - Describes the current quota for the subscription. +type SubscriptionQuota struct { + SubResource + // READ-ONLY; Describes the properties of the quota. + Properties *SubscriptionQuotaProperties `json:"properties,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type SubscriptionQuota. +func (s SubscriptionQuota) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + s.SubResource.marshalInternal(objectMap) + populate(objectMap, "properties", s.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SubscriptionQuota. +func (s *SubscriptionQuota) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, &s.Properties) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + if err := s.SubResource.unmarshalInternal(rawMsg); err != nil { + return err + } + return nil +} + +// SubscriptionQuotaProperties - Describes the properties of the quota. +type SubscriptionQuotaProperties struct { + // READ-ONLY; The current usage of this resource. + CurrentCount *int32 `json:"currentCount,omitempty" azure:"ro"` + + // READ-ONLY; The max permitted usage of this resource. + MaxCount *int32 `json:"maxCount,omitempty" azure:"ro"` +} + +// SubscriptionQuotasListResult - Result of the GetQuotas operation. It contains a list of quotas for the subscription in a particular region. +type SubscriptionQuotasListResult struct { + // READ-ONLY; List of quotas for the subscription in a particular region. + Value []*SubscriptionQuota `json:"value,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type SubscriptionQuotasListResult. +func (s SubscriptionQuotasListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "value", s.Value) + return json.Marshal(objectMap) +} + +// SubscriptionsBeginSampleInputOptions contains the optional parameters for the Subscriptions.BeginSampleInput method. +type SubscriptionsBeginSampleInputOptions struct { + // placeholder for future optional parameters +} + +// SubscriptionsBeginTestInputOptions contains the optional parameters for the Subscriptions.BeginTestInput method. +type SubscriptionsBeginTestInputOptions struct { + // placeholder for future optional parameters +} + +// SubscriptionsBeginTestOutputOptions contains the optional parameters for the Subscriptions.BeginTestOutput method. +type SubscriptionsBeginTestOutputOptions struct { + // placeholder for future optional parameters +} + +// SubscriptionsBeginTestQueryOptions contains the optional parameters for the Subscriptions.BeginTestQuery method. +type SubscriptionsBeginTestQueryOptions struct { + // placeholder for future optional parameters +} + +// SubscriptionsCompileQueryOptions contains the optional parameters for the Subscriptions.CompileQuery method. +type SubscriptionsCompileQueryOptions struct { + // placeholder for future optional parameters +} + +// SubscriptionsListQuotasOptions contains the optional parameters for the Subscriptions.ListQuotas method. +type SubscriptionsListQuotasOptions struct { + // placeholder for future optional parameters +} + +// TestDatasourceResult - The result of the test input or output request. +type TestDatasourceResult struct { + Error + // READ-ONLY; The status of the sample output request. + Status *TestDatasourceResultStatus `json:"status,omitempty" azure:"ro"` +} + +// TestInput - A stream analytics input. +type TestInput struct { + // REQUIRED; The stream analytics input to test. + Input *Input `json:"input,omitempty"` +} + +// TestOutput - A stream analytics output. +type TestOutput struct { + // REQUIRED; The stream analytics output to test. + Output *Output `json:"output,omitempty"` +} + +// TestQuery - The request object for query testing. +type TestQuery struct { + // REQUIRED; Stream analytics job object which defines the input, output, and transformation for the query testing. + StreamingJob *StreamingJob `json:"streamingJob,omitempty"` + + // Diagnostics information related to query testing. + Diagnostics *TestQueryDiagnostics `json:"diagnostics,omitempty"` +} + +// TestQueryDiagnostics - Diagnostics information related to query testing. +type TestQueryDiagnostics struct { + // REQUIRED; The SAS URI to the container or directory. + WriteURI *string `json:"writeUri,omitempty"` + + // The path to the subdirectory. + Path *string `json:"path,omitempty"` +} + +// TrackedResource - The resource model definition for a ARM tracked top level resource +type TrackedResource struct { + Resource + // The geo-location where the resource lives + Location *string `json:"location,omitempty"` + + // Resource tags. + Tags map[string]*string `json:"tags,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type TrackedResource. +func (t TrackedResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + t.marshalInternal(objectMap) + return json.Marshal(objectMap) +} + +func (t TrackedResource) marshalInternal(objectMap map[string]interface{}) { + t.Resource.marshalInternal(objectMap) + populate(objectMap, "location", t.Location) + populate(objectMap, "tags", t.Tags) +} + +// Transformation - A transformation object, containing all information associated with the named transformation. All transformations are contained under +// a streaming job. +type Transformation struct { + SubResource + // The properties that are associated with a transformation. Required on PUT (CreateOrReplace) requests. + Properties *TransformationProperties `json:"properties,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type Transformation. +func (t Transformation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + t.SubResource.marshalInternal(objectMap) + populate(objectMap, "properties", t.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Transformation. +func (t *Transformation) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, &t.Properties) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + if err := t.SubResource.unmarshalInternal(rawMsg); err != nil { + return err + } + return nil +} + +// TransformationProperties - The properties that are associated with a transformation. +type TransformationProperties struct { + // Specifies the query that will be run in the streaming job. You can learn more about the Stream Analytics Query Language (SAQL) here: https://msdn.microsoft.com/library/azure/dn834998 + // . Required on PUT + // (CreateOrReplace) requests. + Query *string `json:"query,omitempty"` + + // Specifies the number of streaming units that the streaming job uses. + StreamingUnits *int32 `json:"streamingUnits,omitempty"` + + // READ-ONLY; The current entity tag for the transformation. This is an opaque string. You can use it to detect whether the resource has changed between + // requests. You can also use it in the If-Match or + // If-None-Match headers for write operations for optimistic concurrency. + Etag *string `json:"etag,omitempty" azure:"ro"` +} + +// TransformationsCreateOrReplaceOptions contains the optional parameters for the Transformations.CreateOrReplace method. +type TransformationsCreateOrReplaceOptions struct { + // The ETag of the transformation. Omit this value to always overwrite the current transformation. Specify the last-seen ETag value to prevent accidentally + // overwriting concurrent changes. + IfMatch *string + // 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. + IfNoneMatch *string +} + +// TransformationsGetOptions contains the optional parameters for the Transformations.Get method. +type TransformationsGetOptions struct { + // placeholder for future optional parameters +} + +// TransformationsUpdateOptions contains the optional parameters for the Transformations.Update method. +type TransformationsUpdateOptions struct { + // The ETag of the transformation. Omit this value to always overwrite the current transformation. Specify the last-seen ETag value to prevent accidentally + // overwriting concurrent changes. + IfMatch *string +} + +func populate(m map[string]interface{}, k string, v interface{}) { + if v == nil { + return + } else if azcore.IsNullValue(v) { + m[k] = nil + } else if !reflect.ValueOf(v).IsNil() { + m[k] = v + } +} + +func unpopulate(data json.RawMessage, v interface{}) error { + if data == nil { + return nil + } + return json.Unmarshal(data, v) +} diff --git a/sdk/resourcemanager/streamanalytics/armstreamanalytics/zz_generated_operations_client.go b/sdk/resourcemanager/streamanalytics/armstreamanalytics/zz_generated_operations_client.go new file mode 100644 index 000000000000..e419e3ecc6ed --- /dev/null +++ b/sdk/resourcemanager/streamanalytics/armstreamanalytics/zz_generated_operations_client.go @@ -0,0 +1,81 @@ +//go:build go1.16 +// +build go1.16 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armstreamanalytics + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" +) + +// OperationsClient contains the methods for the Operations group. +// Don't use this type directly, use NewOperationsClient() instead. +type OperationsClient struct { + ep string + pl runtime.Pipeline +} + +// NewOperationsClient creates a new instance of OperationsClient with the specified values. +func NewOperationsClient(con *arm.Connection) *OperationsClient { + return &OperationsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version)} +} + +// List - Lists all of the available Stream Analytics related operations. +// If the operation fails it returns the *Error error type. +func (client *OperationsClient) List(options *OperationsListOptions) *OperationsListPager { + return &OperationsListPager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, options) + }, + advancer: func(ctx context.Context, resp OperationsListResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.OperationListResult.NextLink) + }, + } +} + +// listCreateRequest creates the List request. +func (client *OperationsClient) listCreateRequest(ctx context.Context, options *OperationsListOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.StreamAnalytics/operations" + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2017-04-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// listHandleResponse handles the List response. +func (client *OperationsClient) listHandleResponse(resp *http.Response) (OperationsListResponse, error) { + result := OperationsListResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.OperationListResult); err != nil { + return OperationsListResponse{}, err + } + return result, nil +} + +// listHandleError handles the List error response. +func (client *OperationsClient) listHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := Error{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} diff --git a/sdk/resourcemanager/streamanalytics/armstreamanalytics/zz_generated_outputs_client.go b/sdk/resourcemanager/streamanalytics/armstreamanalytics/zz_generated_outputs_client.go new file mode 100644 index 000000000000..61cc9e5d5b9c --- /dev/null +++ b/sdk/resourcemanager/streamanalytics/armstreamanalytics/zz_generated_outputs_client.go @@ -0,0 +1,470 @@ +//go:build go1.16 +// +build go1.16 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armstreamanalytics + +import ( + "context" + "errors" + "fmt" + "net/http" + "net/url" + "strings" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" +) + +// OutputsClient contains the methods for the Outputs group. +// Don't use this type directly, use NewOutputsClient() instead. +type OutputsClient struct { + ep string + pl runtime.Pipeline + subscriptionID string +} + +// NewOutputsClient creates a new instance of OutputsClient with the specified values. +func NewOutputsClient(con *arm.Connection, subscriptionID string) *OutputsClient { + return &OutputsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +} + +// CreateOrReplace - Creates an output or replaces an already existing output under an existing streaming job. +// If the operation fails it returns the *Error error type. +func (client *OutputsClient) CreateOrReplace(ctx context.Context, resourceGroupName string, jobName string, outputName string, output Output, options *OutputsCreateOrReplaceOptions) (OutputsCreateOrReplaceResponse, error) { + req, err := client.createOrReplaceCreateRequest(ctx, resourceGroupName, jobName, outputName, output, options) + if err != nil { + return OutputsCreateOrReplaceResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return OutputsCreateOrReplaceResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return OutputsCreateOrReplaceResponse{}, client.createOrReplaceHandleError(resp) + } + return client.createOrReplaceHandleResponse(resp) +} + +// createOrReplaceCreateRequest creates the CreateOrReplace request. +func (client *OutputsClient) createOrReplaceCreateRequest(ctx context.Context, resourceGroupName string, jobName string, outputName string, output Output, options *OutputsCreateOrReplaceOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/outputs/{outputName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if jobName == "" { + return nil, errors.New("parameter jobName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{jobName}", url.PathEscape(jobName)) + if outputName == "" { + return nil, errors.New("parameter outputName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{outputName}", url.PathEscape(outputName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2017-04-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + if options != nil && options.IfMatch != nil { + req.Raw().Header.Set("If-Match", *options.IfMatch) + } + if options != nil && options.IfNoneMatch != nil { + req.Raw().Header.Set("If-None-Match", *options.IfNoneMatch) + } + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, output) +} + +// createOrReplaceHandleResponse handles the CreateOrReplace response. +func (client *OutputsClient) createOrReplaceHandleResponse(resp *http.Response) (OutputsCreateOrReplaceResponse, error) { + result := OutputsCreateOrReplaceResponse{RawResponse: resp} + if val := resp.Header.Get("ETag"); val != "" { + result.ETag = &val + } + if err := runtime.UnmarshalAsJSON(resp, &result.Output); err != nil { + return OutputsCreateOrReplaceResponse{}, err + } + return result, nil +} + +// createOrReplaceHandleError handles the CreateOrReplace error response. +func (client *OutputsClient) createOrReplaceHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := Error{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// Delete - Deletes an output from the streaming job. +// If the operation fails it returns the *Error error type. +func (client *OutputsClient) Delete(ctx context.Context, resourceGroupName string, jobName string, outputName string, options *OutputsDeleteOptions) (OutputsDeleteResponse, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, jobName, outputName, options) + if err != nil { + return OutputsDeleteResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return OutputsDeleteResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { + return OutputsDeleteResponse{}, client.deleteHandleError(resp) + } + return OutputsDeleteResponse{RawResponse: resp}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *OutputsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, jobName string, outputName string, options *OutputsDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/outputs/{outputName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if jobName == "" { + return nil, errors.New("parameter jobName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{jobName}", url.PathEscape(jobName)) + if outputName == "" { + return nil, errors.New("parameter outputName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{outputName}", url.PathEscape(outputName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2017-04-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// deleteHandleError handles the Delete error response. +func (client *OutputsClient) deleteHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := Error{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// Get - Gets details about the specified output. +// If the operation fails it returns the *Error error type. +func (client *OutputsClient) Get(ctx context.Context, resourceGroupName string, jobName string, outputName string, options *OutputsGetOptions) (OutputsGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, jobName, outputName, options) + if err != nil { + return OutputsGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return OutputsGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return OutputsGetResponse{}, client.getHandleError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *OutputsClient) getCreateRequest(ctx context.Context, resourceGroupName string, jobName string, outputName string, options *OutputsGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/outputs/{outputName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if jobName == "" { + return nil, errors.New("parameter jobName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{jobName}", url.PathEscape(jobName)) + if outputName == "" { + return nil, errors.New("parameter outputName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{outputName}", url.PathEscape(outputName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2017-04-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *OutputsClient) getHandleResponse(resp *http.Response) (OutputsGetResponse, error) { + result := OutputsGetResponse{RawResponse: resp} + if val := resp.Header.Get("ETag"); val != "" { + result.ETag = &val + } + if err := runtime.UnmarshalAsJSON(resp, &result.Output); err != nil { + return OutputsGetResponse{}, err + } + return result, nil +} + +// getHandleError handles the Get error response. +func (client *OutputsClient) getHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := Error{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// ListByStreamingJob - Lists all of the outputs under the specified streaming job. +// If the operation fails it returns the *Error error type. +func (client *OutputsClient) ListByStreamingJob(resourceGroupName string, jobName string, options *OutputsListByStreamingJobOptions) *OutputsListByStreamingJobPager { + return &OutputsListByStreamingJobPager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { + return client.listByStreamingJobCreateRequest(ctx, resourceGroupName, jobName, options) + }, + advancer: func(ctx context.Context, resp OutputsListByStreamingJobResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.OutputListResult.NextLink) + }, + } +} + +// listByStreamingJobCreateRequest creates the ListByStreamingJob request. +func (client *OutputsClient) listByStreamingJobCreateRequest(ctx context.Context, resourceGroupName string, jobName string, options *OutputsListByStreamingJobOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/outputs" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if jobName == "" { + return nil, errors.New("parameter jobName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{jobName}", url.PathEscape(jobName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + if options != nil && options.Select != nil { + reqQP.Set("$select", *options.Select) + } + reqQP.Set("api-version", "2017-04-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// listByStreamingJobHandleResponse handles the ListByStreamingJob response. +func (client *OutputsClient) listByStreamingJobHandleResponse(resp *http.Response) (OutputsListByStreamingJobResponse, error) { + result := OutputsListByStreamingJobResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.OutputListResult); err != nil { + return OutputsListByStreamingJobResponse{}, err + } + return result, nil +} + +// listByStreamingJobHandleError handles the ListByStreamingJob error response. +func (client *OutputsClient) listByStreamingJobHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := Error{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// BeginTest - Tests whether an output’s datasource is reachable and usable by the Azure Stream Analytics service. +// If the operation fails it returns the *Error error type. +func (client *OutputsClient) BeginTest(ctx context.Context, resourceGroupName string, jobName string, outputName string, options *OutputsBeginTestOptions) (OutputsTestPollerResponse, error) { + resp, err := client.test(ctx, resourceGroupName, jobName, outputName, options) + if err != nil { + return OutputsTestPollerResponse{}, err + } + result := OutputsTestPollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("OutputsClient.Test", "", resp, client.pl, client.testHandleError) + if err != nil { + return OutputsTestPollerResponse{}, err + } + result.Poller = &OutputsTestPoller{ + pt: pt, + } + return result, nil +} + +// Test - Tests whether an output’s datasource is reachable and usable by the Azure Stream Analytics service. +// If the operation fails it returns the *Error error type. +func (client *OutputsClient) test(ctx context.Context, resourceGroupName string, jobName string, outputName string, options *OutputsBeginTestOptions) (*http.Response, error) { + req, err := client.testCreateRequest(ctx, resourceGroupName, jobName, outputName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, client.testHandleError(resp) + } + return resp, nil +} + +// testCreateRequest creates the Test request. +func (client *OutputsClient) testCreateRequest(ctx context.Context, resourceGroupName string, jobName string, outputName string, options *OutputsBeginTestOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/outputs/{outputName}/test" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if jobName == "" { + return nil, errors.New("parameter jobName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{jobName}", url.PathEscape(jobName)) + if outputName == "" { + return nil, errors.New("parameter outputName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{outputName}", url.PathEscape(outputName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2017-04-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + if options != nil && options.Output != nil { + return req, runtime.MarshalAsJSON(req, *options.Output) + } + return req, nil +} + +// testHandleError handles the Test error response. +func (client *OutputsClient) testHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := Error{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// 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. +// If the operation fails it returns the *Error error type. +func (client *OutputsClient) Update(ctx context.Context, resourceGroupName string, jobName string, outputName string, output Output, options *OutputsUpdateOptions) (OutputsUpdateResponse, error) { + req, err := client.updateCreateRequest(ctx, resourceGroupName, jobName, outputName, output, options) + if err != nil { + return OutputsUpdateResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return OutputsUpdateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return OutputsUpdateResponse{}, client.updateHandleError(resp) + } + return client.updateHandleResponse(resp) +} + +// updateCreateRequest creates the Update request. +func (client *OutputsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, jobName string, outputName string, output Output, options *OutputsUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/outputs/{outputName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if jobName == "" { + return nil, errors.New("parameter jobName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{jobName}", url.PathEscape(jobName)) + if outputName == "" { + return nil, errors.New("parameter outputName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{outputName}", url.PathEscape(outputName)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2017-04-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + if options != nil && options.IfMatch != nil { + req.Raw().Header.Set("If-Match", *options.IfMatch) + } + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, output) +} + +// updateHandleResponse handles the Update response. +func (client *OutputsClient) updateHandleResponse(resp *http.Response) (OutputsUpdateResponse, error) { + result := OutputsUpdateResponse{RawResponse: resp} + if val := resp.Header.Get("ETag"); val != "" { + result.ETag = &val + } + if err := runtime.UnmarshalAsJSON(resp, &result.Output); err != nil { + return OutputsUpdateResponse{}, err + } + return result, nil +} + +// updateHandleError handles the Update error response. +func (client *OutputsClient) updateHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := Error{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} diff --git a/sdk/resourcemanager/streamanalytics/armstreamanalytics/zz_generated_pagers.go b/sdk/resourcemanager/streamanalytics/armstreamanalytics/zz_generated_pagers.go new file mode 100644 index 000000000000..6e68ffdd1798 --- /dev/null +++ b/sdk/resourcemanager/streamanalytics/armstreamanalytics/zz_generated_pagers.go @@ -0,0 +1,558 @@ +//go:build go1.16 +// +build go1.16 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armstreamanalytics + +import ( + "context" + "net/http" + "reflect" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" +) + +// ClustersListByResourceGroupPager provides operations for iterating over paged responses. +type ClustersListByResourceGroupPager struct { + client *ClustersClient + current ClustersListByResourceGroupResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, ClustersListByResourceGroupResponse) (*policy.Request, error) +} + +// Err returns the last error encountered while paging. +func (p *ClustersListByResourceGroupPager) Err() error { + return p.err +} + +// NextPage returns true if the pager advanced to the next page. +// Returns false if there are no more pages or an error occurred. +func (p *ClustersListByResourceGroupPager) NextPage(ctx context.Context) bool { + var req *policy.Request + var err error + if !reflect.ValueOf(p.current).IsZero() { + if p.current.ClusterListResult.NextLink == nil || len(*p.current.ClusterListResult.NextLink) == 0 { + return false + } + req, err = p.advancer(ctx, p.current) + } else { + req, err = p.requester(ctx) + } + if err != nil { + p.err = err + return false + } + resp, err := p.client.pl.Do(req) + if err != nil { + p.err = err + return false + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + p.err = p.client.listByResourceGroupHandleError(resp) + return false + } + result, err := p.client.listByResourceGroupHandleResponse(resp) + if err != nil { + p.err = err + return false + } + p.current = result + return true +} + +// PageResponse returns the current ClustersListByResourceGroupResponse page. +func (p *ClustersListByResourceGroupPager) PageResponse() ClustersListByResourceGroupResponse { + return p.current +} + +// ClustersListBySubscriptionPager provides operations for iterating over paged responses. +type ClustersListBySubscriptionPager struct { + client *ClustersClient + current ClustersListBySubscriptionResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, ClustersListBySubscriptionResponse) (*policy.Request, error) +} + +// Err returns the last error encountered while paging. +func (p *ClustersListBySubscriptionPager) Err() error { + return p.err +} + +// NextPage returns true if the pager advanced to the next page. +// Returns false if there are no more pages or an error occurred. +func (p *ClustersListBySubscriptionPager) NextPage(ctx context.Context) bool { + var req *policy.Request + var err error + if !reflect.ValueOf(p.current).IsZero() { + if p.current.ClusterListResult.NextLink == nil || len(*p.current.ClusterListResult.NextLink) == 0 { + return false + } + req, err = p.advancer(ctx, p.current) + } else { + req, err = p.requester(ctx) + } + if err != nil { + p.err = err + return false + } + resp, err := p.client.pl.Do(req) + if err != nil { + p.err = err + return false + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + p.err = p.client.listBySubscriptionHandleError(resp) + return false + } + result, err := p.client.listBySubscriptionHandleResponse(resp) + if err != nil { + p.err = err + return false + } + p.current = result + return true +} + +// PageResponse returns the current ClustersListBySubscriptionResponse page. +func (p *ClustersListBySubscriptionPager) PageResponse() ClustersListBySubscriptionResponse { + return p.current +} + +// ClustersListStreamingJobsPager provides operations for iterating over paged responses. +type ClustersListStreamingJobsPager struct { + client *ClustersClient + current ClustersListStreamingJobsResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, ClustersListStreamingJobsResponse) (*policy.Request, error) +} + +// Err returns the last error encountered while paging. +func (p *ClustersListStreamingJobsPager) Err() error { + return p.err +} + +// NextPage returns true if the pager advanced to the next page. +// Returns false if there are no more pages or an error occurred. +func (p *ClustersListStreamingJobsPager) NextPage(ctx context.Context) bool { + var req *policy.Request + var err error + if !reflect.ValueOf(p.current).IsZero() { + if p.current.ClusterJobListResult.NextLink == nil || len(*p.current.ClusterJobListResult.NextLink) == 0 { + return false + } + req, err = p.advancer(ctx, p.current) + } else { + req, err = p.requester(ctx) + } + if err != nil { + p.err = err + return false + } + resp, err := p.client.pl.Do(req) + if err != nil { + p.err = err + return false + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + p.err = p.client.listStreamingJobsHandleError(resp) + return false + } + result, err := p.client.listStreamingJobsHandleResponse(resp) + if err != nil { + p.err = err + return false + } + p.current = result + return true +} + +// PageResponse returns the current ClustersListStreamingJobsResponse page. +func (p *ClustersListStreamingJobsPager) PageResponse() ClustersListStreamingJobsResponse { + return p.current +} + +// FunctionsListByStreamingJobPager provides operations for iterating over paged responses. +type FunctionsListByStreamingJobPager struct { + client *FunctionsClient + current FunctionsListByStreamingJobResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, FunctionsListByStreamingJobResponse) (*policy.Request, error) +} + +// Err returns the last error encountered while paging. +func (p *FunctionsListByStreamingJobPager) Err() error { + return p.err +} + +// NextPage returns true if the pager advanced to the next page. +// Returns false if there are no more pages or an error occurred. +func (p *FunctionsListByStreamingJobPager) NextPage(ctx context.Context) bool { + var req *policy.Request + var err error + if !reflect.ValueOf(p.current).IsZero() { + if p.current.FunctionListResult.NextLink == nil || len(*p.current.FunctionListResult.NextLink) == 0 { + return false + } + req, err = p.advancer(ctx, p.current) + } else { + req, err = p.requester(ctx) + } + if err != nil { + p.err = err + return false + } + resp, err := p.client.pl.Do(req) + if err != nil { + p.err = err + return false + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + p.err = p.client.listByStreamingJobHandleError(resp) + return false + } + result, err := p.client.listByStreamingJobHandleResponse(resp) + if err != nil { + p.err = err + return false + } + p.current = result + return true +} + +// PageResponse returns the current FunctionsListByStreamingJobResponse page. +func (p *FunctionsListByStreamingJobPager) PageResponse() FunctionsListByStreamingJobResponse { + return p.current +} + +// InputsListByStreamingJobPager provides operations for iterating over paged responses. +type InputsListByStreamingJobPager struct { + client *InputsClient + current InputsListByStreamingJobResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, InputsListByStreamingJobResponse) (*policy.Request, error) +} + +// Err returns the last error encountered while paging. +func (p *InputsListByStreamingJobPager) Err() error { + return p.err +} + +// NextPage returns true if the pager advanced to the next page. +// Returns false if there are no more pages or an error occurred. +func (p *InputsListByStreamingJobPager) NextPage(ctx context.Context) bool { + var req *policy.Request + var err error + if !reflect.ValueOf(p.current).IsZero() { + if p.current.InputListResult.NextLink == nil || len(*p.current.InputListResult.NextLink) == 0 { + return false + } + req, err = p.advancer(ctx, p.current) + } else { + req, err = p.requester(ctx) + } + if err != nil { + p.err = err + return false + } + resp, err := p.client.pl.Do(req) + if err != nil { + p.err = err + return false + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + p.err = p.client.listByStreamingJobHandleError(resp) + return false + } + result, err := p.client.listByStreamingJobHandleResponse(resp) + if err != nil { + p.err = err + return false + } + p.current = result + return true +} + +// PageResponse returns the current InputsListByStreamingJobResponse page. +func (p *InputsListByStreamingJobPager) PageResponse() InputsListByStreamingJobResponse { + return p.current +} + +// OperationsListPager provides operations for iterating over paged responses. +type OperationsListPager struct { + client *OperationsClient + current OperationsListResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, OperationsListResponse) (*policy.Request, error) +} + +// Err returns the last error encountered while paging. +func (p *OperationsListPager) Err() error { + return p.err +} + +// NextPage returns true if the pager advanced to the next page. +// Returns false if there are no more pages or an error occurred. +func (p *OperationsListPager) NextPage(ctx context.Context) bool { + var req *policy.Request + var err error + if !reflect.ValueOf(p.current).IsZero() { + if p.current.OperationListResult.NextLink == nil || len(*p.current.OperationListResult.NextLink) == 0 { + return false + } + req, err = p.advancer(ctx, p.current) + } else { + req, err = p.requester(ctx) + } + if err != nil { + p.err = err + return false + } + resp, err := p.client.pl.Do(req) + if err != nil { + p.err = err + return false + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + p.err = p.client.listHandleError(resp) + return false + } + result, err := p.client.listHandleResponse(resp) + if err != nil { + p.err = err + return false + } + p.current = result + return true +} + +// PageResponse returns the current OperationsListResponse page. +func (p *OperationsListPager) PageResponse() OperationsListResponse { + return p.current +} + +// OutputsListByStreamingJobPager provides operations for iterating over paged responses. +type OutputsListByStreamingJobPager struct { + client *OutputsClient + current OutputsListByStreamingJobResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, OutputsListByStreamingJobResponse) (*policy.Request, error) +} + +// Err returns the last error encountered while paging. +func (p *OutputsListByStreamingJobPager) Err() error { + return p.err +} + +// NextPage returns true if the pager advanced to the next page. +// Returns false if there are no more pages or an error occurred. +func (p *OutputsListByStreamingJobPager) NextPage(ctx context.Context) bool { + var req *policy.Request + var err error + if !reflect.ValueOf(p.current).IsZero() { + if p.current.OutputListResult.NextLink == nil || len(*p.current.OutputListResult.NextLink) == 0 { + return false + } + req, err = p.advancer(ctx, p.current) + } else { + req, err = p.requester(ctx) + } + if err != nil { + p.err = err + return false + } + resp, err := p.client.pl.Do(req) + if err != nil { + p.err = err + return false + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + p.err = p.client.listByStreamingJobHandleError(resp) + return false + } + result, err := p.client.listByStreamingJobHandleResponse(resp) + if err != nil { + p.err = err + return false + } + p.current = result + return true +} + +// PageResponse returns the current OutputsListByStreamingJobResponse page. +func (p *OutputsListByStreamingJobPager) PageResponse() OutputsListByStreamingJobResponse { + return p.current +} + +// PrivateEndpointsListByClusterPager provides operations for iterating over paged responses. +type PrivateEndpointsListByClusterPager struct { + client *PrivateEndpointsClient + current PrivateEndpointsListByClusterResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, PrivateEndpointsListByClusterResponse) (*policy.Request, error) +} + +// Err returns the last error encountered while paging. +func (p *PrivateEndpointsListByClusterPager) Err() error { + return p.err +} + +// NextPage returns true if the pager advanced to the next page. +// Returns false if there are no more pages or an error occurred. +func (p *PrivateEndpointsListByClusterPager) NextPage(ctx context.Context) bool { + var req *policy.Request + var err error + if !reflect.ValueOf(p.current).IsZero() { + if p.current.PrivateEndpointListResult.NextLink == nil || len(*p.current.PrivateEndpointListResult.NextLink) == 0 { + return false + } + req, err = p.advancer(ctx, p.current) + } else { + req, err = p.requester(ctx) + } + if err != nil { + p.err = err + return false + } + resp, err := p.client.pl.Do(req) + if err != nil { + p.err = err + return false + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + p.err = p.client.listByClusterHandleError(resp) + return false + } + result, err := p.client.listByClusterHandleResponse(resp) + if err != nil { + p.err = err + return false + } + p.current = result + return true +} + +// PageResponse returns the current PrivateEndpointsListByClusterResponse page. +func (p *PrivateEndpointsListByClusterPager) PageResponse() PrivateEndpointsListByClusterResponse { + return p.current +} + +// StreamingJobsListByResourceGroupPager provides operations for iterating over paged responses. +type StreamingJobsListByResourceGroupPager struct { + client *StreamingJobsClient + current StreamingJobsListByResourceGroupResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, StreamingJobsListByResourceGroupResponse) (*policy.Request, error) +} + +// Err returns the last error encountered while paging. +func (p *StreamingJobsListByResourceGroupPager) Err() error { + return p.err +} + +// NextPage returns true if the pager advanced to the next page. +// Returns false if there are no more pages or an error occurred. +func (p *StreamingJobsListByResourceGroupPager) NextPage(ctx context.Context) bool { + var req *policy.Request + var err error + if !reflect.ValueOf(p.current).IsZero() { + if p.current.StreamingJobListResult.NextLink == nil || len(*p.current.StreamingJobListResult.NextLink) == 0 { + return false + } + req, err = p.advancer(ctx, p.current) + } else { + req, err = p.requester(ctx) + } + if err != nil { + p.err = err + return false + } + resp, err := p.client.pl.Do(req) + if err != nil { + p.err = err + return false + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + p.err = p.client.listByResourceGroupHandleError(resp) + return false + } + result, err := p.client.listByResourceGroupHandleResponse(resp) + if err != nil { + p.err = err + return false + } + p.current = result + return true +} + +// PageResponse returns the current StreamingJobsListByResourceGroupResponse page. +func (p *StreamingJobsListByResourceGroupPager) PageResponse() StreamingJobsListByResourceGroupResponse { + return p.current +} + +// StreamingJobsListPager provides operations for iterating over paged responses. +type StreamingJobsListPager struct { + client *StreamingJobsClient + current StreamingJobsListResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, StreamingJobsListResponse) (*policy.Request, error) +} + +// Err returns the last error encountered while paging. +func (p *StreamingJobsListPager) Err() error { + return p.err +} + +// NextPage returns true if the pager advanced to the next page. +// Returns false if there are no more pages or an error occurred. +func (p *StreamingJobsListPager) NextPage(ctx context.Context) bool { + var req *policy.Request + var err error + if !reflect.ValueOf(p.current).IsZero() { + if p.current.StreamingJobListResult.NextLink == nil || len(*p.current.StreamingJobListResult.NextLink) == 0 { + return false + } + req, err = p.advancer(ctx, p.current) + } else { + req, err = p.requester(ctx) + } + if err != nil { + p.err = err + return false + } + resp, err := p.client.pl.Do(req) + if err != nil { + p.err = err + return false + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + p.err = p.client.listHandleError(resp) + return false + } + result, err := p.client.listHandleResponse(resp) + if err != nil { + p.err = err + return false + } + p.current = result + return true +} + +// PageResponse returns the current StreamingJobsListResponse page. +func (p *StreamingJobsListPager) PageResponse() StreamingJobsListResponse { + return p.current +} diff --git a/sdk/resourcemanager/streamanalytics/armstreamanalytics/zz_generated_pollers.go b/sdk/resourcemanager/streamanalytics/armstreamanalytics/zz_generated_pollers.go new file mode 100644 index 000000000000..30c123173af9 --- /dev/null +++ b/sdk/resourcemanager/streamanalytics/armstreamanalytics/zz_generated_pollers.go @@ -0,0 +1,661 @@ +//go:build go1.16 +// +build go1.16 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armstreamanalytics + +import ( + "context" + "net/http" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore" +) + +// ClustersCreateOrUpdatePoller provides polling facilities until the operation reaches a terminal state. +type ClustersCreateOrUpdatePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *ClustersCreateOrUpdatePoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *ClustersCreateOrUpdatePoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final ClustersCreateOrUpdateResponse will be returned. +func (p *ClustersCreateOrUpdatePoller) FinalResponse(ctx context.Context) (ClustersCreateOrUpdateResponse, error) { + respType := ClustersCreateOrUpdateResponse{} + resp, err := p.pt.FinalResponse(ctx, &respType.Cluster) + if err != nil { + return ClustersCreateOrUpdateResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *ClustersCreateOrUpdatePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// ClustersDeletePoller provides polling facilities until the operation reaches a terminal state. +type ClustersDeletePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *ClustersDeletePoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *ClustersDeletePoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final ClustersDeleteResponse will be returned. +func (p *ClustersDeletePoller) FinalResponse(ctx context.Context) (ClustersDeleteResponse, error) { + respType := ClustersDeleteResponse{} + resp, err := p.pt.FinalResponse(ctx, nil) + if err != nil { + return ClustersDeleteResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *ClustersDeletePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// ClustersUpdatePoller provides polling facilities until the operation reaches a terminal state. +type ClustersUpdatePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *ClustersUpdatePoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *ClustersUpdatePoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final ClustersUpdateResponse will be returned. +func (p *ClustersUpdatePoller) FinalResponse(ctx context.Context) (ClustersUpdateResponse, error) { + respType := ClustersUpdateResponse{} + resp, err := p.pt.FinalResponse(ctx, &respType.Cluster) + if err != nil { + return ClustersUpdateResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *ClustersUpdatePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// FunctionsTestPoller provides polling facilities until the operation reaches a terminal state. +type FunctionsTestPoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *FunctionsTestPoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *FunctionsTestPoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final FunctionsTestResponse will be returned. +func (p *FunctionsTestPoller) FinalResponse(ctx context.Context) (FunctionsTestResponse, error) { + respType := FunctionsTestResponse{} + resp, err := p.pt.FinalResponse(ctx, &respType.ResourceTestStatus) + if err != nil { + return FunctionsTestResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *FunctionsTestPoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// InputsTestPoller provides polling facilities until the operation reaches a terminal state. +type InputsTestPoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *InputsTestPoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *InputsTestPoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final InputsTestResponse will be returned. +func (p *InputsTestPoller) FinalResponse(ctx context.Context) (InputsTestResponse, error) { + respType := InputsTestResponse{} + resp, err := p.pt.FinalResponse(ctx, &respType.ResourceTestStatus) + if err != nil { + return InputsTestResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *InputsTestPoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// OutputsTestPoller provides polling facilities until the operation reaches a terminal state. +type OutputsTestPoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *OutputsTestPoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *OutputsTestPoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final OutputsTestResponse will be returned. +func (p *OutputsTestPoller) FinalResponse(ctx context.Context) (OutputsTestResponse, error) { + respType := OutputsTestResponse{} + resp, err := p.pt.FinalResponse(ctx, &respType.ResourceTestStatus) + if err != nil { + return OutputsTestResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *OutputsTestPoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// PrivateEndpointsDeletePoller provides polling facilities until the operation reaches a terminal state. +type PrivateEndpointsDeletePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *PrivateEndpointsDeletePoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *PrivateEndpointsDeletePoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final PrivateEndpointsDeleteResponse will be returned. +func (p *PrivateEndpointsDeletePoller) FinalResponse(ctx context.Context) (PrivateEndpointsDeleteResponse, error) { + respType := PrivateEndpointsDeleteResponse{} + resp, err := p.pt.FinalResponse(ctx, nil) + if err != nil { + return PrivateEndpointsDeleteResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *PrivateEndpointsDeletePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// StreamingJobsCreateOrReplacePoller provides polling facilities until the operation reaches a terminal state. +type StreamingJobsCreateOrReplacePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *StreamingJobsCreateOrReplacePoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *StreamingJobsCreateOrReplacePoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final StreamingJobsCreateOrReplaceResponse will be returned. +func (p *StreamingJobsCreateOrReplacePoller) FinalResponse(ctx context.Context) (StreamingJobsCreateOrReplaceResponse, error) { + respType := StreamingJobsCreateOrReplaceResponse{} + resp, err := p.pt.FinalResponse(ctx, &respType.StreamingJob) + if err != nil { + return StreamingJobsCreateOrReplaceResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *StreamingJobsCreateOrReplacePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// StreamingJobsDeletePoller provides polling facilities until the operation reaches a terminal state. +type StreamingJobsDeletePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *StreamingJobsDeletePoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *StreamingJobsDeletePoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final StreamingJobsDeleteResponse will be returned. +func (p *StreamingJobsDeletePoller) FinalResponse(ctx context.Context) (StreamingJobsDeleteResponse, error) { + respType := StreamingJobsDeleteResponse{} + resp, err := p.pt.FinalResponse(ctx, nil) + if err != nil { + return StreamingJobsDeleteResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *StreamingJobsDeletePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// StreamingJobsStartPoller provides polling facilities until the operation reaches a terminal state. +type StreamingJobsStartPoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *StreamingJobsStartPoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *StreamingJobsStartPoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final StreamingJobsStartResponse will be returned. +func (p *StreamingJobsStartPoller) FinalResponse(ctx context.Context) (StreamingJobsStartResponse, error) { + respType := StreamingJobsStartResponse{} + resp, err := p.pt.FinalResponse(ctx, nil) + if err != nil { + return StreamingJobsStartResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *StreamingJobsStartPoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// StreamingJobsStopPoller provides polling facilities until the operation reaches a terminal state. +type StreamingJobsStopPoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *StreamingJobsStopPoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *StreamingJobsStopPoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final StreamingJobsStopResponse will be returned. +func (p *StreamingJobsStopPoller) FinalResponse(ctx context.Context) (StreamingJobsStopResponse, error) { + respType := StreamingJobsStopResponse{} + resp, err := p.pt.FinalResponse(ctx, nil) + if err != nil { + return StreamingJobsStopResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *StreamingJobsStopPoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// SubscriptionsSampleInputPoller provides polling facilities until the operation reaches a terminal state. +type SubscriptionsSampleInputPoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *SubscriptionsSampleInputPoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *SubscriptionsSampleInputPoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final SubscriptionsSampleInputResponse will be returned. +func (p *SubscriptionsSampleInputPoller) FinalResponse(ctx context.Context) (SubscriptionsSampleInputResponse, error) { + respType := SubscriptionsSampleInputResponse{} + resp, err := p.pt.FinalResponse(ctx, &respType.SampleInputResult) + if err != nil { + return SubscriptionsSampleInputResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *SubscriptionsSampleInputPoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// SubscriptionsTestInputPoller provides polling facilities until the operation reaches a terminal state. +type SubscriptionsTestInputPoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *SubscriptionsTestInputPoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *SubscriptionsTestInputPoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final SubscriptionsTestInputResponse will be returned. +func (p *SubscriptionsTestInputPoller) FinalResponse(ctx context.Context) (SubscriptionsTestInputResponse, error) { + respType := SubscriptionsTestInputResponse{} + resp, err := p.pt.FinalResponse(ctx, &respType.TestDatasourceResult) + if err != nil { + return SubscriptionsTestInputResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *SubscriptionsTestInputPoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// SubscriptionsTestOutputPoller provides polling facilities until the operation reaches a terminal state. +type SubscriptionsTestOutputPoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *SubscriptionsTestOutputPoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *SubscriptionsTestOutputPoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final SubscriptionsTestOutputResponse will be returned. +func (p *SubscriptionsTestOutputPoller) FinalResponse(ctx context.Context) (SubscriptionsTestOutputResponse, error) { + respType := SubscriptionsTestOutputResponse{} + resp, err := p.pt.FinalResponse(ctx, &respType.TestDatasourceResult) + if err != nil { + return SubscriptionsTestOutputResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *SubscriptionsTestOutputPoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// SubscriptionsTestQueryPoller provides polling facilities until the operation reaches a terminal state. +type SubscriptionsTestQueryPoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *SubscriptionsTestQueryPoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *SubscriptionsTestQueryPoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final SubscriptionsTestQueryResponse will be returned. +func (p *SubscriptionsTestQueryPoller) FinalResponse(ctx context.Context) (SubscriptionsTestQueryResponse, error) { + respType := SubscriptionsTestQueryResponse{} + resp, err := p.pt.FinalResponse(ctx, &respType.QueryTestingResult) + if err != nil { + return SubscriptionsTestQueryResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *SubscriptionsTestQueryPoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} diff --git a/sdk/resourcemanager/streamanalytics/armstreamanalytics/zz_generated_polymorphic_helpers.go b/sdk/resourcemanager/streamanalytics/armstreamanalytics/zz_generated_polymorphic_helpers.go new file mode 100644 index 000000000000..639ea4cce8dc --- /dev/null +++ b/sdk/resourcemanager/streamanalytics/armstreamanalytics/zz_generated_polymorphic_helpers.go @@ -0,0 +1,367 @@ +//go:build go1.16 +// +build go1.16 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armstreamanalytics + +import "encoding/json" + +func unmarshalFunctionBindingClassification(rawMsg json.RawMessage) (FunctionBindingClassification, error) { + if rawMsg == nil { + return nil, nil + } + var m map[string]interface{} + if err := json.Unmarshal(rawMsg, &m); err != nil { + return nil, err + } + var b FunctionBindingClassification + switch m["type"] { + case "Microsoft.MachineLearning/WebService": + b = &AzureMachineLearningStudioFunctionBinding{} + case "Microsoft.MachineLearningServices": + b = &AzureMachineLearningServiceFunctionBinding{} + case "Microsoft.StreamAnalytics/CLRUdf": + b = &CSharpFunctionBinding{} + case "Microsoft.StreamAnalytics/JavascriptUdf": + b = &JavaScriptFunctionBinding{} + default: + b = &FunctionBinding{} + } + return b, json.Unmarshal(rawMsg, b) +} + +func unmarshalFunctionBindingClassificationArray(rawMsg json.RawMessage) ([]FunctionBindingClassification, error) { + if rawMsg == nil { + return nil, nil + } + var rawMessages []json.RawMessage + if err := json.Unmarshal(rawMsg, &rawMessages); err != nil { + return nil, err + } + fArray := make([]FunctionBindingClassification, len(rawMessages)) + for index, rawMessage := range rawMessages { + f, err := unmarshalFunctionBindingClassification(rawMessage) + if err != nil { + return nil, err + } + fArray[index] = f + } + return fArray, nil +} + +func unmarshalFunctionPropertiesClassification(rawMsg json.RawMessage) (FunctionPropertiesClassification, error) { + if rawMsg == nil { + return nil, nil + } + var m map[string]interface{} + if err := json.Unmarshal(rawMsg, &m); err != nil { + return nil, err + } + var b FunctionPropertiesClassification + switch m["type"] { + case "Aggregate": + b = &AggregateFunctionProperties{} + case "Scalar": + b = &ScalarFunctionProperties{} + default: + b = &FunctionProperties{} + } + return b, json.Unmarshal(rawMsg, b) +} + +func unmarshalFunctionPropertiesClassificationArray(rawMsg json.RawMessage) ([]FunctionPropertiesClassification, error) { + if rawMsg == nil { + return nil, nil + } + var rawMessages []json.RawMessage + if err := json.Unmarshal(rawMsg, &rawMessages); err != nil { + return nil, err + } + fArray := make([]FunctionPropertiesClassification, len(rawMessages)) + for index, rawMessage := range rawMessages { + f, err := unmarshalFunctionPropertiesClassification(rawMessage) + if err != nil { + return nil, err + } + fArray[index] = f + } + return fArray, nil +} + +func unmarshalFunctionRetrieveDefaultDefinitionParametersClassification(rawMsg json.RawMessage) (FunctionRetrieveDefaultDefinitionParametersClassification, error) { + if rawMsg == nil { + return nil, nil + } + var m map[string]interface{} + if err := json.Unmarshal(rawMsg, &m); err != nil { + return nil, err + } + var b FunctionRetrieveDefaultDefinitionParametersClassification + switch m["bindingType"] { + case "Microsoft.MachineLearning/WebService": + b = &AzureMachineLearningStudioFunctionRetrieveDefaultDefinitionParameters{} + case "Microsoft.MachineLearningServices": + b = &AzureMachineLearningServiceFunctionRetrieveDefaultDefinitionParameters{} + case "Microsoft.StreamAnalytics/CLRUdf": + b = &CSharpFunctionRetrieveDefaultDefinitionParameters{} + case "Microsoft.StreamAnalytics/JavascriptUdf": + b = &JavaScriptFunctionRetrieveDefaultDefinitionParameters{} + default: + b = &FunctionRetrieveDefaultDefinitionParameters{} + } + return b, json.Unmarshal(rawMsg, b) +} + +func unmarshalFunctionRetrieveDefaultDefinitionParametersClassificationArray(rawMsg json.RawMessage) ([]FunctionRetrieveDefaultDefinitionParametersClassification, error) { + if rawMsg == nil { + return nil, nil + } + var rawMessages []json.RawMessage + if err := json.Unmarshal(rawMsg, &rawMessages); err != nil { + return nil, err + } + fArray := make([]FunctionRetrieveDefaultDefinitionParametersClassification, len(rawMessages)) + for index, rawMessage := range rawMessages { + f, err := unmarshalFunctionRetrieveDefaultDefinitionParametersClassification(rawMessage) + if err != nil { + return nil, err + } + fArray[index] = f + } + return fArray, nil +} + +func unmarshalInputPropertiesClassification(rawMsg json.RawMessage) (InputPropertiesClassification, error) { + if rawMsg == nil { + return nil, nil + } + var m map[string]interface{} + if err := json.Unmarshal(rawMsg, &m); err != nil { + return nil, err + } + var b InputPropertiesClassification + switch m["type"] { + case "Reference": + b = &ReferenceInputProperties{} + case "Stream": + b = &StreamInputProperties{} + default: + b = &InputProperties{} + } + return b, json.Unmarshal(rawMsg, b) +} + +func unmarshalInputPropertiesClassificationArray(rawMsg json.RawMessage) ([]InputPropertiesClassification, error) { + if rawMsg == nil { + return nil, nil + } + var rawMessages []json.RawMessage + if err := json.Unmarshal(rawMsg, &rawMessages); err != nil { + return nil, err + } + fArray := make([]InputPropertiesClassification, len(rawMessages)) + for index, rawMessage := range rawMessages { + f, err := unmarshalInputPropertiesClassification(rawMessage) + if err != nil { + return nil, err + } + fArray[index] = f + } + return fArray, nil +} + +func unmarshalOutputDataSourceClassification(rawMsg json.RawMessage) (OutputDataSourceClassification, error) { + if rawMsg == nil { + return nil, nil + } + var m map[string]interface{} + if err := json.Unmarshal(rawMsg, &m); err != nil { + return nil, err + } + var b OutputDataSourceClassification + switch m["type"] { + case "Microsoft.AzureFunction": + b = &AzureFunctionOutputDataSource{} + case "Microsoft.DataLake/Accounts": + b = &AzureDataLakeStoreOutputDataSource{} + case "Microsoft.EventHub/EventHub": + b = &EventHubV2OutputDataSource{} + case "Microsoft.ServiceBus/EventHub": + b = &EventHubOutputDataSource{} + case "Microsoft.ServiceBus/Queue": + b = &ServiceBusQueueOutputDataSource{} + case "Microsoft.ServiceBus/Topic": + b = &ServiceBusTopicOutputDataSource{} + case "Microsoft.Sql/Server/DataWarehouse": + b = &AzureSynapseOutputDataSource{} + case "Microsoft.Sql/Server/Database": + b = &AzureSQLDatabaseOutputDataSource{} + case "Microsoft.Storage/Blob": + b = &BlobOutputDataSource{} + case "Microsoft.Storage/DocumentDB": + b = &DocumentDbOutputDataSource{} + case "Microsoft.Storage/Table": + b = &AzureTableOutputDataSource{} + case "PowerBI": + b = &PowerBIOutputDataSource{} + case "Raw": + b = &RawOutputDatasource{} + default: + b = &OutputDataSource{} + } + return b, json.Unmarshal(rawMsg, b) +} + +func unmarshalOutputDataSourceClassificationArray(rawMsg json.RawMessage) ([]OutputDataSourceClassification, error) { + if rawMsg == nil { + return nil, nil + } + var rawMessages []json.RawMessage + if err := json.Unmarshal(rawMsg, &rawMessages); err != nil { + return nil, err + } + fArray := make([]OutputDataSourceClassification, len(rawMessages)) + for index, rawMessage := range rawMessages { + f, err := unmarshalOutputDataSourceClassification(rawMessage) + if err != nil { + return nil, err + } + fArray[index] = f + } + return fArray, nil +} + +func unmarshalReferenceInputDataSourceClassification(rawMsg json.RawMessage) (ReferenceInputDataSourceClassification, error) { + if rawMsg == nil { + return nil, nil + } + var m map[string]interface{} + if err := json.Unmarshal(rawMsg, &m); err != nil { + return nil, err + } + var b ReferenceInputDataSourceClassification + switch m["type"] { + case "Microsoft.Sql/Server/Database": + b = &AzureSQLReferenceInputDataSource{} + case "Microsoft.Storage/Blob": + b = &BlobReferenceInputDataSource{} + case "Raw": + b = &RawReferenceInputDataSource{} + default: + b = &ReferenceInputDataSource{} + } + return b, json.Unmarshal(rawMsg, b) +} + +func unmarshalReferenceInputDataSourceClassificationArray(rawMsg json.RawMessage) ([]ReferenceInputDataSourceClassification, error) { + if rawMsg == nil { + return nil, nil + } + var rawMessages []json.RawMessage + if err := json.Unmarshal(rawMsg, &rawMessages); err != nil { + return nil, err + } + fArray := make([]ReferenceInputDataSourceClassification, len(rawMessages)) + for index, rawMessage := range rawMessages { + f, err := unmarshalReferenceInputDataSourceClassification(rawMessage) + if err != nil { + return nil, err + } + fArray[index] = f + } + return fArray, nil +} + +func unmarshalSerializationClassification(rawMsg json.RawMessage) (SerializationClassification, error) { + if rawMsg == nil { + return nil, nil + } + var m map[string]interface{} + if err := json.Unmarshal(rawMsg, &m); err != nil { + return nil, err + } + var b SerializationClassification + switch m["type"] { + case string(EventSerializationTypeAvro): + b = &AvroSerialization{} + case string(EventSerializationTypeCSV): + b = &CSVSerialization{} + case string(EventSerializationTypeCustomClr): + b = &CustomClrSerialization{} + case string(EventSerializationTypeJSON): + b = &JSONSerialization{} + case string(EventSerializationTypeParquet): + b = &ParquetSerialization{} + default: + b = &Serialization{} + } + return b, json.Unmarshal(rawMsg, b) +} + +func unmarshalSerializationClassificationArray(rawMsg json.RawMessage) ([]SerializationClassification, error) { + if rawMsg == nil { + return nil, nil + } + var rawMessages []json.RawMessage + if err := json.Unmarshal(rawMsg, &rawMessages); err != nil { + return nil, err + } + fArray := make([]SerializationClassification, len(rawMessages)) + for index, rawMessage := range rawMessages { + f, err := unmarshalSerializationClassification(rawMessage) + if err != nil { + return nil, err + } + fArray[index] = f + } + return fArray, nil +} + +func unmarshalStreamInputDataSourceClassification(rawMsg json.RawMessage) (StreamInputDataSourceClassification, error) { + if rawMsg == nil { + return nil, nil + } + var m map[string]interface{} + if err := json.Unmarshal(rawMsg, &m); err != nil { + return nil, err + } + var b StreamInputDataSourceClassification + switch m["type"] { + case "Microsoft.Devices/IotHubs": + b = &IoTHubStreamInputDataSource{} + case "Microsoft.EventHub/EventHub": + b = &EventHubV2StreamInputDataSource{} + case "Microsoft.ServiceBus/EventHub": + b = &EventHubStreamInputDataSource{} + case "Microsoft.Storage/Blob": + b = &BlobStreamInputDataSource{} + case "Raw": + b = &RawStreamInputDataSource{} + default: + b = &StreamInputDataSource{} + } + return b, json.Unmarshal(rawMsg, b) +} + +func unmarshalStreamInputDataSourceClassificationArray(rawMsg json.RawMessage) ([]StreamInputDataSourceClassification, error) { + if rawMsg == nil { + return nil, nil + } + var rawMessages []json.RawMessage + if err := json.Unmarshal(rawMsg, &rawMessages); err != nil { + return nil, err + } + fArray := make([]StreamInputDataSourceClassification, len(rawMessages)) + for index, rawMessage := range rawMessages { + f, err := unmarshalStreamInputDataSourceClassification(rawMessage) + if err != nil { + return nil, err + } + fArray[index] = f + } + return fArray, nil +} diff --git a/sdk/resourcemanager/streamanalytics/armstreamanalytics/zz_generated_privateendpoints_client.go b/sdk/resourcemanager/streamanalytics/armstreamanalytics/zz_generated_privateendpoints_client.go new file mode 100644 index 000000000000..f2d7e0004111 --- /dev/null +++ b/sdk/resourcemanager/streamanalytics/armstreamanalytics/zz_generated_privateendpoints_client.go @@ -0,0 +1,322 @@ +//go:build go1.16 +// +build go1.16 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armstreamanalytics + +import ( + "context" + "errors" + "fmt" + "net/http" + "net/url" + "strings" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" +) + +// PrivateEndpointsClient contains the methods for the PrivateEndpoints group. +// Don't use this type directly, use NewPrivateEndpointsClient() instead. +type PrivateEndpointsClient struct { + ep string + pl runtime.Pipeline + subscriptionID string +} + +// NewPrivateEndpointsClient creates a new instance of PrivateEndpointsClient with the specified values. +func NewPrivateEndpointsClient(con *arm.Connection, subscriptionID string) *PrivateEndpointsClient { + return &PrivateEndpointsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +} + +// CreateOrUpdate - Creates a Stream Analytics Private Endpoint or replaces an already existing Private Endpoint. +// If the operation fails it returns the *Error error type. +func (client *PrivateEndpointsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, clusterName string, privateEndpointName string, privateEndpoint PrivateEndpoint, options *PrivateEndpointsCreateOrUpdateOptions) (PrivateEndpointsCreateOrUpdateResponse, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, clusterName, privateEndpointName, privateEndpoint, options) + if err != nil { + return PrivateEndpointsCreateOrUpdateResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return PrivateEndpointsCreateOrUpdateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return PrivateEndpointsCreateOrUpdateResponse{}, client.createOrUpdateHandleError(resp) + } + return client.createOrUpdateHandleResponse(resp) +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *PrivateEndpointsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, privateEndpointName string, privateEndpoint PrivateEndpoint, options *PrivateEndpointsCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/clusters/{clusterName}/privateEndpoints/{privateEndpointName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if clusterName == "" { + return nil, errors.New("parameter clusterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName)) + if privateEndpointName == "" { + return nil, errors.New("parameter privateEndpointName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{privateEndpointName}", url.PathEscape(privateEndpointName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2020-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + if options != nil && options.IfMatch != nil { + req.Raw().Header.Set("If-Match", *options.IfMatch) + } + if options != nil && options.IfNoneMatch != nil { + req.Raw().Header.Set("If-None-Match", *options.IfNoneMatch) + } + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, privateEndpoint) +} + +// createOrUpdateHandleResponse handles the CreateOrUpdate response. +func (client *PrivateEndpointsClient) createOrUpdateHandleResponse(resp *http.Response) (PrivateEndpointsCreateOrUpdateResponse, error) { + result := PrivateEndpointsCreateOrUpdateResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpoint); err != nil { + return PrivateEndpointsCreateOrUpdateResponse{}, err + } + return result, nil +} + +// createOrUpdateHandleError handles the CreateOrUpdate error response. +func (client *PrivateEndpointsClient) createOrUpdateHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := Error{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// BeginDelete - Delete the specified private endpoint. +// If the operation fails it returns the *Error error type. +func (client *PrivateEndpointsClient) BeginDelete(ctx context.Context, resourceGroupName string, clusterName string, privateEndpointName string, options *PrivateEndpointsBeginDeleteOptions) (PrivateEndpointsDeletePollerResponse, error) { + resp, err := client.deleteOperation(ctx, resourceGroupName, clusterName, privateEndpointName, options) + if err != nil { + return PrivateEndpointsDeletePollerResponse{}, err + } + result := PrivateEndpointsDeletePollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("PrivateEndpointsClient.Delete", "", resp, client.pl, client.deleteHandleError) + if err != nil { + return PrivateEndpointsDeletePollerResponse{}, err + } + result.Poller = &PrivateEndpointsDeletePoller{ + pt: pt, + } + return result, nil +} + +// Delete - Delete the specified private endpoint. +// If the operation fails it returns the *Error error type. +func (client *PrivateEndpointsClient) deleteOperation(ctx context.Context, resourceGroupName string, clusterName string, privateEndpointName string, options *PrivateEndpointsBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, clusterName, privateEndpointName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + return nil, client.deleteHandleError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *PrivateEndpointsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, privateEndpointName string, options *PrivateEndpointsBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/clusters/{clusterName}/privateEndpoints/{privateEndpointName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if clusterName == "" { + return nil, errors.New("parameter clusterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName)) + if privateEndpointName == "" { + return nil, errors.New("parameter privateEndpointName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{privateEndpointName}", url.PathEscape(privateEndpointName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2020-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// deleteHandleError handles the Delete error response. +func (client *PrivateEndpointsClient) deleteHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := Error{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// Get - Gets information about the specified Private Endpoint. +// If the operation fails it returns the *Error error type. +func (client *PrivateEndpointsClient) Get(ctx context.Context, resourceGroupName string, clusterName string, privateEndpointName string, options *PrivateEndpointsGetOptions) (PrivateEndpointsGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, clusterName, privateEndpointName, options) + if err != nil { + return PrivateEndpointsGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return PrivateEndpointsGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return PrivateEndpointsGetResponse{}, client.getHandleError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *PrivateEndpointsClient) getCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, privateEndpointName string, options *PrivateEndpointsGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/clusters/{clusterName}/privateEndpoints/{privateEndpointName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if clusterName == "" { + return nil, errors.New("parameter clusterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName)) + if privateEndpointName == "" { + return nil, errors.New("parameter privateEndpointName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{privateEndpointName}", url.PathEscape(privateEndpointName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2020-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *PrivateEndpointsClient) getHandleResponse(resp *http.Response) (PrivateEndpointsGetResponse, error) { + result := PrivateEndpointsGetResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpoint); err != nil { + return PrivateEndpointsGetResponse{}, err + } + return result, nil +} + +// getHandleError handles the Get error response. +func (client *PrivateEndpointsClient) getHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := Error{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// ListByCluster - Lists the private endpoints in the cluster. +// If the operation fails it returns the *Error error type. +func (client *PrivateEndpointsClient) ListByCluster(resourceGroupName string, clusterName string, options *PrivateEndpointsListByClusterOptions) *PrivateEndpointsListByClusterPager { + return &PrivateEndpointsListByClusterPager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { + return client.listByClusterCreateRequest(ctx, resourceGroupName, clusterName, options) + }, + advancer: func(ctx context.Context, resp PrivateEndpointsListByClusterResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.PrivateEndpointListResult.NextLink) + }, + } +} + +// listByClusterCreateRequest creates the ListByCluster request. +func (client *PrivateEndpointsClient) listByClusterCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, options *PrivateEndpointsListByClusterOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/clusters/{clusterName}/privateEndpoints" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if clusterName == "" { + return nil, errors.New("parameter clusterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2020-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// listByClusterHandleResponse handles the ListByCluster response. +func (client *PrivateEndpointsClient) listByClusterHandleResponse(resp *http.Response) (PrivateEndpointsListByClusterResponse, error) { + result := PrivateEndpointsListByClusterResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointListResult); err != nil { + return PrivateEndpointsListByClusterResponse{}, err + } + return result, nil +} + +// listByClusterHandleError handles the ListByCluster error response. +func (client *PrivateEndpointsClient) listByClusterHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := Error{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} diff --git a/sdk/resourcemanager/streamanalytics/armstreamanalytics/zz_generated_response_types.go b/sdk/resourcemanager/streamanalytics/armstreamanalytics/zz_generated_response_types.go new file mode 100644 index 000000000000..e2f8d5b61598 --- /dev/null +++ b/sdk/resourcemanager/streamanalytics/armstreamanalytics/zz_generated_response_types.go @@ -0,0 +1,1143 @@ +//go:build go1.16 +// +build go1.16 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armstreamanalytics + +import ( + "context" + "net/http" + "time" + + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" +) + +// ClustersCreateOrUpdatePollerResponse contains the response from method Clusters.CreateOrUpdate. +type ClustersCreateOrUpdatePollerResponse struct { + // Poller contains an initialized poller. + Poller *ClustersCreateOrUpdatePoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +func (l ClustersCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ClustersCreateOrUpdateResponse, error) { + respType := ClustersCreateOrUpdateResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.Cluster) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a ClustersCreateOrUpdatePollerResponse from the provided client and resume token. +func (l *ClustersCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *ClustersClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("ClustersClient.CreateOrUpdate", token, client.pl, client.createOrUpdateHandleError) + if err != nil { + return err + } + poller := &ClustersCreateOrUpdatePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// ClustersCreateOrUpdateResponse contains the response from method Clusters.CreateOrUpdate. +type ClustersCreateOrUpdateResponse struct { + ClustersCreateOrUpdateResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// ClustersCreateOrUpdateResult contains the result from method Clusters.CreateOrUpdate. +type ClustersCreateOrUpdateResult struct { + Cluster +} + +// ClustersDeletePollerResponse contains the response from method Clusters.Delete. +type ClustersDeletePollerResponse struct { + // Poller contains an initialized poller. + Poller *ClustersDeletePoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +func (l ClustersDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ClustersDeleteResponse, error) { + respType := ClustersDeleteResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a ClustersDeletePollerResponse from the provided client and resume token. +func (l *ClustersDeletePollerResponse) Resume(ctx context.Context, client *ClustersClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("ClustersClient.Delete", token, client.pl, client.deleteHandleError) + if err != nil { + return err + } + poller := &ClustersDeletePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// ClustersDeleteResponse contains the response from method Clusters.Delete. +type ClustersDeleteResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// ClustersGetResponse contains the response from method Clusters.Get. +type ClustersGetResponse struct { + ClustersGetResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// ClustersGetResult contains the result from method Clusters.Get. +type ClustersGetResult struct { + Cluster +} + +// ClustersListByResourceGroupResponse contains the response from method Clusters.ListByResourceGroup. +type ClustersListByResourceGroupResponse struct { + ClustersListByResourceGroupResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// ClustersListByResourceGroupResult contains the result from method Clusters.ListByResourceGroup. +type ClustersListByResourceGroupResult struct { + ClusterListResult +} + +// ClustersListBySubscriptionResponse contains the response from method Clusters.ListBySubscription. +type ClustersListBySubscriptionResponse struct { + ClustersListBySubscriptionResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// ClustersListBySubscriptionResult contains the result from method Clusters.ListBySubscription. +type ClustersListBySubscriptionResult struct { + ClusterListResult +} + +// ClustersListStreamingJobsResponse contains the response from method Clusters.ListStreamingJobs. +type ClustersListStreamingJobsResponse struct { + ClustersListStreamingJobsResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// ClustersListStreamingJobsResult contains the result from method Clusters.ListStreamingJobs. +type ClustersListStreamingJobsResult struct { + ClusterJobListResult +} + +// ClustersUpdatePollerResponse contains the response from method Clusters.Update. +type ClustersUpdatePollerResponse struct { + // Poller contains an initialized poller. + Poller *ClustersUpdatePoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +func (l ClustersUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ClustersUpdateResponse, error) { + respType := ClustersUpdateResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.Cluster) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a ClustersUpdatePollerResponse from the provided client and resume token. +func (l *ClustersUpdatePollerResponse) Resume(ctx context.Context, client *ClustersClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("ClustersClient.Update", token, client.pl, client.updateHandleError) + if err != nil { + return err + } + poller := &ClustersUpdatePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// ClustersUpdateResponse contains the response from method Clusters.Update. +type ClustersUpdateResponse struct { + ClustersUpdateResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// ClustersUpdateResult contains the result from method Clusters.Update. +type ClustersUpdateResult struct { + Cluster +} + +// FunctionsCreateOrReplaceResponse contains the response from method Functions.CreateOrReplace. +type FunctionsCreateOrReplaceResponse struct { + FunctionsCreateOrReplaceResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// FunctionsCreateOrReplaceResult contains the result from method Functions.CreateOrReplace. +type FunctionsCreateOrReplaceResult struct { + Function + // ETag contains the information returned from the ETag header response. + ETag *string +} + +// FunctionsDeleteResponse contains the response from method Functions.Delete. +type FunctionsDeleteResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// FunctionsGetResponse contains the response from method Functions.Get. +type FunctionsGetResponse struct { + FunctionsGetResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// FunctionsGetResult contains the result from method Functions.Get. +type FunctionsGetResult struct { + Function + // ETag contains the information returned from the ETag header response. + ETag *string +} + +// FunctionsListByStreamingJobResponse contains the response from method Functions.ListByStreamingJob. +type FunctionsListByStreamingJobResponse struct { + FunctionsListByStreamingJobResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// FunctionsListByStreamingJobResult contains the result from method Functions.ListByStreamingJob. +type FunctionsListByStreamingJobResult struct { + FunctionListResult +} + +// FunctionsRetrieveDefaultDefinitionResponse contains the response from method Functions.RetrieveDefaultDefinition. +type FunctionsRetrieveDefaultDefinitionResponse struct { + FunctionsRetrieveDefaultDefinitionResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// FunctionsRetrieveDefaultDefinitionResult contains the result from method Functions.RetrieveDefaultDefinition. +type FunctionsRetrieveDefaultDefinitionResult struct { + Function +} + +// FunctionsTestPollerResponse contains the response from method Functions.Test. +type FunctionsTestPollerResponse struct { + // Poller contains an initialized poller. + Poller *FunctionsTestPoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +func (l FunctionsTestPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (FunctionsTestResponse, error) { + respType := FunctionsTestResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.ResourceTestStatus) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a FunctionsTestPollerResponse from the provided client and resume token. +func (l *FunctionsTestPollerResponse) Resume(ctx context.Context, client *FunctionsClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("FunctionsClient.Test", token, client.pl, client.testHandleError) + if err != nil { + return err + } + poller := &FunctionsTestPoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// FunctionsTestResponse contains the response from method Functions.Test. +type FunctionsTestResponse struct { + FunctionsTestResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// FunctionsTestResult contains the result from method Functions.Test. +type FunctionsTestResult struct { + ResourceTestStatus +} + +// FunctionsUpdateResponse contains the response from method Functions.Update. +type FunctionsUpdateResponse struct { + FunctionsUpdateResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// FunctionsUpdateResult contains the result from method Functions.Update. +type FunctionsUpdateResult struct { + Function + // ETag contains the information returned from the ETag header response. + ETag *string +} + +// InputsCreateOrReplaceResponse contains the response from method Inputs.CreateOrReplace. +type InputsCreateOrReplaceResponse struct { + InputsCreateOrReplaceResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// InputsCreateOrReplaceResult contains the result from method Inputs.CreateOrReplace. +type InputsCreateOrReplaceResult struct { + Input + // ETag contains the information returned from the ETag header response. + ETag *string +} + +// InputsDeleteResponse contains the response from method Inputs.Delete. +type InputsDeleteResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// InputsGetResponse contains the response from method Inputs.Get. +type InputsGetResponse struct { + InputsGetResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// InputsGetResult contains the result from method Inputs.Get. +type InputsGetResult struct { + Input + // ETag contains the information returned from the ETag header response. + ETag *string +} + +// InputsListByStreamingJobResponse contains the response from method Inputs.ListByStreamingJob. +type InputsListByStreamingJobResponse struct { + InputsListByStreamingJobResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// InputsListByStreamingJobResult contains the result from method Inputs.ListByStreamingJob. +type InputsListByStreamingJobResult struct { + InputListResult +} + +// InputsTestPollerResponse contains the response from method Inputs.Test. +type InputsTestPollerResponse struct { + // Poller contains an initialized poller. + Poller *InputsTestPoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +func (l InputsTestPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (InputsTestResponse, error) { + respType := InputsTestResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.ResourceTestStatus) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a InputsTestPollerResponse from the provided client and resume token. +func (l *InputsTestPollerResponse) Resume(ctx context.Context, client *InputsClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("InputsClient.Test", token, client.pl, client.testHandleError) + if err != nil { + return err + } + poller := &InputsTestPoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// InputsTestResponse contains the response from method Inputs.Test. +type InputsTestResponse struct { + InputsTestResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// InputsTestResult contains the result from method Inputs.Test. +type InputsTestResult struct { + ResourceTestStatus +} + +// InputsUpdateResponse contains the response from method Inputs.Update. +type InputsUpdateResponse struct { + InputsUpdateResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// InputsUpdateResult contains the result from method Inputs.Update. +type InputsUpdateResult struct { + Input + // ETag contains the information returned from the ETag header response. + ETag *string +} + +// OperationsListResponse contains the response from method Operations.List. +type OperationsListResponse struct { + OperationsListResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// OperationsListResult contains the result from method Operations.List. +type OperationsListResult struct { + OperationListResult +} + +// OutputsCreateOrReplaceResponse contains the response from method Outputs.CreateOrReplace. +type OutputsCreateOrReplaceResponse struct { + OutputsCreateOrReplaceResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// OutputsCreateOrReplaceResult contains the result from method Outputs.CreateOrReplace. +type OutputsCreateOrReplaceResult struct { + Output + // ETag contains the information returned from the ETag header response. + ETag *string +} + +// OutputsDeleteResponse contains the response from method Outputs.Delete. +type OutputsDeleteResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// OutputsGetResponse contains the response from method Outputs.Get. +type OutputsGetResponse struct { + OutputsGetResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// OutputsGetResult contains the result from method Outputs.Get. +type OutputsGetResult struct { + Output + // ETag contains the information returned from the ETag header response. + ETag *string +} + +// OutputsListByStreamingJobResponse contains the response from method Outputs.ListByStreamingJob. +type OutputsListByStreamingJobResponse struct { + OutputsListByStreamingJobResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// OutputsListByStreamingJobResult contains the result from method Outputs.ListByStreamingJob. +type OutputsListByStreamingJobResult struct { + OutputListResult +} + +// OutputsTestPollerResponse contains the response from method Outputs.Test. +type OutputsTestPollerResponse struct { + // Poller contains an initialized poller. + Poller *OutputsTestPoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +func (l OutputsTestPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (OutputsTestResponse, error) { + respType := OutputsTestResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.ResourceTestStatus) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a OutputsTestPollerResponse from the provided client and resume token. +func (l *OutputsTestPollerResponse) Resume(ctx context.Context, client *OutputsClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("OutputsClient.Test", token, client.pl, client.testHandleError) + if err != nil { + return err + } + poller := &OutputsTestPoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// OutputsTestResponse contains the response from method Outputs.Test. +type OutputsTestResponse struct { + OutputsTestResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// OutputsTestResult contains the result from method Outputs.Test. +type OutputsTestResult struct { + ResourceTestStatus +} + +// OutputsUpdateResponse contains the response from method Outputs.Update. +type OutputsUpdateResponse struct { + OutputsUpdateResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// OutputsUpdateResult contains the result from method Outputs.Update. +type OutputsUpdateResult struct { + Output + // ETag contains the information returned from the ETag header response. + ETag *string +} + +// PrivateEndpointsCreateOrUpdateResponse contains the response from method PrivateEndpoints.CreateOrUpdate. +type PrivateEndpointsCreateOrUpdateResponse struct { + PrivateEndpointsCreateOrUpdateResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PrivateEndpointsCreateOrUpdateResult contains the result from method PrivateEndpoints.CreateOrUpdate. +type PrivateEndpointsCreateOrUpdateResult struct { + PrivateEndpoint +} + +// PrivateEndpointsDeletePollerResponse contains the response from method PrivateEndpoints.Delete. +type PrivateEndpointsDeletePollerResponse struct { + // Poller contains an initialized poller. + Poller *PrivateEndpointsDeletePoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +func (l PrivateEndpointsDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (PrivateEndpointsDeleteResponse, error) { + respType := PrivateEndpointsDeleteResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a PrivateEndpointsDeletePollerResponse from the provided client and resume token. +func (l *PrivateEndpointsDeletePollerResponse) Resume(ctx context.Context, client *PrivateEndpointsClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("PrivateEndpointsClient.Delete", token, client.pl, client.deleteHandleError) + if err != nil { + return err + } + poller := &PrivateEndpointsDeletePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// PrivateEndpointsDeleteResponse contains the response from method PrivateEndpoints.Delete. +type PrivateEndpointsDeleteResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PrivateEndpointsGetResponse contains the response from method PrivateEndpoints.Get. +type PrivateEndpointsGetResponse struct { + PrivateEndpointsGetResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PrivateEndpointsGetResult contains the result from method PrivateEndpoints.Get. +type PrivateEndpointsGetResult struct { + PrivateEndpoint +} + +// PrivateEndpointsListByClusterResponse contains the response from method PrivateEndpoints.ListByCluster. +type PrivateEndpointsListByClusterResponse struct { + PrivateEndpointsListByClusterResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PrivateEndpointsListByClusterResult contains the result from method PrivateEndpoints.ListByCluster. +type PrivateEndpointsListByClusterResult struct { + PrivateEndpointListResult +} + +// StreamingJobsCreateOrReplacePollerResponse contains the response from method StreamingJobs.CreateOrReplace. +type StreamingJobsCreateOrReplacePollerResponse struct { + // Poller contains an initialized poller. + Poller *StreamingJobsCreateOrReplacePoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +func (l StreamingJobsCreateOrReplacePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (StreamingJobsCreateOrReplaceResponse, error) { + respType := StreamingJobsCreateOrReplaceResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.StreamingJob) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a StreamingJobsCreateOrReplacePollerResponse from the provided client and resume token. +func (l *StreamingJobsCreateOrReplacePollerResponse) Resume(ctx context.Context, client *StreamingJobsClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("StreamingJobsClient.CreateOrReplace", token, client.pl, client.createOrReplaceHandleError) + if err != nil { + return err + } + poller := &StreamingJobsCreateOrReplacePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// StreamingJobsCreateOrReplaceResponse contains the response from method StreamingJobs.CreateOrReplace. +type StreamingJobsCreateOrReplaceResponse struct { + StreamingJobsCreateOrReplaceResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// StreamingJobsCreateOrReplaceResult contains the result from method StreamingJobs.CreateOrReplace. +type StreamingJobsCreateOrReplaceResult struct { + StreamingJob +} + +// StreamingJobsDeletePollerResponse contains the response from method StreamingJobs.Delete. +type StreamingJobsDeletePollerResponse struct { + // Poller contains an initialized poller. + Poller *StreamingJobsDeletePoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +func (l StreamingJobsDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (StreamingJobsDeleteResponse, error) { + respType := StreamingJobsDeleteResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a StreamingJobsDeletePollerResponse from the provided client and resume token. +func (l *StreamingJobsDeletePollerResponse) Resume(ctx context.Context, client *StreamingJobsClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("StreamingJobsClient.Delete", token, client.pl, client.deleteHandleError) + if err != nil { + return err + } + poller := &StreamingJobsDeletePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// StreamingJobsDeleteResponse contains the response from method StreamingJobs.Delete. +type StreamingJobsDeleteResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// StreamingJobsGetResponse contains the response from method StreamingJobs.Get. +type StreamingJobsGetResponse struct { + StreamingJobsGetResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// StreamingJobsGetResult contains the result from method StreamingJobs.Get. +type StreamingJobsGetResult struct { + StreamingJob + // ETag contains the information returned from the ETag header response. + ETag *string +} + +// StreamingJobsListByResourceGroupResponse contains the response from method StreamingJobs.ListByResourceGroup. +type StreamingJobsListByResourceGroupResponse struct { + StreamingJobsListByResourceGroupResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// StreamingJobsListByResourceGroupResult contains the result from method StreamingJobs.ListByResourceGroup. +type StreamingJobsListByResourceGroupResult struct { + StreamingJobListResult +} + +// StreamingJobsListResponse contains the response from method StreamingJobs.List. +type StreamingJobsListResponse struct { + StreamingJobsListResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// StreamingJobsListResult contains the result from method StreamingJobs.List. +type StreamingJobsListResult struct { + StreamingJobListResult +} + +// StreamingJobsStartPollerResponse contains the response from method StreamingJobs.Start. +type StreamingJobsStartPollerResponse struct { + // Poller contains an initialized poller. + Poller *StreamingJobsStartPoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +func (l StreamingJobsStartPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (StreamingJobsStartResponse, error) { + respType := StreamingJobsStartResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a StreamingJobsStartPollerResponse from the provided client and resume token. +func (l *StreamingJobsStartPollerResponse) Resume(ctx context.Context, client *StreamingJobsClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("StreamingJobsClient.Start", token, client.pl, client.startHandleError) + if err != nil { + return err + } + poller := &StreamingJobsStartPoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// StreamingJobsStartResponse contains the response from method StreamingJobs.Start. +type StreamingJobsStartResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// StreamingJobsStopPollerResponse contains the response from method StreamingJobs.Stop. +type StreamingJobsStopPollerResponse struct { + // Poller contains an initialized poller. + Poller *StreamingJobsStopPoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +func (l StreamingJobsStopPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (StreamingJobsStopResponse, error) { + respType := StreamingJobsStopResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a StreamingJobsStopPollerResponse from the provided client and resume token. +func (l *StreamingJobsStopPollerResponse) Resume(ctx context.Context, client *StreamingJobsClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("StreamingJobsClient.Stop", token, client.pl, client.stopHandleError) + if err != nil { + return err + } + poller := &StreamingJobsStopPoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// StreamingJobsStopResponse contains the response from method StreamingJobs.Stop. +type StreamingJobsStopResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// StreamingJobsUpdateResponse contains the response from method StreamingJobs.Update. +type StreamingJobsUpdateResponse struct { + StreamingJobsUpdateResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// StreamingJobsUpdateResult contains the result from method StreamingJobs.Update. +type StreamingJobsUpdateResult struct { + StreamingJob + // ETag contains the information returned from the ETag header response. + ETag *string +} + +// SubscriptionsCompileQueryResponse contains the response from method Subscriptions.CompileQuery. +type SubscriptionsCompileQueryResponse struct { + SubscriptionsCompileQueryResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// SubscriptionsCompileQueryResult contains the result from method Subscriptions.CompileQuery. +type SubscriptionsCompileQueryResult struct { + QueryCompilationResult +} + +// SubscriptionsListQuotasResponse contains the response from method Subscriptions.ListQuotas. +type SubscriptionsListQuotasResponse struct { + SubscriptionsListQuotasResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// SubscriptionsListQuotasResult contains the result from method Subscriptions.ListQuotas. +type SubscriptionsListQuotasResult struct { + SubscriptionQuotasListResult +} + +// SubscriptionsSampleInputPollerResponse contains the response from method Subscriptions.SampleInput. +type SubscriptionsSampleInputPollerResponse struct { + // Poller contains an initialized poller. + Poller *SubscriptionsSampleInputPoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +func (l SubscriptionsSampleInputPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (SubscriptionsSampleInputResponse, error) { + respType := SubscriptionsSampleInputResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.SampleInputResult) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a SubscriptionsSampleInputPollerResponse from the provided client and resume token. +func (l *SubscriptionsSampleInputPollerResponse) Resume(ctx context.Context, client *SubscriptionsClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("SubscriptionsClient.SampleInput", token, client.pl, client.sampleInputHandleError) + if err != nil { + return err + } + poller := &SubscriptionsSampleInputPoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// SubscriptionsSampleInputResponse contains the response from method Subscriptions.SampleInput. +type SubscriptionsSampleInputResponse struct { + SubscriptionsSampleInputResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// SubscriptionsSampleInputResult contains the result from method Subscriptions.SampleInput. +type SubscriptionsSampleInputResult struct { + SampleInputResult +} + +// SubscriptionsTestInputPollerResponse contains the response from method Subscriptions.TestInput. +type SubscriptionsTestInputPollerResponse struct { + // Poller contains an initialized poller. + Poller *SubscriptionsTestInputPoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +func (l SubscriptionsTestInputPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (SubscriptionsTestInputResponse, error) { + respType := SubscriptionsTestInputResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.TestDatasourceResult) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a SubscriptionsTestInputPollerResponse from the provided client and resume token. +func (l *SubscriptionsTestInputPollerResponse) Resume(ctx context.Context, client *SubscriptionsClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("SubscriptionsClient.TestInput", token, client.pl, client.testInputHandleError) + if err != nil { + return err + } + poller := &SubscriptionsTestInputPoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// SubscriptionsTestInputResponse contains the response from method Subscriptions.TestInput. +type SubscriptionsTestInputResponse struct { + SubscriptionsTestInputResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// SubscriptionsTestInputResult contains the result from method Subscriptions.TestInput. +type SubscriptionsTestInputResult struct { + TestDatasourceResult +} + +// SubscriptionsTestOutputPollerResponse contains the response from method Subscriptions.TestOutput. +type SubscriptionsTestOutputPollerResponse struct { + // Poller contains an initialized poller. + Poller *SubscriptionsTestOutputPoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +func (l SubscriptionsTestOutputPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (SubscriptionsTestOutputResponse, error) { + respType := SubscriptionsTestOutputResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.TestDatasourceResult) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a SubscriptionsTestOutputPollerResponse from the provided client and resume token. +func (l *SubscriptionsTestOutputPollerResponse) Resume(ctx context.Context, client *SubscriptionsClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("SubscriptionsClient.TestOutput", token, client.pl, client.testOutputHandleError) + if err != nil { + return err + } + poller := &SubscriptionsTestOutputPoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// SubscriptionsTestOutputResponse contains the response from method Subscriptions.TestOutput. +type SubscriptionsTestOutputResponse struct { + SubscriptionsTestOutputResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// SubscriptionsTestOutputResult contains the result from method Subscriptions.TestOutput. +type SubscriptionsTestOutputResult struct { + TestDatasourceResult +} + +// SubscriptionsTestQueryPollerResponse contains the response from method Subscriptions.TestQuery. +type SubscriptionsTestQueryPollerResponse struct { + // Poller contains an initialized poller. + Poller *SubscriptionsTestQueryPoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +func (l SubscriptionsTestQueryPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (SubscriptionsTestQueryResponse, error) { + respType := SubscriptionsTestQueryResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.QueryTestingResult) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a SubscriptionsTestQueryPollerResponse from the provided client and resume token. +func (l *SubscriptionsTestQueryPollerResponse) Resume(ctx context.Context, client *SubscriptionsClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("SubscriptionsClient.TestQuery", token, client.pl, client.testQueryHandleError) + if err != nil { + return err + } + poller := &SubscriptionsTestQueryPoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// SubscriptionsTestQueryResponse contains the response from method Subscriptions.TestQuery. +type SubscriptionsTestQueryResponse struct { + SubscriptionsTestQueryResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// SubscriptionsTestQueryResult contains the result from method Subscriptions.TestQuery. +type SubscriptionsTestQueryResult struct { + QueryTestingResult +} + +// TransformationsCreateOrReplaceResponse contains the response from method Transformations.CreateOrReplace. +type TransformationsCreateOrReplaceResponse struct { + TransformationsCreateOrReplaceResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// TransformationsCreateOrReplaceResult contains the result from method Transformations.CreateOrReplace. +type TransformationsCreateOrReplaceResult struct { + Transformation + // ETag contains the information returned from the ETag header response. + ETag *string +} + +// TransformationsGetResponse contains the response from method Transformations.Get. +type TransformationsGetResponse struct { + TransformationsGetResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// TransformationsGetResult contains the result from method Transformations.Get. +type TransformationsGetResult struct { + Transformation + // ETag contains the information returned from the ETag header response. + ETag *string +} + +// TransformationsUpdateResponse contains the response from method Transformations.Update. +type TransformationsUpdateResponse struct { + TransformationsUpdateResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// TransformationsUpdateResult contains the result from method Transformations.Update. +type TransformationsUpdateResult struct { + Transformation + // ETag contains the information returned from the ETag header response. + ETag *string +} diff --git a/sdk/resourcemanager/streamanalytics/armstreamanalytics/zz_generated_streamingjobs_client.go b/sdk/resourcemanager/streamanalytics/armstreamanalytics/zz_generated_streamingjobs_client.go new file mode 100644 index 000000000000..9866dd196cc0 --- /dev/null +++ b/sdk/resourcemanager/streamanalytics/armstreamanalytics/zz_generated_streamingjobs_client.go @@ -0,0 +1,610 @@ +//go:build go1.16 +// +build go1.16 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armstreamanalytics + +import ( + "context" + "errors" + "fmt" + "net/http" + "net/url" + "strings" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" +) + +// StreamingJobsClient contains the methods for the StreamingJobs group. +// Don't use this type directly, use NewStreamingJobsClient() instead. +type StreamingJobsClient struct { + ep string + pl runtime.Pipeline + subscriptionID string +} + +// NewStreamingJobsClient creates a new instance of StreamingJobsClient with the specified values. +func NewStreamingJobsClient(con *arm.Connection, subscriptionID string) *StreamingJobsClient { + return &StreamingJobsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +} + +// BeginCreateOrReplace - Creates a streaming job or replaces an already existing streaming job. +// If the operation fails it returns the *Error error type. +func (client *StreamingJobsClient) BeginCreateOrReplace(ctx context.Context, resourceGroupName string, jobName string, streamingJob StreamingJob, options *StreamingJobsBeginCreateOrReplaceOptions) (StreamingJobsCreateOrReplacePollerResponse, error) { + resp, err := client.createOrReplace(ctx, resourceGroupName, jobName, streamingJob, options) + if err != nil { + return StreamingJobsCreateOrReplacePollerResponse{}, err + } + result := StreamingJobsCreateOrReplacePollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("StreamingJobsClient.CreateOrReplace", "", resp, client.pl, client.createOrReplaceHandleError) + if err != nil { + return StreamingJobsCreateOrReplacePollerResponse{}, err + } + result.Poller = &StreamingJobsCreateOrReplacePoller{ + pt: pt, + } + return result, nil +} + +// CreateOrReplace - Creates a streaming job or replaces an already existing streaming job. +// If the operation fails it returns the *Error error type. +func (client *StreamingJobsClient) createOrReplace(ctx context.Context, resourceGroupName string, jobName string, streamingJob StreamingJob, options *StreamingJobsBeginCreateOrReplaceOptions) (*http.Response, error) { + req, err := client.createOrReplaceCreateRequest(ctx, resourceGroupName, jobName, streamingJob, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return nil, client.createOrReplaceHandleError(resp) + } + return resp, nil +} + +// createOrReplaceCreateRequest creates the CreateOrReplace request. +func (client *StreamingJobsClient) createOrReplaceCreateRequest(ctx context.Context, resourceGroupName string, jobName string, streamingJob StreamingJob, options *StreamingJobsBeginCreateOrReplaceOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if jobName == "" { + return nil, errors.New("parameter jobName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{jobName}", url.PathEscape(jobName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2017-04-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + if options != nil && options.IfMatch != nil { + req.Raw().Header.Set("If-Match", *options.IfMatch) + } + if options != nil && options.IfNoneMatch != nil { + req.Raw().Header.Set("If-None-Match", *options.IfNoneMatch) + } + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, streamingJob) +} + +// createOrReplaceHandleError handles the CreateOrReplace error response. +func (client *StreamingJobsClient) createOrReplaceHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := Error{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// BeginDelete - Deletes a streaming job. +// If the operation fails it returns the *Error error type. +func (client *StreamingJobsClient) BeginDelete(ctx context.Context, resourceGroupName string, jobName string, options *StreamingJobsBeginDeleteOptions) (StreamingJobsDeletePollerResponse, error) { + resp, err := client.deleteOperation(ctx, resourceGroupName, jobName, options) + if err != nil { + return StreamingJobsDeletePollerResponse{}, err + } + result := StreamingJobsDeletePollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("StreamingJobsClient.Delete", "", resp, client.pl, client.deleteHandleError) + if err != nil { + return StreamingJobsDeletePollerResponse{}, err + } + result.Poller = &StreamingJobsDeletePoller{ + pt: pt, + } + return result, nil +} + +// Delete - Deletes a streaming job. +// If the operation fails it returns the *Error error type. +func (client *StreamingJobsClient) deleteOperation(ctx context.Context, resourceGroupName string, jobName string, options *StreamingJobsBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, jobName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + return nil, client.deleteHandleError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *StreamingJobsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, jobName string, options *StreamingJobsBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if jobName == "" { + return nil, errors.New("parameter jobName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{jobName}", url.PathEscape(jobName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2017-04-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// deleteHandleError handles the Delete error response. +func (client *StreamingJobsClient) deleteHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := Error{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// Get - Gets details about the specified streaming job. +// If the operation fails it returns the *Error error type. +func (client *StreamingJobsClient) Get(ctx context.Context, resourceGroupName string, jobName string, options *StreamingJobsGetOptions) (StreamingJobsGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, jobName, options) + if err != nil { + return StreamingJobsGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return StreamingJobsGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return StreamingJobsGetResponse{}, client.getHandleError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *StreamingJobsClient) getCreateRequest(ctx context.Context, resourceGroupName string, jobName string, options *StreamingJobsGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if jobName == "" { + return nil, errors.New("parameter jobName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{jobName}", url.PathEscape(jobName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + if options != nil && options.Expand != nil { + reqQP.Set("$expand", *options.Expand) + } + reqQP.Set("api-version", "2017-04-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *StreamingJobsClient) getHandleResponse(resp *http.Response) (StreamingJobsGetResponse, error) { + result := StreamingJobsGetResponse{RawResponse: resp} + if val := resp.Header.Get("ETag"); val != "" { + result.ETag = &val + } + if err := runtime.UnmarshalAsJSON(resp, &result.StreamingJob); err != nil { + return StreamingJobsGetResponse{}, err + } + return result, nil +} + +// getHandleError handles the Get error response. +func (client *StreamingJobsClient) getHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := Error{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// List - Lists all of the streaming jobs in the given subscription. +// If the operation fails it returns the *Error error type. +func (client *StreamingJobsClient) List(options *StreamingJobsListOptions) *StreamingJobsListPager { + return &StreamingJobsListPager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, options) + }, + advancer: func(ctx context.Context, resp StreamingJobsListResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.StreamingJobListResult.NextLink) + }, + } +} + +// listCreateRequest creates the List request. +func (client *StreamingJobsClient) listCreateRequest(ctx context.Context, options *StreamingJobsListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.StreamAnalytics/streamingjobs" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + if options != nil && options.Expand != nil { + reqQP.Set("$expand", *options.Expand) + } + reqQP.Set("api-version", "2017-04-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// listHandleResponse handles the List response. +func (client *StreamingJobsClient) listHandleResponse(resp *http.Response) (StreamingJobsListResponse, error) { + result := StreamingJobsListResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.StreamingJobListResult); err != nil { + return StreamingJobsListResponse{}, err + } + return result, nil +} + +// listHandleError handles the List error response. +func (client *StreamingJobsClient) listHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := Error{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// ListByResourceGroup - Lists all of the streaming jobs in the specified resource group. +// If the operation fails it returns the *Error error type. +func (client *StreamingJobsClient) ListByResourceGroup(resourceGroupName string, options *StreamingJobsListByResourceGroupOptions) *StreamingJobsListByResourceGroupPager { + return &StreamingJobsListByResourceGroupPager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { + return client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) + }, + advancer: func(ctx context.Context, resp StreamingJobsListByResourceGroupResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.StreamingJobListResult.NextLink) + }, + } +} + +// listByResourceGroupCreateRequest creates the ListByResourceGroup request. +func (client *StreamingJobsClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *StreamingJobsListByResourceGroupOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + if options != nil && options.Expand != nil { + reqQP.Set("$expand", *options.Expand) + } + reqQP.Set("api-version", "2017-04-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// listByResourceGroupHandleResponse handles the ListByResourceGroup response. +func (client *StreamingJobsClient) listByResourceGroupHandleResponse(resp *http.Response) (StreamingJobsListByResourceGroupResponse, error) { + result := StreamingJobsListByResourceGroupResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.StreamingJobListResult); err != nil { + return StreamingJobsListByResourceGroupResponse{}, err + } + return result, nil +} + +// listByResourceGroupHandleError handles the ListByResourceGroup error response. +func (client *StreamingJobsClient) listByResourceGroupHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := Error{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// BeginStart - Starts a streaming job. Once a job is started it will start processing input events and produce output. +// If the operation fails it returns the *Error error type. +func (client *StreamingJobsClient) BeginStart(ctx context.Context, resourceGroupName string, jobName string, options *StreamingJobsBeginStartOptions) (StreamingJobsStartPollerResponse, error) { + resp, err := client.start(ctx, resourceGroupName, jobName, options) + if err != nil { + return StreamingJobsStartPollerResponse{}, err + } + result := StreamingJobsStartPollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("StreamingJobsClient.Start", "", resp, client.pl, client.startHandleError) + if err != nil { + return StreamingJobsStartPollerResponse{}, err + } + result.Poller = &StreamingJobsStartPoller{ + pt: pt, + } + return result, nil +} + +// Start - Starts a streaming job. Once a job is started it will start processing input events and produce output. +// If the operation fails it returns the *Error error type. +func (client *StreamingJobsClient) start(ctx context.Context, resourceGroupName string, jobName string, options *StreamingJobsBeginStartOptions) (*http.Response, error) { + req, err := client.startCreateRequest(ctx, resourceGroupName, jobName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, client.startHandleError(resp) + } + return resp, nil +} + +// startCreateRequest creates the Start request. +func (client *StreamingJobsClient) startCreateRequest(ctx context.Context, resourceGroupName string, jobName string, options *StreamingJobsBeginStartOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/start" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if jobName == "" { + return nil, errors.New("parameter jobName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{jobName}", url.PathEscape(jobName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2017-04-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + if options != nil && options.StartJobParameters != nil { + return req, runtime.MarshalAsJSON(req, *options.StartJobParameters) + } + return req, nil +} + +// startHandleError handles the Start error response. +func (client *StreamingJobsClient) startHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := Error{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// BeginStop - Stops a running streaming job. This will cause a running streaming job to stop processing input events and producing output. +// If the operation fails it returns the *Error error type. +func (client *StreamingJobsClient) BeginStop(ctx context.Context, resourceGroupName string, jobName string, options *StreamingJobsBeginStopOptions) (StreamingJobsStopPollerResponse, error) { + resp, err := client.stop(ctx, resourceGroupName, jobName, options) + if err != nil { + return StreamingJobsStopPollerResponse{}, err + } + result := StreamingJobsStopPollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("StreamingJobsClient.Stop", "", resp, client.pl, client.stopHandleError) + if err != nil { + return StreamingJobsStopPollerResponse{}, err + } + result.Poller = &StreamingJobsStopPoller{ + pt: pt, + } + return result, nil +} + +// Stop - Stops a running streaming job. This will cause a running streaming job to stop processing input events and producing output. +// If the operation fails it returns the *Error error type. +func (client *StreamingJobsClient) stop(ctx context.Context, resourceGroupName string, jobName string, options *StreamingJobsBeginStopOptions) (*http.Response, error) { + req, err := client.stopCreateRequest(ctx, resourceGroupName, jobName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, client.stopHandleError(resp) + } + return resp, nil +} + +// stopCreateRequest creates the Stop request. +func (client *StreamingJobsClient) stopCreateRequest(ctx context.Context, resourceGroupName string, jobName string, options *StreamingJobsBeginStopOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/stop" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if jobName == "" { + return nil, errors.New("parameter jobName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{jobName}", url.PathEscape(jobName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2017-04-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// stopHandleError handles the Stop error response. +func (client *StreamingJobsClient) stopHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := Error{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// 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. +// If the operation fails it returns the *Error error type. +func (client *StreamingJobsClient) Update(ctx context.Context, resourceGroupName string, jobName string, streamingJob StreamingJob, options *StreamingJobsUpdateOptions) (StreamingJobsUpdateResponse, error) { + req, err := client.updateCreateRequest(ctx, resourceGroupName, jobName, streamingJob, options) + if err != nil { + return StreamingJobsUpdateResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return StreamingJobsUpdateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return StreamingJobsUpdateResponse{}, client.updateHandleError(resp) + } + return client.updateHandleResponse(resp) +} + +// updateCreateRequest creates the Update request. +func (client *StreamingJobsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, jobName string, streamingJob StreamingJob, options *StreamingJobsUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if jobName == "" { + return nil, errors.New("parameter jobName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{jobName}", url.PathEscape(jobName)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2017-04-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + if options != nil && options.IfMatch != nil { + req.Raw().Header.Set("If-Match", *options.IfMatch) + } + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, streamingJob) +} + +// updateHandleResponse handles the Update response. +func (client *StreamingJobsClient) updateHandleResponse(resp *http.Response) (StreamingJobsUpdateResponse, error) { + result := StreamingJobsUpdateResponse{RawResponse: resp} + if val := resp.Header.Get("ETag"); val != "" { + result.ETag = &val + } + if err := runtime.UnmarshalAsJSON(resp, &result.StreamingJob); err != nil { + return StreamingJobsUpdateResponse{}, err + } + return result, nil +} + +// updateHandleError handles the Update error response. +func (client *StreamingJobsClient) updateHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := Error{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} diff --git a/sdk/resourcemanager/streamanalytics/armstreamanalytics/zz_generated_subscriptions_client.go b/sdk/resourcemanager/streamanalytics/armstreamanalytics/zz_generated_subscriptions_client.go new file mode 100644 index 000000000000..d1355732818e --- /dev/null +++ b/sdk/resourcemanager/streamanalytics/armstreamanalytics/zz_generated_subscriptions_client.go @@ -0,0 +1,446 @@ +//go:build go1.16 +// +build go1.16 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armstreamanalytics + +import ( + "context" + "errors" + "fmt" + "net/http" + "net/url" + "strings" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" +) + +// SubscriptionsClient contains the methods for the Subscriptions group. +// Don't use this type directly, use NewSubscriptionsClient() instead. +type SubscriptionsClient struct { + ep string + pl runtime.Pipeline + subscriptionID string +} + +// NewSubscriptionsClient creates a new instance of SubscriptionsClient with the specified values. +func NewSubscriptionsClient(con *arm.Connection, subscriptionID string) *SubscriptionsClient { + return &SubscriptionsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +} + +// CompileQuery - Compile the Stream Analytics query. +// If the operation fails it returns the *Error error type. +func (client *SubscriptionsClient) CompileQuery(ctx context.Context, location string, compileQuery CompileQuery, options *SubscriptionsCompileQueryOptions) (SubscriptionsCompileQueryResponse, error) { + req, err := client.compileQueryCreateRequest(ctx, location, compileQuery, options) + if err != nil { + return SubscriptionsCompileQueryResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return SubscriptionsCompileQueryResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return SubscriptionsCompileQueryResponse{}, client.compileQueryHandleError(resp) + } + return client.compileQueryHandleResponse(resp) +} + +// compileQueryCreateRequest creates the CompileQuery request. +func (client *SubscriptionsClient) compileQueryCreateRequest(ctx context.Context, location string, compileQuery CompileQuery, options *SubscriptionsCompileQueryOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.StreamAnalytics/locations/{location}/compileQuery" + if location == "" { + return nil, errors.New("parameter location cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2017-04-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, compileQuery) +} + +// compileQueryHandleResponse handles the CompileQuery response. +func (client *SubscriptionsClient) compileQueryHandleResponse(resp *http.Response) (SubscriptionsCompileQueryResponse, error) { + result := SubscriptionsCompileQueryResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.QueryCompilationResult); err != nil { + return SubscriptionsCompileQueryResponse{}, err + } + return result, nil +} + +// compileQueryHandleError handles the CompileQuery error response. +func (client *SubscriptionsClient) compileQueryHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := Error{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// ListQuotas - Retrieves the subscription's current quota information in a particular region. +// If the operation fails it returns the *Error error type. +func (client *SubscriptionsClient) ListQuotas(ctx context.Context, location string, options *SubscriptionsListQuotasOptions) (SubscriptionsListQuotasResponse, error) { + req, err := client.listQuotasCreateRequest(ctx, location, options) + if err != nil { + return SubscriptionsListQuotasResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return SubscriptionsListQuotasResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return SubscriptionsListQuotasResponse{}, client.listQuotasHandleError(resp) + } + return client.listQuotasHandleResponse(resp) +} + +// listQuotasCreateRequest creates the ListQuotas request. +func (client *SubscriptionsClient) listQuotasCreateRequest(ctx context.Context, location string, options *SubscriptionsListQuotasOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.StreamAnalytics/locations/{location}/quotas" + if location == "" { + return nil, errors.New("parameter location cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2017-04-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// listQuotasHandleResponse handles the ListQuotas response. +func (client *SubscriptionsClient) listQuotasHandleResponse(resp *http.Response) (SubscriptionsListQuotasResponse, error) { + result := SubscriptionsListQuotasResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.SubscriptionQuotasListResult); err != nil { + return SubscriptionsListQuotasResponse{}, err + } + return result, nil +} + +// listQuotasHandleError handles the ListQuotas error response. +func (client *SubscriptionsClient) listQuotasHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := Error{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// BeginSampleInput - Sample the Stream Analytics input data. +// If the operation fails it returns the *Error error type. +func (client *SubscriptionsClient) BeginSampleInput(ctx context.Context, location string, sampleInput SampleInput, options *SubscriptionsBeginSampleInputOptions) (SubscriptionsSampleInputPollerResponse, error) { + resp, err := client.sampleInput(ctx, location, sampleInput, options) + if err != nil { + return SubscriptionsSampleInputPollerResponse{}, err + } + result := SubscriptionsSampleInputPollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("SubscriptionsClient.SampleInput", "location", resp, client.pl, client.sampleInputHandleError) + if err != nil { + return SubscriptionsSampleInputPollerResponse{}, err + } + result.Poller = &SubscriptionsSampleInputPoller{ + pt: pt, + } + return result, nil +} + +// SampleInput - Sample the Stream Analytics input data. +// If the operation fails it returns the *Error error type. +func (client *SubscriptionsClient) sampleInput(ctx context.Context, location string, sampleInput SampleInput, options *SubscriptionsBeginSampleInputOptions) (*http.Response, error) { + req, err := client.sampleInputCreateRequest(ctx, location, sampleInput, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusAccepted) { + return nil, client.sampleInputHandleError(resp) + } + return resp, nil +} + +// sampleInputCreateRequest creates the SampleInput request. +func (client *SubscriptionsClient) sampleInputCreateRequest(ctx context.Context, location string, sampleInput SampleInput, options *SubscriptionsBeginSampleInputOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.StreamAnalytics/locations/{location}/sampleInput" + if location == "" { + return nil, errors.New("parameter location cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2017-04-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, sampleInput) +} + +// sampleInputHandleError handles the SampleInput error response. +func (client *SubscriptionsClient) sampleInputHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := Error{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// BeginTestInput - Test the Stream Analytics input. +// If the operation fails it returns the *Error error type. +func (client *SubscriptionsClient) BeginTestInput(ctx context.Context, location string, testInput TestInput, options *SubscriptionsBeginTestInputOptions) (SubscriptionsTestInputPollerResponse, error) { + resp, err := client.testInput(ctx, location, testInput, options) + if err != nil { + return SubscriptionsTestInputPollerResponse{}, err + } + result := SubscriptionsTestInputPollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("SubscriptionsClient.TestInput", "location", resp, client.pl, client.testInputHandleError) + if err != nil { + return SubscriptionsTestInputPollerResponse{}, err + } + result.Poller = &SubscriptionsTestInputPoller{ + pt: pt, + } + return result, nil +} + +// TestInput - Test the Stream Analytics input. +// If the operation fails it returns the *Error error type. +func (client *SubscriptionsClient) testInput(ctx context.Context, location string, testInput TestInput, options *SubscriptionsBeginTestInputOptions) (*http.Response, error) { + req, err := client.testInputCreateRequest(ctx, location, testInput, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusAccepted) { + return nil, client.testInputHandleError(resp) + } + return resp, nil +} + +// testInputCreateRequest creates the TestInput request. +func (client *SubscriptionsClient) testInputCreateRequest(ctx context.Context, location string, testInput TestInput, options *SubscriptionsBeginTestInputOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.StreamAnalytics/locations/{location}/testInput" + if location == "" { + return nil, errors.New("parameter location cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2017-04-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, testInput) +} + +// testInputHandleError handles the TestInput error response. +func (client *SubscriptionsClient) testInputHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := Error{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// BeginTestOutput - Test the Stream Analytics output. +// If the operation fails it returns the *Error error type. +func (client *SubscriptionsClient) BeginTestOutput(ctx context.Context, location string, testOutput TestOutput, options *SubscriptionsBeginTestOutputOptions) (SubscriptionsTestOutputPollerResponse, error) { + resp, err := client.testOutput(ctx, location, testOutput, options) + if err != nil { + return SubscriptionsTestOutputPollerResponse{}, err + } + result := SubscriptionsTestOutputPollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("SubscriptionsClient.TestOutput", "location", resp, client.pl, client.testOutputHandleError) + if err != nil { + return SubscriptionsTestOutputPollerResponse{}, err + } + result.Poller = &SubscriptionsTestOutputPoller{ + pt: pt, + } + return result, nil +} + +// TestOutput - Test the Stream Analytics output. +// If the operation fails it returns the *Error error type. +func (client *SubscriptionsClient) testOutput(ctx context.Context, location string, testOutput TestOutput, options *SubscriptionsBeginTestOutputOptions) (*http.Response, error) { + req, err := client.testOutputCreateRequest(ctx, location, testOutput, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusAccepted) { + return nil, client.testOutputHandleError(resp) + } + return resp, nil +} + +// testOutputCreateRequest creates the TestOutput request. +func (client *SubscriptionsClient) testOutputCreateRequest(ctx context.Context, location string, testOutput TestOutput, options *SubscriptionsBeginTestOutputOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.StreamAnalytics/locations/{location}/testOutput" + if location == "" { + return nil, errors.New("parameter location cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2017-04-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, testOutput) +} + +// testOutputHandleError handles the TestOutput error response. +func (client *SubscriptionsClient) testOutputHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := Error{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// BeginTestQuery - Test the Stream Analytics query on a sample input. +// If the operation fails it returns the *Error error type. +func (client *SubscriptionsClient) BeginTestQuery(ctx context.Context, location string, testQuery TestQuery, options *SubscriptionsBeginTestQueryOptions) (SubscriptionsTestQueryPollerResponse, error) { + resp, err := client.testQuery(ctx, location, testQuery, options) + if err != nil { + return SubscriptionsTestQueryPollerResponse{}, err + } + result := SubscriptionsTestQueryPollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("SubscriptionsClient.TestQuery", "location", resp, client.pl, client.testQueryHandleError) + if err != nil { + return SubscriptionsTestQueryPollerResponse{}, err + } + result.Poller = &SubscriptionsTestQueryPoller{ + pt: pt, + } + return result, nil +} + +// TestQuery - Test the Stream Analytics query on a sample input. +// If the operation fails it returns the *Error error type. +func (client *SubscriptionsClient) testQuery(ctx context.Context, location string, testQuery TestQuery, options *SubscriptionsBeginTestQueryOptions) (*http.Response, error) { + req, err := client.testQueryCreateRequest(ctx, location, testQuery, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, client.testQueryHandleError(resp) + } + return resp, nil +} + +// testQueryCreateRequest creates the TestQuery request. +func (client *SubscriptionsClient) testQueryCreateRequest(ctx context.Context, location string, testQuery TestQuery, options *SubscriptionsBeginTestQueryOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.StreamAnalytics/locations/{location}/testQuery" + if location == "" { + return nil, errors.New("parameter location cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2017-04-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, testQuery) +} + +// testQueryHandleError handles the TestQuery error response. +func (client *SubscriptionsClient) testQueryHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := Error{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} diff --git a/sdk/resourcemanager/streamanalytics/armstreamanalytics/zz_generated_time_rfc3339.go b/sdk/resourcemanager/streamanalytics/armstreamanalytics/zz_generated_time_rfc3339.go new file mode 100644 index 000000000000..b740116f1050 --- /dev/null +++ b/sdk/resourcemanager/streamanalytics/armstreamanalytics/zz_generated_time_rfc3339.go @@ -0,0 +1,58 @@ +//go:build go1.16 +// +build go1.16 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armstreamanalytics + +import ( + "regexp" + "strings" + "time" +) + +const ( + utcLayoutJSON = `"2006-01-02T15:04:05.999999999"` + utcLayout = "2006-01-02T15:04:05.999999999" + rfc3339JSON = `"` + time.RFC3339Nano + `"` +) + +// Azure reports time in UTC but it doesn't include the 'Z' time zone suffix in some cases. +var tzOffsetRegex = regexp.MustCompile(`(Z|z|\+|-)(\d+:\d+)*"*$`) + +type timeRFC3339 time.Time + +func (t timeRFC3339) MarshalJSON() (json []byte, err error) { + tt := time.Time(t) + return tt.MarshalJSON() +} + +func (t timeRFC3339) MarshalText() (text []byte, err error) { + tt := time.Time(t) + return tt.MarshalText() +} + +func (t *timeRFC3339) UnmarshalJSON(data []byte) error { + layout := utcLayoutJSON + if tzOffsetRegex.Match(data) { + layout = rfc3339JSON + } + return t.Parse(layout, string(data)) +} + +func (t *timeRFC3339) UnmarshalText(data []byte) (err error) { + layout := utcLayout + if tzOffsetRegex.Match(data) { + layout = time.RFC3339Nano + } + return t.Parse(layout, string(data)) +} + +func (t *timeRFC3339) Parse(layout, value string) error { + p, err := time.Parse(layout, strings.ToUpper(value)) + *t = timeRFC3339(p) + return err +} diff --git a/sdk/resourcemanager/streamanalytics/armstreamanalytics/zz_generated_transformations_client.go b/sdk/resourcemanager/streamanalytics/armstreamanalytics/zz_generated_transformations_client.go new file mode 100644 index 000000000000..76337fd06b0d --- /dev/null +++ b/sdk/resourcemanager/streamanalytics/armstreamanalytics/zz_generated_transformations_client.go @@ -0,0 +1,262 @@ +//go:build go1.16 +// +build go1.16 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armstreamanalytics + +import ( + "context" + "errors" + "fmt" + "net/http" + "net/url" + "strings" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" +) + +// TransformationsClient contains the methods for the Transformations group. +// Don't use this type directly, use NewTransformationsClient() instead. +type TransformationsClient struct { + ep string + pl runtime.Pipeline + subscriptionID string +} + +// NewTransformationsClient creates a new instance of TransformationsClient with the specified values. +func NewTransformationsClient(con *arm.Connection, subscriptionID string) *TransformationsClient { + return &TransformationsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +} + +// CreateOrReplace - Creates a transformation or replaces an already existing transformation under an existing streaming job. +// If the operation fails it returns the *Error error type. +func (client *TransformationsClient) CreateOrReplace(ctx context.Context, resourceGroupName string, jobName string, transformationName string, transformation Transformation, options *TransformationsCreateOrReplaceOptions) (TransformationsCreateOrReplaceResponse, error) { + req, err := client.createOrReplaceCreateRequest(ctx, resourceGroupName, jobName, transformationName, transformation, options) + if err != nil { + return TransformationsCreateOrReplaceResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return TransformationsCreateOrReplaceResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return TransformationsCreateOrReplaceResponse{}, client.createOrReplaceHandleError(resp) + } + return client.createOrReplaceHandleResponse(resp) +} + +// createOrReplaceCreateRequest creates the CreateOrReplace request. +func (client *TransformationsClient) createOrReplaceCreateRequest(ctx context.Context, resourceGroupName string, jobName string, transformationName string, transformation Transformation, options *TransformationsCreateOrReplaceOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/transformations/{transformationName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if jobName == "" { + return nil, errors.New("parameter jobName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{jobName}", url.PathEscape(jobName)) + if transformationName == "" { + return nil, errors.New("parameter transformationName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{transformationName}", url.PathEscape(transformationName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2017-04-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + if options != nil && options.IfMatch != nil { + req.Raw().Header.Set("If-Match", *options.IfMatch) + } + if options != nil && options.IfNoneMatch != nil { + req.Raw().Header.Set("If-None-Match", *options.IfNoneMatch) + } + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, transformation) +} + +// createOrReplaceHandleResponse handles the CreateOrReplace response. +func (client *TransformationsClient) createOrReplaceHandleResponse(resp *http.Response) (TransformationsCreateOrReplaceResponse, error) { + result := TransformationsCreateOrReplaceResponse{RawResponse: resp} + if val := resp.Header.Get("ETag"); val != "" { + result.ETag = &val + } + if err := runtime.UnmarshalAsJSON(resp, &result.Transformation); err != nil { + return TransformationsCreateOrReplaceResponse{}, err + } + return result, nil +} + +// createOrReplaceHandleError handles the CreateOrReplace error response. +func (client *TransformationsClient) createOrReplaceHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := Error{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// Get - Gets details about the specified transformation. +// If the operation fails it returns the *Error error type. +func (client *TransformationsClient) Get(ctx context.Context, resourceGroupName string, jobName string, transformationName string, options *TransformationsGetOptions) (TransformationsGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, jobName, transformationName, options) + if err != nil { + return TransformationsGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return TransformationsGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return TransformationsGetResponse{}, client.getHandleError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *TransformationsClient) getCreateRequest(ctx context.Context, resourceGroupName string, jobName string, transformationName string, options *TransformationsGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/transformations/{transformationName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if jobName == "" { + return nil, errors.New("parameter jobName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{jobName}", url.PathEscape(jobName)) + if transformationName == "" { + return nil, errors.New("parameter transformationName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{transformationName}", url.PathEscape(transformationName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2017-04-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *TransformationsClient) getHandleResponse(resp *http.Response) (TransformationsGetResponse, error) { + result := TransformationsGetResponse{RawResponse: resp} + if val := resp.Header.Get("ETag"); val != "" { + result.ETag = &val + } + if err := runtime.UnmarshalAsJSON(resp, &result.Transformation); err != nil { + return TransformationsGetResponse{}, err + } + return result, nil +} + +// getHandleError handles the Get error response. +func (client *TransformationsClient) getHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := Error{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// 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. +// If the operation fails it returns the *Error error type. +func (client *TransformationsClient) Update(ctx context.Context, resourceGroupName string, jobName string, transformationName string, transformation Transformation, options *TransformationsUpdateOptions) (TransformationsUpdateResponse, error) { + req, err := client.updateCreateRequest(ctx, resourceGroupName, jobName, transformationName, transformation, options) + if err != nil { + return TransformationsUpdateResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return TransformationsUpdateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return TransformationsUpdateResponse{}, client.updateHandleError(resp) + } + return client.updateHandleResponse(resp) +} + +// updateCreateRequest creates the Update request. +func (client *TransformationsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, jobName string, transformationName string, transformation Transformation, options *TransformationsUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/transformations/{transformationName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if jobName == "" { + return nil, errors.New("parameter jobName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{jobName}", url.PathEscape(jobName)) + if transformationName == "" { + return nil, errors.New("parameter transformationName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{transformationName}", url.PathEscape(transformationName)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2017-04-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + if options != nil && options.IfMatch != nil { + req.Raw().Header.Set("If-Match", *options.IfMatch) + } + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, transformation) +} + +// updateHandleResponse handles the Update response. +func (client *TransformationsClient) updateHandleResponse(resp *http.Response) (TransformationsUpdateResponse, error) { + result := TransformationsUpdateResponse{RawResponse: resp} + if val := resp.Header.Get("ETag"); val != "" { + result.ETag = &val + } + if err := runtime.UnmarshalAsJSON(resp, &result.Transformation); err != nil { + return TransformationsUpdateResponse{}, err + } + return result, nil +} + +// updateHandleError handles the Update error response. +func (client *TransformationsClient) updateHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := Error{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +}