Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Naming data plane #1739

Merged
merged 5 commits into from
Dec 10, 2021
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/protocol_method_client.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ However a handful of configuration changes are needed to get started.
2. Add the following key to the readme.md or autorest.md configuration file:

```yaml
low-level-client: true
data-plane: true
```

3. Define the authentication in configuration
Expand Down
2 changes: 1 addition & 1 deletion eng/Generate.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ if (!($Exclude -contains "TestServer"))
}
}

$llcArgs = "--low-level-client=true --security=AzureKey --security-header-name=Fake-Subscription-Key"
$llcArgs = "--data-plane=true --security=AzureKey --security-header-name=Fake-Subscription-Key"

$testServerLowLevelDirectory = Join-Path $repoRoot 'test' 'TestServerProjectsLowLevel'
$testNamesLowLevel =
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion samples/Azure.AI.DocumentTranslation/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ title: Azure.AI.DocumentTranslation
require: $(this-folder)/../../readme.md
input-file: https://github.com/Azure/azure-rest-api-specs/blob/3196a62202976da192d6da86f44b02246ca2aa97/specification/cognitiveservices/data-plane/TranslatorText/preview/v1.0-preview.1/TranslatorBatch.json
namespace: Azure.AI.DocumentTranslation
low-level-client: true
data-plane: true
security: AzureKey
security-header-name: Ocp-Apim-Subscription-Key
```

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion samples/Azure.Analytics.Purview.Account/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ title: PurviewAccount
require: $(this-folder)/../../readme.md
input-file: https://github.com/Azure/azure-rest-api-specs/blob/b2bddfe2e59b5b14e559e0433b6e6d057bcff95d/specification/purview/data-plane/Azure.Analytics.Purview.Account/preview/2019-11-01-preview/account.json
namespace: Azure.Analytics.Purview.Account
low-level-client: true
data-plane: true
security: AADToken
security-scopes: https://purview.azure.net/.default
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ internal static string SaveConfiguration(Configuration configuration)
WriteIfNotDefault(writer, Configuration.Options.ModelNamespace, configuration.ModelNamespace);
WriteIfNotDefault(writer, Configuration.Options.HeadAsBoolean, configuration.HeadAsBoolean);
WriteIfNotDefault(writer, Configuration.Options.SkipCSProjPackageReference, configuration.SkipCSProjPackageReference);
WriteIfNotDefault(writer, Configuration.Options.LowLevelClient, configuration.LowLevelClient);
WriteIfNotDefault(writer, Configuration.Options.DataPlane, configuration.DataPlane);
WriteIfNotDefault(writer, Configuration.Options.SingleTopLevelClient, configuration.SingleTopLevelClient);

configuration.MgmtConfiguration.SaveConfiguration(writer);
Expand Down Expand Up @@ -120,7 +120,7 @@ internal static Configuration LoadConfiguration(string basePath, string json)
ReadOption(root, Configuration.Options.ModelNamespace),
ReadOption(root, Configuration.Options.HeadAsBoolean),
ReadOption(root, Configuration.Options.SkipCSProjPackageReference),
ReadOption(root, Configuration.Options.LowLevelClient),
ReadOption(root, Configuration.Options.DataPlane),
ReadOption(root, Configuration.Options.SingleTopLevelClient),
MgmtConfiguration.LoadConfiguration(root)
);
Expand Down
6 changes: 3 additions & 3 deletions src/AutoRest.CSharp/Common/AutoRest/Plugins/CSharpGen.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public async Task<GeneratedCodeWorkspace> ExecuteAsync(Task<CodeModel> codeModel

var codeModel = await codeModelTask;

if (configuration.LowLevelClient)
if (configuration.DataPlane)
{
LowLevelTarget.Execute(project, codeModel, sourceInputModel, configuration);
}
Expand All @@ -58,9 +58,9 @@ public async Task<GeneratedCodeWorkspace> ExecuteAsync(Task<CodeModel> codeModel

private static void ValidateConfiguration (Configuration configuration)
{
if (configuration.LowLevelClient && configuration.AzureArm)
if (configuration.DataPlane && configuration.AzureArm)
{
throw new Exception("Enabling both 'low-level-client' and 'azure-arm' at the same time is not supported.");
throw new Exception("Enabling both 'data-plane' and 'azure-arm' at the same time is not supported.");
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/AutoRest.CSharp/Common/AutoRest/Plugins/CSharpProj.cs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public async Task<bool> Execute(IPluginCommunication autoRest)
{
additionalContent += _armCsProjContent;
}
if (configuration.LowLevelClient)
if (configuration.DataPlane)
{
additionalContent += _llcProjectContent;
}
Expand Down
12 changes: 6 additions & 6 deletions src/AutoRest.CSharp/Common/AutoRest/Plugins/Configuration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ public static class Options
public const string ModelNamespace = "model-namespace";
public const string HeadAsBoolean = "head-as-boolean";
public const string SkipCSProjPackageReference = "skip-csproj-packagereference";
public const string LowLevelClient = "low-level-client";
public const string DataPlane = "data-plane";
public const string SingleTopLevelClient = "single-top-level-client";
public const string AttachDebuggerFormat = "{0}.attach";
}

public Configuration(string outputFolder, string? ns, string? name, string[] sharedSourceFolders, bool saveInputs, bool azureArm, bool publicClients, bool modelNamespace, bool headAsBoolean, bool skipCSProjPackageReference, bool lowLevelClient, bool singleTopLevelClient, MgmtConfiguration mgmtConfiguration)
public Configuration(string outputFolder, string? ns, string? name, string[] sharedSourceFolders, bool saveInputs, bool azureArm, bool publicClients, bool modelNamespace, bool headAsBoolean, bool skipCSProjPackageReference, bool dataplane, bool singleTopLevelClient, MgmtConfiguration mgmtConfiguration)
{
OutputFolder = outputFolder;
Namespace = ns;
Expand All @@ -40,7 +40,7 @@ public Configuration(string outputFolder, string? ns, string? name, string[] sha
ModelNamespace = azureArm || modelNamespace;
HeadAsBoolean = headAsBoolean;
SkipCSProjPackageReference = skipCSProjPackageReference;
LowLevelClient = lowLevelClient;
DataPlane = dataplane;
SingleTopLevelClient = singleTopLevelClient;
MgmtConfiguration = mgmtConfiguration;
}
Expand All @@ -55,7 +55,7 @@ public Configuration(string outputFolder, string? ns, string? name, string[] sha
public bool ModelNamespace { get; }
public bool HeadAsBoolean { get; }
public bool SkipCSProjPackageReference { get; }
public bool LowLevelClient { get; }
public bool DataPlane { get; }
public bool SingleTopLevelClient { get; }
public MgmtConfiguration MgmtConfiguration { get; }

Expand All @@ -72,7 +72,7 @@ public static Configuration GetConfiguration(IPluginCommunication autoRest)
modelNamespace: GetOptionValue(autoRest, Options.ModelNamespace),
headAsBoolean: GetOptionValue(autoRest, Options.HeadAsBoolean),
skipCSProjPackageReference: GetOptionValue(autoRest, Options.SkipCSProjPackageReference),
lowLevelClient: GetOptionValue(autoRest, Options.LowLevelClient),
dataplane: GetOptionValue(autoRest, Options.DataPlane),
singleTopLevelClient: GetOptionValue(autoRest, Options.SingleTopLevelClient),
mgmtConfiguration: MgmtConfiguration.GetConfiguration(autoRest)
);
Expand All @@ -99,7 +99,7 @@ private static bool GetOptionValue(IPluginCommunication autoRest, string option)
return false;
case Options.SkipCSProjPackageReference:
return false;
case Options.LowLevelClient:
case Options.DataPlane:
return false;
case Options.SingleTopLevelClient:
return false;
Expand Down
10 changes: 5 additions & 5 deletions src/AutoRest.CSharp/Common/Output/Models/RestClientBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ private RequestHeader[] BuildHeaders(IList<RequestParameter> requestParameters,
if (requestParameter.In == ParameterLocation.Header)
{
/* skip raw condition header if collapsed already. */
if (_context.Configuration.LowLevelClient)
if (_context.Configuration.DataPlane)
{
if ((collapseType == RequestConditionCollapseType.MatchConditionsCollapse && requestParameter.IsMatchConditionHeader()) ||
(collapseType == RequestConditionCollapseType.RequestConditionsCollapse && requestParameter.IsRequestConditionHeader()))
Expand All @@ -275,7 +275,7 @@ private RequestHeader[] BuildHeaders(IList<RequestParameter> requestParameters,
}
}

if (_context.Configuration.LowLevelClient)
if (_context.Configuration.DataPlane)
{
RequestConditionsHeader? collapseConditions = null;
if (collapseType != RequestConditionCollapseType.None)
Expand Down Expand Up @@ -355,7 +355,7 @@ private Parameter[] BuildMethodParameters(IList<RequestParameter> parameters, Di
List<Parameter> methodParameters = new();
foreach (var requestParameter in parameters)
{
if (_context.Configuration.LowLevelClient)
if (_context.Configuration.DataPlane)
{
if ((collapseType == RequestConditionCollapseType.MatchConditionsCollapse && requestParameter.IsMatchConditionHeader()) ||
(collapseType == RequestConditionCollapseType.RequestConditionsCollapse && requestParameter.IsRequestConditionHeader()))
Expand All @@ -371,7 +371,7 @@ private Parameter[] BuildMethodParameters(IList<RequestParameter> parameters, Di
methodParameters.Add(parameter);
}
}
if (_context.Configuration.LowLevelClient)
if (_context.Configuration.DataPlane)
{
Parameter? collapseConditionParameter = BuildMethodRequestConditionParameter(parameters, collapseType);
if (collapseConditionParameter != null)
Expand Down Expand Up @@ -679,7 +679,7 @@ private Parameter BuildParameter(RequestParameter requestParameter)
var isRequired = requestParameter.Required == true;
var defaultValue = ParseConstant(requestParameter);

if (_context.Configuration.LowLevelClient && requestParameter.IsMatchConditionHeader())
if (_context.Configuration.DataPlane && requestParameter.IsMatchConditionHeader())
{
type = typeof(Azure.ETag);
type = type.WithNullable(requestParameter.IsNullable || !requestParameter.IsRequired);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ internal class BuildContext<T> : BuildContext where T : OutputLibrary

public BuildContext(CodeModel codeModel, Configuration configuration, SourceInputModel? sourceInputModel) : base(codeModel, configuration, sourceInputModel)
{
if (configuration.LowLevelClient)
if (configuration.DataPlane)
{
Library = (T)(object)new LowLevelOutputLibrary(codeModel, (BuildContext<LowLevelOutputLibrary>)(object)this);
}
Expand Down
2 changes: 1 addition & 1 deletion src/AutoRest.CSharp/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ output-scope:
shared-source-folders: $(this-folder)/Generator.Shared;$(this-folder)/Azure.Core.Shared
```

```yaml !$(low-level-client)
```yaml !$(data-plane)
modelerfour:
flatten-models: true
flatten-payloads: true
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion test/TestProjects/Accessibility-LowLevel-NoAuth/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
```yaml
require: $(this-folder)/../../../readme.md
input-file: $(this-folder)/../Accessibility-LowLevel/Accessibility-LowLevel.json
low-level-client: true
data-plane: true
```

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
```yaml
require: $(this-folder)/../../../readme.md
input-file: $(this-folder)/../Accessibility-LowLevel/Accessibility-LowLevel.json
low-level-client: true
data-plane: true
security: AADToken
security-header-name: Your-Subscription-Key
security-scopes: https://test.azure.com/.default
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion test/TestProjects/Accessibility-LowLevel/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
```yaml
require: $(this-folder)/../../../readme.md
input-file: $(this-folder)\Accessibility-LowLevel.json
low-level-client: true
data-plane: true
security: AzureKey
security-header-name: Fake-Subscription-Key
```

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion test/TestProjects/BodyAndPath-LowLevel/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
``` yaml
require: $(this-folder)/../../../readme.md
input-file: $(this-folder)/BodyAndPath-LowLevel.json
low-level-client: true
data-plane: true
security: AzureKey
security-header-name: Fake-Subscription-Key
```

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
```yaml
require: $(this-folder)/../../../readme.md
input-file: $(this-folder)\CollapseRequestCondition-LowLevel.json
low-level-client: true
data-plane: true
security: AzureKey
security-header-name: Fake-Subscription-Key
```

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion test/TestProjects/HeadAsBooleanTrue-LowLevel/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ title: HeadAsBooleanTrue
require: $(this-folder)/../../../readme.md
input-file: https://github.com/Azure/autorest.testserver/blob/master/swagger/head.json
namespace: Azure.HeadAsBooleanTrue
low-level-client: true
data-plane: true
security: AzureKey
security-header-name: Fake-Subscription-Key
head-as-boolean: true
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ title: RequestContextAllOptional
require: $(this-folder)/../../../readme.md
input-file: $(this-folder)/RequestContextAllOptional.json
namespace: Azure.RequestContextAllOptional
low-level-client: true
data-plane: true
security: AzureKey
security-header-name: Fake-Subscription-Key
```

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
```yaml
require: $(this-folder)/../../../readme.md
input-file: $(this-folder)/SingleTopLevelClientWithOperations.json
low-level-client: true
data-plane: true
security: AzureKey
security-header-name: Fake-Subscription-Key
single-top-level-client: true
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
```yaml
require: $(this-folder)/../../../readme.md
input-file: $(this-folder)/SingleTopLevelClientWithoutOperations.json
low-level-client: true
data-plane: true
single-top-level-client: true
security: AzureKey
security-header-name: Fake-Subscription-Key
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion test/TestProjects/SubClients-LowLevel/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
``` yaml
require: $(this-folder)/../../../readme.md
input-file: $(this-folder)/SubClients-LowLevel.json
low-level-client: true
data-plane: true
security: AzureKey
security-header-name: Fake-Subscription-Key
```

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading