public async Task GetAll() { _webPubSub = await CreateWebPubSub(); var list = await _webPubSub.GetSharedPrivateLinks().GetAllAsync().ToEnumerableAsync(); Assert.AreEqual(0, list.Count); }
public async Task Get() { #region Snippet:Managing_WebPubSub_GetWebPubSub WebPubSubCollection WebPubSubColletion = resourceGroup.GetWebPubSubs(); WebPubSub webPubSub = await WebPubSubColletion.GetAsync("myWebPubSubName"); Console.WriteLine(webPubSub.Data.Name); #endregion }
public async Task DeleteVirtualWebPubSub() { #region Snippet:Managing_WebPubSub_DeleteWebPubSub WebPubSubCollection WebPubSubColletion = resourceGroup.GetWebPubSubs(); WebPubSub webPubSub = await WebPubSubColletion.GetAsync("myWebPubSubName"); await webPubSub.DeleteAsync(); #endregion }
public async Task CheckIfExist() { string webPubSubName = SessionRecording.GenerateAssetName("WebPubSub-"); _webPubSub = await CreateWebPubSub(webPubSubName); await CreatePrivateEndpointConnection(_privateEndPointName); var list = await _webPubSub.GetPrivateEndpointConnections().GetAllAsync().ToEnumerableAsync(); Assert.True(await _webPubSub.GetPrivateEndpointConnections().ExistsAsync(list[0].Data.Name)); Assert.False(await _webPubSub.GetPrivateEndpointConnections().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.GetPrivateEndpointConnections().GetAllAsync().ToEnumerableAsync(); var PrivateEndpointConnection = await _webPubSub.GetPrivateEndpointConnections().GetAsync(list[0].Data.Name); Assert.NotNull(PrivateEndpointConnection.Value.Data); Assert.AreEqual("Approved", PrivateEndpointConnection.Value.Data.PrivateLinkServiceConnectionState.Status.ToString()); }
public async Task GetAll() { string webPubSubName = SessionRecording.GenerateAssetName("WebPubSub-"); _webPubSub = await CreateWebPubSub(webPubSubName); var list = await _webPubSub.GetPrivateEndpointConnections().GetAllAsync().ToEnumerableAsync(); Assert.AreEqual(0, list.Count); await CreatePrivateEndpointConnection(_privateEndPointName); list = await _webPubSub.GetPrivateEndpointConnections().GetAllAsync().ToEnumerableAsync(); Assert.AreEqual(1, list.Count); }
public async Task GetIfExists() { #region Snippet:Managing_WebPubSub_GetWebPubSubIfExists WebPubSubCollection WebPubSubColletion = resourceGroup.GetWebPubSubs(); WebPubSub webPubSub = await WebPubSubColletion.GetIfExistsAsync("foo"); if (webPubSub != null) { Console.WriteLine(webPubSub.Data.Name); } if (await WebPubSubColletion.CheckIfExistsAsync("bar")) { Console.WriteLine("WebPubSub 'bar' exists."); } #endregion }
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(Location.WestUS2) { Sku = new WebPubSubSku("Standard_S1"), LiveTraceConfiguration = new LiveTraceConfiguration("true", categories), NetworkAcls = new WebPubSubNetworkAcls(aclAction, publicNetwork, privateEndpoints), ResourceLogConfiguration = new ResourceLogConfiguration(resourceLogCategory), }; WebPubSub webPubSub = await(await WebPubSubColletion.CreateOrUpdateAsync(webPubSubName, data)).WaitForCompletionAsync(); #endregion }