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

Update documentdb 20240815, add MongodbUserDefinition #4550

Merged

Conversation

petrepopescu21
Copy link
Contributor

@petrepopescu21 petrepopescu21 commented Jan 30, 2025

What this PR does

  • Adds support for DocumentDB apiVersion 2024-08-15
  • Adds MongodbUserDefinition
  • Adds MongodbRoleDefinition bug encountered, see comments
  • Adds support for MongoDB 5.0, 6.0 and 7.0

The currently supported version 4.2 has been EOL for a while now.

How does this PR make you feel?

gif

Checklist

  • this PR contains documentation
  • this PR contains tests
  • this PR contains YAML Samples

@petrepopescu21
Copy link
Contributor Author

petrepopescu21 commented Feb 1, 2025

I'm having trouble with making the MongodbRoleDefinition work. While the status struct is generated correctly:

type MongodbRoleDefinition_STATUS struct {
	Conditions     []conditions.Condition `json:"conditions,omitempty"`
	DatabaseName   *string                `json:"databaseName,omitempty"`
	Id             *string                `json:"id,omitempty"`
	Name           *string                `json:"name,omitempty"`
	Privileges     []Privilege_STATUS     `json:"privileges,omitempty"`
	PropertiesType *string                `json:"properties_type,omitempty"`
	PropertyBag    genruntime.PropertyBag `json:"$propertyBag,omitempty"`
	RoleName       *string                `json:"roleName,omitempty"`
	Roles          []Role_STATUS          `json:"roles,omitempty"`
	Type           *string                `json:"type,omitempty"`
}

when reading a resource using Azure CLI I get an integer instead of a string for the PropertiesType field:

az resource show --ids /subscriptions/3e8e8f8d-5388-41dd-8cb1-6dd1d418fe76/resourceGroups/asotest-rg-bmupee/providers/Microsoft.DocumentDB/databaseAccounts/asotestdbkgsgso/mongodbRoleDefinitions/asotest-mongo-hamilo.dboperator
{
  "extendedLocation": null,
  "id": "/subscriptions/3e8e8f8d-5388-41dd-8cb1-6dd1d418fe76/resourceGroups/asotest-rg-bmupee/providers/Microsoft.DocumentDB/databaseAccounts/asotestdbkgsgso/mongodbRoleDefinitions/asotest-mongo-hamilo.dboperator",
  "identity": null,
  "kind": null,
  "location": null,
  "managedBy": null,
  "name": "dboperator",
  "plan": null,
  "properties": {
    "databaseName": "asotest-mongo-hamilo",
    "privileges": [
      {
        "actions": [
          "dbStats"
        ],
        "resource": {
          "db": "asotest-mongo-hamilo"
        }
      }
    ],
    "roleName": "dboperator",
    "roles": [],
    "type": 1
  },
  "resourceGroup": "asotest-rg-bmupee",
  "sku": null,
  "tags": null,
  "type": "Microsoft.DocumentDB/databaseAccounts/mongodbRoleDefinitions"
}

This causes an unmarshaling failure which is blocking my PR.
I was looking through the various modifiers in azure-arm.yaml but I was not able to find a similar situation.

Could anyone help out here?
Thanks!

@petrepopescu21 petrepopescu21 changed the title [WIP] Feature/documentdb 20240815 [Help needed] Feature/documentdb 20240815 Feb 1, 2025
@theunrepentantgeek
Copy link
Member

Oh this is fun, the spec version has Type declared as an enum:

└── Type: *Enum (2 values)
    ├── "BuiltInRole"
    └── "CustomRole"

Having the service return an integer seems like a bug; it should be returning either BuiltInRole or CustomRole, as appropriate.
I'll check in with the rest of the team tomorrow on this.

@petrepopescu21
Copy link
Contributor Author

petrepopescu21 commented Feb 3, 2025

@theunrepentantgeek while this is looked at, I'd rather limit my PR to the documentDB update + UserDefinition support. We use ASO heavily and this would unblock us.

Does re-scoping PR sound OK?

@petrepopescu21 petrepopescu21 changed the title [Help needed] Feature/documentdb 20240815 Update documentdb 20240815, add MongodbUserDefinition Feb 3, 2025
@petrepopescu21 petrepopescu21 marked this pull request as ready for review February 3, 2025 16:25
@theunrepentantgeek
Copy link
Member

Reducing scope is fine - would you please log an issue requesting MongodbRoleDefinition support, including details of the problem you ran into?

@theunrepentantgeek
Copy link
Member

We're going to publish the v2.13 release of ASO very soon and it would be good to include these in that release.

Do you think you can sort out the CI issues in the next couple of days (say, by Thursday this week)?

Your builds are failing due to missing recordings for your samples, these should be easy to add.
BUT: If you don't think you can get them done in time for this release, we can show you how to suppress that requirement (though we'll need to circle back and add them post release).

@petrepopescu21
Copy link
Contributor Author

I'll get them sorted out, optimistically in the next few hours.

@petrepopescu21
Copy link
Contributor Author

@theunrepentantgeek should be ready now

@theunrepentantgeek
Copy link
Member

I think I can make that build failure will go away by merging #4555 - leave this with me to check.

@theunrepentantgeek
Copy link
Member

I think all you need to do is to merge main and then the CI build should pass.

@theunrepentantgeek
Copy link
Member

/ok-to-test sha=af1b917

@theunrepentantgeek theunrepentantgeek added this pull request to the merge queue Feb 4, 2025
Merged via the queue into Azure:main with commit 9311308 Feb 4, 2025
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Recently Completed
Development

Successfully merging this pull request may close these issues.

3 participants