public async Task GetAll() { _webPubSub = await CreateWebPubSub(); var list = await _webPubSub.GetSharedPrivateLinks().GetAllAsync().ToEnumerableAsync(); Assert.AreEqual(0, list.Count); }
public static WebPubSubResource GetWebPubSubResource(this ArmClient client, ResourceIdentifier id) { return(client.GetResourceClient(() => { WebPubSubResource.ValidateResourceId(id); return new WebPubSubResource(client, id); } )); }
public async Task Get() { #region Snippet:Managing_WebPubSub_GetWebPubSub WebPubSubCollection WebPubSubColletion = resourceGroup.GetWebPubSubs(); WebPubSubResource webPubSub = await WebPubSubColletion.GetAsync("myWebPubSubName"); Console.WriteLine(webPubSub.Data.Name); #endregion }
public async Task DeleteVirtualWebPubSub() { #region Snippet:Managing_WebPubSub_DeleteWebPubSub WebPubSubCollection WebPubSubColletion = resourceGroup.GetWebPubSubs(); WebPubSubResource webPubSub = await WebPubSubColletion.GetAsync("myWebPubSubName"); await webPubSub.DeleteAsync(WaitUntil.Completed); #endregion }
public async Task CheckIfExist() { string webPubSubName = SessionRecording.GenerateAssetName("WebPubSub-"); _webPubSub = await CreateWebPubSub(webPubSubName); await CreatePrivateEndpointConnection(_privateEndPointName); var list = await _webPubSub.GetWebPubSubPrivateEndpointConnections().GetAllAsync().ToEnumerableAsync(); Assert.True(await _webPubSub.GetWebPubSubPrivateEndpointConnections().ExistsAsync(list[0].Data.Name)); Assert.False(await _webPubSub.GetWebPubSubPrivateEndpointConnections().ExistsAsync(list[0].Data.Name + "01")); }
public async Task Get() { string webPubSubName = SessionRecording.GenerateAssetName("WebPubSub-"); _webPubSub = await CreateWebPubSub(webPubSubName); await CreatePrivateEndpointConnection(_privateEndPointName); var list = await _webPubSub.GetWebPubSubPrivateEndpointConnections().GetAllAsync().ToEnumerableAsync(); var PrivateEndpointConnection = await _webPubSub.GetWebPubSubPrivateEndpointConnections().GetAsync(list[0].Data.Name); Assert.NotNull(PrivateEndpointConnection.Value.Data); Assert.AreEqual("Approved", PrivateEndpointConnection.Value.Data.ConnectionState.Status.ToString()); }
public async Task GetAll() { string webPubSubName = SessionRecording.GenerateAssetName("WebPubSub-"); _webPubSub = await CreateWebPubSub(webPubSubName); var list = await _webPubSub.GetWebPubSubPrivateEndpointConnections().GetAllAsync().ToEnumerableAsync(); Assert.AreEqual(0, list.Count); await CreatePrivateEndpointConnection(_privateEndPointName); list = await _webPubSub.GetWebPubSubPrivateEndpointConnections().GetAllAsync().ToEnumerableAsync(); Assert.AreEqual(1, list.Count); }
public async Task Delete() { string webPubSubName = SessionRecording.GenerateAssetName("WebPubSub-"); _webPubSub = await CreateWebPubSub(webPubSubName); await CreatePrivateEndpointConnection(_privateEndPointName); var list = await _webPubSub.GetWebPubSubPrivateEndpointConnections().GetAllAsync().ToEnumerableAsync(); Assert.AreEqual(1, list.Count); foreach (var item in list) { await item.DeleteAsync(WaitUntil.Completed); } list = await _webPubSub.GetWebPubSubPrivateEndpointConnections().GetAllAsync().ToEnumerableAsync(); Assert.AreEqual(0, list.Count); }
public async Task CreateOrUpdate() { #region Snippet:Managing_WebPubSub_CreateWebPubSub WebPubSubCollection WebPubSubColletion = resourceGroup.GetWebPubSubs(); string webPubSubName = "myWebPubSubName"; // Use the same location as the resource group IList <LiveTraceCategory> categories = new List <LiveTraceCategory>(); categories.Add(new LiveTraceCategory("category-01", "true")); AclAction aclAction = new AclAction("Deny"); IList <WebPubSubRequestType> allow = new List <WebPubSubRequestType>(); IList <WebPubSubRequestType> deny = new List <WebPubSubRequestType>(); deny.Add(new WebPubSubRequestType("RESTAPI")); NetworkAcl publicNetwork = new NetworkAcl(allow, deny); IList <PrivateEndpointAcl> privateEndpoints = new List <PrivateEndpointAcl>(); List <ResourceLogCategory> resourceLogCategory = new List <ResourceLogCategory>() { new ResourceLogCategory() { Name = "category1", Enabled = "false" } }; WebPubSubData data = new WebPubSubData(AzureLocation.WestUS2) { Sku = new WebPubSubSku("Standard_S1"), LiveTraceConfiguration = new LiveTraceConfiguration("true", categories), NetworkAcls = new WebPubSubNetworkAcls(aclAction, publicNetwork, privateEndpoints), ResourceLogConfiguration = new ResourceLogConfiguration(resourceLogCategory), }; WebPubSubResource webPubSub = await(await WebPubSubColletion.CreateOrUpdateAsync(WaitUntil.Started, webPubSubName, data)).WaitForCompletionAsync(); #endregion }
public async Task WebAppWebPubSubConnectionCRUD() { string resourceGroupName = Recording.GenerateAssetName("SdkRg"); string webAppName = Recording.GenerateAssetName("SdkWeb"); string webpubsubName = Recording.GenerateAssetName("SdkWebPubSub"); string linkerName = Recording.GenerateAssetName("SdkLinker"); // create resource group await ResourceGroups.CreateOrUpdateAsync(WaitUntil.Completed, resourceGroupName, new Resources.ResourceGroupData(DefaultLocation)); ResourceGroupResource resourceGroup = await ResourceGroups.GetAsync(resourceGroupName); // create web app WebSiteCollection webSites = resourceGroup.GetWebSites(); await webSites.CreateOrUpdateAsync(WaitUntil.Completed, webAppName, new WebSiteData(DefaultLocation)); WebSiteResource webapp = await webSites.GetAsync(webAppName); // create webpubsub WebPubSubCollection webPubSubs = resourceGroup.GetWebPubSubs(); WebPubSubData webPubSubData = new WebPubSubData(DefaultLocation) { Sku = new WebPubSub.Models.WebPubSubSku("Standard_S1"), LiveTraceConfiguration = new WebPubSub.Models.LiveTraceConfiguration(), NetworkAcls = new WebPubSub.Models.WebPubSubNetworkAcls { PublicNetwork = new WebPubSub.Models.NetworkAcl(), }, }; webPubSubData.LiveTraceConfiguration.Categories.Clear(); webPubSubData.NetworkAcls.PublicNetwork.Allow.Clear(); webPubSubData.NetworkAcls.PublicNetwork.Deny.Clear(); webPubSubData.ResourceLogCategories.Clear(); await webPubSubs.CreateOrUpdateAsync(WaitUntil.Completed, webpubsubName, webPubSubData); WebPubSubResource webPubSub = await webPubSubs.GetAsync(webpubsubName); // create service linker LinkerResourceCollection linkers = webapp.GetLinkerResources(); var linkerData = new LinkerResourceData { TargetService = new Models.AzureResource { Id = webPubSub.Id, }, AuthInfo = new SecretAuthInfo(), ClientType = ClientType.Dotnet, }; await linkers.CreateOrUpdateAsync(WaitUntil.Completed, linkerName, linkerData); // list service linker var linkerResources = await linkers.GetAllAsync().ToEnumerableAsync(); Assert.AreEqual(1, linkerResources.Count); Assert.AreEqual(linkerName, linkerResources[0].Data.Name); // get service linker LinkerResource linker = await linkers.GetAsync(linkerName); Assert.IsTrue(linker.Id.ToString().StartsWith(webapp.Id.ToString(), StringComparison.InvariantCultureIgnoreCase)); Assert.AreEqual(webPubSub.Id.ToString(), (linker.Data.TargetService as AzureResource).Id); Assert.AreEqual(AuthType.Secret, linker.Data.AuthInfo.AuthType); // get service linker configurations SourceConfigurationResult configurations = await linker.GetConfigurationsAsync(); foreach (var configuration in configurations.Configurations) { Assert.IsNotNull(configuration.Name); Assert.IsNotNull(configuration.Value); } // delete service linker var operation = await linker.DeleteAsync(WaitUntil.Completed); Assert.IsTrue(operation.HasCompleted); }