Repository navigation
arc-multicloud: add 2027-01-01 (GA) command models with GCP support - #1125
Conversation
Adds the 2027-01-01 stable version of Microsoft.HybridConnectivity to the
existing arc-multicloud command group, inheriting all 2024-12-01
customizations.
New command:
* arc-multicloud generate-gcp-template (POST
/subscriptions/{}/providers/Microsoft.HybridConnectivity/generateGcpTemplate)
Additive model changes carried in from the 2027-01-01 swagger:
* HostType enum gains GCP
* PublicCloudConnector gains read-only 'kind'
* PublicCloudConnectorProperties gains optional gcpCloudProfile
* PublicCloudConnectorPropertiesUpdate gains optional gcpCloudProfile
* SolutionTypeProperties / SolutionTypeSettingsProperties gain hostTypes
Downstream CLI extension PR: Azure/azure-cli-extensions#10267
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Use the swagger summary casing ("Retrieve GCP Access Control template"),
matching the generate-aws-template sibling and the aaz command model in
Azure/aaz#1125.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
JaysonTaiMicrosoft — this is approved and Context on ordering: Azure/azure-cli-extensions#10267 (the The change is purely additive — 2415 insertions, 0 deletions across 39 files — and |
… GCP support (#10267) * [MulticloudConnector] Target HybridConnectivity 2027-01-01 GA and add GCP support * Bump the api-version of every generated AAZ command from 2024-12-01 to 2027-01-01 * Add `az arc-multicloud generate-gcp-template` * Add `--gcp-cloud-profile` to public-cloud-connector create/update and GCP to --host-type * Surface the read-only `kind` property and solution-type `hostTypes` * `awsCloudProfile` is no longer required by the service, matching the 2027-01-01 spec Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> * Address PR feedback and unblock recorded tests - generate-gcp-template test: use a fully-qualified connector ID (leading '/'). connectorId travels in the request body here, unlike the scope-style ID that solution-configuration interpolates into the request path. - generate-aws/gcp-template: stop swallowing failures in _output(). Returning {"status": "error"} made the command exit 0 on failure; the helpers already raise ValidationError, so let it propagate. - tests: pin the Microsoft.Resources api-version used by the RP-registration pre-check on replay. That version is owned by azure-cli-core, not this extension, and core moving to 2024-11-01 broke every recorded test here (reproduced on unmodified main). Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> * Document the flat key=value form for --gcp-cloud-profile public-cloud-connector create already showed both the nested brace form and the flat key=value form for --aws-cloud-profile, but only the nested form for --gcp-cloud-profile. Added the matching flat example, verified against the real CLI (project-properties={...} and the dotted project-properties.project-id=... form both parse to the expected request body). Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> * Pair every shorthand example with a fully flattened form Master's convention is to show each object argument twice: once in the nested "{...}" brace form and once in the flat key=value form. The GCP examples added for 2027-01-01 only followed this partially, and the update command had no GCP example at all. - public-cloud-connector create: the GCP "flat" example still nested braces one level down. Replace it with a fully dotted, brace-free form. - public-cloud-connector update: add the missing AWS flat example and both GCP examples (nested and flat). - generate-gcp-template: add the flat companion to the nested example. Every example string was executed against the CLI and its serialized request body compared against the nested form to confirm they produce identical payloads. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> * Fix GCP examples and live test after canary validation Validated the 2027-01-01 commands against the canary rollout in eastus2euap. The service enforces a rule that is not expressed in the swagger: projectProperties and organizationProperties on gcpCloudProfile are mutually exclusive (GCPPropertiesMutuallyExclusive). Every GCP example in the PR set both, so all of them were invalid as written. - public_cloud_connector/_create.py: split the two GCP examples so one is project-scoped (nested form) and the other organization-scoped (flat form), keeping both profile shapes and both syntaxes documented. - _generate_gcp_template.py: same split, and show --solution-types only in the pre-provisioning flow. The service rejects solution types when connectorId refers to an existing connector, since it reads them from that connector's solution configurations. - README.md: project-scoped example plus an organization-scoped alternative. - tests: create the GCP connector with organization properties only so the exclusion-list update applies to the same connector, assert the new readonly kind property, and create a solution configuration before generate-gcp-template, which the service requires. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> * Match generate-gcp-template summary to generated AAZ model Use the swagger summary casing ("Retrieve GCP Access Control template"), matching the generate-aws-template sibling and the aaz command model in Azure/aaz#1125. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> * Fix GCP test failure and make it run in CI playback The GCP scenario test failed on every live run, including the reviewer's. Root cause: generate-gcp-template validates connectorId in the request body against ^/subscriptions/[\w-]+/resourceGroups/[\w-]+/..., and [\w-] excludes '.'. ResourceGroupPreparer's default name_prefix is 'clitest.rg', so the generated resource group name always contained a dot and the service rejected the request with ModelValidationError. Use a dot-free prefix. With that fixed the scenario no longer needs to be live-only, so drop @live_only() and add the recordings, letting it run in CI playback. Also address the review feedback on assertion strength: - assert the GCP exclusion lists actually persist across update, and that the immutable organization fields survive the patch, rather than only checking the connector name - write the template to a scratch directory and assert the artifact exists and is well-formed JSON, rather than only checking the success envelope - add project-scoped GCP coverage; projectProperties and organizationProperties are mutually exclusive service-side, so it needs its own connector Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> * Re-record existing scenario recordings against the current service Per review feedback, re-record the three pre-existing recordings live instead of carrying the api-version-substituted ones: test_public_cloud_connector.yaml test_solution_configuration.yaml test_solution_types.yaml All extension requests in the new cassettes are genuinely 2027-01-01; the remaining 2024-12-01 strings are provider-metadata response bodies listing available apiVersions, not request versions. test_solution_types asserted `length(@) == 2` on the output of `solution-type list`. That is a service-wide catalog rather than anything the test creates, and it has since grown to 9 entries, so the assertion failed on re-record. Replace the hard-coded count with assertions that are meaningful and stable: the list is non-empty and advertises the solution type the test exercises. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> * Cover generate-gcp-template output-failure propagation The x-engineering-agent review asked for focused coverage of template-output failure propagation; only the success path was covered. The file write happens in _output, after a successful service call, so a write failure must surface as a command failure rather than a success envelope. Assert that by pointing --output-directory at an existing file: the os.path.exists check passes, so makedirs is skipped, and opening a path beneath a file fails on every platform, exercising the ValidationError branch. Verified the assertion has teeth by mutation: replacing the raise with a pass makes the test fail. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Adds the 2027-01-01 (stable/GA) version of
Microsoft.HybridConnectivityto the existingarc-multicloudcommand group.Generated with
aaz-devby adding the 2027-01-01 swagger resources withaaz_version: 2024-12-01inheritance, so all existing 2024-12-01 customizations are preserved (argument renames such as-n/--name, curated help text, and examples). The diff is purely additive: 2415 insertions, 0 deletions.New command
arc-multicloud generate-gcp-template->POST /subscriptions/{subscriptionId}/providers/Microsoft.HybridConnectivity/generateGcpTemplateAdditive model changes from the 2027-01-01 swagger
HostTypeenum[AWS]->[AWS, GCP]PublicCloudConnectorkindPublicCloudConnectorPropertiesgcpCloudProfilePublicCloudConnectorPropertiesUpdategcpCloudProfile(excludedProjectNumbers/excludedFolderIdsonly)SolutionTypePropertieshostTypesSolutionTypeSettingsPropertieshostTypesValidation
aaz-dev command-model verify -a <aaz> -t arc-multicloud-> exit 0.aaz-dev cli regenerateagainst the downstream extension reproduces the CLI PR's code, with no functional differences.Downstream
Azure/azure-cli-extensions#10267