internal ActivityLogAlertData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary <string, string> tags, AzureLocation location, IList <string> scopes, bool?enabled, ActivityLogAlertAllOfCondition condition, ActivityLogAlertActionList actions, string description) : base(id, name, resourceType, systemData, tags, location) { Scopes = scopes; Enabled = enabled; Condition = condition; Actions = actions; Description = description; }
private static void AreEqual(ActivityLogAlertAllOfCondition exp, ActivityLogAlertAllOfCondition act) { if (exp != null) { Assert.NotNull(act); Assert.NotNull(act.AllOf); for (int i = 0; i < exp.AllOf.Count; i++) { AreEqual(exp.AllOf[i], act.AllOf[i]); } } }
///GENMHASH:0202A00A1DCF248D2647DBDBEF2CA865:9B7B9E01CD94CAAB45F3A60AA8B80787 public override async Task <Microsoft.Azure.Management.Monitor.Fluent.IActivityLogAlert> CreateResourceAsync(CancellationToken cancellationToken = default(CancellationToken)) { this.Inner.Location = "global"; var condition = new ActivityLogAlertAllOfCondition(); condition.AllOf = new List <ActivityLogAlertLeafCondition>(); foreach (var cds in conditions) { var alalc = new ActivityLogAlertLeafCondition(); alalc.Field = cds.Key; alalc.EqualsTo = cds.Value; condition.AllOf.Add(alalc); } this.Inner.Condition = condition; this.SetInner(await this.Manager.Inner.ActivityLogAlerts.CreateOrUpdateAsync(this.ResourceGroupName, this.Name, this.Inner, cancellationToken)); return(this); }
/// <summary> /// Initializes a new instance of the ActivityLogAlertResource class. /// </summary> /// <param name="activityLogAlertResource">The ActivityLogAlertResource object</param> public ActivityLogAlertResource(Monitor.Models.ActivityLogAlertResource activityLogAlertResource) : base( location: activityLogAlertResource?.Location, scopes: activityLogAlertResource?.Scopes, condition: activityLogAlertResource?.Condition, actions: activityLogAlertResource?.Actions, id: activityLogAlertResource?.Id, name: activityLogAlertResource?.Name, type: activityLogAlertResource?.Type, tags: activityLogAlertResource?.Tags, enabled: activityLogAlertResource?.Enabled, description: activityLogAlertResource?.Description) { if (activityLogAlertResource != null) { this.Actions = activityLogAlertResource.Actions != null ? new ActivityLogAlertActionList(activityLogAlertResource.Actions) : null; this.Condition = activityLogAlertResource.Condition != null ? new ActivityLogAlertAllOfCondition(activityLogAlertResource.Condition) : null; } }
internal static ActivityLogAlertData DeserializeActivityLogAlertData(JsonElement element) { IDictionary <string, string> tags = default; AzureLocation location = default; ResourceIdentifier id = default; string name = default; ResourceType type = default; SystemData systemData = default; Optional <IList <string> > scopes = default; Optional <bool> enabled = default; Optional <ActivityLogAlertAllOfCondition> condition = default; Optional <ActivityLogAlertActionList> actions = default; Optional <string> description = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("tags")) { Dictionary <string, string> dictionary = new Dictionary <string, string>(); foreach (var property0 in property.Value.EnumerateObject()) { dictionary.Add(property0.Name, property0.Value.GetString()); } tags = dictionary; continue; } if (property.NameEquals("location")) { location = new AzureLocation(property.Value.GetString()); continue; } if (property.NameEquals("id")) { id = new ResourceIdentifier(property.Value.GetString()); continue; } if (property.NameEquals("name")) { name = property.Value.GetString(); continue; } if (property.NameEquals("type")) { type = new ResourceType(property.Value.GetString()); continue; } if (property.NameEquals("systemData")) { systemData = JsonSerializer.Deserialize <SystemData>(property.Value.ToString()); continue; } if (property.NameEquals("properties")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } foreach (var property0 in property.Value.EnumerateObject()) { if (property0.NameEquals("scopes")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } List <string> array = new List <string>(); foreach (var item in property0.Value.EnumerateArray()) { array.Add(item.GetString()); } scopes = array; continue; } if (property0.NameEquals("enabled")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } enabled = property0.Value.GetBoolean(); continue; } if (property0.NameEquals("condition")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } condition = ActivityLogAlertAllOfCondition.DeserializeActivityLogAlertAllOfCondition(property0.Value); continue; } if (property0.NameEquals("actions")) { if (property0.Value.ValueKind == JsonValueKind.Null) { actions = null; continue; } actions = ActivityLogAlertActionList.DeserializeActivityLogAlertActionList(property0.Value); continue; } if (property0.NameEquals("description")) { description = property0.Value.GetString(); continue; } } continue; } } return(new ActivityLogAlertData(id, name, type, systemData, tags, location, Optional.ToList(scopes), Optional.ToNullable(enabled), condition.Value, actions.Value, description.Value)); }