mirror of
https://github.com/langchain-ai/LangChain-Commercial-Marketplace-Meters-Accelerator.git
synced 2026-07-01 20:24:03 -04:00
fix resouce uri
This commit is contained in:
@@ -456,7 +456,7 @@ Write-host ""
|
||||
Write-host " 🔵 Add The following URL in PartnerCenter AMA Plan Technical Configuration"
|
||||
Write-host " ➡️ Notification Webhook section: https://$WebAppNamePrefix-admin.azurewebsites.net/api?sig=$Sig"
|
||||
Write-host ""
|
||||
Write-host " 🔵 Add The following URL to your HLEM Configmap.yaml"
|
||||
Write-host " 🔵 Add The following URL to your HELM Configmap.yaml"
|
||||
Write-host " ➡️ Container Webhook section: https://$WebAppNamePrefix-admin.azurewebsites.net/api/container?sig=$Sig"
|
||||
Write-host ""
|
||||
Write-host " 🔵 Use the Following WebApp to access the Admin Portal"
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
apiVersion: batch/v1
|
||||
kind: CronJob
|
||||
metadata:
|
||||
name: marketplace-custom-meters-engine
|
||||
labels:
|
||||
billing: helloworld
|
||||
spec:
|
||||
failedJobsHistoryLimit: 1
|
||||
schedule: "0 * * * *"
|
||||
successfulJobsHistoryLimit: 1
|
||||
jobTemplate:
|
||||
spec:
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: engin-cron
|
||||
cron: engine-meters-cronJob
|
||||
spec:
|
||||
containers:
|
||||
- name: engine
|
||||
image: magdysalem/custom-meters-engine:v1
|
||||
restartPolicy: Never
|
||||
@@ -117,10 +117,12 @@ namespace ManagedApplicationScheduler.AdminSite.Controllers
|
||||
List<SelectListItem> DimensionsList = new();
|
||||
foreach (var item in allActiveMeteredSubscriptions)
|
||||
{
|
||||
|
||||
var sub = item.ResourceUri.Split("/");
|
||||
|
||||
SubscriptionList.Add(new SelectListItem()
|
||||
{
|
||||
Text = sub[2] + "|" + sub[8],
|
||||
Text = sub[2] + "|" + sub[sub.Length - 1],
|
||||
Value = item.id.ToString(),
|
||||
});
|
||||
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
using Azure.Identity;
|
||||
using ManagedApplicationScheduler.DataAccess.Contracts;
|
||||
using ManagedApplicationScheduler.DataAccess.Entities;
|
||||
using ManagedApplicationScheduler.Services.Configurations;
|
||||
using ManagedApplicationScheduler.Services.Models;
|
||||
using ManagedApplicationScheduler.Services.Services;
|
||||
using ManagedApplicationScheduler.Services.Utilities;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.SignalR;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -63,9 +65,11 @@ namespace ManagedApplicationScheduler.AdminSite.Controllers.Webhook
|
||||
// If provisioning of a marketplace application instance is successful, we persist a Meter entry to be picked up by the chron metric emitting job
|
||||
if (notificationDefinition.EventType == "PUT" && notificationDefinition.ProvisioningState == "Succeeded")
|
||||
{
|
||||
this.applicationLogService.AddApplicationLog($"Check If subscription {notificationDefinition.ApplicationId} Exists");
|
||||
var sub = this.subscriptionService.GetSubscriptionByKey(notificationDefinition.Plan.Product,notificationDefinition.Plan.Name,notificationDefinition.SubscriptionKey);
|
||||
if (sub is null)
|
||||
{
|
||||
this.applicationLogService.AddApplicationLog($"Create new subscription for {notificationDefinition.ApplicationId}");
|
||||
var subscription = new SubscriptionModel
|
||||
{
|
||||
// CosmosDB does not support forward slashes in the id.
|
||||
@@ -107,8 +111,10 @@ namespace ManagedApplicationScheduler.AdminSite.Controllers.Webhook
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if (sub.ResourceUri != notificationDefinition.ApplicationId)
|
||||
{
|
||||
this.applicationLogService.AddApplicationLog($"Update subscription {sub.ResourceUri} with new ID {notificationDefinition.ApplicationId} ");
|
||||
this.subscriptionService.UpdateSubscriptionResourceUri(sub.id, notificationDefinition.ApplicationId);
|
||||
this.schedulerService.UpdateSchedulerResourceUri(sub.ResourceUri, notificationDefinition.ApplicationId);
|
||||
sub.ResourceUri = notificationDefinition.ApplicationId;
|
||||
@@ -131,8 +137,11 @@ namespace ManagedApplicationScheduler.AdminSite.Controllers.Webhook
|
||||
{
|
||||
try
|
||||
{
|
||||
this.applicationLogService.AddApplicationLog($"Check For Scheduled Tasks");
|
||||
List<ScheduledTasksModel> task = new ();
|
||||
var scheduledItems = this.schedulerService.GetEnabledSchedulersTasksBySubscription(subscription.ResourceUri);
|
||||
|
||||
this.applicationLogService.AddApplicationLog($"Number of Scheduled tasks is {scheduledItems.Count.ToString()}");
|
||||
//GetCurrentUTC time
|
||||
DateTime _currentUTCTime = DateTime.UtcNow;
|
||||
TimeSpan ts = new TimeSpan(DateTime.UtcNow.Hour, 0, 0);
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
<div class="form-group row">
|
||||
<div class="col-md-12">
|
||||
<div class="text-left">
|
||||
<span class="cm-section-heading">Manage Application Logs</span>
|
||||
<span class="cm-section-heading">Application Logs</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -128,7 +128,9 @@ namespace ManagedApplicationScheduler.Services.Services
|
||||
}
|
||||
public void SaveMilestonePayment(SubscriptionModel subscription)
|
||||
{
|
||||
var appName = subscription.ResourceUri.Split("/")[8];
|
||||
var list = subscription.ResourceUri.Split("/");
|
||||
var appName = list[list.Length - 1];
|
||||
|
||||
var payment = GetPaymentByOfferByPlan(subscription.Product, subscription.PlanId);
|
||||
foreach(var item in payment)
|
||||
{
|
||||
@@ -138,7 +140,6 @@ namespace ManagedApplicationScheduler.Services.Services
|
||||
ResourceUri = subscription.ResourceUri,
|
||||
PlanId = item.PlanId,
|
||||
Dimension = item.Dimension,
|
||||
StartDate = item.StartDate.Value,
|
||||
Frequency = SchedulerFrequencyEnum.OneTime.ToString(),
|
||||
Quantity = item.Quantity,
|
||||
Status = "Scheduled",
|
||||
@@ -149,6 +150,10 @@ namespace ManagedApplicationScheduler.Services.Services
|
||||
DateTime rounded = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, DateTime.Now.Hour+1, 0, 0);
|
||||
task.StartDate = rounded;
|
||||
}
|
||||
else
|
||||
{
|
||||
task.StartDate = item.StartDate;
|
||||
}
|
||||
this.scheduledTasksRepository.Save(task);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user