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

[Automated] Update API Surface Area #7811

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

github-actions[bot]
Copy link
Contributor

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.

@davidfowl davidfowl added the NO-MERGE The PR is not ready for merge yet (see discussion for detailed reasons) label Feb 28, 2025
@github-actions github-actions bot force-pushed the update-api-diffs branch 7 times, most recently from 55c8b26 to 4bcd5c4 Compare March 7, 2025 16:15
@github-actions github-actions bot added the needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners label Mar 10, 2025
@danmoseley danmoseley added area-engineering-systems infrastructure helix infra engineering repo stuff and removed needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners labels Mar 11, 2025
@github-actions github-actions bot force-pushed the update-api-diffs branch 5 times, most recently from afdfb7c to 7767997 Compare March 17, 2025 16:17
Comment on lines +59 to +73
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; } }
Copy link
Member

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) { }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ISet? @eerhardt

Copy link
Member

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.

Copy link
Member

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
Copy link
Member

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?

Copy link
Member

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?

Copy link
Member

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.

Comment on lines +493 to +499
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; }
Copy link
Member

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

Copy link
Member

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

Copy link
Member

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

Copy link
Member

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?

Copy link
Member

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 ;)

Copy link
Member

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 😄 .

Copy link
Member

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.

Copy link
Member

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?

Copy link
Member

@IEvangelist IEvangelist Mar 24, 2025

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.

Copy link
Member

@DamianEdwards DamianEdwards Mar 24, 2025

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

@radical
Copy link
Member

radical commented Mar 20, 2025

The tests are not getting triggered on this PR. I found https://github.com/orgs/community/discussions/55906#discussioncomment-5946239

.. and ..
When you use the repository's GITHUB_TOKEN to perform tasks, events triggered by the GITHUB_TOKEN, with the exception of workflow_dispatch and repository_dispatch, will not create a new workflow run.

We are indeed using the token.

- name: Create or update pull request
uses: dotnet/actions-create-pull-request@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
branch: update-api-diffs
base: main

Maybe we need this which suggests adding a permissions: pull-request: write to the GITHUB_TOKEN, which IIUC should be limited to that workflow.

@@ -120,6 +120,13 @@ public partial interface IAzureResource : IResource

namespace Aspire.Hosting.Azure
{
public partial class AppliedRoleAssignmentsAnnotation : ApplicationModel.IResourceAnnotation
Copy link
Member

@eerhardt eerhardt Mar 21, 2025

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

Copy link
Member

@mitchdenny mitchdenny Mar 23, 2025

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.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

EffectiveRoleAssignmentsAnnotation

Copy link
Member

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".

@davidfowl
Copy link
Member

The tests are not getting triggered on this PR. I found https://github.com/orgs/community/discussions/55906#discussioncomment-5946239

We don't want test triggered on this PR 😄

@github-actions github-actions bot force-pushed the update-api-diffs branch 2 times, most recently from 4bc4810 to 6eb4b15 Compare March 23, 2025 16:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-engineering-systems infrastructure helix infra engineering repo stuff NO-MERGE The PR is not ready for merge yet (see discussion for detailed reasons)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants