-
Notifications
You must be signed in to change notification settings - Fork 166
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
ArmResource illustration #5017
base: main
Are you sure you want to change the base?
ArmResource illustration #5017
Conversation
@@ -0,0 +1,156 @@ | |||
[ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file is printed from API getArmResources
. It takes all the tsp spec under the same folder as input.
|
||
/// <summary> Gets the data representing this Feature. </summary> | ||
/// <exception cref="InvalidOperationException"> Throws if there is no data loaded in the current instance. </exception> | ||
public virtual DataConnectorData Data |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
XXXResource
contains XXXData
as model and corresponding operations.
|
||
/// <summary> Gets the data representing this Feature. </summary> | ||
/// <exception cref="InvalidOperationException"> Throws if there is no data loaded in the current instance. </exception> | ||
public virtual SiteData Data |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SiteResource
contains the SiteData
as its resource model.
|
||
/// <summary> Gets the data representing this Feature. </summary> | ||
/// <exception cref="InvalidOperationException"> Throws if there is no data loaded in the current instance. </exception> | ||
public virtual SiteData Data |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SiteSlotResource
also contains SiteData
as its resource model.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so maybe we could rename this file to tspResources.json
to align with tspCodeModel
and the same prefix will let github to list the two files side by side
|
||
export async function $onEmit(context: EmitContext<AzureNetEmitterOptions>) { | ||
const program: Program = context.program; | ||
const options = resolveAzureEmitterOptions(context); | ||
/* set the loglevel. */ | ||
Logger.initialize(program, options.logLevel ?? LoggerLevel.INFO); | ||
|
||
const details = getArmResources(program); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe we could put this into our agenda and do it first, so that we could have the full codeModel available right here, and we do not have to emit another file, but we could emit an extra section in the tspCodeModel.json
Description:
This PR is to give an intuitive example to handle the problem in:
It contains:
getArmResources
. In this simple case, the output result is pretty much how .net understands resource.XXXCollection
,XXXData
,XXXResource
as below shows.For all of above, see the detailed comments in PR.