コード例 #1
0
        public async Task GetLogAnalyticsRankings()
        {
            Subscription subscription = await Client.GetDefaultSubscriptionAsync();

            ResourceGroup rg = await subscription.GetResourceGroups().GetAsync("CdnTest");

            Profile afdProfile = await rg.GetProfiles().GetAsync("testAFDProfile");

            List <LogRanking> rankings = new List <LogRanking>()
            {
                LogRanking.Url
            };
            List <LogRankingMetric> metric = new List <LogRankingMetric>()
            {
                LogRankingMetric.ClientRequestCount
            };
            int              maxRankings      = 5;
            DateTimeOffset   dateTimeBegin    = new DateTimeOffset(2021, 9, 23, 0, 0, 0, TimeSpan.Zero);
            DateTimeOffset   dateTimeEnd      = new DateTimeOffset(2021, 9, 25, 0, 0, 0, TimeSpan.Zero);
            RankingsResponse rankingsResponse = await afdProfile.GetLogAnalyticsRankingsAfdProfileAsync(rankings, metric, maxRankings, dateTimeBegin, dateTimeEnd);

            Assert.AreEqual(rankingsResponse.Tables.Count, 1);
            Assert.AreEqual(rankingsResponse.Tables[0].Ranking, LogRanking.Url.ToString());
            Assert.AreEqual(rankingsResponse.Tables[0].Data.Count, 0);
        }
コード例 #2
0
 // Use this for initialization
 void Start()
 {
     StaticVars.LocalStudentName = UserStore.StudentName;
     StaticVars.LocalAdminName   = UserStore.AdminName;
     if (StaticVars.LocalStudentName == "")
     {
         StaticVars.LocalStudentName = "noname";
     }
     if (StaticVars.LocalAdminName == "")
     {
         StaticVars.LocalAdminName = "noname";
     }
     Time.timeScale = 1f;
     res_s          = new RankingsResponse();
     res_a          = new RankingsResponse();
     StartCoroutine(UploadScoreForStudent());
     StartCoroutine(UploadScoreForAdmin());
     StartCoroutine(AcquireScoreForStudent());
     StartCoroutine(AcquireScoreForAdmin());
 }
コード例 #3
0
        public void GetLogAnalyticsRankingsTest()
        {
            var handler1 = new RecordedDelegatingHandler {
                StatusCodeToReturn = HttpStatusCode.OK
            };
            var handler2 = new RecordedDelegatingHandler {
                StatusCodeToReturn = HttpStatusCode.OK
            };

            using (MockContext context = MockContext.Start(this.GetType()))
            {
                // Create clients
                var cdnMgmtClient   = CdnTestUtilities.GetCdnManagementClient(context, handler1);
                var resourcesClient = CdnTestUtilities.GetResourceManagementClient(context, handler2);

                // Create resource group
                var resourceGroupName = CdnTestUtilities.CreateResourceGroup(resourcesClient);

                try
                {
                    // Create a standard Azure frontdoor profile
                    string  profileName      = TestUtilities.GenerateName("profile");
                    Profile createParameters = new Profile
                    {
                        Location = "WestUs",
                        Sku      = new Sku {
                            Name = SkuName.StandardAzureFrontDoor
                        },
                        Tags = new Dictionary <string, string>
                        {
                            { "key1", "value1" },
                            { "key2", "value2" }
                        }
                    };
                    var profile = cdnMgmtClient.Profiles.Create(resourceGroupName, profileName, createParameters);

                    // Create a standard Azure frontdoor endpoint
                    string endpointName             = TestUtilities.GenerateName("endpointName");
                    var    endpointCreateParameters = new AFDEndpoint("WestUs")
                    {
                        EnabledState = "Enabled",
                        OriginResponseTimeoutSeconds = 60,
                        Tags = new Dictionary <string, string>
                        {
                            { "key1", "value1" },
                            { "key2", "value2" }
                        }
                    };
                    var endpoint = cdnMgmtClient.AFDEndpoints.Create(resourceGroupName, profileName, endpointName, endpointCreateParameters);


                    IList <string> rankings = new List <string>()
                    {
                        "url"
                    };
                    IList <string> metrics = new List <string>()
                    {
                        "clientRequestCount"
                    };
                    int              maxRanking    = 50;
                    DateTime         dateTimeBegin = new DateTime(2021, 1, 27, 0, 0, 0);
                    DateTime         dateTimeEnd   = new DateTime(2021, 1, 27, 0, 0, 1);
                    RankingsResponse response      = cdnMgmtClient.LogAnalytics.GetLogAnalyticsRankings(resourceGroupName, profileName, rankings, metrics, maxRanking, dateTimeBegin, dateTimeEnd);
                    Assert.NotNull(response);
                }
                finally
                {
                    // Delete resource group
                    _ = CdnTestUtilities.DeleteResourceGroupAsync(resourcesClient, resourceGroupName);
                }
            }
        }