vendor: add github.com/Azure/azure-sdk-for-go and dependencies
This commit is contained in:
Generated
Vendored
Executable
+452
@@ -0,0 +1,452 @@
|
||||
package monitor
|
||||
|
||||
// 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"
|
||||
)
|
||||
|
||||
// ActivityLogAlertsClient is the composite Swagger for Monitor Management
|
||||
// Client
|
||||
type ActivityLogAlertsClient struct {
|
||||
ManagementClient
|
||||
}
|
||||
|
||||
// NewActivityLogAlertsClient creates an instance of the
|
||||
// ActivityLogAlertsClient client.
|
||||
func NewActivityLogAlertsClient(subscriptionID string) ActivityLogAlertsClient {
|
||||
return NewActivityLogAlertsClientWithBaseURI(DefaultBaseURI, subscriptionID)
|
||||
}
|
||||
|
||||
// NewActivityLogAlertsClientWithBaseURI creates an instance of the
|
||||
// ActivityLogAlertsClient client.
|
||||
func NewActivityLogAlertsClientWithBaseURI(baseURI string, subscriptionID string) ActivityLogAlertsClient {
|
||||
return ActivityLogAlertsClient{NewWithBaseURI(baseURI, subscriptionID)}
|
||||
}
|
||||
|
||||
// CreateOrUpdate create a new activity log alert or update an existing one.
|
||||
//
|
||||
// resourceGroupName is the name of the resource group. activityLogAlertName is
|
||||
// the name of the activity log alert. activityLogAlert is the activity log
|
||||
// alert to create or use for the update.
|
||||
func (client ActivityLogAlertsClient) CreateOrUpdate(resourceGroupName string, activityLogAlertName string, activityLogAlert ActivityLogAlertResource) (result ActivityLogAlertResource, err error) {
|
||||
if err := validation.Validate([]validation.Validation{
|
||||
{TargetValue: activityLogAlert,
|
||||
Constraints: []validation.Constraint{{Target: "activityLogAlert.ActivityLogAlert", Name: validation.Null, Rule: false,
|
||||
Chain: []validation.Constraint{{Target: "activityLogAlert.ActivityLogAlert.Scopes", Name: validation.Null, Rule: true, Chain: nil},
|
||||
{Target: "activityLogAlert.ActivityLogAlert.Condition", Name: validation.Null, Rule: true,
|
||||
Chain: []validation.Constraint{{Target: "activityLogAlert.ActivityLogAlert.Condition.AllOf", Name: validation.Null, Rule: true, Chain: nil}}},
|
||||
{Target: "activityLogAlert.ActivityLogAlert.Actions", Name: validation.Null, Rule: true, Chain: nil},
|
||||
}}}}}); err != nil {
|
||||
return result, validation.NewErrorWithValidationError(err, "monitor.ActivityLogAlertsClient", "CreateOrUpdate")
|
||||
}
|
||||
|
||||
req, err := client.CreateOrUpdatePreparer(resourceGroupName, activityLogAlertName, activityLogAlert)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "monitor.ActivityLogAlertsClient", "CreateOrUpdate", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.CreateOrUpdateSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
err = autorest.NewErrorWithError(err, "monitor.ActivityLogAlertsClient", "CreateOrUpdate", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.CreateOrUpdateResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "monitor.ActivityLogAlertsClient", "CreateOrUpdate", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// CreateOrUpdatePreparer prepares the CreateOrUpdate request.
|
||||
func (client ActivityLogAlertsClient) CreateOrUpdatePreparer(resourceGroupName string, activityLogAlertName string, activityLogAlert ActivityLogAlertResource) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"activityLogAlertName": autorest.Encode("path", activityLogAlertName),
|
||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
}
|
||||
|
||||
const APIVersion = "2017-03-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.insights/activityLogAlerts/{activityLogAlertName}", pathParameters),
|
||||
autorest.WithJSON(activityLogAlert),
|
||||
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 ActivityLogAlertsClient) 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 ActivityLogAlertsClient) CreateOrUpdateResponder(resp *http.Response) (result ActivityLogAlertResource, 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 delete an activity log alert.
|
||||
//
|
||||
// resourceGroupName is the name of the resource group. activityLogAlertName is
|
||||
// the name of the activity log alert.
|
||||
func (client ActivityLogAlertsClient) Delete(resourceGroupName string, activityLogAlertName string) (result autorest.Response, err error) {
|
||||
req, err := client.DeletePreparer(resourceGroupName, activityLogAlertName)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "monitor.ActivityLogAlertsClient", "Delete", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.DeleteSender(req)
|
||||
if err != nil {
|
||||
result.Response = resp
|
||||
err = autorest.NewErrorWithError(err, "monitor.ActivityLogAlertsClient", "Delete", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.DeleteResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "monitor.ActivityLogAlertsClient", "Delete", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// DeletePreparer prepares the Delete request.
|
||||
func (client ActivityLogAlertsClient) DeletePreparer(resourceGroupName string, activityLogAlertName string) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"activityLogAlertName": autorest.Encode("path", activityLogAlertName),
|
||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
}
|
||||
|
||||
const APIVersion = "2017-03-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.insights/activityLogAlerts/{activityLogAlertName}", 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 ActivityLogAlertsClient) 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 ActivityLogAlertsClient) 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 get an activity log alert.
|
||||
//
|
||||
// resourceGroupName is the name of the resource group. activityLogAlertName is
|
||||
// the name of the activity log alert.
|
||||
func (client ActivityLogAlertsClient) Get(resourceGroupName string, activityLogAlertName string) (result ActivityLogAlertResource, err error) {
|
||||
req, err := client.GetPreparer(resourceGroupName, activityLogAlertName)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "monitor.ActivityLogAlertsClient", "Get", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.GetSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
err = autorest.NewErrorWithError(err, "monitor.ActivityLogAlertsClient", "Get", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.GetResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "monitor.ActivityLogAlertsClient", "Get", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// GetPreparer prepares the Get request.
|
||||
func (client ActivityLogAlertsClient) GetPreparer(resourceGroupName string, activityLogAlertName string) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"activityLogAlertName": autorest.Encode("path", activityLogAlertName),
|
||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
}
|
||||
|
||||
const APIVersion = "2017-03-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.insights/activityLogAlerts/{activityLogAlertName}", 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 ActivityLogAlertsClient) 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 ActivityLogAlertsClient) GetResponder(resp *http.Response) (result ActivityLogAlertResource, 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 get a list of all activity log alerts in a resource
|
||||
// group.
|
||||
//
|
||||
// resourceGroupName is the name of the resource group.
|
||||
func (client ActivityLogAlertsClient) ListByResourceGroup(resourceGroupName string) (result ActivityLogAlertList, err error) {
|
||||
req, err := client.ListByResourceGroupPreparer(resourceGroupName)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "monitor.ActivityLogAlertsClient", "ListByResourceGroup", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.ListByResourceGroupSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
err = autorest.NewErrorWithError(err, "monitor.ActivityLogAlertsClient", "ListByResourceGroup", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.ListByResourceGroupResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "monitor.ActivityLogAlertsClient", "ListByResourceGroup", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// ListByResourceGroupPreparer prepares the ListByResourceGroup request.
|
||||
func (client ActivityLogAlertsClient) ListByResourceGroupPreparer(resourceGroupName string) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
}
|
||||
|
||||
const APIVersion = "2017-03-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.insights/activityLogAlerts", 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 ActivityLogAlertsClient) 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 ActivityLogAlertsClient) ListByResourceGroupResponder(resp *http.Response) (result ActivityLogAlertList, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||
autorest.ByUnmarshallingJSON(&result),
|
||||
autorest.ByClosing())
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return
|
||||
}
|
||||
|
||||
// ListBySubscriptionID get a list of all activity log alerts in a
|
||||
// subscription.
|
||||
func (client ActivityLogAlertsClient) ListBySubscriptionID() (result ActivityLogAlertList, err error) {
|
||||
req, err := client.ListBySubscriptionIDPreparer()
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "monitor.ActivityLogAlertsClient", "ListBySubscriptionID", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.ListBySubscriptionIDSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
err = autorest.NewErrorWithError(err, "monitor.ActivityLogAlertsClient", "ListBySubscriptionID", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.ListBySubscriptionIDResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "monitor.ActivityLogAlertsClient", "ListBySubscriptionID", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// ListBySubscriptionIDPreparer prepares the ListBySubscriptionID request.
|
||||
func (client ActivityLogAlertsClient) ListBySubscriptionIDPreparer() (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
}
|
||||
|
||||
const APIVersion = "2017-03-01-preview"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsGet(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/activityLogAlerts", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// ListBySubscriptionIDSender sends the ListBySubscriptionID request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client ActivityLogAlertsClient) ListBySubscriptionIDSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client, req)
|
||||
}
|
||||
|
||||
// ListBySubscriptionIDResponder handles the response to the ListBySubscriptionID request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client ActivityLogAlertsClient) ListBySubscriptionIDResponder(resp *http.Response) (result ActivityLogAlertList, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||
autorest.ByUnmarshallingJSON(&result),
|
||||
autorest.ByClosing())
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return
|
||||
}
|
||||
|
||||
// Update updates an existing ActivityLogAlertResource's tags. To update other
|
||||
// fields use the CreateOrUpdate method.
|
||||
//
|
||||
// resourceGroupName is the name of the resource group. activityLogAlertName is
|
||||
// the name of the activity log alert. activityLogAlertPatch is parameters
|
||||
// supplied to the operation.
|
||||
func (client ActivityLogAlertsClient) Update(resourceGroupName string, activityLogAlertName string, activityLogAlertPatch ActivityLogAlertResourcePatch) (result ActivityLogAlertResource, err error) {
|
||||
req, err := client.UpdatePreparer(resourceGroupName, activityLogAlertName, activityLogAlertPatch)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "monitor.ActivityLogAlertsClient", "Update", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.UpdateSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
err = autorest.NewErrorWithError(err, "monitor.ActivityLogAlertsClient", "Update", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.UpdateResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "monitor.ActivityLogAlertsClient", "Update", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// UpdatePreparer prepares the Update request.
|
||||
func (client ActivityLogAlertsClient) UpdatePreparer(resourceGroupName string, activityLogAlertName string, activityLogAlertPatch ActivityLogAlertResourcePatch) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"activityLogAlertName": autorest.Encode("path", activityLogAlertName),
|
||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
}
|
||||
|
||||
const APIVersion = "2017-03-01-preview"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsJSON(),
|
||||
autorest.AsPatch(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/activityLogAlerts/{activityLogAlertName}", pathParameters),
|
||||
autorest.WithJSON(activityLogAlertPatch),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// UpdateSender sends the Update request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client ActivityLogAlertsClient) UpdateSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client, req)
|
||||
}
|
||||
|
||||
// UpdateResponder handles the response to the Update request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client ActivityLogAlertsClient) UpdateResponder(resp *http.Response) (result ActivityLogAlertResource, 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
+176
@@ -0,0 +1,176 @@
|
||||
package monitor
|
||||
|
||||
// Copyright (c) Microsoft and contributors. All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
//
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0
|
||||
// Changes may cause incorrect behavior and will be lost if the code is
|
||||
// regenerated.
|
||||
|
||||
import (
|
||||
"github.com/Azure/go-autorest/autorest"
|
||||
"github.com/Azure/go-autorest/autorest/azure"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
// AlertRuleIncidentsClient is the composite Swagger for Monitor Management
|
||||
// Client
|
||||
type AlertRuleIncidentsClient struct {
|
||||
ManagementClient
|
||||
}
|
||||
|
||||
// NewAlertRuleIncidentsClient creates an instance of the
|
||||
// AlertRuleIncidentsClient client.
|
||||
func NewAlertRuleIncidentsClient(subscriptionID string) AlertRuleIncidentsClient {
|
||||
return NewAlertRuleIncidentsClientWithBaseURI(DefaultBaseURI, subscriptionID)
|
||||
}
|
||||
|
||||
// NewAlertRuleIncidentsClientWithBaseURI creates an instance of the
|
||||
// AlertRuleIncidentsClient client.
|
||||
func NewAlertRuleIncidentsClientWithBaseURI(baseURI string, subscriptionID string) AlertRuleIncidentsClient {
|
||||
return AlertRuleIncidentsClient{NewWithBaseURI(baseURI, subscriptionID)}
|
||||
}
|
||||
|
||||
// Get gets an incident associated to an alert rule
|
||||
//
|
||||
// resourceGroupName is the name of the resource group. ruleName is the name of
|
||||
// the rule. incidentName is the name of the incident to retrieve.
|
||||
func (client AlertRuleIncidentsClient) Get(resourceGroupName string, ruleName string, incidentName string) (result Incident, err error) {
|
||||
req, err := client.GetPreparer(resourceGroupName, ruleName, incidentName)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "monitor.AlertRuleIncidentsClient", "Get", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.GetSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
err = autorest.NewErrorWithError(err, "monitor.AlertRuleIncidentsClient", "Get", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.GetResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "monitor.AlertRuleIncidentsClient", "Get", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// GetPreparer prepares the Get request.
|
||||
func (client AlertRuleIncidentsClient) GetPreparer(resourceGroupName string, ruleName string, incidentName string) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"incidentName": autorest.Encode("path", incidentName),
|
||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||
"ruleName": autorest.Encode("path", ruleName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
}
|
||||
|
||||
const APIVersion = "2016-03-01"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsGet(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/alertrules/{ruleName}/incidents/{incidentName}", 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 AlertRuleIncidentsClient) 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 AlertRuleIncidentsClient) GetResponder(resp *http.Response) (result Incident, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||
autorest.ByUnmarshallingJSON(&result),
|
||||
autorest.ByClosing())
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return
|
||||
}
|
||||
|
||||
// ListByAlertRule gets a list of incidents associated to an alert rule
|
||||
//
|
||||
// resourceGroupName is the name of the resource group. ruleName is the name of
|
||||
// the rule.
|
||||
func (client AlertRuleIncidentsClient) ListByAlertRule(resourceGroupName string, ruleName string) (result IncidentListResult, err error) {
|
||||
req, err := client.ListByAlertRulePreparer(resourceGroupName, ruleName)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "monitor.AlertRuleIncidentsClient", "ListByAlertRule", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.ListByAlertRuleSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
err = autorest.NewErrorWithError(err, "monitor.AlertRuleIncidentsClient", "ListByAlertRule", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.ListByAlertRuleResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "monitor.AlertRuleIncidentsClient", "ListByAlertRule", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// ListByAlertRulePreparer prepares the ListByAlertRule request.
|
||||
func (client AlertRuleIncidentsClient) ListByAlertRulePreparer(resourceGroupName string, ruleName string) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||
"ruleName": autorest.Encode("path", ruleName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
}
|
||||
|
||||
const APIVersion = "2016-03-01"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsGet(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/alertrules/{ruleName}/incidents", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// ListByAlertRuleSender sends the ListByAlertRule request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client AlertRuleIncidentsClient) ListByAlertRuleSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client, req)
|
||||
}
|
||||
|
||||
// ListByAlertRuleResponder handles the response to the ListByAlertRule request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client AlertRuleIncidentsClient) ListByAlertRuleResponder(resp *http.Response) (result IncidentListResult, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||
autorest.ByUnmarshallingJSON(&result),
|
||||
autorest.ByClosing())
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return
|
||||
}
|
||||
+315
@@ -0,0 +1,315 @@
|
||||
package monitor
|
||||
|
||||
// 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"
|
||||
)
|
||||
|
||||
// AlertRulesClient is the composite Swagger for Monitor Management Client
|
||||
type AlertRulesClient struct {
|
||||
ManagementClient
|
||||
}
|
||||
|
||||
// NewAlertRulesClient creates an instance of the AlertRulesClient client.
|
||||
func NewAlertRulesClient(subscriptionID string) AlertRulesClient {
|
||||
return NewAlertRulesClientWithBaseURI(DefaultBaseURI, subscriptionID)
|
||||
}
|
||||
|
||||
// NewAlertRulesClientWithBaseURI creates an instance of the AlertRulesClient
|
||||
// client.
|
||||
func NewAlertRulesClientWithBaseURI(baseURI string, subscriptionID string) AlertRulesClient {
|
||||
return AlertRulesClient{NewWithBaseURI(baseURI, subscriptionID)}
|
||||
}
|
||||
|
||||
// CreateOrUpdate creates or updates an alert rule.
|
||||
//
|
||||
// resourceGroupName is the name of the resource group. ruleName is the name of
|
||||
// the rule. parameters is the parameters of the rule to create or update.
|
||||
func (client AlertRulesClient) CreateOrUpdate(resourceGroupName string, ruleName string, parameters AlertRuleResource) (result AlertRuleResource, err error) {
|
||||
if err := validation.Validate([]validation.Validation{
|
||||
{TargetValue: parameters,
|
||||
Constraints: []validation.Constraint{{Target: "parameters.AlertRule", Name: validation.Null, Rule: true,
|
||||
Chain: []validation.Constraint{{Target: "parameters.AlertRule.Name", Name: validation.Null, Rule: true, Chain: nil},
|
||||
{Target: "parameters.AlertRule.IsEnabled", Name: validation.Null, Rule: true, Chain: nil},
|
||||
{Target: "parameters.AlertRule.Condition", Name: validation.Null, Rule: true, Chain: nil},
|
||||
}}}}}); err != nil {
|
||||
return result, validation.NewErrorWithValidationError(err, "monitor.AlertRulesClient", "CreateOrUpdate")
|
||||
}
|
||||
|
||||
req, err := client.CreateOrUpdatePreparer(resourceGroupName, ruleName, parameters)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "monitor.AlertRulesClient", "CreateOrUpdate", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.CreateOrUpdateSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
err = autorest.NewErrorWithError(err, "monitor.AlertRulesClient", "CreateOrUpdate", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.CreateOrUpdateResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "monitor.AlertRulesClient", "CreateOrUpdate", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// CreateOrUpdatePreparer prepares the CreateOrUpdate request.
|
||||
func (client AlertRulesClient) CreateOrUpdatePreparer(resourceGroupName string, ruleName string, parameters AlertRuleResource) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||
"ruleName": autorest.Encode("path", ruleName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
}
|
||||
|
||||
const APIVersion = "2016-03-01"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsJSON(),
|
||||
autorest.AsPut(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/alertrules/{ruleName}", 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 AlertRulesClient) 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 AlertRulesClient) CreateOrUpdateResponder(resp *http.Response) (result AlertRuleResource, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated),
|
||||
autorest.ByUnmarshallingJSON(&result),
|
||||
autorest.ByClosing())
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return
|
||||
}
|
||||
|
||||
// Delete deletes an alert rule
|
||||
//
|
||||
// resourceGroupName is the name of the resource group. ruleName is the name of
|
||||
// the rule.
|
||||
func (client AlertRulesClient) Delete(resourceGroupName string, ruleName string) (result autorest.Response, err error) {
|
||||
req, err := client.DeletePreparer(resourceGroupName, ruleName)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "monitor.AlertRulesClient", "Delete", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.DeleteSender(req)
|
||||
if err != nil {
|
||||
result.Response = resp
|
||||
err = autorest.NewErrorWithError(err, "monitor.AlertRulesClient", "Delete", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.DeleteResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "monitor.AlertRulesClient", "Delete", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// DeletePreparer prepares the Delete request.
|
||||
func (client AlertRulesClient) DeletePreparer(resourceGroupName string, ruleName string) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||
"ruleName": autorest.Encode("path", ruleName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
}
|
||||
|
||||
const APIVersion = "2016-03-01"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsDelete(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/alertrules/{ruleName}", 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 AlertRulesClient) 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 AlertRulesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK),
|
||||
autorest.ByClosing())
|
||||
result.Response = resp
|
||||
return
|
||||
}
|
||||
|
||||
// Get gets an alert rule
|
||||
//
|
||||
// resourceGroupName is the name of the resource group. ruleName is the name of
|
||||
// the rule.
|
||||
func (client AlertRulesClient) Get(resourceGroupName string, ruleName string) (result AlertRuleResource, err error) {
|
||||
req, err := client.GetPreparer(resourceGroupName, ruleName)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "monitor.AlertRulesClient", "Get", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.GetSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
err = autorest.NewErrorWithError(err, "monitor.AlertRulesClient", "Get", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.GetResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "monitor.AlertRulesClient", "Get", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// GetPreparer prepares the Get request.
|
||||
func (client AlertRulesClient) GetPreparer(resourceGroupName string, ruleName string) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||
"ruleName": autorest.Encode("path", ruleName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
}
|
||||
|
||||
const APIVersion = "2016-03-01"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsGet(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/alertrules/{ruleName}", 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 AlertRulesClient) 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 AlertRulesClient) GetResponder(resp *http.Response) (result AlertRuleResource, 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 list the alert rules within a resource group.
|
||||
//
|
||||
// resourceGroupName is the name of the resource group.
|
||||
func (client AlertRulesClient) ListByResourceGroup(resourceGroupName string) (result AlertRuleResourceCollection, err error) {
|
||||
req, err := client.ListByResourceGroupPreparer(resourceGroupName)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "monitor.AlertRulesClient", "ListByResourceGroup", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.ListByResourceGroupSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
err = autorest.NewErrorWithError(err, "monitor.AlertRulesClient", "ListByResourceGroup", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.ListByResourceGroupResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "monitor.AlertRulesClient", "ListByResourceGroup", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// ListByResourceGroupPreparer prepares the ListByResourceGroup request.
|
||||
func (client AlertRulesClient) ListByResourceGroupPreparer(resourceGroupName string) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
}
|
||||
|
||||
const APIVersion = "2016-03-01"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsGet(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/alertrules", 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 AlertRulesClient) 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 AlertRulesClient) ListByResourceGroupResponder(resp *http.Response) (result AlertRuleResourceCollection, 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
+341
@@ -0,0 +1,341 @@
|
||||
package monitor
|
||||
|
||||
// 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"
|
||||
)
|
||||
|
||||
// AutoscaleSettingsClient is the composite Swagger for Monitor Management
|
||||
// Client
|
||||
type AutoscaleSettingsClient struct {
|
||||
ManagementClient
|
||||
}
|
||||
|
||||
// NewAutoscaleSettingsClient creates an instance of the
|
||||
// AutoscaleSettingsClient client.
|
||||
func NewAutoscaleSettingsClient(subscriptionID string) AutoscaleSettingsClient {
|
||||
return NewAutoscaleSettingsClientWithBaseURI(DefaultBaseURI, subscriptionID)
|
||||
}
|
||||
|
||||
// NewAutoscaleSettingsClientWithBaseURI creates an instance of the
|
||||
// AutoscaleSettingsClient client.
|
||||
func NewAutoscaleSettingsClientWithBaseURI(baseURI string, subscriptionID string) AutoscaleSettingsClient {
|
||||
return AutoscaleSettingsClient{NewWithBaseURI(baseURI, subscriptionID)}
|
||||
}
|
||||
|
||||
// CreateOrUpdate creates or updates an autoscale setting.
|
||||
//
|
||||
// resourceGroupName is the name of the resource group. autoscaleSettingName is
|
||||
// the autoscale setting name. parameters is parameters supplied to the
|
||||
// operation.
|
||||
func (client AutoscaleSettingsClient) CreateOrUpdate(resourceGroupName string, autoscaleSettingName string, parameters AutoscaleSettingResource) (result AutoscaleSettingResource, err error) {
|
||||
if err := validation.Validate([]validation.Validation{
|
||||
{TargetValue: parameters,
|
||||
Constraints: []validation.Constraint{{Target: "parameters.AutoscaleSetting", Name: validation.Null, Rule: true,
|
||||
Chain: []validation.Constraint{{Target: "parameters.AutoscaleSetting.Profiles", Name: validation.Null, Rule: true,
|
||||
Chain: []validation.Constraint{{Target: "parameters.AutoscaleSetting.Profiles", Name: validation.MaxItems, Rule: 20, Chain: nil}}},
|
||||
}}}}}); err != nil {
|
||||
return result, validation.NewErrorWithValidationError(err, "monitor.AutoscaleSettingsClient", "CreateOrUpdate")
|
||||
}
|
||||
|
||||
req, err := client.CreateOrUpdatePreparer(resourceGroupName, autoscaleSettingName, parameters)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "monitor.AutoscaleSettingsClient", "CreateOrUpdate", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.CreateOrUpdateSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
err = autorest.NewErrorWithError(err, "monitor.AutoscaleSettingsClient", "CreateOrUpdate", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.CreateOrUpdateResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "monitor.AutoscaleSettingsClient", "CreateOrUpdate", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// CreateOrUpdatePreparer prepares the CreateOrUpdate request.
|
||||
func (client AutoscaleSettingsClient) CreateOrUpdatePreparer(resourceGroupName string, autoscaleSettingName string, parameters AutoscaleSettingResource) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"autoscaleSettingName": autorest.Encode("path", autoscaleSettingName),
|
||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
}
|
||||
|
||||
const APIVersion = "2015-04-01"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsJSON(),
|
||||
autorest.AsPut(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/autoscalesettings/{autoscaleSettingName}", 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 AutoscaleSettingsClient) 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 AutoscaleSettingsClient) CreateOrUpdateResponder(resp *http.Response) (result AutoscaleSettingResource, 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 and autoscale setting
|
||||
//
|
||||
// resourceGroupName is the name of the resource group. autoscaleSettingName is
|
||||
// the autoscale setting name.
|
||||
func (client AutoscaleSettingsClient) Delete(resourceGroupName string, autoscaleSettingName string) (result autorest.Response, err error) {
|
||||
req, err := client.DeletePreparer(resourceGroupName, autoscaleSettingName)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "monitor.AutoscaleSettingsClient", "Delete", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.DeleteSender(req)
|
||||
if err != nil {
|
||||
result.Response = resp
|
||||
err = autorest.NewErrorWithError(err, "monitor.AutoscaleSettingsClient", "Delete", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.DeleteResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "monitor.AutoscaleSettingsClient", "Delete", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// DeletePreparer prepares the Delete request.
|
||||
func (client AutoscaleSettingsClient) DeletePreparer(resourceGroupName string, autoscaleSettingName string) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"autoscaleSettingName": autorest.Encode("path", autoscaleSettingName),
|
||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
}
|
||||
|
||||
const APIVersion = "2015-04-01"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsDelete(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/autoscalesettings/{autoscaleSettingName}", 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 AutoscaleSettingsClient) 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 AutoscaleSettingsClient) 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 an autoscale setting
|
||||
//
|
||||
// resourceGroupName is the name of the resource group. autoscaleSettingName is
|
||||
// the autoscale setting name.
|
||||
func (client AutoscaleSettingsClient) Get(resourceGroupName string, autoscaleSettingName string) (result AutoscaleSettingResource, err error) {
|
||||
req, err := client.GetPreparer(resourceGroupName, autoscaleSettingName)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "monitor.AutoscaleSettingsClient", "Get", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.GetSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
err = autorest.NewErrorWithError(err, "monitor.AutoscaleSettingsClient", "Get", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.GetResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "monitor.AutoscaleSettingsClient", "Get", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// GetPreparer prepares the Get request.
|
||||
func (client AutoscaleSettingsClient) GetPreparer(resourceGroupName string, autoscaleSettingName string) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"autoscaleSettingName": autorest.Encode("path", autoscaleSettingName),
|
||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
}
|
||||
|
||||
const APIVersion = "2015-04-01"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsGet(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/autoscalesettings/{autoscaleSettingName}", 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 AutoscaleSettingsClient) 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 AutoscaleSettingsClient) GetResponder(resp *http.Response) (result AutoscaleSettingResource, 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 lists the autoscale settings for a resource group
|
||||
//
|
||||
// resourceGroupName is the name of the resource group.
|
||||
func (client AutoscaleSettingsClient) ListByResourceGroup(resourceGroupName string) (result AutoscaleSettingResourceCollection, err error) {
|
||||
req, err := client.ListByResourceGroupPreparer(resourceGroupName)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "monitor.AutoscaleSettingsClient", "ListByResourceGroup", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.ListByResourceGroupSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
err = autorest.NewErrorWithError(err, "monitor.AutoscaleSettingsClient", "ListByResourceGroup", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.ListByResourceGroupResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "monitor.AutoscaleSettingsClient", "ListByResourceGroup", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// ListByResourceGroupPreparer prepares the ListByResourceGroup request.
|
||||
func (client AutoscaleSettingsClient) ListByResourceGroupPreparer(resourceGroupName string) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
}
|
||||
|
||||
const APIVersion = "2015-04-01"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsGet(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/autoscalesettings", 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 AutoscaleSettingsClient) 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 AutoscaleSettingsClient) ListByResourceGroupResponder(resp *http.Response) (result AutoscaleSettingResourceCollection, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||
autorest.ByUnmarshallingJSON(&result),
|
||||
autorest.ByClosing())
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return
|
||||
}
|
||||
|
||||
// ListByResourceGroupNextResults retrieves the next set of results, if any.
|
||||
func (client AutoscaleSettingsClient) ListByResourceGroupNextResults(lastResults AutoscaleSettingResourceCollection) (result AutoscaleSettingResourceCollection, err error) {
|
||||
req, err := lastResults.AutoscaleSettingResourceCollectionPreparer()
|
||||
if err != nil {
|
||||
return result, autorest.NewErrorWithError(err, "monitor.AutoscaleSettingsClient", "ListByResourceGroup", nil, "Failure preparing next results request")
|
||||
}
|
||||
if req == nil {
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.ListByResourceGroupSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return result, autorest.NewErrorWithError(err, "monitor.AutoscaleSettingsClient", "ListByResourceGroup", resp, "Failure sending next results request")
|
||||
}
|
||||
|
||||
result, err = client.ListByResourceGroupResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "monitor.AutoscaleSettingsClient", "ListByResourceGroup", resp, "Failure responding to next results request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
+52
@@ -0,0 +1,52 @@
|
||||
// Package monitor implements the Azure ARM Monitor service API version .
|
||||
//
|
||||
// Composite Swagger for Monitor Management Client
|
||||
package monitor
|
||||
|
||||
// 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 Monitor
|
||||
DefaultBaseURI = "https://management.azure.com"
|
||||
)
|
||||
|
||||
// ManagementClient is the base client for Monitor.
|
||||
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,
|
||||
}
|
||||
}
|
||||
+311
@@ -0,0 +1,311 @@
|
||||
package monitor
|
||||
|
||||
// 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"
|
||||
)
|
||||
|
||||
// LogProfilesClient is the composite Swagger for Monitor Management Client
|
||||
type LogProfilesClient struct {
|
||||
ManagementClient
|
||||
}
|
||||
|
||||
// NewLogProfilesClient creates an instance of the LogProfilesClient client.
|
||||
func NewLogProfilesClient(subscriptionID string) LogProfilesClient {
|
||||
return NewLogProfilesClientWithBaseURI(DefaultBaseURI, subscriptionID)
|
||||
}
|
||||
|
||||
// NewLogProfilesClientWithBaseURI creates an instance of the LogProfilesClient
|
||||
// client.
|
||||
func NewLogProfilesClientWithBaseURI(baseURI string, subscriptionID string) LogProfilesClient {
|
||||
return LogProfilesClient{NewWithBaseURI(baseURI, subscriptionID)}
|
||||
}
|
||||
|
||||
// CreateOrUpdate create or update a log profile in Azure Monitoring REST API.
|
||||
//
|
||||
// logProfileName is the name of the log profile. parameters is parameters
|
||||
// supplied to the operation.
|
||||
func (client LogProfilesClient) CreateOrUpdate(logProfileName string, parameters LogProfileResource) (result LogProfileResource, err error) {
|
||||
if err := validation.Validate([]validation.Validation{
|
||||
{TargetValue: parameters,
|
||||
Constraints: []validation.Constraint{{Target: "parameters.LogProfileProperties", Name: validation.Null, Rule: true,
|
||||
Chain: []validation.Constraint{{Target: "parameters.LogProfileProperties.Locations", Name: validation.Null, Rule: true, Chain: nil},
|
||||
{Target: "parameters.LogProfileProperties.Categories", Name: validation.Null, Rule: true, Chain: nil},
|
||||
{Target: "parameters.LogProfileProperties.RetentionPolicy", Name: validation.Null, Rule: true,
|
||||
Chain: []validation.Constraint{{Target: "parameters.LogProfileProperties.RetentionPolicy.Enabled", Name: validation.Null, Rule: true, Chain: nil},
|
||||
{Target: "parameters.LogProfileProperties.RetentionPolicy.Days", Name: validation.Null, Rule: true,
|
||||
Chain: []validation.Constraint{{Target: "parameters.LogProfileProperties.RetentionPolicy.Days", Name: validation.InclusiveMinimum, Rule: 0, Chain: nil}}},
|
||||
}},
|
||||
}}}}}); err != nil {
|
||||
return result, validation.NewErrorWithValidationError(err, "monitor.LogProfilesClient", "CreateOrUpdate")
|
||||
}
|
||||
|
||||
req, err := client.CreateOrUpdatePreparer(logProfileName, parameters)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "monitor.LogProfilesClient", "CreateOrUpdate", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.CreateOrUpdateSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
err = autorest.NewErrorWithError(err, "monitor.LogProfilesClient", "CreateOrUpdate", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.CreateOrUpdateResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "monitor.LogProfilesClient", "CreateOrUpdate", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// CreateOrUpdatePreparer prepares the CreateOrUpdate request.
|
||||
func (client LogProfilesClient) CreateOrUpdatePreparer(logProfileName string, parameters LogProfileResource) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"logProfileName": autorest.Encode("path", logProfileName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
}
|
||||
|
||||
const APIVersion = "2016-03-01"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsJSON(),
|
||||
autorest.AsPut(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/logprofiles/{logProfileName}", 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 LogProfilesClient) 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 LogProfilesClient) CreateOrUpdateResponder(resp *http.Response) (result LogProfileResource, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||
autorest.ByUnmarshallingJSON(&result),
|
||||
autorest.ByClosing())
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return
|
||||
}
|
||||
|
||||
// Delete deletes the log profile.
|
||||
//
|
||||
// logProfileName is the name of the log profile.
|
||||
func (client LogProfilesClient) Delete(logProfileName string) (result autorest.Response, err error) {
|
||||
req, err := client.DeletePreparer(logProfileName)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "monitor.LogProfilesClient", "Delete", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.DeleteSender(req)
|
||||
if err != nil {
|
||||
result.Response = resp
|
||||
err = autorest.NewErrorWithError(err, "monitor.LogProfilesClient", "Delete", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.DeleteResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "monitor.LogProfilesClient", "Delete", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// DeletePreparer prepares the Delete request.
|
||||
func (client LogProfilesClient) DeletePreparer(logProfileName string) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"logProfileName": autorest.Encode("path", logProfileName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
}
|
||||
|
||||
const APIVersion = "2016-03-01"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsDelete(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/logprofiles/{logProfileName}", 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 LogProfilesClient) 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 LogProfilesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||
autorest.ByClosing())
|
||||
result.Response = resp
|
||||
return
|
||||
}
|
||||
|
||||
// Get gets the log profile.
|
||||
//
|
||||
// logProfileName is the name of the log profile.
|
||||
func (client LogProfilesClient) Get(logProfileName string) (result LogProfileResource, err error) {
|
||||
req, err := client.GetPreparer(logProfileName)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "monitor.LogProfilesClient", "Get", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.GetSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
err = autorest.NewErrorWithError(err, "monitor.LogProfilesClient", "Get", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.GetResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "monitor.LogProfilesClient", "Get", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// GetPreparer prepares the Get request.
|
||||
func (client LogProfilesClient) GetPreparer(logProfileName string) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"logProfileName": autorest.Encode("path", logProfileName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
}
|
||||
|
||||
const APIVersion = "2016-03-01"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsGet(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/logprofiles/{logProfileName}", 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 LogProfilesClient) 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 LogProfilesClient) GetResponder(resp *http.Response) (result LogProfileResource, 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 list the log profiles.
|
||||
func (client LogProfilesClient) List() (result LogProfileCollection, err error) {
|
||||
req, err := client.ListPreparer()
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "monitor.LogProfilesClient", "List", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.ListSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
err = autorest.NewErrorWithError(err, "monitor.LogProfilesClient", "List", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.ListResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "monitor.LogProfilesClient", "List", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// ListPreparer prepares the List request.
|
||||
func (client LogProfilesClient) ListPreparer() (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
}
|
||||
|
||||
const APIVersion = "2016-03-01"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsGet(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/logprofiles", 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 LogProfilesClient) 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 LogProfilesClient) ListResponder(resp *http.Response) (result LogProfileCollection, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||
autorest.ByUnmarshallingJSON(&result),
|
||||
autorest.ByClosing())
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return
|
||||
}
|
||||
+586
@@ -0,0 +1,586 @@
|
||||
package monitor
|
||||
|
||||
// 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"
|
||||
)
|
||||
|
||||
// ComparisonOperationType enumerates the values for comparison operation type.
|
||||
type ComparisonOperationType string
|
||||
|
||||
const (
|
||||
// Equals specifies the equals state for comparison operation type.
|
||||
Equals ComparisonOperationType = "Equals"
|
||||
// GreaterThan specifies the greater than state for comparison operation
|
||||
// type.
|
||||
GreaterThan ComparisonOperationType = "GreaterThan"
|
||||
// GreaterThanOrEqual specifies the greater than or equal state for
|
||||
// comparison operation type.
|
||||
GreaterThanOrEqual ComparisonOperationType = "GreaterThanOrEqual"
|
||||
// LessThan specifies the less than state for comparison operation type.
|
||||
LessThan ComparisonOperationType = "LessThan"
|
||||
// LessThanOrEqual specifies the less than or equal state for comparison
|
||||
// operation type.
|
||||
LessThanOrEqual ComparisonOperationType = "LessThanOrEqual"
|
||||
// NotEquals specifies the not equals state for comparison operation type.
|
||||
NotEquals ComparisonOperationType = "NotEquals"
|
||||
)
|
||||
|
||||
// ConditionOperator enumerates the values for condition operator.
|
||||
type ConditionOperator string
|
||||
|
||||
const (
|
||||
// ConditionOperatorGreaterThan specifies the condition operator greater
|
||||
// than state for condition operator.
|
||||
ConditionOperatorGreaterThan ConditionOperator = "GreaterThan"
|
||||
// ConditionOperatorGreaterThanOrEqual specifies the condition operator
|
||||
// greater than or equal state for condition operator.
|
||||
ConditionOperatorGreaterThanOrEqual ConditionOperator = "GreaterThanOrEqual"
|
||||
// ConditionOperatorLessThan specifies the condition operator less than
|
||||
// state for condition operator.
|
||||
ConditionOperatorLessThan ConditionOperator = "LessThan"
|
||||
// ConditionOperatorLessThanOrEqual specifies the condition operator less
|
||||
// than or equal state for condition operator.
|
||||
ConditionOperatorLessThanOrEqual ConditionOperator = "LessThanOrEqual"
|
||||
)
|
||||
|
||||
// MetricStatisticType enumerates the values for metric statistic type.
|
||||
type MetricStatisticType string
|
||||
|
||||
const (
|
||||
// Average specifies the average state for metric statistic type.
|
||||
Average MetricStatisticType = "Average"
|
||||
// Max specifies the max state for metric statistic type.
|
||||
Max MetricStatisticType = "Max"
|
||||
// Min specifies the min state for metric statistic type.
|
||||
Min MetricStatisticType = "Min"
|
||||
// Sum specifies the sum state for metric statistic type.
|
||||
Sum MetricStatisticType = "Sum"
|
||||
)
|
||||
|
||||
// RecurrenceFrequency enumerates the values for recurrence frequency.
|
||||
type RecurrenceFrequency string
|
||||
|
||||
const (
|
||||
// Day specifies the day state for recurrence frequency.
|
||||
Day RecurrenceFrequency = "Day"
|
||||
// Hour specifies the hour state for recurrence frequency.
|
||||
Hour RecurrenceFrequency = "Hour"
|
||||
// Minute specifies the minute state for recurrence frequency.
|
||||
Minute RecurrenceFrequency = "Minute"
|
||||
// Month specifies the month state for recurrence frequency.
|
||||
Month RecurrenceFrequency = "Month"
|
||||
// None specifies the none state for recurrence frequency.
|
||||
None RecurrenceFrequency = "None"
|
||||
// Second specifies the second state for recurrence frequency.
|
||||
Second RecurrenceFrequency = "Second"
|
||||
// Week specifies the week state for recurrence frequency.
|
||||
Week RecurrenceFrequency = "Week"
|
||||
// Year specifies the year state for recurrence frequency.
|
||||
Year RecurrenceFrequency = "Year"
|
||||
)
|
||||
|
||||
// ScaleDirection enumerates the values for scale direction.
|
||||
type ScaleDirection string
|
||||
|
||||
const (
|
||||
// ScaleDirectionDecrease specifies the scale direction decrease state for
|
||||
// scale direction.
|
||||
ScaleDirectionDecrease ScaleDirection = "Decrease"
|
||||
// ScaleDirectionIncrease specifies the scale direction increase state for
|
||||
// scale direction.
|
||||
ScaleDirectionIncrease ScaleDirection = "Increase"
|
||||
// ScaleDirectionNone specifies the scale direction none state for scale
|
||||
// direction.
|
||||
ScaleDirectionNone ScaleDirection = "None"
|
||||
)
|
||||
|
||||
// ScaleType enumerates the values for scale type.
|
||||
type ScaleType string
|
||||
|
||||
const (
|
||||
// ChangeCount specifies the change count state for scale type.
|
||||
ChangeCount ScaleType = "ChangeCount"
|
||||
// ExactCount specifies the exact count state for scale type.
|
||||
ExactCount ScaleType = "ExactCount"
|
||||
// PercentChangeCount specifies the percent change count state for scale
|
||||
// type.
|
||||
PercentChangeCount ScaleType = "PercentChangeCount"
|
||||
)
|
||||
|
||||
// TimeAggregationOperator enumerates the values for time aggregation operator.
|
||||
type TimeAggregationOperator string
|
||||
|
||||
const (
|
||||
// TimeAggregationOperatorAverage specifies the time aggregation operator
|
||||
// average state for time aggregation operator.
|
||||
TimeAggregationOperatorAverage TimeAggregationOperator = "Average"
|
||||
// TimeAggregationOperatorLast specifies the time aggregation operator last
|
||||
// state for time aggregation operator.
|
||||
TimeAggregationOperatorLast TimeAggregationOperator = "Last"
|
||||
// TimeAggregationOperatorMaximum specifies the time aggregation operator
|
||||
// maximum state for time aggregation operator.
|
||||
TimeAggregationOperatorMaximum TimeAggregationOperator = "Maximum"
|
||||
// TimeAggregationOperatorMinimum specifies the time aggregation operator
|
||||
// minimum state for time aggregation operator.
|
||||
TimeAggregationOperatorMinimum TimeAggregationOperator = "Minimum"
|
||||
// TimeAggregationOperatorTotal specifies the time aggregation operator
|
||||
// total state for time aggregation operator.
|
||||
TimeAggregationOperatorTotal TimeAggregationOperator = "Total"
|
||||
)
|
||||
|
||||
// TimeAggregationType enumerates the values for time aggregation type.
|
||||
type TimeAggregationType string
|
||||
|
||||
const (
|
||||
// TimeAggregationTypeAverage specifies the time aggregation type average
|
||||
// state for time aggregation type.
|
||||
TimeAggregationTypeAverage TimeAggregationType = "Average"
|
||||
// TimeAggregationTypeCount specifies the time aggregation type count state
|
||||
// for time aggregation type.
|
||||
TimeAggregationTypeCount TimeAggregationType = "Count"
|
||||
// TimeAggregationTypeMaximum specifies the time aggregation type maximum
|
||||
// state for time aggregation type.
|
||||
TimeAggregationTypeMaximum TimeAggregationType = "Maximum"
|
||||
// TimeAggregationTypeMinimum specifies the time aggregation type minimum
|
||||
// state for time aggregation type.
|
||||
TimeAggregationTypeMinimum TimeAggregationType = "Minimum"
|
||||
// TimeAggregationTypeTotal specifies the time aggregation type total state
|
||||
// for time aggregation type.
|
||||
TimeAggregationTypeTotal TimeAggregationType = "Total"
|
||||
)
|
||||
|
||||
// ActivityLogAlert is an Azure activity log alert.
|
||||
type ActivityLogAlert struct {
|
||||
Scopes *[]string `json:"scopes,omitempty"`
|
||||
Enabled *bool `json:"enabled,omitempty"`
|
||||
Condition *ActivityLogAlertAllOfCondition `json:"condition,omitempty"`
|
||||
Actions *ActivityLogAlertActionList `json:"actions,omitempty"`
|
||||
Description *string `json:"description,omitempty"`
|
||||
}
|
||||
|
||||
// ActivityLogAlertActionGroup is a pointer to an Azure Action Group.
|
||||
type ActivityLogAlertActionGroup struct {
|
||||
ActionGroupID *string `json:"actionGroupId,omitempty"`
|
||||
WebhookProperties *map[string]*string `json:"webhookProperties,omitempty"`
|
||||
}
|
||||
|
||||
// ActivityLogAlertActionList is a list of activity log alert actions.
|
||||
type ActivityLogAlertActionList struct {
|
||||
ActionGroups *[]ActivityLogAlertActionGroup `json:"actionGroups,omitempty"`
|
||||
}
|
||||
|
||||
// ActivityLogAlertAllOfCondition is an Activity Log alert condition that is
|
||||
// met when all its member conditions are met.
|
||||
type ActivityLogAlertAllOfCondition struct {
|
||||
AllOf *[]ActivityLogAlertLeafCondition `json:"allOf,omitempty"`
|
||||
}
|
||||
|
||||
// ActivityLogAlertLeafCondition is an Activity Log alert condition that is met
|
||||
// by comparing an activity log field and value.
|
||||
type ActivityLogAlertLeafCondition struct {
|
||||
Field *string `json:"field,omitempty"`
|
||||
Equals *string `json:"equals,omitempty"`
|
||||
}
|
||||
|
||||
// ActivityLogAlertList is a list of activity log alerts.
|
||||
type ActivityLogAlertList struct {
|
||||
autorest.Response `json:"-"`
|
||||
Value *[]ActivityLogAlertResource `json:"value,omitempty"`
|
||||
}
|
||||
|
||||
// ActivityLogAlertPatch is an Azure activity log alert for patch operations.
|
||||
type ActivityLogAlertPatch struct {
|
||||
Enabled *bool `json:"enabled,omitempty"`
|
||||
}
|
||||
|
||||
// ActivityLogAlertResource is an activity log alert resource.
|
||||
type ActivityLogAlertResource 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"`
|
||||
*ActivityLogAlert `json:"properties,omitempty"`
|
||||
}
|
||||
|
||||
// ActivityLogAlertResourcePatch is an activity log alert resource for patch
|
||||
// operations.
|
||||
type ActivityLogAlertResourcePatch 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"`
|
||||
*ActivityLogAlertPatch `json:"properties,omitempty"`
|
||||
}
|
||||
|
||||
// AlertRule is an alert rule.
|
||||
type AlertRule struct {
|
||||
Name *string `json:"name,omitempty"`
|
||||
Description *string `json:"description,omitempty"`
|
||||
IsEnabled *bool `json:"isEnabled,omitempty"`
|
||||
Condition *RuleCondition `json:"condition,omitempty"`
|
||||
Actions *[]RuleAction `json:"actions,omitempty"`
|
||||
LastUpdatedTime *date.Time `json:"lastUpdatedTime,omitempty"`
|
||||
}
|
||||
|
||||
// AlertRuleResource is the alert rule resource.
|
||||
type AlertRuleResource 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"`
|
||||
*AlertRule `json:"properties,omitempty"`
|
||||
}
|
||||
|
||||
// AlertRuleResourceCollection is represents a collection of alert rule
|
||||
// resources.
|
||||
type AlertRuleResourceCollection struct {
|
||||
autorest.Response `json:"-"`
|
||||
Value *[]AlertRuleResource `json:"value,omitempty"`
|
||||
}
|
||||
|
||||
// AutoscaleNotification is autoscale notification.
|
||||
type AutoscaleNotification struct {
|
||||
Operation *string `json:"operation,omitempty"`
|
||||
Email *EmailNotification `json:"email,omitempty"`
|
||||
Webhooks *[]WebhookNotification `json:"webhooks,omitempty"`
|
||||
}
|
||||
|
||||
// AutoscaleProfile is autoscale profile.
|
||||
type AutoscaleProfile struct {
|
||||
Name *string `json:"name,omitempty"`
|
||||
Capacity *ScaleCapacity `json:"capacity,omitempty"`
|
||||
Rules *[]ScaleRule `json:"rules,omitempty"`
|
||||
FixedDate *TimeWindow `json:"fixedDate,omitempty"`
|
||||
Recurrence *Recurrence `json:"recurrence,omitempty"`
|
||||
}
|
||||
|
||||
// AutoscaleSetting is a setting that contains all of the configuration for the
|
||||
// automatic scaling of a resource.
|
||||
type AutoscaleSetting struct {
|
||||
Profiles *[]AutoscaleProfile `json:"profiles,omitempty"`
|
||||
Notifications *[]AutoscaleNotification `json:"notifications,omitempty"`
|
||||
Enabled *bool `json:"enabled,omitempty"`
|
||||
Name *string `json:"name,omitempty"`
|
||||
TargetResourceURI *string `json:"targetResourceUri,omitempty"`
|
||||
}
|
||||
|
||||
// AutoscaleSettingResource is the autoscale setting resource.
|
||||
type AutoscaleSettingResource 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"`
|
||||
*AutoscaleSetting `json:"properties,omitempty"`
|
||||
}
|
||||
|
||||
// AutoscaleSettingResourceCollection is represents a collection of autoscale
|
||||
// setting resources.
|
||||
type AutoscaleSettingResourceCollection struct {
|
||||
autorest.Response `json:"-"`
|
||||
Value *[]AutoscaleSettingResource `json:"value,omitempty"`
|
||||
NextLink *string `json:"nextLink,omitempty"`
|
||||
}
|
||||
|
||||
// AutoscaleSettingResourceCollectionPreparer prepares a request to retrieve the next set of results. It returns
|
||||
// nil if no more results exist.
|
||||
func (client AutoscaleSettingResourceCollection) AutoscaleSettingResourceCollectionPreparer() (*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)))
|
||||
}
|
||||
|
||||
// EmailNotification is email notification of an autoscale event.
|
||||
type EmailNotification struct {
|
||||
SendToSubscriptionAdministrator *bool `json:"sendToSubscriptionAdministrator,omitempty"`
|
||||
SendToSubscriptionCoAdministrators *bool `json:"sendToSubscriptionCoAdministrators,omitempty"`
|
||||
CustomEmails *[]string `json:"customEmails,omitempty"`
|
||||
}
|
||||
|
||||
// ErrorResponse is describes the format of Error response.
|
||||
type ErrorResponse struct {
|
||||
Code *string `json:"code,omitempty"`
|
||||
Message *string `json:"message,omitempty"`
|
||||
}
|
||||
|
||||
// Incident is an alert incident indicates the activation status of an alert
|
||||
// rule.
|
||||
type Incident struct {
|
||||
autorest.Response `json:"-"`
|
||||
Name *string `json:"name,omitempty"`
|
||||
RuleName *string `json:"ruleName,omitempty"`
|
||||
IsActive *bool `json:"isActive,omitempty"`
|
||||
ActivatedTime *date.Time `json:"activatedTime,omitempty"`
|
||||
ResolvedTime *date.Time `json:"resolvedTime,omitempty"`
|
||||
}
|
||||
|
||||
// IncidentListResult is the List incidents operation response.
|
||||
type IncidentListResult struct {
|
||||
autorest.Response `json:"-"`
|
||||
Value *[]Incident `json:"value,omitempty"`
|
||||
}
|
||||
|
||||
// LocationThresholdRuleCondition is a rule condition based on a certain number
|
||||
// of locations failing.
|
||||
type LocationThresholdRuleCondition struct {
|
||||
DataSource *RuleDataSource `json:"dataSource,omitempty"`
|
||||
WindowSize *string `json:"windowSize,omitempty"`
|
||||
FailedLocationCount *int32 `json:"failedLocationCount,omitempty"`
|
||||
}
|
||||
|
||||
// LogProfileCollection is represents a collection of log profiles.
|
||||
type LogProfileCollection struct {
|
||||
autorest.Response `json:"-"`
|
||||
Value *[]LogProfileResource `json:"value,omitempty"`
|
||||
}
|
||||
|
||||
// LogProfileProperties is the log profile properties.
|
||||
type LogProfileProperties struct {
|
||||
StorageAccountID *string `json:"storageAccountId,omitempty"`
|
||||
ServiceBusRuleID *string `json:"serviceBusRuleId,omitempty"`
|
||||
Locations *[]string `json:"locations,omitempty"`
|
||||
Categories *[]string `json:"categories,omitempty"`
|
||||
RetentionPolicy *RetentionPolicy `json:"retentionPolicy,omitempty"`
|
||||
}
|
||||
|
||||
// LogProfileResource is the log profile resource.
|
||||
type LogProfileResource 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"`
|
||||
*LogProfileProperties `json:"properties,omitempty"`
|
||||
}
|
||||
|
||||
// LogSettings is part of MultiTenantDiagnosticSettings. Specifies the settings
|
||||
// for a particular log.
|
||||
type LogSettings struct {
|
||||
Category *string `json:"category,omitempty"`
|
||||
Enabled *bool `json:"enabled,omitempty"`
|
||||
RetentionPolicy *RetentionPolicy `json:"retentionPolicy,omitempty"`
|
||||
}
|
||||
|
||||
// ManagementEventAggregationCondition is how the data that is collected should
|
||||
// be combined over time.
|
||||
type ManagementEventAggregationCondition struct {
|
||||
Operator ConditionOperator `json:"operator,omitempty"`
|
||||
Threshold *float64 `json:"threshold,omitempty"`
|
||||
WindowSize *string `json:"windowSize,omitempty"`
|
||||
}
|
||||
|
||||
// ManagementEventRuleCondition is a management event rule condition.
|
||||
type ManagementEventRuleCondition struct {
|
||||
DataSource *RuleDataSource `json:"dataSource,omitempty"`
|
||||
Aggregation *ManagementEventAggregationCondition `json:"aggregation,omitempty"`
|
||||
}
|
||||
|
||||
// MetricSettings is part of MultiTenantDiagnosticSettings. Specifies the
|
||||
// settings for a particular metric.
|
||||
type MetricSettings struct {
|
||||
TimeGrain *string `json:"timeGrain,omitempty"`
|
||||
Enabled *bool `json:"enabled,omitempty"`
|
||||
RetentionPolicy *RetentionPolicy `json:"retentionPolicy,omitempty"`
|
||||
}
|
||||
|
||||
// MetricTrigger is the trigger that results in a scaling action.
|
||||
type MetricTrigger struct {
|
||||
MetricName *string `json:"metricName,omitempty"`
|
||||
MetricResourceURI *string `json:"metricResourceUri,omitempty"`
|
||||
TimeGrain *string `json:"timeGrain,omitempty"`
|
||||
Statistic MetricStatisticType `json:"statistic,omitempty"`
|
||||
TimeWindow *string `json:"timeWindow,omitempty"`
|
||||
TimeAggregation TimeAggregationType `json:"timeAggregation,omitempty"`
|
||||
Operator ComparisonOperationType `json:"operator,omitempty"`
|
||||
Threshold *float64 `json:"threshold,omitempty"`
|
||||
}
|
||||
|
||||
// Recurrence is the repeating times at which this profile begins. This element
|
||||
// is not used if the FixedDate element is used.
|
||||
type Recurrence struct {
|
||||
Frequency RecurrenceFrequency `json:"frequency,omitempty"`
|
||||
Schedule *RecurrentSchedule `json:"schedule,omitempty"`
|
||||
}
|
||||
|
||||
// RecurrentSchedule is the scheduling constraints for when the profile begins.
|
||||
type RecurrentSchedule struct {
|
||||
TimeZone *string `json:"timeZone,omitempty"`
|
||||
Days *[]string `json:"days,omitempty"`
|
||||
Hours *[]int32 `json:"hours,omitempty"`
|
||||
Minutes *[]int32 `json:"minutes,omitempty"`
|
||||
}
|
||||
|
||||
// Resource is an azure resource object
|
||||
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"`
|
||||
}
|
||||
|
||||
// RetentionPolicy is specifies the retention policy for the log.
|
||||
type RetentionPolicy struct {
|
||||
Enabled *bool `json:"enabled,omitempty"`
|
||||
Days *int32 `json:"days,omitempty"`
|
||||
}
|
||||
|
||||
// RuleAction is the action that is performed when the alert rule becomes
|
||||
// active, and when an alert condition is resolved.
|
||||
type RuleAction struct {
|
||||
}
|
||||
|
||||
// RuleCondition is the condition that results in the alert rule being
|
||||
// activated.
|
||||
type RuleCondition struct {
|
||||
DataSource *RuleDataSource `json:"dataSource,omitempty"`
|
||||
}
|
||||
|
||||
// RuleDataSource is the resource from which the rule collects its data.
|
||||
type RuleDataSource struct {
|
||||
ResourceURI *string `json:"resourceUri,omitempty"`
|
||||
}
|
||||
|
||||
// RuleEmailAction is specifies the action to send email when the rule
|
||||
// condition is evaluated. The discriminator is always RuleEmailAction in this
|
||||
// case.
|
||||
type RuleEmailAction struct {
|
||||
SendToServiceOwners *bool `json:"sendToServiceOwners,omitempty"`
|
||||
CustomEmails *[]string `json:"customEmails,omitempty"`
|
||||
}
|
||||
|
||||
// RuleManagementEventClaimsDataSource is the claims for a rule management
|
||||
// event data source.
|
||||
type RuleManagementEventClaimsDataSource struct {
|
||||
EmailAddress *string `json:"emailAddress,omitempty"`
|
||||
}
|
||||
|
||||
// RuleManagementEventDataSource is a rule management event data source. The
|
||||
// discriminator fields is always RuleManagementEventDataSource in this case.
|
||||
type RuleManagementEventDataSource struct {
|
||||
ResourceURI *string `json:"resourceUri,omitempty"`
|
||||
EventName *string `json:"eventName,omitempty"`
|
||||
EventSource *string `json:"eventSource,omitempty"`
|
||||
Level *string `json:"level,omitempty"`
|
||||
OperationName *string `json:"operationName,omitempty"`
|
||||
ResourceGroupName *string `json:"resourceGroupName,omitempty"`
|
||||
ResourceProviderName *string `json:"resourceProviderName,omitempty"`
|
||||
Status *string `json:"status,omitempty"`
|
||||
SubStatus *string `json:"subStatus,omitempty"`
|
||||
Claims *RuleManagementEventClaimsDataSource `json:"claims,omitempty"`
|
||||
}
|
||||
|
||||
// RuleMetricDataSource is a rule metric data source. The discriminator value
|
||||
// is always RuleMetricDataSource in this case.
|
||||
type RuleMetricDataSource struct {
|
||||
ResourceURI *string `json:"resourceUri,omitempty"`
|
||||
MetricName *string `json:"metricName,omitempty"`
|
||||
}
|
||||
|
||||
// RuleWebhookAction is specifies the action to post to service when the rule
|
||||
// condition is evaluated. The discriminator is always RuleWebhookAction in
|
||||
// this case.
|
||||
type RuleWebhookAction struct {
|
||||
ServiceURI *string `json:"serviceUri,omitempty"`
|
||||
Properties *map[string]*string `json:"properties,omitempty"`
|
||||
}
|
||||
|
||||
// ScaleAction is the parameters for the scaling action.
|
||||
type ScaleAction struct {
|
||||
Direction ScaleDirection `json:"direction,omitempty"`
|
||||
Type ScaleType `json:"type,omitempty"`
|
||||
Value *string `json:"value,omitempty"`
|
||||
Cooldown *string `json:"cooldown,omitempty"`
|
||||
}
|
||||
|
||||
// ScaleCapacity is the number of instances that can be used during this
|
||||
// profile.
|
||||
type ScaleCapacity struct {
|
||||
Minimum *string `json:"minimum,omitempty"`
|
||||
Maximum *string `json:"maximum,omitempty"`
|
||||
Default *string `json:"default,omitempty"`
|
||||
}
|
||||
|
||||
// ScaleRule is a rule that provide the triggers and parameters for the scaling
|
||||
// action.
|
||||
type ScaleRule struct {
|
||||
MetricTrigger *MetricTrigger `json:"metricTrigger,omitempty"`
|
||||
ScaleAction *ScaleAction `json:"scaleAction,omitempty"`
|
||||
}
|
||||
|
||||
// ServiceDiagnosticSettings is the diagnostic settings for service.
|
||||
type ServiceDiagnosticSettings struct {
|
||||
StorageAccountID *string `json:"storageAccountId,omitempty"`
|
||||
ServiceBusRuleID *string `json:"serviceBusRuleId,omitempty"`
|
||||
EventHubAuthorizationRuleID *string `json:"eventHubAuthorizationRuleId,omitempty"`
|
||||
Metrics *[]MetricSettings `json:"metrics,omitempty"`
|
||||
Logs *[]LogSettings `json:"logs,omitempty"`
|
||||
WorkspaceID *string `json:"workspaceId,omitempty"`
|
||||
}
|
||||
|
||||
// ServiceDiagnosticSettingsResource is description of a service diagnostic
|
||||
// setting
|
||||
type ServiceDiagnosticSettingsResource 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"`
|
||||
*ServiceDiagnosticSettings `json:"properties,omitempty"`
|
||||
}
|
||||
|
||||
// ThresholdRuleCondition is a rule condition based on a metric crossing a
|
||||
// threshold.
|
||||
type ThresholdRuleCondition struct {
|
||||
DataSource *RuleDataSource `json:"dataSource,omitempty"`
|
||||
Operator ConditionOperator `json:"operator,omitempty"`
|
||||
Threshold *float64 `json:"threshold,omitempty"`
|
||||
WindowSize *string `json:"windowSize,omitempty"`
|
||||
TimeAggregation TimeAggregationOperator `json:"timeAggregation,omitempty"`
|
||||
}
|
||||
|
||||
// TimeWindow is a specific date-time for the profile.
|
||||
type TimeWindow struct {
|
||||
TimeZone *string `json:"timeZone,omitempty"`
|
||||
Start *date.Time `json:"start,omitempty"`
|
||||
End *date.Time `json:"end,omitempty"`
|
||||
}
|
||||
|
||||
// WebhookNotification is webhook notification of an autoscale event.
|
||||
type WebhookNotification struct {
|
||||
ServiceURI *string `json:"serviceUri,omitempty"`
|
||||
Properties *map[string]*string `json:"properties,omitempty"`
|
||||
}
|
||||
Generated
Vendored
Executable
+242
@@ -0,0 +1,242 @@
|
||||
package monitor
|
||||
|
||||
// Copyright (c) Microsoft and contributors. All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
//
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0
|
||||
// Changes may cause incorrect behavior and will be lost if the code is
|
||||
// regenerated.
|
||||
|
||||
import (
|
||||
"github.com/Azure/go-autorest/autorest"
|
||||
"github.com/Azure/go-autorest/autorest/azure"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
// ServiceDiagnosticSettingsClient is the composite Swagger for Monitor
|
||||
// Management Client
|
||||
type ServiceDiagnosticSettingsClient struct {
|
||||
ManagementClient
|
||||
}
|
||||
|
||||
// NewServiceDiagnosticSettingsClient creates an instance of the
|
||||
// ServiceDiagnosticSettingsClient client.
|
||||
func NewServiceDiagnosticSettingsClient(subscriptionID string) ServiceDiagnosticSettingsClient {
|
||||
return NewServiceDiagnosticSettingsClientWithBaseURI(DefaultBaseURI, subscriptionID)
|
||||
}
|
||||
|
||||
// NewServiceDiagnosticSettingsClientWithBaseURI creates an instance of the
|
||||
// ServiceDiagnosticSettingsClient client.
|
||||
func NewServiceDiagnosticSettingsClientWithBaseURI(baseURI string, subscriptionID string) ServiceDiagnosticSettingsClient {
|
||||
return ServiceDiagnosticSettingsClient{NewWithBaseURI(baseURI, subscriptionID)}
|
||||
}
|
||||
|
||||
// CreateOrUpdate create or update new diagnostic settings for the specified
|
||||
// resource. **WARNING**: This method will be deprecated in future releases.
|
||||
//
|
||||
// resourceURI is the identifier of the resource. parameters is parameters
|
||||
// supplied to the operation.
|
||||
func (client ServiceDiagnosticSettingsClient) CreateOrUpdate(resourceURI string, parameters ServiceDiagnosticSettingsResource) (result ServiceDiagnosticSettingsResource, err error) {
|
||||
req, err := client.CreateOrUpdatePreparer(resourceURI, parameters)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "monitor.ServiceDiagnosticSettingsClient", "CreateOrUpdate", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.CreateOrUpdateSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
err = autorest.NewErrorWithError(err, "monitor.ServiceDiagnosticSettingsClient", "CreateOrUpdate", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.CreateOrUpdateResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "monitor.ServiceDiagnosticSettingsClient", "CreateOrUpdate", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// CreateOrUpdatePreparer prepares the CreateOrUpdate request.
|
||||
func (client ServiceDiagnosticSettingsClient) CreateOrUpdatePreparer(resourceURI string, parameters ServiceDiagnosticSettingsResource) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"resourceUri": autorest.Encode("path", resourceURI),
|
||||
}
|
||||
|
||||
const APIVersion = "2016-09-01"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsJSON(),
|
||||
autorest.AsPut(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/diagnosticSettings/service", 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 ServiceDiagnosticSettingsClient) 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 ServiceDiagnosticSettingsClient) CreateOrUpdateResponder(resp *http.Response) (result ServiceDiagnosticSettingsResource, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||
autorest.ByUnmarshallingJSON(&result),
|
||||
autorest.ByClosing())
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return
|
||||
}
|
||||
|
||||
// Get gets the active diagnostic settings for the specified resource.
|
||||
// **WARNING**: This method will be deprecated in future releases.
|
||||
//
|
||||
// resourceURI is the identifier of the resource.
|
||||
func (client ServiceDiagnosticSettingsClient) Get(resourceURI string) (result ServiceDiagnosticSettingsResource, err error) {
|
||||
req, err := client.GetPreparer(resourceURI)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "monitor.ServiceDiagnosticSettingsClient", "Get", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.GetSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
err = autorest.NewErrorWithError(err, "monitor.ServiceDiagnosticSettingsClient", "Get", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.GetResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "monitor.ServiceDiagnosticSettingsClient", "Get", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// GetPreparer prepares the Get request.
|
||||
func (client ServiceDiagnosticSettingsClient) GetPreparer(resourceURI string) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"resourceUri": autorest.Encode("path", resourceURI),
|
||||
}
|
||||
|
||||
const APIVersion = "2016-09-01"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsGet(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/diagnosticSettings/service", 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 ServiceDiagnosticSettingsClient) 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 ServiceDiagnosticSettingsClient) GetResponder(resp *http.Response) (result ServiceDiagnosticSettingsResource, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||
autorest.ByUnmarshallingJSON(&result),
|
||||
autorest.ByClosing())
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return
|
||||
}
|
||||
|
||||
// Update updates an existing ServiceDiagnosticSettingsResource. To update
|
||||
// other fields use the CreateOrUpdate method. **WARNING**: This method will be
|
||||
// deprecated in future releases.
|
||||
//
|
||||
// resourceURI is the identifier of the resource.
|
||||
// serviceDiagnosticSettingsResource is parameters supplied to the operation.
|
||||
func (client ServiceDiagnosticSettingsClient) Update(resourceURI string, serviceDiagnosticSettingsResource ServiceDiagnosticSettingsResource) (result ServiceDiagnosticSettingsResource, err error) {
|
||||
req, err := client.UpdatePreparer(resourceURI, serviceDiagnosticSettingsResource)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "monitor.ServiceDiagnosticSettingsClient", "Update", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.UpdateSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
err = autorest.NewErrorWithError(err, "monitor.ServiceDiagnosticSettingsClient", "Update", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.UpdateResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "monitor.ServiceDiagnosticSettingsClient", "Update", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// UpdatePreparer prepares the Update request.
|
||||
func (client ServiceDiagnosticSettingsClient) UpdatePreparer(resourceURI string, serviceDiagnosticSettingsResource ServiceDiagnosticSettingsResource) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"resourceUri": autorest.Encode("path", resourceURI),
|
||||
}
|
||||
|
||||
const APIVersion = "2016-09-01"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsJSON(),
|
||||
autorest.AsPatch(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/{resourceUri}/providers/microsoft.insights/diagnosticSettings/service", pathParameters),
|
||||
autorest.WithJSON(serviceDiagnosticSettingsResource),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// UpdateSender sends the Update request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client ServiceDiagnosticSettingsClient) UpdateSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client, req)
|
||||
}
|
||||
|
||||
// UpdateResponder handles the response to the Update request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client ServiceDiagnosticSettingsClient) UpdateResponder(resp *http.Response) (result ServiceDiagnosticSettingsResource, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||
autorest.ByUnmarshallingJSON(&result),
|
||||
autorest.ByClosing())
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return
|
||||
}
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
package monitor
|
||||
|
||||
// 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-monitor/"
|
||||
}
|
||||
|
||||
// Version returns the semantic version (see http://semver.org) of the client.
|
||||
func Version() string {
|
||||
return "v10.1.0-beta"
|
||||
}
|
||||
Reference in New Issue
Block a user