-
Notifications
You must be signed in to change notification settings - Fork 575
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
[Automated] Update API Surface Area #7811
base: main
Are you sure you want to change the base?
Conversation
55c8b26
to
4bcd5c4
Compare
afdfb7c
to
7767997
Compare
7767997
to
01dd76c
Compare
public BicepOutputReference ContainerAppDomain { get { throw null; } } | ||
|
||
public BicepOutputReference ContainerAppEnvironmentId { get { throw null; } } | ||
|
||
public BicepOutputReference ContainerAppEnvironmentName { get { throw null; } } | ||
|
||
public BicepOutputReference ContainerRegistryManagedIdentityId { get { throw null; } } | ||
|
||
public BicepOutputReference ContainerRegistryUrl { get { throw null; } } | ||
|
||
public BicepOutputReference LogAnalyticsWorkspaceId { get { throw null; } } | ||
|
||
public BicepOutputReference ManagedIdentityId { get { throw null; } } | ||
|
||
public BicepOutputReference PrincipalName { get { throw null; } } |
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.
I don't think these should be exposed.
@@ -120,6 +120,13 @@ public partial interface IAzureResource : IResource | |||
|
|||
namespace Aspire.Hosting.Azure | |||
{ | |||
public partial class AppliedRoleAssignmentsAnnotation : ApplicationModel.IResourceAnnotation | |||
{ | |||
public AppliedRoleAssignmentsAnnotation(System.Collections.Generic.HashSet<RoleDefinition> roles) { } |
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.
ISet? @eerhardt
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.
I wanted someone else's eyes on how I'm exposing these collections across these new annotations. Here's what we have today:
class AppliedRoleAssignmentsAnnotation
HashSet<RoleDefinition> Roles
class RoleAssignmentAnnotation
IReadOnlySet<RoleDefinition> Roles
class DefaultRoleAssignmentsAnnotation
IReadOnlySet<RoleDefinition> Roles
The reason I made AppliedRoleAssignmentsAnnotation
mutable is because we loop over the RoleAssignmentAnnotations and add them into the singular AppliedRoleAssignmentsAnnotation
. That allows for simplier code in the resources - they only need to get 1 AppliedRoleAssignmentsAnnotation and not loop over them all. The other 2 feel more like read only is appropriate.
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 ones need more explanation. I think I understand the second and third bullet, what is AppliedRoleAssignmentsAnnotation?
@@ -697,6 +796,13 @@ public ContainerRuntimeArgsCallbackContext(System.Collections.Generic.IList<obje | |||
public System.Threading.CancellationToken CancellationToken { get { throw null; } } | |||
} | |||
|
|||
public sealed partial class CreationScriptAnnotation : IResourceAnnotation |
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.
@sebastienros Why is this in Aspire.Hosting?
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 can be used by any resource. Other option is to duplicate it in each database integration that needs it. Third option?
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.
Duplicate it in each database resource. Probably with a unique name.
public static ApplicationModel.IResourceBuilder<TResource> WithHttpCommand<TResource>(this ApplicationModel.IResourceBuilder<TResource> builder, string path, string displayName, System.Func<ApplicationModel.EndpointReference>? endpointSelector, System.Net.Http.HttpMethod? method = null, string? httpClientName = null, System.Func<ApplicationModel.HttpCommandRequestContext, System.Threading.Tasks.Task>? configureRequest = null, System.Func<ApplicationModel.HttpCommandResultContext, System.Threading.Tasks.Task<ApplicationModel.ExecuteCommandResult>>? getCommandResult = null, string? commandName = null, System.Func<ApplicationModel.UpdateCommandStateContext, ApplicationModel.ResourceCommandState>? updateState = null, string? displayDescription = null, string? confirmationMessage = null, string? iconName = null, ApplicationModel.IconVariant? iconVariant = null, bool isHighlighted = false) | ||
where TResource : ApplicationModel.IResourceWithEndpoints { throw null; } | ||
|
||
public static ApplicationModel.IResourceBuilder<TResource> WithHttpCommand<TResource>(this ApplicationModel.IResourceBuilder<TResource> builder, string path, string displayName, string? endpointName = null, System.Net.Http.HttpMethod? method = null, string? httpClientName = null, System.Func<ApplicationModel.HttpCommandRequestContext, System.Threading.Tasks.Task>? configureRequest = null, System.Func<ApplicationModel.HttpCommandResultContext, System.Threading.Tasks.Task<ApplicationModel.ExecuteCommandResult>>? getCommandResult = null, string? commandName = null, System.Func<ApplicationModel.UpdateCommandStateContext, ApplicationModel.ResourceCommandState>? updateState = null, string? displayDescription = null, string? confirmationMessage = null, string? iconName = null, ApplicationModel.IconVariant? iconVariant = null, bool isHighlighted = false) | ||
where TResource : ApplicationModel.IResourceWithEndpoints { throw null; } |
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.
I'm of the opinion that these APIs (both WithHttpCommand
overloads) have way too many parameters. It might be cleaner to encapsulate (or logically group) some of these parameters into a specific DashboardOptions
object, or parameter object that group things together to help reduce the number of parameters. @davidfowl
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.
Agree, this looks a little crazy from a versioning POV. We had this problem with WithEndpoint
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.
@DamianEdwards can you do the needful
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.
These expose the same parameters that the WithCommand
methods do, plus the few extra specific to HTTP commands. I'm really not sure any other approach is better. Having this API take a new options object that isn't supported by WithCommand
doesn't seem to make much sense. Are we thinking we introduce a new type like CommandOptions
and use it for both WithCommand
and WithHttpCommand
, and mark the overloads of WithCommand
that don't take it obsolete?
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 seems like a lesson that we need to keep learning ;)
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.
Yes, optional parameters at this scale are extremely hard to version. WithEndpoint is in the exact same jail 😄 .
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.
I’d be very happy if we stage a jailbreak on WithEndpoint in 10.0 so we can do proxyless persistent containers by default.
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 what's the consensus for 9.2? Change WithCommand
and WithHttpCommand
to use a new CommandOptions
parameter and obsolete the existing WithCommand
overload with all the optional parameters?
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.
I'd vote yes, move forward with CommandOptions
parameter and obsolete the existing, but that's just me. Also, I found a bug related to this API when testing it: #8270.
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.
Change is in PR #8276
01dd76c
to
0925d80
Compare
The tests are not getting triggered on this PR. I found https://github.com/orgs/community/discussions/55906#discussioncomment-5946239 .. and .. We are indeed using the token. aspire/.github/workflows/generate-api-diffs.yml Lines 27 to 32 in 58cb944
Maybe we need this which suggests adding a |
0925d80
to
2487e0a
Compare
@@ -120,6 +120,13 @@ public partial interface IAzureResource : IResource | |||
|
|||
namespace Aspire.Hosting.Azure | |||
{ | |||
public partial class AppliedRoleAssignmentsAnnotation : ApplicationModel.IResourceAnnotation |
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.
Does anyone have good options for the name of this annotation? I used this one to start, but I'm not excited about the name.
/// <summary> | |
/// Represents the role assignments that have been applied to an Azure resource | |
/// and should be included in its Bicep template. These role assignments will grant the | |
/// <see cref="AzureBicepResource.KnownParameters.PrincipalId"/> permissions to the Azure resource. | |
/// </summary> | |
/// <param name="roles">The roles to generate in the resource's Bicep template.</param> | |
/// <remarks> | |
/// <see cref="AppliedRoleAssignmentsAnnotation"/> are used when the entire application utilizes a single managed identity. | |
/// For instance, during local development provisioning, all resources will use the same managed identity, | |
/// which is the currently logged-in developer. | |
/// | |
/// When using provisioning infrastructure that supports targeted role assignments (e.g., AddAzureContainerAppsInfrastructure), | |
/// <see cref="AppliedRoleAssignmentsAnnotation"/> are not used. | |
/// </remarks> | |
public class AppliedRoleAssignmentsAnnotation(HashSet<RoleDefinition> roles) : IResourceAnnotation |
Other options I've thought of (or copilot suggested that I thought were interesting):
- EmbeddedRoleAssignmentsAnnoation
- IncludedRoleAssignmentsAnnoation
- InlineRoleAssignmentsAnnotation
- RoleAssignmentsInBicepAnnotation
- RoleAssignmentsInMainBicepAnnotation
- ColocatedRoleAssignmentsAnnotation
cc @captainsafia @davidfowl @sebastienros @mitchdenny @ReubenBond
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.
Why not RoleAssignmentsAnnotation
. Might be missing something.
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.
EffectiveRoleAssignmentsAnnotation
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.
EffectiveRoleAssignmentsAnnotation
I'm not sure this is a good name because the role assignments that are external to the resource's bicep are also "effective".
2487e0a
to
a6fe802
Compare
We don't want test triggered on this PR 😄 |
4bc4810
to
6eb4b15
Compare
6eb4b15
to
5a18408
Compare
Auto-generated update to the API surface to compare current surface vs latest release. This should only be merged once this surface area ships in a new release.