Skip to content

{AFD} Add health probe parameters validation for afd origin-group and rewrite doc string#31551

Merged
necusjz merged 5 commits into
Azure:devfrom
Ptnan7:issue-30698
May 27, 2025
Merged

{AFD} Add health probe parameters validation for afd origin-group and rewrite doc string#31551
necusjz merged 5 commits into
Azure:devfrom
Ptnan7:issue-30698

Conversation

@Ptnan7
Copy link
Copy Markdown
Member

@Ptnan7 Ptnan7 commented May 26, 2025

Copilot AI review requested due to automatic review settings May 26, 2025 01:55
@azure-client-tools-bot-prd
Copy link
Copy Markdown

azure-client-tools-bot-prd Bot commented May 26, 2025

️✔️AzureCLI-FullTest
️✔️acr
️✔️latest
️✔️3.12
️✔️3.9
️✔️acs
️✔️latest
️✔️3.12
️✔️3.9
️✔️advisor
️✔️latest
️✔️3.12
️✔️3.9
️✔️ams
️✔️latest
️✔️3.12
️✔️3.9
️✔️apim
️✔️latest
️✔️3.12
️✔️3.9
️✔️appconfig
️✔️latest
️✔️3.12
️✔️3.9
️✔️appservice
️✔️latest
️✔️3.12
️✔️3.9
️✔️aro
️✔️latest
️✔️3.12
️✔️3.9
️✔️backup
️✔️latest
️✔️3.12
️✔️3.9
️✔️batch
️✔️latest
️✔️3.12
️✔️3.9
️✔️batchai
️✔️latest
️✔️3.12
️✔️3.9
️✔️billing
️✔️latest
️✔️3.12
️✔️3.9
️✔️botservice
️✔️latest
️✔️3.12
️✔️3.9
️✔️cdn
️✔️latest
️✔️3.12
️✔️3.9
️✔️cloud
️✔️latest
️✔️3.12
️✔️3.9
️✔️cognitiveservices
️✔️latest
️✔️3.12
️✔️3.9
️✔️compute_recommender
️✔️latest
️✔️3.12
️✔️3.9
️✔️computefleet
️✔️latest
️✔️3.12
️✔️3.9
️✔️config
️✔️latest
️✔️3.12
️✔️3.9
️✔️configure
️✔️latest
️✔️3.12
️✔️3.9
️✔️consumption
️✔️latest
️✔️3.12
️✔️3.9
️✔️container
️✔️latest
️✔️3.12
️✔️3.9
️✔️containerapp
️✔️latest
️✔️3.12
️✔️3.9
️✔️core
️✔️latest
️✔️3.12
️✔️3.9
️✔️cosmosdb
️✔️latest
️✔️3.12
️✔️3.9
️✔️databoxedge
️✔️latest
️✔️3.12
️✔️3.9
️✔️dls
️✔️latest
️✔️3.12
️✔️3.9
️✔️dms
️✔️latest
️✔️3.12
️✔️3.9
️✔️eventgrid
️✔️latest
️✔️3.12
️✔️3.9
️✔️eventhubs
️✔️latest
️✔️3.12
️✔️3.9
️✔️feedback
️✔️latest
️✔️3.12
️✔️3.9
️✔️find
️✔️latest
️✔️3.12
️✔️3.9
️✔️hdinsight
️✔️latest
️✔️3.12
️✔️3.9
️✔️identity
️✔️latest
️✔️3.12
️✔️3.9
️✔️iot
️✔️latest
️✔️3.12
️✔️3.9
️✔️keyvault
️✔️latest
️✔️3.12
️✔️3.9
️✔️lab
️✔️latest
️✔️3.12
️✔️3.9
️✔️managedservices
️✔️latest
️✔️3.12
️✔️3.9
️✔️maps
️✔️latest
️✔️3.12
️✔️3.9
️✔️marketplaceordering
️✔️latest
️✔️3.12
️✔️3.9
️✔️monitor
️✔️latest
️✔️3.12
️✔️3.9
️✔️mysql
️✔️latest
️✔️3.12
️✔️3.9
️✔️netappfiles
️✔️latest
️✔️3.12
️✔️3.9
️✔️network
️✔️latest
️✔️3.12
️✔️3.9
️✔️policyinsights
️✔️latest
️✔️3.12
️✔️3.9
️✔️privatedns
️✔️latest
️✔️3.12
️✔️3.9
️✔️profile
️✔️latest
️✔️3.12
️✔️3.9
️✔️rdbms
️✔️latest
️✔️3.12
️✔️3.9
️✔️redis
️✔️latest
️✔️3.12
️✔️3.9
️✔️relay
️✔️latest
️✔️3.12
️✔️3.9
️✔️resource
️✔️latest
️✔️3.12
️✔️3.9
️✔️role
️✔️latest
️✔️3.12
️✔️3.9
️✔️search
️✔️latest
️✔️3.12
️✔️3.9
️✔️security
️✔️latest
️✔️3.12
️✔️3.9
️✔️servicebus
️✔️latest
️✔️3.12
️✔️3.9
️✔️serviceconnector
️✔️latest
️✔️3.12
️✔️3.9
️✔️servicefabric
️✔️latest
️✔️3.12
️✔️3.9
️✔️signalr
️✔️latest
️✔️3.12
️✔️3.9
️✔️sql
️✔️latest
️✔️3.12
️✔️3.9
️✔️sqlvm
️✔️latest
️✔️3.12
️✔️3.9
️✔️storage
️✔️latest
️✔️3.12
️✔️3.9
️✔️synapse
️✔️latest
️✔️3.12
️✔️3.9
️✔️telemetry
️✔️latest
️✔️3.12
️✔️3.9
️✔️util
️✔️latest
️✔️3.12
️✔️3.9
️✔️vm
️✔️latest
️✔️3.12
️✔️3.9

@azure-client-tools-bot-prd
Copy link
Copy Markdown

Hi @Ptnan7,
Since the current milestone time is less than 7 days, this pr will be reviewed in the next milestone.

@azure-client-tools-bot-prd
Copy link
Copy Markdown

azure-client-tools-bot-prd Bot commented May 26, 2025

️✔️AzureCLI-BreakingChangeTest
️✔️Non Breaking Changes

@yonzhan
Copy link
Copy Markdown
Collaborator

yonzhan commented May 26, 2025

Thank you for your contribution! We will review the pull request and get back to you soon.

@github-actions
Copy link
Copy Markdown

The git hooks are available for azure-cli and azure-cli-extensions repos. They could help you run required checks before creating the PR.

Please sync the latest code with latest dev branch (for azure-cli) or main branch (for azure-cli-extensions).
After that please run the following commands to enable git hooks:

pip install azdev --upgrade
azdev setup -c <your azure-cli repo path> -r <your azure-cli-extensions repo path>

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds validation for health probe parameters in AFD origin groups to address issue 30698.

  • Introduces the get_health_probe_settings() function to centralize validation logic.
  • Refactors the pre_operations() methods in AFDOriginGroupCreate and AFDOriginGroupUpdate to use the new function.
  • Consolidates the health probe parameter checks when setting args.health_probe_settings.
Comments suppressed due to low confidence (1)

src/azure-cli/azure/cli/command_modules/cdn/custom/custom_afdx.py:263

  • [nitpick] The error message exceeds the 79-character line limit. Consider breaking the string into multiple concatenated lines to comply with coding style guidelines.
raise InvalidArgumentValueError( 'When --enable-health-probe is set, all of --probe-interval-in-seconds, --probe-path, --probe-protocol and --probe-request-type must be specified.' )



def get_health_probe_settings(enable_health_probe, probe_interval_in_seconds, probe_path, probe_protocol, probe_request_type):
params = [probe_interval_in_seconds, probe_path, probe_protocol, probe_request_type]
Copy link

Copilot AI May 26, 2025

Choose a reason for hiding this comment

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

The validation logic for health probe parameters is duplicated across branches. Consider consolidating these checks to improve maintainability and reduce repetition.

Suggested change
params = [probe_interval_in_seconds, probe_path, probe_protocol, probe_request_type]
params = [probe_interval_in_seconds, probe_path, probe_protocol, probe_request_type]
enable_health_probe = _validate_health_probe_params(enable_health_probe, params)
if not enable_health_probe:
return None
return {
'probeIntervalInSeconds': probe_interval_in_seconds,
'probePath': probe_path,
'probeProtocol': probe_protocol,
'probeRequestType': probe_request_type
}
def _validate_health_probe_params(enable_health_probe, params):

Copilot uses AI. Check for mistakes.
@necusjz
Copy link
Copy Markdown
Member

necusjz commented May 26, 2025

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 3 pipeline(s).

@Ptnan7 Ptnan7 changed the title {AFD} Fix issue 30698: Add health probe parameters validation for afd origin-group {AFD} Fix issue 30698: Add health probe parameters validation for afd origin-group And issue 30761: rewrite doc string May 26, 2025
@necusjz
Copy link
Copy Markdown
Member

necusjz commented May 26, 2025

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 3 pipeline(s).

@necusjz
Copy link
Copy Markdown
Member

necusjz commented May 27, 2025

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 3 pipeline(s).

@necusjz necusjz changed the title {AFD} Fix issue 30698: Add health probe parameters validation for afd origin-group And issue 30761: rewrite doc string {AFD} Add health probe parameters validation for afd origin-group and rewrite doc string May 27, 2025
@necusjz necusjz merged commit 775d9d1 into Azure:dev May 27, 2025
49 checks passed
@necusjz necusjz mentioned this pull request May 27, 2025
3 tasks
@Ptnan7 Ptnan7 deleted the issue-30698 branch May 30, 2025 01:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants