public async Task GetAll() { _webPubSub = await CreateWebPubSub(); var list = await _webPubSub.GetSharedPrivateLinks().GetAllAsync().ToEnumerableAsync(); Assert.AreEqual(0, list.Count); }
public async Task <SharedPrivateLinkResource> CreateSharedPrivateLink(string LinkName) { //1. create vnet var vnetData = new VirtualNetworkData() { Location = "westus2", Subnets = { new SubnetData() { Name = "subnet01", AddressPrefix = "10.10.1.0/24", }, new SubnetData() { Name = "subnet02", AddressPrefix = "10.10.2.0/24", PrivateEndpointNetworkPolicies = "Disabled", } }, }; vnetData.AddressPrefixes.Add("10.10.0.0/16"); var vnetContainer = _resourceGroup.GetVirtualNetworks(); var vnet = await vnetContainer.CreateOrUpdateAsync(WaitUntil.Completed, _vnetName, vnetData); //2.1 Create AppServicePlan //string appServicePlanName = "appServicePlan5952"; //string location = "westus2"; //string appServicePlanId = $"{_resourceGroupIdentifier}/providers/Microsoft.Web/serverfarms/{appServicePlanName}"; //var armClient = GetArmClient(); //await armClient.DefaultSubscription.GetGenericResources().CreateOrUpdateAsync(appServicePlanId, new GenericResourceData(location) //{ // Properties = new Dictionary<string, object> // { // { "resources", new Dictionary<string, object> // { // { "type", "Microsoft.Web/serverfarms" }, // { "apiVersion", "2021-01-15" }, // { "name", appServicePlanName }, // { "location", location }, // { "kind", "app" }, // { "sku", new Dictionary<string,object> // { // { "name", "P1v2" }, // { "tier", "PremiumV2" }, // { "size", "P1v2" }, // { "family", "P1v2" }, // { "capacity", 1 }, // } // }, // { "properties", new Dictionary<string,object> // { // { "perSiteScaling", false }, // { "elasticScaleEnabled", false }, // { "maximumElasticWorkerCount", 1 }, // { "isSpot", false }, // { "reserved", false }, // { "isXenon", false }, // { "hyperV", false }, // { "targetWorkerCount", 0 }, // { "targetWorkerSizeId", 0 }, // } // }, // } // } // } //}); //TODO: 2.2 Create Appservice(Microsoft.Web/sites) string WebAppName = SessionRecording.GenerateAssetName("site-"); //3 create SharedPrivateLink //TODO: Creating a SharedPrivateLink inevitably requires manual approval on the portal. var container = _webPubSub.GetSharedPrivateLinks(); SharedPrivateLinkData data = new SharedPrivateLinkData() { PrivateLinkResourceId = $"{_resourceGroupIdentifier}/providers/Microsoft.Web/sites/{WebAppName}/sharedPrivateLinkResources/{LinkName}", GroupId = "webPubSub", RequestMessage = "please approve", }; var link = await container.CreateOrUpdateAsync(WaitUntil.Completed, LinkName, data); return(link.Value); }