From 6b423d8ba6ff60c83eef95107262366a5d2b643f Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Tue, 17 Nov 2020 09:49:23 +0000 Subject: [PATCH] CodeGen from PR 11649 in Azure/azure-rest-api-specs Microsoft.OperationalInsights: Updating property name + Adding a new resource (#11649) * Updating property name. * example update. * Adding force cmk to workspace. * Adding default error response. * Removing redundant examples. * adding workspace capping to example per code review request. * Per review request. Co-authored-by: Dudi Likvornik --- .../operationalinsights/client.go | 52 + .../operationalinsights/clusters.go | 596 +++++++++ .../operationalinsights/dataexport.go | 433 +++++++ .../operationalinsights/enums.go | 99 ++ .../operationalinsights/linkedservices.go | 385 ++++++ .../linkedstorageaccounts.go | 388 ++++++ .../operationalinsights/models.go | 1152 +++++++++++++++++ .../operationalinsightsapi/interfaces.go | 69 + .../operationalinsights/version.go | 30 + 9 files changed, 3204 insertions(+) create mode 100644 services/preview/operationalinsights/mgmt/2019-08-01-preview/operationalinsights/client.go create mode 100644 services/preview/operationalinsights/mgmt/2019-08-01-preview/operationalinsights/clusters.go create mode 100644 services/preview/operationalinsights/mgmt/2019-08-01-preview/operationalinsights/dataexport.go create mode 100644 services/preview/operationalinsights/mgmt/2019-08-01-preview/operationalinsights/enums.go create mode 100644 services/preview/operationalinsights/mgmt/2019-08-01-preview/operationalinsights/linkedservices.go create mode 100644 services/preview/operationalinsights/mgmt/2019-08-01-preview/operationalinsights/linkedstorageaccounts.go create mode 100644 services/preview/operationalinsights/mgmt/2019-08-01-preview/operationalinsights/models.go create mode 100644 services/preview/operationalinsights/mgmt/2019-08-01-preview/operationalinsights/operationalinsightsapi/interfaces.go create mode 100644 services/preview/operationalinsights/mgmt/2019-08-01-preview/operationalinsights/version.go diff --git a/services/preview/operationalinsights/mgmt/2019-08-01-preview/operationalinsights/client.go b/services/preview/operationalinsights/mgmt/2019-08-01-preview/operationalinsights/client.go new file mode 100644 index 000000000000..087b196c83d9 --- /dev/null +++ b/services/preview/operationalinsights/mgmt/2019-08-01-preview/operationalinsights/client.go @@ -0,0 +1,52 @@ +// Package operationalinsights implements the Azure ARM Operationalinsights service API version 2019-08-01-preview. +// +// Operational Insights Client +package operationalinsights + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" +) + +const ( + // DefaultBaseURI is the default URI used for the service Operationalinsights + DefaultBaseURI = "https://management.azure.com" +) + +// BaseClient is the base client for Operationalinsights. +type BaseClient struct { + autorest.Client + BaseURI string + SubscriptionID string +} + +// New creates an instance of the BaseClient client. +func New(subscriptionID string) BaseClient { + return NewWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewWithBaseURI creates an instance of the BaseClient client using a custom endpoint. Use this when interacting with +// an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient { + return BaseClient{ + Client: autorest.NewClientWithUserAgent(UserAgent()), + BaseURI: baseURI, + SubscriptionID: subscriptionID, + } +} diff --git a/services/preview/operationalinsights/mgmt/2019-08-01-preview/operationalinsights/clusters.go b/services/preview/operationalinsights/mgmt/2019-08-01-preview/operationalinsights/clusters.go new file mode 100644 index 000000000000..973dc37cd915 --- /dev/null +++ b/services/preview/operationalinsights/mgmt/2019-08-01-preview/operationalinsights/clusters.go @@ -0,0 +1,596 @@ +package operationalinsights + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// ClustersClient is the operational Insights Client +type ClustersClient struct { + BaseClient +} + +// NewClustersClient creates an instance of the ClustersClient client. +func NewClustersClient(subscriptionID string) ClustersClient { + return NewClustersClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewClustersClientWithBaseURI creates an instance of the ClustersClient client using a custom endpoint. Use this +// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewClustersClientWithBaseURI(baseURI string, subscriptionID string) ClustersClient { + return ClustersClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate create or update a Log Analytics cluster. +// Parameters: +// resourceGroupName - the resource group name of the Log Analytics cluster. +// clusterName - the name of the Log Analytics cluster. +// parameters - the parameters required to create or update a Log Analytics cluster. +func (client ClustersClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, clusterName string, parameters Cluster) (result ClustersCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ClustersClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: clusterName, + Constraints: []validation.Constraint{{Target: "clusterName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "clusterName", Name: validation.MinLength, Rule: 4, Chain: nil}, + {Target: "clusterName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("operationalinsights.ClustersClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, clusterName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "operationalinsights.ClustersClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "operationalinsights.ClustersClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client ClustersClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, clusterName string, parameters Cluster) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-08-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/clusters/{clusterName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client ClustersClient) CreateOrUpdateSender(req *http.Request) (future ClustersCreateOrUpdateFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client ClustersClient) CreateOrUpdateResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// Delete deletes a cluster instance. +// Parameters: +// resourceGroupName - the resource group name of the Log Analytics cluster. +// clusterName - name of the Log Analytics Cluster. +func (client ClustersClient) Delete(ctx context.Context, resourceGroupName string, clusterName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ClustersClient.Delete") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, resourceGroupName, clusterName) + if err != nil { + err = autorest.NewErrorWithError(err, "operationalinsights.ClustersClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "operationalinsights.ClustersClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "operationalinsights.ClustersClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client ClustersClient) DeletePreparer(ctx context.Context, resourceGroupName string, clusterName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-08-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/clusters/{clusterName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client ClustersClient) DeleteSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client ClustersClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets a Log Analytics cluster instance. +// Parameters: +// resourceGroupName - the resource group name of the Log Analytics cluster. +// clusterName - name of the Log Analytics Cluster. +func (client ClustersClient) Get(ctx context.Context, resourceGroupName string, clusterName string) (result Cluster, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ClustersClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, clusterName) + if err != nil { + err = autorest.NewErrorWithError(err, "operationalinsights.ClustersClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "operationalinsights.ClustersClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "operationalinsights.ClustersClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client ClustersClient) GetPreparer(ctx context.Context, resourceGroupName string, clusterName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-08-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/clusters/{clusterName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client ClustersClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ClustersClient) GetResponder(resp *http.Response) (result Cluster, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List gets the Log Analytics clusters in a subscription. +func (client ClustersClient) List(ctx context.Context) (result ClusterListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ClustersClient.List") + defer func() { + sc := -1 + if result.clr.Response.Response != nil { + sc = result.clr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "operationalinsights.ClustersClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.clr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "operationalinsights.ClustersClient", "List", resp, "Failure sending request") + return + } + + result.clr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "operationalinsights.ClustersClient", "List", resp, "Failure responding to request") + } + if result.clr.hasNextLink() && result.clr.IsEmpty() { + err = result.NextWithContext(ctx) + } + + return +} + +// ListPreparer prepares the List request. +func (client ClustersClient) ListPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-08-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.OperationalInsights/clusters", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client ClustersClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client ClustersClient) ListResponder(resp *http.Response) (result ClusterListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client ClustersClient) listNextResults(ctx context.Context, lastResults ClusterListResult) (result ClusterListResult, err error) { + req, err := lastResults.clusterListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "operationalinsights.ClustersClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "operationalinsights.ClustersClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "operationalinsights.ClustersClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client ClustersClient) ListComplete(ctx context.Context) (result ClusterListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ClustersClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx) + return +} + +// ListByResourceGroup gets Log Analytics clusters in a resource group. +// Parameters: +// resourceGroupName - the name of the resource group to get. The name is case insensitive. +func (client ClustersClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result ClusterListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ClustersClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.clr.Response.Response != nil { + sc = result.clr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("operationalinsights.ClustersClient", "ListByResourceGroup", err.Error()) + } + + result.fn = client.listByResourceGroupNextResults + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "operationalinsights.ClustersClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.clr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "operationalinsights.ClustersClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result.clr, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "operationalinsights.ClustersClient", "ListByResourceGroup", resp, "Failure responding to request") + } + if result.clr.hasNextLink() && result.clr.IsEmpty() { + err = result.NextWithContext(ctx) + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client ClustersClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-08-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/clusters", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client ClustersClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (client ClustersClient) ListByResourceGroupResponder(resp *http.Response) (result ClusterListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByResourceGroupNextResults retrieves the next set of results, if any. +func (client ClustersClient) listByResourceGroupNextResults(ctx context.Context, lastResults ClusterListResult) (result ClusterListResult, err error) { + req, err := lastResults.clusterListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "operationalinsights.ClustersClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "operationalinsights.ClustersClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "operationalinsights.ClustersClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. +func (client ClustersClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result ClusterListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ClustersClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByResourceGroup(ctx, resourceGroupName) + return +} + +// Update updates a Log Analytics cluster. +// Parameters: +// resourceGroupName - the resource group name of the cluster. +// clusterName - the name of the cluster. +// parameters - the parameters required to patch a Log Analytics cluster. +func (client ClustersClient) Update(ctx context.Context, resourceGroupName string, clusterName string, parameters ClusterPatch) (result Cluster, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ClustersClient.Update") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: clusterName, + Constraints: []validation.Constraint{{Target: "clusterName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "clusterName", Name: validation.MinLength, Rule: 4, Chain: nil}, + {Target: "clusterName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("operationalinsights.ClustersClient", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, resourceGroupName, clusterName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "operationalinsights.ClustersClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "operationalinsights.ClustersClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "operationalinsights.ClustersClient", "Update", resp, "Failure responding to request") + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client ClustersClient) UpdatePreparer(ctx context.Context, resourceGroupName string, clusterName string, parameters ClusterPatch) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-08-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/clusters/{clusterName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client ClustersClient) UpdateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client ClustersClient) UpdateResponder(resp *http.Response) (result Cluster, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/operationalinsights/mgmt/2019-08-01-preview/operationalinsights/dataexport.go b/services/preview/operationalinsights/mgmt/2019-08-01-preview/operationalinsights/dataexport.go new file mode 100644 index 000000000000..712494e643cc --- /dev/null +++ b/services/preview/operationalinsights/mgmt/2019-08-01-preview/operationalinsights/dataexport.go @@ -0,0 +1,433 @@ +package operationalinsights + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// DataExportClient is the operational Insights Client +type DataExportClient struct { + BaseClient +} + +// NewDataExportClient creates an instance of the DataExportClient client. +func NewDataExportClient(subscriptionID string) DataExportClient { + return NewDataExportClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewDataExportClientWithBaseURI creates an instance of the DataExportClient client using a custom endpoint. Use this +// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewDataExportClientWithBaseURI(baseURI string, subscriptionID string) DataExportClient { + return DataExportClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate create or update a data export. +// Parameters: +// resourceGroupName - the name of the resource group to get. The name is case insensitive. +// workspaceName - the Log Analytics workspace name. +// dataExportName - the data export rule name. +// parameters - the parameters required to create or update a data export. +func (client DataExportClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, dataExportName string, parameters DataExport) (result DataExportCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DataExportClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: dataExportName, + Constraints: []validation.Constraint{{Target: "dataExportName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "dataExportName", Name: validation.MinLength, Rule: 4, Chain: nil}, + {Target: "dataExportName", Name: validation.Pattern, Rule: `^[A-Za-z][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}}, + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.DataExportProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.DataExportProperties.Destination", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.DataExportProperties.Destination.ResourceID", Name: validation.Null, Rule: true, Chain: nil}}}, + }}}}}); err != nil { + return result, validation.NewError("operationalinsights.DataExportClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, workspaceName, dataExportName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "operationalinsights.DataExportClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "operationalinsights.DataExportClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client DataExportClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, workspaceName string, dataExportName string, parameters DataExport) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "dataExportName": autorest.Encode("path", dataExportName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2019-08-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/dataExports/{dataExportName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client DataExportClient) CreateOrUpdateSender(req *http.Request) (future DataExportCreateOrUpdateFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client DataExportClient) CreateOrUpdateResponder(resp *http.Response) (result DataExport, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes the specified data export in a given workspace.. +// Parameters: +// resourceGroupName - the name of the resource group to get. The name is case insensitive. +// workspaceName - the Log Analytics workspace name. +// dataExportName - the data export rule name. +func (client DataExportClient) Delete(ctx context.Context, resourceGroupName string, workspaceName string, dataExportName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DataExportClient.Delete") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("operationalinsights.DataExportClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, workspaceName, dataExportName) + if err != nil { + err = autorest.NewErrorWithError(err, "operationalinsights.DataExportClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "operationalinsights.DataExportClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "operationalinsights.DataExportClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client DataExportClient) DeletePreparer(ctx context.Context, resourceGroupName string, workspaceName string, dataExportName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "dataExportName": autorest.Encode("path", dataExportName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2019-08-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/dataExports/{dataExportName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client DataExportClient) DeleteSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client DataExportClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNotFound), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets a data export instance. +// Parameters: +// resourceGroupName - the name of the resource group to get. The name is case insensitive. +// workspaceName - the Log Analytics workspace name. +// dataExportName - the data export rule name. +func (client DataExportClient) Get(ctx context.Context, resourceGroupName string, workspaceName string, dataExportName string) (result DataExport, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DataExportClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("operationalinsights.DataExportClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, workspaceName, dataExportName) + if err != nil { + err = autorest.NewErrorWithError(err, "operationalinsights.DataExportClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "operationalinsights.DataExportClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "operationalinsights.DataExportClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client DataExportClient) GetPreparer(ctx context.Context, resourceGroupName string, workspaceName string, dataExportName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "dataExportName": autorest.Encode("path", dataExportName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2019-08-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/dataExports/{dataExportName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client DataExportClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client DataExportClient) GetResponder(resp *http.Response) (result DataExport, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNotFound), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByWorkspace lists the data export instances within a workspace. +// Parameters: +// resourceGroupName - the name of the resource group to get. The name is case insensitive. +// workspaceName - the Log Analytics workspace name. +func (client DataExportClient) ListByWorkspace(ctx context.Context, resourceGroupName string, workspaceName string) (result DataExportListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DataExportClient.ListByWorkspace") + defer func() { + sc := -1 + if result.delr.Response.Response != nil { + sc = result.delr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("operationalinsights.DataExportClient", "ListByWorkspace", err.Error()) + } + + result.fn = client.listByWorkspaceNextResults + req, err := client.ListByWorkspacePreparer(ctx, resourceGroupName, workspaceName) + if err != nil { + err = autorest.NewErrorWithError(err, "operationalinsights.DataExportClient", "ListByWorkspace", nil, "Failure preparing request") + return + } + + resp, err := client.ListByWorkspaceSender(req) + if err != nil { + result.delr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "operationalinsights.DataExportClient", "ListByWorkspace", resp, "Failure sending request") + return + } + + result.delr, err = client.ListByWorkspaceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "operationalinsights.DataExportClient", "ListByWorkspace", resp, "Failure responding to request") + } + if result.delr.hasNextLink() && result.delr.IsEmpty() { + err = result.NextWithContext(ctx) + } + + return +} + +// ListByWorkspacePreparer prepares the ListByWorkspace request. +func (client DataExportClient) ListByWorkspacePreparer(ctx context.Context, resourceGroupName string, workspaceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2019-08-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/dataExports", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByWorkspaceSender sends the ListByWorkspace request. The method will close the +// http.Response Body if it receives an error. +func (client DataExportClient) ListByWorkspaceSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByWorkspaceResponder handles the response to the ListByWorkspace request. The method always +// closes the http.Response Body. +func (client DataExportClient) ListByWorkspaceResponder(resp *http.Response) (result DataExportListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByWorkspaceNextResults retrieves the next set of results, if any. +func (client DataExportClient) listByWorkspaceNextResults(ctx context.Context, lastResults DataExportListResult) (result DataExportListResult, err error) { + req, err := lastResults.dataExportListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "operationalinsights.DataExportClient", "listByWorkspaceNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByWorkspaceSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "operationalinsights.DataExportClient", "listByWorkspaceNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByWorkspaceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "operationalinsights.DataExportClient", "listByWorkspaceNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByWorkspaceComplete enumerates all values, automatically crossing page boundaries as required. +func (client DataExportClient) ListByWorkspaceComplete(ctx context.Context, resourceGroupName string, workspaceName string) (result DataExportListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DataExportClient.ListByWorkspace") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByWorkspace(ctx, resourceGroupName, workspaceName) + return +} diff --git a/services/preview/operationalinsights/mgmt/2019-08-01-preview/operationalinsights/enums.go b/services/preview/operationalinsights/mgmt/2019-08-01-preview/operationalinsights/enums.go new file mode 100644 index 000000000000..be54ca1319ea --- /dev/null +++ b/services/preview/operationalinsights/mgmt/2019-08-01-preview/operationalinsights/enums.go @@ -0,0 +1,99 @@ +package operationalinsights + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// DataSourceType enumerates the values for data source type. +type DataSourceType string + +const ( + // AzureWatson ... + AzureWatson DataSourceType = "AzureWatson" + // CustomLogs ... + CustomLogs DataSourceType = "CustomLogs" +) + +// PossibleDataSourceTypeValues returns an array of possible values for the DataSourceType const type. +func PossibleDataSourceTypeValues() []DataSourceType { + return []DataSourceType{AzureWatson, CustomLogs} +} + +// EntityStatus enumerates the values for entity status. +type EntityStatus string + +const ( + // Canceled ... + Canceled EntityStatus = "Canceled" + // Creating ... + Creating EntityStatus = "Creating" + // Deleting ... + Deleting EntityStatus = "Deleting" + // Failed ... + Failed EntityStatus = "Failed" + // ProvisioningAccount ... + ProvisioningAccount EntityStatus = "ProvisioningAccount" + // Succeeded ... + Succeeded EntityStatus = "Succeeded" +) + +// PossibleEntityStatusValues returns an array of possible values for the EntityStatus const type. +func PossibleEntityStatusValues() []EntityStatus { + return []EntityStatus{Canceled, Creating, Deleting, Failed, ProvisioningAccount, Succeeded} +} + +// IdentityType enumerates the values for identity type. +type IdentityType string + +const ( + // None ... + None IdentityType = "None" + // SystemAssigned ... + SystemAssigned IdentityType = "SystemAssigned" +) + +// PossibleIdentityTypeValues returns an array of possible values for the IdentityType const type. +func PossibleIdentityTypeValues() []IdentityType { + return []IdentityType{None, SystemAssigned} +} + +// SkuNameEnum enumerates the values for sku name enum. +type SkuNameEnum string + +const ( + // CapacityReservation ... + CapacityReservation SkuNameEnum = "CapacityReservation" +) + +// PossibleSkuNameEnumValues returns an array of possible values for the SkuNameEnum const type. +func PossibleSkuNameEnumValues() []SkuNameEnum { + return []SkuNameEnum{CapacityReservation} +} + +// Type enumerates the values for type. +type Type string + +const ( + // EventHub ... + EventHub Type = "EventHub" + // StorageAccount ... + StorageAccount Type = "StorageAccount" +) + +// PossibleTypeValues returns an array of possible values for the Type const type. +func PossibleTypeValues() []Type { + return []Type{EventHub, StorageAccount} +} diff --git a/services/preview/operationalinsights/mgmt/2019-08-01-preview/operationalinsights/linkedservices.go b/services/preview/operationalinsights/mgmt/2019-08-01-preview/operationalinsights/linkedservices.go new file mode 100644 index 000000000000..d58dedc366ba --- /dev/null +++ b/services/preview/operationalinsights/mgmt/2019-08-01-preview/operationalinsights/linkedservices.go @@ -0,0 +1,385 @@ +package operationalinsights + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// LinkedServicesClient is the operational Insights Client +type LinkedServicesClient struct { + BaseClient +} + +// NewLinkedServicesClient creates an instance of the LinkedServicesClient client. +func NewLinkedServicesClient(subscriptionID string) LinkedServicesClient { + return NewLinkedServicesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewLinkedServicesClientWithBaseURI creates an instance of the LinkedServicesClient client using a custom endpoint. +// Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewLinkedServicesClientWithBaseURI(baseURI string, subscriptionID string) LinkedServicesClient { + return LinkedServicesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate create or update a linked service. +// Parameters: +// resourceGroupName - the name of the resource group to get. The name is case insensitive. +// workspaceName - name of the Log Analytics Workspace that will contain the linkedServices resource +// linkedServiceName - name of the linkedServices resource +// parameters - the parameters required to create or update a linked service. +func (client LinkedServicesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, linkedServiceName string, parameters LinkedService) (result LinkedService, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/LinkedServicesClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.LinkedServiceProperties", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("operationalinsights.LinkedServicesClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, workspaceName, linkedServiceName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "operationalinsights.LinkedServicesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "operationalinsights.LinkedServicesClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "operationalinsights.LinkedServicesClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client LinkedServicesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, workspaceName string, linkedServiceName string, parameters LinkedService) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "linkedServiceName": autorest.Encode("path", linkedServiceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2019-08-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/linkedServices/{linkedServiceName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client LinkedServicesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client LinkedServicesClient) CreateOrUpdateResponder(resp *http.Response) (result LinkedService, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes a linked service instance. +// Parameters: +// resourceGroupName - the name of the resource group to get. The name is case insensitive. +// workspaceName - name of the Log Analytics Workspace that contains the linkedServices resource +// linkedServiceName - name of the linked service. +func (client LinkedServicesClient) Delete(ctx context.Context, resourceGroupName string, workspaceName string, linkedServiceName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/LinkedServicesClient.Delete") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("operationalinsights.LinkedServicesClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, workspaceName, linkedServiceName) + if err != nil { + err = autorest.NewErrorWithError(err, "operationalinsights.LinkedServicesClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "operationalinsights.LinkedServicesClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "operationalinsights.LinkedServicesClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client LinkedServicesClient) DeletePreparer(ctx context.Context, resourceGroupName string, workspaceName string, linkedServiceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "linkedServiceName": autorest.Encode("path", linkedServiceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2019-08-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/linkedServices/{linkedServiceName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client LinkedServicesClient) DeleteSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client LinkedServicesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets a linked service instance. +// Parameters: +// resourceGroupName - the name of the resource group to get. The name is case insensitive. +// workspaceName - name of the Log Analytics Workspace that contains the linkedServices resource +// linkedServiceName - name of the linked service. +func (client LinkedServicesClient) Get(ctx context.Context, resourceGroupName string, workspaceName string, linkedServiceName string) (result LinkedService, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/LinkedServicesClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("operationalinsights.LinkedServicesClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, workspaceName, linkedServiceName) + if err != nil { + err = autorest.NewErrorWithError(err, "operationalinsights.LinkedServicesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "operationalinsights.LinkedServicesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "operationalinsights.LinkedServicesClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client LinkedServicesClient) GetPreparer(ctx context.Context, resourceGroupName string, workspaceName string, linkedServiceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "linkedServiceName": autorest.Encode("path", linkedServiceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2019-08-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/linkedServices/{linkedServiceName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client LinkedServicesClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client LinkedServicesClient) GetResponder(resp *http.Response) (result LinkedService, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByWorkspace gets the linked services instances in a workspace. +// Parameters: +// resourceGroupName - the name of the resource group to get. The name is case insensitive. +// workspaceName - name of the Log Analytics Workspace that contains the linked services. +func (client LinkedServicesClient) ListByWorkspace(ctx context.Context, resourceGroupName string, workspaceName string) (result LinkedServiceListResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/LinkedServicesClient.ListByWorkspace") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("operationalinsights.LinkedServicesClient", "ListByWorkspace", err.Error()) + } + + req, err := client.ListByWorkspacePreparer(ctx, resourceGroupName, workspaceName) + if err != nil { + err = autorest.NewErrorWithError(err, "operationalinsights.LinkedServicesClient", "ListByWorkspace", nil, "Failure preparing request") + return + } + + resp, err := client.ListByWorkspaceSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "operationalinsights.LinkedServicesClient", "ListByWorkspace", resp, "Failure sending request") + return + } + + result, err = client.ListByWorkspaceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "operationalinsights.LinkedServicesClient", "ListByWorkspace", resp, "Failure responding to request") + } + + return +} + +// ListByWorkspacePreparer prepares the ListByWorkspace request. +func (client LinkedServicesClient) ListByWorkspacePreparer(ctx context.Context, resourceGroupName string, workspaceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2019-08-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/linkedServices", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByWorkspaceSender sends the ListByWorkspace request. The method will close the +// http.Response Body if it receives an error. +func (client LinkedServicesClient) ListByWorkspaceSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByWorkspaceResponder handles the response to the ListByWorkspace request. The method always +// closes the http.Response Body. +func (client LinkedServicesClient) ListByWorkspaceResponder(resp *http.Response) (result LinkedServiceListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/operationalinsights/mgmt/2019-08-01-preview/operationalinsights/linkedstorageaccounts.go b/services/preview/operationalinsights/mgmt/2019-08-01-preview/operationalinsights/linkedstorageaccounts.go new file mode 100644 index 000000000000..72188c86af9a --- /dev/null +++ b/services/preview/operationalinsights/mgmt/2019-08-01-preview/operationalinsights/linkedstorageaccounts.go @@ -0,0 +1,388 @@ +package operationalinsights + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// LinkedStorageAccountsClient is the operational Insights Client +type LinkedStorageAccountsClient struct { + BaseClient +} + +// NewLinkedStorageAccountsClient creates an instance of the LinkedStorageAccountsClient client. +func NewLinkedStorageAccountsClient(subscriptionID string) LinkedStorageAccountsClient { + return NewLinkedStorageAccountsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewLinkedStorageAccountsClientWithBaseURI creates an instance of the LinkedStorageAccountsClient client using a +// custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, +// Azure stack). +func NewLinkedStorageAccountsClientWithBaseURI(baseURI string, subscriptionID string) LinkedStorageAccountsClient { + return LinkedStorageAccountsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate create or Update a link relation between current workspace and a group of storage accounts of a +// specific data source type. +// Parameters: +// resourceGroupName - the name of the resource group to get. The name is case insensitive. +// workspaceName - name of the Log Analytics Workspace that will contain the resource. +// dataSourceType - linked storage accounts type. +// parameters - the parameters required to create or update linked storage accounts. +func (client LinkedStorageAccountsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, dataSourceType DataSourceType, parameters LinkedStorageAccounts) (result LinkedStorageAccounts, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/LinkedStorageAccountsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.LinkedStorageAccountsProperties", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("operationalinsights.LinkedStorageAccountsClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, workspaceName, dataSourceType, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "operationalinsights.LinkedStorageAccountsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "operationalinsights.LinkedStorageAccountsClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "operationalinsights.LinkedStorageAccountsClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client LinkedStorageAccountsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, workspaceName string, dataSourceType DataSourceType, parameters LinkedStorageAccounts) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "dataSourceType": autorest.Encode("path", dataSourceType), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2019-08-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/linkedStorageAccounts/{dataSourceType}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client LinkedStorageAccountsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client LinkedStorageAccountsClient) CreateOrUpdateResponder(resp *http.Response) (result LinkedStorageAccounts, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes all linked storage accounts of a specific data source type associated with the specified workspace. +// Parameters: +// resourceGroupName - the name of the resource group to get. The name is case insensitive. +// workspaceName - name of the Log Analytics Workspace that will contain the resource. +// dataSourceType - linked storage accounts type. +func (client LinkedStorageAccountsClient) Delete(ctx context.Context, resourceGroupName string, workspaceName string, dataSourceType DataSourceType) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/LinkedStorageAccountsClient.Delete") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("operationalinsights.LinkedStorageAccountsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, workspaceName, dataSourceType) + if err != nil { + err = autorest.NewErrorWithError(err, "operationalinsights.LinkedStorageAccountsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "operationalinsights.LinkedStorageAccountsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "operationalinsights.LinkedStorageAccountsClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client LinkedStorageAccountsClient) DeletePreparer(ctx context.Context, resourceGroupName string, workspaceName string, dataSourceType DataSourceType) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "dataSourceType": autorest.Encode("path", dataSourceType), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2019-08-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/linkedStorageAccounts/{dataSourceType}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client LinkedStorageAccountsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client LinkedStorageAccountsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets all linked storage account of a specific data source type associated with the specified workspace. +// Parameters: +// resourceGroupName - the name of the resource group to get. The name is case insensitive. +// workspaceName - name of the Log Analytics Workspace that will contain the resource. +// dataSourceType - linked storage accounts type. +func (client LinkedStorageAccountsClient) Get(ctx context.Context, resourceGroupName string, workspaceName string, dataSourceType DataSourceType) (result LinkedStorageAccounts, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/LinkedStorageAccountsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("operationalinsights.LinkedStorageAccountsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, workspaceName, dataSourceType) + if err != nil { + err = autorest.NewErrorWithError(err, "operationalinsights.LinkedStorageAccountsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "operationalinsights.LinkedStorageAccountsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "operationalinsights.LinkedStorageAccountsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client LinkedStorageAccountsClient) GetPreparer(ctx context.Context, resourceGroupName string, workspaceName string, dataSourceType DataSourceType) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "dataSourceType": autorest.Encode("path", dataSourceType), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2019-08-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/linkedStorageAccounts/{dataSourceType}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client LinkedStorageAccountsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client LinkedStorageAccountsClient) GetResponder(resp *http.Response) (result LinkedStorageAccounts, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByWorkspace gets all linked storage accounts associated with the specified workspace, storage accounts will be +// sorted by their data source type. +// Parameters: +// resourceGroupName - the name of the resource group to get. The name is case insensitive. +// workspaceName - name of the Log Analytics Workspace that will contain the resource. +func (client LinkedStorageAccountsClient) ListByWorkspace(ctx context.Context, resourceGroupName string, workspaceName string) (result LinkedStorageAccountsListResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/LinkedStorageAccountsClient.ListByWorkspace") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("operationalinsights.LinkedStorageAccountsClient", "ListByWorkspace", err.Error()) + } + + req, err := client.ListByWorkspacePreparer(ctx, resourceGroupName, workspaceName) + if err != nil { + err = autorest.NewErrorWithError(err, "operationalinsights.LinkedStorageAccountsClient", "ListByWorkspace", nil, "Failure preparing request") + return + } + + resp, err := client.ListByWorkspaceSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "operationalinsights.LinkedStorageAccountsClient", "ListByWorkspace", resp, "Failure sending request") + return + } + + result, err = client.ListByWorkspaceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "operationalinsights.LinkedStorageAccountsClient", "ListByWorkspace", resp, "Failure responding to request") + } + + return +} + +// ListByWorkspacePreparer prepares the ListByWorkspace request. +func (client LinkedStorageAccountsClient) ListByWorkspacePreparer(ctx context.Context, resourceGroupName string, workspaceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2019-08-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/linkedStorageAccounts", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByWorkspaceSender sends the ListByWorkspace request. The method will close the +// http.Response Body if it receives an error. +func (client LinkedStorageAccountsClient) ListByWorkspaceSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByWorkspaceResponder handles the response to the ListByWorkspace request. The method always +// closes the http.Response Body. +func (client LinkedStorageAccountsClient) ListByWorkspaceResponder(resp *http.Response) (result LinkedStorageAccountsListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/operationalinsights/mgmt/2019-08-01-preview/operationalinsights/models.go b/services/preview/operationalinsights/mgmt/2019-08-01-preview/operationalinsights/models.go new file mode 100644 index 000000000000..6ef0b2b92ec1 --- /dev/null +++ b/services/preview/operationalinsights/mgmt/2019-08-01-preview/operationalinsights/models.go @@ -0,0 +1,1152 @@ +package operationalinsights + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "encoding/json" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/to" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// The package's fully qualified name. +const fqdn = "github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2019-08-01-preview/operationalinsights" + +// Cluster the top level Log Analytics cluster resource container. +type Cluster struct { + autorest.Response `json:"-"` + // Identity - The identity of the resource. + Identity *Identity `json:"identity,omitempty"` + // Sku - The sku properties. + Sku *Sku `json:"sku,omitempty"` + // ClusterProperties - Log Analytics cluster properties. + *ClusterProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type + Type *string `json:"type,omitempty"` + // Location - Resource location + Location *string `json:"location,omitempty"` + // Tags - Resource tags + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for Cluster. +func (c Cluster) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if c.Identity != nil { + objectMap["identity"] = c.Identity + } + if c.Sku != nil { + objectMap["sku"] = c.Sku + } + if c.ClusterProperties != nil { + objectMap["properties"] = c.ClusterProperties + } + if c.Location != nil { + objectMap["location"] = c.Location + } + if c.Tags != nil { + objectMap["tags"] = c.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for Cluster struct. +func (c *Cluster) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "identity": + if v != nil { + var identity Identity + err = json.Unmarshal(*v, &identity) + if err != nil { + return err + } + c.Identity = &identity + } + case "sku": + if v != nil { + var sku Sku + err = json.Unmarshal(*v, &sku) + if err != nil { + return err + } + c.Sku = &sku + } + case "properties": + if v != nil { + var clusterProperties ClusterProperties + err = json.Unmarshal(*v, &clusterProperties) + if err != nil { + return err + } + c.ClusterProperties = &clusterProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + c.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + c.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + c.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + c.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + c.Tags = tags + } + } + } + + return nil +} + +// ClusterListResult the list clusters operation response. +type ClusterListResult struct { + autorest.Response `json:"-"` + // NextLink - The link used to get the next page of recommendations. + NextLink *string `json:"nextLink,omitempty"` + // Value - A list of Log Analytics clusters. + Value *[]Cluster `json:"value,omitempty"` +} + +// ClusterListResultIterator provides access to a complete listing of Cluster values. +type ClusterListResultIterator struct { + i int + page ClusterListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ClusterListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ClusterListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ClusterListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ClusterListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ClusterListResultIterator) Response() ClusterListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ClusterListResultIterator) Value() Cluster { + if !iter.page.NotDone() { + return Cluster{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ClusterListResultIterator type. +func NewClusterListResultIterator(page ClusterListResultPage) ClusterListResultIterator { + return ClusterListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (clr ClusterListResult) IsEmpty() bool { + return clr.Value == nil || len(*clr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (clr ClusterListResult) hasNextLink() bool { + return clr.NextLink != nil && len(*clr.NextLink) != 0 +} + +// clusterListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (clr ClusterListResult) clusterListResultPreparer(ctx context.Context) (*http.Request, error) { + if !clr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(clr.NextLink))) +} + +// ClusterListResultPage contains a page of Cluster values. +type ClusterListResultPage struct { + fn func(context.Context, ClusterListResult) (ClusterListResult, error) + clr ClusterListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ClusterListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ClusterListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.clr) + if err != nil { + return err + } + page.clr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ClusterListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ClusterListResultPage) NotDone() bool { + return !page.clr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ClusterListResultPage) Response() ClusterListResult { + return page.clr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ClusterListResultPage) Values() []Cluster { + if page.clr.IsEmpty() { + return nil + } + return *page.clr.Value +} + +// Creates a new instance of the ClusterListResultPage type. +func NewClusterListResultPage(cur ClusterListResult, getNextPage func(context.Context, ClusterListResult) (ClusterListResult, error)) ClusterListResultPage { + return ClusterListResultPage{ + fn: getNextPage, + clr: cur, + } +} + +// ClusterPatch the top level Log Analytics cluster resource container. +type ClusterPatch struct { + // ClusterPatchProperties - Log Analytics cluster properties. + *ClusterPatchProperties `json:"properties,omitempty"` + // Sku - The sku properties. + Sku *Sku `json:"sku,omitempty"` + // Tags - Resource tags + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for ClusterPatch. +func (cp ClusterPatch) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if cp.ClusterPatchProperties != nil { + objectMap["properties"] = cp.ClusterPatchProperties + } + if cp.Sku != nil { + objectMap["sku"] = cp.Sku + } + if cp.Tags != nil { + objectMap["tags"] = cp.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ClusterPatch struct. +func (cp *ClusterPatch) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var clusterPatchProperties ClusterPatchProperties + err = json.Unmarshal(*v, &clusterPatchProperties) + if err != nil { + return err + } + cp.ClusterPatchProperties = &clusterPatchProperties + } + case "sku": + if v != nil { + var sku Sku + err = json.Unmarshal(*v, &sku) + if err != nil { + return err + } + cp.Sku = &sku + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + cp.Tags = tags + } + } + } + + return nil +} + +// ClusterPatchProperties log Analytics cluster patch properties. +type ClusterPatchProperties struct { + // KeyVaultProperties - The associated key properties. + KeyVaultProperties *KeyVaultProperties `json:"keyVaultProperties,omitempty"` +} + +// ClusterProperties cluster properties. +type ClusterProperties struct { + // NextLink - The link used to get the next page of recommendations. + NextLink *string `json:"nextLink,omitempty"` + // ClusterID - READ-ONLY; The ID associated with the cluster. + ClusterID *string `json:"clusterId,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the cluster. Possible values include: 'Creating', 'Succeeded', 'Failed', 'Canceled', 'Deleting', 'ProvisioningAccount' + ProvisioningState EntityStatus `json:"provisioningState,omitempty"` + // KeyVaultProperties - The associated key properties. + KeyVaultProperties *KeyVaultProperties `json:"keyVaultProperties,omitempty"` +} + +// MarshalJSON is the custom marshaler for ClusterProperties. +func (cp ClusterProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if cp.NextLink != nil { + objectMap["nextLink"] = cp.NextLink + } + if cp.KeyVaultProperties != nil { + objectMap["keyVaultProperties"] = cp.KeyVaultProperties + } + return json.Marshal(objectMap) +} + +// ClustersCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type ClustersCreateOrUpdateFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *ClustersCreateOrUpdateFuture) Result(client ClustersClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "operationalinsights.ClustersCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("operationalinsights.ClustersCreateOrUpdateFuture") + return + } + ar.Response = future.Response() + return +} + +// DataExport the top level data export resource container. +type DataExport struct { + autorest.Response `json:"-"` + // DataExportProperties - data export properties. + *DataExportProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for DataExport. +func (de DataExport) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if de.DataExportProperties != nil { + objectMap["properties"] = de.DataExportProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for DataExport struct. +func (de *DataExport) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var dataExportProperties DataExportProperties + err = json.Unmarshal(*v, &dataExportProperties) + if err != nil { + return err + } + de.DataExportProperties = &dataExportProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + de.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + de.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + de.Type = &typeVar + } + } + } + + return nil +} + +// DataExportCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type DataExportCreateOrUpdateFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *DataExportCreateOrUpdateFuture) Result(client DataExportClient) (de DataExport, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "operationalinsights.DataExportCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("operationalinsights.DataExportCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if de.Response.Response, err = future.GetResult(sender); err == nil && de.Response.Response.StatusCode != http.StatusNoContent { + de, err = client.CreateOrUpdateResponder(de.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "operationalinsights.DataExportCreateOrUpdateFuture", "Result", de.Response.Response, "Failure responding to request") + } + } + return +} + +// DataExportListResult result of the request to list data exports. +type DataExportListResult struct { + autorest.Response `json:"-"` + // Value - List of data export instances within a workspace.. + Value *[]DataExport `json:"value,omitempty"` +} + +// DataExportListResultIterator provides access to a complete listing of DataExport values. +type DataExportListResultIterator struct { + i int + page DataExportListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *DataExportListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DataExportListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *DataExportListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter DataExportListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter DataExportListResultIterator) Response() DataExportListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter DataExportListResultIterator) Value() DataExport { + if !iter.page.NotDone() { + return DataExport{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the DataExportListResultIterator type. +func NewDataExportListResultIterator(page DataExportListResultPage) DataExportListResultIterator { + return DataExportListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (delr DataExportListResult) IsEmpty() bool { + return delr.Value == nil || len(*delr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (delr DataExportListResult) hasNextLink() bool { + return delr.NextLink != nil && len(*delr.NextLink) != 0 +} + +// dataExportListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (delr DataExportListResult) dataExportListResultPreparer(ctx context.Context) (*http.Request, error) { + if !delr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(delr.NextLink))) +} + +// DataExportListResultPage contains a page of DataExport values. +type DataExportListResultPage struct { + fn func(context.Context, DataExportListResult) (DataExportListResult, error) + delr DataExportListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *DataExportListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DataExportListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.delr) + if err != nil { + return err + } + page.delr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *DataExportListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page DataExportListResultPage) NotDone() bool { + return !page.delr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page DataExportListResultPage) Response() DataExportListResult { + return page.delr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page DataExportListResultPage) Values() []DataExport { + if page.delr.IsEmpty() { + return nil + } + return *page.delr.Value +} + +// Creates a new instance of the DataExportListResultPage type. +func NewDataExportListResultPage(cur DataExportListResult, getNextPage func(context.Context, DataExportListResult) (DataExportListResult, error)) DataExportListResultPage { + return DataExportListResultPage{ + fn: getNextPage, + delr: cur, + } +} + +// DataExportProperties data Export properties. +type DataExportProperties struct { + // DataExportID - The data export rule ID. + DataExportID *string `json:"dataExportId,omitempty"` + // TableNames - An array of tables to export, for example: [“Heartbeat, SecurityEvent”]. + TableNames *[]string `json:"tableNames,omitempty"` + // Destination - destination properties. + *Destination `json:"destination,omitempty"` + // Enable - Active when enabled. + Enable *bool `json:"enable,omitempty"` + // CreatedDate - The latest data export rule modification time. + CreatedDate *string `json:"createdDate,omitempty"` + // LastModifiedDate - Date and time when the export was last modified. + LastModifiedDate *string `json:"lastModifiedDate,omitempty"` +} + +// MarshalJSON is the custom marshaler for DataExportProperties. +func (dep DataExportProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if dep.DataExportID != nil { + objectMap["dataExportId"] = dep.DataExportID + } + if dep.TableNames != nil { + objectMap["tableNames"] = dep.TableNames + } + if dep.Destination != nil { + objectMap["destination"] = dep.Destination + } + if dep.Enable != nil { + objectMap["enable"] = dep.Enable + } + if dep.CreatedDate != nil { + objectMap["createdDate"] = dep.CreatedDate + } + if dep.LastModifiedDate != nil { + objectMap["lastModifiedDate"] = dep.LastModifiedDate + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for DataExportProperties struct. +func (dep *DataExportProperties) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "dataExportId": + if v != nil { + var dataExportID string + err = json.Unmarshal(*v, &dataExportID) + if err != nil { + return err + } + dep.DataExportID = &dataExportID + } + case "tableNames": + if v != nil { + var tableNames []string + err = json.Unmarshal(*v, &tableNames) + if err != nil { + return err + } + dep.TableNames = &tableNames + } + case "destination": + if v != nil { + var destination Destination + err = json.Unmarshal(*v, &destination) + if err != nil { + return err + } + dep.Destination = &destination + } + case "enable": + if v != nil { + var enable bool + err = json.Unmarshal(*v, &enable) + if err != nil { + return err + } + dep.Enable = &enable + } + case "createdDate": + if v != nil { + var createdDate string + err = json.Unmarshal(*v, &createdDate) + if err != nil { + return err + } + dep.CreatedDate = &createdDate + } + case "lastModifiedDate": + if v != nil { + var lastModifiedDate string + err = json.Unmarshal(*v, &lastModifiedDate) + if err != nil { + return err + } + dep.LastModifiedDate = &lastModifiedDate + } + } + } + + return nil +} + +// Destination destination properties. +type Destination struct { + // ResourceID - The destination resource ID. This can be copied from the Properties entry of the destination resource in Azure. + ResourceID *string `json:"resourceId,omitempty"` + // Type - READ-ONLY; The type of the destination resource. Possible values include: 'StorageAccount', 'EventHub' + Type Type `json:"type,omitempty"` + // DestinationMetaData - destination meta data. + *DestinationMetaData `json:"metaData,omitempty"` +} + +// MarshalJSON is the custom marshaler for Destination. +func (d Destination) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if d.ResourceID != nil { + objectMap["resourceId"] = d.ResourceID + } + if d.DestinationMetaData != nil { + objectMap["metaData"] = d.DestinationMetaData + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for Destination struct. +func (d *Destination) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "resourceId": + if v != nil { + var resourceID string + err = json.Unmarshal(*v, &resourceID) + if err != nil { + return err + } + d.ResourceID = &resourceID + } + case "type": + if v != nil { + var typeVar Type + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + d.Type = typeVar + } + case "metaData": + if v != nil { + var destinationMetaData DestinationMetaData + err = json.Unmarshal(*v, &destinationMetaData) + if err != nil { + return err + } + d.DestinationMetaData = &destinationMetaData + } + } + } + + return nil +} + +// DestinationMetaData destination meta data. +type DestinationMetaData struct { + // EventHubName - Optional. Allows to define an Event Hub name. Not applicable when destination is Storage Account. + EventHubName *string `json:"eventHubName,omitempty"` +} + +// ErrorDetails the details of the error. +type ErrorDetails struct { + // Code - READ-ONLY; Error code. + Code *string `json:"code,omitempty"` + // Message - READ-ONLY; Error message indicating why the operation failed. + Message *string `json:"message,omitempty"` + // Target - READ-ONLY; The target of the particular error. + Target *string `json:"target,omitempty"` +} + +// ErrorResponse error response indicates that the service is not able to process the incoming request. The +// reason is provided in the error message. +type ErrorResponse struct { + // Error - The details of the error. + Error *ErrorDetails `json:"error,omitempty"` +} + +// Identity identity for the resource. +type Identity struct { + // PrincipalID - READ-ONLY; The principal ID of resource identity. + PrincipalID *string `json:"principalId,omitempty"` + // TenantID - READ-ONLY; The tenant ID of resource. + TenantID *string `json:"tenantId,omitempty"` + // Type - The identity type. Possible values include: 'SystemAssigned', 'None' + Type IdentityType `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for Identity. +func (i Identity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if i.Type != "" { + objectMap["type"] = i.Type + } + return json.Marshal(objectMap) +} + +// KeyVaultProperties ... +type KeyVaultProperties struct { + // KeyVaultURI - The Key Vault uri which holds they key associated with the Log Analytics cluster. + KeyVaultURI *string `json:"keyVaultUri,omitempty"` + // KeyName - The name of the key associated with the Log Analytics cluster. + KeyName *string `json:"keyName,omitempty"` + // KeyVersion - The version of the key associated with the Log Analytics cluster. + KeyVersion *string `json:"keyVersion,omitempty"` +} + +// LinkedService the top level Linked service resource container. +type LinkedService struct { + autorest.Response `json:"-"` + // LinkedServiceProperties - The properties of the linked service. + *LinkedServiceProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for LinkedService. +func (ls LinkedService) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ls.LinkedServiceProperties != nil { + objectMap["properties"] = ls.LinkedServiceProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for LinkedService struct. +func (ls *LinkedService) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var linkedServiceProperties LinkedServiceProperties + err = json.Unmarshal(*v, &linkedServiceProperties) + if err != nil { + return err + } + ls.LinkedServiceProperties = &linkedServiceProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + ls.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + ls.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + ls.Type = &typeVar + } + } + } + + return nil +} + +// LinkedServiceListResult the list linked service operation response. +type LinkedServiceListResult struct { + autorest.Response `json:"-"` + // Value - The list of linked service instances + Value *[]LinkedService `json:"value,omitempty"` +} + +// LinkedServiceProperties linked service properties. +type LinkedServiceProperties struct { + // ResourceID - The resource id of the resource that will be linked to the workspace. This should be used for linking resources which require read access + ResourceID *string `json:"resourceId,omitempty"` + // WriteAccessResourceID - The resource id of the resource that will be linked to the workspace. This should be used for linking resources which require write access + WriteAccessResourceID *string `json:"writeAccessResourceId,omitempty"` +} + +// LinkedStorageAccounts linked storage accounts top level resource container. +type LinkedStorageAccounts struct { + autorest.Response `json:"-"` + // LinkedStorageAccountsProperties - Linked storage accounts properties. + *LinkedStorageAccountsProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for LinkedStorageAccounts. +func (lsa LinkedStorageAccounts) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if lsa.LinkedStorageAccountsProperties != nil { + objectMap["properties"] = lsa.LinkedStorageAccountsProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for LinkedStorageAccounts struct. +func (lsa *LinkedStorageAccounts) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var linkedStorageAccountsProperties LinkedStorageAccountsProperties + err = json.Unmarshal(*v, &linkedStorageAccountsProperties) + if err != nil { + return err + } + lsa.LinkedStorageAccountsProperties = &linkedStorageAccountsProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + lsa.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + lsa.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + lsa.Type = &typeVar + } + } + } + + return nil +} + +// LinkedStorageAccountsListResult the list linked storage accounts service operation response. +type LinkedStorageAccountsListResult struct { + autorest.Response `json:"-"` + // Value - A list of linked storage accounts instances. + Value *[]LinkedStorageAccounts `json:"value,omitempty"` +} + +// LinkedStorageAccountsProperties linked storage accounts properties. +type LinkedStorageAccountsProperties struct { + // DataSourceType - READ-ONLY; Linked storage accounts type. Possible values include: 'CustomLogs', 'AzureWatson' + DataSourceType DataSourceType `json:"dataSourceType,omitempty"` + // StorageAccountIds - Linked storage accounts resources ids. + StorageAccountIds *[]string `json:"storageAccountIds,omitempty"` +} + +// MarshalJSON is the custom marshaler for LinkedStorageAccountsProperties. +func (lsap LinkedStorageAccountsProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if lsap.StorageAccountIds != nil { + objectMap["storageAccountIds"] = lsap.StorageAccountIds + } + return json.Marshal(objectMap) +} + +// ProxyResource common properties of proxy resource. +type ProxyResource struct { + // ID - READ-ONLY; Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` +} + +// Resource the resource definition. +type Resource struct { + // ID - READ-ONLY; Resource Id + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type + Type *string `json:"type,omitempty"` + // Location - Resource location + Location *string `json:"location,omitempty"` + // Tags - Resource tags + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for Resource. +func (r Resource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if r.Location != nil { + objectMap["location"] = r.Location + } + if r.Tags != nil { + objectMap["tags"] = r.Tags + } + return json.Marshal(objectMap) +} + +// Sku ... +type Sku struct { + // Capacity - The capacity value + Capacity *int64 `json:"capacity,omitempty"` + // Name - The name of the SKU. Possible values include: 'CapacityReservation' + Name SkuNameEnum `json:"name,omitempty"` +} diff --git a/services/preview/operationalinsights/mgmt/2019-08-01-preview/operationalinsights/operationalinsightsapi/interfaces.go b/services/preview/operationalinsights/mgmt/2019-08-01-preview/operationalinsights/operationalinsightsapi/interfaces.go new file mode 100644 index 000000000000..803229e08b58 --- /dev/null +++ b/services/preview/operationalinsights/mgmt/2019-08-01-preview/operationalinsights/operationalinsightsapi/interfaces.go @@ -0,0 +1,69 @@ +package operationalinsightsapi + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/azure-sdk-for-go/services/preview/operationalinsights/mgmt/2019-08-01-preview/operationalinsights" + "github.com/Azure/go-autorest/autorest" +) + +// ClustersClientAPI contains the set of methods on the ClustersClient type. +type ClustersClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, clusterName string, parameters operationalinsights.Cluster) (result operationalinsights.ClustersCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, clusterName string) (result autorest.Response, err error) + Get(ctx context.Context, resourceGroupName string, clusterName string) (result operationalinsights.Cluster, err error) + List(ctx context.Context) (result operationalinsights.ClusterListResultPage, err error) + ListComplete(ctx context.Context) (result operationalinsights.ClusterListResultIterator, err error) + ListByResourceGroup(ctx context.Context, resourceGroupName string) (result operationalinsights.ClusterListResultPage, err error) + ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result operationalinsights.ClusterListResultIterator, err error) + Update(ctx context.Context, resourceGroupName string, clusterName string, parameters operationalinsights.ClusterPatch) (result operationalinsights.Cluster, err error) +} + +var _ ClustersClientAPI = (*operationalinsights.ClustersClient)(nil) + +// LinkedServicesClientAPI contains the set of methods on the LinkedServicesClient type. +type LinkedServicesClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, linkedServiceName string, parameters operationalinsights.LinkedService) (result operationalinsights.LinkedService, err error) + Delete(ctx context.Context, resourceGroupName string, workspaceName string, linkedServiceName string) (result autorest.Response, err error) + Get(ctx context.Context, resourceGroupName string, workspaceName string, linkedServiceName string) (result operationalinsights.LinkedService, err error) + ListByWorkspace(ctx context.Context, resourceGroupName string, workspaceName string) (result operationalinsights.LinkedServiceListResult, err error) +} + +var _ LinkedServicesClientAPI = (*operationalinsights.LinkedServicesClient)(nil) + +// DataExportClientAPI contains the set of methods on the DataExportClient type. +type DataExportClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, dataExportName string, parameters operationalinsights.DataExport) (result operationalinsights.DataExportCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, workspaceName string, dataExportName string) (result autorest.Response, err error) + Get(ctx context.Context, resourceGroupName string, workspaceName string, dataExportName string) (result operationalinsights.DataExport, err error) + ListByWorkspace(ctx context.Context, resourceGroupName string, workspaceName string) (result operationalinsights.DataExportListResultPage, err error) + ListByWorkspaceComplete(ctx context.Context, resourceGroupName string, workspaceName string) (result operationalinsights.DataExportListResultIterator, err error) +} + +var _ DataExportClientAPI = (*operationalinsights.DataExportClient)(nil) + +// LinkedStorageAccountsClientAPI contains the set of methods on the LinkedStorageAccountsClient type. +type LinkedStorageAccountsClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, dataSourceType operationalinsights.DataSourceType, parameters operationalinsights.LinkedStorageAccounts) (result operationalinsights.LinkedStorageAccounts, err error) + Delete(ctx context.Context, resourceGroupName string, workspaceName string, dataSourceType operationalinsights.DataSourceType) (result autorest.Response, err error) + Get(ctx context.Context, resourceGroupName string, workspaceName string, dataSourceType operationalinsights.DataSourceType) (result operationalinsights.LinkedStorageAccounts, err error) + ListByWorkspace(ctx context.Context, resourceGroupName string, workspaceName string) (result operationalinsights.LinkedStorageAccountsListResult, err error) +} + +var _ LinkedStorageAccountsClientAPI = (*operationalinsights.LinkedStorageAccountsClient)(nil) diff --git a/services/preview/operationalinsights/mgmt/2019-08-01-preview/operationalinsights/version.go b/services/preview/operationalinsights/mgmt/2019-08-01-preview/operationalinsights/version.go new file mode 100644 index 000000000000..7a3441caef47 --- /dev/null +++ b/services/preview/operationalinsights/mgmt/2019-08-01-preview/operationalinsights/version.go @@ -0,0 +1,30 @@ +package operationalinsights + +import "github.com/Azure/azure-sdk-for-go/version" + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// UserAgent returns the UserAgent string to use when sending http.Requests. +func UserAgent() string { + return "Azure-SDK-For-Go/" + Version() + " operationalinsights/2019-08-01-preview" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return version.Number +}