diff --git a/eng/scripts/Invoke-GenerateAndBuildV2.ps1 b/eng/scripts/Invoke-GenerateAndBuildV2.ps1 index 5b3278fae7c0..4696f37f5ce4 100644 --- a/eng/scripts/Invoke-GenerateAndBuildV2.ps1 +++ b/eng/scripts/Invoke-GenerateAndBuildV2.ps1 @@ -102,7 +102,7 @@ foreach( $file in $inputFilePaths) { $inputFileToGen += @($file) } } - + } if ($inputFileToGen) { @@ -113,42 +113,27 @@ if ($inputFileToGen) { if ($relatedTypeSpecProjectFolder) { foreach ($typespecRelativeFolder in $relatedTypeSpecProjectFolder) { $typespecFolder = Resolve-Path (Join-Path $swaggerDir $typespecRelativeFolder) - $newPackageOutput = "newPackageOutput.json" - - $tspConfigYaml = Get-Content -Path (Join-Path "$typespecFolder" "tspconfig.yaml") -Raw - - Install-ModuleIfNotInstalled "powershell-yaml" "0.4.1" | Import-Module - $yml = ConvertFrom-YAML $tspConfigYaml - $service = "" - $namespace = "" - if ($yml) { - if ($yml["parameters"] -And $yml["parameters"]["service-directory-name"]) { - $service = $yml["parameters"]["service-directory-name"]["default"]; - } - if ($yml["options"] -And $yml["options"]["@azure-tools/typespec-csharp"] -And $yml["options"]["@azure-tools/typespec-csharp"]["namespace"]) { - $namespace = $yml["options"]["@azure-tools/typespec-csharp"]["namespace"] - } - } - if (!$service || !$namespace) { - throw "Not provide service name or namespace." - } - $projectFolder = (Join-Path $sdkPath "sdk" $service $namespace) - New-TypeSpecPackageFolder ` - -service $service ` - -namespace $namespace ` - -sdkPath $sdkPath ` - -relatedTypeSpecProjectFolder $typespecRelativeFolder ` - -specRoot $swaggerDir ` - -outputJsonFile $newpackageoutput - $newPackageOutputJson = Get-Content $newPackageOutput -Raw | ConvertFrom-Json - $relativeSdkPath = $newPackageOutputJson.path - GeneratePackage ` - -projectFolder $projectFolder ` + $curpath = Get-Location | Select-Object -ExpandProperty Path | Out-String -Stream + Write-Host "Current path is $curpath" + $processScript = Resolve-Path (Join-Path "./eng/common/scripts" "TypeSpec-Project-Process.ps1") + $sdkProjectFolder = & $processScript $typespecFolder $commitid $repoHttpsUrl -SkipSyncAndGenerate + if ($LASTEXITCODE) { + # If Process script call fails, then return with failure to CI and don't need to call GeneratePackage + $generatedSDKPackages = @{ + result = "failed"; + path=@(""); + } + } else { + $relativeSdkPath = Resolve-Path $sdkProjectFolder -Relative + GeneratePackage ` + -projectFolder $sdkProjectFolder ` -sdkRootPath $sdkPath ` -path $relativeSdkPath ` -downloadUrlPrefix $downloadUrlPrefix ` -serviceType "data-plane" ` - -generatedSDKPackages $generatedSDKPackages + -generatedSDKPackages $generatedSDKPackages ` + -specRepoRoot $swaggerDir + } } } $outputJson = [PSCustomObject]@{ diff --git a/eng/scripts/automation/GenerateAndBuildLib.ps1 b/eng/scripts/automation/GenerateAndBuildLib.ps1 index f83ae9246876..81c2870477bd 100644 --- a/eng/scripts/automation/GenerateAndBuildLib.ps1 +++ b/eng/scripts/automation/GenerateAndBuildLib.ps1 @@ -722,7 +722,8 @@ function GeneratePackage() [string]$downloadUrlPrefix="", [string]$serviceType="data-plane", [switch]$skipGenerate, - [object]$generatedSDKPackages + [object]$generatedSDKPackages, + [string]$specRepoRoot="" ) $packageName = Split-Path $projectFolder -Leaf @@ -740,7 +741,11 @@ function GeneratePackage() Write-Host "Start to generate sdk $projectFolder" $srcPath = Join-Path $projectFolder 'src' if (!$skipGenerate) { - dotnet build /t:GenerateCode $srcPath + if($specRepoRoot -eq "") { + dotnet build /t:GenerateCode $srcPath + } else { + dotnet build /t:GenerateCode $srcPath /p:SpecRepoRoot=$specRepoRoot + } } if ( !$?) { Write-Error "Failed to generate sdk. exit code: $?" diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/IPublicIpAddressesOperations.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/IPublicIPAddressesOperations.cs similarity index 100% rename from sdk/network/Microsoft.Azure.Management.Network/src/Generated/IPublicIpAddressesOperations.cs rename to sdk/network/Microsoft.Azure.Management.Network/src/Generated/IPublicIPAddressesOperations.cs diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/IVirtualWANsOperations.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/IVirtualWansOperations.cs similarity index 100% rename from sdk/network/Microsoft.Azure.Management.Network/src/Generated/IVirtualWANsOperations.cs rename to sdk/network/Microsoft.Azure.Management.Network/src/Generated/IVirtualWansOperations.cs diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/ApplicationGatewayFrontendIpConfiguration.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/ApplicationGatewayFrontendIPConfiguration.cs similarity index 100% rename from sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/ApplicationGatewayFrontendIpConfiguration.cs rename to sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/ApplicationGatewayFrontendIPConfiguration.cs diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/ApplicationGatewayIpConfiguration.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/ApplicationGatewayIPConfiguration.cs similarity index 100% rename from sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/ApplicationGatewayIpConfiguration.cs rename to sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/ApplicationGatewayIPConfiguration.cs diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/FrontendIpConfiguration.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/FrontendIPConfiguration.cs similarity index 100% rename from sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/FrontendIpConfiguration.cs rename to sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/FrontendIPConfiguration.cs diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/IpAllocationMethod.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/IPAllocationMethod.cs similarity index 100% rename from sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/IpAllocationMethod.cs rename to sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/IPAllocationMethod.cs diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/NetworkInterfaceIpConfiguration.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/NetworkInterfaceIPConfiguration.cs similarity index 100% rename from sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/NetworkInterfaceIpConfiguration.cs rename to sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/NetworkInterfaceIPConfiguration.cs diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/PublicIpAddress.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/PublicIPAddress.cs similarity index 100% rename from sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/PublicIpAddress.cs rename to sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/PublicIPAddress.cs diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/PublicIpAddressDnsSettings.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/PublicIPAddressDnsSettings.cs similarity index 100% rename from sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/PublicIpAddressDnsSettings.cs rename to sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/PublicIPAddressDnsSettings.cs diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/VirtualNetworkGatewayIpConfiguration.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/VirtualNetworkGatewayIPConfiguration.cs similarity index 100% rename from sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/VirtualNetworkGatewayIpConfiguration.cs rename to sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/VirtualNetworkGatewayIPConfiguration.cs diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/VirtualNetworkPeering.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/VirtualNetworkPeering.cs index 8d387c34da1a..7f633bf9b142 100644 --- a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/VirtualNetworkPeering.cs +++ b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/VirtualNetworkPeering.cs @@ -13,6 +13,8 @@ namespace Microsoft.Azure.Management.Network.Models using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; using System.Linq; /// @@ -52,8 +54,18 @@ public VirtualNetworkPeering() /// different region (preview). See here to register for the preview /// and learn more /// (https://docs.microsoft.com/en-us/azure/virtual-network/virtual-network-create-peering). + /// The local address space of the + /// local virtual network that is peered. + /// The current local + /// address space of the local virtual network that is peered. /// The reference to the address space /// peered with the remote virtual network. + /// Whether complete virtual network + /// address space is peered. + /// List of local subnet names that are + /// subnet peered with remote virtual network. + /// List of remote subnet names from + /// remote virtual network that are subnet peered. /// The reference to the /// current address space of the remote virtual network. /// The reference to the remote @@ -80,7 +92,7 @@ public VirtualNetworkPeering() /// A unique read-only string that changes whenever /// the resource is updated. /// Resource type. - public VirtualNetworkPeering(string id = default(string), bool? allowVirtualNetworkAccess = default(bool?), bool? allowForwardedTraffic = default(bool?), bool? allowGatewayTransit = default(bool?), bool? useRemoteGateways = default(bool?), SubResource remoteVirtualNetwork = default(SubResource), AddressSpace remoteAddressSpace = default(AddressSpace), AddressSpace remoteVirtualNetworkAddressSpace = default(AddressSpace), VirtualNetworkBgpCommunities remoteBgpCommunities = default(VirtualNetworkBgpCommunities), VirtualNetworkEncryption remoteVirtualNetworkEncryption = default(VirtualNetworkEncryption), string peeringState = default(string), string peeringSyncLevel = default(string), string provisioningState = default(string), bool? doNotVerifyRemoteGateways = default(bool?), string resourceGuid = default(string), string name = default(string), string etag = default(string), string type = default(string)) + public VirtualNetworkPeering(string id = default(string), bool? allowVirtualNetworkAccess = default(bool?), bool? allowForwardedTraffic = default(bool?), bool? allowGatewayTransit = default(bool?), bool? useRemoteGateways = default(bool?), SubResource remoteVirtualNetwork = default(SubResource), AddressSpace localAddressSpace = default(AddressSpace), AddressSpace localVirtualNetworkAddressSpace = default(AddressSpace), AddressSpace remoteAddressSpace = default(AddressSpace), bool? peerCompleteVnets = default(bool?), IList localSubnetNames = default(IList), IList remoteSubnetNames = default(IList), AddressSpace remoteVirtualNetworkAddressSpace = default(AddressSpace), VirtualNetworkBgpCommunities remoteBgpCommunities = default(VirtualNetworkBgpCommunities), VirtualNetworkEncryption remoteVirtualNetworkEncryption = default(VirtualNetworkEncryption), string peeringState = default(string), string peeringSyncLevel = default(string), string provisioningState = default(string), bool? doNotVerifyRemoteGateways = default(bool?), string resourceGuid = default(string), string name = default(string), string etag = default(string), string type = default(string)) : base(id) { AllowVirtualNetworkAccess = allowVirtualNetworkAccess; @@ -88,7 +100,12 @@ public VirtualNetworkPeering() AllowGatewayTransit = allowGatewayTransit; UseRemoteGateways = useRemoteGateways; RemoteVirtualNetwork = remoteVirtualNetwork; + LocalAddressSpace = localAddressSpace; + LocalVirtualNetworkAddressSpace = localVirtualNetworkAddressSpace; RemoteAddressSpace = remoteAddressSpace; + PeerCompleteVnets = peerCompleteVnets; + LocalSubnetNames = localSubnetNames; + RemoteSubnetNames = remoteSubnetNames; RemoteVirtualNetworkAddressSpace = remoteVirtualNetworkAddressSpace; RemoteBgpCommunities = remoteBgpCommunities; RemoteVirtualNetworkEncryption = remoteVirtualNetworkEncryption; @@ -150,6 +167,20 @@ public VirtualNetworkPeering() [JsonProperty(PropertyName = "properties.remoteVirtualNetwork")] public SubResource RemoteVirtualNetwork { get; set; } + /// + /// Gets or sets the local address space of the local virtual network + /// that is peered. + /// + [JsonProperty(PropertyName = "properties.localAddressSpace")] + public AddressSpace LocalAddressSpace { get; set; } + + /// + /// Gets or sets the current local address space of the local virtual + /// network that is peered. + /// + [JsonProperty(PropertyName = "properties.localVirtualNetworkAddressSpace")] + public AddressSpace LocalVirtualNetworkAddressSpace { get; set; } + /// /// Gets or sets the reference to the address space peered with the /// remote virtual network. @@ -157,6 +188,27 @@ public VirtualNetworkPeering() [JsonProperty(PropertyName = "properties.remoteAddressSpace")] public AddressSpace RemoteAddressSpace { get; set; } + /// + /// Gets or sets whether complete virtual network address space is + /// peered. + /// + [JsonProperty(PropertyName = "properties.peerCompleteVnets")] + public bool? PeerCompleteVnets { get; set; } + + /// + /// Gets or sets list of local subnet names that are subnet peered with + /// remote virtual network. + /// + [JsonProperty(PropertyName = "properties.localSubnetNames")] + public IList LocalSubnetNames { get; set; } + + /// + /// Gets or sets list of remote subnet names from remote virtual + /// network that are subnet peered. + /// + [JsonProperty(PropertyName = "properties.remoteSubnetNames")] + public IList RemoteSubnetNames { get; set; } + /// /// Gets or sets the reference to the current address space of the /// remote virtual network. diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/PublicIpAddressesOperations.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/PublicIPAddressesOperations.cs similarity index 100% rename from sdk/network/Microsoft.Azure.Management.Network/src/Generated/PublicIpAddressesOperations.cs rename to sdk/network/Microsoft.Azure.Management.Network/src/Generated/PublicIPAddressesOperations.cs diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/PublicIpAddressesOperationsExtensions.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/PublicIPAddressesOperationsExtensions.cs similarity index 100% rename from sdk/network/Microsoft.Azure.Management.Network/src/Generated/PublicIpAddressesOperationsExtensions.cs rename to sdk/network/Microsoft.Azure.Management.Network/src/Generated/PublicIPAddressesOperationsExtensions.cs diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/SdkInfo_NetworkManagementClient.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/SdkInfo_NetworkManagementClient.cs index cceaf00f7700..9f47f94740fb 100644 --- a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/SdkInfo_NetworkManagementClient.cs +++ b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/SdkInfo_NetworkManagementClient.cs @@ -172,16 +172,5 @@ public static IEnumerable> ApiInfo_NetworkManageme }.AsEnumerable(); } } - // BEGIN: Code Generation Metadata Section - public static readonly String AutoRestVersion = "2.0.4421"; - public static readonly String AutoRestBootStrapperVersion = "autorest@2.0.4413"; - public static readonly String AutoRestCmdExecuted = "cmd.exe /c autorest.cmd https://github.com/Azure/azure-rest-api-specs/blob/main/specification/network/resource-manager/readme.md --csharp --version=2.0.4421 --reflect-api-versions --csharp-sdks-folder=D:\\GitRepos\\AzureSdkForNet4\\sdk"; - public static readonly String GithubForkName = "Azure"; - public static readonly String GithubBranchName = "main"; - public static readonly String GithubCommidId = "382192a08796a202d9d1915e4d2e339dfd4d110d"; - public static readonly String CodeGenerationErrors = ""; - public static readonly String GithubRepoName = "azure-rest-api-specs"; - // END: Code Generation Metadata Section } } - diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/VirtualWANsOperations.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/VirtualWansOperations.cs similarity index 100% rename from sdk/network/Microsoft.Azure.Management.Network/src/Generated/VirtualWANsOperations.cs rename to sdk/network/Microsoft.Azure.Management.Network/src/Generated/VirtualWansOperations.cs diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/VirtualWANsOperationsExtensions.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/VirtualWansOperationsExtensions.cs similarity index 100% rename from sdk/network/Microsoft.Azure.Management.Network/src/Generated/VirtualWANsOperationsExtensions.cs rename to sdk/network/Microsoft.Azure.Management.Network/src/Generated/VirtualWansOperationsExtensions.cs