Skip to content

Commit

Permalink
[Monitor] Adding Operations API and making DiagnosticSettings ProxyOn…
Browse files Browse the repository at this point in the history
…ly resource (Azure#3705)

* [Monitor] Sync with latest spec

* [Monitor] Add tests for operations api
  • Loading branch information
vcanaa authored and EvgenyAgafonchikov committed Oct 13, 2017
1 parent 26fd394 commit b64a28c
Show file tree
Hide file tree
Showing 18 changed files with 819 additions and 66 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -278,10 +278,6 @@ internal DiagnosticSettingsOperations(MonitorManagementClient client)
{
throw new ValidationException(ValidationRules.CannotBeNull, "parameters");
}
if (parameters != null)
{
parameters.Validate();
}
if (name == null)
{
throw new ValidationException(ValidationRules.CannotBeNull, "name");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,11 @@ public partial interface IMonitorManagementClient : System.IDisposable
/// </summary>
IAutoscaleSettingsOperations AutoscaleSettings { get; }

/// <summary>
/// Gets the IOperations.
/// </summary>
IOperations Operations { get; }

/// <summary>
/// Gets the IAlertRuleIncidentsOperations.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for
// license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.

namespace Microsoft.Azure.Management.Monitor.Management
{
using Microsoft.Azure;
using Microsoft.Azure.Management;
using Microsoft.Azure.Management.Monitor;
using Microsoft.Rest;
using Microsoft.Rest.Azure;
using Models;
using System.Collections;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;

/// <summary>
/// Operations operations.
/// </summary>
public partial interface IOperations
{
/// <summary>
/// Lists all of the available operations from Microsoft.Insights
/// provider.
/// </summary>
/// <param name='customHeaders'>
/// The headers that will be added to request.
/// </param>
/// <param name='cancellationToken'>
/// The cancellation token.
/// </param>
/// <exception cref="Microsoft.Rest.Azure.CloudException">
/// Thrown when the operation returned an invalid status code
/// </exception>
/// <exception cref="Microsoft.Rest.SerializationException">
/// Thrown when unable to deserialize the response
/// </exception>
/// <exception cref="Microsoft.Rest.ValidationException">
/// Thrown when a required parameter is null
/// </exception>
Task<AzureOperationResponse<OperationListResult>> ListWithHttpMessagesAsync(Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,13 @@ namespace Microsoft.Azure.Management.Monitor.Management.Models
using Microsoft.Rest;
using Microsoft.Rest.Serialization;
using Newtonsoft.Json;
using System.Collections;
using System.Collections.Generic;
using System.Linq;

/// <summary>
/// Description of diagnostic setting category.
/// The diagnostic settings category resource.
/// </summary>
[Rest.Serialization.JsonTransformation]
public partial class DiagnosticSettingsCategoryResource : Resource
public partial class DiagnosticSettingsCategoryResource : ProxyOnlyResource
{
/// <summary>
/// Initializes a new instance of the
Expand All @@ -38,15 +36,13 @@ public DiagnosticSettingsCategoryResource()
/// Initializes a new instance of the
/// DiagnosticSettingsCategoryResource class.
/// </summary>
/// <param name="location">Resource location</param>
/// <param name="id">Azure resource Id</param>
/// <param name="name">Azure resource name</param>
/// <param name="type">Azure resource type</param>
/// <param name="tags">Resource tags</param>
/// <param name="categoryType">The type of the diagnostic settings
/// category. Possible values include: 'Metrics', 'Logs'</param>
public DiagnosticSettingsCategoryResource(string location, string id = default(string), string name = default(string), string type = default(string), IDictionary<string, string> tags = default(IDictionary<string, string>), CategoryType categoryType = default(CategoryType))
: base(location, id, name, type, tags)
public DiagnosticSettingsCategoryResource(string id = default(string), string name = default(string), string type = default(string), CategoryType categoryType = default(CategoryType))
: base(id, name, type)
{
CategoryType = categoryType;
CustomInit();
Expand All @@ -64,15 +60,5 @@ public DiagnosticSettingsCategoryResource()
[JsonProperty(PropertyName = "properties.categoryType")]
public CategoryType CategoryType { get; set; }

/// <summary>
/// Validate the object.
/// </summary>
/// <exception cref="ValidationException">
/// Thrown if validation fails
/// </exception>
public override void Validate()
{
base.Validate();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ namespace Microsoft.Azure.Management.Monitor.Management.Models
using System.Linq;

/// <summary>
/// Description of diagnostic setting resource.
/// The diagnostic setting resource.
/// </summary>
[Rest.Serialization.JsonTransformation]
public partial class DiagnosticSettingsResource : Resource
public partial class DiagnosticSettingsResource : ProxyOnlyResource
{
/// <summary>
/// Initializes a new instance of the DiagnosticSettingsResource class.
Expand All @@ -36,11 +36,9 @@ public DiagnosticSettingsResource()
/// <summary>
/// Initializes a new instance of the DiagnosticSettingsResource class.
/// </summary>
/// <param name="location">Resource location</param>
/// <param name="id">Azure resource Id</param>
/// <param name="name">Azure resource name</param>
/// <param name="type">Azure resource type</param>
/// <param name="tags">Resource tags</param>
/// <param name="storageAccountId">The resource ID of the storage
/// account to which you would like to send Diagnostic Logs.</param>
/// <param name="eventHubAuthorizationRuleId">The resource Id for the
Expand All @@ -53,8 +51,8 @@ public DiagnosticSettingsResource()
/// Analytics workspace) for a Log Analytics workspace to which you
/// would like to send Diagnostic Logs. Example:
/// /subscriptions/4b9e8510-67ab-4e9a-95a9-e2f1e570ea9c/resourceGroups/insights-integration/providers/Microsoft.OperationalInsights/workspaces/viruela2</param>
public DiagnosticSettingsResource(string location, string id = default(string), string name = default(string), string type = default(string), IDictionary<string, string> tags = default(IDictionary<string, string>), string storageAccountId = default(string), string eventHubAuthorizationRuleId = default(string), string eventHubName = default(string), IList<MetricSettings> metrics = default(IList<MetricSettings>), IList<LogSettings> logs = default(IList<LogSettings>), string workspaceId = default(string))
: base(location, id, name, type, tags)
public DiagnosticSettingsResource(string id = default(string), string name = default(string), string type = default(string), string storageAccountId = default(string), string eventHubAuthorizationRuleId = default(string), string eventHubName = default(string), IList<MetricSettings> metrics = default(IList<MetricSettings>), IList<LogSettings> logs = default(IList<LogSettings>), string workspaceId = default(string))
: base(id, name, type)
{
StorageAccountId = storageAccountId;
EventHubAuthorizationRuleId = eventHubAuthorizationRuleId;
Expand Down Expand Up @@ -111,35 +109,5 @@ public DiagnosticSettingsResource()
[JsonProperty(PropertyName = "properties.workspaceId")]
public string WorkspaceId { get; set; }

/// <summary>
/// Validate the object.
/// </summary>
/// <exception cref="ValidationException">
/// Thrown if validation fails
/// </exception>
public override void Validate()
{
base.Validate();
if (Metrics != null)
{
foreach (var element in Metrics)
{
if (element != null)
{
element.Validate();
}
}
}
if (Logs != null)
{
foreach (var element1 in Logs)
{
if (element1 != null)
{
element1.Validate();
}
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for
// license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.

namespace Microsoft.Azure.Management.Monitor.Management.Models
{
using Microsoft.Azure;
using Microsoft.Azure.Management;
using Microsoft.Azure.Management.Monitor;
using Microsoft.Azure.Management.Monitor.Management;
using Newtonsoft.Json;
using System.Linq;

/// <summary>
/// Microsoft Insights API operation definition.
/// </summary>
public partial class Operation
{
/// <summary>
/// Initializes a new instance of the Operation class.
/// </summary>
public Operation()
{
CustomInit();
}

/// <summary>
/// Initializes a new instance of the Operation class.
/// </summary>
/// <param name="name">Operation name:
/// {provider}/{resource}/{operation}</param>
/// <param name="display">Display metadata associated with the
/// operation.</param>
public Operation(string name = default(string), OperationDisplay display = default(OperationDisplay))
{
Name = name;
Display = display;
CustomInit();
}

/// <summary>
/// An initialization method that performs custom operations like setting defaults
/// </summary>
partial void CustomInit();

/// <summary>
/// Gets or sets operation name: {provider}/{resource}/{operation}
/// </summary>
[JsonProperty(PropertyName = "name")]
public string Name { get; set; }

/// <summary>
/// Gets or sets display metadata associated with the operation.
/// </summary>
[JsonProperty(PropertyName = "display")]
public OperationDisplay Display { get; set; }

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for
// license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.

namespace Microsoft.Azure.Management.Monitor.Management.Models
{
using Microsoft.Azure;
using Microsoft.Azure.Management;
using Microsoft.Azure.Management.Monitor;
using Microsoft.Azure.Management.Monitor.Management;
using Newtonsoft.Json;
using System.Linq;

/// <summary>
/// Display metadata associated with the operation.
/// </summary>
public partial class OperationDisplay
{
/// <summary>
/// Initializes a new instance of the OperationDisplay class.
/// </summary>
public OperationDisplay()
{
CustomInit();
}

/// <summary>
/// Initializes a new instance of the OperationDisplay class.
/// </summary>
/// <param name="provider">Service provider: Microsoft.Insights</param>
/// <param name="resource">Resource on which the operation is
/// performed: AlertRules, Autoscale, etc.</param>
/// <param name="operation">Operation type: Read, write, delete,
/// etc.</param>
public OperationDisplay(string provider = default(string), string resource = default(string), string operation = default(string))
{
Provider = provider;
Resource = resource;
Operation = operation;
CustomInit();
}

/// <summary>
/// An initialization method that performs custom operations like setting defaults
/// </summary>
partial void CustomInit();

/// <summary>
/// Gets or sets service provider: Microsoft.Insights
/// </summary>
[JsonProperty(PropertyName = "provider")]
public string Provider { get; set; }

/// <summary>
/// Gets or sets resource on which the operation is performed:
/// AlertRules, Autoscale, etc.
/// </summary>
[JsonProperty(PropertyName = "resource")]
public string Resource { get; set; }

/// <summary>
/// Gets or sets operation type: Read, write, delete, etc.
/// </summary>
[JsonProperty(PropertyName = "operation")]
public string Operation { get; set; }

}
}
Loading

0 comments on commit b64a28c

Please sign in to comment.