static IEnumerable GetBicepFilePermittedOverloads()

in src/Bicep.Core/Semantics/Namespaces/AzNamespaceType.cs [385:559]


            static IEnumerable<FunctionOverload> GetBicepFilePermittedOverloads()
            {
                yield return new FunctionOverloadBuilder("environment")
                    .WithReturnType(GetEnvironmentReturnType())
                    .WithGenericDescription("Returns information about the Azure environment used for deployment.")
                    .Build();

                // TODO: This is based on docs. Verify
                // the resourceId function relies on leading optional parameters that are disambiguated at runtime
                // modeling this as multiple overload with all possible permutations of the leading parameters
                const string resourceIdDescription = "Returns the unique identifier of a resource. You use this function when the resource name is ambiguous or not provisioned within the same template. The format of the returned identifier varies based on whether the deployment happens at the scope of a resource group, subscription, management group, or tenant.";
                yield return new FunctionOverloadBuilder("resourceId")
                    .WithReturnType(LanguageConstants.String)
                    .WithGenericDescription(resourceIdDescription)
                    .WithRequiredParameter("resourceType", LanguageConstants.String, "Type of resource including resource provider namespace")
                    .WithVariableParameter("resourceName", LanguageConstants.String, minimumCount: 1, "The resource name segment")
                    .Build();

                yield return new FunctionOverloadBuilder("resourceId")
                    .WithReturnType(LanguageConstants.String)
                    .WithGenericDescription(resourceIdDescription)
                    .WithRequiredParameter("subscriptionId", LanguageConstants.String, "The subscription ID")
                    .WithRequiredParameter("resourceType", LanguageConstants.String, "Type of resource including resource provider namespace")
                    .WithVariableParameter("resourceName", LanguageConstants.String, minimumCount: 1, "The resource name segment")
                    .Build();

                yield return new FunctionOverloadBuilder("resourceId")
                    .WithReturnType(LanguageConstants.String)
                    .WithGenericDescription(resourceIdDescription)
                    .WithRequiredParameter("resourceGroupName", LanguageConstants.String, "The resource group name")
                    .WithRequiredParameter("resourceType", LanguageConstants.String, "Type of resource including resource provider namespace")
                    .WithVariableParameter("resourceName", LanguageConstants.String, minimumCount: 1, "The resource name segment")
                    .Build();

                yield return new FunctionOverloadBuilder("resourceId")
                    .WithReturnType(LanguageConstants.String)
                    .WithGenericDescription(resourceIdDescription)
                    .WithRequiredParameter("subscriptionId", LanguageConstants.String, "The subscription ID")
                    .WithRequiredParameter("resourceGroupName", LanguageConstants.String, "The resource group name")
                    .WithRequiredParameter("resourceType", LanguageConstants.String, "Type of resource including resource provider namespace")
                    .WithVariableParameter("resourceName", LanguageConstants.String, minimumCount: 1, "The resource name segment")
                    .Build();

                // the subscriptionResourceId function relies on leading optional parameters that are disambiguated at runtime
                // modeling this as multiple overload with all possible permutations of the leading parameters
                const string subscriptionResourceIdDescription = "Returns the unique identifier for a resource deployed at the subscription level.";
                yield return new FunctionOverloadBuilder("subscriptionResourceId")
                    .WithReturnType(LanguageConstants.String)
                    .WithGenericDescription(subscriptionResourceIdDescription)
                    .WithRequiredParameter("resourceType", LanguageConstants.String, "Type of resource including resource provider namespace")
                    .WithVariableParameter("resourceName", LanguageConstants.String, minimumCount: 1, "The resource name segment")
                    .Build();

                yield return new FunctionOverloadBuilder("subscriptionResourceId")
                    .WithReturnType(LanguageConstants.String)
                    .WithGenericDescription(subscriptionResourceIdDescription)
                    .WithRequiredParameter("subscriptionId", LanguageConstants.String, "The subscription ID")
                    .WithRequiredParameter("resourceType", LanguageConstants.String, "Type of resource including resource provider namespace")
                    .WithVariableParameter("resourceName", LanguageConstants.String, minimumCount: 1, "The resource name segment")
                    .Build();

                yield return new FunctionOverloadBuilder("tenantResourceId")
                    .WithReturnType(LanguageConstants.String)
                    .WithGenericDescription("Returns the unique identifier for a resource deployed at the tenant level.")
                    .WithRequiredParameter("resourceType", LanguageConstants.String, "Type of resource including resource provider namespace")
                    .WithVariableParameter("resourceName", LanguageConstants.String, minimumCount: 1, "The resource name segment")
                    .Build();

                yield return new FunctionOverloadBuilder("extensionResourceId")
                    .WithReturnType(LanguageConstants.String)
                    // .WithGenericDescription("Returns the resource ID for an extension resource, which is a resource type that is applied to another resource to add to its capabilities.")
                    .WithGenericDescription("Returns the resource ID for an [extension](https://docs.microsoft.com/en-us/azure/azure-resource-manager/management/extension-resource-types) resource, which is a resource type that is applied to another resource to add to its capabilities.")
                    .WithRequiredParameter("resourceId", LanguageConstants.String, "The resource ID for the resource that the extension resource is applied to")
                    .WithRequiredParameter("resourceType", LanguageConstants.String, "Type of the extension resource including resource provider namespace")
                    .WithVariableParameter("resourceName", LanguageConstants.String, minimumCount: 1, "The extension resource name segment")
                    .Build();

                const string managementGroupResourceIdDescription = "Returns the unique identifier for a resource deployed at the management group level.";
                yield return new FunctionOverloadBuilder("managementGroupResourceId")
                    .WithReturnType(LanguageConstants.String)
                    .WithGenericDescription(managementGroupResourceIdDescription)
                    .WithRequiredParameter("resourceType", LanguageConstants.String, "Type of resource including resource provider namespace")
                    .WithVariableParameter("resourceName", LanguageConstants.String, minimumCount: 1, "The resource name segment")
                    .Build();

                yield return new FunctionOverloadBuilder("managementGroupResourceId")
                    .WithReturnType(LanguageConstants.String)
                    .WithGenericDescription(managementGroupResourceIdDescription)
                    .WithRequiredParameter("managementGroupId", LanguageConstants.String, "The management group ID")
                    .WithRequiredParameter("resourceType", LanguageConstants.String, "Type of resource including resource provider namespace")
                    .WithVariableParameter("resourceName", LanguageConstants.String, minimumCount: 1, "The resource name segment")
                    .Build();

                const string providersDescription = "Returns information about a resource provider and its supported resource types. If you don't provide a resource type, the function returns all the supported types for the resource provider.";
                yield return new FunctionOverloadBuilder("providers")
                    .WithReturnResultBuilder(AddDiagnosticsAndReturnResult(GetProvidersSingleProviderReturnType(), x => x.DeprecatedProvidersFunction("providers")), GetProvidersSingleProviderReturnType())
                    .WithGenericDescription(providersDescription)
                    .WithRequiredParameter("providerNamespace", LanguageConstants.String, "the namespace of the provider")
                    .Build();

                yield return new FunctionOverloadBuilder("providers")
                    .WithReturnResultBuilder(AddDiagnosticsAndReturnResult(GetProvidersSingleResourceReturnType(), x => x.DeprecatedProvidersFunction("providers")), GetProvidersSingleResourceReturnType())
                    .WithGenericDescription(providersDescription)
                    .WithRequiredParameter("providerNamespace", LanguageConstants.String, "the namespace of the provider")
                    .WithRequiredParameter("resourceType", LanguageConstants.String, "The type of resource within the specified namespace")
                    .Build();

                yield return new FunctionOverloadBuilder("toLogicalZone")
                    .WithReturnType(LanguageConstants.String)
                    .WithGenericDescription("Returns the logical zone corresponding to the given physical zone.")
                    .WithRequiredParameter("subscriptionId", LanguageConstants.String, "The subscription ID of the deployed availability zones")
                    .WithRequiredParameter("location", LanguageConstants.String, "The location of the availability zone mappings")
                    .WithRequiredParameter("physicalZone", LanguageConstants.String, "The physical zone to convert")
                    .WithFlags(FunctionFlags.RequiresInlining)
                    .Build();

                yield return new FunctionOverloadBuilder("toLogicalZones")
                    .WithReturnType(new TypedArrayType(LanguageConstants.String, TypeSymbolValidationFlags.Default))
                    .WithGenericDescription("Returns the logical zone array corresponding to the given array of physical zones.")
                    .WithRequiredParameter("subscriptionId", LanguageConstants.String, "The subscription ID of the deployed availability zones")
                    .WithRequiredParameter("location", LanguageConstants.String, "The location of the availability zone mappings")
                    .WithRequiredParameter("physicalZones", LanguageConstants.Array, "An array of physical zones to convert")
                    .WithFlags(FunctionFlags.RequiresInlining)
                    .Build();

                yield return new FunctionOverloadBuilder("toPhysicalZone")
                    .WithReturnType(LanguageConstants.String)
                    .WithGenericDescription("Returns the physical zone corresponding to the given logical zone.")
                    .WithRequiredParameter("subscriptionId", LanguageConstants.String, "The subscription ID of the deployed availability zones")
                    .WithRequiredParameter("location", LanguageConstants.String, "The location of the availability zone mappings")
                    .WithRequiredParameter("logicalZone", LanguageConstants.String, "The logical zone to convert")
                    .WithFlags(FunctionFlags.RequiresInlining)
                    .Build();

                yield return new FunctionOverloadBuilder("toPhysicalZones")
                    .WithReturnType(new TypedArrayType(LanguageConstants.String, TypeSymbolValidationFlags.Default))
                    .WithGenericDescription("Returns the physical zone array corresponding to the given array of logical zones.")
                    .WithRequiredParameter("subscriptionId", LanguageConstants.String, "The subscription ID of the deployed availability zones")
                    .WithRequiredParameter("location", LanguageConstants.String, "The location of the availability zone mappings")
                    .WithRequiredParameter("logicalZones", LanguageConstants.Array, "An array of logical zones to convert")
                    .WithFlags(FunctionFlags.RequiresInlining)
                    .Build();

                // TODO: return type is string[]
                // TODO: Location param should be of location type if we ever add it
                yield return new FunctionOverloadBuilder("pickZones")
                    .WithReturnType(LanguageConstants.Array)
                    .WithGenericDescription("Determines whether a resource type supports zones for a region.")
                    .WithRequiredParameter("providerNamespace", LanguageConstants.String, "The resource provider namespace for the resource type to check for zone support")
                    .WithRequiredParameter("resourceType", LanguageConstants.String, "The resource type to check for zone support")
                    .WithRequiredParameter("location", LanguageConstants.String, "The region to check for zone support")
                    .WithOptionalParameter("numberOfZones", LanguageConstants.Int, "The number of logical zones to return. The default is 1. The number must a positive integer from 1 to 3. Use 1 for single-zoned resources. For multi-zoned resources, the value must be less than or equal to the number of supported zones.")
                    .WithOptionalParameter("offset", LanguageConstants.Int, "The offset from the starting logical zone. The function returns an error if offset plus numberOfZones exceeds the number of supported zones.")
                    .Build();

                // TODO: Change 'Full' to literal type after verifying in the runtime source
                yield return new FunctionOverloadBuilder("reference")
                    .WithReturnType(LanguageConstants.Object)
                    .WithGenericDescription("Returns an object representing a resource's runtime state.")
                    .WithRequiredParameter("resourceNameOrIdentifier", LanguageConstants.String, "Name or unique identifier of a resource. When referencing a resource in the current template, provide only the resource name as a parameter. When referencing a previously deployed resource or when the name of the resource is ambiguous, provide the resource ID.")
                    .WithOptionalParameter("apiVersion", LanguageConstants.String, "API version of the specified resource. This parameter is required when the resource isn't provisioned within same template.")
                    .WithOptionalParameter("full", LanguageConstants.String, "Value that specifies whether to return the full resource object. If you don't specify 'Full', only the properties object of the resource is returned. The full object includes values such as the resource ID and location.")
                    .WithFlags(FunctionFlags.RequiresInlining)
                    .Build();

                // TODO: Doc parameters need an update
                yield return new FunctionWildcardOverloadBuilder("list*", AzConstants.ListWildcardFunctionRegex)
                    .WithReturnType(LanguageConstants.Any)
                    .WithGenericDescription("The syntax for this function varies by name of the list operations. Each implementation returns values for the resource type that supports a list operation. The operation name must start with list. Some common usages are `listKeys`, `listKeyValue`, and `listSecrets`.")
                    .WithRequiredParameter("resourceNameOrIdentifier", LanguageConstants.String, "Name or unique identifier of a resource. When referencing a resource in the current template, provide only the resource name as a parameter. When referencing a previously deployed resource or when the name of the resource is ambiguous, provide the resource ID.")
                    .WithRequiredParameter("apiVersion", LanguageConstants.String, "API version of resource runtime state. Typically, in the format, yyyy-mm-dd.")
                    .WithOptionalParameter("functionValues", LanguageConstants.Object, "An object that has values for the function. Only provide this object for functions that support receiving an object with parameter values, such as listAccountSas on a storage account. An example of passing function values is shown in this article.")
                    .WithFlags(FunctionFlags.RequiresInlining)
                    .Build();
            }