vendor: add github.com/Azure/azure-sdk-for-go and dependencies
This commit is contained in:
Generated
Vendored
Executable
+53
@@ -0,0 +1,53 @@
|
||||
// Package operationalinsights implements the Azure ARM Operationalinsights
|
||||
// service API version 2015-11-01-preview.
|
||||
//
|
||||
// Azure Log Analytics API reference
|
||||
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 1.0.1.0
|
||||
// Changes may cause incorrect behavior and will be lost if the code is
|
||||
// regenerated.
|
||||
|
||||
import (
|
||||
"github.com/Azure/go-autorest/autorest"
|
||||
)
|
||||
|
||||
const (
|
||||
// DefaultBaseURI is the default URI used for the service Operationalinsights
|
||||
DefaultBaseURI = "https://management.azure.com"
|
||||
)
|
||||
|
||||
// ManagementClient is the base client for Operationalinsights.
|
||||
type ManagementClient struct {
|
||||
autorest.Client
|
||||
BaseURI string
|
||||
SubscriptionID string
|
||||
}
|
||||
|
||||
// New creates an instance of the ManagementClient client.
|
||||
func New(subscriptionID string) ManagementClient {
|
||||
return NewWithBaseURI(DefaultBaseURI, subscriptionID)
|
||||
}
|
||||
|
||||
// NewWithBaseURI creates an instance of the ManagementClient client.
|
||||
func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient {
|
||||
return ManagementClient{
|
||||
Client: autorest.NewClientWithUserAgent(UserAgent()),
|
||||
BaseURI: baseURI,
|
||||
SubscriptionID: subscriptionID,
|
||||
}
|
||||
}
|
||||
Generated
Vendored
Executable
+380
@@ -0,0 +1,380 @@
|
||||
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 1.0.1.0
|
||||
// Changes may cause incorrect behavior and will be lost if the code is
|
||||
// regenerated.
|
||||
|
||||
import (
|
||||
"github.com/Azure/go-autorest/autorest"
|
||||
"github.com/Azure/go-autorest/autorest/azure"
|
||||
"github.com/Azure/go-autorest/autorest/validation"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
// DataSourcesClient is the azure Log Analytics API reference
|
||||
type DataSourcesClient struct {
|
||||
ManagementClient
|
||||
}
|
||||
|
||||
// NewDataSourcesClient creates an instance of the DataSourcesClient client.
|
||||
func NewDataSourcesClient(subscriptionID string) DataSourcesClient {
|
||||
return NewDataSourcesClientWithBaseURI(DefaultBaseURI, subscriptionID)
|
||||
}
|
||||
|
||||
// NewDataSourcesClientWithBaseURI creates an instance of the DataSourcesClient
|
||||
// client.
|
||||
func NewDataSourcesClientWithBaseURI(baseURI string, subscriptionID string) DataSourcesClient {
|
||||
return DataSourcesClient{NewWithBaseURI(baseURI, subscriptionID)}
|
||||
}
|
||||
|
||||
// CreateOrUpdate create or update a data source.
|
||||
//
|
||||
// resourceGroupName is the name of the resource group to get. The name is case
|
||||
// insensitive. workspaceName is name of the Log Analytics Workspace that will
|
||||
// contain the datasource dataSourceName is the name of the datasource
|
||||
// resource. parameters is the parameters required to create or update a
|
||||
// datasource.
|
||||
func (client DataSourcesClient) CreateOrUpdate(resourceGroupName string, workspaceName string, dataSourceName string, parameters DataSource) (result DataSource, err error) {
|
||||
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.Properties", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil {
|
||||
return result, validation.NewErrorWithValidationError(err, "operationalinsights.DataSourcesClient", "CreateOrUpdate")
|
||||
}
|
||||
|
||||
req, err := client.CreateOrUpdatePreparer(resourceGroupName, workspaceName, dataSourceName, parameters)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "operationalinsights.DataSourcesClient", "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.DataSourcesClient", "CreateOrUpdate", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.CreateOrUpdateResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "operationalinsights.DataSourcesClient", "CreateOrUpdate", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// CreateOrUpdatePreparer prepares the CreateOrUpdate request.
|
||||
func (client DataSourcesClient) CreateOrUpdatePreparer(resourceGroupName string, workspaceName string, dataSourceName string, parameters DataSource) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"dataSourceName": autorest.Encode("path", dataSourceName),
|
||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
"workspaceName": autorest.Encode("path", workspaceName),
|
||||
}
|
||||
|
||||
const APIVersion = "2015-11-01-preview"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsJSON(),
|
||||
autorest.AsPut(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/dataSources/{dataSourceName}", pathParameters),
|
||||
autorest.WithJSON(parameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client DataSourcesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client, req)
|
||||
}
|
||||
|
||||
// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client DataSourcesClient) CreateOrUpdateResponder(resp *http.Response) (result DataSource, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated),
|
||||
autorest.ByUnmarshallingJSON(&result),
|
||||
autorest.ByClosing())
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return
|
||||
}
|
||||
|
||||
// Delete deletes a data source instance.
|
||||
//
|
||||
// resourceGroupName is the name of the resource group to get. The name is case
|
||||
// insensitive. workspaceName is name of the Log Analytics Workspace that
|
||||
// contains the datasource. dataSourceName is name of the datasource.
|
||||
func (client DataSourcesClient) Delete(resourceGroupName string, workspaceName string, dataSourceName string) (result autorest.Response, err error) {
|
||||
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.NewErrorWithValidationError(err, "operationalinsights.DataSourcesClient", "Delete")
|
||||
}
|
||||
|
||||
req, err := client.DeletePreparer(resourceGroupName, workspaceName, dataSourceName)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "operationalinsights.DataSourcesClient", "Delete", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.DeleteSender(req)
|
||||
if err != nil {
|
||||
result.Response = resp
|
||||
err = autorest.NewErrorWithError(err, "operationalinsights.DataSourcesClient", "Delete", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.DeleteResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "operationalinsights.DataSourcesClient", "Delete", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// DeletePreparer prepares the Delete request.
|
||||
func (client DataSourcesClient) DeletePreparer(resourceGroupName string, workspaceName string, dataSourceName string) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"dataSourceName": autorest.Encode("path", dataSourceName),
|
||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
"workspaceName": autorest.Encode("path", workspaceName),
|
||||
}
|
||||
|
||||
const APIVersion = "2015-11-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}/dataSources/{dataSourceName}", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// DeleteSender sends the Delete request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client DataSourcesClient) DeleteSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client, req)
|
||||
}
|
||||
|
||||
// DeleteResponder handles the response to the Delete request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client DataSourcesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent),
|
||||
autorest.ByClosing())
|
||||
result.Response = resp
|
||||
return
|
||||
}
|
||||
|
||||
// Get gets a datasource instance.
|
||||
//
|
||||
// resourceGroupName is the name of the resource group to get. The name is case
|
||||
// insensitive. workspaceName is name of the Log Analytics Workspace that
|
||||
// contains the datasource. dataSourceName is name of the datasource
|
||||
func (client DataSourcesClient) Get(resourceGroupName string, workspaceName string, dataSourceName string) (result DataSource, err error) {
|
||||
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.NewErrorWithValidationError(err, "operationalinsights.DataSourcesClient", "Get")
|
||||
}
|
||||
|
||||
req, err := client.GetPreparer(resourceGroupName, workspaceName, dataSourceName)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "operationalinsights.DataSourcesClient", "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.DataSourcesClient", "Get", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.GetResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "operationalinsights.DataSourcesClient", "Get", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// GetPreparer prepares the Get request.
|
||||
func (client DataSourcesClient) GetPreparer(resourceGroupName string, workspaceName string, dataSourceName string) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"dataSourceName": autorest.Encode("path", dataSourceName),
|
||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
"workspaceName": autorest.Encode("path", workspaceName),
|
||||
}
|
||||
|
||||
const APIVersion = "2015-11-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}/dataSources/{dataSourceName}", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// GetSender sends the Get request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client DataSourcesClient) GetSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client, req)
|
||||
}
|
||||
|
||||
// GetResponder handles the response to the Get request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client DataSourcesClient) GetResponder(resp *http.Response) (result DataSource, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||
autorest.ByUnmarshallingJSON(&result),
|
||||
autorest.ByClosing())
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return
|
||||
}
|
||||
|
||||
// ListByWorkspace gets the first page of data source instances in a workspace
|
||||
// with the link to the next page.
|
||||
//
|
||||
// resourceGroupName is the name of the resource group to get. The name is case
|
||||
// insensitive. workspaceName is the workspace that contains the data sources.
|
||||
// filter is the filter to apply on the operation. skiptoken is starting point
|
||||
// of the collection of data source instances.
|
||||
func (client DataSourcesClient) ListByWorkspace(resourceGroupName string, workspaceName string, filter string, skiptoken string) (result DataSourceListResult, err error) {
|
||||
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.NewErrorWithValidationError(err, "operationalinsights.DataSourcesClient", "ListByWorkspace")
|
||||
}
|
||||
|
||||
req, err := client.ListByWorkspacePreparer(resourceGroupName, workspaceName, filter, skiptoken)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "operationalinsights.DataSourcesClient", "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.DataSourcesClient", "ListByWorkspace", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.ListByWorkspaceResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "operationalinsights.DataSourcesClient", "ListByWorkspace", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// ListByWorkspacePreparer prepares the ListByWorkspace request.
|
||||
func (client DataSourcesClient) ListByWorkspacePreparer(resourceGroupName string, workspaceName string, filter string, skiptoken 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 = "2015-11-01-preview"
|
||||
queryParameters := map[string]interface{}{
|
||||
"$filter": autorest.Encode("query", filter),
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
if len(skiptoken) > 0 {
|
||||
queryParameters["$skiptoken"] = autorest.Encode("query", skiptoken)
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsGet(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/dataSources", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// ListByWorkspaceSender sends the ListByWorkspace request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client DataSourcesClient) ListByWorkspaceSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client, req)
|
||||
}
|
||||
|
||||
// ListByWorkspaceResponder handles the response to the ListByWorkspace request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client DataSourcesClient) ListByWorkspaceResponder(resp *http.Response) (result DataSourceListResult, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
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 DataSourcesClient) ListByWorkspaceNextResults(lastResults DataSourceListResult) (result DataSourceListResult, err error) {
|
||||
req, err := lastResults.DataSourceListResultPreparer()
|
||||
if err != nil {
|
||||
return result, autorest.NewErrorWithError(err, "operationalinsights.DataSourcesClient", "ListByWorkspace", 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.DataSourcesClient", "ListByWorkspace", resp, "Failure sending next results request")
|
||||
}
|
||||
|
||||
result, err = client.ListByWorkspaceResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "operationalinsights.DataSourcesClient", "ListByWorkspace", resp, "Failure responding to next results request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
Generated
Vendored
Executable
+354
@@ -0,0 +1,354 @@
|
||||
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 1.0.1.0
|
||||
// Changes may cause incorrect behavior and will be lost if the code is
|
||||
// regenerated.
|
||||
|
||||
import (
|
||||
"github.com/Azure/go-autorest/autorest"
|
||||
"github.com/Azure/go-autorest/autorest/azure"
|
||||
"github.com/Azure/go-autorest/autorest/validation"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
// LinkedServicesClient is the azure Log Analytics API reference
|
||||
type LinkedServicesClient struct {
|
||||
ManagementClient
|
||||
}
|
||||
|
||||
// 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.
|
||||
func NewLinkedServicesClientWithBaseURI(baseURI string, subscriptionID string) LinkedServicesClient {
|
||||
return LinkedServicesClient{NewWithBaseURI(baseURI, subscriptionID)}
|
||||
}
|
||||
|
||||
// CreateOrUpdate create or update a linked service.
|
||||
//
|
||||
// resourceGroupName is the name of the resource group to get. The name is case
|
||||
// insensitive. workspaceName is name of the Log Analytics Workspace that will
|
||||
// contain the linkedServices resource linkedServiceName is name of the
|
||||
// linkedServices resource parameters is the parameters required to create or
|
||||
// update a linked service.
|
||||
func (client LinkedServicesClient) CreateOrUpdate(resourceGroupName string, workspaceName string, linkedServiceName string, parameters LinkedService) (result LinkedService, err error) {
|
||||
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: []validation.Constraint{{Target: "parameters.LinkedServiceProperties.ResourceID", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil {
|
||||
return result, validation.NewErrorWithValidationError(err, "operationalinsights.LinkedServicesClient", "CreateOrUpdate")
|
||||
}
|
||||
|
||||
req, err := client.CreateOrUpdatePreparer(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(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 = "2015-11-01-preview"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsJSON(),
|
||||
autorest.AsPut(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/linkedServices/{linkedServiceName}", pathParameters),
|
||||
autorest.WithJSON(parameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client LinkedServicesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client, req)
|
||||
}
|
||||
|
||||
// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client LinkedServicesClient) CreateOrUpdateResponder(resp *http.Response) (result LinkedService, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated),
|
||||
autorest.ByUnmarshallingJSON(&result),
|
||||
autorest.ByClosing())
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return
|
||||
}
|
||||
|
||||
// Delete deletes a linked service instance.
|
||||
//
|
||||
// resourceGroupName is the name of the resource group to get. The name is case
|
||||
// insensitive. workspaceName is name of the Log Analytics Workspace that
|
||||
// contains the linkedServices resource linkedServiceName is name of the linked
|
||||
// service.
|
||||
func (client LinkedServicesClient) Delete(resourceGroupName string, workspaceName string, linkedServiceName string) (result autorest.Response, err error) {
|
||||
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.NewErrorWithValidationError(err, "operationalinsights.LinkedServicesClient", "Delete")
|
||||
}
|
||||
|
||||
req, err := client.DeletePreparer(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(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 = "2015-11-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{})
|
||||
}
|
||||
|
||||
// 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 autorest.SendWithSender(client, req)
|
||||
}
|
||||
|
||||
// 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,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent),
|
||||
autorest.ByClosing())
|
||||
result.Response = resp
|
||||
return
|
||||
}
|
||||
|
||||
// Get gets a linked service instance.
|
||||
//
|
||||
// resourceGroupName is the name of the resource group to get. The name is case
|
||||
// insensitive. workspaceName is name of the Log Analytics Workspace that
|
||||
// contains the linkedServices resource linkedServiceName is name of the linked
|
||||
// service.
|
||||
func (client LinkedServicesClient) Get(resourceGroupName string, workspaceName string, linkedServiceName string) (result LinkedService, err error) {
|
||||
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.NewErrorWithValidationError(err, "operationalinsights.LinkedServicesClient", "Get")
|
||||
}
|
||||
|
||||
req, err := client.GetPreparer(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(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 = "2015-11-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{})
|
||||
}
|
||||
|
||||
// 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 autorest.SendWithSender(client, req)
|
||||
}
|
||||
|
||||
// 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,
|
||||
client.ByInspecting(),
|
||||
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.
|
||||
//
|
||||
// resourceGroupName is the name of the resource group to get. The name is case
|
||||
// insensitive. workspaceName is name of the Log Analytics Workspace that
|
||||
// contains the linked services.
|
||||
func (client LinkedServicesClient) ListByWorkspace(resourceGroupName string, workspaceName string) (result LinkedServiceListResult, err error) {
|
||||
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.NewErrorWithValidationError(err, "operationalinsights.LinkedServicesClient", "ListByWorkspace")
|
||||
}
|
||||
|
||||
req, err := client.ListByWorkspacePreparer(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(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 = "2015-11-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{})
|
||||
}
|
||||
|
||||
// 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 autorest.SendWithSender(client, req)
|
||||
}
|
||||
|
||||
// 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,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||
autorest.ByUnmarshallingJSON(&result),
|
||||
autorest.ByClosing())
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return
|
||||
}
|
||||
Generated
Vendored
Executable
+285
@@ -0,0 +1,285 @@
|
||||
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 1.0.1.0
|
||||
// Changes may cause incorrect behavior and will be lost if the code is
|
||||
// regenerated.
|
||||
|
||||
import (
|
||||
"github.com/Azure/go-autorest/autorest"
|
||||
"github.com/Azure/go-autorest/autorest/date"
|
||||
"github.com/Azure/go-autorest/autorest/to"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
// DataSourceKind enumerates the values for data source kind.
|
||||
type DataSourceKind string
|
||||
|
||||
const (
|
||||
// AzureActivityLog specifies the azure activity log state for data source
|
||||
// kind.
|
||||
AzureActivityLog DataSourceKind = "AzureActivityLog"
|
||||
// ChangeTrackingCustomRegistry specifies the change tracking custom
|
||||
// registry state for data source kind.
|
||||
ChangeTrackingCustomRegistry DataSourceKind = "ChangeTrackingCustomRegistry"
|
||||
// ChangeTrackingDefaultPath specifies the change tracking default path
|
||||
// state for data source kind.
|
||||
ChangeTrackingDefaultPath DataSourceKind = "ChangeTrackingDefaultPath"
|
||||
// ChangeTrackingDefaultRegistry specifies the change tracking default
|
||||
// registry state for data source kind.
|
||||
ChangeTrackingDefaultRegistry DataSourceKind = "ChangeTrackingDefaultRegistry"
|
||||
// ChangeTrackingPath specifies the change tracking path state for data
|
||||
// source kind.
|
||||
ChangeTrackingPath DataSourceKind = "ChangeTrackingPath"
|
||||
// CustomLog specifies the custom log state for data source kind.
|
||||
CustomLog DataSourceKind = "CustomLog"
|
||||
// CustomLogCollection specifies the custom log collection state for data
|
||||
// source kind.
|
||||
CustomLogCollection DataSourceKind = "CustomLogCollection"
|
||||
// GenericDataSource specifies the generic data source state for data
|
||||
// source kind.
|
||||
GenericDataSource DataSourceKind = "GenericDataSource"
|
||||
// IISLogs specifies the iis logs state for data source kind.
|
||||
IISLogs DataSourceKind = "IISLogs"
|
||||
// LinuxPerformanceCollection specifies the linux performance collection
|
||||
// state for data source kind.
|
||||
LinuxPerformanceCollection DataSourceKind = "LinuxPerformanceCollection"
|
||||
// LinuxPerformanceObject specifies the linux performance object state for
|
||||
// data source kind.
|
||||
LinuxPerformanceObject DataSourceKind = "LinuxPerformanceObject"
|
||||
// LinuxSyslog specifies the linux syslog state for data source kind.
|
||||
LinuxSyslog DataSourceKind = "LinuxSyslog"
|
||||
// LinuxSyslogCollection specifies the linux syslog collection state for
|
||||
// data source kind.
|
||||
LinuxSyslogCollection DataSourceKind = "LinuxSyslogCollection"
|
||||
// WindowsEvent specifies the windows event state for data source kind.
|
||||
WindowsEvent DataSourceKind = "WindowsEvent"
|
||||
// WindowsPerformanceCounter specifies the windows performance counter
|
||||
// state for data source kind.
|
||||
WindowsPerformanceCounter DataSourceKind = "WindowsPerformanceCounter"
|
||||
)
|
||||
|
||||
// EntityStatus enumerates the values for entity status.
|
||||
type EntityStatus string
|
||||
|
||||
const (
|
||||
// Canceled specifies the canceled state for entity status.
|
||||
Canceled EntityStatus = "Canceled"
|
||||
// Creating specifies the creating state for entity status.
|
||||
Creating EntityStatus = "Creating"
|
||||
// Deleting specifies the deleting state for entity status.
|
||||
Deleting EntityStatus = "Deleting"
|
||||
// Failed specifies the failed state for entity status.
|
||||
Failed EntityStatus = "Failed"
|
||||
// ProvisioningAccount specifies the provisioning account state for entity
|
||||
// status.
|
||||
ProvisioningAccount EntityStatus = "ProvisioningAccount"
|
||||
// Succeeded specifies the succeeded state for entity status.
|
||||
Succeeded EntityStatus = "Succeeded"
|
||||
)
|
||||
|
||||
// SkuNameEnum enumerates the values for sku name enum.
|
||||
type SkuNameEnum string
|
||||
|
||||
const (
|
||||
// Free specifies the free state for sku name enum.
|
||||
Free SkuNameEnum = "Free"
|
||||
// PerNode specifies the per node state for sku name enum.
|
||||
PerNode SkuNameEnum = "PerNode"
|
||||
// Premium specifies the premium state for sku name enum.
|
||||
Premium SkuNameEnum = "Premium"
|
||||
// Standalone specifies the standalone state for sku name enum.
|
||||
Standalone SkuNameEnum = "Standalone"
|
||||
// Standard specifies the standard state for sku name enum.
|
||||
Standard SkuNameEnum = "Standard"
|
||||
// Unlimited specifies the unlimited state for sku name enum.
|
||||
Unlimited SkuNameEnum = "Unlimited"
|
||||
)
|
||||
|
||||
// DataSource is datasources under OMS Workspace.
|
||||
type DataSource struct {
|
||||
autorest.Response `json:"-"`
|
||||
ID *string `json:"id,omitempty"`
|
||||
Name *string `json:"name,omitempty"`
|
||||
Type *string `json:"type,omitempty"`
|
||||
Tags *map[string]*string `json:"tags,omitempty"`
|
||||
Properties *map[string]interface{} `json:"properties,omitempty"`
|
||||
ETag *string `json:"eTag,omitempty"`
|
||||
Kind DataSourceKind `json:"kind,omitempty"`
|
||||
}
|
||||
|
||||
// DataSourceFilter is dataSource filter. Right now, only filter by kind is
|
||||
// supported.
|
||||
type DataSourceFilter struct {
|
||||
Kind DataSourceKind `json:"kind,omitempty"`
|
||||
}
|
||||
|
||||
// DataSourceListResult is the list data source by workspace operation
|
||||
// response.
|
||||
type DataSourceListResult struct {
|
||||
autorest.Response `json:"-"`
|
||||
Value *[]DataSource `json:"value,omitempty"`
|
||||
NextLink *string `json:"nextLink,omitempty"`
|
||||
}
|
||||
|
||||
// DataSourceListResultPreparer prepares a request to retrieve the next set of results. It returns
|
||||
// nil if no more results exist.
|
||||
func (client DataSourceListResult) DataSourceListResultPreparer() (*http.Request, error) {
|
||||
if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 {
|
||||
return nil, nil
|
||||
}
|
||||
return autorest.Prepare(&http.Request{},
|
||||
autorest.AsJSON(),
|
||||
autorest.AsGet(),
|
||||
autorest.WithBaseURL(to.String(client.NextLink)))
|
||||
}
|
||||
|
||||
// IntelligencePack is intelligence Pack containing a string name and boolean
|
||||
// indicating if it's enabled.
|
||||
type IntelligencePack struct {
|
||||
Name *string `json:"name,omitempty"`
|
||||
Enabled *bool `json:"enabled,omitempty"`
|
||||
}
|
||||
|
||||
// LinkedService is the top level Linked service resource container.
|
||||
type LinkedService struct {
|
||||
autorest.Response `json:"-"`
|
||||
ID *string `json:"id,omitempty"`
|
||||
Name *string `json:"name,omitempty"`
|
||||
Type *string `json:"type,omitempty"`
|
||||
Tags *map[string]*string `json:"tags,omitempty"`
|
||||
*LinkedServiceProperties `json:"properties,omitempty"`
|
||||
}
|
||||
|
||||
// LinkedServiceListResult is the list linked service operation response.
|
||||
type LinkedServiceListResult struct {
|
||||
autorest.Response `json:"-"`
|
||||
Value *[]LinkedService `json:"value,omitempty"`
|
||||
}
|
||||
|
||||
// LinkedServiceProperties is linked service properties.
|
||||
type LinkedServiceProperties struct {
|
||||
ResourceID *string `json:"resourceId,omitempty"`
|
||||
}
|
||||
|
||||
// ListIntelligencePack is
|
||||
type ListIntelligencePack struct {
|
||||
autorest.Response `json:"-"`
|
||||
Value *[]IntelligencePack `json:"value,omitempty"`
|
||||
}
|
||||
|
||||
// ManagementGroup is a management group that is connected to a workspace
|
||||
type ManagementGroup struct {
|
||||
*ManagementGroupProperties `json:"properties,omitempty"`
|
||||
}
|
||||
|
||||
// ManagementGroupProperties is management group properties.
|
||||
type ManagementGroupProperties struct {
|
||||
ServerCount *int32 `json:"serverCount,omitempty"`
|
||||
IsGateway *bool `json:"isGateway,omitempty"`
|
||||
Name *string `json:"name,omitempty"`
|
||||
ID *string `json:"id,omitempty"`
|
||||
Created *date.Time `json:"created,omitempty"`
|
||||
DataReceived *date.Time `json:"dataReceived,omitempty"`
|
||||
Version *string `json:"version,omitempty"`
|
||||
Sku *string `json:"sku,omitempty"`
|
||||
}
|
||||
|
||||
// MetricName is the name of a metric.
|
||||
type MetricName struct {
|
||||
Value *string `json:"value,omitempty"`
|
||||
LocalizedValue *string `json:"localizedValue,omitempty"`
|
||||
}
|
||||
|
||||
// ProxyResource is common properties of proxy resource.
|
||||
type ProxyResource struct {
|
||||
ID *string `json:"id,omitempty"`
|
||||
Name *string `json:"name,omitempty"`
|
||||
Type *string `json:"type,omitempty"`
|
||||
Tags *map[string]*string `json:"tags,omitempty"`
|
||||
}
|
||||
|
||||
// Resource is the resource definition.
|
||||
type Resource struct {
|
||||
ID *string `json:"id,omitempty"`
|
||||
Name *string `json:"name,omitempty"`
|
||||
Type *string `json:"type,omitempty"`
|
||||
Location *string `json:"location,omitempty"`
|
||||
Tags *map[string]*string `json:"tags,omitempty"`
|
||||
}
|
||||
|
||||
// SharedKeys is the shared keys for a workspace.
|
||||
type SharedKeys struct {
|
||||
autorest.Response `json:"-"`
|
||||
PrimarySharedKey *string `json:"primarySharedKey,omitempty"`
|
||||
SecondarySharedKey *string `json:"secondarySharedKey,omitempty"`
|
||||
}
|
||||
|
||||
// Sku is the SKU (tier) of a workspace.
|
||||
type Sku struct {
|
||||
Name SkuNameEnum `json:"name,omitempty"`
|
||||
}
|
||||
|
||||
// UsageMetric is a metric describing the usage of a resource.
|
||||
type UsageMetric struct {
|
||||
Name *MetricName `json:"name,omitempty"`
|
||||
Unit *string `json:"unit,omitempty"`
|
||||
CurrentValue *float64 `json:"currentValue,omitempty"`
|
||||
Limit *float64 `json:"limit,omitempty"`
|
||||
NextResetTime *date.Time `json:"nextResetTime,omitempty"`
|
||||
QuotaPeriod *string `json:"quotaPeriod,omitempty"`
|
||||
}
|
||||
|
||||
// Workspace is the top level Workspace resource container.
|
||||
type Workspace struct {
|
||||
autorest.Response `json:"-"`
|
||||
ID *string `json:"id,omitempty"`
|
||||
Name *string `json:"name,omitempty"`
|
||||
Type *string `json:"type,omitempty"`
|
||||
Location *string `json:"location,omitempty"`
|
||||
Tags *map[string]*string `json:"tags,omitempty"`
|
||||
*WorkspaceProperties `json:"properties,omitempty"`
|
||||
ETag *string `json:"eTag,omitempty"`
|
||||
}
|
||||
|
||||
// WorkspaceListManagementGroupsResult is the list workspace managmement groups
|
||||
// operation response.
|
||||
type WorkspaceListManagementGroupsResult struct {
|
||||
autorest.Response `json:"-"`
|
||||
Value *[]ManagementGroup `json:"value,omitempty"`
|
||||
}
|
||||
|
||||
// WorkspaceListResult is the list workspaces operation response.
|
||||
type WorkspaceListResult struct {
|
||||
autorest.Response `json:"-"`
|
||||
Value *[]Workspace `json:"value,omitempty"`
|
||||
}
|
||||
|
||||
// WorkspaceListUsagesResult is the list workspace usages operation response.
|
||||
type WorkspaceListUsagesResult struct {
|
||||
autorest.Response `json:"-"`
|
||||
Value *[]UsageMetric `json:"value,omitempty"`
|
||||
}
|
||||
|
||||
// WorkspaceProperties is workspace properties.
|
||||
type WorkspaceProperties struct {
|
||||
ProvisioningState EntityStatus `json:"provisioningState,omitempty"`
|
||||
Source *string `json:"source,omitempty"`
|
||||
CustomerID *string `json:"customerId,omitempty"`
|
||||
PortalURL *string `json:"portalUrl,omitempty"`
|
||||
Sku *Sku `json:"sku,omitempty"`
|
||||
RetentionInDays *int32 `json:"retentionInDays,omitempty"`
|
||||
}
|
||||
Generated
Vendored
Executable
+29
@@ -0,0 +1,29 @@
|
||||
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 1.0.1.0
|
||||
// Changes may cause incorrect behavior and will be lost if the code is
|
||||
// regenerated.
|
||||
|
||||
// UserAgent returns the UserAgent string to use when sending http.Requests.
|
||||
func UserAgent() string {
|
||||
return "Azure-SDK-For-Go/v10.1.0-beta arm-operationalinsights/2015-11-01-preview"
|
||||
}
|
||||
|
||||
// Version returns the semantic version (see http://semver.org) of the client.
|
||||
func Version() string {
|
||||
return "v10.1.0-beta"
|
||||
}
|
||||
Generated
Vendored
Executable
+858
@@ -0,0 +1,858 @@
|
||||
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 1.0.1.0
|
||||
// Changes may cause incorrect behavior and will be lost if the code is
|
||||
// regenerated.
|
||||
|
||||
import (
|
||||
"github.com/Azure/go-autorest/autorest"
|
||||
"github.com/Azure/go-autorest/autorest/azure"
|
||||
"github.com/Azure/go-autorest/autorest/validation"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
// WorkspacesClient is the azure Log Analytics API reference
|
||||
type WorkspacesClient struct {
|
||||
ManagementClient
|
||||
}
|
||||
|
||||
// NewWorkspacesClient creates an instance of the WorkspacesClient client.
|
||||
func NewWorkspacesClient(subscriptionID string) WorkspacesClient {
|
||||
return NewWorkspacesClientWithBaseURI(DefaultBaseURI, subscriptionID)
|
||||
}
|
||||
|
||||
// NewWorkspacesClientWithBaseURI creates an instance of the WorkspacesClient
|
||||
// client.
|
||||
func NewWorkspacesClientWithBaseURI(baseURI string, subscriptionID string) WorkspacesClient {
|
||||
return WorkspacesClient{NewWithBaseURI(baseURI, subscriptionID)}
|
||||
}
|
||||
|
||||
// CreateOrUpdate create or update a workspace. This method may poll for
|
||||
// completion. Polling can be canceled by passing the cancel channel argument.
|
||||
// The channel will be used to cancel polling and any outstanding HTTP
|
||||
// requests.
|
||||
//
|
||||
// resourceGroupName is the resource group name of the workspace. workspaceName
|
||||
// is the name of the workspace. parameters is the parameters required to
|
||||
// create or update a workspace.
|
||||
func (client WorkspacesClient) CreateOrUpdate(resourceGroupName string, workspaceName string, parameters Workspace, cancel <-chan struct{}) (<-chan Workspace, <-chan error) {
|
||||
resultChan := make(chan Workspace, 1)
|
||||
errChan := make(chan error, 1)
|
||||
if err := validation.Validate([]validation.Validation{
|
||||
{TargetValue: workspaceName,
|
||||
Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 63, Chain: nil},
|
||||
{Target: "workspaceName", Name: validation.MinLength, Rule: 4, Chain: nil},
|
||||
{Target: "workspaceName", Name: validation.Pattern, Rule: `^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$`, Chain: nil}}},
|
||||
{TargetValue: parameters,
|
||||
Constraints: []validation.Constraint{{Target: "parameters.WorkspaceProperties", Name: validation.Null, Rule: false,
|
||||
Chain: []validation.Constraint{{Target: "parameters.WorkspaceProperties.RetentionInDays", Name: validation.Null, Rule: false,
|
||||
Chain: []validation.Constraint{{Target: "parameters.WorkspaceProperties.RetentionInDays", Name: validation.InclusiveMaximum, Rule: 730, Chain: nil},
|
||||
{Target: "parameters.WorkspaceProperties.RetentionInDays", Name: validation.InclusiveMinimum, Rule: -1, Chain: nil},
|
||||
}},
|
||||
}}}}}); err != nil {
|
||||
errChan <- validation.NewErrorWithValidationError(err, "operationalinsights.WorkspacesClient", "CreateOrUpdate")
|
||||
close(errChan)
|
||||
close(resultChan)
|
||||
return resultChan, errChan
|
||||
}
|
||||
|
||||
go func() {
|
||||
var err error
|
||||
var result Workspace
|
||||
defer func() {
|
||||
resultChan <- result
|
||||
errChan <- err
|
||||
close(resultChan)
|
||||
close(errChan)
|
||||
}()
|
||||
req, err := client.CreateOrUpdatePreparer(resourceGroupName, workspaceName, parameters, cancel)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "operationalinsights.WorkspacesClient", "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.WorkspacesClient", "CreateOrUpdate", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.CreateOrUpdateResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "operationalinsights.WorkspacesClient", "CreateOrUpdate", resp, "Failure responding to request")
|
||||
}
|
||||
}()
|
||||
return resultChan, errChan
|
||||
}
|
||||
|
||||
// CreateOrUpdatePreparer prepares the CreateOrUpdate request.
|
||||
func (client WorkspacesClient) CreateOrUpdatePreparer(resourceGroupName string, workspaceName string, parameters Workspace, cancel <-chan struct{}) (*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 = "2015-11-01-preview"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsJSON(),
|
||||
autorest.AsPut(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}", pathParameters),
|
||||
autorest.WithJSON(parameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{Cancel: cancel})
|
||||
}
|
||||
|
||||
// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client WorkspacesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client,
|
||||
req,
|
||||
azure.DoPollForAsynchronous(client.PollingDelay))
|
||||
}
|
||||
|
||||
// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client WorkspacesClient) CreateOrUpdateResponder(resp *http.Response) (result Workspace, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated),
|
||||
autorest.ByUnmarshallingJSON(&result),
|
||||
autorest.ByClosing())
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return
|
||||
}
|
||||
|
||||
// Delete deletes a workspace instance.
|
||||
//
|
||||
// resourceGroupName is the resource group name of the workspace. workspaceName
|
||||
// is name of the Log Analytics Workspace.
|
||||
func (client WorkspacesClient) Delete(resourceGroupName string, workspaceName string) (result autorest.Response, err error) {
|
||||
req, err := client.DeletePreparer(resourceGroupName, workspaceName)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "operationalinsights.WorkspacesClient", "Delete", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.DeleteSender(req)
|
||||
if err != nil {
|
||||
result.Response = resp
|
||||
err = autorest.NewErrorWithError(err, "operationalinsights.WorkspacesClient", "Delete", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.DeleteResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "operationalinsights.WorkspacesClient", "Delete", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// DeletePreparer prepares the Delete request.
|
||||
func (client WorkspacesClient) DeletePreparer(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 = "2015-11-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}", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// DeleteSender sends the Delete request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client WorkspacesClient) DeleteSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client, req)
|
||||
}
|
||||
|
||||
// DeleteResponder handles the response to the Delete request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client WorkspacesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent),
|
||||
autorest.ByClosing())
|
||||
result.Response = resp
|
||||
return
|
||||
}
|
||||
|
||||
// DisableIntelligencePack disables an intelligence pack for a given workspace.
|
||||
//
|
||||
// resourceGroupName is the name of the resource group to get. The name is case
|
||||
// insensitive. workspaceName is name of the Log Analytics Workspace.
|
||||
// intelligencePackName is the name of the intelligence pack to be disabled.
|
||||
func (client WorkspacesClient) DisableIntelligencePack(resourceGroupName string, workspaceName string, intelligencePackName string) (result autorest.Response, err error) {
|
||||
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.NewErrorWithValidationError(err, "operationalinsights.WorkspacesClient", "DisableIntelligencePack")
|
||||
}
|
||||
|
||||
req, err := client.DisableIntelligencePackPreparer(resourceGroupName, workspaceName, intelligencePackName)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "operationalinsights.WorkspacesClient", "DisableIntelligencePack", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.DisableIntelligencePackSender(req)
|
||||
if err != nil {
|
||||
result.Response = resp
|
||||
err = autorest.NewErrorWithError(err, "operationalinsights.WorkspacesClient", "DisableIntelligencePack", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.DisableIntelligencePackResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "operationalinsights.WorkspacesClient", "DisableIntelligencePack", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// DisableIntelligencePackPreparer prepares the DisableIntelligencePack request.
|
||||
func (client WorkspacesClient) DisableIntelligencePackPreparer(resourceGroupName string, workspaceName string, intelligencePackName string) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"intelligencePackName": autorest.Encode("path", intelligencePackName),
|
||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
"workspaceName": autorest.Encode("path", workspaceName),
|
||||
}
|
||||
|
||||
const APIVersion = "2015-11-01-preview"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsPost(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/intelligencePacks/{intelligencePackName}/Disable", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// DisableIntelligencePackSender sends the DisableIntelligencePack request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client WorkspacesClient) DisableIntelligencePackSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client, req)
|
||||
}
|
||||
|
||||
// DisableIntelligencePackResponder handles the response to the DisableIntelligencePack request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client WorkspacesClient) DisableIntelligencePackResponder(resp *http.Response) (result autorest.Response, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||
autorest.ByClosing())
|
||||
result.Response = resp
|
||||
return
|
||||
}
|
||||
|
||||
// EnableIntelligencePack enables an intelligence pack for a given workspace.
|
||||
//
|
||||
// resourceGroupName is the name of the resource group to get. The name is case
|
||||
// insensitive. workspaceName is name of the Log Analytics Workspace.
|
||||
// intelligencePackName is the name of the intelligence pack to be enabled.
|
||||
func (client WorkspacesClient) EnableIntelligencePack(resourceGroupName string, workspaceName string, intelligencePackName string) (result autorest.Response, err error) {
|
||||
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.NewErrorWithValidationError(err, "operationalinsights.WorkspacesClient", "EnableIntelligencePack")
|
||||
}
|
||||
|
||||
req, err := client.EnableIntelligencePackPreparer(resourceGroupName, workspaceName, intelligencePackName)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "operationalinsights.WorkspacesClient", "EnableIntelligencePack", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.EnableIntelligencePackSender(req)
|
||||
if err != nil {
|
||||
result.Response = resp
|
||||
err = autorest.NewErrorWithError(err, "operationalinsights.WorkspacesClient", "EnableIntelligencePack", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.EnableIntelligencePackResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "operationalinsights.WorkspacesClient", "EnableIntelligencePack", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// EnableIntelligencePackPreparer prepares the EnableIntelligencePack request.
|
||||
func (client WorkspacesClient) EnableIntelligencePackPreparer(resourceGroupName string, workspaceName string, intelligencePackName string) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"intelligencePackName": autorest.Encode("path", intelligencePackName),
|
||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
"workspaceName": autorest.Encode("path", workspaceName),
|
||||
}
|
||||
|
||||
const APIVersion = "2015-11-01-preview"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsPost(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/intelligencePacks/{intelligencePackName}/Enable", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// EnableIntelligencePackSender sends the EnableIntelligencePack request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client WorkspacesClient) EnableIntelligencePackSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client, req)
|
||||
}
|
||||
|
||||
// EnableIntelligencePackResponder handles the response to the EnableIntelligencePack request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client WorkspacesClient) EnableIntelligencePackResponder(resp *http.Response) (result autorest.Response, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||
autorest.ByClosing())
|
||||
result.Response = resp
|
||||
return
|
||||
}
|
||||
|
||||
// Get gets a workspace instance.
|
||||
//
|
||||
// resourceGroupName is the resource group name of the workspace. workspaceName
|
||||
// is name of the Log Analytics Workspace.
|
||||
func (client WorkspacesClient) Get(resourceGroupName string, workspaceName string) (result Workspace, err error) {
|
||||
req, err := client.GetPreparer(resourceGroupName, workspaceName)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "operationalinsights.WorkspacesClient", "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.WorkspacesClient", "Get", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.GetResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "operationalinsights.WorkspacesClient", "Get", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// GetPreparer prepares the Get request.
|
||||
func (client WorkspacesClient) GetPreparer(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 = "2015-11-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}", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// GetSender sends the Get request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client WorkspacesClient) GetSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client, req)
|
||||
}
|
||||
|
||||
// GetResponder handles the response to the Get request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client WorkspacesClient) GetResponder(resp *http.Response) (result Workspace, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||
autorest.ByUnmarshallingJSON(&result),
|
||||
autorest.ByClosing())
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return
|
||||
}
|
||||
|
||||
// GetSharedKeys gets the shared keys for a workspace.
|
||||
//
|
||||
// resourceGroupName is the name of the resource group to get. The name is case
|
||||
// insensitive. workspaceName is name of the Log Analytics Workspace.
|
||||
func (client WorkspacesClient) GetSharedKeys(resourceGroupName string, workspaceName string) (result SharedKeys, err error) {
|
||||
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.NewErrorWithValidationError(err, "operationalinsights.WorkspacesClient", "GetSharedKeys")
|
||||
}
|
||||
|
||||
req, err := client.GetSharedKeysPreparer(resourceGroupName, workspaceName)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "operationalinsights.WorkspacesClient", "GetSharedKeys", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.GetSharedKeysSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
err = autorest.NewErrorWithError(err, "operationalinsights.WorkspacesClient", "GetSharedKeys", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.GetSharedKeysResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "operationalinsights.WorkspacesClient", "GetSharedKeys", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// GetSharedKeysPreparer prepares the GetSharedKeys request.
|
||||
func (client WorkspacesClient) GetSharedKeysPreparer(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 = "2015-11-01-preview"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsPost(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/sharedKeys", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// GetSharedKeysSender sends the GetSharedKeys request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client WorkspacesClient) GetSharedKeysSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client, req)
|
||||
}
|
||||
|
||||
// GetSharedKeysResponder handles the response to the GetSharedKeys request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client WorkspacesClient) GetSharedKeysResponder(resp *http.Response) (result SharedKeys, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||
autorest.ByUnmarshallingJSON(&result),
|
||||
autorest.ByClosing())
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return
|
||||
}
|
||||
|
||||
// List gets the workspaces in a subscription.
|
||||
func (client WorkspacesClient) List() (result WorkspaceListResult, err error) {
|
||||
req, err := client.ListPreparer()
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "operationalinsights.WorkspacesClient", "List", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.ListSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
err = autorest.NewErrorWithError(err, "operationalinsights.WorkspacesClient", "List", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.ListResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "operationalinsights.WorkspacesClient", "List", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// ListPreparer prepares the List request.
|
||||
func (client WorkspacesClient) ListPreparer() (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
}
|
||||
|
||||
const APIVersion = "2015-11-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/workspaces", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// ListSender sends the List request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client WorkspacesClient) ListSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client, req)
|
||||
}
|
||||
|
||||
// ListResponder handles the response to the List request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client WorkspacesClient) ListResponder(resp *http.Response) (result WorkspaceListResult, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||
autorest.ByUnmarshallingJSON(&result),
|
||||
autorest.ByClosing())
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return
|
||||
}
|
||||
|
||||
// ListByResourceGroup gets workspaces in a resource group.
|
||||
//
|
||||
// resourceGroupName is the name of the resource group to get. The name is case
|
||||
// insensitive.
|
||||
func (client WorkspacesClient) ListByResourceGroup(resourceGroupName string) (result WorkspaceListResult, err error) {
|
||||
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.NewErrorWithValidationError(err, "operationalinsights.WorkspacesClient", "ListByResourceGroup")
|
||||
}
|
||||
|
||||
req, err := client.ListByResourceGroupPreparer(resourceGroupName)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "operationalinsights.WorkspacesClient", "ListByResourceGroup", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.ListByResourceGroupSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
err = autorest.NewErrorWithError(err, "operationalinsights.WorkspacesClient", "ListByResourceGroup", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.ListByResourceGroupResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "operationalinsights.WorkspacesClient", "ListByResourceGroup", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// ListByResourceGroupPreparer prepares the ListByResourceGroup request.
|
||||
func (client WorkspacesClient) ListByResourceGroupPreparer(resourceGroupName string) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
}
|
||||
|
||||
const APIVersion = "2015-11-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", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client WorkspacesClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client, req)
|
||||
}
|
||||
|
||||
// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client WorkspacesClient) ListByResourceGroupResponder(resp *http.Response) (result WorkspaceListResult, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||
autorest.ByUnmarshallingJSON(&result),
|
||||
autorest.ByClosing())
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return
|
||||
}
|
||||
|
||||
// ListIntelligencePacks lists all the intelligence packs possible and whether
|
||||
// they are enabled or disabled for a given workspace.
|
||||
//
|
||||
// resourceGroupName is the name of the resource group to get. The name is case
|
||||
// insensitive. workspaceName is name of the Log Analytics Workspace.
|
||||
func (client WorkspacesClient) ListIntelligencePacks(resourceGroupName string, workspaceName string) (result ListIntelligencePack, err error) {
|
||||
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.NewErrorWithValidationError(err, "operationalinsights.WorkspacesClient", "ListIntelligencePacks")
|
||||
}
|
||||
|
||||
req, err := client.ListIntelligencePacksPreparer(resourceGroupName, workspaceName)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "operationalinsights.WorkspacesClient", "ListIntelligencePacks", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.ListIntelligencePacksSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
err = autorest.NewErrorWithError(err, "operationalinsights.WorkspacesClient", "ListIntelligencePacks", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.ListIntelligencePacksResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "operationalinsights.WorkspacesClient", "ListIntelligencePacks", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// ListIntelligencePacksPreparer prepares the ListIntelligencePacks request.
|
||||
func (client WorkspacesClient) ListIntelligencePacksPreparer(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 = "2015-11-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}/intelligencePacks", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// ListIntelligencePacksSender sends the ListIntelligencePacks request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client WorkspacesClient) ListIntelligencePacksSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client, req)
|
||||
}
|
||||
|
||||
// ListIntelligencePacksResponder handles the response to the ListIntelligencePacks request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client WorkspacesClient) ListIntelligencePacksResponder(resp *http.Response) (result ListIntelligencePack, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||
autorest.ByUnmarshallingJSON(&result.Value),
|
||||
autorest.ByClosing())
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return
|
||||
}
|
||||
|
||||
// ListManagementGroups gets a list of management groups connected to a
|
||||
// workspace.
|
||||
//
|
||||
// resourceGroupName is the name of the resource group to get. The name is case
|
||||
// insensitive. workspaceName is the name of the workspace.
|
||||
func (client WorkspacesClient) ListManagementGroups(resourceGroupName string, workspaceName string) (result WorkspaceListManagementGroupsResult, err error) {
|
||||
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.NewErrorWithValidationError(err, "operationalinsights.WorkspacesClient", "ListManagementGroups")
|
||||
}
|
||||
|
||||
req, err := client.ListManagementGroupsPreparer(resourceGroupName, workspaceName)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "operationalinsights.WorkspacesClient", "ListManagementGroups", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.ListManagementGroupsSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
err = autorest.NewErrorWithError(err, "operationalinsights.WorkspacesClient", "ListManagementGroups", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.ListManagementGroupsResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "operationalinsights.WorkspacesClient", "ListManagementGroups", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// ListManagementGroupsPreparer prepares the ListManagementGroups request.
|
||||
func (client WorkspacesClient) ListManagementGroupsPreparer(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 = "2015-11-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}/managementGroups", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// ListManagementGroupsSender sends the ListManagementGroups request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client WorkspacesClient) ListManagementGroupsSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client, req)
|
||||
}
|
||||
|
||||
// ListManagementGroupsResponder handles the response to the ListManagementGroups request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client WorkspacesClient) ListManagementGroupsResponder(resp *http.Response) (result WorkspaceListManagementGroupsResult, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||
autorest.ByUnmarshallingJSON(&result),
|
||||
autorest.ByClosing())
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return
|
||||
}
|
||||
|
||||
// ListUsages gets a list of usage metrics for a workspace.
|
||||
//
|
||||
// resourceGroupName is the name of the resource group to get. The name is case
|
||||
// insensitive. workspaceName is the name of the workspace.
|
||||
func (client WorkspacesClient) ListUsages(resourceGroupName string, workspaceName string) (result WorkspaceListUsagesResult, err error) {
|
||||
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.NewErrorWithValidationError(err, "operationalinsights.WorkspacesClient", "ListUsages")
|
||||
}
|
||||
|
||||
req, err := client.ListUsagesPreparer(resourceGroupName, workspaceName)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "operationalinsights.WorkspacesClient", "ListUsages", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.ListUsagesSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
err = autorest.NewErrorWithError(err, "operationalinsights.WorkspacesClient", "ListUsages", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.ListUsagesResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "operationalinsights.WorkspacesClient", "ListUsages", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// ListUsagesPreparer prepares the ListUsages request.
|
||||
func (client WorkspacesClient) ListUsagesPreparer(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 = "2015-11-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}/usages", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// ListUsagesSender sends the ListUsages request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client WorkspacesClient) ListUsagesSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client, req)
|
||||
}
|
||||
|
||||
// ListUsagesResponder handles the response to the ListUsages request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client WorkspacesClient) ListUsagesResponder(resp *http.Response) (result WorkspaceListUsagesResult, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||
autorest.ByUnmarshallingJSON(&result),
|
||||
autorest.ByClosing())
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return
|
||||
}
|
||||
Reference in New Issue
Block a user