コード例 #1
0
 protected void Initialize()
 {
     AzureLocation       = "eastus";
     KeyUuId             = "test_key_a6af8952-54a6-11e9-b600-2816a84d0309";
     LabelUuId           = "1d7b2b28-549e-11e9-b51c-2816a84d0309";
     Key                 = "PYTHON_UNIT_" + KeyUuId;
     Label               = "test_label1_" + LabelUuId;
     TestContentType     = "test content type";
     TestValue           = "test value";
     ResourceGroupPrefix = "Default-EventHub-";
     AppConfigurationManagementClient     = GetAppConfigurationManagementClient();
     ConfigurationStoresOperations        = AppConfigurationManagementClient.ConfigurationStores;
     PrivateEndpointConnectionsOperations = AppConfigurationManagementClient.PrivateEndpointConnections;
     PrivateLinkResourcesOperations       = AppConfigurationManagementClient.PrivateLinkResources;
     Operations = AppConfigurationManagementClient.Operations;
     ResourcesManagementClient  = GetResourceManagementClient();
     ResourceGroupsOperations   = ResourcesManagementClient.ResourceGroups;
     NetworkManagementClient    = GetNetworkManagementClient();
     VirtualNetworksOperations  = NetworkManagementClient.VirtualNetworks;
     SubnetsOperations          = NetworkManagementClient.Subnets;
     PrivateEndpointsOperations = NetworkManagementClient.PrivateEndpoints;
 }
コード例 #2
0
        public async Task AppConfiguration()
        {
            string ServiceName                   = Recording.GenerateAssetName("myapimrndxyz");
            string VnetName                      = Recording.GenerateAssetName("vnetname");
            string SubnetName                    = Recording.GenerateAssetName("subnetname");
            string EndpointName                  = Recording.GenerateAssetName("endpointxyz");
            string configurationStoreName        = Recording.GenerateAssetName("configuration");
            string privateEndpointConnectionName = Recording.GenerateAssetName("privateendpoint");
            var    resourceGroupName             = Recording.GenerateAssetName(ResourceGroupPrefix);
            await Helper.TryRegisterResourceGroupAsync(ResourceGroupsOperations, AzureLocation, resourceGroupName);

            var configurationCreateResponse = await ConfigurationStoresOperations.StartCreateAsync(resourceGroupName, configurationStoreName, new ConfigurationStore("westus", new Sku("Standard")));

            var configurationCreateResult = await WaitForCompletionAsync(configurationCreateResponse);

            Assert.IsNotNull(configurationCreateResult.Value);
            VirtualNetwork vnet = new VirtualNetwork()
            {
                Location     = "eastus",
                AddressSpace = new AddressSpace()
                {
                    AddressPrefixes = { "10.0.0.0/16", }
                },
                DhcpOptions = new DhcpOptions()
                {
                    DnsServers = { "10.1.1.1", "10.1.2.4" }
                },
                Subnets = { new Subnet()
                            {
                                Name = SubnetName, AddressPrefix = "10.0.0.0/24", PrivateEndpointNetworkPolicies = "Disabled"
                            } }
            };
            var putVnetResponseOperation = await WaitForCompletionAsync(await NetworkManagementClient.VirtualNetworks.StartCreateOrUpdateAsync(resourceGroupName, VnetName, vnet));

            Assert.IsNotNull(putVnetResponseOperation.Value);
            var setPrivateEndpointResponse = await WaitForCompletionAsync(await PrivateEndpointsOperations.StartCreateOrUpdateAsync(resourceGroupName, EndpointName,
                                                                                                                                    new Management.Network.Models.PrivateEndpoint()
            {
                Location = "eastus",
                PrivateLinkServiceConnections = { new PrivateLinkServiceConnection()
                                                  {
                                                      Name = "myconnection",
                                                      PrivateLinkServiceId = configurationCreateResult.Value.Id,
                                                      GroupIds             = { "configurationStores" },
                                                      RequestMessage       = "Please approve my connection",
                                                  } },
                Subnet = new Subnet()
                {
                    Id = "/subscriptions/" + TestEnvironment.SubscriptionId + "/resourceGroups/" + resourceGroupName + "/providers/Microsoft.Network/virtualNetworks/" + VnetName + "/subnets/" + SubnetName
                }
            }));

            //get Configuration
            var configurationGetResult = (await ConfigurationStoresOperations.GetAsync(resourceGroupName, configurationStoreName)).Value;

            Assert.IsNotNull(configurationGetResult);
            privateEndpointConnectionName = configurationGetResult.PrivateEndpointConnections[0].Name;
            var privateConnectionId = configurationGetResult.PrivateEndpointConnections[0].Id;
            //Create PrivateEndpointConnection
            var createPrivateEndPointConnectionResponse = await WaitForCompletionAsync(await PrivateEndpointConnectionsOperations.StartCreateOrUpdateAsync(resourceGroupName, configurationStoreName, privateEndpointConnectionName,
                                                                                                                                                           new Models.PrivateEndpointConnection(
                                                                                                                                                               //privateConnectionId,privateEndpointConnectionName,null,null,
                                                                                                                                                               privateConnectionId, privateEndpointConnectionName, null, null,
                                                                                                                                                               new Models.PrivateEndpoint("/subscriptions/" + TestEnvironment.SubscriptionId + "/resourceGroups/" + resourceGroupName + "/providers/Microsoft.Network/privateEndpoints/" + EndpointName),
                                                                                                                                                               new Models.PrivateLinkServiceConnectionState(Models.ConnectionStatus.Approved, "Auto-Approved", null)
                                                                                                                                                               )));

            Assert.IsNotNull(createPrivateEndPointConnectionResponse);
            var getPrivateEndPointConnectionResponse = await PrivateEndpointConnectionsOperations.GetAsync(resourceGroupName, configurationStoreName, privateEndpointConnectionName);

            Assert.IsNotNull(getPrivateEndPointConnectionResponse);

            var listByConfigurationResult = PrivateLinkResourcesOperations.ListByConfigurationStoreAsync(resourceGroupName, configurationStoreName);
            var listByConfigurationRes    = await listByConfigurationResult.ToEnumerableAsync();

            var privateLinkResourceName = listByConfigurationRes.First().Name;

            var privatelinkresourcegetResult = await PrivateLinkResourcesOperations.GetAsync(resourceGroupName, configurationStoreName, privateLinkResourceName);

            Assert.IsNotNull(privatelinkresourcegetResult.Value);
            var listByConfigurationStoreResult   = PrivateEndpointConnectionsOperations.ListByConfigurationStoreAsync(resourceGroupName, configurationStoreName);
            var listByConfigurationStoreResponse = await listByConfigurationStoreResult.ToEnumerableAsync();

            Assert.IsTrue(listByConfigurationStoreResponse.Count() >= 1);
            // get PrivateEndpointConnectionList
            var ConfigurationStoreListResponse = await PrivateLinkResourcesOperations.ListByConfigurationStoreAsync(resourceGroupName, configurationStoreName).ToEnumerableAsync();

            privateLinkResourceName = ConfigurationStoreListResponse.First().Name;

            //get privatelinkResource
            var GetPrivatelinkResponse = await PrivateLinkResourcesOperations.GetAsync(resourceGroupName, configurationStoreName, privateLinkResourceName);

            Assert.IsNotNull(GetPrivatelinkResponse.Value);

            //get privatelinkResource list
            var GetPrivatelinkListResponse = await PrivateLinkResourcesOperations.ListByConfigurationStoreAsync(resourceGroupName, configurationStoreName).ToEnumerableAsync();

            Assert.IsTrue(GetPrivatelinkListResponse.Count >= 1);

            // operation list test
            var operationListResult = await Operations.ListAsync().ToEnumerableAsync();

            Assert.IsTrue(operationListResult.Count >= 1);
            // ConfigurationStoresOperations list by resourcegroup test

            var configurationStoreListByResourceGroupResult = await ConfigurationStoresOperations.ListByResourceGroupAsync(resourceGroupName).ToEnumerableAsync();

            Assert.IsTrue(operationListResult.Count >= 1);

            //ConfigurationStoresOperations list by test
            var configurationStoresListResult = await ConfigurationStoresOperations.ListAsync(resourceGroupName).ToEnumerableAsync();

            Assert.IsTrue(configurationStoresListResult.Count >= 1);

            //update ConfigurationStores_Update
            var configurationStoresBeginUpdateResult = await WaitForCompletionAsync(await ConfigurationStoresOperations.StartUpdateAsync(resourceGroupName, configurationStoreName, new ConfigurationStoreUpdateParameters()
            {
                Tags = { { "category", "Marketing" } },
                Sku  = new Sku("Standard")
            }));

            Assert.AreEqual(configurationStoresBeginUpdateResult.Value.ProvisioningState.ToString(), "Succeeded");
            // ConfigurationStores CheckNameNotAvailable
            var checkNameAvailabilityResponse = await Operations.CheckNameAvailabilityAsync(new CheckNameAvailabilityParameters("contoso", "Microsoft.AppConfiguration/configurationStores"));

            Assert.IsNotNull(checkNameAvailabilityResponse.Value);
            //PrivateEndpointConnections Delete
            var deletePrivateEndpointConnectionResponse = await WaitForCompletionAsync(await PrivateEndpointConnectionsOperations.StartDeleteAsync(resourceGroupName, configurationStoreName, privateEndpointConnectionName));

            Assert.IsNotNull(deletePrivateEndpointConnectionResponse.Value);
            //ConfigurationStores Delete
            var deleteConfigurationStores = await WaitForCompletionAsync(await ConfigurationStoresOperations.StartDeleteAsync(resourceGroupName, configurationStoreName));

            Assert.IsNotNull(deleteConfigurationStores.Value);
        }
コード例 #3
0
 /// <summary>
 /// Initializes client properties.
 /// </summary>
 protected override void Initialize()
 {
     ApplicationGateways               = new ApplicationGatewaysOperations(this);
     ApplicationSecurityGroups         = new ApplicationSecurityGroupsOperations(this);
     AvailableDelegations              = new AvailableDelegationsOperations(this);
     AvailableResourceGroupDelegations = new AvailableResourceGroupDelegationsOperations(this);
     AzureFirewalls                       = new AzureFirewallsOperations(this);
     AzureFirewallFqdnTags                = new AzureFirewallFqdnTagsOperations(this);
     BastionHosts                         = new BastionHostsOperations(this);
     DdosCustomPolicies                   = new DdosCustomPoliciesOperations(this);
     DdosProtectionPlans                  = new DdosProtectionPlansOperations(this);
     AvailableEndpointServices            = new AvailableEndpointServicesOperations(this);
     ExpressRouteCircuitAuthorizations    = new ExpressRouteCircuitAuthorizationsOperations(this);
     ExpressRouteCircuitPeerings          = new ExpressRouteCircuitPeeringsOperations(this);
     ExpressRouteCircuitConnections       = new ExpressRouteCircuitConnectionsOperations(this);
     PeerExpressRouteCircuitConnections   = new PeerExpressRouteCircuitConnectionsOperations(this);
     ExpressRouteCircuits                 = new ExpressRouteCircuitsOperations(this);
     ExpressRouteServiceProviders         = new ExpressRouteServiceProvidersOperations(this);
     ExpressRouteCrossConnections         = new ExpressRouteCrossConnectionsOperations(this);
     ExpressRouteCrossConnectionPeerings  = new ExpressRouteCrossConnectionPeeringsOperations(this);
     ExpressRouteGateways                 = new ExpressRouteGatewaysOperations(this);
     ExpressRouteConnections              = new ExpressRouteConnectionsOperations(this);
     ExpressRoutePortsLocations           = new ExpressRoutePortsLocationsOperations(this);
     ExpressRoutePorts                    = new ExpressRoutePortsOperations(this);
     ExpressRouteLinks                    = new ExpressRouteLinksOperations(this);
     LoadBalancers                        = new LoadBalancersOperations(this);
     LoadBalancerBackendAddressPools      = new LoadBalancerBackendAddressPoolsOperations(this);
     LoadBalancerFrontendIPConfigurations = new LoadBalancerFrontendIPConfigurationsOperations(this);
     InboundNatRules                      = new InboundNatRulesOperations(this);
     LoadBalancerLoadBalancingRules       = new LoadBalancerLoadBalancingRulesOperations(this);
     LoadBalancerOutboundRules            = new LoadBalancerOutboundRulesOperations(this);
     LoadBalancerNetworkInterfaces        = new LoadBalancerNetworkInterfacesOperations(this);
     LoadBalancerProbes                   = new LoadBalancerProbesOperations(this);
     NatGateways       = new NatGatewaysOperations(this);
     NetworkInterfaces = new NetworkInterfacesOperations(this);
     NetworkInterfaceIPConfigurations  = new NetworkInterfaceIPConfigurationsOperations(this);
     NetworkInterfaceLoadBalancers     = new NetworkInterfaceLoadBalancersOperations(this);
     NetworkInterfaceTapConfigurations = new NetworkInterfaceTapConfigurationsOperations(this);
     NetworkProfiles               = new NetworkProfilesOperations(this);
     NetworkSecurityGroups         = new NetworkSecurityGroupsOperations(this);
     SecurityRules                 = new SecurityRulesOperations(this);
     DefaultSecurityRules          = new DefaultSecurityRulesOperations(this);
     NetworkWatchers               = new NetworkWatchersOperations(this);
     PacketCaptures                = new PacketCapturesOperations(this);
     ConnectionMonitors            = new ConnectionMonitorsOperations(this);
     Operations                    = new Operations(this);
     PrivateEndpoints              = new PrivateEndpointsOperations(this);
     AvailablePrivateEndpointTypes = new AvailablePrivateEndpointTypesOperations(this);
     PrivateLinkServices           = new PrivateLinkServicesOperations(this);
     PublicIPAddresses             = new PublicIPAddressesOperations(this);
     PublicIPPrefixes              = new PublicIPPrefixesOperations(this);
     RouteFilters                  = new RouteFiltersOperations(this);
     RouteFilterRules              = new RouteFilterRulesOperations(this);
     RouteTables                   = new RouteTablesOperations(this);
     Routes = new RoutesOperations(this);
     BgpServiceCommunities            = new BgpServiceCommunitiesOperations(this);
     ServiceEndpointPolicies          = new ServiceEndpointPoliciesOperations(this);
     ServiceEndpointPolicyDefinitions = new ServiceEndpointPolicyDefinitionsOperations(this);
     ServiceTags                      = new ServiceTagsOperations(this);
     Usages                           = new UsagesOperations(this);
     VirtualNetworks                  = new VirtualNetworksOperations(this);
     Subnets                          = new SubnetsOperations(this);
     ResourceNavigationLinks          = new ResourceNavigationLinksOperations(this);
     ServiceAssociationLinks          = new ServiceAssociationLinksOperations(this);
     VirtualNetworkPeerings           = new VirtualNetworkPeeringsOperations(this);
     VirtualNetworkGateways           = new VirtualNetworkGatewaysOperations(this);
     VirtualNetworkGatewayConnections = new VirtualNetworkGatewayConnectionsOperations(this);
     LocalNetworkGateways             = new LocalNetworkGatewaysOperations(this);
     VirtualNetworkTaps               = new VirtualNetworkTapsOperations(this);
     VirtualWans                      = new VirtualWansOperations(this);
     VpnSites                         = new VpnSitesOperations(this);
     VpnSiteLinks                     = new VpnSiteLinksOperations(this);
     VpnSitesConfiguration            = new VpnSitesConfigurationOperations(this);
     VirtualHubs                      = new VirtualHubsOperations(this);
     HubVirtualNetworkConnections     = new HubVirtualNetworkConnectionsOperations(this);
     VpnGateways                      = new VpnGatewaysOperations(this);
     VpnConnections                   = new VpnConnectionsOperations(this);
     VpnSiteLinkConnections           = new VpnSiteLinkConnectionsOperations(this);
     VpnLinkConnections               = new VpnLinkConnectionsOperations(this);
     P2sVpnServerConfigurations       = new P2sVpnServerConfigurationsOperations(this);
     P2sVpnGateways                   = new P2sVpnGatewaysOperations(this);
     WebApplicationFirewallPolicies   = new WebApplicationFirewallPoliciesOperations(this);
     BaseUri                          = new System.Uri("https://management.azure.com");
     AcceptLanguage                   = "en-US";
     LongRunningOperationRetryTimeout = 30;
     GenerateClientRequestId          = true;
     SerializationSettings            = new JsonSerializerSettings
     {
         Formatting            = Newtonsoft.Json.Formatting.Indented,
         DateFormatHandling    = Newtonsoft.Json.DateFormatHandling.IsoDateFormat,
         DateTimeZoneHandling  = Newtonsoft.Json.DateTimeZoneHandling.Utc,
         NullValueHandling     = Newtonsoft.Json.NullValueHandling.Ignore,
         ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize,
         ContractResolver      = new ReadOnlyJsonContractResolver(),
         Converters            = new List <JsonConverter>
         {
             new Iso8601TimeSpanConverter()
         }
     };
     SerializationSettings.Converters.Add(new TransformationJsonConverter());
     DeserializationSettings = new JsonSerializerSettings
     {
         DateFormatHandling    = Newtonsoft.Json.DateFormatHandling.IsoDateFormat,
         DateTimeZoneHandling  = Newtonsoft.Json.DateTimeZoneHandling.Utc,
         NullValueHandling     = Newtonsoft.Json.NullValueHandling.Ignore,
         ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize,
         ContractResolver      = new ReadOnlyJsonContractResolver(),
         Converters            = new List <JsonConverter>
         {
             new Iso8601TimeSpanConverter()
         }
     };
     CustomInitialize();
     DeserializationSettings.Converters.Add(new TransformationJsonConverter());
     DeserializationSettings.Converters.Add(new CloudErrorJsonConverter());
 }