Skip to content

Commit

Permalink
Parent Decoration (#1117)
Browse files Browse the repository at this point in the history
* Mnash 5154 skeleton operations (#1011)

* create shell resource operations objects

* added trailing newline

* Revert "added trailing newline"

This reverts commit a24d17d.

* update launch settings to add a compute option vs modifying

* updates after adding dummy constructor

* updates after merge

* updates to generated code

* address pr comments

* update after redoing npm install

* update launchsettings

* update samples list

* revert unintended change

* update ordering for launch settings

* add resource container shell to mgmt generation (#1025)

* add resource container shell to mgmt generation

* Address review comments

* Renaming Azure.ResourceManager.Compute to Azure.ResourceManager.Sample (#1034)

* Update code to support adding and parsing provider name (#1032)

* WIP: Update code for provider name

* Add operationsGroupMappings example

* Only Write out if has field

* WIP: update operations config


* Update readme

* Wip: update compute


* WIP: off by one

* Remove Synapse

* Remove more tests

* Remove all mgmt test

* Update OutputLibrary.cs

* remove imds for now

* Update Operations

* Tenant id (#1037)

* WIP: tenant id

* WIP: rebase

* Rebase

* WIP

* WIP: tenant deco

* NIT

* NIT

* WIP: Update

* NIT newline

* Updates

* WIP: updates

* Updates

* NIT

* Enable OperationGroup get associated resource name from one property (#1049)

* WIP: update (#1052)

* WIP: update

* Updates

* Fix bad merge

* White space

* Update config

* Mergev3tomgmt (#1062)

* Generate public client constructors and options (#1046)

Generate public client constructors and options

* Make client options class partial (#1055)

* Disable buffering for stream responses (#1060)

* updates after merge

* duplicate end file

* regen after merge

Co-authored-by: ShivangiReja <45216704+ShivangiReja@users.noreply.github.com>
Co-authored-by: Pavel Krymets <pavel@krymets.com>

* merge feature/v3 into feature/mgmt-track2 (#1072)

* Generate public client constructors and options (#1046)

Generate public client constructors and options

* Make client options class partial (#1055)

* Disable buffering for stream responses (#1060)

* Add Url Encoded Body support (#1042)

- Fixes: #986

* Fix LRO create request from relative path on Unix (#1059)

* Remove automated buffering logic (#1064)

* Add System.Text.Json converter to models (#1063)

Fixes: #947

* Fix feature/v3 integration with azure-sdk-for-net (#1065)

- Autorest core 3.0.6372 and above crash due to directive ordering bug Tim is digging into now
- New shared code does not compile cleanly with azure-sdk-for-net rules

* Hide paging classes (#1066)

* Add help content (#1067)

* Add help content

* update after merge

Co-authored-by: ShivangiReja <45216704+ShivangiReja@users.noreply.github.com>
Co-authored-by: Pavel Krymets <pavel@krymets.com>
Co-authored-by: Chris Hamons <chris.hamons@microsoft.com>
Co-authored-by: pavelprystinka <30868871+pavelprystinka@users.noreply.github.com>
Co-authored-by: Timothee Guerin <tiguerin@microsoft.com>

* Support generating empty data and data serialization file (#1074)

* Add compute to test projects

* Support generating empty [Resource]Data.cs and [Resource]Data.Serialization.cs

* Upload compute codegen result

* Remove codegen result

* Resolve merge conflicts

* Resolve reference errors

* Refactor code

* Regenerate Azure.ResourceManager.Sample

* Regenerate Azure.Management.Storage

* Update all other codegen files when running Generate.ps1

* Re-run Generate.ps1

* Remove the stale compute project

* Decorate schema

* Change ResourceData to inherit from ObjectType

* Regenerate Azure.Management.Storage

* Regenerate Azure.ResourceManager.Sample

* Correct the Resource name in [Resource]Container.cs and [Resource]Operation.cs

* Regenerate Azure.Management.Storage

* Regenerate Azure.ResourceManager.Sample

* Cleanup comments

* Re-run Generate.ps1

* Address review comments

* Run Generate.ps1

* regen

* add files

Co-authored-by: YalinLi0312 <yall@microsoft.com>

* [Mgmt Track 2] 5156 generate empty resource autorest change (#1076)

* Empty Resource Code Change

* CI fix

* Empty Resource Sample Update

* Rename arm to mgmt as ARM is ingored

* Updating storage sample

* Updated resource to be in the Generated folder

* Updates after merge

* regenerate with feature/v3 changes

* WIP: First cust parent algo

* Update OutputLibrary.cs

* WIP

* WIP:

* WIP

* WIP

* WIP

* WIP: Updates

* WIP

* WIP:

* WIP

* WIP

* WIP

* WIP

* WIP: update configs

* WIP: update test

* WIP

* Update [Resource]Data to inherit the exact matching base class (#1095)

* Add Azure.ResourceManager.Core to package reference group

* Override inheritance in [Resource]Data

* Regenerate Azure.Resourcemanager.Sample

* Regenerate Azure.Management.Storage

* Update Azure.Core and Azure.ResourceManager.Core version

* Rebuild model inheritance

* Correct the properties to generate

* Update ResourceDataWriter and its serialization writer

* Regenerate Azure.ResourceManager.Sample

* Update Azure.resourceManager.Core version

* Regenerate Azure.Management.Storage

* Run Generate.ps1

* Address review comments

* Run Generate.ps1

* initial changes to compile

* finish merge

* initial mgmt fork

* Updates test

* more changes to mgmt fork

* updates after merge

* remove unnecessary Arm configuration checks

* missed a merge conflict to enable the inheritance code

* auto-generate after merge and changes

* address review comments

* Updates

* Update

* WIP

* Merge

* Update

* Updates

* Updates

* Update DataPlaneResponseHeaderGroupWriter.cs

* Update DataPlaneLongRunningOperationWriter.cs

* Update DataPlaneLongRunningOperationMethod.cs

* address review comments

* add resource rename test

Co-authored-by: m-nash <64171366+m-nash@users.noreply.github.com>
Co-authored-by: Allen Zhang <allenzhang@live.com>
Co-authored-by: Yalin Li <yall@microsoft.com>
Co-authored-by: ShivangiReja <45216704+ShivangiReja@users.noreply.github.com>
Co-authored-by: Pavel Krymets <pavel@krymets.com>
Co-authored-by: Chris Hamons <chris.hamons@microsoft.com>
Co-authored-by: pavelprystinka <30868871+pavelprystinka@users.noreply.github.com>
Co-authored-by: Timothee Guerin <tiguerin@microsoft.com>
Co-authored-by: m-nash <prognash@microsoft.com>
  • Loading branch information
10 people authored Apr 6, 2021
1 parent 2bdfde4 commit 4060722
Show file tree
Hide file tree
Showing 131 changed files with 7,475 additions and 71 deletions.
2 changes: 1 addition & 1 deletion samples/AppConfiguration/Generated/Configuration.json

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

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

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

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

5 changes: 5 additions & 0 deletions samples/Azure.Management.Storage/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,10 @@ operation-group-to-resource:
resource-rename:
BlobServiceProperties: BlobService
FileServiceProperties: FileService
operation-group-to-parent:
BlobContainers: Microsoft.Storage/storageAccounts
FileShares: Microsoft.Storage/storageAccounts
Usages: subscriptions
StorageAccounts: any
```

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

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

5 changes: 5 additions & 0 deletions samples/Azure.ResourceManager.Sample/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ resource-rename:
SshPublicKey : SshPublicKeyInfo
LogAnalyticsOperationResult: LogAnalytics
SshPublicKeyResource: SshPublicKey
operation-group-to-parent:
LogAnalytics: subscriptions
VirtualMachineExtensionImages: Microsoft.Compute/locations/publishers
VirtualMachineImages: Microsoft.Compute/locations
VirtualMachineScaleSetVMExtensions: Microsoft.Compute/virtualMachineScaleSets
modelerfour:
lenient-model-deduplication: true
```
2 changes: 1 addition & 1 deletion samples/Azure.Storage.Tables/Generated/Configuration.json

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

2 changes: 1 addition & 1 deletion samples/CognitiveSearch/Generated/Configuration.json

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

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 @@ -95,6 +95,13 @@ internal static string SaveConfiguration(Configuration configuration)
}
writer.WriteEndObject();

writer.WriteStartObject(nameof(Configuration.OperationGroupToParent));
foreach (var keyval in configuration.OperationGroupToParent)
{
writer.WriteString(keyval.Key, keyval.Value);
}
writer.WriteEndObject();

writer.WriteEndObject();
}

Expand All @@ -107,7 +114,7 @@ private static string NormalizePath(Configuration configuration, string sharedSo
return Path.GetRelativePath(configuration.OutputFolder, sharedSourceFolder);
}

private static Configuration LoadConfiguration(string basePath, string json)
internal static Configuration LoadConfiguration(string basePath, string json)
{
JsonDocument document = JsonDocument.Parse(json);
var root = document.RootElement;
Expand Down Expand Up @@ -147,7 +154,8 @@ private static Configuration LoadConfiguration(string basePath, string json)
root.GetProperty(nameof(Configuration.LowLevelClient)).GetBoolean(),
root.GetProperty(nameof(Configuration.OperationGroupToResourceType)),
root.GetProperty(nameof(Configuration.OperationGroupToResource)),
root.GetProperty(nameof(Configuration.ResourceRename))
root.GetProperty(nameof(Configuration.ResourceRename)),
root.GetProperty(nameof(Configuration.OperationGroupToParent))
);
}
}
Expand Down
7 changes: 5 additions & 2 deletions src/AutoRest.CSharp/Common/AutoRest/Plugins/Configuration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ namespace AutoRest.CSharp.AutoRest.Plugins
{
internal class Configuration
{
public Configuration(string outputFolder, string? ns, string? name, string[] sharedSourceFolders, bool saveInputs, bool azureArm, bool publicClients, bool modelNamespace, bool headAsBoolean, bool skipCSProjPackageReference, string[] credentialTypes, string[] credentialScopes, string credentialHeaderName, bool lowLevelClient, JsonElement? operationGroupToResourceType = default, JsonElement? operationGroupToResource = default, JsonElement? resourceRename = default)
public Configuration(string outputFolder, string? ns, string? name, string[] sharedSourceFolders, bool saveInputs, bool azureArm, bool publicClients, bool modelNamespace, bool headAsBoolean, bool skipCSProjPackageReference, string[] credentialTypes, string[] credentialScopes, string credentialHeaderName, bool lowLevelClient, JsonElement? operationGroupToResourceType = default, JsonElement? operationGroupToResource = default, JsonElement? resourceRename = default, JsonElement? operationGroupToParent = default)
{
OutputFolder = outputFolder;
Namespace = ns;
Expand All @@ -31,6 +31,7 @@ public Configuration(string outputFolder, string? ns, string? name, string[] sha
OperationGroupToResourceType = operationGroupToResourceType?.ValueKind == JsonValueKind.Null ? new Dictionary<string, string>() : JsonSerializer.Deserialize<Dictionary<string, string>>(operationGroupToResourceType.ToString());
OperationGroupToResource = operationGroupToResource?.ValueKind == JsonValueKind.Null ? new Dictionary<string, string>() : JsonSerializer.Deserialize<Dictionary<string, string>>(operationGroupToResource.ToString());
ResourceRename = resourceRename?.ValueKind == JsonValueKind.Null ? new Dictionary<string, string>() : JsonSerializer.Deserialize<Dictionary<string, string>>(resourceRename.ToString());
OperationGroupToParent = operationGroupToParent?.ValueKind == JsonValueKind.Null ? new Dictionary<string, string>() : JsonSerializer.Deserialize<Dictionary<string, string>>(operationGroupToParent.ToString());
}

public string OutputFolder { get; }
Expand All @@ -52,6 +53,7 @@ public Configuration(string outputFolder, string? ns, string? name, string[] sha
public IReadOnlyDictionary<string, string> OperationGroupToResource { get; }
public IReadOnlyDictionary<string, string> ResourceRename { get; }
public bool LowLevelClient { get; }
public IReadOnlyDictionary<string, string> OperationGroupToParent { get; }

public static Configuration GetConfiguration(IPluginCommunication autoRest)
{
Expand All @@ -72,7 +74,8 @@ public static Configuration GetConfiguration(IPluginCommunication autoRest)
autoRest.GetValue<bool?>("low-level-client").GetAwaiter().GetResult() ?? false,
autoRest.GetValue<JsonElement?>("operation-group-to-resource-type").GetAwaiter().GetResult(),
autoRest.GetValue<JsonElement?>("operation-group-to-resource").GetAwaiter().GetResult(),
autoRest.GetValue<JsonElement?>("resource-rename").GetAwaiter().GetResult()
autoRest.GetValue<JsonElement?>("resource-rename").GetAwaiter().GetResult(),
autoRest.GetValue<JsonElement?>("operation-group-to-parent").GetAwaiter().GetResult()
);
}

Expand Down
Loading

0 comments on commit 4060722

Please sign in to comment.