From d81f8f24767d1535caced786365da59efa1fb771 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Fri, 12 May 2023 21:59:21 +0000 Subject: [PATCH] CodeGen from PR 23955 in Azure/azure-rest-api-specs Merge a57e9210a34423623846fcf3fa4b92c41b2e256c into faeccdca4311ebfbe437d0cbbe3ccad33213d32f --- .../azure-mgmt-costmanagement/_meta.json | 6 +- .../azure/mgmt/costmanagement/__init__.py | 2 +- .../mgmt/costmanagement/_configuration.py | 15 +- .../costmanagement/_cost_management_client.py | 121 ++- .../mgmt/costmanagement/_serialization.py | 180 ++-- .../azure/mgmt/costmanagement/_vendor.py | 5 +- .../azure/mgmt/costmanagement/_version.py | 2 +- .../azure/mgmt/costmanagement/aio/__init__.py | 2 +- .../mgmt/costmanagement/aio/_configuration.py | 10 +- .../aio/_cost_management_client.py | 115 ++- .../costmanagement/aio/operations/__init__.py | 44 +- .../aio/operations/_alerts_operations.py | 94 +- .../_benefit_recommendations_operations.py | 27 +- ...enefit_utilization_summaries_operations.py | 101 ++- .../_billing_account_scope_operations.py | 288 ++++++ .../_billing_profile_scope_operations.py | 300 +++++++ .../aio/operations/_dimensions_operations.py | 51 +- .../aio/operations/_exports_operations.py | 132 +-- .../aio/operations/_forecast_operations.py | 68 +- ...generate_cost_details_report_operations.py | 115 +-- ...ost_report_operation_results_operations.py | 38 +- ...cost_report_operation_status_operations.py | 20 +- ...enerate_detailed_cost_report_operations.py | 60 +- ...e_reservation_details_report_operations.py | 89 +- .../aio/operations/_operations.py | 24 +- .../aio/operations/_price_sheet_operations.py | 83 +- .../aio/operations/_query_operations.py | 68 +- .../_reservation_order_scope_operations.py | 290 ++++++ .../_reservation_scope_operations.py | 297 +++++++ .../_savings_plan_order_scope_operations.py | 290 ++++++ .../_savings_plan_scope_operations.py | 299 +++++++ .../_scheduled_actions_operations.py | 336 ++++--- .../aio/operations/_views_operations.py | 190 ++-- .../mgmt/costmanagement/models/__init__.py | 22 +- .../models/_cost_management_client_enums.py | 108 ++- .../mgmt/costmanagement/models/_models_py3.py | 831 +++++++++++++----- .../costmanagement/operations/__init__.py | 44 +- .../operations/_alerts_operations.py | 112 +-- .../_benefit_recommendations_operations.py | 31 +- ...enefit_utilization_summaries_operations.py | 117 +-- .../_billing_account_scope_operations.py | 321 +++++++ .../_billing_profile_scope_operations.py | 336 +++++++ .../operations/_dimensions_operations.py | 59 +- .../operations/_exports_operations.py | 158 ++-- .../operations/_forecast_operations.py | 80 +- ...generate_cost_details_report_operations.py | 125 +-- ...ost_report_operation_results_operations.py | 42 +- ...cost_report_operation_status_operations.py | 24 +- ...enerate_detailed_cost_report_operations.py | 66 +- ...e_reservation_details_report_operations.py | 97 +- .../costmanagement/operations/_operations.py | 26 +- .../operations/_price_sheet_operations.py | 91 +- .../operations/_query_operations.py | 80 +- .../_reservation_order_scope_operations.py | 323 +++++++ .../_reservation_scope_operations.py | 333 +++++++ .../_savings_plan_order_scope_operations.py | 323 +++++++ .../_savings_plan_scope_operations.py | 333 +++++++ .../_scheduled_actions_operations.py | 398 +++++---- .../operations/_views_operations.py | 224 ++--- ...fit_recommendations_by_billing_account.py} | 4 +- ...ion_summaries_report_by_billing_account.py | 45 + ...ion_summaries_report_by_billing_profile.py | 46 + ...ization_summaries_report_by_reservation.py | 45 + ...n_summaries_report_by_reservation_order.py | 44 + ...zation_summaries_report_by_savings_plan.py | 45 + ..._summaries_report_by_savings_plan_order.py | 44 + .../savings_plan_billing_account.py} | 4 +- .../savings_plan_billing_profile.py} | 4 +- .../savings_plan_savings_plan_id_monthly.py} | 4 +- ...vings_plan_savings_plan_order_id_daily.py} | 4 +- .../billing_account_alerts.py | 2 +- ....py => billing_account_dimensions_list.py} | 4 +- ...account_dimensions_list_expand_and_top.py} | 4 +- ...ng_account_dimensions_list_with_filter.py} | 4 +- .../billing_account_forecast.py | 2 +- ...ery_legacy.py => billing_account_query.py} | 4 +- ...y.py => billing_account_query_grouping.py} | 4 +- .../billing_profile_alerts.py | 2 +- .../billing_profile_forecast.py | 2 +- ...peration_results_by_subscription_scope.py} | 4 +- .../generated_samples/department_alerts.py | 2 +- ...egacy.py => department_dimensions_list.py} | 4 +- ...artment_dimensions_list_expand_and_top.py} | 4 +- ...department_dimensions_list_with_filter.py} | 4 +- .../generated_samples/department_forecast.py | 2 +- ...nt_query_legacy.py => department_query.py} | 4 +- ...legacy.py => department_query_grouping.py} | 4 +- ...ts.py => dismiss_resource_group_alerts.py} | 4 +- ...erts.py => dismiss_subscription_alerts.py} | 4 +- .../enrollment_account_alerts.py | 2 +- ... => enrollment_account_dimensions_list.py} | 4 +- ...account_dimensions_list_expand_and_top.py} | 4 +- ...nt_account_dimensions_list_with_filter.py} | 4 +- .../enrollment_account_forecast.py | 2 +- ..._legacy.py => enrollment_account_query.py} | 4 +- ...y => enrollment_account_query_grouping.py} | 4 +- ...ort_create_or_update_by_billing_account.py | 2 +- .../export_create_or_update_by_department.py | 2 +- ..._create_or_update_by_enrollment_account.py | 2 +- ...rt_create_or_update_by_management_group.py | 2 +- ...port_create_or_update_by_resource_group.py | 2 +- ...export_create_or_update_by_subscription.py | 2 +- .../export_delete_by_billing_account.py | 5 +- .../export_delete_by_department.py | 5 +- .../export_delete_by_enrollment_account.py | 5 +- .../export_delete_by_management_group.py | 5 +- .../export_delete_by_resource_group.py | 5 +- .../export_delete_by_subscription.py | 5 +- .../export_get_by_billing_account.py | 2 +- .../export_get_by_department.py | 2 +- .../export_get_by_enrollment_account.py | 2 +- .../export_get_by_management_group.py | 2 +- .../export_get_by_resource_group.py | 2 +- .../export_get_by_subscription.py | 2 +- .../export_run_by_billing_account.py | 5 +- .../export_run_by_department.py | 5 +- .../export_run_by_enrollment_account.py | 5 +- .../export_run_by_management_group.py | 5 +- .../export_run_by_resource_group.py | 5 +- .../export_run_by_subscription.py | 5 +- ...port_run_history_get_by_billing_account.py | 2 +- .../export_run_history_get_by_department.py | 2 +- ...t_run_history_get_by_enrollment_account.py | 2 +- ...ort_run_history_get_by_management_group.py | 2 +- ...xport_run_history_get_by_resource_group.py | 2 +- .../export_run_history_get_by_subscription.py | 2 +- .../exports_get_by_billing_account.py | 2 +- .../exports_get_by_department.py | 2 +- .../exports_get_by_enrollment_account.py | 2 +- .../exports_get_by_management_group.py | 2 +- .../exports_get_by_resource_group.py | 2 +- .../exports_get_by_subscription.py | 2 +- .../external_billing_account_alerts.py | 2 +- .../external_billing_account_forecast.py | 2 +- ...> external_billing_accounts_dimensions.py} | 4 +- ....py => external_billing_accounts_query.py} | 4 +- .../external_subscription_alerts.py | 2 +- .../external_subscription_forecast.py | 2 +- ...y => external_subscriptions_dimensions.py} | 4 +- .../external_subscriptions_query.py | 2 +- ...e_agreement_customer_and_billing_period.py | 2 +- ...eport_by_billing_profile_and_invoice_id.py | 2 +- ..._profile_and_invoice_id_and_customer_id.py | 2 +- ...ails_report_by_customer_and_time_period.py | 2 +- ...s_report_by_departments_and_time_period.py | 2 +- ..._by_enrollment_accounts_and_time_period.py | 2 +- ..._report_by_subscription_and_time_period.py | 2 +- ...lling_account_legacy_and_billing_period.py | 2 +- ...eport_by_billing_profile_and_invoice_id.py | 2 +- ..._profile_and_invoice_id_and_customer_id.py | 2 +- ...cost_report_by_customer_and_time_period.py | 2 +- ..._report_by_subscription_and_time_period.py | 2 +- ...operation_results_by_subscription_scope.py | 40 + ...operation_status_by_subscription_scope.py} | 4 +- ...tion_details_report_by_billing_account.py} | 4 +- ...ation_details_report_by_billing_profile.py | 42 + .../invoice_section_alerts.py | 2 +- .../invoice_section_forecast.py | 2 +- ...py => management_group_dimensions_list.py} | 4 +- ...t_group_dimensions_list_expand_and_top.py} | 4 +- ...ment_group_dimensions_list_with_filter.py} | 4 +- ...ry_legacy.py => management_group_query.py} | 4 +- ....py => management_group_query_grouping.py} | 4 +- ...=> mca_billing_account_dimensions_list.py} | 4 +- ...account_dimensions_list_expand_and_top.py} | 4 +- ...ng_account_dimensions_list_with_filter.py} | 4 +- ...ry_mca.py => mca_billing_account_query.py} | 4 +- ... => mca_billing_account_query_grouping.py} | 4 +- ...=> mca_billing_profile_dimensions_list.py} | 4 +- ...profile_dimensions_list_expand_and_top.py} | 4 +- ...ng_profile_dimensions_list_with_filter.py} | 4 +- ...ry_mca.py => mca_billing_profile_query.py} | 4 +- ... => mca_billing_profile_query_grouping.py} | 4 +- ...mca.py => mca_customer_dimensions_list.py} | 4 +- ...ustomer_dimensions_list_expand_and_top.py} | 4 +- ...a_customer_dimensions_list_with_filter.py} | 4 +- ...mer_query_mca.py => mca_customer_query.py} | 4 +- ..._mca.py => mca_customer_query_grouping.py} | 4 +- ...=> mca_invoice_section_dimensions_list.py} | 4 +- ...section_dimensions_list_expand_and_top.py} | 4 +- ...ce_section_dimensions_list_with_filter.py} | 4 +- ...ry_mca.py => mca_invoice_section_query.py} | 4 +- ... => mca_invoice_section_query_grouping.py} | 4 +- .../generated_samples/operation_list.py | 2 +- .../generated_samples/pricesheet_download.py | 2 +- .../pricesheet_download_by_billing_profile.py | 2 +- .../generated_samples/private_view.py | 2 +- ...ew.py => private_view_create_or_update.py} | 4 +- ...private_view.py => private_view_delete.py} | 7 +- .../generated_samples/private_view_list.py | 2 +- .../resource_group_alerts.py | 2 +- ...y.py => resource_group_dimensions_list.py} | 4 +- .../resource_group_forecast.py | 2 +- ...uery_legacy.py => resource_group_query.py} | 4 +- ...cy.py => resource_group_query_grouping.py} | 4 +- ...me_availabilityprivatescheduled_action.py} | 4 +- ...ame_availabilitysharedscheduled_action.py} | 4 +- ...cheduled_actioncreate_or_updateprivate.py} | 4 +- ...scheduled_actioncreate_or_updateshared.py} | 4 +- .../scheduled_actiondeleteprivate.py} | 7 +- .../scheduled_actiondeleteshared.py} | 7 +- .../scheduled_actiongetprivate.py} | 4 +- .../scheduled_actiongetshared.py} | 4 +- ...ioninsight_alertcreate_or_updateshared.py} | 4 +- .../scheduled_actionsend_nowprivate.py} | 7 +- .../scheduled_actionsend_nowshared.py} | 7 +- ...heduled_actionslist_with_filterprivate.py} | 4 +- ...cheduled_actionslist_with_filtershared.py} | 4 +- .../scheduled_actionslistprivate.py} | 4 +- .../scheduled_actionslistshared.py} | 4 +- ...erts.py => single_resource_group_alert.py} | 4 +- ...alerts.py => single_subscription_alert.py} | 4 +- .../generated_samples/subscription_alerts.py | 2 +- ...acy.py => subscription_dimensions_list.py} | 4 +- .../subscription_forecast.py | 2 +- ..._query_legacy.py => subscription_query.py} | 4 +- ...gacy.py => subscription_query_grouping.py} | 4 +- ...roup_view.py => view_by_resource_group.py} | 4 +- ...iew_create_or_update_by_resource_group.py} | 4 +- ...ew.py => view_delete_by_resource_group.py} | 7 +- ...list.py => view_list_by_resource_group.py} | 4 +- 221 files changed, 7142 insertions(+), 2201 deletions(-) create mode 100644 sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_billing_account_scope_operations.py create mode 100644 sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_billing_profile_scope_operations.py create mode 100644 sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_reservation_order_scope_operations.py create mode 100644 sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_reservation_scope_operations.py create mode 100644 sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_savings_plan_order_scope_operations.py create mode 100644 sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_savings_plan_scope_operations.py create mode 100644 sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_billing_account_scope_operations.py create mode 100644 sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_billing_profile_scope_operations.py create mode 100644 sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_reservation_order_scope_operations.py create mode 100644 sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_reservation_scope_operations.py create mode 100644 sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_savings_plan_order_scope_operations.py create mode 100644 sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_savings_plan_scope_operations.py rename sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/{benefit_recommendations_billing_account_list.py => benefit_recommendations_by_billing_account.py} (92%) create mode 100644 sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/benefit_utilization_summaries/async/generate_benefit_utilization_summaries_report_by_billing_account.py create mode 100644 sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/benefit_utilization_summaries/async/generate_benefit_utilization_summaries_report_by_billing_profile.py create mode 100644 sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/benefit_utilization_summaries/async/generate_benefit_utilization_summaries_report_by_reservation.py create mode 100644 sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/benefit_utilization_summaries/async/generate_benefit_utilization_summaries_report_by_reservation_order.py create mode 100644 sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/benefit_utilization_summaries/async/generate_benefit_utilization_summaries_report_by_savings_plan.py create mode 100644 sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/benefit_utilization_summaries/async/generate_benefit_utilization_summaries_report_by_savings_plan_order.py rename sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/{savings_plan_utilization_summaries_billing_account.py => benefit_utilization_summaries/savings_plan_billing_account.py} (91%) rename sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/{savings_plan_utilization_summaries_billing_profile.py => benefit_utilization_summaries/savings_plan_billing_profile.py} (92%) rename sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/{savings_plan_utilization_summaries_monthly_with_savings_plan_id.py => benefit_utilization_summaries/savings_plan_savings_plan_id_monthly.py} (91%) rename sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/{savings_plan_utilization_summaries_daily.py => benefit_utilization_summaries/savings_plan_savings_plan_order_id_daily.py} (92%) rename sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/{billing_account_dimensions_list_legacy.py => billing_account_dimensions_list.py} (92%) rename sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/{billing_account_dimensions_list_expand_and_top_legacy.py => billing_account_dimensions_list_expand_and_top.py} (91%) rename sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/{billing_account_dimensions_list_with_filter_legacy.py => billing_account_dimensions_list_with_filter.py} (91%) rename sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/{billing_account_query_legacy.py => billing_account_query.py} (95%) rename sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/{billing_account_query_grouping_legacy.py => billing_account_query_grouping.py} (93%) rename sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/{get_details_of_the_operation_result.py => cost_details_operation_results_by_subscription_scope.py} (92%) rename sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/{department_dimensions_list_legacy.py => department_dimensions_list.py} (92%) rename sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/{department_dimensions_list_expand_and_top_legacy.py => department_dimensions_list_expand_and_top.py} (91%) rename sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/{department_dimensions_list_with_filter_legacy.py => department_dimensions_list_with_filter.py} (92%) rename sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/{department_query_legacy.py => department_query.py} (95%) rename sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/{department_query_grouping_legacy.py => department_query_grouping.py} (94%) rename sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/{patch_resource_group_alerts.py => dismiss_resource_group_alerts.py} (93%) rename sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/{patch_subscription_alerts.py => dismiss_subscription_alerts.py} (93%) rename sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/{enrollment_account_dimensions_list_legacy.py => enrollment_account_dimensions_list.py} (92%) rename sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/{enrollment_account_dimensions_list_expand_and_top_legacy.py => enrollment_account_dimensions_list_expand_and_top.py} (91%) rename sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/{enrollment_account_dimensions_list_with_filter_legacy.py => enrollment_account_dimensions_list_with_filter.py} (91%) rename sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/{enrollment_account_query_legacy.py => enrollment_account_query.py} (95%) rename sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/{enrollment_account_query_grouping_legacy.py => enrollment_account_query_grouping.py} (93%) rename sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/{external_billing_account_dimension_list.py => external_billing_accounts_dimensions.py} (92%) rename sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/{external_billing_account_query_list.py => external_billing_accounts_query.py} (95%) rename sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/{external_subscription_dimension_list.py => external_subscriptions_dimensions.py} (92%) create mode 100644 sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/generate_detailed_cost_report_operation_results_by_subscription_scope.py rename sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/{get_details_of_the_operation_status.py => generate_detailed_cost_report_operation_status_by_subscription_scope.py} (91%) rename sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/{reservation_details.py => generate_reservation_details_report_by_billing_account.py} (91%) create mode 100644 sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/generate_reservation_details_report_by_billing_profile.py rename sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/{management_group_dimensions_list_legacy.py => management_group_dimensions_list.py} (92%) rename sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/{management_group_dimensions_list_expand_and_top_legacy.py => management_group_dimensions_list_expand_and_top.py} (91%) rename sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/{management_group_dimensions_list_with_filter_legacy.py => management_group_dimensions_list_with_filter.py} (91%) rename sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/{management_group_query_legacy.py => management_group_query.py} (95%) rename sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/{management_group_query_grouping_legacy.py => management_group_query_grouping.py} (93%) rename sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/{billing_account_dimensions_list_mca.py => mca_billing_account_dimensions_list.py} (92%) rename sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/{billing_account_dimensions_list_expand_and_top_mca.py => mca_billing_account_dimensions_list_expand_and_top.py} (91%) rename sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/{billing_account_dimensions_list_with_filter_mca.py => mca_billing_account_dimensions_list_with_filter.py} (92%) rename sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/{billing_account_query_mca.py => mca_billing_account_query.py} (95%) rename sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/{billing_account_query_grouping_mca.py => mca_billing_account_query_grouping.py} (93%) rename sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/{billing_profile_dimensions_list_mca.py => mca_billing_profile_dimensions_list.py} (92%) rename sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/{billing_profile_dimensions_list_expand_and_top_mca.py => mca_billing_profile_dimensions_list_expand_and_top.py} (92%) rename sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/{billing_profile_dimensions_list_with_filter_mca.py => mca_billing_profile_dimensions_list_with_filter.py} (92%) rename sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/{billing_profile_query_mca.py => mca_billing_profile_query.py} (95%) rename sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/{billing_profile_query_grouping_mca.py => mca_billing_profile_query_grouping.py} (94%) rename sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/{customer_dimensions_list_mca.py => mca_customer_dimensions_list.py} (93%) rename sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/{customer_dimensions_list_expand_and_top_mca.py => mca_customer_dimensions_list_expand_and_top.py} (92%) rename sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/{customer_dimensions_list_with_filter_mca.py => mca_customer_dimensions_list_with_filter.py} (92%) rename sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/{customer_query_mca.py => mca_customer_query.py} (96%) rename sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/{customer_query_grouping_mca.py => mca_customer_query_grouping.py} (94%) rename sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/{invoice_section_dimensions_list_mca.py => mca_invoice_section_dimensions_list.py} (92%) rename sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/{invoice_section_dimensions_list_expand_and_top_mca.py => mca_invoice_section_dimensions_list_expand_and_top.py} (92%) rename sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/{invoice_section_dimensions_list_with_filter_mca.py => mca_invoice_section_dimensions_list_with_filter.py} (92%) rename sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/{invoice_section_query_mca.py => mca_invoice_section_query.py} (95%) rename sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/{invoice_section_query_grouping_mca.py => mca_invoice_section_query_grouping.py} (94%) rename sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/{create_or_update_private_view.py => private_view_create_or_update.py} (96%) rename sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/{delete_private_view.py => private_view_delete.py} (89%) rename sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/{resource_group_dimensions_list_legacy.py => resource_group_dimensions_list.py} (92%) rename sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/{resource_group_query_legacy.py => resource_group_query.py} (95%) rename sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/{resource_group_query_grouping_legacy.py => resource_group_query_grouping.py} (93%) rename sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/{scheduled_action_check_name_availability.py => scheduled_actions/check_name_availabilityprivatescheduled_action.py} (92%) rename sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/{scheduled_action_check_name_availability_by_scope.py => scheduled_actions/check_name_availabilitysharedscheduled_action.py} (92%) rename sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/{create_or_update_private_scheduled_action.py => scheduled_actions/scheduled_actioncreate_or_updateprivate.py} (94%) rename sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/{create_or_update_scheduled_action_by_scope.py => scheduled_actions/scheduled_actioncreate_or_updateshared.py} (95%) rename sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/{private_scheduled_action_delete.py => scheduled_actions/scheduled_actiondeleteprivate.py} (88%) rename sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/{scheduled_action_delete_by_scope.py => scheduled_actions/scheduled_actiondeleteshared.py} (88%) rename sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/{private_scheduled_action.py => scheduled_actions/scheduled_actiongetprivate.py} (93%) rename sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/{scheduled_action_by_scope.py => scheduled_actions/scheduled_actiongetshared.py} (93%) rename sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/{create_or_update_insight_alert_scheduled_action_by_scope.py => scheduled_actions/scheduled_actioninsight_alertcreate_or_updateshared.py} (94%) rename sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/{scheduled_action_send_now.py => scheduled_actions/scheduled_actionsend_nowprivate.py} (88%) rename sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/{scheduled_action_run_by_scope.py => scheduled_actions/scheduled_actionsend_nowshared.py} (88%) rename sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/{private_scheduled_actions_list_filter_by_view_id.py => scheduled_actions/scheduled_actionslist_with_filterprivate.py} (91%) rename sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/{scheduled_actions_list_by_scope_filter_by_view_id.py => scheduled_actions/scheduled_actionslist_with_filtershared.py} (92%) rename sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/{private_scheduled_actions_list.py => scheduled_actions/scheduled_actionslistprivate.py} (92%) rename sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/{scheduled_actions_list_by_scope.py => scheduled_actions/scheduled_actionslistshared.py} (93%) rename sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/{single_resource_group_alerts.py => single_resource_group_alert.py} (93%) rename sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/{single_subscription_alerts.py => single_subscription_alert.py} (93%) rename sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/{subscription_dimensions_list_legacy.py => subscription_dimensions_list.py} (92%) rename sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/{subscription_query_legacy.py => subscription_query.py} (95%) rename sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/{subscription_query_grouping_legacy.py => subscription_query_grouping.py} (93%) rename sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/{resource_group_view.py => view_by_resource_group.py} (93%) rename sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/{resource_group_create_or_update_view.py => view_create_or_update_by_resource_group.py} (96%) rename sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/{resource_group_delete_view.py => view_delete_by_resource_group.py} (89%) rename sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/{resource_group_view_list.py => view_list_by_resource_group.py} (93%) diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/_meta.json b/sdk/costmanagement/azure-mgmt-costmanagement/_meta.json index f20a7c259f2b..c2ec3cf7ea5a 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/_meta.json +++ b/sdk/costmanagement/azure-mgmt-costmanagement/_meta.json @@ -1,11 +1,11 @@ { - "commit": "e77f2f011a17a05457e14a0e78b10c100337a557", + "commit": "cb621736f6f1ee664155f13df9ff68070e5f4c22", "repository_url": "https://github.com/Azure/azure-rest-api-specs", "autorest": "3.9.2", "use": [ - "@autorest/python@6.2.1", + "@autorest/python@6.4.12", "@autorest/modelerfour@4.24.3" ], - "autorest_command": "autorest specification/cost-management/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --use=@autorest/python@6.2.1 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False", + "autorest_command": "autorest specification/cost-management/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --use=@autorest/python@6.4.12 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False", "readme": "specification/cost-management/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/__init__.py b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/__init__.py index 8968aa76c748..327688c9882a 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/__init__.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/__init__.py @@ -13,7 +13,7 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/_configuration.py b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/_configuration.py index dabc5c4d4905..73793bed9fbc 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/_configuration.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/_configuration.py @@ -6,7 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -15,11 +14,6 @@ from ._version import VERSION -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports - if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential @@ -33,14 +27,14 @@ class CostManagementClientConfiguration(Configuration): # pylint: disable=too-m :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential - :keyword api_version: Api Version. Default value is "2022-10-01". Note that overriding this + :keyword api_version: Api Version. Default value is "2023-03-01". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ def __init__(self, credential: "TokenCredential", **kwargs: Any) -> None: super(CostManagementClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2022-10-01") # type: Literal["2022-10-01"] + api_version: str = kwargs.pop("api_version", "2023-03-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -51,10 +45,7 @@ def __init__(self, credential: "TokenCredential", **kwargs: Any) -> None: kwargs.setdefault("sdk_moniker", "mgmt-costmanagement/{}".format(VERSION)) self._configure(**kwargs) - def _configure( - self, **kwargs # type: Any - ): - # type: (...) -> None + def _configure(self, **kwargs: Any) -> None: self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/_cost_management_client.py b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/_cost_management_client.py index 4ba98e38ed43..4ed91ef62f4a 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/_cost_management_client.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/_cost_management_client.py @@ -12,13 +12,15 @@ from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient -from . import models +from . import models as _models from ._configuration import CostManagementClientConfiguration from ._serialization import Deserializer, Serializer from .operations import ( AlertsOperations, BenefitRecommendationsOperations, BenefitUtilizationSummariesOperations, + BillingAccountScopeOperations, + BillingProfileScopeOperations, DimensionsOperations, ExportsOperations, ForecastOperations, @@ -30,6 +32,10 @@ Operations, PriceSheetOperations, QueryOperations, + ReservationOrderScopeOperations, + ReservationScopeOperations, + SavingsPlanOrderScopeOperations, + SavingsPlanScopeOperations, ScheduledActionsOperations, ViewsOperations, ) @@ -45,20 +51,28 @@ class CostManagementClient: # pylint: disable=client-accepts-api-version-keywor :ivar operations: Operations operations :vartype operations: azure.mgmt.costmanagement.operations.Operations - :ivar views: ViewsOperations operations - :vartype views: azure.mgmt.costmanagement.operations.ViewsOperations - :ivar alerts: AlertsOperations operations - :vartype alerts: azure.mgmt.costmanagement.operations.AlertsOperations - :ivar forecast: ForecastOperations operations - :vartype forecast: azure.mgmt.costmanagement.operations.ForecastOperations - :ivar dimensions: DimensionsOperations operations - :vartype dimensions: azure.mgmt.costmanagement.operations.DimensionsOperations - :ivar query: QueryOperations operations - :vartype query: azure.mgmt.costmanagement.operations.QueryOperations - :ivar generate_reservation_details_report: GenerateReservationDetailsReportOperations - operations - :vartype generate_reservation_details_report: - azure.mgmt.costmanagement.operations.GenerateReservationDetailsReportOperations + :ivar benefit_recommendations: BenefitRecommendationsOperations operations + :vartype benefit_recommendations: + azure.mgmt.costmanagement.operations.BenefitRecommendationsOperations + :ivar benefit_utilization_summaries: BenefitUtilizationSummariesOperations operations + :vartype benefit_utilization_summaries: + azure.mgmt.costmanagement.operations.BenefitUtilizationSummariesOperations + :ivar billing_account_scope: BillingAccountScopeOperations operations + :vartype billing_account_scope: + azure.mgmt.costmanagement.operations.BillingAccountScopeOperations + :ivar billing_profile_scope: BillingProfileScopeOperations operations + :vartype billing_profile_scope: + azure.mgmt.costmanagement.operations.BillingProfileScopeOperations + :ivar reservation_order_scope: ReservationOrderScopeOperations operations + :vartype reservation_order_scope: + azure.mgmt.costmanagement.operations.ReservationOrderScopeOperations + :ivar reservation_scope: ReservationScopeOperations operations + :vartype reservation_scope: azure.mgmt.costmanagement.operations.ReservationScopeOperations + :ivar savings_plan_order_scope: SavingsPlanOrderScopeOperations operations + :vartype savings_plan_order_scope: + azure.mgmt.costmanagement.operations.SavingsPlanOrderScopeOperations + :ivar savings_plan_scope: SavingsPlanScopeOperations operations + :vartype savings_plan_scope: azure.mgmt.costmanagement.operations.SavingsPlanScopeOperations :ivar exports: ExportsOperations operations :vartype exports: azure.mgmt.costmanagement.operations.ExportsOperations :ivar generate_cost_details_report: GenerateCostDetailsReportOperations operations @@ -75,21 +89,29 @@ class CostManagementClient: # pylint: disable=client-accepts-api-version-keywor GenerateDetailedCostReportOperationStatusOperations operations :vartype generate_detailed_cost_report_operation_status: azure.mgmt.costmanagement.operations.GenerateDetailedCostReportOperationStatusOperations + :ivar views: ViewsOperations operations + :vartype views: azure.mgmt.costmanagement.operations.ViewsOperations + :ivar alerts: AlertsOperations operations + :vartype alerts: azure.mgmt.costmanagement.operations.AlertsOperations + :ivar forecast: ForecastOperations operations + :vartype forecast: azure.mgmt.costmanagement.operations.ForecastOperations + :ivar dimensions: DimensionsOperations operations + :vartype dimensions: azure.mgmt.costmanagement.operations.DimensionsOperations + :ivar query: QueryOperations operations + :vartype query: azure.mgmt.costmanagement.operations.QueryOperations + :ivar generate_reservation_details_report: GenerateReservationDetailsReportOperations + operations + :vartype generate_reservation_details_report: + azure.mgmt.costmanagement.operations.GenerateReservationDetailsReportOperations :ivar price_sheet: PriceSheetOperations operations :vartype price_sheet: azure.mgmt.costmanagement.operations.PriceSheetOperations :ivar scheduled_actions: ScheduledActionsOperations operations :vartype scheduled_actions: azure.mgmt.costmanagement.operations.ScheduledActionsOperations - :ivar benefit_recommendations: BenefitRecommendationsOperations operations - :vartype benefit_recommendations: - azure.mgmt.costmanagement.operations.BenefitRecommendationsOperations - :ivar benefit_utilization_summaries: BenefitUtilizationSummariesOperations operations - :vartype benefit_utilization_summaries: - azure.mgmt.costmanagement.operations.BenefitUtilizationSummariesOperations :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str - :keyword api_version: Api Version. Default value is "2022-10-01". Note that overriding this + :keyword api_version: Api Version. Default value is "2023-03-01". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no @@ -100,19 +122,35 @@ def __init__( self, credential: "TokenCredential", base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: self._config = CostManagementClientConfiguration(credential=credential, **kwargs) - self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.views = ViewsOperations(self._client, self._config, self._serialize, self._deserialize) - self.alerts = AlertsOperations(self._client, self._config, self._serialize, self._deserialize) - self.forecast = ForecastOperations(self._client, self._config, self._serialize, self._deserialize) - self.dimensions = DimensionsOperations(self._client, self._config, self._serialize, self._deserialize) - self.query = QueryOperations(self._client, self._config, self._serialize, self._deserialize) - self.generate_reservation_details_report = GenerateReservationDetailsReportOperations( + self.benefit_recommendations = BenefitRecommendationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.benefit_utilization_summaries = BenefitUtilizationSummariesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.billing_account_scope = BillingAccountScopeOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.billing_profile_scope = BillingProfileScopeOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.reservation_order_scope = ReservationOrderScopeOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.reservation_scope = ReservationScopeOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.savings_plan_order_scope = SavingsPlanOrderScopeOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.savings_plan_scope = SavingsPlanScopeOperations( self._client, self._config, self._serialize, self._deserialize ) self.exports = ExportsOperations(self._client, self._config, self._serialize, self._deserialize) @@ -128,14 +166,16 @@ def __init__( self.generate_detailed_cost_report_operation_status = GenerateDetailedCostReportOperationStatusOperations( self._client, self._config, self._serialize, self._deserialize ) - self.price_sheet = PriceSheetOperations(self._client, self._config, self._serialize, self._deserialize) - self.scheduled_actions = ScheduledActionsOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.benefit_recommendations = BenefitRecommendationsOperations( + self.views = ViewsOperations(self._client, self._config, self._serialize, self._deserialize) + self.alerts = AlertsOperations(self._client, self._config, self._serialize, self._deserialize) + self.forecast = ForecastOperations(self._client, self._config, self._serialize, self._deserialize) + self.dimensions = DimensionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.query = QueryOperations(self._client, self._config, self._serialize, self._deserialize) + self.generate_reservation_details_report = GenerateReservationDetailsReportOperations( self._client, self._config, self._serialize, self._deserialize ) - self.benefit_utilization_summaries = BenefitUtilizationSummariesOperations( + self.price_sheet = PriceSheetOperations(self._client, self._config, self._serialize, self._deserialize) + self.scheduled_actions = ScheduledActionsOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -161,15 +201,12 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: request_copy.url = self._client.format_url(request_copy.url) return self._client.send_request(request_copy, **kwargs) - def close(self): - # type: () -> None + def close(self) -> None: self._client.close() - def __enter__(self): - # type: () -> CostManagementClient + def __enter__(self) -> "CostManagementClient": self._client.__enter__() return self - def __exit__(self, *exc_details): - # type: (Any) -> None + def __exit__(self, *exc_details: Any) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/_serialization.py b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/_serialization.py index 7c1dedb5133d..842ae727fbbc 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/_serialization.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/_serialization.py @@ -25,6 +25,7 @@ # -------------------------------------------------------------------------- # pylint: skip-file +# pyright: reportUnnecessaryTypeIgnoreComment=false from base64 import b64decode, b64encode import calendar @@ -37,23 +38,38 @@ import re import sys import codecs +from typing import ( + Dict, + Any, + cast, + Optional, + Union, + AnyStr, + IO, + Mapping, + Callable, + TypeVar, + MutableMapping, + Type, + List, + Mapping, +) try: from urllib import quote # type: ignore except ImportError: - from urllib.parse import quote # type: ignore + from urllib.parse import quote import xml.etree.ElementTree as ET -import isodate - -from typing import Dict, Any, cast, TYPE_CHECKING +import isodate # type: ignore from azure.core.exceptions import DeserializationError, SerializationError, raise_with_traceback +from azure.core.serialization import NULL as AzureCoreNull _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") -if TYPE_CHECKING: - from typing import Optional, Union, AnyStr, IO, Mapping +ModelType = TypeVar("ModelType", bound="Model") +JSON = MutableMapping[str, Any] class RawDeserializer: @@ -65,8 +81,7 @@ class RawDeserializer: CONTEXT_NAME = "deserialized_data" @classmethod - def deserialize_from_text(cls, data, content_type=None): - # type: (Optional[Union[AnyStr, IO]], Optional[str]) -> Any + def deserialize_from_text(cls, data: Optional[Union[AnyStr, IO]], content_type: Optional[str] = None) -> Any: """Decode data according to content-type. Accept a stream of data as well, but will be load at once in memory for now. @@ -132,8 +147,7 @@ def _json_attemp(data): raise DeserializationError("Cannot deserialize content-type: {}".format(content_type)) @classmethod - def deserialize_from_http_generics(cls, body_bytes, headers): - # type: (Optional[Union[AnyStr, IO]], Mapping) -> Any + def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], headers: Mapping) -> Any: """Deserialize from HTTP response. Use bytes and headers to NOT use any requests/aiohttp or whatever @@ -160,8 +174,8 @@ def deserialize_from_http_generics(cls, body_bytes, headers): basestring # type: ignore unicode_str = unicode # type: ignore except NameError: - basestring = str # type: ignore - unicode_str = str # type: ignore + basestring = str + unicode_str = str _LOGGER = logging.getLogger(__name__) @@ -188,7 +202,7 @@ def dst(self, dt): try: - from datetime import timezone as _FixedOffset + from datetime import timezone as _FixedOffset # type: ignore except ImportError: # Python 2.7 class _FixedOffset(datetime.tzinfo): # type: ignore @@ -219,7 +233,7 @@ def __getinitargs__(self): try: from datetime import timezone - TZ_UTC = timezone.utc # type: ignore + TZ_UTC = timezone.utc except ImportError: TZ_UTC = UTC() # type: ignore @@ -276,12 +290,12 @@ class Model(object): serialization and deserialization. """ - _subtype_map = {} # type: Dict[str, Dict[str, Any]] - _attribute_map = {} # type: Dict[str, Dict[str, Any]] - _validation = {} # type: Dict[str, Dict[str, Any]] + _subtype_map: Dict[str, Dict[str, Any]] = {} + _attribute_map: Dict[str, Dict[str, Any]] = {} + _validation: Dict[str, Dict[str, Any]] = {} - def __init__(self, **kwargs): - self.additional_properties = {} + def __init__(self, **kwargs: Any) -> None: + self.additional_properties: Dict[str, Any] = {} for k in kwargs: if k not in self._attribute_map: _LOGGER.warning("%s is not a known attribute of class %s and will be ignored", k, self.__class__) @@ -290,27 +304,27 @@ def __init__(self, **kwargs): else: setattr(self, k, kwargs[k]) - def __eq__(self, other): + def __eq__(self, other: Any) -> bool: """Compare objects by comparing all attributes.""" if isinstance(other, self.__class__): return self.__dict__ == other.__dict__ return False - def __ne__(self, other): + def __ne__(self, other: Any) -> bool: """Compare objects by comparing all attributes.""" return not self.__eq__(other) - def __str__(self): + def __str__(self) -> str: return str(self.__dict__) @classmethod - def enable_additional_properties_sending(cls): + def enable_additional_properties_sending(cls) -> None: cls._attribute_map["additional_properties"] = {"key": "", "type": "{object}"} @classmethod - def is_xml_model(cls): + def is_xml_model(cls) -> bool: try: - cls._xml_map + cls._xml_map # type: ignore except AttributeError: return False return True @@ -319,13 +333,13 @@ def is_xml_model(cls): def _create_xml_node(cls): """Create XML node.""" try: - xml_map = cls._xml_map + xml_map = cls._xml_map # type: ignore except AttributeError: xml_map = {} return _create_xml_node(xml_map.get("name", cls.__name__), xml_map.get("prefix", None), xml_map.get("ns", None)) - def serialize(self, keep_readonly=False, **kwargs): + def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: """Return the JSON that would be sent to azure from this model. This is an alias to `as_dict(full_restapi_key_transformer, keep_readonly=False)`. @@ -339,8 +353,13 @@ def serialize(self, keep_readonly=False, **kwargs): serializer = Serializer(self._infer_class_models()) return serializer._serialize(self, keep_readonly=keep_readonly, **kwargs) - def as_dict(self, keep_readonly=True, key_transformer=attribute_transformer, **kwargs): - """Return a dict that can be JSONify using json.dump. + def as_dict( + self, + keep_readonly: bool = True, + key_transformer: Callable[[str, Dict[str, Any], Any], Any] = attribute_transformer, + **kwargs: Any + ) -> JSON: + """Return a dict that can be serialized using json.dump. Advanced usage might optionally use a callback as parameter: @@ -387,7 +406,7 @@ def _infer_class_models(cls): return client_models @classmethod - def deserialize(cls, data, content_type=None): + def deserialize(cls: Type[ModelType], data: Any, content_type: Optional[str] = None) -> ModelType: """Parse a str using the RestAPI syntax and return a model. :param str data: A str using RestAPI structure. JSON by default. @@ -399,7 +418,12 @@ def deserialize(cls, data, content_type=None): return deserializer(cls.__name__, data, content_type=content_type) @classmethod - def from_dict(cls, data, key_extractors=None, content_type=None): + def from_dict( + cls: Type[ModelType], + data: Any, + key_extractors: Optional[Callable[[str, Dict[str, Any], Any], Any]] = None, + content_type: Optional[str] = None, + ) -> ModelType: """Parse a dict using given key extractor return a model. By default consider key @@ -412,8 +436,8 @@ def from_dict(cls, data, key_extractors=None, content_type=None): :raises: DeserializationError if something went wrong """ deserializer = Deserializer(cls._infer_class_models()) - deserializer.key_extractors = ( - [ + deserializer.key_extractors = ( # type: ignore + [ # type: ignore attribute_key_case_insensitive_extractor, rest_key_case_insensitive_extractor, last_rest_key_case_insensitive_extractor, @@ -453,7 +477,7 @@ def _classify(cls, response, objects): return cls flatten_mapping_type = cls._flatten_subtype(subtype_key, objects) try: - return objects[flatten_mapping_type[subtype_value]] + return objects[flatten_mapping_type[subtype_value]] # type: ignore except KeyError: _LOGGER.warning( "Subtype value %s has no mapping, use base class %s.", @@ -521,7 +545,7 @@ class Serializer(object): "multiple": lambda x, y: x % y != 0, } - def __init__(self, classes=None): + def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): self.serialize_type = { "iso-8601": Serializer.serialize_iso, "rfc-1123": Serializer.serialize_rfc, @@ -537,7 +561,7 @@ def __init__(self, classes=None): "[]": self.serialize_iter, "{}": self.serialize_dict, } - self.dependencies = dict(classes) if classes else {} + self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} self.key_transformer = full_restapi_key_transformer self.client_side_validation = True @@ -605,14 +629,14 @@ def _serialize(self, target_obj, data_type=None, **kwargs): if xml_desc.get("attr", False): if xml_ns: ET.register_namespace(xml_prefix, xml_ns) - xml_name = "{}{}".format(xml_ns, xml_name) - serialized.set(xml_name, new_attr) + xml_name = "{{{}}}{}".format(xml_ns, xml_name) + serialized.set(xml_name, new_attr) # type: ignore continue if xml_desc.get("text", False): - serialized.text = new_attr + serialized.text = new_attr # type: ignore continue if isinstance(new_attr, list): - serialized.extend(new_attr) + serialized.extend(new_attr) # type: ignore elif isinstance(new_attr, ET.Element): # If the down XML has no XML/Name, we MUST replace the tag with the local tag. But keeping the namespaces. if "name" not in getattr(orig_attr, "_xml_map", {}): @@ -621,23 +645,22 @@ def _serialize(self, target_obj, data_type=None, **kwargs): new_attr.tag = "}".join([splitted_tag[0], xml_name]) else: new_attr.tag = xml_name - serialized.append(new_attr) + serialized.append(new_attr) # type: ignore else: # That's a basic type # Integrate namespace if necessary local_node = _create_xml_node(xml_name, xml_prefix, xml_ns) local_node.text = unicode_str(new_attr) - serialized.append(local_node) + serialized.append(local_node) # type: ignore else: # JSON - for k in reversed(keys): - unflattened = {k: new_attr} - new_attr = unflattened + for k in reversed(keys): # type: ignore + new_attr = {k: new_attr} _new_attr = new_attr _serialized = serialized - for k in keys: + for k in keys: # type: ignore if k not in _serialized: - _serialized.update(_new_attr) - _new_attr = _new_attr[k] + _serialized.update(_new_attr) # type: ignore + _new_attr = _new_attr[k] # type: ignore _serialized = _serialized[k] except ValueError: continue @@ -659,8 +682,8 @@ def body(self, data, data_type, **kwargs): """ # Just in case this is a dict - internal_data_type = data_type.strip("[]{}") - internal_data_type = self.dependencies.get(internal_data_type, None) + internal_data_type_str = data_type.strip("[]{}") + internal_data_type = self.dependencies.get(internal_data_type_str, None) try: is_xml_model_serialization = kwargs["is_xml"] except KeyError: @@ -675,7 +698,7 @@ def body(self, data, data_type, **kwargs): # We're not able to deal with additional properties for now. deserializer.additional_properties_detection = False if is_xml_model_serialization: - deserializer.key_extractors = [ + deserializer.key_extractors = [ # type: ignore attribute_key_case_insensitive_extractor, ] else: @@ -780,6 +803,8 @@ def serialize_data(self, data, data_type, **kwargs): raise ValueError("No value for given attribute") try: + if data is AzureCoreNull: + return None if data_type in self.basic_types.values(): return self.serialize_basic(data, data_type, **kwargs) @@ -843,7 +868,7 @@ def serialize_unicode(cls, data): pass try: - if isinstance(data, unicode): + if isinstance(data, unicode): # type: ignore # Don't change it, JSON and XML ElementTree are totally able # to serialize correctly u'' strings return data @@ -1001,10 +1026,10 @@ def serialize_enum(attr, enum_obj=None): except AttributeError: result = attr try: - enum_obj(result) + enum_obj(result) # type: ignore return result except ValueError: - for enum_value in enum_obj: + for enum_value in enum_obj: # type: ignore if enum_value.value.lower() == str(attr).lower(): return enum_value.value error = "{!r} is not valid value for enum {!r}" @@ -1164,7 +1189,8 @@ def rest_key_extractor(attr, attr_desc, data): working_data = data while "." in key: - dict_keys = _FLATTEN.split(key) + # Need the cast, as for some reasons "split" is typed as list[str | Any] + dict_keys = cast(List[str], _FLATTEN.split(key)) if len(dict_keys) == 1: key = _decode_attribute_map_key(dict_keys[0]) break @@ -1245,7 +1271,7 @@ def _extract_name_from_internal_type(internal_type): xml_name = internal_type_xml_map.get("name", internal_type.__name__) xml_ns = internal_type_xml_map.get("ns", None) if xml_ns: - xml_name = "{}{}".format(xml_ns, xml_name) + xml_name = "{{{}}}{}".format(xml_ns, xml_name) return xml_name @@ -1269,7 +1295,7 @@ def xml_key_extractor(attr, attr_desc, data): # Integrate namespace if necessary xml_ns = xml_desc.get("ns", internal_type_xml_map.get("ns", None)) if xml_ns: - xml_name = "{}{}".format(xml_ns, xml_name) + xml_name = "{{{}}}{}".format(xml_ns, xml_name) # If it's an attribute, that's simple if xml_desc.get("attr", False): @@ -1335,7 +1361,7 @@ class Deserializer(object): valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}" r"\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") - def __init__(self, classes=None): + def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): self.deserialize_type = { "iso-8601": Deserializer.deserialize_iso, "rfc-1123": Deserializer.deserialize_rfc, @@ -1355,7 +1381,7 @@ def __init__(self, classes=None): "duration": (isodate.Duration, datetime.timedelta), "iso-8601": (datetime.datetime), } - self.dependencies = dict(classes) if classes else {} + self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} self.key_extractors = [rest_key_extractor, xml_key_extractor] # Additional properties only works if the "rest_key_extractor" is used to # extract the keys. Making it to work whatever the key extractor is too much @@ -1416,7 +1442,7 @@ def _deserialize(self, target_obj, data): if data is None: return data try: - attributes = response._attribute_map + attributes = response._attribute_map # type: ignore d_attrs = {} for attr, attr_desc in attributes.items(): # Check empty string. If it's not empty, someone has a real "additionalProperties"... @@ -1444,7 +1470,7 @@ def _deserialize(self, target_obj, data): value = self.deserialize_data(raw_value, attr_desc["type"]) d_attrs[attr] = value except (AttributeError, TypeError, KeyError) as err: - msg = "Unable to deserialize to object: " + class_name + msg = "Unable to deserialize to object: " + class_name # type: ignore raise_with_traceback(DeserializationError, msg, err) else: additional_properties = self._build_additional_properties(attributes, data) @@ -1474,7 +1500,7 @@ def _classify_target(self, target, data): Once classification has been determined, initialize object. :param str target: The target object type to deserialize to. - :param str/dict data: The response data to deseralize. + :param str/dict data: The response data to deserialize. """ if target is None: return None, None @@ -1489,7 +1515,7 @@ def _classify_target(self, target, data): target = target._classify(data, self.dependencies) except AttributeError: pass # Target is not a Model, no classify - return target, target.__class__.__name__ + return target, target.__class__.__name__ # type: ignore def failsafe_deserialize(self, target_obj, data, content_type=None): """Ignores any errors encountered in deserialization, @@ -1499,7 +1525,7 @@ def failsafe_deserialize(self, target_obj, data, content_type=None): a deserialization error. :param str target_obj: The target object type to deserialize to. - :param str/dict data: The response data to deseralize. + :param str/dict data: The response data to deserialize. :param str content_type: Swagger "produces" if available. """ try: @@ -1543,7 +1569,7 @@ def _unpack_content(raw_data, content_type=None): return RawDeserializer.deserialize_from_http_generics(raw_data.text, raw_data.headers) if isinstance(raw_data, (basestring, bytes)) or hasattr(raw_data, "read"): - return RawDeserializer.deserialize_from_text(raw_data, content_type) + return RawDeserializer.deserialize_from_text(raw_data, content_type) # type: ignore return raw_data def _instantiate_model(self, response, attrs, additional_properties=None): @@ -1565,7 +1591,7 @@ def _instantiate_model(self, response, attrs, additional_properties=None): response_obj.additional_properties = additional_properties return response_obj except TypeError as err: - msg = "Unable to deserialize {} into model {}. ".format(kwargs, response) + msg = "Unable to deserialize {} into model {}. ".format(kwargs, response) # type: ignore raise DeserializationError(msg + str(err)) else: try: @@ -1747,7 +1773,7 @@ def deserialize_unicode(data): # Consider this is real string try: - if isinstance(data, unicode): + if isinstance(data, unicode): # type: ignore return data except NameError: return str(data) @@ -1798,7 +1824,7 @@ def deserialize_bytearray(attr): """ if isinstance(attr, ET.Element): attr = attr.text - return bytearray(b64decode(attr)) + return bytearray(b64decode(attr)) # type: ignore @staticmethod def deserialize_base64(attr): @@ -1810,8 +1836,8 @@ def deserialize_base64(attr): """ if isinstance(attr, ET.Element): attr = attr.text - padding = "=" * (3 - (len(attr) + 3) % 4) - attr = attr + padding + padding = "=" * (3 - (len(attr) + 3) % 4) # type: ignore + attr = attr + padding # type: ignore encoded = attr.replace("-", "+").replace("_", "/") return b64decode(encoded) @@ -1826,7 +1852,7 @@ def deserialize_decimal(attr): if isinstance(attr, ET.Element): attr = attr.text try: - return decimal.Decimal(attr) + return decimal.Decimal(attr) # type: ignore except decimal.DecimalException as err: msg = "Invalid decimal {}".format(attr) raise_with_traceback(DeserializationError, msg, err) @@ -1841,7 +1867,7 @@ def deserialize_long(attr): """ if isinstance(attr, ET.Element): attr = attr.text - return _long_type(attr) + return _long_type(attr) # type: ignore @staticmethod def deserialize_duration(attr): @@ -1871,7 +1897,7 @@ def deserialize_date(attr): """ if isinstance(attr, ET.Element): attr = attr.text - if re.search(r"[^\W\d_]", attr, re.I + re.U): + if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore raise DeserializationError("Date must have only digits and -. Received: %s" % attr) # This must NOT use defaultmonth/defaultday. Using None ensure this raises an exception. return isodate.parse_date(attr, defaultmonth=None, defaultday=None) @@ -1886,7 +1912,7 @@ def deserialize_time(attr): """ if isinstance(attr, ET.Element): attr = attr.text - if re.search(r"[^\W\d_]", attr, re.I + re.U): + if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore raise DeserializationError("Date must have only digits and -. Received: %s" % attr) return isodate.parse_time(attr) @@ -1901,7 +1927,7 @@ def deserialize_rfc(attr): if isinstance(attr, ET.Element): attr = attr.text try: - parsed_date = email.utils.parsedate_tz(attr) + parsed_date = email.utils.parsedate_tz(attr) # type: ignore date_obj = datetime.datetime( *parsed_date[:6], tzinfo=_FixedOffset(datetime.timedelta(minutes=(parsed_date[9] or 0) / 60)) ) @@ -1924,7 +1950,7 @@ def deserialize_iso(attr): if isinstance(attr, ET.Element): attr = attr.text try: - attr = attr.upper() + attr = attr.upper() # type: ignore match = Deserializer.valid_date.match(attr) if not match: raise ValueError("Invalid datetime string: " + attr) @@ -1960,7 +1986,7 @@ def deserialize_unix(attr): :raises: DeserializationError if format invalid """ if isinstance(attr, ET.Element): - attr = int(attr.text) + attr = int(attr.text) # type: ignore try: date_obj = datetime.datetime.fromtimestamp(attr, TZ_UTC) except ValueError as err: diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/_vendor.py b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/_vendor.py index 9aad73fc743e..bd0df84f5319 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/_vendor.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/_vendor.py @@ -5,6 +5,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import List, cast + from azure.core.pipeline.transport import HttpRequest @@ -22,6 +24,7 @@ def _format_url_section(template, **kwargs): try: return template.format(**kwargs) except KeyError as key: - formatted_components = template.split("/") + # Need the cast, as for some reasons "split" is typed as list[str | Any] + formatted_components = cast(List[str], template.split("/")) components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/_version.py b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/_version.py index 3073d7c910a0..e5754a47ce68 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/_version.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "4.0.0b1" +VERSION = "1.0.0b1" diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/__init__.py b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/__init__.py index b7a880c83975..e631aab7dc99 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/__init__.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/__init__.py @@ -10,7 +10,7 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/_configuration.py b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/_configuration.py index 585b86de08bd..a7ddd14a13e9 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/_configuration.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/_configuration.py @@ -6,7 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -15,11 +14,6 @@ from .._version import VERSION -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports - if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential @@ -33,14 +27,14 @@ class CostManagementClientConfiguration(Configuration): # pylint: disable=too-m :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :keyword api_version: Api Version. Default value is "2022-10-01". Note that overriding this + :keyword api_version: Api Version. Default value is "2023-03-01". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ def __init__(self, credential: "AsyncTokenCredential", **kwargs: Any) -> None: super(CostManagementClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2022-10-01") # type: Literal["2022-10-01"] + api_version: str = kwargs.pop("api_version", "2023-03-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/_cost_management_client.py b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/_cost_management_client.py index 0b26c3c423d1..55a4e87dc02c 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/_cost_management_client.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/_cost_management_client.py @@ -12,13 +12,15 @@ from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient -from .. import models +from .. import models as _models from .._serialization import Deserializer, Serializer from ._configuration import CostManagementClientConfiguration from .operations import ( AlertsOperations, BenefitRecommendationsOperations, BenefitUtilizationSummariesOperations, + BillingAccountScopeOperations, + BillingProfileScopeOperations, DimensionsOperations, ExportsOperations, ForecastOperations, @@ -30,6 +32,10 @@ Operations, PriceSheetOperations, QueryOperations, + ReservationOrderScopeOperations, + ReservationScopeOperations, + SavingsPlanOrderScopeOperations, + SavingsPlanScopeOperations, ScheduledActionsOperations, ViewsOperations, ) @@ -45,20 +51,29 @@ class CostManagementClient: # pylint: disable=client-accepts-api-version-keywor :ivar operations: Operations operations :vartype operations: azure.mgmt.costmanagement.aio.operations.Operations - :ivar views: ViewsOperations operations - :vartype views: azure.mgmt.costmanagement.aio.operations.ViewsOperations - :ivar alerts: AlertsOperations operations - :vartype alerts: azure.mgmt.costmanagement.aio.operations.AlertsOperations - :ivar forecast: ForecastOperations operations - :vartype forecast: azure.mgmt.costmanagement.aio.operations.ForecastOperations - :ivar dimensions: DimensionsOperations operations - :vartype dimensions: azure.mgmt.costmanagement.aio.operations.DimensionsOperations - :ivar query: QueryOperations operations - :vartype query: azure.mgmt.costmanagement.aio.operations.QueryOperations - :ivar generate_reservation_details_report: GenerateReservationDetailsReportOperations - operations - :vartype generate_reservation_details_report: - azure.mgmt.costmanagement.aio.operations.GenerateReservationDetailsReportOperations + :ivar benefit_recommendations: BenefitRecommendationsOperations operations + :vartype benefit_recommendations: + azure.mgmt.costmanagement.aio.operations.BenefitRecommendationsOperations + :ivar benefit_utilization_summaries: BenefitUtilizationSummariesOperations operations + :vartype benefit_utilization_summaries: + azure.mgmt.costmanagement.aio.operations.BenefitUtilizationSummariesOperations + :ivar billing_account_scope: BillingAccountScopeOperations operations + :vartype billing_account_scope: + azure.mgmt.costmanagement.aio.operations.BillingAccountScopeOperations + :ivar billing_profile_scope: BillingProfileScopeOperations operations + :vartype billing_profile_scope: + azure.mgmt.costmanagement.aio.operations.BillingProfileScopeOperations + :ivar reservation_order_scope: ReservationOrderScopeOperations operations + :vartype reservation_order_scope: + azure.mgmt.costmanagement.aio.operations.ReservationOrderScopeOperations + :ivar reservation_scope: ReservationScopeOperations operations + :vartype reservation_scope: azure.mgmt.costmanagement.aio.operations.ReservationScopeOperations + :ivar savings_plan_order_scope: SavingsPlanOrderScopeOperations operations + :vartype savings_plan_order_scope: + azure.mgmt.costmanagement.aio.operations.SavingsPlanOrderScopeOperations + :ivar savings_plan_scope: SavingsPlanScopeOperations operations + :vartype savings_plan_scope: + azure.mgmt.costmanagement.aio.operations.SavingsPlanScopeOperations :ivar exports: ExportsOperations operations :vartype exports: azure.mgmt.costmanagement.aio.operations.ExportsOperations :ivar generate_cost_details_report: GenerateCostDetailsReportOperations operations @@ -75,21 +90,29 @@ class CostManagementClient: # pylint: disable=client-accepts-api-version-keywor GenerateDetailedCostReportOperationStatusOperations operations :vartype generate_detailed_cost_report_operation_status: azure.mgmt.costmanagement.aio.operations.GenerateDetailedCostReportOperationStatusOperations + :ivar views: ViewsOperations operations + :vartype views: azure.mgmt.costmanagement.aio.operations.ViewsOperations + :ivar alerts: AlertsOperations operations + :vartype alerts: azure.mgmt.costmanagement.aio.operations.AlertsOperations + :ivar forecast: ForecastOperations operations + :vartype forecast: azure.mgmt.costmanagement.aio.operations.ForecastOperations + :ivar dimensions: DimensionsOperations operations + :vartype dimensions: azure.mgmt.costmanagement.aio.operations.DimensionsOperations + :ivar query: QueryOperations operations + :vartype query: azure.mgmt.costmanagement.aio.operations.QueryOperations + :ivar generate_reservation_details_report: GenerateReservationDetailsReportOperations + operations + :vartype generate_reservation_details_report: + azure.mgmt.costmanagement.aio.operations.GenerateReservationDetailsReportOperations :ivar price_sheet: PriceSheetOperations operations :vartype price_sheet: azure.mgmt.costmanagement.aio.operations.PriceSheetOperations :ivar scheduled_actions: ScheduledActionsOperations operations :vartype scheduled_actions: azure.mgmt.costmanagement.aio.operations.ScheduledActionsOperations - :ivar benefit_recommendations: BenefitRecommendationsOperations operations - :vartype benefit_recommendations: - azure.mgmt.costmanagement.aio.operations.BenefitRecommendationsOperations - :ivar benefit_utilization_summaries: BenefitUtilizationSummariesOperations operations - :vartype benefit_utilization_summaries: - azure.mgmt.costmanagement.aio.operations.BenefitUtilizationSummariesOperations :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str - :keyword api_version: Api Version. Default value is "2022-10-01". Note that overriding this + :keyword api_version: Api Version. Default value is "2023-03-01". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no @@ -100,19 +123,35 @@ def __init__( self, credential: "AsyncTokenCredential", base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: self._config = CostManagementClientConfiguration(credential=credential, **kwargs) - self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.views = ViewsOperations(self._client, self._config, self._serialize, self._deserialize) - self.alerts = AlertsOperations(self._client, self._config, self._serialize, self._deserialize) - self.forecast = ForecastOperations(self._client, self._config, self._serialize, self._deserialize) - self.dimensions = DimensionsOperations(self._client, self._config, self._serialize, self._deserialize) - self.query = QueryOperations(self._client, self._config, self._serialize, self._deserialize) - self.generate_reservation_details_report = GenerateReservationDetailsReportOperations( + self.benefit_recommendations = BenefitRecommendationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.benefit_utilization_summaries = BenefitUtilizationSummariesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.billing_account_scope = BillingAccountScopeOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.billing_profile_scope = BillingProfileScopeOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.reservation_order_scope = ReservationOrderScopeOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.reservation_scope = ReservationScopeOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.savings_plan_order_scope = SavingsPlanOrderScopeOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.savings_plan_scope = SavingsPlanScopeOperations( self._client, self._config, self._serialize, self._deserialize ) self.exports = ExportsOperations(self._client, self._config, self._serialize, self._deserialize) @@ -128,14 +167,16 @@ def __init__( self.generate_detailed_cost_report_operation_status = GenerateDetailedCostReportOperationStatusOperations( self._client, self._config, self._serialize, self._deserialize ) - self.price_sheet = PriceSheetOperations(self._client, self._config, self._serialize, self._deserialize) - self.scheduled_actions = ScheduledActionsOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.benefit_recommendations = BenefitRecommendationsOperations( + self.views = ViewsOperations(self._client, self._config, self._serialize, self._deserialize) + self.alerts = AlertsOperations(self._client, self._config, self._serialize, self._deserialize) + self.forecast = ForecastOperations(self._client, self._config, self._serialize, self._deserialize) + self.dimensions = DimensionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.query = QueryOperations(self._client, self._config, self._serialize, self._deserialize) + self.generate_reservation_details_report = GenerateReservationDetailsReportOperations( self._client, self._config, self._serialize, self._deserialize ) - self.benefit_utilization_summaries = BenefitUtilizationSummariesOperations( + self.price_sheet = PriceSheetOperations(self._client, self._config, self._serialize, self._deserialize) + self.scheduled_actions = ScheduledActionsOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -168,5 +209,5 @@ async def __aenter__(self) -> "CostManagementClient": await self._client.__aenter__() return self - async def __aexit__(self, *exc_details) -> None: + async def __aexit__(self, *exc_details: Any) -> None: await self._client.__aexit__(*exc_details) diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/__init__.py b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/__init__.py index 2d305a7dc351..e1655f86453e 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/__init__.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/__init__.py @@ -7,12 +7,14 @@ # -------------------------------------------------------------------------- from ._operations import Operations -from ._views_operations import ViewsOperations -from ._alerts_operations import AlertsOperations -from ._forecast_operations import ForecastOperations -from ._dimensions_operations import DimensionsOperations -from ._query_operations import QueryOperations -from ._generate_reservation_details_report_operations import GenerateReservationDetailsReportOperations +from ._benefit_recommendations_operations import BenefitRecommendationsOperations +from ._benefit_utilization_summaries_operations import BenefitUtilizationSummariesOperations +from ._billing_account_scope_operations import BillingAccountScopeOperations +from ._billing_profile_scope_operations import BillingProfileScopeOperations +from ._reservation_order_scope_operations import ReservationOrderScopeOperations +from ._reservation_scope_operations import ReservationScopeOperations +from ._savings_plan_order_scope_operations import SavingsPlanOrderScopeOperations +from ._savings_plan_scope_operations import SavingsPlanScopeOperations from ._exports_operations import ExportsOperations from ._generate_cost_details_report_operations import GenerateCostDetailsReportOperations from ._generate_detailed_cost_report_operations import GenerateDetailedCostReportOperations @@ -22,32 +24,42 @@ from ._generate_detailed_cost_report_operation_status_operations import ( GenerateDetailedCostReportOperationStatusOperations, ) +from ._views_operations import ViewsOperations +from ._alerts_operations import AlertsOperations +from ._forecast_operations import ForecastOperations +from ._dimensions_operations import DimensionsOperations +from ._query_operations import QueryOperations +from ._generate_reservation_details_report_operations import GenerateReservationDetailsReportOperations from ._price_sheet_operations import PriceSheetOperations from ._scheduled_actions_operations import ScheduledActionsOperations -from ._benefit_recommendations_operations import BenefitRecommendationsOperations -from ._benefit_utilization_summaries_operations import BenefitUtilizationSummariesOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ "Operations", + "BenefitRecommendationsOperations", + "BenefitUtilizationSummariesOperations", + "BillingAccountScopeOperations", + "BillingProfileScopeOperations", + "ReservationOrderScopeOperations", + "ReservationScopeOperations", + "SavingsPlanOrderScopeOperations", + "SavingsPlanScopeOperations", + "ExportsOperations", + "GenerateCostDetailsReportOperations", + "GenerateDetailedCostReportOperations", + "GenerateDetailedCostReportOperationResultsOperations", + "GenerateDetailedCostReportOperationStatusOperations", "ViewsOperations", "AlertsOperations", "ForecastOperations", "DimensionsOperations", "QueryOperations", "GenerateReservationDetailsReportOperations", - "ExportsOperations", - "GenerateCostDetailsReportOperations", - "GenerateDetailedCostReportOperations", - "GenerateDetailedCostReportOperationResultsOperations", - "GenerateDetailedCostReportOperationStatusOperations", "PriceSheetOperations", "ScheduledActionsOperations", - "BenefitRecommendationsOperations", - "BenefitUtilizationSummariesOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_alerts_operations.py b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_alerts_operations.py index c24ac2826010..aac3086e4d30 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_alerts_operations.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_alerts_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -33,10 +33,6 @@ build_list_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -64,6 +60,9 @@ def __init__(self, *args, **kwargs) -> None: async def list(self, scope: str, **kwargs: Any) -> _models.AlertsResult: """Lists the alerts for scope defined. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :param scope: The scope associated with alerts operations. This includes '/subscriptions/{subscriptionId}/' for subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, @@ -97,10 +96,8 @@ async def list(self, scope: str, **kwargs: Any) -> _models.AlertsResult: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AlertsResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.AlertsResult] = kwargs.pop("cls", None) request = build_list_request( scope=scope, @@ -110,10 +107,11 @@ async def list(self, scope: str, **kwargs: Any) -> _models.AlertsResult: params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -130,12 +128,15 @@ async def list(self, scope: str, **kwargs: Any) -> _models.AlertsResult: return deserialized - list.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/alerts"} # type: ignore + list.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/alerts"} @distributed_trace_async async def get(self, scope: str, alert_id: str, **kwargs: Any) -> _models.Alert: """Gets the alert for the scope by alert ID. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :param scope: The scope associated with alerts operations. This includes '/subscriptions/{subscriptionId}/' for subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, @@ -171,10 +172,8 @@ async def get(self, scope: str, alert_id: str, **kwargs: Any) -> _models.Alert: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Alert] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.Alert] = kwargs.pop("cls", None) request = build_get_request( scope=scope, @@ -185,10 +184,11 @@ async def get(self, scope: str, alert_id: str, **kwargs: Any) -> _models.Alert: params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -205,7 +205,7 @@ async def get(self, scope: str, alert_id: str, **kwargs: Any) -> _models.Alert: return deserialized - get.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/alerts/{alertId}"} # type: ignore + get.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/alerts/{alertId}"} @overload async def dismiss( @@ -219,6 +219,9 @@ async def dismiss( ) -> _models.Alert: """Dismisses the specified alert. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :param scope: The scope associated with alerts operations. This includes '/subscriptions/{subscriptionId}/' for subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, @@ -255,6 +258,9 @@ async def dismiss( ) -> _models.Alert: """Dismisses the specified alert. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :param scope: The scope associated with alerts operations. This includes '/subscriptions/{subscriptionId}/' for subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, @@ -291,6 +297,9 @@ async def dismiss( ) -> _models.Alert: """Dismisses the specified alert. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :param scope: The scope associated with alerts operations. This includes '/subscriptions/{subscriptionId}/' for subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, @@ -310,8 +319,8 @@ async def dismiss( :type scope: str :param alert_id: Alert ID. Required. :type alert_id: str - :param parameters: Parameters supplied to the Dismiss Alert operation. Is either a model type - or a IO type. Required. + :param parameters: Parameters supplied to the Dismiss Alert operation. Is either a + DismissAlertPayload type or a IO type. Required. :type parameters: ~azure.mgmt.costmanagement.models.DismissAlertPayload or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -332,16 +341,14 @@ async def dismiss( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Alert] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Alert] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "DismissAlertPayload") @@ -358,10 +365,11 @@ async def dismiss( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -378,7 +386,7 @@ async def dismiss( return deserialized - dismiss.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/alerts/{alertId}"} # type: ignore + dismiss.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/alerts/{alertId}"} @distributed_trace_async async def list_external( @@ -389,6 +397,9 @@ async def list_external( ) -> _models.AlertsResult: """Lists the Alerts for external cloud provider type defined. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :param external_cloud_provider_type: The external cloud provider type associated with dimension/query operations. This includes 'externalSubscriptions' for linked account and 'externalBillingAccounts' for consolidated account. Known values are: "externalSubscriptions" @@ -415,10 +426,8 @@ async def list_external( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AlertsResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.AlertsResult] = kwargs.pop("cls", None) request = build_list_external_request( external_cloud_provider_type=external_cloud_provider_type, @@ -429,10 +438,11 @@ async def list_external( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -449,4 +459,6 @@ async def list_external( return deserialized - list_external.metadata = {"url": "/providers/Microsoft.CostManagement/{externalCloudProviderType}/{externalCloudProviderId}/alerts"} # type: ignore + list_external.metadata = { + "url": "/providers/Microsoft.CostManagement/{externalCloudProviderType}/{externalCloudProviderId}/alerts" + } diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_benefit_recommendations_operations.py b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_benefit_recommendations_operations.py index 95dfa1cd9532..cafa32b3d00d 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_benefit_recommendations_operations.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_benefit_recommendations_operations.py @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse @@ -30,10 +29,6 @@ from ..._vendor import _convert_request from ...operations._benefit_recommendations_operations import build_list_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -68,6 +63,9 @@ def list( ) -> AsyncIterable["_models.BenefitRecommendationModel"]: """List of recommendations for purchasing savings plan. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/CostManagement/ + :param billing_scope: The scope associated with benefit recommendation operations. This includes '/subscriptions/{subscriptionId}/' for subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resource group scope, @@ -99,10 +97,8 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.BenefitRecommendationsListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.BenefitRecommendationsListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -126,7 +122,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -142,7 +138,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -150,14 +146,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("BenefitRecommendationsListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -170,4 +167,4 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/{billingScope}/providers/Microsoft.CostManagement/benefitRecommendations"} # type: ignore + list.metadata = {"url": "/{billingScope}/providers/Microsoft.CostManagement/benefitRecommendations"} diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_benefit_utilization_summaries_operations.py b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_benefit_utilization_summaries_operations.py index e38164f1b6da..81caf0cefc6f 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_benefit_utilization_summaries_operations.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_benefit_utilization_summaries_operations.py @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union import urllib.parse @@ -35,10 +34,6 @@ build_list_by_savings_plan_order_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -73,6 +68,9 @@ def list_by_billing_account_id( """Lists savings plan utilization summaries for the enterprise agreement scope. Supported at grain values: 'Daily' and 'Monthly'. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/cost-management/ + :param billing_account_id: Billing account ID. Required. :type billing_account_id: str :param grain_parameter: Grain. Known values are: "Hourly", "Daily", and "Monthly". Default @@ -91,10 +89,8 @@ def list_by_billing_account_id( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.BenefitUtilizationSummariesListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.BenefitUtilizationSummariesListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -117,7 +113,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -133,7 +129,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -141,14 +137,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("BenefitUtilizationSummariesListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -161,7 +158,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_billing_account_id.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.CostManagement/benefitUtilizationSummaries"} # type: ignore + list_by_billing_account_id.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.CostManagement/benefitUtilizationSummaries" + } @distributed_trace def list_by_billing_profile_id( @@ -175,6 +174,9 @@ def list_by_billing_profile_id( """Lists savings plan utilization summaries for billing profile. Supported at grain values: 'Daily' and 'Monthly'. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/cost-management/ + :param billing_account_id: Billing account ID. Required. :type billing_account_id: str :param billing_profile_id: Billing profile ID. Required. @@ -195,10 +197,8 @@ def list_by_billing_profile_id( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.BenefitUtilizationSummariesListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.BenefitUtilizationSummariesListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -222,7 +222,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -238,7 +238,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -246,14 +246,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("BenefitUtilizationSummariesListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -266,7 +267,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_billing_profile_id.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/providers/Microsoft.CostManagement/benefitUtilizationSummaries"} # type: ignore + list_by_billing_profile_id.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/providers/Microsoft.CostManagement/benefitUtilizationSummaries" + } @distributed_trace def list_by_savings_plan_order( @@ -278,6 +281,9 @@ def list_by_savings_plan_order( ) -> AsyncIterable["_models.BenefitUtilizationSummary"]: """Lists the savings plan utilization summaries for daily or monthly grain. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/cost-management/ + :param savings_plan_order_id: Savings plan order ID. Required. :type savings_plan_order_id: str :param filter: Supports filtering by properties/usageDate. Default value is None. @@ -295,10 +301,8 @@ def list_by_savings_plan_order( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.BenefitUtilizationSummariesListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.BenefitUtilizationSummariesListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -321,7 +325,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -337,7 +341,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -345,14 +349,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("BenefitUtilizationSummariesListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -365,7 +370,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_savings_plan_order.metadata = {"url": "/providers/Microsoft.BillingBenefits/savingsPlanOrders/{savingsPlanOrderId}/providers/Microsoft.CostManagement/benefitUtilizationSummaries"} # type: ignore + list_by_savings_plan_order.metadata = { + "url": "/providers/Microsoft.BillingBenefits/savingsPlanOrders/{savingsPlanOrderId}/providers/Microsoft.CostManagement/benefitUtilizationSummaries" + } @distributed_trace def list_by_savings_plan_id( @@ -378,6 +385,9 @@ def list_by_savings_plan_id( ) -> AsyncIterable["_models.BenefitUtilizationSummary"]: """Lists the savings plan utilization summaries for daily or monthly grain. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/cost-management/ + :param savings_plan_order_id: Savings plan order ID. Required. :type savings_plan_order_id: str :param savings_plan_id: Savings plan ID. Required. @@ -397,10 +407,8 @@ def list_by_savings_plan_id( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.BenefitUtilizationSummariesListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.BenefitUtilizationSummariesListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -424,7 +432,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -440,7 +448,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -448,14 +456,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("BenefitUtilizationSummariesListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -468,4 +477,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_savings_plan_id.metadata = {"url": "/providers/Microsoft.BillingBenefits/savingsPlanOrders/{savingsPlanOrderId}/savingsPlans/{savingsPlanId}/providers/Microsoft.CostManagement/benefitUtilizationSummaries"} # type: ignore + list_by_savings_plan_id.metadata = { + "url": "/providers/Microsoft.BillingBenefits/savingsPlanOrders/{savingsPlanOrderId}/savingsPlans/{savingsPlanId}/providers/Microsoft.CostManagement/benefitUtilizationSummaries" + } diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_billing_account_scope_operations.py b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_billing_account_scope_operations.py new file mode 100644 index 000000000000..d7393b4bdc88 --- /dev/null +++ b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_billing_account_scope_operations.py @@ -0,0 +1,288 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._billing_account_scope_operations import build_generate_benefit_utilization_summaries_report_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class BillingAccountScopeOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.costmanagement.aio.CostManagementClient`'s + :attr:`billing_account_scope` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + async def _generate_benefit_utilization_summaries_report_initial( + self, + billing_account_id: str, + benefit_utilization_summaries_request: Union[_models.BenefitUtilizationSummariesRequest, IO], + **kwargs: Any + ) -> Optional[_models.BenefitUtilizationSummariesOperationStatus]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.BenefitUtilizationSummariesOperationStatus]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(benefit_utilization_summaries_request, (IOBase, bytes)): + _content = benefit_utilization_summaries_request + else: + _json = self._serialize.body(benefit_utilization_summaries_request, "BenefitUtilizationSummariesRequest") + + request = build_generate_benefit_utilization_summaries_report_request( + billing_account_id=billing_account_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._generate_benefit_utilization_summaries_report_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseAutoGenerated, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("BenefitUtilizationSummariesOperationStatus", pipeline_response) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _generate_benefit_utilization_summaries_report_initial.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.CostManagement/generateBenefitUtilizationSummariesReport" + } + + @overload + async def begin_generate_benefit_utilization_summaries_report( + self, + billing_account_id: str, + benefit_utilization_summaries_request: _models.BenefitUtilizationSummariesRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.BenefitUtilizationSummariesOperationStatus]: + """Triggers generation of a benefit utilization summaries report for the provided billing account. + This API supports only enrollment accounts. + + .. seealso:: + - https://docs.microsoft.com/rest/api/cost-management/ + + :param billing_account_id: Billing account ID. Required. + :type billing_account_id: str + :param benefit_utilization_summaries_request: Async Benefit Utilization Summary report to be + created. Required. + :type benefit_utilization_summaries_request: + ~azure.mgmt.costmanagement.models.BenefitUtilizationSummariesRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either + BenefitUtilizationSummariesOperationStatus or the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.costmanagement.models.BenefitUtilizationSummariesOperationStatus] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_generate_benefit_utilization_summaries_report( + self, + billing_account_id: str, + benefit_utilization_summaries_request: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.BenefitUtilizationSummariesOperationStatus]: + """Triggers generation of a benefit utilization summaries report for the provided billing account. + This API supports only enrollment accounts. + + .. seealso:: + - https://docs.microsoft.com/rest/api/cost-management/ + + :param billing_account_id: Billing account ID. Required. + :type billing_account_id: str + :param benefit_utilization_summaries_request: Async Benefit Utilization Summary report to be + created. Required. + :type benefit_utilization_summaries_request: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either + BenefitUtilizationSummariesOperationStatus or the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.costmanagement.models.BenefitUtilizationSummariesOperationStatus] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_generate_benefit_utilization_summaries_report( + self, + billing_account_id: str, + benefit_utilization_summaries_request: Union[_models.BenefitUtilizationSummariesRequest, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.BenefitUtilizationSummariesOperationStatus]: + """Triggers generation of a benefit utilization summaries report for the provided billing account. + This API supports only enrollment accounts. + + .. seealso:: + - https://docs.microsoft.com/rest/api/cost-management/ + + :param billing_account_id: Billing account ID. Required. + :type billing_account_id: str + :param benefit_utilization_summaries_request: Async Benefit Utilization Summary report to be + created. Is either a BenefitUtilizationSummariesRequest type or a IO type. Required. + :type benefit_utilization_summaries_request: + ~azure.mgmt.costmanagement.models.BenefitUtilizationSummariesRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either + BenefitUtilizationSummariesOperationStatus or the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.costmanagement.models.BenefitUtilizationSummariesOperationStatus] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.BenefitUtilizationSummariesOperationStatus] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._generate_benefit_utilization_summaries_report_initial( + billing_account_id=billing_account_id, + benefit_utilization_summaries_request=benefit_utilization_summaries_request, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("BenefitUtilizationSummariesOperationStatus", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_generate_benefit_utilization_summaries_report.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.CostManagement/generateBenefitUtilizationSummariesReport" + } diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_billing_profile_scope_operations.py b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_billing_profile_scope_operations.py new file mode 100644 index 000000000000..87b73fe869ab --- /dev/null +++ b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_billing_profile_scope_operations.py @@ -0,0 +1,300 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._billing_profile_scope_operations import build_generate_benefit_utilization_summaries_report_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class BillingProfileScopeOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.costmanagement.aio.CostManagementClient`'s + :attr:`billing_profile_scope` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + async def _generate_benefit_utilization_summaries_report_initial( + self, + billing_account_id: str, + billing_profile_id: str, + benefit_utilization_summaries_request: Union[_models.BenefitUtilizationSummariesRequest, IO], + **kwargs: Any + ) -> Optional[_models.BenefitUtilizationSummariesOperationStatus]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.BenefitUtilizationSummariesOperationStatus]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(benefit_utilization_summaries_request, (IOBase, bytes)): + _content = benefit_utilization_summaries_request + else: + _json = self._serialize.body(benefit_utilization_summaries_request, "BenefitUtilizationSummariesRequest") + + request = build_generate_benefit_utilization_summaries_report_request( + billing_account_id=billing_account_id, + billing_profile_id=billing_profile_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._generate_benefit_utilization_summaries_report_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseAutoGenerated, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("BenefitUtilizationSummariesOperationStatus", pipeline_response) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _generate_benefit_utilization_summaries_report_initial.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/providers/Microsoft.CostManagement/generateBenefitUtilizationSummariesReport" + } + + @overload + async def begin_generate_benefit_utilization_summaries_report( + self, + billing_account_id: str, + billing_profile_id: str, + benefit_utilization_summaries_request: _models.BenefitUtilizationSummariesRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.BenefitUtilizationSummariesOperationStatus]: + """Triggers generation of a benefit utilization summaries report for the provided billing account + and billing profile. + + .. seealso:: + - https://docs.microsoft.com/rest/api/cost-management/ + + :param billing_account_id: Billing account ID. Required. + :type billing_account_id: str + :param billing_profile_id: Billing profile ID. Required. + :type billing_profile_id: str + :param benefit_utilization_summaries_request: Async Benefit Utilization Summary report to be + created. Required. + :type benefit_utilization_summaries_request: + ~azure.mgmt.costmanagement.models.BenefitUtilizationSummariesRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either + BenefitUtilizationSummariesOperationStatus or the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.costmanagement.models.BenefitUtilizationSummariesOperationStatus] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_generate_benefit_utilization_summaries_report( + self, + billing_account_id: str, + billing_profile_id: str, + benefit_utilization_summaries_request: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.BenefitUtilizationSummariesOperationStatus]: + """Triggers generation of a benefit utilization summaries report for the provided billing account + and billing profile. + + .. seealso:: + - https://docs.microsoft.com/rest/api/cost-management/ + + :param billing_account_id: Billing account ID. Required. + :type billing_account_id: str + :param billing_profile_id: Billing profile ID. Required. + :type billing_profile_id: str + :param benefit_utilization_summaries_request: Async Benefit Utilization Summary report to be + created. Required. + :type benefit_utilization_summaries_request: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either + BenefitUtilizationSummariesOperationStatus or the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.costmanagement.models.BenefitUtilizationSummariesOperationStatus] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_generate_benefit_utilization_summaries_report( + self, + billing_account_id: str, + billing_profile_id: str, + benefit_utilization_summaries_request: Union[_models.BenefitUtilizationSummariesRequest, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.BenefitUtilizationSummariesOperationStatus]: + """Triggers generation of a benefit utilization summaries report for the provided billing account + and billing profile. + + .. seealso:: + - https://docs.microsoft.com/rest/api/cost-management/ + + :param billing_account_id: Billing account ID. Required. + :type billing_account_id: str + :param billing_profile_id: Billing profile ID. Required. + :type billing_profile_id: str + :param benefit_utilization_summaries_request: Async Benefit Utilization Summary report to be + created. Is either a BenefitUtilizationSummariesRequest type or a IO type. Required. + :type benefit_utilization_summaries_request: + ~azure.mgmt.costmanagement.models.BenefitUtilizationSummariesRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either + BenefitUtilizationSummariesOperationStatus or the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.costmanagement.models.BenefitUtilizationSummariesOperationStatus] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.BenefitUtilizationSummariesOperationStatus] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._generate_benefit_utilization_summaries_report_initial( + billing_account_id=billing_account_id, + billing_profile_id=billing_profile_id, + benefit_utilization_summaries_request=benefit_utilization_summaries_request, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("BenefitUtilizationSummariesOperationStatus", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_generate_benefit_utilization_summaries_report.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/providers/Microsoft.CostManagement/generateBenefitUtilizationSummariesReport" + } diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_dimensions_operations.py b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_dimensions_operations.py index eff1333cb7cd..1f64b263a6b0 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_dimensions_operations.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_dimensions_operations.py @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union import urllib.parse @@ -30,10 +29,6 @@ from ..._vendor import _convert_request from ...operations._dimensions_operations import build_by_external_cloud_provider_type_request, build_list_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -69,6 +64,9 @@ def list( ) -> AsyncIterable["_models.Dimension"]: """Lists the dimensions by the defined scope. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :param scope: The scope associated with dimension operations. This includes '/subscriptions/{subscriptionId}/' for subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, @@ -109,10 +107,8 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.DimensionsListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.DimensionsListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -137,7 +133,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -153,7 +149,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -161,14 +157,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("DimensionsListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -181,7 +178,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/dimensions"} # type: ignore + list.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/dimensions"} @distributed_trace def by_external_cloud_provider_type( @@ -196,6 +193,9 @@ def by_external_cloud_provider_type( ) -> AsyncIterable["_models.Dimension"]: """Lists the dimensions by the external cloud provider type. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :param external_cloud_provider_type: The external cloud provider type associated with dimension/query operations. This includes 'externalSubscriptions' for linked account and 'externalBillingAccounts' for consolidated account. Known values are: "externalSubscriptions" @@ -229,10 +229,8 @@ def by_external_cloud_provider_type( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.DimensionsListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.DimensionsListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -258,7 +256,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -274,7 +272,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -282,14 +280,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("DimensionsListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -302,4 +301,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - by_external_cloud_provider_type.metadata = {"url": "/providers/Microsoft.CostManagement/{externalCloudProviderType}/{externalCloudProviderId}/dimensions"} # type: ignore + by_external_cloud_provider_type.metadata = { + "url": "/providers/Microsoft.CostManagement/{externalCloudProviderType}/{externalCloudProviderId}/dimensions" + } diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_exports_operations.py b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_exports_operations.py index d8ef0ca18c5b..bfa77ebf03d9 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_exports_operations.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_exports_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -35,10 +35,6 @@ build_list_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -66,6 +62,9 @@ def __init__(self, *args, **kwargs) -> None: async def list(self, scope: str, expand: Optional[str] = None, **kwargs: Any) -> _models.ExportListResult: """The operation to list all exports at the given scope. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :param scope: The scope associated with export operations. This includes '/subscriptions/{subscriptionId}/' for subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, @@ -103,10 +102,8 @@ async def list(self, scope: str, expand: Optional[str] = None, **kwargs: Any) -> _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ExportListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ExportListResult] = kwargs.pop("cls", None) request = build_list_request( scope=scope, @@ -117,10 +114,11 @@ async def list(self, scope: str, expand: Optional[str] = None, **kwargs: Any) -> params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -137,12 +135,15 @@ async def list(self, scope: str, expand: Optional[str] = None, **kwargs: Any) -> return deserialized - list.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/exports"} # type: ignore + list.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/exports"} @distributed_trace_async async def get(self, scope: str, export_name: str, expand: Optional[str] = None, **kwargs: Any) -> _models.Export: """The operation to get the export for the defined scope by export name. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :param scope: The scope associated with export operations. This includes '/subscriptions/{subscriptionId}/' for subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, @@ -182,10 +183,8 @@ async def get(self, scope: str, export_name: str, expand: Optional[str] = None, _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Export] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.Export] = kwargs.pop("cls", None) request = build_get_request( scope=scope, @@ -197,10 +196,11 @@ async def get(self, scope: str, export_name: str, expand: Optional[str] = None, params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -217,7 +217,7 @@ async def get(self, scope: str, export_name: str, expand: Optional[str] = None, return deserialized - get.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/exports/{exportName}"} # type: ignore + get.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/exports/{exportName}"} @overload async def create_or_update( @@ -233,6 +233,9 @@ async def create_or_update( the request. You may obtain the latest eTag by performing a get operation. Create operation does not require eTag. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :param scope: The scope associated with export operations. This includes '/subscriptions/{subscriptionId}/' for subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, @@ -271,6 +274,9 @@ async def create_or_update( the request. You may obtain the latest eTag by performing a get operation. Create operation does not require eTag. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :param scope: The scope associated with export operations. This includes '/subscriptions/{subscriptionId}/' for subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, @@ -309,6 +315,9 @@ async def create_or_update( the request. You may obtain the latest eTag by performing a get operation. Create operation does not require eTag. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :param scope: The scope associated with export operations. This includes '/subscriptions/{subscriptionId}/' for subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, @@ -329,7 +338,7 @@ async def create_or_update( :param export_name: Export Name. Required. :type export_name: str :param parameters: Parameters supplied to the CreateOrUpdate Export operation. Is either a - model type or a IO type. Required. + Export type or a IO type. Required. :type parameters: ~azure.mgmt.costmanagement.models.Export or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -350,16 +359,14 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Export] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Export] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "Export") @@ -376,10 +383,11 @@ async def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -396,11 +404,11 @@ async def create_or_update( deserialized = self._deserialize("Export", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/exports/{exportName}"} # type: ignore + create_or_update.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/exports/{exportName}"} @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -408,6 +416,9 @@ async def delete( # pylint: disable=inconsistent-return-statements ) -> None: """The operation to delete a export. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :param scope: The scope associated with export operations. This includes '/subscriptions/{subscriptionId}/' for subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, @@ -443,10 +454,8 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( scope=scope, @@ -457,10 +466,11 @@ async def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -473,7 +483,7 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/exports/{exportName}"} # type: ignore + delete.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/exports/{exportName}"} @distributed_trace_async async def execute( # pylint: disable=inconsistent-return-statements @@ -481,6 +491,9 @@ async def execute( # pylint: disable=inconsistent-return-statements ) -> None: """The operation to run an export. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :param scope: The scope associated with export operations. This includes '/subscriptions/{subscriptionId}/' for subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, @@ -516,10 +529,8 @@ async def execute( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_execute_request( scope=scope, @@ -530,10 +541,11 @@ async def execute( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -546,7 +558,7 @@ async def execute( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - execute.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/exports/{exportName}/run"} # type: ignore + execute.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/exports/{exportName}/run"} @distributed_trace_async async def get_execution_history( @@ -554,6 +566,9 @@ async def get_execution_history( ) -> _models.ExportExecutionListResult: """The operation to get the run history of an export for the defined scope and export name. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :param scope: The scope associated with export operations. This includes '/subscriptions/{subscriptionId}/' for subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, @@ -589,10 +604,8 @@ async def get_execution_history( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ExportExecutionListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ExportExecutionListResult] = kwargs.pop("cls", None) request = build_get_execution_history_request( scope=scope, @@ -603,10 +616,11 @@ async def get_execution_history( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -623,4 +637,6 @@ async def get_execution_history( return deserialized - get_execution_history.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/exports/{exportName}/runHistory"} # type: ignore + get_execution_history.metadata = { + "url": "/{scope}/providers/Microsoft.CostManagement/exports/{exportName}/runHistory" + } diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_forecast_operations.py b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_forecast_operations.py index a84cbc9bac29..45ae7f6285bc 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_forecast_operations.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_forecast_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -28,10 +28,6 @@ from ..._vendor import _convert_request from ...operations._forecast_operations import build_external_cloud_provider_usage_request, build_usage_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -67,6 +63,9 @@ async def usage( ) -> Optional[_models.ForecastResult]: """Lists the forecast charges for scope defined. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :param scope: The scope associated with forecast operations. This includes '/subscriptions/{subscriptionId}/' for subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, @@ -112,6 +111,9 @@ async def usage( ) -> Optional[_models.ForecastResult]: """Lists the forecast charges for scope defined. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :param scope: The scope associated with forecast operations. This includes '/subscriptions/{subscriptionId}/' for subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, @@ -151,6 +153,9 @@ async def usage( ) -> Optional[_models.ForecastResult]: """Lists the forecast charges for scope defined. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :param scope: The scope associated with forecast operations. This includes '/subscriptions/{subscriptionId}/' for subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, @@ -169,7 +174,7 @@ async def usage( specific for partners. Required. :type scope: str :param parameters: Parameters supplied to the CreateOrUpdate Forecast Config operation. Is - either a model type or a IO type. Required. + either a ForecastDefinition type or a IO type. Required. :type parameters: ~azure.mgmt.costmanagement.models.ForecastDefinition or IO :param filter: May be used to filter forecasts by properties/usageDate (Utc time), properties/chargeType or properties/grain. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', @@ -194,16 +199,14 @@ async def usage( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.ForecastResult]] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.ForecastResult]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "ForecastDefinition") @@ -220,10 +223,11 @@ async def usage( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -242,7 +246,7 @@ async def usage( return deserialized - usage.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/forecast"} # type: ignore + usage.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/forecast"} @overload async def external_cloud_provider_usage( @@ -257,6 +261,9 @@ async def external_cloud_provider_usage( ) -> _models.ForecastResult: """Lists the forecast charges for external cloud provider type defined. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :param external_cloud_provider_type: The external cloud provider type associated with dimension/query operations. This includes 'externalSubscriptions' for linked account and 'externalBillingAccounts' for consolidated account. Known values are: "externalSubscriptions" @@ -296,6 +303,9 @@ async def external_cloud_provider_usage( ) -> _models.ForecastResult: """Lists the forecast charges for external cloud provider type defined. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :param external_cloud_provider_type: The external cloud provider type associated with dimension/query operations. This includes 'externalSubscriptions' for linked account and 'externalBillingAccounts' for consolidated account. Known values are: "externalSubscriptions" @@ -333,6 +343,9 @@ async def external_cloud_provider_usage( ) -> _models.ForecastResult: """Lists the forecast charges for external cloud provider type defined. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :param external_cloud_provider_type: The external cloud provider type associated with dimension/query operations. This includes 'externalSubscriptions' for linked account and 'externalBillingAccounts' for consolidated account. Known values are: "externalSubscriptions" @@ -344,7 +357,7 @@ async def external_cloud_provider_usage( Required. :type external_cloud_provider_id: str :param parameters: Parameters supplied to the CreateOrUpdate Forecast Config operation. Is - either a model type or a IO type. Required. + either a ForecastDefinition type or a IO type. Required. :type parameters: ~azure.mgmt.costmanagement.models.ForecastDefinition or IO :param filter: May be used to filter forecasts by properties/usageDate (Utc time), properties/chargeType or properties/grain. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', @@ -369,16 +382,14 @@ async def external_cloud_provider_usage( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ForecastResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ForecastResult] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "ForecastDefinition") @@ -396,10 +407,11 @@ async def external_cloud_provider_usage( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -416,4 +428,6 @@ async def external_cloud_provider_usage( return deserialized - external_cloud_provider_usage.metadata = {"url": "/providers/Microsoft.CostManagement/{externalCloudProviderType}/{externalCloudProviderId}/forecast"} # type: ignore + external_cloud_provider_usage.metadata = { + "url": "/providers/Microsoft.CostManagement/{externalCloudProviderType}/{externalCloudProviderId}/forecast" + } diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_generate_cost_details_report_operations.py b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_generate_cost_details_report_operations.py index b494d94e6028..c889de927149 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_generate_cost_details_report_operations.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_generate_cost_details_report_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload from azure.core.exceptions import ( @@ -33,10 +33,6 @@ build_get_operation_results_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -74,16 +70,14 @@ async def _create_operation_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.CostDetailsOperationResults]] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.CostDetailsOperationResults]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "GenerateCostDetailsReportRequestDefinition") @@ -99,15 +93,16 @@ async def _create_operation_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 202]: + if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize( _models.GenerateCostDetailsReportErrorResponse, pipeline_response @@ -128,7 +123,9 @@ async def _create_operation_initial( return deserialized - _create_operation_initial.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/generateCostDetailsReport"} # type: ignore + _create_operation_initial.metadata = { + "url": "/{scope}/providers/Microsoft.CostManagement/generateCostDetailsReport" + } @overload async def begin_create_operation( @@ -148,7 +145,12 @@ async def begin_create_operation( will provide a 202 response with a 'Location' header if the operation is still in progress. Once the report generation operation completes, the polling endpoint will provide a 200 response along with details on the report blob(s) that are available for download. The details - on the file(s) available for download will be available in the polling response body. + on the file(s) available for download will be available in the polling response body. To + Understand cost details (formerly known as usage details) fields found in files ,see + https://learn.microsoft.com/en-us/azure/cost-management-billing/automate/understand-usage-details-fields. + + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ :param scope: The ARM Resource ID for subscription, resource group, billing account, or other billing scopes. For details, see https://aka.ms/costmgmt/scopes. Required. @@ -186,7 +188,12 @@ async def begin_create_operation( will provide a 202 response with a 'Location' header if the operation is still in progress. Once the report generation operation completes, the polling endpoint will provide a 200 response along with details on the report blob(s) that are available for download. The details - on the file(s) available for download will be available in the polling response body. + on the file(s) available for download will be available in the polling response body. To + Understand cost details (formerly known as usage details) fields found in files ,see + https://learn.microsoft.com/en-us/azure/cost-management-billing/automate/understand-usage-details-fields. + + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ :param scope: The ARM Resource ID for subscription, resource group, billing account, or other billing scopes. For details, see https://aka.ms/costmgmt/scopes. Required. @@ -224,13 +231,18 @@ async def begin_create_operation( will provide a 202 response with a 'Location' header if the operation is still in progress. Once the report generation operation completes, the polling endpoint will provide a 200 response along with details on the report blob(s) that are available for download. The details - on the file(s) available for download will be available in the polling response body. + on the file(s) available for download will be available in the polling response body. To + Understand cost details (formerly known as usage details) fields found in files ,see + https://learn.microsoft.com/en-us/azure/cost-management-billing/automate/understand-usage-details-fields. + + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ :param scope: The ARM Resource ID for subscription, resource group, billing account, or other billing scopes. For details, see https://aka.ms/costmgmt/scopes. Required. :type scope: str - :param parameters: Parameters supplied to the Create cost details operation. Is either a model - type or a IO type. Required. + :param parameters: Parameters supplied to the Create cost details operation. Is either a + GenerateCostDetailsReportRequestDefinition type or a IO type. Required. :type parameters: ~azure.mgmt.costmanagement.models.GenerateCostDetailsReportRequestDefinition or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -253,16 +265,14 @@ async def begin_create_operation( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CostDetailsOperationResults] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CostDetailsOperationResults] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._create_operation_initial( # type: ignore + raw_result = await self._create_operation_initial( scope=scope, parameters=parameters, api_version=api_version, @@ -281,9 +291,9 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast( + polling_method: AsyncPollingMethod = cast( AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) # type: AsyncPollingMethod + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -295,9 +305,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create_operation.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/generateCostDetailsReport"} # type: ignore + begin_create_operation.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/generateCostDetailsReport"} async def _get_operation_results_initial( self, scope: str, operation_id: str, **kwargs: Any @@ -313,10 +323,8 @@ async def _get_operation_results_initial( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.CostDetailsOperationResults]] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Optional[_models.CostDetailsOperationResults]] = kwargs.pop("cls", None) request = build_get_operation_results_request( scope=scope, @@ -327,10 +335,11 @@ async def _get_operation_results_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -349,7 +358,9 @@ async def _get_operation_results_initial( return deserialized - _get_operation_results_initial.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/costDetailsOperationResults/{operationId}"} # type: ignore + _get_operation_results_initial.metadata = { + "url": "/{scope}/providers/Microsoft.CostManagement/costDetailsOperationResults/{operationId}" + } @distributed_trace_async async def begin_get_operation_results( @@ -380,15 +391,13 @@ async def begin_get_operation_results( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CostDetailsOperationResults] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.CostDetailsOperationResults] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._get_operation_results_initial( # type: ignore + raw_result = await self._get_operation_results_initial( scope=scope, operation_id=operation_id, api_version=api_version, @@ -406,9 +415,9 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast( + polling_method: AsyncPollingMethod = cast( AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) # type: AsyncPollingMethod + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -420,6 +429,8 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_get_operation_results.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/costDetailsOperationResults/{operationId}"} # type: ignore + begin_get_operation_results.metadata = { + "url": "/{scope}/providers/Microsoft.CostManagement/costDetailsOperationResults/{operationId}" + } diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_generate_detailed_cost_report_operation_results_operations.py b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_generate_detailed_cost_report_operation_results_operations.py index 9337dc341ee7..f1fa361658d2 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_generate_detailed_cost_report_operation_results_operations.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_generate_detailed_cost_report_operation_results_operations.py @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.exceptions import ( @@ -30,10 +29,6 @@ from ..._vendor import _convert_request from ...operations._generate_detailed_cost_report_operation_results_operations import build_get_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -71,10 +66,8 @@ async def _get_initial( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.GenerateDetailedCostReportOperationResult]] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Optional[_models.GenerateDetailedCostReportOperationResult]] = kwargs.pop("cls", None) request = build_get_request( operation_id=operation_id, @@ -85,10 +78,11 @@ async def _get_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -107,7 +101,7 @@ async def _get_initial( return deserialized - _get_initial.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/operationResults/{operationId}"} # type: ignore + _get_initial.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/operationResults/{operationId}"} @distributed_trace_async async def begin_get( @@ -138,15 +132,13 @@ async def begin_get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.GenerateDetailedCostReportOperationResult] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.GenerateDetailedCostReportOperationResult] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._get_initial( # type: ignore + raw_result = await self._get_initial( operation_id=operation_id, scope=scope, api_version=api_version, @@ -164,7 +156,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -176,6 +168,6 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_get.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/operationResults/{operationId}"} # type: ignore + begin_get.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/operationResults/{operationId}"} diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_generate_detailed_cost_report_operation_status_operations.py b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_generate_detailed_cost_report_operation_status_operations.py index 3bf99479ad16..241b5a5598cf 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_generate_detailed_cost_report_operation_status_operations.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_generate_detailed_cost_report_operation_status_operations.py @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -28,10 +27,6 @@ from ..._vendor import _convert_request from ...operations._generate_detailed_cost_report_operation_status_operations import build_get_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -83,10 +78,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.GenerateDetailedCostReportOperationStatuses] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.GenerateDetailedCostReportOperationStatuses] = kwargs.pop("cls", None) request = build_get_request( operation_id=operation_id, @@ -97,10 +90,11 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -117,4 +111,4 @@ async def get( return deserialized - get.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/operationStatus/{operationId}"} # type: ignore + get.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/operationStatus/{operationId}"} diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_generate_detailed_cost_report_operations.py b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_generate_detailed_cost_report_operations.py index 1ea51c38d877..407343cd8e4b 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_generate_detailed_cost_report_operations.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_generate_detailed_cost_report_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload from azure.core.exceptions import ( @@ -30,10 +30,6 @@ from ..._vendor import _convert_request from ...operations._generate_detailed_cost_report_operations import build_create_operation_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -71,16 +67,14 @@ async def _create_operation_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.GenerateDetailedCostReportOperationResult]] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.GenerateDetailedCostReportOperationResult]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "GenerateDetailedCostReportDefinition") @@ -96,10 +90,11 @@ async def _create_operation_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -131,7 +126,9 @@ async def _create_operation_initial( return deserialized - _create_operation_initial.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/generateDetailedCostReport"} # type: ignore + _create_operation_initial.metadata = { + "url": "/{scope}/providers/Microsoft.CostManagement/generateDetailedCostReport" + } @overload async def begin_create_operation( @@ -148,6 +145,9 @@ async def begin_create_operation( operation will provide the status and if the operation is completed the blob file where generated detailed cost report is being stored. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :param scope: The ARM Resource ID for subscription, resource group, billing account, or other billing scopes. For details, see https://aka.ms/costmgmt/scopes. Required. :type scope: str @@ -181,6 +181,9 @@ async def begin_create_operation( operation will provide the status and if the operation is completed the blob file where generated detailed cost report is being stored. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :param scope: The ARM Resource ID for subscription, resource group, billing account, or other billing scopes. For details, see https://aka.ms/costmgmt/scopes. Required. :type scope: str @@ -214,11 +217,14 @@ async def begin_create_operation( operation will provide the status and if the operation is completed the blob file where generated detailed cost report is being stored. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :param scope: The ARM Resource ID for subscription, resource group, billing account, or other billing scopes. For details, see https://aka.ms/costmgmt/scopes. Required. :type scope: str :param parameters: Parameters supplied to the Create detailed cost report operation. Is either - a model type or a IO type. Required. + a GenerateDetailedCostReportDefinition type or a IO type. Required. :type parameters: ~azure.mgmt.costmanagement.models.GenerateDetailedCostReportDefinition or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -240,16 +246,14 @@ async def begin_create_operation( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.GenerateDetailedCostReportOperationResult] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.GenerateDetailedCostReportOperationResult] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._create_operation_initial( # type: ignore + raw_result = await self._create_operation_initial( scope=scope, parameters=parameters, api_version=api_version, @@ -268,9 +272,9 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast( + polling_method: AsyncPollingMethod = cast( AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) # type: AsyncPollingMethod + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -282,6 +286,6 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create_operation.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/generateDetailedCostReport"} # type: ignore + begin_create_operation.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/generateDetailedCostReport"} diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_generate_reservation_details_report_operations.py b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_generate_reservation_details_report_operations.py index 20874b3d0edf..537ff7ec10dd 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_generate_reservation_details_report_operations.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_generate_reservation_details_report_operations.py @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.exceptions import ( @@ -33,10 +32,6 @@ build_by_billing_profile_id_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -74,10 +69,8 @@ async def _by_billing_account_id_initial( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.OperationStatus]] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Optional[_models.OperationStatus]] = kwargs.pop("cls", None) request = build_by_billing_account_id_request( billing_account_id=billing_account_id, @@ -89,10 +82,11 @@ async def _by_billing_account_id_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -116,7 +110,9 @@ async def _by_billing_account_id_initial( return deserialized - _by_billing_account_id_initial.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.CostManagement/generateReservationDetailsReport"} # type: ignore + _by_billing_account_id_initial.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.CostManagement/generateReservationDetailsReport" + } @distributed_trace_async async def begin_by_billing_account_id( @@ -127,6 +123,9 @@ async def begin_by_billing_account_id( For more details on the roles see, https://docs.microsoft.com/en-us/azure/cost-management-billing/manage/understand-ea-roles#usage-and-costs-access-by-role. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :param billing_account_id: Enrollment ID (Legacy BillingAccount ID). Required. :type billing_account_id: str :param start_date: Start Date. Required. @@ -149,15 +148,13 @@ async def begin_by_billing_account_id( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationStatus] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.OperationStatus] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._by_billing_account_id_initial( # type: ignore + raw_result = await self._by_billing_account_id_initial( billing_account_id=billing_account_id, start_date=start_date, end_date=end_date, @@ -176,9 +173,9 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast( + polling_method: AsyncPollingMethod = cast( AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) # type: AsyncPollingMethod + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -190,9 +187,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_by_billing_account_id.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.CostManagement/generateReservationDetailsReport"} # type: ignore + begin_by_billing_account_id.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.CostManagement/generateReservationDetailsReport" + } async def _by_billing_profile_id_initial( self, billing_account_id: str, billing_profile_id: str, start_date: str, end_date: str, **kwargs: Any @@ -208,10 +207,8 @@ async def _by_billing_profile_id_initial( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.OperationStatus]] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Optional[_models.OperationStatus]] = kwargs.pop("cls", None) request = build_by_billing_profile_id_request( billing_account_id=billing_account_id, @@ -224,10 +221,11 @@ async def _by_billing_profile_id_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -251,7 +249,9 @@ async def _by_billing_profile_id_initial( return deserialized - _by_billing_profile_id_initial.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/providers/Microsoft.CostManagement/generateReservationDetailsReport"} # type: ignore + _by_billing_profile_id_initial.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/providers/Microsoft.CostManagement/generateReservationDetailsReport" + } @distributed_trace_async async def begin_by_billing_profile_id( @@ -262,6 +262,9 @@ async def begin_by_billing_profile_id( default. For more details on the roles see, https://docs.microsoft.com/en-us/azure/cost-management-billing/reservations/reservation-utilization#view-utilization-in-the-azure-portal-with-azure-rbac-access. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :param billing_account_id: Billing account ID. Required. :type billing_account_id: str :param billing_profile_id: Billing profile ID. Required. @@ -286,15 +289,13 @@ async def begin_by_billing_profile_id( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationStatus] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.OperationStatus] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._by_billing_profile_id_initial( # type: ignore + raw_result = await self._by_billing_profile_id_initial( billing_account_id=billing_account_id, billing_profile_id=billing_profile_id, start_date=start_date, @@ -314,9 +315,9 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast( + polling_method: AsyncPollingMethod = cast( AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) # type: AsyncPollingMethod + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -328,6 +329,8 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_by_billing_profile_id.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/providers/Microsoft.CostManagement/generateReservationDetailsReport"} # type: ignore + begin_by_billing_profile_id.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/providers/Microsoft.CostManagement/generateReservationDetailsReport" + } diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_operations.py b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_operations.py index 6134de06e246..9ea97535fb12 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_operations.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_operations.py @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse @@ -30,10 +29,6 @@ from ..._vendor import _convert_request from ...operations._operations import build_list_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -71,10 +66,8 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.CostManagementOperation" _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -94,7 +87,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -110,7 +103,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -118,14 +111,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("OperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -138,4 +132,4 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/providers/Microsoft.CostManagement/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.CostManagement/operations"} diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_price_sheet_operations.py b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_price_sheet_operations.py index a9689d030d9a..ee61643df312 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_price_sheet_operations.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_price_sheet_operations.py @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.exceptions import ( @@ -30,10 +29,6 @@ from ..._vendor import _convert_request from ...operations._price_sheet_operations import build_download_by_billing_profile_request, build_download_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -71,10 +66,8 @@ async def _download_initial( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.DownloadURL]] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Optional[_models.DownloadURL]] = kwargs.pop("cls", None) request = build_download_request( billing_account_name=billing_account_name, @@ -86,10 +79,11 @@ async def _download_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -114,7 +108,9 @@ async def _download_initial( return deserialized - _download_initial.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoices/{invoiceName}/providers/Microsoft.CostManagement/pricesheets/default/download"} # type: ignore + _download_initial.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoices/{invoiceName}/providers/Microsoft.CostManagement/pricesheets/default/download" + } @distributed_trace_async async def begin_download( @@ -145,15 +141,13 @@ async def begin_download( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.DownloadURL] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.DownloadURL] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._download_initial( # type: ignore + raw_result = await self._download_initial( billing_account_name=billing_account_name, billing_profile_name=billing_profile_name, invoice_name=invoice_name, @@ -172,9 +166,9 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast( + polling_method: AsyncPollingMethod = cast( AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) # type: AsyncPollingMethod + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -186,9 +180,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_download.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoices/{invoiceName}/providers/Microsoft.CostManagement/pricesheets/default/download"} # type: ignore + begin_download.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoices/{invoiceName}/providers/Microsoft.CostManagement/pricesheets/default/download" + } async def _download_by_billing_profile_initial( self, billing_account_name: str, billing_profile_name: str, **kwargs: Any @@ -204,10 +200,8 @@ async def _download_by_billing_profile_initial( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.DownloadURL]] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Optional[_models.DownloadURL]] = kwargs.pop("cls", None) request = build_download_by_billing_profile_request( billing_account_name=billing_account_name, @@ -218,10 +212,11 @@ async def _download_by_billing_profile_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -246,7 +241,9 @@ async def _download_by_billing_profile_initial( return deserialized - _download_by_billing_profile_initial.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/providers/Microsoft.CostManagement/pricesheets/default/download"} # type: ignore + _download_by_billing_profile_initial.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/providers/Microsoft.CostManagement/pricesheets/default/download" + } @distributed_trace_async async def begin_download_by_billing_profile( @@ -278,15 +275,13 @@ async def begin_download_by_billing_profile( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.DownloadURL] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.DownloadURL] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._download_by_billing_profile_initial( # type: ignore + raw_result = await self._download_by_billing_profile_initial( billing_account_name=billing_account_name, billing_profile_name=billing_profile_name, api_version=api_version, @@ -304,9 +299,9 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast( + polling_method: AsyncPollingMethod = cast( AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) # type: AsyncPollingMethod + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -318,6 +313,8 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_download_by_billing_profile.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/providers/Microsoft.CostManagement/pricesheets/default/download"} # type: ignore + begin_download_by_billing_profile.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/providers/Microsoft.CostManagement/pricesheets/default/download" + } diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_query_operations.py b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_query_operations.py index da801dee2c07..21f90c26efe1 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_query_operations.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_query_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -28,10 +28,6 @@ from ..._vendor import _convert_request from ...operations._query_operations import build_usage_by_external_cloud_provider_type_request, build_usage_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -61,6 +57,9 @@ async def usage( ) -> Optional[_models.QueryResult]: """Query the usage data for scope defined. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :param scope: The scope associated with query and export operations. This includes '/subscriptions/{subscriptionId}/' for subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, @@ -95,6 +94,9 @@ async def usage( ) -> Optional[_models.QueryResult]: """Query the usage data for scope defined. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :param scope: The scope associated with query and export operations. This includes '/subscriptions/{subscriptionId}/' for subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, @@ -129,6 +131,9 @@ async def usage( ) -> Optional[_models.QueryResult]: """Query the usage data for scope defined. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :param scope: The scope associated with query and export operations. This includes '/subscriptions/{subscriptionId}/' for subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, @@ -147,7 +152,7 @@ async def usage( specific for partners. Required. :type scope: str :param parameters: Parameters supplied to the CreateOrUpdate Query Config operation. Is either - a model type or a IO type. Required. + a QueryDefinition type or a IO type. Required. :type parameters: ~azure.mgmt.costmanagement.models.QueryDefinition or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -168,16 +173,14 @@ async def usage( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.QueryResult]] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.QueryResult]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "QueryDefinition") @@ -193,10 +196,11 @@ async def usage( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -215,7 +219,7 @@ async def usage( return deserialized - usage.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/query"} # type: ignore + usage.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/query"} @overload async def usage_by_external_cloud_provider_type( @@ -229,6 +233,9 @@ async def usage_by_external_cloud_provider_type( ) -> _models.QueryResult: """Query the usage data for external cloud provider type defined. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :param external_cloud_provider_type: The external cloud provider type associated with dimension/query operations. This includes 'externalSubscriptions' for linked account and 'externalBillingAccounts' for consolidated account. Known values are: "externalSubscriptions" @@ -262,6 +269,9 @@ async def usage_by_external_cloud_provider_type( ) -> _models.QueryResult: """Query the usage data for external cloud provider type defined. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :param external_cloud_provider_type: The external cloud provider type associated with dimension/query operations. This includes 'externalSubscriptions' for linked account and 'externalBillingAccounts' for consolidated account. Known values are: "externalSubscriptions" @@ -293,6 +303,9 @@ async def usage_by_external_cloud_provider_type( ) -> _models.QueryResult: """Query the usage data for external cloud provider type defined. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :param external_cloud_provider_type: The external cloud provider type associated with dimension/query operations. This includes 'externalSubscriptions' for linked account and 'externalBillingAccounts' for consolidated account. Known values are: "externalSubscriptions" @@ -304,7 +317,7 @@ async def usage_by_external_cloud_provider_type( Required. :type external_cloud_provider_id: str :param parameters: Parameters supplied to the CreateOrUpdate Query Config operation. Is either - a model type or a IO type. Required. + a QueryDefinition type or a IO type. Required. :type parameters: ~azure.mgmt.costmanagement.models.QueryDefinition or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -325,16 +338,14 @@ async def usage_by_external_cloud_provider_type( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.QueryResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.QueryResult] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "QueryDefinition") @@ -351,10 +362,11 @@ async def usage_by_external_cloud_provider_type( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -371,4 +383,6 @@ async def usage_by_external_cloud_provider_type( return deserialized - usage_by_external_cloud_provider_type.metadata = {"url": "/providers/Microsoft.CostManagement/{externalCloudProviderType}/{externalCloudProviderId}/query"} # type: ignore + usage_by_external_cloud_provider_type.metadata = { + "url": "/providers/Microsoft.CostManagement/{externalCloudProviderType}/{externalCloudProviderId}/query" + } diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_reservation_order_scope_operations.py b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_reservation_order_scope_operations.py new file mode 100644 index 000000000000..ea9e160cd5a0 --- /dev/null +++ b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_reservation_order_scope_operations.py @@ -0,0 +1,290 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._reservation_order_scope_operations import ( + build_generate_benefit_utilization_summaries_report_request, +) + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class ReservationOrderScopeOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.costmanagement.aio.CostManagementClient`'s + :attr:`reservation_order_scope` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + async def _generate_benefit_utilization_summaries_report_initial( + self, + reservation_order_id: str, + benefit_utilization_summaries_request: Union[_models.BenefitUtilizationSummariesRequest, IO], + **kwargs: Any + ) -> Optional[_models.BenefitUtilizationSummariesOperationStatus]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.BenefitUtilizationSummariesOperationStatus]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(benefit_utilization_summaries_request, (IOBase, bytes)): + _content = benefit_utilization_summaries_request + else: + _json = self._serialize.body(benefit_utilization_summaries_request, "BenefitUtilizationSummariesRequest") + + request = build_generate_benefit_utilization_summaries_report_request( + reservation_order_id=reservation_order_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._generate_benefit_utilization_summaries_report_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseAutoGenerated, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("BenefitUtilizationSummariesOperationStatus", pipeline_response) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _generate_benefit_utilization_summaries_report_initial.metadata = { + "url": "/providers/Microsoft.Capacity/reservationorders/{reservationOrderId}/providers/Microsoft.CostManagement/generateBenefitUtilizationSummariesReport" + } + + @overload + async def begin_generate_benefit_utilization_summaries_report( + self, + reservation_order_id: str, + benefit_utilization_summaries_request: _models.BenefitUtilizationSummariesRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.BenefitUtilizationSummariesOperationStatus]: + """Triggers generation of a benefit utilization summaries report for the provided reservation + order. + + .. seealso:: + - https://docs.microsoft.com/rest/api/cost-management/ + + :param reservation_order_id: Reservation Order ID. Required. + :type reservation_order_id: str + :param benefit_utilization_summaries_request: Async Benefit Utilization Summary report to be + created. Required. + :type benefit_utilization_summaries_request: + ~azure.mgmt.costmanagement.models.BenefitUtilizationSummariesRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either + BenefitUtilizationSummariesOperationStatus or the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.costmanagement.models.BenefitUtilizationSummariesOperationStatus] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_generate_benefit_utilization_summaries_report( + self, + reservation_order_id: str, + benefit_utilization_summaries_request: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.BenefitUtilizationSummariesOperationStatus]: + """Triggers generation of a benefit utilization summaries report for the provided reservation + order. + + .. seealso:: + - https://docs.microsoft.com/rest/api/cost-management/ + + :param reservation_order_id: Reservation Order ID. Required. + :type reservation_order_id: str + :param benefit_utilization_summaries_request: Async Benefit Utilization Summary report to be + created. Required. + :type benefit_utilization_summaries_request: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either + BenefitUtilizationSummariesOperationStatus or the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.costmanagement.models.BenefitUtilizationSummariesOperationStatus] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_generate_benefit_utilization_summaries_report( + self, + reservation_order_id: str, + benefit_utilization_summaries_request: Union[_models.BenefitUtilizationSummariesRequest, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.BenefitUtilizationSummariesOperationStatus]: + """Triggers generation of a benefit utilization summaries report for the provided reservation + order. + + .. seealso:: + - https://docs.microsoft.com/rest/api/cost-management/ + + :param reservation_order_id: Reservation Order ID. Required. + :type reservation_order_id: str + :param benefit_utilization_summaries_request: Async Benefit Utilization Summary report to be + created. Is either a BenefitUtilizationSummariesRequest type or a IO type. Required. + :type benefit_utilization_summaries_request: + ~azure.mgmt.costmanagement.models.BenefitUtilizationSummariesRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either + BenefitUtilizationSummariesOperationStatus or the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.costmanagement.models.BenefitUtilizationSummariesOperationStatus] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.BenefitUtilizationSummariesOperationStatus] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._generate_benefit_utilization_summaries_report_initial( + reservation_order_id=reservation_order_id, + benefit_utilization_summaries_request=benefit_utilization_summaries_request, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("BenefitUtilizationSummariesOperationStatus", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_generate_benefit_utilization_summaries_report.metadata = { + "url": "/providers/Microsoft.Capacity/reservationorders/{reservationOrderId}/providers/Microsoft.CostManagement/generateBenefitUtilizationSummariesReport" + } diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_reservation_scope_operations.py b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_reservation_scope_operations.py new file mode 100644 index 000000000000..4347f0c30771 --- /dev/null +++ b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_reservation_scope_operations.py @@ -0,0 +1,297 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._reservation_scope_operations import build_generate_benefit_utilization_summaries_report_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class ReservationScopeOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.costmanagement.aio.CostManagementClient`'s + :attr:`reservation_scope` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + async def _generate_benefit_utilization_summaries_report_initial( + self, + reservation_order_id: str, + reservation_id: str, + benefit_utilization_summaries_request: Union[_models.BenefitUtilizationSummariesRequest, IO], + **kwargs: Any + ) -> Optional[_models.BenefitUtilizationSummariesOperationStatus]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.BenefitUtilizationSummariesOperationStatus]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(benefit_utilization_summaries_request, (IOBase, bytes)): + _content = benefit_utilization_summaries_request + else: + _json = self._serialize.body(benefit_utilization_summaries_request, "BenefitUtilizationSummariesRequest") + + request = build_generate_benefit_utilization_summaries_report_request( + reservation_order_id=reservation_order_id, + reservation_id=reservation_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._generate_benefit_utilization_summaries_report_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseAutoGenerated, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("BenefitUtilizationSummariesOperationStatus", pipeline_response) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _generate_benefit_utilization_summaries_report_initial.metadata = { + "url": "/providers/Microsoft.Capacity/reservationorders/{reservationOrderId}/reservations/{reservationId}/providers/Microsoft.CostManagement/generateBenefitUtilizationSummariesReport" + } + + @overload + async def begin_generate_benefit_utilization_summaries_report( + self, + reservation_order_id: str, + reservation_id: str, + benefit_utilization_summaries_request: _models.BenefitUtilizationSummariesRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.BenefitUtilizationSummariesOperationStatus]: + """Triggers generation of a benefit utilization summaries report for the provided reservation. + + .. seealso:: + - https://docs.microsoft.com/rest/api/cost-management/ + + :param reservation_order_id: Reservation Order ID. Required. + :type reservation_order_id: str + :param reservation_id: Reservation ID. Required. + :type reservation_id: str + :param benefit_utilization_summaries_request: Async Benefit Utilization Summary report to be + created. Required. + :type benefit_utilization_summaries_request: + ~azure.mgmt.costmanagement.models.BenefitUtilizationSummariesRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either + BenefitUtilizationSummariesOperationStatus or the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.costmanagement.models.BenefitUtilizationSummariesOperationStatus] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_generate_benefit_utilization_summaries_report( + self, + reservation_order_id: str, + reservation_id: str, + benefit_utilization_summaries_request: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.BenefitUtilizationSummariesOperationStatus]: + """Triggers generation of a benefit utilization summaries report for the provided reservation. + + .. seealso:: + - https://docs.microsoft.com/rest/api/cost-management/ + + :param reservation_order_id: Reservation Order ID. Required. + :type reservation_order_id: str + :param reservation_id: Reservation ID. Required. + :type reservation_id: str + :param benefit_utilization_summaries_request: Async Benefit Utilization Summary report to be + created. Required. + :type benefit_utilization_summaries_request: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either + BenefitUtilizationSummariesOperationStatus or the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.costmanagement.models.BenefitUtilizationSummariesOperationStatus] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_generate_benefit_utilization_summaries_report( + self, + reservation_order_id: str, + reservation_id: str, + benefit_utilization_summaries_request: Union[_models.BenefitUtilizationSummariesRequest, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.BenefitUtilizationSummariesOperationStatus]: + """Triggers generation of a benefit utilization summaries report for the provided reservation. + + .. seealso:: + - https://docs.microsoft.com/rest/api/cost-management/ + + :param reservation_order_id: Reservation Order ID. Required. + :type reservation_order_id: str + :param reservation_id: Reservation ID. Required. + :type reservation_id: str + :param benefit_utilization_summaries_request: Async Benefit Utilization Summary report to be + created. Is either a BenefitUtilizationSummariesRequest type or a IO type. Required. + :type benefit_utilization_summaries_request: + ~azure.mgmt.costmanagement.models.BenefitUtilizationSummariesRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either + BenefitUtilizationSummariesOperationStatus or the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.costmanagement.models.BenefitUtilizationSummariesOperationStatus] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.BenefitUtilizationSummariesOperationStatus] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._generate_benefit_utilization_summaries_report_initial( + reservation_order_id=reservation_order_id, + reservation_id=reservation_id, + benefit_utilization_summaries_request=benefit_utilization_summaries_request, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("BenefitUtilizationSummariesOperationStatus", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_generate_benefit_utilization_summaries_report.metadata = { + "url": "/providers/Microsoft.Capacity/reservationorders/{reservationOrderId}/reservations/{reservationId}/providers/Microsoft.CostManagement/generateBenefitUtilizationSummariesReport" + } diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_savings_plan_order_scope_operations.py b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_savings_plan_order_scope_operations.py new file mode 100644 index 000000000000..28bfe84a3e18 --- /dev/null +++ b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_savings_plan_order_scope_operations.py @@ -0,0 +1,290 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._savings_plan_order_scope_operations import ( + build_generate_benefit_utilization_summaries_report_request, +) + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class SavingsPlanOrderScopeOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.costmanagement.aio.CostManagementClient`'s + :attr:`savings_plan_order_scope` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + async def _generate_benefit_utilization_summaries_report_initial( + self, + savings_plan_order_id: str, + benefit_utilization_summaries_request: Union[_models.BenefitUtilizationSummariesRequest, IO], + **kwargs: Any + ) -> Optional[_models.BenefitUtilizationSummariesOperationStatus]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.BenefitUtilizationSummariesOperationStatus]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(benefit_utilization_summaries_request, (IOBase, bytes)): + _content = benefit_utilization_summaries_request + else: + _json = self._serialize.body(benefit_utilization_summaries_request, "BenefitUtilizationSummariesRequest") + + request = build_generate_benefit_utilization_summaries_report_request( + savings_plan_order_id=savings_plan_order_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._generate_benefit_utilization_summaries_report_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseAutoGenerated, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("BenefitUtilizationSummariesOperationStatus", pipeline_response) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _generate_benefit_utilization_summaries_report_initial.metadata = { + "url": "/providers/Microsoft.BillingBenefits/savingsPlanOrders/{savingsPlanOrderId}/providers/Microsoft.CostManagement/generateBenefitUtilizationSummariesReport" + } + + @overload + async def begin_generate_benefit_utilization_summaries_report( + self, + savings_plan_order_id: str, + benefit_utilization_summaries_request: _models.BenefitUtilizationSummariesRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.BenefitUtilizationSummariesOperationStatus]: + """Triggers generation of a benefit utilization summaries report for the provided savings plan + order. + + .. seealso:: + - https://docs.microsoft.com/rest/api/cost-management/ + + :param savings_plan_order_id: Savings plan order ID. Required. + :type savings_plan_order_id: str + :param benefit_utilization_summaries_request: Async Benefit Utilization Summary report to be + created. Required. + :type benefit_utilization_summaries_request: + ~azure.mgmt.costmanagement.models.BenefitUtilizationSummariesRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either + BenefitUtilizationSummariesOperationStatus or the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.costmanagement.models.BenefitUtilizationSummariesOperationStatus] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_generate_benefit_utilization_summaries_report( + self, + savings_plan_order_id: str, + benefit_utilization_summaries_request: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.BenefitUtilizationSummariesOperationStatus]: + """Triggers generation of a benefit utilization summaries report for the provided savings plan + order. + + .. seealso:: + - https://docs.microsoft.com/rest/api/cost-management/ + + :param savings_plan_order_id: Savings plan order ID. Required. + :type savings_plan_order_id: str + :param benefit_utilization_summaries_request: Async Benefit Utilization Summary report to be + created. Required. + :type benefit_utilization_summaries_request: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either + BenefitUtilizationSummariesOperationStatus or the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.costmanagement.models.BenefitUtilizationSummariesOperationStatus] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_generate_benefit_utilization_summaries_report( + self, + savings_plan_order_id: str, + benefit_utilization_summaries_request: Union[_models.BenefitUtilizationSummariesRequest, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.BenefitUtilizationSummariesOperationStatus]: + """Triggers generation of a benefit utilization summaries report for the provided savings plan + order. + + .. seealso:: + - https://docs.microsoft.com/rest/api/cost-management/ + + :param savings_plan_order_id: Savings plan order ID. Required. + :type savings_plan_order_id: str + :param benefit_utilization_summaries_request: Async Benefit Utilization Summary report to be + created. Is either a BenefitUtilizationSummariesRequest type or a IO type. Required. + :type benefit_utilization_summaries_request: + ~azure.mgmt.costmanagement.models.BenefitUtilizationSummariesRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either + BenefitUtilizationSummariesOperationStatus or the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.costmanagement.models.BenefitUtilizationSummariesOperationStatus] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.BenefitUtilizationSummariesOperationStatus] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._generate_benefit_utilization_summaries_report_initial( + savings_plan_order_id=savings_plan_order_id, + benefit_utilization_summaries_request=benefit_utilization_summaries_request, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("BenefitUtilizationSummariesOperationStatus", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_generate_benefit_utilization_summaries_report.metadata = { + "url": "/providers/Microsoft.BillingBenefits/savingsPlanOrders/{savingsPlanOrderId}/providers/Microsoft.CostManagement/generateBenefitUtilizationSummariesReport" + } diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_savings_plan_scope_operations.py b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_savings_plan_scope_operations.py new file mode 100644 index 000000000000..a4bb0f4ccf6b --- /dev/null +++ b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_savings_plan_scope_operations.py @@ -0,0 +1,299 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._savings_plan_scope_operations import ( + build_generate_benefit_utilization_summaries_report_async_request, +) + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class SavingsPlanScopeOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.costmanagement.aio.CostManagementClient`'s + :attr:`savings_plan_scope` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + async def _generate_benefit_utilization_summaries_report_async_initial( + self, + savings_plan_order_id: str, + savings_plan_id: str, + benefit_utilization_summaries_request: Union[_models.BenefitUtilizationSummariesRequest, IO], + **kwargs: Any + ) -> Optional[_models.BenefitUtilizationSummariesOperationStatus]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.BenefitUtilizationSummariesOperationStatus]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(benefit_utilization_summaries_request, (IOBase, bytes)): + _content = benefit_utilization_summaries_request + else: + _json = self._serialize.body(benefit_utilization_summaries_request, "BenefitUtilizationSummariesRequest") + + request = build_generate_benefit_utilization_summaries_report_async_request( + savings_plan_order_id=savings_plan_order_id, + savings_plan_id=savings_plan_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._generate_benefit_utilization_summaries_report_async_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseAutoGenerated, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("BenefitUtilizationSummariesOperationStatus", pipeline_response) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _generate_benefit_utilization_summaries_report_async_initial.metadata = { + "url": "/providers/Microsoft.BillingBenefits/savingsPlanOrders/{savingsPlanOrderId}/savingsPlans/{savingsPlanId}/providers/Microsoft.CostManagement/generateBenefitUtilizationSummariesReport" + } + + @overload + async def begin_generate_benefit_utilization_summaries_report_async( + self, + savings_plan_order_id: str, + savings_plan_id: str, + benefit_utilization_summaries_request: _models.BenefitUtilizationSummariesRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.BenefitUtilizationSummariesOperationStatus]: + """Triggers generation of a benefit utilization summaries report for the provided savings plan. + + .. seealso:: + - https://docs.microsoft.com/rest/api/cost-management/ + + :param savings_plan_order_id: Savings plan order ID. Required. + :type savings_plan_order_id: str + :param savings_plan_id: Savings plan ID. Required. + :type savings_plan_id: str + :param benefit_utilization_summaries_request: Async Benefit Utilization Summary report to be + created. Required. + :type benefit_utilization_summaries_request: + ~azure.mgmt.costmanagement.models.BenefitUtilizationSummariesRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either + BenefitUtilizationSummariesOperationStatus or the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.costmanagement.models.BenefitUtilizationSummariesOperationStatus] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_generate_benefit_utilization_summaries_report_async( + self, + savings_plan_order_id: str, + savings_plan_id: str, + benefit_utilization_summaries_request: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.BenefitUtilizationSummariesOperationStatus]: + """Triggers generation of a benefit utilization summaries report for the provided savings plan. + + .. seealso:: + - https://docs.microsoft.com/rest/api/cost-management/ + + :param savings_plan_order_id: Savings plan order ID. Required. + :type savings_plan_order_id: str + :param savings_plan_id: Savings plan ID. Required. + :type savings_plan_id: str + :param benefit_utilization_summaries_request: Async Benefit Utilization Summary report to be + created. Required. + :type benefit_utilization_summaries_request: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either + BenefitUtilizationSummariesOperationStatus or the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.costmanagement.models.BenefitUtilizationSummariesOperationStatus] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_generate_benefit_utilization_summaries_report_async( + self, + savings_plan_order_id: str, + savings_plan_id: str, + benefit_utilization_summaries_request: Union[_models.BenefitUtilizationSummariesRequest, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.BenefitUtilizationSummariesOperationStatus]: + """Triggers generation of a benefit utilization summaries report for the provided savings plan. + + .. seealso:: + - https://docs.microsoft.com/rest/api/cost-management/ + + :param savings_plan_order_id: Savings plan order ID. Required. + :type savings_plan_order_id: str + :param savings_plan_id: Savings plan ID. Required. + :type savings_plan_id: str + :param benefit_utilization_summaries_request: Async Benefit Utilization Summary report to be + created. Is either a BenefitUtilizationSummariesRequest type or a IO type. Required. + :type benefit_utilization_summaries_request: + ~azure.mgmt.costmanagement.models.BenefitUtilizationSummariesRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either + BenefitUtilizationSummariesOperationStatus or the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.costmanagement.models.BenefitUtilizationSummariesOperationStatus] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.BenefitUtilizationSummariesOperationStatus] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._generate_benefit_utilization_summaries_report_async_initial( + savings_plan_order_id=savings_plan_order_id, + savings_plan_id=savings_plan_id, + benefit_utilization_summaries_request=benefit_utilization_summaries_request, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("BenefitUtilizationSummariesOperationStatus", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_generate_benefit_utilization_summaries_report_async.metadata = { + "url": "/providers/Microsoft.BillingBenefits/savingsPlanOrders/{savingsPlanOrderId}/savingsPlans/{savingsPlanId}/providers/Microsoft.CostManagement/generateBenefitUtilizationSummariesReport" + } diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_scheduled_actions_operations.py b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_scheduled_actions_operations.py index f46cbd55ddb5..9adf299e0b72 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_scheduled_actions_operations.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_scheduled_actions_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -44,10 +44,6 @@ build_run_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -75,6 +71,9 @@ def __init__(self, *args, **kwargs) -> None: def list(self, filter: Optional[str] = None, **kwargs: Any) -> AsyncIterable["_models.ScheduledAction"]: """List all private scheduled actions. + .. seealso:: + - https://docs.microsoft.com/rest/api/cost-management/ + :param filter: May be used to filter scheduled actions by properties/viewId. Supported operator is 'eq'. Default value is None. :type filter: str @@ -87,10 +86,8 @@ def list(self, filter: Optional[str] = None, **kwargs: Any) -> AsyncIterable["_m _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ScheduledActionListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ScheduledActionListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -111,7 +108,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -127,7 +124,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -135,27 +132,30 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("ScheduledActionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponseWithNestedDetails, pipeline_response + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/providers/Microsoft.CostManagement/scheduledActions"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.CostManagement/scheduledActions"} @distributed_trace def list_by_scope( @@ -163,6 +163,9 @@ def list_by_scope( ) -> AsyncIterable["_models.ScheduledAction"]: """List all shared scheduled actions within the given scope. + .. seealso:: + - https://docs.microsoft.com/rest/api/cost-management/ + :param scope: The scope associated with scheduled action operations. This includes 'subscriptions/{subscriptionId}' for subscription scope, 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, @@ -193,10 +196,8 @@ def list_by_scope( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ScheduledActionListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ScheduledActionListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -218,7 +219,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -234,7 +235,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -242,33 +243,37 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("ScheduledActionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponseWithNestedDetails, pipeline_response + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response return AsyncItemPaged(get_next, extract_data) - list_by_scope.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/scheduledActions"} # type: ignore + list_by_scope.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/scheduledActions"} @overload async def create_or_update( self, name: str, scheduled_action: _models.ScheduledAction, + if_match: Optional[str] = None, *, content_type: str = "application/json", **kwargs: Any @@ -279,6 +284,10 @@ async def create_or_update( :type name: str :param scheduled_action: Scheduled action to be created or updated. Required. :type scheduled_action: ~azure.mgmt.costmanagement.models.ScheduledAction + :param if_match: ETag of the Entity. Not required when creating an entity. Optional when + updating an entity and can be specified to achieve optimistic concurrency. Default value is + None. + :type if_match: str :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -290,7 +299,13 @@ async def create_or_update( @overload async def create_or_update( - self, name: str, scheduled_action: IO, *, content_type: str = "application/json", **kwargs: Any + self, + name: str, + scheduled_action: IO, + if_match: Optional[str] = None, + *, + content_type: str = "application/json", + **kwargs: Any ) -> _models.ScheduledAction: """Create or update a private scheduled action. @@ -298,6 +313,10 @@ async def create_or_update( :type name: str :param scheduled_action: Scheduled action to be created or updated. Required. :type scheduled_action: IO + :param if_match: ETag of the Entity. Not required when creating an entity. Optional when + updating an entity and can be specified to achieve optimistic concurrency. Default value is + None. + :type if_match: str :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -309,15 +328,23 @@ async def create_or_update( @distributed_trace_async async def create_or_update( - self, name: str, scheduled_action: Union[_models.ScheduledAction, IO], **kwargs: Any + self, + name: str, + scheduled_action: Union[_models.ScheduledAction, IO], + if_match: Optional[str] = None, + **kwargs: Any ) -> _models.ScheduledAction: """Create or update a private scheduled action. :param name: Scheduled action name. Required. :type name: str - :param scheduled_action: Scheduled action to be created or updated. Is either a model type or a - IO type. Required. + :param scheduled_action: Scheduled action to be created or updated. Is either a ScheduledAction + type or a IO type. Required. :type scheduled_action: ~azure.mgmt.costmanagement.models.ScheduledAction or IO + :param if_match: ETag of the Entity. Not required when creating an entity. Optional when + updating an entity and can be specified to achieve optimistic concurrency. Default value is + None. + :type if_match: str :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. :paramtype content_type: str @@ -337,22 +364,21 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ScheduledAction] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ScheduledAction] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(scheduled_action, (IO, bytes)): + if isinstance(scheduled_action, (IOBase, bytes)): _content = scheduled_action else: _json = self._serialize.body(scheduled_action, "ScheduledAction") request = build_create_or_update_request( name=name, + if_match=if_match, api_version=api_version, content_type=content_type, json=_json, @@ -362,17 +388,18 @@ async def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseWithNestedDetails, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -382,16 +409,19 @@ async def create_or_update( deserialized = self._deserialize("ScheduledAction", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/providers/Microsoft.CostManagement/scheduledActions/{name}"} # type: ignore + create_or_update.metadata = {"url": "/providers/Microsoft.CostManagement/scheduledActions/{name}"} @distributed_trace_async async def get(self, name: str, **kwargs: Any) -> _models.ScheduledAction: """Get the private scheduled action by name. + .. seealso:: + - https://docs.microsoft.com/rest/api/cost-management/ + :param name: Scheduled action name. Required. :type name: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -410,10 +440,8 @@ async def get(self, name: str, **kwargs: Any) -> _models.ScheduledAction: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ScheduledAction] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ScheduledAction] = kwargs.pop("cls", None) request = build_get_request( name=name, @@ -423,17 +451,18 @@ async def get(self, name: str, **kwargs: Any) -> _models.ScheduledAction: params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseWithNestedDetails, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("ScheduledAction", pipeline_response) @@ -443,12 +472,15 @@ async def get(self, name: str, **kwargs: Any) -> _models.ScheduledAction: return deserialized - get.metadata = {"url": "/providers/Microsoft.CostManagement/scheduledActions/{name}"} # type: ignore + get.metadata = {"url": "/providers/Microsoft.CostManagement/scheduledActions/{name}"} @distributed_trace_async async def delete(self, name: str, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements """Delete a private scheduled action. + .. seealso:: + - https://docs.microsoft.com/rest/api/cost-management/ + :param name: Scheduled action name. Required. :type name: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -467,10 +499,8 @@ async def delete(self, name: str, **kwargs: Any) -> None: # pylint: disable=inc _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( name=name, @@ -480,23 +510,24 @@ async def delete(self, name: str, **kwargs: Any) -> None: # pylint: disable=inc params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseWithNestedDetails, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/providers/Microsoft.CostManagement/scheduledActions/{name}"} # type: ignore + delete.metadata = {"url": "/providers/Microsoft.CostManagement/scheduledActions/{name}"} @overload async def create_or_update_by_scope( @@ -504,6 +535,7 @@ async def create_or_update_by_scope( scope: str, name: str, scheduled_action: _models.ScheduledAction, + if_match: Optional[str] = None, *, content_type: str = "application/json", **kwargs: Any @@ -532,6 +564,10 @@ async def create_or_update_by_scope( :type name: str :param scheduled_action: Scheduled action to be created or updated. Required. :type scheduled_action: ~azure.mgmt.costmanagement.models.ScheduledAction + :param if_match: ETag of the Entity. Not required when creating an entity. Optional when + updating an entity and can be specified to achieve optimistic concurrency. Default value is + None. + :type if_match: str :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -543,7 +579,14 @@ async def create_or_update_by_scope( @overload async def create_or_update_by_scope( - self, scope: str, name: str, scheduled_action: IO, *, content_type: str = "application/json", **kwargs: Any + self, + scope: str, + name: str, + scheduled_action: IO, + if_match: Optional[str] = None, + *, + content_type: str = "application/json", + **kwargs: Any ) -> _models.ScheduledAction: """Create or update a shared scheduled action within the given scope. @@ -569,6 +612,10 @@ async def create_or_update_by_scope( :type name: str :param scheduled_action: Scheduled action to be created or updated. Required. :type scheduled_action: IO + :param if_match: ETag of the Entity. Not required when creating an entity. Optional when + updating an entity and can be specified to achieve optimistic concurrency. Default value is + None. + :type if_match: str :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -580,7 +627,12 @@ async def create_or_update_by_scope( @distributed_trace_async async def create_or_update_by_scope( - self, scope: str, name: str, scheduled_action: Union[_models.ScheduledAction, IO], **kwargs: Any + self, + scope: str, + name: str, + scheduled_action: Union[_models.ScheduledAction, IO], + if_match: Optional[str] = None, + **kwargs: Any ) -> _models.ScheduledAction: """Create or update a shared scheduled action within the given scope. @@ -604,9 +656,13 @@ async def create_or_update_by_scope( :type scope: str :param name: Scheduled action name. Required. :type name: str - :param scheduled_action: Scheduled action to be created or updated. Is either a model type or a - IO type. Required. + :param scheduled_action: Scheduled action to be created or updated. Is either a ScheduledAction + type or a IO type. Required. :type scheduled_action: ~azure.mgmt.costmanagement.models.ScheduledAction or IO + :param if_match: ETag of the Entity. Not required when creating an entity. Optional when + updating an entity and can be specified to achieve optimistic concurrency. Default value is + None. + :type if_match: str :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. :paramtype content_type: str @@ -626,16 +682,14 @@ async def create_or_update_by_scope( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ScheduledAction] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ScheduledAction] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(scheduled_action, (IO, bytes)): + if isinstance(scheduled_action, (IOBase, bytes)): _content = scheduled_action else: _json = self._serialize.body(scheduled_action, "ScheduledAction") @@ -643,6 +697,7 @@ async def create_or_update_by_scope( request = build_create_or_update_by_scope_request( scope=scope, name=name, + if_match=if_match, api_version=api_version, content_type=content_type, json=_json, @@ -652,17 +707,18 @@ async def create_or_update_by_scope( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseWithNestedDetails, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -672,16 +728,19 @@ async def create_or_update_by_scope( deserialized = self._deserialize("ScheduledAction", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update_by_scope.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/scheduledActions/{name}"} # type: ignore + create_or_update_by_scope.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/scheduledActions/{name}"} @distributed_trace_async async def get_by_scope(self, scope: str, name: str, **kwargs: Any) -> _models.ScheduledAction: """Get the shared scheduled action from the given scope by name. + .. seealso:: + - https://docs.microsoft.com/rest/api/cost-management/ + :param scope: The scope associated with scheduled action operations. This includes 'subscriptions/{subscriptionId}' for subscription scope, 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, @@ -718,10 +777,8 @@ async def get_by_scope(self, scope: str, name: str, **kwargs: Any) -> _models.Sc _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ScheduledAction] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ScheduledAction] = kwargs.pop("cls", None) request = build_get_by_scope_request( scope=scope, @@ -732,17 +789,18 @@ async def get_by_scope(self, scope: str, name: str, **kwargs: Any) -> _models.Sc params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseWithNestedDetails, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("ScheduledAction", pipeline_response) @@ -752,7 +810,7 @@ async def get_by_scope(self, scope: str, name: str, **kwargs: Any) -> _models.Sc return deserialized - get_by_scope.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/scheduledActions/{name}"} # type: ignore + get_by_scope.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/scheduledActions/{name}"} @distributed_trace_async async def delete_by_scope( # pylint: disable=inconsistent-return-statements @@ -760,6 +818,9 @@ async def delete_by_scope( # pylint: disable=inconsistent-return-statements ) -> None: """Delete a scheduled action within the given scope. + .. seealso:: + - https://docs.microsoft.com/rest/api/cost-management/ + :param scope: The scope associated with scheduled action operations. This includes 'subscriptions/{subscriptionId}' for subscription scope, 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, @@ -796,10 +857,8 @@ async def delete_by_scope( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_by_scope_request( scope=scope, @@ -810,23 +869,24 @@ async def delete_by_scope( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseWithNestedDetails, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - delete_by_scope.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/scheduledActions/{name}"} # type: ignore + delete_by_scope.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/scheduledActions/{name}"} @distributed_trace_async async def run(self, name: str, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements @@ -850,10 +910,8 @@ async def run(self, name: str, **kwargs: Any) -> None: # pylint: disable=incons _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_run_request( name=name, @@ -863,23 +921,24 @@ async def run(self, name: str, **kwargs: Any) -> None: # pylint: disable=incons params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseWithNestedDetails, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - run.metadata = {"url": "/providers/Microsoft.CostManagement/scheduledActions/{name}/execute"} # type: ignore + run.metadata = {"url": "/providers/Microsoft.CostManagement/scheduledActions/{name}/execute"} @distributed_trace_async async def run_by_scope( # pylint: disable=inconsistent-return-statements @@ -923,10 +982,8 @@ async def run_by_scope( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_run_by_scope_request( scope=scope, @@ -937,23 +994,24 @@ async def run_by_scope( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseWithNestedDetails, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - run_by_scope.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/scheduledActions/{name}/execute"} # type: ignore + run_by_scope.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/scheduledActions/{name}/execute"} @overload async def check_name_availability( @@ -1001,7 +1059,7 @@ async def check_name_availability( """Checks availability and correctness of the name for a scheduled action. :param check_name_availability_request: Scheduled action to be created or updated. Is either a - model type or a IO type. Required. + CheckNameAvailabilityRequest type or a IO type. Required. :type check_name_availability_request: ~azure.mgmt.costmanagement.models.CheckNameAvailabilityRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -1023,16 +1081,14 @@ async def check_name_availability( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CheckNameAvailabilityResponse] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CheckNameAvailabilityResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(check_name_availability_request, (IO, bytes)): + if isinstance(check_name_availability_request, (IOBase, bytes)): _content = check_name_availability_request else: _json = self._serialize.body(check_name_availability_request, "CheckNameAvailabilityRequest") @@ -1047,17 +1103,18 @@ async def check_name_availability( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseWithNestedDetails, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("CheckNameAvailabilityResponse", pipeline_response) @@ -1067,7 +1124,7 @@ async def check_name_availability( return deserialized - check_name_availability.metadata = {"url": "/providers/Microsoft.CostManagement/checkNameAvailability"} # type: ignore + check_name_availability.metadata = {"url": "/providers/Microsoft.CostManagement/checkNameAvailability"} @overload async def check_name_availability_by_scope( @@ -1173,7 +1230,7 @@ async def check_name_availability_by_scope( Required. :type scope: str :param check_name_availability_request: Scheduled action to be created or updated. Is either a - model type or a IO type. Required. + CheckNameAvailabilityRequest type or a IO type. Required. :type check_name_availability_request: ~azure.mgmt.costmanagement.models.CheckNameAvailabilityRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -1195,16 +1252,14 @@ async def check_name_availability_by_scope( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CheckNameAvailabilityResponse] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CheckNameAvailabilityResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(check_name_availability_request, (IO, bytes)): + if isinstance(check_name_availability_request, (IOBase, bytes)): _content = check_name_availability_request else: _json = self._serialize.body(check_name_availability_request, "CheckNameAvailabilityRequest") @@ -1220,17 +1275,18 @@ async def check_name_availability_by_scope( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseWithNestedDetails, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("CheckNameAvailabilityResponse", pipeline_response) @@ -1240,4 +1296,6 @@ async def check_name_availability_by_scope( return deserialized - check_name_availability_by_scope.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/checkNameAvailability"} # type: ignore + check_name_availability_by_scope.metadata = { + "url": "/{scope}/providers/Microsoft.CostManagement/checkNameAvailability" + } diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_views_operations.py b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_views_operations.py index 783b77477239..28afc176547a 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_views_operations.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/aio/operations/_views_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -40,10 +40,6 @@ build_list_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -71,6 +67,9 @@ def __init__(self, *args, **kwargs) -> None: def list(self, **kwargs: Any) -> AsyncIterable["_models.View"]: """Lists all views by tenant and object. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either View or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.costmanagement.models.View] @@ -79,10 +78,8 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.View"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ViewListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ViewListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -102,7 +99,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -118,7 +115,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -126,14 +123,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("ViewListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -146,12 +144,15 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/providers/Microsoft.CostManagement/views"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.CostManagement/views"} @distributed_trace def list_by_scope(self, scope: str, **kwargs: Any) -> AsyncIterable["_models.View"]: """Lists all views at the given scope. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :param scope: The scope associated with view operations. This includes 'subscriptions/{subscriptionId}' for subscription scope, 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, @@ -178,10 +179,8 @@ def list_by_scope(self, scope: str, **kwargs: Any) -> AsyncIterable["_models.Vie _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ViewListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ViewListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -202,7 +201,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -218,7 +217,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -226,14 +225,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("ViewListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -246,12 +246,15 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_scope.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/views"} # type: ignore + list_by_scope.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/views"} @distributed_trace_async async def get(self, view_name: str, **kwargs: Any) -> _models.View: """Gets the view by view name. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :param view_name: View name. Required. :type view_name: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -270,10 +273,8 @@ async def get(self, view_name: str, **kwargs: Any) -> _models.View: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.View] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.View] = kwargs.pop("cls", None) request = build_get_request( view_name=view_name, @@ -283,10 +284,11 @@ async def get(self, view_name: str, **kwargs: Any) -> _models.View: params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -303,7 +305,7 @@ async def get(self, view_name: str, **kwargs: Any) -> _models.View: return deserialized - get.metadata = {"url": "/providers/Microsoft.CostManagement/views/{viewName}"} # type: ignore + get.metadata = {"url": "/providers/Microsoft.CostManagement/views/{viewName}"} @overload async def create_or_update( @@ -313,6 +315,9 @@ async def create_or_update( the request. You may obtain the latest eTag by performing a get operation. Create operation does not require eTag. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :param view_name: View name. Required. :type view_name: str :param parameters: Parameters supplied to the CreateOrUpdate View operation. Required. @@ -334,6 +339,9 @@ async def create_or_update( the request. You may obtain the latest eTag by performing a get operation. Create operation does not require eTag. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :param view_name: View name. Required. :type view_name: str :param parameters: Parameters supplied to the CreateOrUpdate View operation. Required. @@ -355,9 +363,12 @@ async def create_or_update( the request. You may obtain the latest eTag by performing a get operation. Create operation does not require eTag. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :param view_name: View name. Required. :type view_name: str - :param parameters: Parameters supplied to the CreateOrUpdate View operation. Is either a model + :param parameters: Parameters supplied to the CreateOrUpdate View operation. Is either a View type or a IO type. Required. :type parameters: ~azure.mgmt.costmanagement.models.View or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -379,16 +390,14 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.View] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.View] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "View") @@ -404,10 +413,11 @@ async def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -424,16 +434,19 @@ async def create_or_update( deserialized = self._deserialize("View", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/providers/Microsoft.CostManagement/views/{viewName}"} # type: ignore + create_or_update.metadata = {"url": "/providers/Microsoft.CostManagement/views/{viewName}"} @distributed_trace_async async def delete(self, view_name: str, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements """The operation to delete a view. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :param view_name: View name. Required. :type view_name: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -452,10 +465,8 @@ async def delete(self, view_name: str, **kwargs: Any) -> None: # pylint: disabl _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( view_name=view_name, @@ -465,10 +476,11 @@ async def delete(self, view_name: str, **kwargs: Any) -> None: # pylint: disabl params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -481,12 +493,15 @@ async def delete(self, view_name: str, **kwargs: Any) -> None: # pylint: disabl if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/providers/Microsoft.CostManagement/views/{viewName}"} # type: ignore + delete.metadata = {"url": "/providers/Microsoft.CostManagement/views/{viewName}"} @distributed_trace_async async def get_by_scope(self, scope: str, view_name: str, **kwargs: Any) -> _models.View: """Gets the view for the defined scope by view name. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :param scope: The scope associated with view operations. This includes 'subscriptions/{subscriptionId}' for subscription scope, 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, @@ -523,10 +538,8 @@ async def get_by_scope(self, scope: str, view_name: str, **kwargs: Any) -> _mode _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.View] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.View] = kwargs.pop("cls", None) request = build_get_by_scope_request( scope=scope, @@ -537,10 +550,11 @@ async def get_by_scope(self, scope: str, view_name: str, **kwargs: Any) -> _mode params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -557,7 +571,7 @@ async def get_by_scope(self, scope: str, view_name: str, **kwargs: Any) -> _mode return deserialized - get_by_scope.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/views/{viewName}"} # type: ignore + get_by_scope.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/views/{viewName}"} @overload async def create_or_update_by_scope( @@ -573,6 +587,9 @@ async def create_or_update_by_scope( the request. You may obtain the latest eTag by performing a get operation. Create operation does not require eTag. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :param scope: The scope associated with view operations. This includes 'subscriptions/{subscriptionId}' for subscription scope, 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, @@ -612,6 +629,9 @@ async def create_or_update_by_scope( the request. You may obtain the latest eTag by performing a get operation. Create operation does not require eTag. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :param scope: The scope associated with view operations. This includes 'subscriptions/{subscriptionId}' for subscription scope, 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, @@ -651,6 +671,9 @@ async def create_or_update_by_scope( the request. You may obtain the latest eTag by performing a get operation. Create operation does not require eTag. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :param scope: The scope associated with view operations. This includes 'subscriptions/{subscriptionId}' for subscription scope, 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, @@ -671,7 +694,7 @@ async def create_or_update_by_scope( :type scope: str :param view_name: View name. Required. :type view_name: str - :param parameters: Parameters supplied to the CreateOrUpdate View operation. Is either a model + :param parameters: Parameters supplied to the CreateOrUpdate View operation. Is either a View type or a IO type. Required. :type parameters: ~azure.mgmt.costmanagement.models.View or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -693,16 +716,14 @@ async def create_or_update_by_scope( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.View] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.View] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "View") @@ -719,10 +740,11 @@ async def create_or_update_by_scope( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -739,11 +761,11 @@ async def create_or_update_by_scope( deserialized = self._deserialize("View", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update_by_scope.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/views/{viewName}"} # type: ignore + create_or_update_by_scope.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/views/{viewName}"} @distributed_trace_async async def delete_by_scope( # pylint: disable=inconsistent-return-statements @@ -751,6 +773,9 @@ async def delete_by_scope( # pylint: disable=inconsistent-return-statements ) -> None: """The operation to delete a view. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :param scope: The scope associated with view operations. This includes 'subscriptions/{subscriptionId}' for subscription scope, 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, @@ -787,10 +812,8 @@ async def delete_by_scope( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_by_scope_request( scope=scope, @@ -801,10 +824,11 @@ async def delete_by_scope( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -817,4 +841,4 @@ async def delete_by_scope( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete_by_scope.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/views/{viewName}"} # type: ignore + delete_by_scope.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/views/{viewName}"} diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/models/__init__.py b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/models/__init__.py index aade15c2f223..e484eedf3311 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/models/__init__.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/models/__init__.py @@ -12,11 +12,14 @@ from ._models_py3 import AlertsResult from ._models_py3 import AllSavingsBenefitDetails from ._models_py3 import AllSavingsList +from ._models_py3 import AsyncOperationStatusProperties from ._models_py3 import BenefitRecommendationModel from ._models_py3 import BenefitRecommendationProperties from ._models_py3 import BenefitRecommendationsListResult from ._models_py3 import BenefitResource from ._models_py3 import BenefitUtilizationSummariesListResult +from ._models_py3 import BenefitUtilizationSummariesOperationStatus +from ._models_py3 import BenefitUtilizationSummariesRequest from ._models_py3 import BenefitUtilizationSummary from ._models_py3 import BenefitUtilizationSummaryProperties from ._models_py3 import BlobInfo @@ -32,8 +35,13 @@ from ._models_py3 import DimensionsListResult from ._models_py3 import DismissAlertPayload from ._models_py3 import DownloadURL +from ._models_py3 import ErrorAdditionalInfo +from ._models_py3 import ErrorDetail from ._models_py3 import ErrorDetails +from ._models_py3 import ErrorDetailsWithNestedDetails from ._models_py3 import ErrorResponse +from ._models_py3 import ErrorResponseAutoGenerated +from ._models_py3 import ErrorResponseWithNestedDetails from ._models_py3 import Export from ._models_py3 import ExportDataset from ._models_py3 import ExportDatasetConfiguration @@ -117,6 +125,7 @@ from ._cost_management_client_enums import AlertTimeGrainType from ._cost_management_client_enums import AlertType from ._cost_management_client_enums import BenefitKind +from ._cost_management_client_enums import BenefitUtilizationSummaryReportSchema from ._cost_management_client_enums import ChartType from ._cost_management_client_enums import CheckNameAvailabilityReason from ._cost_management_client_enums import CostDetailsDataFormat @@ -149,7 +158,6 @@ from ._cost_management_client_enums import QueryColumnType from ._cost_management_client_enums import QueryOperatorType from ._cost_management_client_enums import RecurrenceType -from ._cost_management_client_enums import ReportConfigColumnType from ._cost_management_client_enums import ReportConfigSortingType from ._cost_management_client_enums import ReportGranularityType from ._cost_management_client_enums import ReportOperationStatusType @@ -165,7 +173,7 @@ from ._cost_management_client_enums import TimeframeType from ._cost_management_client_enums import WeeksOfMonth from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ @@ -175,11 +183,14 @@ "AlertsResult", "AllSavingsBenefitDetails", "AllSavingsList", + "AsyncOperationStatusProperties", "BenefitRecommendationModel", "BenefitRecommendationProperties", "BenefitRecommendationsListResult", "BenefitResource", "BenefitUtilizationSummariesListResult", + "BenefitUtilizationSummariesOperationStatus", + "BenefitUtilizationSummariesRequest", "BenefitUtilizationSummary", "BenefitUtilizationSummaryProperties", "BlobInfo", @@ -195,8 +206,13 @@ "DimensionsListResult", "DismissAlertPayload", "DownloadURL", + "ErrorAdditionalInfo", + "ErrorDetail", "ErrorDetails", + "ErrorDetailsWithNestedDetails", "ErrorResponse", + "ErrorResponseAutoGenerated", + "ErrorResponseWithNestedDetails", "Export", "ExportDataset", "ExportDatasetConfiguration", @@ -279,6 +295,7 @@ "AlertTimeGrainType", "AlertType", "BenefitKind", + "BenefitUtilizationSummaryReportSchema", "ChartType", "CheckNameAvailabilityReason", "CostDetailsDataFormat", @@ -311,7 +328,6 @@ "QueryColumnType", "QueryOperatorType", "RecurrenceType", - "ReportConfigColumnType", "ReportConfigSortingType", "ReportGranularityType", "ReportOperationStatusType", diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/models/_cost_management_client_enums.py b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/models/_cost_management_client_enums.py index 0dbdb4a13835..fdb4e24ec48d 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/models/_cost_management_client_enums.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/models/_cost_management_client_enums.py @@ -106,12 +106,29 @@ class AlertType(str, Enum, metaclass=CaseInsensitiveEnumMeta): class BenefitKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Kind/type of the benefit.""" - #: Benefit is IncludedQuantity. INCLUDED_QUANTITY = "IncludedQuantity" - #: Benefit is Reservation. + """Benefit is IncludedQuantity.""" RESERVATION = "Reservation" - #: Benefit is SavingsPlan. + """Benefit is Reservation.""" SAVINGS_PLAN = "SavingsPlan" + """Benefit is SavingsPlan.""" + + +class BenefitUtilizationSummaryReportSchema(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The CSV file from the reportUrl and secondaryReportUrl blob link will consist of the following + columns of benefit utilization data. UtilizedPercentage will be 0 for savings plans reports and + non data bricks reservations. Utilization percentages will be 0 for data bricks reservations. + """ + + KIND = "Kind" + AVG_UTILIZATION_PERCENTAGE = "AvgUtilizationPercentage" + BENEFIT_ORDER_ID = "BenefitOrderId" + BENEFIT_ID = "BenefitId" + BENEFIT_TYPE = "BenefitType" + MAX_UTILIZATION_PERCENTAGE = "MaxUtilizationPercentage" + MIN_UTILIZATION_PERCENTAGE = "MinUtilizationPercentage" + USAGE_DATE = "UsageDate" + UTILIZED_PERCENTAGE = "UtilizedPercentage" class ChartType(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -134,28 +151,28 @@ class CheckNameAvailabilityReason(str, Enum, metaclass=CaseInsensitiveEnumMeta): class CostDetailsDataFormat(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The data format of the report.""" - #: Csv data format. CSV_COST_DETAILS_DATA_FORMAT = "Csv" + """Csv data format.""" class CostDetailsMetricType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of the detailed report. By default ActualCost is provided.""" - #: Actual cost data. ACTUAL_COST_COST_DETAILS_METRIC_TYPE = "ActualCost" - #: Amortized cost data. + """Actual cost data.""" AMORTIZED_COST_COST_DETAILS_METRIC_TYPE = "AmortizedCost" + """Amortized cost data.""" class CostDetailsStatusType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The status of the cost details operation.""" - #: Operation is Completed. COMPLETED_COST_DETAILS_STATUS_TYPE = "Completed" - #: Operation is Completed and no cost data found. + """Operation is Completed.""" NO_DATA_FOUND_COST_DETAILS_STATUS_TYPE = "NoDataFound" - #: Operation Failed. + """Operation is Completed and no cost data found.""" FAILED_COST_DETAILS_STATUS_TYPE = "Failed" + """Operation Failed.""" class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -199,7 +216,9 @@ class ExecutionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): class ExportType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of the query.""" + """The type of the export. Note that 'Usage' is equivalent to 'ActualCost' and is applicable to + exports that do not yet provide data for charges or amortization for service reservations. + """ USAGE = "Usage" ACTUAL_COST = "ActualCost" @@ -223,6 +242,7 @@ class ForecastOperatorType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The operator to use for comparison.""" IN = "In" + IN_ENUM = "In" class ForecastTimeframe(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -270,27 +290,27 @@ class GenerateDetailedCostReportMetricType(str, Enum, metaclass=CaseInsensitiveE class Grain(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Grain which corresponds to value.""" - #: Hourly grain corresponds to value per hour. HOURLY = "Hourly" - #: Hourly grain corresponds to value per day. + """Hourly grain corresponds to value per hour.""" DAILY = "Daily" - #: Hourly grain corresponds to value per month. + """Hourly grain corresponds to value per day.""" MONTHLY = "Monthly" + """Hourly grain corresponds to value per month.""" class GrainParameter(str, Enum, metaclass=CaseInsensitiveEnumMeta): """GrainParameter.""" - #: Hourly grain corresponds to value per hour. HOURLY = "Hourly" - #: Hourly grain corresponds to value per day. + """Hourly grain corresponds to value per hour.""" DAILY = "Daily" - #: Hourly grain corresponds to value per month. + """Hourly grain corresponds to value per day.""" MONTHLY = "Monthly" + """Hourly grain corresponds to value per month.""" class GranularityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The granularity of rows in the forecast.""" + """The granularity of rows in the export. Currently only 'Daily' is supported.""" DAILY = "Daily" @@ -305,12 +325,12 @@ class KpiType(str, Enum, metaclass=CaseInsensitiveEnumMeta): class LookBackPeriod(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The number of days used to look back.""" - #: 7 days used to look back. LAST7_DAYS = "Last7Days" - #: 30 days used to look back. + """7 days used to look back.""" LAST30_DAYS = "Last30Days" - #: 60 days used to look back. + """30 days used to look back.""" LAST60_DAYS = "Last60Days" + """60 days used to look back.""" class MetricType(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -322,11 +342,12 @@ class MetricType(str, Enum, metaclass=CaseInsensitiveEnumMeta): class OperationStatusType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The status of the long running operation.""" + """Enum representing the status of an async operation.""" RUNNING = "Running" - COMPLETED = "Completed" + COMPLETE = "Complete" FAILED = "Failed" + COMPLETED = "Completed" class OperatorType(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -334,6 +355,7 @@ class OperatorType(str, Enum, metaclass=CaseInsensitiveEnumMeta): IN = "In" CONTAINS = "Contains" + IN_ENUM = "In" class Origin(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -354,16 +376,19 @@ class PivotType(str, Enum, metaclass=CaseInsensitiveEnumMeta): class QueryColumnType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of the column in the export.""" + """The type of the column in the report.""" - TAG = "Tag" + TAG_KEY = "TagKey" + """The tag associated with the cost data.""" DIMENSION = "Dimension" + """The dimension of cost data.""" class QueryOperatorType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The operator to use for comparison.""" IN = "In" + IN_ENUM = "In" class RecurrenceType(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -375,13 +400,6 @@ class RecurrenceType(str, Enum, metaclass=CaseInsensitiveEnumMeta): ANNUALLY = "Annually" -class ReportConfigColumnType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of the column in the report.""" - - TAG = "Tag" - DIMENSION = "Dimension" - - class ReportConfigSortingType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Direction of sort.""" @@ -449,42 +467,42 @@ class ReservationReportSchema(str, Enum, metaclass=CaseInsensitiveEnumMeta): class ScheduledActionKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Kind of the scheduled action.""" - #: Cost analysis data will be emailed. EMAIL = "Email" - #: Cost anomaly information will be emailed. Available only on subscription scope at daily - #: frequency. If no anomaly is detected on the resource, an email won't be sent. + """Cost analysis data will be emailed.""" INSIGHT_ALERT = "InsightAlert" + """Cost anomaly information will be emailed. Available only on subscription scope at daily + #: frequency. If no anomaly is detected on the resource, an email won't be sent.""" class ScheduledActionStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Status of the scheduled action.""" - #: Scheduled action is saved but will not be run. DISABLED = "Disabled" - #: Scheduled action is saved and will be run. + """Scheduled action is saved but will not be run.""" ENABLED = "Enabled" - #: Scheduled action is expired. + """Scheduled action is saved and will be run.""" EXPIRED = "Expired" + """Scheduled action is expired.""" class ScheduleFrequency(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Frequency of the schedule.""" - #: Cost analysis data will be emailed every day. DAILY = "Daily" - #: Cost analysis data will be emailed every week. + """Cost analysis data will be emailed every day.""" WEEKLY = "Weekly" - #: Cost analysis data will be emailed every month. + """Cost analysis data will be emailed every week.""" MONTHLY = "Monthly" + """Cost analysis data will be emailed every month.""" class Scope(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Kind of the recommendation scope.""" - #: Single scope recommendation. SINGLE = "Single" - #: Shared scope recommendation. + """Single scope recommendation.""" SHARED = "Shared" + """Shared scope recommendation.""" class StatusType(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -497,14 +515,14 @@ class StatusType(str, Enum, metaclass=CaseInsensitiveEnumMeta): class Term(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Grain which corresponds to value.""" - #: Benefit term is 1 year. P1_Y = "P1Y" - #: Benefit term is 3 years. + """Benefit term is 1 year.""" P3_Y = "P3Y" + """Benefit term is 3 years.""" class TimeframeType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The time frame for pulling data for the query. If custom, then a specific time period must be + """The time frame for pulling data for the export. If custom, then a specific time period must be provided. """ diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/models/_models_py3.py b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/models/_models_py3.py index 94017df1f517..c5c7685f1ab0 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/models/_models_py3.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/models/_models_py3.py @@ -53,7 +53,7 @@ class CostManagementProxyResource(_serialization.Model): "e_tag": {"key": "eTag", "type": "str"}, } - def __init__(self, *, e_tag: Optional[str] = None, **kwargs): + def __init__(self, *, e_tag: Optional[str] = None, **kwargs: Any) -> None: """ :keyword e_tag: eTag of the resource. To handle concurrent update scenario, this field will be used to determine whether the user is updating the latest version or not. @@ -144,8 +144,8 @@ def __init__( modification_time: Optional[str] = None, status_modification_user_name: Optional[str] = None, status_modification_time: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword e_tag: eTag of the resource. To handle concurrent update scenario, this field will be used to determine whether the user is updating the latest version or not. @@ -217,8 +217,8 @@ def __init__( type: Optional[Union[str, "_models.AlertType"]] = None, category: Optional[Union[str, "_models.AlertCategory"]] = None, criteria: Optional[Union[str, "_models.AlertCriteria"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword type: type of alert. Known values are: "Budget", "Invoice", "Credit", "Quota", "General", "xCloud", and "BudgetForecast". @@ -340,8 +340,8 @@ def __init__( enrollment_start_date: Optional[str] = None, enrollment_end_date: Optional[str] = None, invoicing_threshold: Optional[float] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword time_grain_type: Type of timegrain cadence. Known values are: "None", "Monthly", "Quarterly", "Annually", "BillingMonth", "BillingQuarter", and "BillingAnnual". @@ -436,7 +436,7 @@ class AlertsResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None @@ -498,7 +498,7 @@ class AllSavingsBenefitDetails(_serialization.Model): "wastage_cost": {"key": "wastageCost", "type": "float"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.overage_cost = None @@ -533,13 +533,70 @@ class AllSavingsList(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None self.next_link = None +class AsyncOperationStatusProperties(_serialization.Model): + """Object representing the report url and valid until date of the async report generated. + + :ivar report_url: Sas url to the async benefit utilization summaries report. Will be empty if + the report is in Running or Failed state. Known values are: "Kind", "AvgUtilizationPercentage", + "BenefitOrderId", "BenefitId", "BenefitType", "MaxUtilizationPercentage", + "MinUtilizationPercentage", "UsageDate", and "UtilizedPercentage". + :vartype report_url: str or + ~azure.mgmt.costmanagement.models.BenefitUtilizationSummaryReportSchema + :ivar secondary_report_url: Sas url to async benefit utilization summaries report in secondary + storage in case of primary outage. Will be empty if the report is in Running or Failed state. + Known values are: "Kind", "AvgUtilizationPercentage", "BenefitOrderId", "BenefitId", + "BenefitType", "MaxUtilizationPercentage", "MinUtilizationPercentage", "UsageDate", and + "UtilizedPercentage". + :vartype secondary_report_url: str or + ~azure.mgmt.costmanagement.models.BenefitUtilizationSummaryReportSchema + :ivar valid_until: The date that the sas url provided in reportUrl expires. + :vartype valid_until: ~datetime.datetime + """ + + _attribute_map = { + "report_url": {"key": "reportUrl", "type": "str"}, + "secondary_report_url": {"key": "secondaryReportUrl", "type": "str"}, + "valid_until": {"key": "validUntil", "type": "iso-8601"}, + } + + def __init__( + self, + *, + report_url: Optional[Union[str, "_models.BenefitUtilizationSummaryReportSchema"]] = None, + secondary_report_url: Optional[Union[str, "_models.BenefitUtilizationSummaryReportSchema"]] = None, + valid_until: Optional[datetime.datetime] = None, + **kwargs: Any + ) -> None: + """ + :keyword report_url: Sas url to the async benefit utilization summaries report. Will be empty + if the report is in Running or Failed state. Known values are: "Kind", + "AvgUtilizationPercentage", "BenefitOrderId", "BenefitId", "BenefitType", + "MaxUtilizationPercentage", "MinUtilizationPercentage", "UsageDate", and "UtilizedPercentage". + :paramtype report_url: str or + ~azure.mgmt.costmanagement.models.BenefitUtilizationSummaryReportSchema + :keyword secondary_report_url: Sas url to async benefit utilization summaries report in + secondary storage in case of primary outage. Will be empty if the report is in Running or + Failed state. Known values are: "Kind", "AvgUtilizationPercentage", "BenefitOrderId", + "BenefitId", "BenefitType", "MaxUtilizationPercentage", "MinUtilizationPercentage", + "UsageDate", and "UtilizedPercentage". + :paramtype secondary_report_url: str or + ~azure.mgmt.costmanagement.models.BenefitUtilizationSummaryReportSchema + :keyword valid_until: The date that the sas url provided in reportUrl expires. + :paramtype valid_until: ~datetime.datetime + """ + super().__init__(**kwargs) + self.report_url = report_url + self.secondary_report_url = secondary_report_url + self.valid_until = valid_until + + class Resource(_serialization.Model): """Common fields that are returned in the response for all Azure Resource Manager resources. @@ -567,7 +624,7 @@ class Resource(_serialization.Model): "type": {"key": "type", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.id = None @@ -606,7 +663,7 @@ class BenefitResource(Resource): "kind": {"key": "kind", "type": "str"}, } - def __init__(self, *, kind: Optional[Union[str, "_models.BenefitKind"]] = None, **kwargs): + def __init__(self, *, kind: Optional[Union[str, "_models.BenefitKind"]] = None, **kwargs: Any) -> None: """ :keyword kind: Reservation or SavingsPlan. Known values are: "IncludedQuantity", "Reservation", and "SavingsPlan". @@ -655,8 +712,8 @@ def __init__( *, kind: Optional[Union[str, "_models.BenefitKind"]] = None, properties: Optional["_models.BenefitRecommendationProperties"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword kind: Reservation or SavingsPlan. Known values are: "IncludedQuantity", "Reservation", and "SavingsPlan". @@ -758,8 +815,8 @@ def __init__( term: Optional[Union[str, "_models.Term"]] = None, commitment_granularity: Optional[Union[str, "_models.Grain"]] = None, recommendation_details: Optional["_models.AllSavingsBenefitDetails"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword look_back_period: The number of days of usage evaluated for computing the recommendations. Known values are: "Last7Days", "Last30Days", and "Last60Days". @@ -789,7 +846,7 @@ def __init__( self.cost_without_benefit = None self.recommendation_details = recommendation_details self.all_recommendation_details = None - self.scope = None # type: Optional[str] + self.scope: Optional[str] = None class BenefitRecommendationsListResult(_serialization.Model): @@ -813,7 +870,7 @@ class BenefitRecommendationsListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None @@ -841,13 +898,161 @@ class BenefitUtilizationSummariesListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None self.next_link = None +class BenefitUtilizationSummariesOperationStatus(_serialization.Model): + """Status of a benefit utilization summaries report. Provides Async Benefit Utilization Summaries + Request input, status, and report sas url. + + :ivar input: Input given to create the benefit utilization summaries report. + :vartype input: ~azure.mgmt.costmanagement.models.BenefitUtilizationSummariesRequest + :ivar status: The status of the creation of the benefit utilization summaries report. Known + values are: "Running", "Complete", "Failed", and "Completed". + :vartype status: str or ~azure.mgmt.costmanagement.models.OperationStatusType + :ivar properties: Contains sas url to the async benefit utilization summaries report and a date + that the url is valid until. These values will be empty if the report is in a Running or Failed + state. + :vartype properties: ~azure.mgmt.costmanagement.models.AsyncOperationStatusProperties + """ + + _attribute_map = { + "input": {"key": "input", "type": "BenefitUtilizationSummariesRequest"}, + "status": {"key": "status", "type": "str"}, + "properties": {"key": "properties", "type": "AsyncOperationStatusProperties"}, + } + + def __init__( + self, + *, + input: Optional["_models.BenefitUtilizationSummariesRequest"] = None, + status: Optional[Union[str, "_models.OperationStatusType"]] = None, + properties: Optional["_models.AsyncOperationStatusProperties"] = None, + **kwargs: Any + ) -> None: + """ + :keyword input: Input given to create the benefit utilization summaries report. + :paramtype input: ~azure.mgmt.costmanagement.models.BenefitUtilizationSummariesRequest + :keyword status: The status of the creation of the benefit utilization summaries report. Known + values are: "Running", "Complete", "Failed", and "Completed". + :paramtype status: str or ~azure.mgmt.costmanagement.models.OperationStatusType + :keyword properties: Contains sas url to the async benefit utilization summaries report and a + date that the url is valid until. These values will be empty if the report is in a Running or + Failed state. + :paramtype properties: ~azure.mgmt.costmanagement.models.AsyncOperationStatusProperties + """ + super().__init__(**kwargs) + self.input = input + self.status = status + self.properties = properties + + +class BenefitUtilizationSummariesRequest(_serialization.Model): + """Properties of an async benefit utilization summaries request. + + All required parameters must be populated in order to send to Azure. + + :ivar billing_account_id: Billing account the benefit utilization summaries report is for. + Required for billing account and billing profile scopes. Not supported for any benefit scopes. + :vartype billing_account_id: str + :ivar billing_profile_id: Billing profile id the benefit utilization summaries report is for. + Required for billing profile scope. Not supported for billing account or any benefit scopes. + :vartype billing_profile_id: str + :ivar benefit_order_id: Benefit order id the benefit utilization summaries report is for. + Required for benefit order and benefit id scopes. Not supported for any billing scopes. + :vartype benefit_order_id: str + :ivar benefit_id: Benefit id the benefit utilization summaries report is for. Required for + benefit id scope. Not supported for benefit order or any billing scopes. + :vartype benefit_id: str + :ivar grain: The grain the summaries data is served at in the report. Accepted values are + 'Daily' or 'Monthly'. Required. Known values are: "Hourly", "Daily", and "Monthly". + :vartype grain: str or ~azure.mgmt.costmanagement.models.Grain + :ivar start_date: The start date of the summaries data that will be served in the report. + Required. + :vartype start_date: ~datetime.datetime + :ivar end_date: The end date of the summaries data that will be served in the report. Required. + :vartype end_date: ~datetime.datetime + :ivar kind: The type of benefit data requested. Required for billing account and billing + profile scopes. Implied and not to be passed at benefit scopes. Supported values are + Reservation and SavingsPlan. Known values are: "IncludedQuantity", "Reservation", and + "SavingsPlan". + :vartype kind: str or ~azure.mgmt.costmanagement.models.BenefitKind + """ + + _validation = { + "grain": {"required": True}, + "start_date": {"required": True}, + "end_date": {"required": True}, + } + + _attribute_map = { + "billing_account_id": {"key": "billingAccountId", "type": "str"}, + "billing_profile_id": {"key": "billingProfileId", "type": "str"}, + "benefit_order_id": {"key": "benefitOrderId", "type": "str"}, + "benefit_id": {"key": "benefitId", "type": "str"}, + "grain": {"key": "grain", "type": "str"}, + "start_date": {"key": "startDate", "type": "iso-8601"}, + "end_date": {"key": "endDate", "type": "iso-8601"}, + "kind": {"key": "kind", "type": "str"}, + } + + def __init__( + self, + *, + grain: Union[str, "_models.Grain"], + start_date: datetime.datetime, + end_date: datetime.datetime, + billing_account_id: Optional[str] = None, + billing_profile_id: Optional[str] = None, + benefit_order_id: Optional[str] = None, + benefit_id: Optional[str] = None, + kind: Optional[Union[str, "_models.BenefitKind"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword billing_account_id: Billing account the benefit utilization summaries report is for. + Required for billing account and billing profile scopes. Not supported for any benefit scopes. + :paramtype billing_account_id: str + :keyword billing_profile_id: Billing profile id the benefit utilization summaries report is + for. Required for billing profile scope. Not supported for billing account or any benefit + scopes. + :paramtype billing_profile_id: str + :keyword benefit_order_id: Benefit order id the benefit utilization summaries report is for. + Required for benefit order and benefit id scopes. Not supported for any billing scopes. + :paramtype benefit_order_id: str + :keyword benefit_id: Benefit id the benefit utilization summaries report is for. Required for + benefit id scope. Not supported for benefit order or any billing scopes. + :paramtype benefit_id: str + :keyword grain: The grain the summaries data is served at in the report. Accepted values are + 'Daily' or 'Monthly'. Required. Known values are: "Hourly", "Daily", and "Monthly". + :paramtype grain: str or ~azure.mgmt.costmanagement.models.Grain + :keyword start_date: The start date of the summaries data that will be served in the report. + Required. + :paramtype start_date: ~datetime.datetime + :keyword end_date: The end date of the summaries data that will be served in the report. + Required. + :paramtype end_date: ~datetime.datetime + :keyword kind: The type of benefit data requested. Required for billing account and billing + profile scopes. Implied and not to be passed at benefit scopes. Supported values are + Reservation and SavingsPlan. Known values are: "IncludedQuantity", "Reservation", and + "SavingsPlan". + :paramtype kind: str or ~azure.mgmt.costmanagement.models.BenefitKind + """ + super().__init__(**kwargs) + self.billing_account_id = billing_account_id + self.billing_profile_id = billing_profile_id + self.benefit_order_id = benefit_order_id + self.benefit_id = benefit_id + self.grain = grain + self.start_date = start_date + self.end_date = end_date + self.kind = kind + + class BenefitUtilizationSummary(Resource): """Benefit utilization summary resource. @@ -892,10 +1097,10 @@ class BenefitUtilizationSummary(Resource): } } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.kind = None # type: Optional[str] + self.kind: Optional[str] = None class BenefitUtilizationSummaryProperties(_serialization.Model): @@ -932,7 +1137,7 @@ class BenefitUtilizationSummaryProperties(_serialization.Model): "usage_date": {"key": "usageDate", "type": "iso-8601"}, } - def __init__(self, *, benefit_type: Optional[Union[str, "_models.BenefitKind"]] = None, **kwargs): + def __init__(self, *, benefit_type: Optional[Union[str, "_models.BenefitKind"]] = None, **kwargs: Any) -> None: """ :keyword benefit_type: The benefit type. Supported values: 'SavingsPlan'. Known values are: "IncludedQuantity", "Reservation", and "SavingsPlan". @@ -960,7 +1165,7 @@ class BlobInfo(_serialization.Model): "byte_count": {"key": "byteCount", "type": "int"}, } - def __init__(self, *, blob_link: Optional[str] = None, byte_count: Optional[int] = None, **kwargs): + def __init__(self, *, blob_link: Optional[str] = None, byte_count: Optional[int] = None, **kwargs: Any) -> None: """ :keyword blob_link: Link to the blob to download file. :paramtype blob_link: str @@ -986,7 +1191,7 @@ class CheckNameAvailabilityRequest(_serialization.Model): "type": {"key": "type", "type": "str"}, } - def __init__(self, *, name: Optional[str] = None, type: Optional[str] = None, **kwargs): + def __init__(self, *, name: Optional[str] = None, type: Optional[str] = None, **kwargs: Any) -> None: """ :keyword name: The name of the resource for which availability needs to be checked. :paramtype name: str @@ -1022,8 +1227,8 @@ def __init__( name_available: Optional[bool] = None, reason: Optional[Union[str, "_models.CheckNameAvailabilityReason"]] = None, message: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name_available: Indicates if the resource name is available. :paramtype name_available: bool @@ -1087,8 +1292,8 @@ def __init__( format: Optional[Union[str, "_models.FormatType"]] = None, run_history: Optional["_models.ExportExecutionListResult"] = None, partition_data: Optional[bool] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword format: The format of the export being delivered. Currently only 'Csv' is supported. "Csv" @@ -1186,8 +1391,8 @@ def __init__( blobs: Optional[List["_models.BlobInfo"]] = None, request_scope: Optional[str] = None, request_body: Optional["_models.GenerateCostDetailsReportRequestDefinition"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: The id of the long running operation. :paramtype id: str @@ -1239,7 +1444,8 @@ def __init__( class CostDetailsTimePeriod(_serialization.Model): - """The start and end date for pulling data for the cost detailed report. API only allows data to be pulled for 1 month or less and no older than 13 months. + """The start and end date for pulling data for the cost detailed report. API only allows data to + be pulled for 1 month or less and no older than 13 months. All required parameters must be populated in order to send to Azure. @@ -1259,7 +1465,7 @@ class CostDetailsTimePeriod(_serialization.Model): "end": {"key": "end", "type": "str"}, } - def __init__(self, *, start: str, end: str, **kwargs): + def __init__(self, *, start: str, end: str, **kwargs: Any) -> None: """ :keyword start: The start date to pull data from. example format 2020-03-15. Required. :paramtype start: str @@ -1308,7 +1514,7 @@ class Operation(_serialization.Model): "action_type": {"key": "actionType", "type": "str"}, } - def __init__(self, *, display: Optional["_models.OperationDisplay"] = None, **kwargs): + def __init__(self, *, display: Optional["_models.OperationDisplay"] = None, **kwargs: Any) -> None: """ :keyword display: Localized display information for this particular operation. :paramtype display: ~azure.mgmt.costmanagement.models.OperationDisplay @@ -1362,7 +1568,7 @@ class CostManagementOperation(Operation): "id": {"key": "id", "type": "str"}, } - def __init__(self, *, display: Optional["_models.OperationDisplay"] = None, **kwargs): + def __init__(self, *, display: Optional["_models.OperationDisplay"] = None, **kwargs: Any) -> None: """ :keyword display: Localized display information for this particular operation. :paramtype display: ~azure.mgmt.costmanagement.models.OperationDisplay @@ -1412,7 +1618,7 @@ class CostManagementResource(_serialization.Model): "tags": {"key": "tags", "type": "{str}"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.id = None @@ -1500,7 +1706,7 @@ class Dimension(CostManagementResource): # pylint: disable=too-many-instance-at "next_link": {"key": "properties.nextLink", "type": "str"}, } - def __init__(self, *, data: Optional[List[str]] = None, **kwargs): + def __init__(self, *, data: Optional[List[str]] = None, **kwargs: Any) -> None: """ :keyword data: Dimension data. :paramtype data: list[str] @@ -1534,7 +1740,7 @@ class DimensionsListResult(_serialization.Model): "value": {"key": "value", "type": "[Dimension]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None @@ -1596,8 +1802,8 @@ def __init__( modification_time: Optional[str] = None, status_modification_user_name: Optional[str] = None, status_modification_time: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword definition: defines the type of alert. :paramtype definition: ~azure.mgmt.costmanagement.models.AlertPropertiesDefinition @@ -1662,7 +1868,9 @@ class DownloadURL(_serialization.Model): "download_url": {"key": "downloadUrl", "type": "str"}, } - def __init__(self, *, valid_till: Optional[datetime.datetime] = None, download_url: Optional[str] = None, **kwargs): + def __init__( + self, *, valid_till: Optional[datetime.datetime] = None, download_url: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword valid_till: The time at which report URL becomes invalid/expires in UTC e.g. 2020-12-08T05:55:59.4394737Z. @@ -1676,6 +1884,77 @@ def __init__(self, *, valid_till: Optional[datetime.datetime] = None, download_u self.download_url = download_url +class ErrorAdditionalInfo(_serialization.Model): + """The resource management error additional info. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar type: The additional info type. + :vartype type: str + :ivar info: The additional info. + :vartype info: JSON + """ + + _validation = { + "type": {"readonly": True}, + "info": {"readonly": True}, + } + + _attribute_map = { + "type": {"key": "type", "type": "str"}, + "info": {"key": "info", "type": "object"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.type = None + self.info = None + + +class ErrorDetail(_serialization.Model): + """The error detail. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar code: The error code. + :vartype code: str + :ivar message: The error message. + :vartype message: str + :ivar target: The error target. + :vartype target: str + :ivar details: The error details. + :vartype details: list[~azure.mgmt.costmanagement.models.ErrorDetail] + :ivar additional_info: The error additional info. + :vartype additional_info: list[~azure.mgmt.costmanagement.models.ErrorAdditionalInfo] + """ + + _validation = { + "code": {"readonly": True}, + "message": {"readonly": True}, + "target": {"readonly": True}, + "details": {"readonly": True}, + "additional_info": {"readonly": True}, + } + + _attribute_map = { + "code": {"key": "code", "type": "str"}, + "message": {"key": "message", "type": "str"}, + "target": {"key": "target", "type": "str"}, + "details": {"key": "details", "type": "[ErrorDetail]"}, + "additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.code = None + self.message = None + self.target = None + self.details = None + self.additional_info = None + + class ErrorDetails(_serialization.Model): """The details of the error. @@ -1697,34 +1976,68 @@ class ErrorDetails(_serialization.Model): "message": {"key": "message", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.code = None self.message = None +class ErrorDetailsWithNestedDetails(ErrorDetails): + """The details of the error. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar code: Error code. + :vartype code: str + :ivar message: Error message indicating why the operation failed. + :vartype message: str + :ivar details: The additional details of the error. + :vartype details: list[~azure.mgmt.costmanagement.models.ErrorDetailsWithNestedDetails] + """ + + _validation = { + "code": {"readonly": True}, + "message": {"readonly": True}, + "details": {"readonly": True}, + } + + _attribute_map = { + "code": {"key": "code", "type": "str"}, + "message": {"key": "message", "type": "str"}, + "details": {"key": "details", "type": "[ErrorDetailsWithNestedDetails]"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.details = None + + class ErrorResponse(_serialization.Model): - """Error response indicates that the service is not able to process the incoming request. The reason is provided in the error message. + """Error response indicates that the service is not able to process the incoming request. The + reason is provided in the error message. Some Error responses: * - 429 TooManyRequests - Request is throttled. Retry after waiting for the time specified in the "x-ms-ratelimit-microsoft.consumption-retry-after" header. + 429 TooManyRequests - Request is throttled. Retry after waiting for the time specified in the + "x-ms-ratelimit-microsoft.consumption-retry-after" header. * - 503 ServiceUnavailable - Service is temporarily unavailable. Retry after waiting for the time specified in the "Retry-After" header. + 503 ServiceUnavailable - Service is temporarily unavailable. Retry after waiting for the time + specified in the "Retry-After" header. - :ivar error: The details of the error. - :vartype error: ~azure.mgmt.costmanagement.models.ErrorDetails + :ivar error: The details of the error. + :vartype error: ~azure.mgmt.costmanagement.models.ErrorDetails """ _attribute_map = { "error": {"key": "error", "type": "ErrorDetails"}, } - def __init__(self, *, error: Optional["_models.ErrorDetails"] = None, **kwargs): + def __init__(self, *, error: Optional["_models.ErrorDetails"] = None, **kwargs: Any) -> None: """ :keyword error: The details of the error. :paramtype error: ~azure.mgmt.costmanagement.models.ErrorDetails @@ -1733,6 +2046,59 @@ def __init__(self, *, error: Optional["_models.ErrorDetails"] = None, **kwargs): self.error = error +class ErrorResponseAutoGenerated(_serialization.Model): + """Common error response for all Azure Resource Manager APIs to return error details for failed + operations. (This also follows the OData error response format.). + + :ivar error: The error object. + :vartype error: ~azure.mgmt.costmanagement.models.ErrorDetail + """ + + _attribute_map = { + "error": {"key": "error", "type": "ErrorDetail"}, + } + + def __init__(self, *, error: Optional["_models.ErrorDetail"] = None, **kwargs: Any) -> None: + """ + :keyword error: The error object. + :paramtype error: ~azure.mgmt.costmanagement.models.ErrorDetail + """ + super().__init__(**kwargs) + self.error = error + + +class ErrorResponseWithNestedDetails(_serialization.Model): + """Error response indicates that the service is not able to process the incoming request. The + reason is provided in the error message. + + Some Error responses: + + + * + 429 TooManyRequests - Request is throttled. Retry after waiting for the time specified in the + "x-ms-ratelimit-microsoft.consumption-retry-after" header. + + * + 503 ServiceUnavailable - Service is temporarily unavailable. Retry after waiting for the time + specified in the "Retry-After" header. + + :ivar error: The details of the error. + :vartype error: ~azure.mgmt.costmanagement.models.ErrorDetailsWithNestedDetails + """ + + _attribute_map = { + "error": {"key": "error", "type": "ErrorDetailsWithNestedDetails"}, + } + + def __init__(self, *, error: Optional["_models.ErrorDetailsWithNestedDetails"] = None, **kwargs: Any) -> None: + """ + :keyword error: The details of the error. + :paramtype error: ~azure.mgmt.costmanagement.models.ErrorDetailsWithNestedDetails + """ + super().__init__(**kwargs) + self.error = error + + class Export(CostManagementProxyResource): # pylint: disable=too-many-instance-attributes """An export resource. @@ -1798,8 +2164,8 @@ def __init__( run_history: Optional["_models.ExportExecutionListResult"] = None, partition_data: Optional[bool] = None, schedule: Optional["_models.ExportSchedule"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword e_tag: eTag of the resource. To handle concurrent update scenario, this field will be used to determine whether the user is updating the latest version or not. @@ -1850,8 +2216,8 @@ def __init__( *, granularity: Optional[Union[str, "_models.GranularityType"]] = None, configuration: Optional["_models.ExportDatasetConfiguration"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword granularity: The granularity of rows in the export. Currently only 'Daily' is supported. "Daily" @@ -1865,7 +2231,8 @@ def __init__( class ExportDatasetConfiguration(_serialization.Model): - """The export dataset configuration. Allows columns to be selected for the export. If not provided then the export will include all available columns. + """The export dataset configuration. Allows columns to be selected for the export. If not provided + then the export will include all available columns. :ivar columns: Array of column names to be included in the export. If not provided then the export will include all available columns. The available columns can vary by customer channel @@ -1877,7 +2244,7 @@ class ExportDatasetConfiguration(_serialization.Model): "columns": {"key": "columns", "type": "[str]"}, } - def __init__(self, *, columns: Optional[List[str]] = None, **kwargs): + def __init__(self, *, columns: Optional[List[str]] = None, **kwargs: Any) -> None: """ :keyword columns: Array of column names to be included in the export. If not provided then the export will include all available columns. The available columns can vary by customer channel @@ -1926,8 +2293,8 @@ def __init__( timeframe: Union[str, "_models.TimeframeType"], time_period: Optional["_models.ExportTimePeriod"] = None, data_set: Optional["_models.ExportDataset"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword type: The type of the export. Note that 'Usage' is equivalent to 'ActualCost' and is applicable to exports that do not yet provide data for charges or amortization for service @@ -1950,7 +2317,22 @@ def __init__( class ExportDeliveryDestination(_serialization.Model): - """This represents the blob storage account location where exports of costs will be delivered. There are two ways to configure the destination. The approach recommended for most customers is to specify the resourceId of the storage account. This requires a one-time registration of the account's subscription with the Microsoft.CostManagementExports resource provider in order to give Cost Management services access to the storage. When creating an export in the Azure portal this registration is performed automatically but API users may need to register the subscription explicitly (for more information see https://docs.microsoft.com/en-us/azure/azure-resource-manager/resource-manager-supported-services ). Another way to configure the destination is available ONLY to Partners with a Microsoft Partner Agreement plan who are global admins of their billing account. These Partners, instead of specifying the resourceId of a storage account, can specify the storage account name along with a SAS token for the account. This allows exports of costs to a storage account in any tenant. The SAS token should be created for the blob service with Service/Container/Object resource types and with Read/Write/Delete/List/Add/Create permissions (for more information see https://docs.microsoft.com/en-us/azure/cost-management-billing/costs/export-cost-data-storage-account-sas-key ). + """This represents the blob storage account location where exports of costs will be delivered. + There are two ways to configure the destination. The approach recommended for most customers is + to specify the resourceId of the storage account. This requires a one-time registration of the + account's subscription with the Microsoft.CostManagementExports resource provider in order to + give Cost Management services access to the storage. When creating an export in the Azure + portal this registration is performed automatically but API users may need to register the + subscription explicitly (for more information see + https://docs.microsoft.com/en-us/azure/azure-resource-manager/resource-manager-supported-services + ). Another way to configure the destination is available ONLY to Partners with a Microsoft + Partner Agreement plan who are global admins of their billing account. These Partners, instead + of specifying the resourceId of a storage account, can specify the storage account name along + with a SAS token for the account. This allows exports of costs to a storage account in any + tenant. The SAS token should be created for the blob service with Service/Container/Object + resource types and with Read/Write/Delete/List/Add/Create permissions (for more information see + https://docs.microsoft.com/en-us/azure/cost-management-billing/costs/export-cost-data-storage-account-sas-key + ). All required parameters must be populated in order to send to Azure. @@ -1993,8 +2375,8 @@ def __init__( root_folder_path: Optional[str] = None, sas_token: Optional[str] = None, storage_account: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword resource_id: The resource id of the storage account where exports will be delivered. This is not required if a sasToken and storageAccount are specified. @@ -2039,7 +2421,7 @@ class ExportDeliveryInfo(_serialization.Model): "destination": {"key": "destination", "type": "ExportDeliveryDestination"}, } - def __init__(self, *, destination: "_models.ExportDeliveryDestination", **kwargs): + def __init__(self, *, destination: "_models.ExportDeliveryDestination", **kwargs: Any) -> None: """ :keyword destination: Has destination for the export being delivered. Required. :paramtype destination: ~azure.mgmt.costmanagement.models.ExportDeliveryDestination @@ -2065,7 +2447,7 @@ class ExportExecutionListResult(_serialization.Model): "value": {"key": "value", "type": "[ExportRun]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None @@ -2088,7 +2470,7 @@ class ExportListResult(_serialization.Model): "value": {"key": "value", "type": "[Export]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None @@ -2146,8 +2528,8 @@ def __init__( run_history: Optional["_models.ExportExecutionListResult"] = None, partition_data: Optional[bool] = None, schedule: Optional["_models.ExportSchedule"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword format: The format of the export being delivered. Currently only 'Csv' is supported. "Csv" @@ -2196,7 +2578,9 @@ class ExportRecurrencePeriod(_serialization.Model): "to": {"key": "to", "type": "iso-8601"}, } - def __init__(self, *, from_property: datetime.datetime, to: Optional[datetime.datetime] = None, **kwargs): + def __init__( + self, *, from_property: datetime.datetime, to: Optional[datetime.datetime] = None, **kwargs: Any + ) -> None: """ :keyword from_property: The start date of recurrence. Required. :paramtype from_property: ~datetime.datetime @@ -2279,8 +2663,8 @@ def __init__( file_name: Optional[str] = None, run_settings: Optional["_models.CommonExportProperties"] = None, error: Optional["_models.ErrorDetails"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword e_tag: eTag of the resource. To handle concurrent update scenario, this field will be used to determine whether the user is updating the latest version or not. @@ -2345,8 +2729,8 @@ def __init__( status: Optional[Union[str, "_models.StatusType"]] = None, recurrence: Optional[Union[str, "_models.RecurrenceType"]] = None, recurrence_period: Optional["_models.ExportRecurrencePeriod"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword status: The status of the export's schedule. If 'Inactive', the export's schedule is paused. Known values are: "Active" and "Inactive". @@ -2365,7 +2749,8 @@ def __init__( class ExportTimePeriod(_serialization.Model): - """The date range for data in the export. This should only be specified with timeFrame set to 'Custom'. The maximum date range is 3 months. + """The date range for data in the export. This should only be specified with timeFrame set to + 'Custom'. The maximum date range is 3 months. All required parameters must be populated in order to send to Azure. @@ -2385,7 +2770,7 @@ class ExportTimePeriod(_serialization.Model): "to": {"key": "to", "type": "iso-8601"}, } - def __init__(self, *, from_property: datetime.datetime, to: datetime.datetime, **kwargs): + def __init__(self, *, from_property: datetime.datetime, to: datetime.datetime, **kwargs: Any) -> None: """ :keyword from_property: The start date for export data. Required. :paramtype from_property: ~datetime.datetime @@ -2408,7 +2793,7 @@ class FileDestination(_serialization.Model): "file_formats": {"key": "fileFormats", "type": "[str]"}, } - def __init__(self, *, file_formats: Optional[List[Union[str, "_models.FileFormat"]]] = None, **kwargs): + def __init__(self, *, file_formats: Optional[List[Union[str, "_models.FileFormat"]]] = None, **kwargs: Any) -> None: """ :keyword file_formats: Destination of the view data. Currently only CSV format is supported. :paramtype file_formats: list[str or ~azure.mgmt.costmanagement.models.FileFormat] @@ -2440,8 +2825,8 @@ class ForecastAggregation(_serialization.Model): } def __init__( - self, *, name: Union[str, "_models.FunctionName"], function: Union[str, "_models.FunctionType"], **kwargs - ): + self, *, name: Union[str, "_models.FunctionName"], function: Union[str, "_models.FunctionType"], **kwargs: Any + ) -> None: """ :keyword name: The name of the column to aggregate. Required. Known values are: "PreTaxCostUSD", "Cost", "CostUSD", and "PreTaxCost". @@ -2468,7 +2853,7 @@ class ForecastColumn(_serialization.Model): "type": {"key": "type", "type": "str"}, } - def __init__(self, *, name: Optional[str] = None, type: Optional[str] = None, **kwargs): + def __init__(self, *, name: Optional[str] = None, type: Optional[str] = None, **kwargs: Any) -> None: """ :keyword name: The name of column. :paramtype name: str @@ -2487,7 +2872,7 @@ class ForecastComparisonExpression(_serialization.Model): :ivar name: The name of the column to use in comparison. Required. :vartype name: str - :ivar operator: The operator to use for comparison. Required. "In" + :ivar operator: The operator to use for comparison. Required. Known values are: "In" and "In". :vartype operator: str or ~azure.mgmt.costmanagement.models.ForecastOperatorType :ivar values: Array of values to use for comparison. Required. :vartype values: list[str] @@ -2505,11 +2890,14 @@ class ForecastComparisonExpression(_serialization.Model): "values": {"key": "values", "type": "[str]"}, } - def __init__(self, *, name: str, operator: Union[str, "_models.ForecastOperatorType"], values: List[str], **kwargs): + def __init__( + self, *, name: str, operator: Union[str, "_models.ForecastOperatorType"], values: List[str], **kwargs: Any + ) -> None: """ :keyword name: The name of the column to use in comparison. Required. :paramtype name: str - :keyword operator: The operator to use for comparison. Required. "In" + :keyword operator: The operator to use for comparison. Required. Known values are: "In" and + "In". :paramtype operator: str or ~azure.mgmt.costmanagement.models.ForecastOperatorType :keyword values: Array of values to use for comparison. Required. :paramtype values: list[str] @@ -2556,8 +2944,8 @@ def __init__( granularity: Optional[Union[str, "_models.GranularityType"]] = None, configuration: Optional["_models.ForecastDatasetConfiguration"] = None, filter: Optional["_models.ForecastFilter"] = None, # pylint: disable=redefined-builtin - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword granularity: The granularity of rows in the forecast. "Daily" :paramtype granularity: str or ~azure.mgmt.costmanagement.models.GranularityType @@ -2590,7 +2978,7 @@ class ForecastDatasetConfiguration(_serialization.Model): "columns": {"key": "columns", "type": "[str]"}, } - def __init__(self, *, columns: Optional[List[str]] = None, **kwargs): + def __init__(self, *, columns: Optional[List[str]] = None, **kwargs: Any) -> None: """ :keyword columns: Array of column names to be included in the forecast. Any valid forecast column name is allowed. If not provided, then forecast includes all columns. @@ -2645,8 +3033,8 @@ def __init__( time_period: Optional["_models.ForecastTimePeriod"] = None, include_actual_cost: Optional[bool] = None, include_fresh_partial_cost: Optional[bool] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword type: The type of the forecast. Required. Known values are: "Usage", "ActualCost", and "AmortizedCost". @@ -2705,8 +3093,8 @@ def __init__( or_property: Optional[List["_models.ForecastFilter"]] = None, dimensions: Optional["_models.ForecastComparisonExpression"] = None, tags: Optional["_models.ForecastComparisonExpression"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword and_property: The logical "AND" expression. Must have at least 2 items. :paramtype and_property: list[~azure.mgmt.costmanagement.models.ForecastFilter] @@ -2780,8 +3168,8 @@ def __init__( next_link: Optional[str] = None, columns: Optional[List["_models.ForecastColumn"]] = None, rows: Optional[List[List[Any]]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword next_link: The link (url) to the next page of results. :paramtype next_link: str @@ -2817,7 +3205,7 @@ class ForecastTimePeriod(_serialization.Model): "to": {"key": "to", "type": "iso-8601"}, } - def __init__(self, *, from_property: datetime.datetime, to: datetime.datetime, **kwargs): + def __init__(self, *, from_property: datetime.datetime, to: datetime.datetime, **kwargs: Any) -> None: """ :keyword from_property: The start date to pull data from. Required. :paramtype from_property: ~datetime.datetime @@ -2830,38 +3218,46 @@ def __init__(self, *, from_property: datetime.datetime, to: datetime.datetime, * class GenerateCostDetailsReportErrorResponse(_serialization.Model): - """Error response indicates that the service is not able to process the incoming request. The reason is provided in the error message. + """Error response indicates that the service is not able to process the incoming request. The + reason is provided in the error message. Some Error responses: * - 400 Bad Request - Invalid Request Payload. Request payload provided is not in a json format or had an invalid member not accepted in the request payload. + 400 Bad Request - Invalid Request Payload. Request payload provided is not in a json format + or had an invalid member not accepted in the request payload. * - 400 Bad Request - Invalid request payload: can only have either timePeriod or invoiceId or billingPeriod. API only allows data to be pulled for either timePeriod or invoiceId or billingPeriod. Customer should provide only one of these parameters. + 400 Bad Request - Invalid request payload: can only have either timePeriod or invoiceId or + billingPeriod. API only allows data to be pulled for either timePeriod or invoiceId or + billingPeriod. Customer should provide only one of these parameters. * - 400 Bad Request - Start date must be after . API only allows data to be pulled no older than 13 months from now. + 400 Bad Request - Start date must be after . API only allows data to be pulled no older than + 13 months from now. * - 400 Bad Request - The maximum allowed date range is 1 months. API only allows data to be pulled for 1 month or less. + 400 Bad Request - The maximum allowed date range is 1 months. API only allows data to be + pulled for 1 month or less. * - 429 TooManyRequests - Request is throttled. Retry after waiting for the time specified in the "retry-after" header. + 429 TooManyRequests - Request is throttled. Retry after waiting for the time specified in the + "retry-after" header. * - 503 ServiceUnavailable - Service is temporarily unavailable. Retry after waiting for the time specified in the "Retry-After" header. + 503 ServiceUnavailable - Service is temporarily unavailable. Retry after waiting for the time + specified in the "Retry-After" header. - :ivar error: The details of the error. - :vartype error: ~azure.mgmt.costmanagement.models.ErrorDetails + :ivar error: The details of the error. + :vartype error: ~azure.mgmt.costmanagement.models.ErrorDetails """ _attribute_map = { "error": {"key": "error", "type": "ErrorDetails"}, } - def __init__(self, *, error: Optional["_models.ErrorDetails"] = None, **kwargs): + def __init__(self, *, error: Optional["_models.ErrorDetails"] = None, **kwargs: Any) -> None: """ :keyword error: The details of the error. :paramtype error: ~azure.mgmt.costmanagement.models.ErrorDetails @@ -2910,8 +3306,8 @@ def __init__( time_period: Optional["_models.CostDetailsTimePeriod"] = None, billing_period: Optional[str] = None, invoice_id: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword metric: The type of the detailed report. By default ActualCost is provided. Known values are: "ActualCost" and "AmortizedCost". @@ -2981,8 +3377,8 @@ def __init__( billing_period: Optional[str] = None, invoice_id: Optional[str] = None, customer_id: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword metric: The type of the detailed report. By default ActualCost is provided. Known values are: "ActualCost" and "AmortizedCost". @@ -3013,29 +3409,34 @@ def __init__( class GenerateDetailedCostReportErrorResponse(_serialization.Model): - """Error response indicates that the service is not able to process the incoming request. The reason is provided in the error message. + """Error response indicates that the service is not able to process the incoming request. The + reason is provided in the error message. Some Error responses: * - 413 Request Entity Too Large - Request is throttled. The amount of data required to fulfill the request exceeds the maximum size permitted of 2Gb. Please utilize our Exports feature instead. + 413 Request Entity Too Large - Request is throttled. The amount of data required to fulfill + the request exceeds the maximum size permitted of 2Gb. Please utilize our Exports feature + instead. * - 429 TooManyRequests - Request is throttled. Retry after waiting for the time specified in the "x-ms-ratelimit-microsoft.consumption-retry-after" header. + 429 TooManyRequests - Request is throttled. Retry after waiting for the time specified in the + "x-ms-ratelimit-microsoft.consumption-retry-after" header. * - 503 ServiceUnavailable - Service is temporarily unavailable. Retry after waiting for the time specified in the "Retry-After" header. + 503 ServiceUnavailable - Service is temporarily unavailable. Retry after waiting for the time + specified in the "Retry-After" header. - :ivar error: The details of the error. - :vartype error: ~azure.mgmt.costmanagement.models.ErrorDetails + :ivar error: The details of the error. + :vartype error: ~azure.mgmt.costmanagement.models.ErrorDetails """ _attribute_map = { "error": {"key": "error", "type": "ErrorDetails"}, } - def __init__(self, *, error: Optional["_models.ErrorDetails"] = None, **kwargs): + def __init__(self, *, error: Optional["_models.ErrorDetails"] = None, **kwargs: Any) -> None: """ :keyword error: The details of the error. :paramtype error: ~azure.mgmt.costmanagement.models.ErrorDetails @@ -3086,8 +3487,8 @@ def __init__( type: Optional[str] = None, valid_till: Optional[datetime.datetime] = None, download_url: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: The ARM resource id of the long running operation. :paramtype id: str @@ -3121,6 +3522,10 @@ class GenerateDetailedCostReportOperationStatuses(_serialization.Model): :vartype name: str :ivar status: The status of the long running operation. :vartype status: ~azure.mgmt.costmanagement.models.Status + :ivar start_time: The startTime of the operation. + :vartype start_time: str + :ivar end_time: The endTime of the operation. + :vartype end_time: str :ivar type: The type of the long running operation. :vartype type: str :ivar error: The details of the error. @@ -3143,6 +3548,8 @@ class GenerateDetailedCostReportOperationStatuses(_serialization.Model): "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, "status": {"key": "status", "type": "Status"}, + "start_time": {"key": "startTime", "type": "str"}, + "end_time": {"key": "endTime", "type": "str"}, "type": {"key": "type", "type": "str"}, "error": {"key": "error", "type": "ErrorDetails"}, "expiry_time": {"key": "properties.expiryTime", "type": "iso-8601"}, @@ -3156,12 +3563,14 @@ def __init__( id: Optional[str] = None, # pylint: disable=redefined-builtin name: Optional[str] = None, status: Optional["_models.Status"] = None, + start_time: Optional[str] = None, + end_time: Optional[str] = None, type: Optional[str] = None, error: Optional["_models.ErrorDetails"] = None, valid_till: Optional[datetime.datetime] = None, download_url: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: The ID of the long running operation. :paramtype id: str @@ -3169,6 +3578,10 @@ def __init__( :paramtype name: str :keyword status: The status of the long running operation. :paramtype status: ~azure.mgmt.costmanagement.models.Status + :keyword start_time: The startTime of the operation. + :paramtype start_time: str + :keyword end_time: The endTime of the operation. + :paramtype end_time: str :keyword type: The type of the long running operation. :paramtype type: str :keyword error: The details of the error. @@ -3183,6 +3596,8 @@ def __init__( self.id = id self.name = name self.status = status + self.start_time = start_time + self.end_time = end_time self.type = type self.error = error self.expiry_time = None @@ -3211,7 +3626,7 @@ class GenerateDetailedCostReportTimePeriod(_serialization.Model): "end": {"key": "end", "type": "str"}, } - def __init__(self, *, start: str, end: str, **kwargs): + def __init__(self, *, start: str, end: str, **kwargs: Any) -> None: """ :keyword start: The start date to pull data from. example format 2020-03-15. Required. :paramtype start: str @@ -3282,14 +3697,14 @@ class IncludedQuantityUtilizationSummary(BenefitUtilizationSummary): "utilization_percentage": {"key": "properties.utilizationPercentage", "type": "float"}, } - def __init__(self, *, benefit_type: Optional[Union[str, "_models.BenefitKind"]] = None, **kwargs): + def __init__(self, *, benefit_type: Optional[Union[str, "_models.BenefitKind"]] = None, **kwargs: Any) -> None: """ :keyword benefit_type: The benefit type. Supported values: 'SavingsPlan'. Known values are: "IncludedQuantity", "Reservation", and "SavingsPlan". :paramtype benefit_type: str or ~azure.mgmt.costmanagement.models.BenefitKind """ super().__init__(**kwargs) - self.kind = "IncludedQuantity" # type: str + self.kind: str = "IncludedQuantity" self.arm_sku_name = None self.benefit_id = None self.benefit_order_id = None @@ -3336,7 +3751,7 @@ class IncludedQuantityUtilizationSummaryProperties(BenefitUtilizationSummaryProp "utilization_percentage": {"key": "utilizationPercentage", "type": "float"}, } - def __init__(self, *, benefit_type: Optional[Union[str, "_models.BenefitKind"]] = None, **kwargs): + def __init__(self, *, benefit_type: Optional[Union[str, "_models.BenefitKind"]] = None, **kwargs: Any) -> None: """ :keyword benefit_type: The benefit type. Supported values: 'SavingsPlan'. Known values are: "IncludedQuantity", "Reservation", and "SavingsPlan". @@ -3369,8 +3784,8 @@ def __init__( type: Optional[Union[str, "_models.KpiType"]] = None, id: Optional[str] = None, # pylint: disable=redefined-builtin enabled: Optional[bool] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword type: KPI type (Forecast, Budget). Known values are: "Forecast" and "Budget". :paramtype type: str or ~azure.mgmt.costmanagement.models.KpiType @@ -3424,8 +3839,8 @@ def __init__( language: Optional[str] = None, message: Optional[str] = None, regional_format: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword to: Array of email addresses. Required. :paramtype to: list[str] @@ -3481,7 +3896,7 @@ class OperationDisplay(_serialization.Model): "description": {"key": "description", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.provider = None @@ -3491,7 +3906,8 @@ def __init__(self, **kwargs): class OperationListResult(_serialization.Model): - """Result of listing cost management operations. It contains a list of operations and a URL link to get the next set of results. + """Result of listing cost management operations. It contains a list of operations and a URL link + to get the next set of results. Variables are only populated by the server, and will be ignored when sending a request. @@ -3512,7 +3928,7 @@ class OperationListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None @@ -3523,7 +3939,7 @@ class OperationStatus(_serialization.Model): """The status of the long running operation. :ivar status: The status of the long running operation. Known values are: "Running", - "Completed", and "Failed". + "Complete", "Failed", and "Completed". :vartype status: str or ~azure.mgmt.costmanagement.models.OperationStatusType :ivar report_url: The CSV file from the reportUrl blob link consists of reservation usage data with the following schema at daily granularity. Known values are: "InstanceFlexibilityGroup", @@ -3546,11 +3962,11 @@ def __init__( status: Optional[Union[str, "_models.OperationStatusType"]] = None, report_url: Optional[Union[str, "_models.ReservationReportSchema"]] = None, valid_until: Optional[datetime.datetime] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword status: The status of the long running operation. Known values are: "Running", - "Completed", and "Failed". + "Complete", "Failed", and "Completed". :paramtype status: str or ~azure.mgmt.costmanagement.models.OperationStatusType :keyword report_url: The CSV file from the reportUrl blob link consists of reservation usage data with the following schema at daily granularity. Known values are: @@ -3581,7 +3997,9 @@ class PivotProperties(_serialization.Model): "name": {"key": "name", "type": "str"}, } - def __init__(self, *, type: Optional[Union[str, "_models.PivotType"]] = None, name: Optional[str] = None, **kwargs): + def __init__( + self, *, type: Optional[Union[str, "_models.PivotType"]] = None, name: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword type: Data type to show in view. Known values are: "Dimension" and "TagKey". :paramtype type: str or ~azure.mgmt.costmanagement.models.PivotType @@ -3594,7 +4012,8 @@ def __init__(self, *, type: Optional[Union[str, "_models.PivotType"]] = None, na class ProxyResource(Resource): - """The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a location. + """The resource model definition for a Azure Resource Manager proxy resource. It will not have + tags and a location. Variables are only populated by the server, and will be ignored when sending a request. @@ -3620,7 +4039,7 @@ class ProxyResource(Resource): "type": {"key": "type", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) @@ -3646,7 +4065,7 @@ class QueryAggregation(_serialization.Model): "function": {"key": "function", "type": "str"}, } - def __init__(self, *, name: str, function: Union[str, "_models.FunctionType"], **kwargs): + def __init__(self, *, name: str, function: Union[str, "_models.FunctionType"], **kwargs: Any) -> None: """ :keyword name: The name of the column to aggregate. Required. :paramtype name: str @@ -3672,7 +4091,7 @@ class QueryColumn(_serialization.Model): "type": {"key": "type", "type": "str"}, } - def __init__(self, *, name: Optional[str] = None, type: Optional[str] = None, **kwargs): + def __init__(self, *, name: Optional[str] = None, type: Optional[str] = None, **kwargs: Any) -> None: """ :keyword name: The name of column. :paramtype name: str @@ -3691,7 +4110,7 @@ class QueryComparisonExpression(_serialization.Model): :ivar name: The name of the column to use in comparison. Required. :vartype name: str - :ivar operator: The operator to use for comparison. Required. "In" + :ivar operator: The operator to use for comparison. Required. Known values are: "In" and "In". :vartype operator: str or ~azure.mgmt.costmanagement.models.QueryOperatorType :ivar values: Array of values to use for comparison. Required. :vartype values: list[str] @@ -3709,11 +4128,14 @@ class QueryComparisonExpression(_serialization.Model): "values": {"key": "values", "type": "[str]"}, } - def __init__(self, *, name: str, operator: Union[str, "_models.QueryOperatorType"], values: List[str], **kwargs): + def __init__( + self, *, name: str, operator: Union[str, "_models.QueryOperatorType"], values: List[str], **kwargs: Any + ) -> None: """ :keyword name: The name of the column to use in comparison. Required. :paramtype name: str - :keyword operator: The operator to use for comparison. Required. "In" + :keyword operator: The operator to use for comparison. Required. Known values are: "In" and + "In". :paramtype operator: str or ~azure.mgmt.costmanagement.models.QueryOperatorType :keyword values: Array of values to use for comparison. Required. :paramtype values: list[str] @@ -3764,8 +4186,8 @@ def __init__( aggregation: Optional[Dict[str, "_models.QueryAggregation"]] = None, grouping: Optional[List["_models.QueryGrouping"]] = None, filter: Optional["_models.QueryFilter"] = None, # pylint: disable=redefined-builtin - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword granularity: The granularity of rows in the query. "Daily" :paramtype granularity: str or ~azure.mgmt.costmanagement.models.GranularityType @@ -3803,7 +4225,7 @@ class QueryDatasetConfiguration(_serialization.Model): "columns": {"key": "columns", "type": "[str]"}, } - def __init__(self, *, columns: Optional[List[str]] = None, **kwargs): + def __init__(self, *, columns: Optional[List[str]] = None, **kwargs: Any) -> None: """ :keyword columns: Array of column names to be included in the query. Any valid query column name is allowed. If not provided, then query includes all columns. @@ -3851,8 +4273,8 @@ def __init__( timeframe: Union[str, "_models.TimeframeType"], dataset: "_models.QueryDataset", time_period: Optional["_models.QueryTimePeriod"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword type: The type of the query. Required. Known values are: "Usage", "ActualCost", and "AmortizedCost". @@ -3905,8 +4327,8 @@ def __init__( or_property: Optional[List["_models.QueryFilter"]] = None, dimensions: Optional["_models.QueryComparisonExpression"] = None, tags: Optional["_models.QueryComparisonExpression"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword and_property: The logical "AND" expression. Must have at least 2 items. :paramtype and_property: list[~azure.mgmt.costmanagement.models.QueryFilter] @@ -3929,7 +4351,8 @@ class QueryGrouping(_serialization.Model): All required parameters must be populated in order to send to Azure. - :ivar type: Has type of the column to group. Required. Known values are: "Tag" and "Dimension". + :ivar type: Has type of the column to group. Required. Known values are: "TagKey" and + "Dimension". :vartype type: str or ~azure.mgmt.costmanagement.models.QueryColumnType :ivar name: The name of the column to group. Required. :vartype name: str @@ -3945,9 +4368,9 @@ class QueryGrouping(_serialization.Model): "name": {"key": "name", "type": "str"}, } - def __init__(self, *, type: Union[str, "_models.QueryColumnType"], name: str, **kwargs): + def __init__(self, *, type: Union[str, "_models.QueryColumnType"], name: str, **kwargs: Any) -> None: """ - :keyword type: Has type of the column to group. Required. Known values are: "Tag" and + :keyword type: Has type of the column to group. Required. Known values are: "TagKey" and "Dimension". :paramtype type: str or ~azure.mgmt.costmanagement.models.QueryColumnType :keyword name: The name of the column to group. Required. @@ -4014,8 +4437,8 @@ def __init__( next_link: Optional[str] = None, columns: Optional[List["_models.QueryColumn"]] = None, rows: Optional[List[List[Any]]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword next_link: The link (url) to the next page of results. :paramtype next_link: str @@ -4051,7 +4474,7 @@ class QueryTimePeriod(_serialization.Model): "to": {"key": "to", "type": "iso-8601"}, } - def __init__(self, *, from_property: datetime.datetime, to: datetime.datetime, **kwargs): + def __init__(self, *, from_property: datetime.datetime, to: datetime.datetime, **kwargs: Any) -> None: """ :keyword from_property: The start date to pull data from. Required. :paramtype from_property: ~datetime.datetime @@ -4064,7 +4487,8 @@ def __init__(self, *, from_property: datetime.datetime, to: datetime.datetime, * class RecommendationUsageDetails(_serialization.Model): - """On-demand charges between firstConsumptionDate and lastConsumptionDate that were used for computing benefit recommendations. + """On-demand charges between firstConsumptionDate and lastConsumptionDate that were used for + computing benefit recommendations. Variables are only populated by the server, and will be ignored when sending a request. @@ -4085,7 +4509,7 @@ class RecommendationUsageDetails(_serialization.Model): "charges": {"key": "charges", "type": "[float]"}, } - def __init__(self, *, usage_grain: Optional[Union[str, "_models.Grain"]] = None, **kwargs): + def __init__(self, *, usage_grain: Optional[Union[str, "_models.Grain"]] = None, **kwargs: Any) -> None: """ :keyword usage_grain: The grain of the usage. Supported values: 'Hourly'. Known values are: "Hourly", "Daily", and "Monthly". @@ -4117,7 +4541,7 @@ class ReportConfigAggregation(_serialization.Model): "function": {"key": "function", "type": "str"}, } - def __init__(self, *, name: str, function: Union[str, "_models.FunctionType"], **kwargs): + def __init__(self, *, name: str, function: Union[str, "_models.FunctionType"], **kwargs: Any) -> None: """ :keyword name: The name of the column to aggregate. Required. :paramtype name: str @@ -4136,8 +4560,8 @@ class ReportConfigComparisonExpression(_serialization.Model): :ivar name: The name of the column to use in comparison. Required. :vartype name: str - :ivar operator: The operator to use for comparison. Required. Known values are: "In" and - "Contains". + :ivar operator: The operator to use for comparison. Required. Known values are: "In", + "Contains", and "In". :vartype operator: str or ~azure.mgmt.costmanagement.models.OperatorType :ivar values: Array of values to use for comparison. Required. :vartype values: list[str] @@ -4155,12 +4579,14 @@ class ReportConfigComparisonExpression(_serialization.Model): "values": {"key": "values", "type": "[str]"}, } - def __init__(self, *, name: str, operator: Union[str, "_models.OperatorType"], values: List[str], **kwargs): + def __init__( + self, *, name: str, operator: Union[str, "_models.OperatorType"], values: List[str], **kwargs: Any + ) -> None: """ :keyword name: The name of the column to use in comparison. Required. :paramtype name: str - :keyword operator: The operator to use for comparison. Required. Known values are: "In" and - "Contains". + :keyword operator: The operator to use for comparison. Required. Known values are: "In", + "Contains", and "In". :paramtype operator: str or ~azure.mgmt.costmanagement.models.OperatorType :keyword values: Array of values to use for comparison. Required. :paramtype values: list[str] @@ -4215,8 +4641,8 @@ def __init__( grouping: Optional[List["_models.ReportConfigGrouping"]] = None, sorting: Optional[List["_models.ReportConfigSorting"]] = None, filter: Optional["_models.ReportConfigFilter"] = None, # pylint: disable=redefined-builtin - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword granularity: The granularity of rows in the report. Known values are: "Daily" and "Monthly". @@ -4257,7 +4683,7 @@ class ReportConfigDatasetConfiguration(_serialization.Model): "columns": {"key": "columns", "type": "[str]"}, } - def __init__(self, *, columns: Optional[List[str]] = None, **kwargs): + def __init__(self, *, columns: Optional[List[str]] = None, **kwargs: Any) -> None: """ :keyword columns: Array of column names to be included in the report. Any valid report column name is allowed. If not provided, then report includes all columns. @@ -4299,8 +4725,8 @@ def __init__( or_property: Optional[List["_models.ReportConfigFilter"]] = None, dimensions: Optional["_models.ReportConfigComparisonExpression"] = None, tags: Optional["_models.ReportConfigComparisonExpression"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword and_property: The logical "AND" expression. Must have at least 2 items. :paramtype and_property: list[~azure.mgmt.costmanagement.models.ReportConfigFilter] @@ -4323,8 +4749,9 @@ class ReportConfigGrouping(_serialization.Model): All required parameters must be populated in order to send to Azure. - :ivar type: Has type of the column to group. Required. Known values are: "Tag" and "Dimension". - :vartype type: str or ~azure.mgmt.costmanagement.models.ReportConfigColumnType + :ivar type: Has type of the column to group. Required. Known values are: "TagKey" and + "Dimension". + :vartype type: str or ~azure.mgmt.costmanagement.models.QueryColumnType :ivar name: The name of the column to group. This version supports subscription lowest possible grain. Required. :vartype name: str @@ -4340,11 +4767,11 @@ class ReportConfigGrouping(_serialization.Model): "name": {"key": "name", "type": "str"}, } - def __init__(self, *, type: Union[str, "_models.ReportConfigColumnType"], name: str, **kwargs): + def __init__(self, *, type: Union[str, "_models.QueryColumnType"], name: str, **kwargs: Any) -> None: """ - :keyword type: Has type of the column to group. Required. Known values are: "Tag" and + :keyword type: Has type of the column to group. Required. Known values are: "TagKey" and "Dimension". - :paramtype type: str or ~azure.mgmt.costmanagement.models.ReportConfigColumnType + :paramtype type: str or ~azure.mgmt.costmanagement.models.QueryColumnType :keyword name: The name of the column to group. This version supports subscription lowest possible grain. Required. :paramtype name: str @@ -4375,8 +4802,8 @@ class ReportConfigSorting(_serialization.Model): } def __init__( - self, *, name: str, direction: Optional[Union[str, "_models.ReportConfigSortingType"]] = None, **kwargs - ): + self, *, name: str, direction: Optional[Union[str, "_models.ReportConfigSortingType"]] = None, **kwargs: Any + ) -> None: """ :keyword direction: Direction of sort. Known values are: "Ascending" and "Descending". :paramtype direction: str or ~azure.mgmt.costmanagement.models.ReportConfigSortingType @@ -4409,7 +4836,7 @@ class ReportConfigTimePeriod(_serialization.Model): "to": {"key": "to", "type": "iso-8601"}, } - def __init__(self, *, from_property: datetime.datetime, to: datetime.datetime, **kwargs): + def __init__(self, *, from_property: datetime.datetime, to: datetime.datetime, **kwargs: Any) -> None: """ :keyword from_property: The start date to pull data from. Required. :paramtype from_property: ~datetime.datetime @@ -4453,14 +4880,14 @@ class SavingsPlanUtilizationSummary(BenefitUtilizationSummary): # pylint: disab :vartype usage_date: ~datetime.datetime :ivar avg_utilization_percentage: This is the average hourly utilization for each date range that corresponds to given grain (Daily, Monthly). Suppose the API call is for usageDate > - 2022-10-01 and usageDate < 2022-10-31 at a daily granularity. There will be one record per + 2023-03-01 and usageDate < 2022-10-31 at a daily granularity. There will be one record per benefit id for each day. For a single day, the avgUtilizationPercentage value will be equal to the average of the set of values where the set contains 24 utilization percentage entries one for each hour in a specific day. :vartype avg_utilization_percentage: float :ivar min_utilization_percentage: This is the minimum hourly utilization for each date range that corresponds to given grain (Daily, Monthly). Suppose the API call is for usageDate > - 2022-10-01 and usageDate < 2022-10-31 at a daily granularity. There will be one record per + 2023-03-01 and usageDate < 2022-10-31 at a daily granularity. There will be one record per benefit id for each day. For a single day, the minUtilizationPercentage value will be equal to the smallest in the set of values where the set contains 24 utilization percentage entries one for each hour in a specific day. If on the day 2022-10-18, the lowest utilization percentage @@ -4468,7 +4895,7 @@ class SavingsPlanUtilizationSummary(BenefitUtilizationSummary): # pylint: disab :vartype min_utilization_percentage: float :ivar max_utilization_percentage: This is the maximum hourly utilization for each date range that corresponds to given grain (Daily, Monthly). Suppose the API call is for usageDate > - 2022-10-01 and usageDate < 2022-10-31 at a daily granularity. There will be one record per + 2023-03-01 and usageDate < 2022-10-31 at a daily granularity. There will be one record per benefit id for each day. For a single day, the maxUtilizationPercentage value will be equal to the largest in the set of values where the set contains 24 utilization percentage entries one for each hour in a specific day. If on the day 2022-10-18, the largest utilization percentage @@ -4505,14 +4932,14 @@ class SavingsPlanUtilizationSummary(BenefitUtilizationSummary): # pylint: disab "max_utilization_percentage": {"key": "properties.maxUtilizationPercentage", "type": "float"}, } - def __init__(self, *, benefit_type: Optional[Union[str, "_models.BenefitKind"]] = None, **kwargs): + def __init__(self, *, benefit_type: Optional[Union[str, "_models.BenefitKind"]] = None, **kwargs: Any) -> None: """ :keyword benefit_type: The benefit type. Supported values: 'SavingsPlan'. Known values are: "IncludedQuantity", "Reservation", and "SavingsPlan". :paramtype benefit_type: str or ~azure.mgmt.costmanagement.models.BenefitKind """ super().__init__(**kwargs) - self.kind = "SavingsPlan" # type: str + self.kind: str = "SavingsPlan" self.arm_sku_name = None self.benefit_id = None self.benefit_order_id = None @@ -4542,14 +4969,14 @@ class SavingsPlanUtilizationSummaryProperties(BenefitUtilizationSummaryPropertie :vartype usage_date: ~datetime.datetime :ivar avg_utilization_percentage: This is the average hourly utilization for each date range that corresponds to given grain (Daily, Monthly). Suppose the API call is for usageDate > - 2022-10-01 and usageDate < 2022-10-31 at a daily granularity. There will be one record per + 2023-03-01 and usageDate < 2022-10-31 at a daily granularity. There will be one record per benefit id for each day. For a single day, the avgUtilizationPercentage value will be equal to the average of the set of values where the set contains 24 utilization percentage entries one for each hour in a specific day. :vartype avg_utilization_percentage: float :ivar min_utilization_percentage: This is the minimum hourly utilization for each date range that corresponds to given grain (Daily, Monthly). Suppose the API call is for usageDate > - 2022-10-01 and usageDate < 2022-10-31 at a daily granularity. There will be one record per + 2023-03-01 and usageDate < 2022-10-31 at a daily granularity. There will be one record per benefit id for each day. For a single day, the minUtilizationPercentage value will be equal to the smallest in the set of values where the set contains 24 utilization percentage entries one for each hour in a specific day. If on the day 2022-10-18, the lowest utilization percentage @@ -4557,7 +4984,7 @@ class SavingsPlanUtilizationSummaryProperties(BenefitUtilizationSummaryPropertie :vartype min_utilization_percentage: float :ivar max_utilization_percentage: This is the maximum hourly utilization for each date range that corresponds to given grain (Daily, Monthly). Suppose the API call is for usageDate > - 2022-10-01 and usageDate < 2022-10-31 at a daily granularity. There will be one record per + 2023-03-01 and usageDate < 2022-10-31 at a daily granularity. There will be one record per benefit id for each day. For a single day, the maxUtilizationPercentage value will be equal to the largest in the set of values where the set contains 24 utilization percentage entries one for each hour in a specific day. If on the day 2022-10-18, the largest utilization percentage @@ -4586,7 +5013,7 @@ class SavingsPlanUtilizationSummaryProperties(BenefitUtilizationSummaryPropertie "max_utilization_percentage": {"key": "maxUtilizationPercentage", "type": "float"}, } - def __init__(self, *, benefit_type: Optional[Union[str, "_models.BenefitKind"]] = None, **kwargs): + def __init__(self, *, benefit_type: Optional[Union[str, "_models.BenefitKind"]] = None, **kwargs: Any) -> None: """ :keyword benefit_type: The benefit type. Supported values: 'SavingsPlan'. Known values are: "IncludedQuantity", "Reservation", and "SavingsPlan". @@ -4611,7 +5038,10 @@ class ScheduledActionProxyResource(ProxyResource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :ivar e_tag: Resource Etag. + :ivar e_tag: Resource Etag. For update calls, eTag is optional and can be specified to achieve + optimistic concurrency. Fetch the resource's eTag by doing a 'GET' call first and then + including the latest eTag as part of the request body or 'If-Match' header while performing the + update. For create calls, eTag is not required. :vartype e_tag: str :ivar kind: Kind of the scheduled action. Known values are: "Email" and "InsightAlert". :vartype kind: str or ~azure.mgmt.costmanagement.models.ScheduledActionKind @@ -4636,7 +5066,7 @@ class ScheduledActionProxyResource(ProxyResource): "system_data": {"key": "systemData", "type": "SystemData"}, } - def __init__(self, *, kind: Optional[Union[str, "_models.ScheduledActionKind"]] = None, **kwargs): + def __init__(self, *, kind: Optional[Union[str, "_models.ScheduledActionKind"]] = None, **kwargs: Any) -> None: """ :keyword kind: Kind of the scheduled action. Known values are: "Email" and "InsightAlert". :paramtype kind: str or ~azure.mgmt.costmanagement.models.ScheduledActionKind @@ -4660,7 +5090,10 @@ class ScheduledAction(ScheduledActionProxyResource): # pylint: disable=too-many :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :ivar e_tag: Resource Etag. + :ivar e_tag: Resource Etag. For update calls, eTag is optional and can be specified to achieve + optimistic concurrency. Fetch the resource's eTag by doing a 'GET' call first and then + including the latest eTag as part of the request body or 'If-Match' header while performing the + update. For create calls, eTag is not required. :vartype e_tag: str :ivar kind: Kind of the scheduled action. Known values are: "Email" and "InsightAlert". :vartype kind: str or ~azure.mgmt.costmanagement.models.ScheduledActionKind @@ -4739,8 +5172,8 @@ def __init__( scope: Optional[str] = None, status: Optional[Union[str, "_models.ScheduledActionStatus"]] = None, view_id: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword kind: Kind of the scheduled action. Known values are: "Email" and "InsightAlert". :paramtype kind: str or ~azure.mgmt.costmanagement.models.ScheduledActionKind @@ -4811,7 +5244,7 @@ class ScheduledActionListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None @@ -4870,8 +5303,8 @@ def __init__( days_of_week: Optional[List[Union[str, "_models.DaysOfWeek"]]] = None, weeks_of_month: Optional[List[Union[str, "_models.WeeksOfMonth"]]] = None, day_of_month: Optional[int] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword frequency: Frequency of the schedule. Required. Known values are: "Daily", "Weekly", and "Monthly". @@ -4985,8 +5418,8 @@ def __init__( term: Optional[Union[str, "_models.Term"]] = None, commitment_granularity: Optional[Union[str, "_models.Grain"]] = None, recommendation_details: Optional["_models.AllSavingsBenefitDetails"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword look_back_period: The number of days of usage evaluated for computing the recommendations. Known values are: "Last7Days", "Last30Days", and "Last60Days". @@ -5011,7 +5444,7 @@ def __init__( recommendation_details=recommendation_details, **kwargs ) - self.scope = "Shared" # type: str + self.scope: str = "Shared" class SingleScopeBenefitRecommendationProperties( @@ -5106,8 +5539,8 @@ def __init__( term: Optional[Union[str, "_models.Term"]] = None, commitment_granularity: Optional[Union[str, "_models.Grain"]] = None, recommendation_details: Optional["_models.AllSavingsBenefitDetails"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword look_back_period: The number of days of usage evaluated for computing the recommendations. Known values are: "Last7Days", "Last30Days", and "Last60Days". @@ -5132,7 +5565,7 @@ def __init__( recommendation_details=recommendation_details, **kwargs ) - self.scope = "Single" # type: str + self.scope: str = "Single" self.subscription_id = None self.resource_group = None @@ -5149,7 +5582,9 @@ class Status(_serialization.Model): "status": {"key": "status", "type": "str"}, } - def __init__(self, *, status: Optional[Union[str, "_models.ReportOperationStatusType"]] = None, **kwargs): + def __init__( + self, *, status: Optional[Union[str, "_models.ReportOperationStatusType"]] = None, **kwargs: Any + ) -> None: """ :keyword status: The status of the long running operation. Known values are: "InProgress", "Completed", "Failed", "Queued", "NoDataFound", "ReadyToDownload", and "TimedOut". @@ -5196,8 +5631,8 @@ def __init__( last_modified_by: Optional[str] = None, last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, last_modified_at: Optional[datetime.datetime] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword created_by: The identity that created the resource. :paramtype created_by: str @@ -5342,8 +5777,8 @@ def __init__( time_period: Optional["_models.ReportConfigTimePeriod"] = None, data_set: Optional["_models.ReportConfigDataset"] = None, include_monetary_commitment: Optional[bool] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword e_tag: eTag of the resource. To handle concurrent update scenario, this field will be used to determine whether the user is updating the latest version or not. @@ -5435,7 +5870,7 @@ class ViewListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/__init__.py b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/__init__.py index 2d305a7dc351..e1655f86453e 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/__init__.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/__init__.py @@ -7,12 +7,14 @@ # -------------------------------------------------------------------------- from ._operations import Operations -from ._views_operations import ViewsOperations -from ._alerts_operations import AlertsOperations -from ._forecast_operations import ForecastOperations -from ._dimensions_operations import DimensionsOperations -from ._query_operations import QueryOperations -from ._generate_reservation_details_report_operations import GenerateReservationDetailsReportOperations +from ._benefit_recommendations_operations import BenefitRecommendationsOperations +from ._benefit_utilization_summaries_operations import BenefitUtilizationSummariesOperations +from ._billing_account_scope_operations import BillingAccountScopeOperations +from ._billing_profile_scope_operations import BillingProfileScopeOperations +from ._reservation_order_scope_operations import ReservationOrderScopeOperations +from ._reservation_scope_operations import ReservationScopeOperations +from ._savings_plan_order_scope_operations import SavingsPlanOrderScopeOperations +from ._savings_plan_scope_operations import SavingsPlanScopeOperations from ._exports_operations import ExportsOperations from ._generate_cost_details_report_operations import GenerateCostDetailsReportOperations from ._generate_detailed_cost_report_operations import GenerateDetailedCostReportOperations @@ -22,32 +24,42 @@ from ._generate_detailed_cost_report_operation_status_operations import ( GenerateDetailedCostReportOperationStatusOperations, ) +from ._views_operations import ViewsOperations +from ._alerts_operations import AlertsOperations +from ._forecast_operations import ForecastOperations +from ._dimensions_operations import DimensionsOperations +from ._query_operations import QueryOperations +from ._generate_reservation_details_report_operations import GenerateReservationDetailsReportOperations from ._price_sheet_operations import PriceSheetOperations from ._scheduled_actions_operations import ScheduledActionsOperations -from ._benefit_recommendations_operations import BenefitRecommendationsOperations -from ._benefit_utilization_summaries_operations import BenefitUtilizationSummariesOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ "Operations", + "BenefitRecommendationsOperations", + "BenefitUtilizationSummariesOperations", + "BillingAccountScopeOperations", + "BillingProfileScopeOperations", + "ReservationOrderScopeOperations", + "ReservationScopeOperations", + "SavingsPlanOrderScopeOperations", + "SavingsPlanScopeOperations", + "ExportsOperations", + "GenerateCostDetailsReportOperations", + "GenerateDetailedCostReportOperations", + "GenerateDetailedCostReportOperationResultsOperations", + "GenerateDetailedCostReportOperationStatusOperations", "ViewsOperations", "AlertsOperations", "ForecastOperations", "DimensionsOperations", "QueryOperations", "GenerateReservationDetailsReportOperations", - "ExportsOperations", - "GenerateCostDetailsReportOperations", - "GenerateDetailedCostReportOperations", - "GenerateDetailedCostReportOperationResultsOperations", - "GenerateDetailedCostReportOperationStatusOperations", "PriceSheetOperations", "ScheduledActionsOperations", - "BenefitRecommendationsOperations", - "BenefitUtilizationSummariesOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_alerts_operations.py b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_alerts_operations.py index 39878262b5b6..28ea480a1fb1 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_alerts_operations.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_alerts_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -28,10 +28,6 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -43,7 +39,7 @@ def build_list_request(scope: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) # type: Literal["2022-10-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -52,7 +48,7 @@ def build_list_request(scope: str, **kwargs: Any) -> HttpRequest: "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -67,7 +63,7 @@ def build_get_request(scope: str, alert_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) # type: Literal["2022-10-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -77,7 +73,7 @@ def build_get_request(scope: str, alert_id: str, **kwargs: Any) -> HttpRequest: "alertId": _SERIALIZER.url("alert_id", alert_id, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -92,8 +88,8 @@ def build_dismiss_request(scope: str, alert_id: str, **kwargs: Any) -> HttpReque _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) # type: Literal["2022-10-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -103,7 +99,7 @@ def build_dismiss_request(scope: str, alert_id: str, **kwargs: Any) -> HttpReque "alertId": _SERIALIZER.url("alert_id", alert_id, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -124,7 +120,7 @@ def build_list_external_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) # type: Literal["2022-10-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -139,7 +135,7 @@ def build_list_external_request( "externalCloudProviderId": _SERIALIZER.url("external_cloud_provider_id", external_cloud_provider_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -173,6 +169,9 @@ def __init__(self, *args, **kwargs): def list(self, scope: str, **kwargs: Any) -> _models.AlertsResult: """Lists the alerts for scope defined. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :param scope: The scope associated with alerts operations. This includes '/subscriptions/{subscriptionId}/' for subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, @@ -206,10 +205,8 @@ def list(self, scope: str, **kwargs: Any) -> _models.AlertsResult: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AlertsResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.AlertsResult] = kwargs.pop("cls", None) request = build_list_request( scope=scope, @@ -219,10 +216,11 @@ def list(self, scope: str, **kwargs: Any) -> _models.AlertsResult: params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -239,12 +237,15 @@ def list(self, scope: str, **kwargs: Any) -> _models.AlertsResult: return deserialized - list.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/alerts"} # type: ignore + list.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/alerts"} @distributed_trace def get(self, scope: str, alert_id: str, **kwargs: Any) -> _models.Alert: """Gets the alert for the scope by alert ID. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :param scope: The scope associated with alerts operations. This includes '/subscriptions/{subscriptionId}/' for subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, @@ -280,10 +281,8 @@ def get(self, scope: str, alert_id: str, **kwargs: Any) -> _models.Alert: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Alert] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.Alert] = kwargs.pop("cls", None) request = build_get_request( scope=scope, @@ -294,10 +293,11 @@ def get(self, scope: str, alert_id: str, **kwargs: Any) -> _models.Alert: params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -314,7 +314,7 @@ def get(self, scope: str, alert_id: str, **kwargs: Any) -> _models.Alert: return deserialized - get.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/alerts/{alertId}"} # type: ignore + get.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/alerts/{alertId}"} @overload def dismiss( @@ -328,6 +328,9 @@ def dismiss( ) -> _models.Alert: """Dismisses the specified alert. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :param scope: The scope associated with alerts operations. This includes '/subscriptions/{subscriptionId}/' for subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, @@ -364,6 +367,9 @@ def dismiss( ) -> _models.Alert: """Dismisses the specified alert. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :param scope: The scope associated with alerts operations. This includes '/subscriptions/{subscriptionId}/' for subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, @@ -400,6 +406,9 @@ def dismiss( ) -> _models.Alert: """Dismisses the specified alert. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :param scope: The scope associated with alerts operations. This includes '/subscriptions/{subscriptionId}/' for subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, @@ -419,8 +428,8 @@ def dismiss( :type scope: str :param alert_id: Alert ID. Required. :type alert_id: str - :param parameters: Parameters supplied to the Dismiss Alert operation. Is either a model type - or a IO type. Required. + :param parameters: Parameters supplied to the Dismiss Alert operation. Is either a + DismissAlertPayload type or a IO type. Required. :type parameters: ~azure.mgmt.costmanagement.models.DismissAlertPayload or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -441,16 +450,14 @@ def dismiss( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Alert] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Alert] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "DismissAlertPayload") @@ -467,10 +474,11 @@ def dismiss( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -487,7 +495,7 @@ def dismiss( return deserialized - dismiss.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/alerts/{alertId}"} # type: ignore + dismiss.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/alerts/{alertId}"} @distributed_trace def list_external( @@ -498,6 +506,9 @@ def list_external( ) -> _models.AlertsResult: """Lists the Alerts for external cloud provider type defined. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :param external_cloud_provider_type: The external cloud provider type associated with dimension/query operations. This includes 'externalSubscriptions' for linked account and 'externalBillingAccounts' for consolidated account. Known values are: "externalSubscriptions" @@ -524,10 +535,8 @@ def list_external( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AlertsResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.AlertsResult] = kwargs.pop("cls", None) request = build_list_external_request( external_cloud_provider_type=external_cloud_provider_type, @@ -538,10 +547,11 @@ def list_external( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -558,4 +568,6 @@ def list_external( return deserialized - list_external.metadata = {"url": "/providers/Microsoft.CostManagement/{externalCloudProviderType}/{externalCloudProviderId}/alerts"} # type: ignore + list_external.metadata = { + "url": "/providers/Microsoft.CostManagement/{externalCloudProviderType}/{externalCloudProviderId}/alerts" + } diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_benefit_recommendations_operations.py b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_benefit_recommendations_operations.py index 62e7f41d301a..b4a03b3e7d5d 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_benefit_recommendations_operations.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_benefit_recommendations_operations.py @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse @@ -30,10 +29,6 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -52,7 +47,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) # type: Literal["2022-10-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -61,7 +56,7 @@ def build_list_request( "billingScope": _SERIALIZER.url("billing_scope", billing_scope, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -108,6 +103,9 @@ def list( ) -> Iterable["_models.BenefitRecommendationModel"]: """List of recommendations for purchasing savings plan. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/CostManagement/ + :param billing_scope: The scope associated with benefit recommendation operations. This includes '/subscriptions/{subscriptionId}/' for subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resource group scope, @@ -139,10 +137,8 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.BenefitRecommendationsListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.BenefitRecommendationsListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -166,7 +162,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -182,7 +178,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -190,14 +186,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("BenefitRecommendationsListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -210,4 +207,4 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/{billingScope}/providers/Microsoft.CostManagement/benefitRecommendations"} # type: ignore + list.metadata = {"url": "/{billingScope}/providers/Microsoft.CostManagement/benefitRecommendations"} diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_benefit_utilization_summaries_operations.py b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_benefit_utilization_summaries_operations.py index 4045f0f98ee4..e95e025543e7 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_benefit_utilization_summaries_operations.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_benefit_utilization_summaries_operations.py @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union import urllib.parse @@ -30,10 +29,6 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -51,7 +46,7 @@ def build_list_by_billing_account_id_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) # type: Literal["2022-10-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -63,7 +58,7 @@ def build_list_by_billing_account_id_request( "billingAccountId": _SERIALIZER.url("billing_account_id", billing_account_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -89,7 +84,7 @@ def build_list_by_billing_profile_id_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) # type: Literal["2022-10-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -102,7 +97,7 @@ def build_list_by_billing_profile_id_request( "billingProfileId": _SERIALIZER.url("billing_profile_id", billing_profile_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -127,7 +122,7 @@ def build_list_by_savings_plan_order_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) # type: Literal["2022-10-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -139,7 +134,7 @@ def build_list_by_savings_plan_order_request( "savingsPlanOrderId": _SERIALIZER.url("savings_plan_order_id", savings_plan_order_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -165,7 +160,7 @@ def build_list_by_savings_plan_id_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) # type: Literal["2022-10-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -178,7 +173,7 @@ def build_list_by_savings_plan_id_request( "savingsPlanId": _SERIALIZER.url("savings_plan_id", savings_plan_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -223,6 +218,9 @@ def list_by_billing_account_id( """Lists savings plan utilization summaries for the enterprise agreement scope. Supported at grain values: 'Daily' and 'Monthly'. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/cost-management/ + :param billing_account_id: Billing account ID. Required. :type billing_account_id: str :param grain_parameter: Grain. Known values are: "Hourly", "Daily", and "Monthly". Default @@ -241,10 +239,8 @@ def list_by_billing_account_id( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.BenefitUtilizationSummariesListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.BenefitUtilizationSummariesListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -267,7 +263,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -283,7 +279,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -291,14 +287,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("BenefitUtilizationSummariesListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -311,7 +308,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_billing_account_id.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.CostManagement/benefitUtilizationSummaries"} # type: ignore + list_by_billing_account_id.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.CostManagement/benefitUtilizationSummaries" + } @distributed_trace def list_by_billing_profile_id( @@ -325,6 +324,9 @@ def list_by_billing_profile_id( """Lists savings plan utilization summaries for billing profile. Supported at grain values: 'Daily' and 'Monthly'. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/cost-management/ + :param billing_account_id: Billing account ID. Required. :type billing_account_id: str :param billing_profile_id: Billing profile ID. Required. @@ -345,10 +347,8 @@ def list_by_billing_profile_id( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.BenefitUtilizationSummariesListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.BenefitUtilizationSummariesListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -372,7 +372,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -388,7 +388,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -396,14 +396,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("BenefitUtilizationSummariesListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -416,7 +417,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_billing_profile_id.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/providers/Microsoft.CostManagement/benefitUtilizationSummaries"} # type: ignore + list_by_billing_profile_id.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/providers/Microsoft.CostManagement/benefitUtilizationSummaries" + } @distributed_trace def list_by_savings_plan_order( @@ -428,6 +431,9 @@ def list_by_savings_plan_order( ) -> Iterable["_models.BenefitUtilizationSummary"]: """Lists the savings plan utilization summaries for daily or monthly grain. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/cost-management/ + :param savings_plan_order_id: Savings plan order ID. Required. :type savings_plan_order_id: str :param filter: Supports filtering by properties/usageDate. Default value is None. @@ -445,10 +451,8 @@ def list_by_savings_plan_order( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.BenefitUtilizationSummariesListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.BenefitUtilizationSummariesListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -471,7 +475,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -487,7 +491,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -495,14 +499,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("BenefitUtilizationSummariesListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -515,7 +520,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_savings_plan_order.metadata = {"url": "/providers/Microsoft.BillingBenefits/savingsPlanOrders/{savingsPlanOrderId}/providers/Microsoft.CostManagement/benefitUtilizationSummaries"} # type: ignore + list_by_savings_plan_order.metadata = { + "url": "/providers/Microsoft.BillingBenefits/savingsPlanOrders/{savingsPlanOrderId}/providers/Microsoft.CostManagement/benefitUtilizationSummaries" + } @distributed_trace def list_by_savings_plan_id( @@ -528,6 +535,9 @@ def list_by_savings_plan_id( ) -> Iterable["_models.BenefitUtilizationSummary"]: """Lists the savings plan utilization summaries for daily or monthly grain. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/cost-management/ + :param savings_plan_order_id: Savings plan order ID. Required. :type savings_plan_order_id: str :param savings_plan_id: Savings plan ID. Required. @@ -547,10 +557,8 @@ def list_by_savings_plan_id( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.BenefitUtilizationSummariesListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.BenefitUtilizationSummariesListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -574,7 +582,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -590,7 +598,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -598,14 +606,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("BenefitUtilizationSummariesListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -618,4 +627,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_savings_plan_id.metadata = {"url": "/providers/Microsoft.BillingBenefits/savingsPlanOrders/{savingsPlanOrderId}/savingsPlans/{savingsPlanId}/providers/Microsoft.CostManagement/benefitUtilizationSummaries"} # type: ignore + list_by_savings_plan_id.metadata = { + "url": "/providers/Microsoft.BillingBenefits/savingsPlanOrders/{savingsPlanOrderId}/savingsPlans/{savingsPlanId}/providers/Microsoft.CostManagement/benefitUtilizationSummaries" + } diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_billing_account_scope_operations.py b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_billing_account_scope_operations.py new file mode 100644 index 000000000000..e095bbd72b69 --- /dev/null +++ b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_billing_account_scope_operations.py @@ -0,0 +1,321 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request, _format_url_section + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_generate_benefit_utilization_summaries_report_request(billing_account_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.CostManagement/generateBenefitUtilizationSummariesReport", + ) # pylint: disable=line-too-long + path_format_arguments = { + "billingAccountId": _SERIALIZER.url("billing_account_id", billing_account_id, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +class BillingAccountScopeOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.costmanagement.CostManagementClient`'s + :attr:`billing_account_scope` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + def _generate_benefit_utilization_summaries_report_initial( + self, + billing_account_id: str, + benefit_utilization_summaries_request: Union[_models.BenefitUtilizationSummariesRequest, IO], + **kwargs: Any + ) -> Optional[_models.BenefitUtilizationSummariesOperationStatus]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.BenefitUtilizationSummariesOperationStatus]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(benefit_utilization_summaries_request, (IOBase, bytes)): + _content = benefit_utilization_summaries_request + else: + _json = self._serialize.body(benefit_utilization_summaries_request, "BenefitUtilizationSummariesRequest") + + request = build_generate_benefit_utilization_summaries_report_request( + billing_account_id=billing_account_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._generate_benefit_utilization_summaries_report_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseAutoGenerated, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("BenefitUtilizationSummariesOperationStatus", pipeline_response) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _generate_benefit_utilization_summaries_report_initial.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.CostManagement/generateBenefitUtilizationSummariesReport" + } + + @overload + def begin_generate_benefit_utilization_summaries_report( + self, + billing_account_id: str, + benefit_utilization_summaries_request: _models.BenefitUtilizationSummariesRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.BenefitUtilizationSummariesOperationStatus]: + """Triggers generation of a benefit utilization summaries report for the provided billing account. + This API supports only enrollment accounts. + + .. seealso:: + - https://docs.microsoft.com/rest/api/cost-management/ + + :param billing_account_id: Billing account ID. Required. + :type billing_account_id: str + :param benefit_utilization_summaries_request: Async Benefit Utilization Summary report to be + created. Required. + :type benefit_utilization_summaries_request: + ~azure.mgmt.costmanagement.models.BenefitUtilizationSummariesRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either + BenefitUtilizationSummariesOperationStatus or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.costmanagement.models.BenefitUtilizationSummariesOperationStatus] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_generate_benefit_utilization_summaries_report( + self, + billing_account_id: str, + benefit_utilization_summaries_request: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.BenefitUtilizationSummariesOperationStatus]: + """Triggers generation of a benefit utilization summaries report for the provided billing account. + This API supports only enrollment accounts. + + .. seealso:: + - https://docs.microsoft.com/rest/api/cost-management/ + + :param billing_account_id: Billing account ID. Required. + :type billing_account_id: str + :param benefit_utilization_summaries_request: Async Benefit Utilization Summary report to be + created. Required. + :type benefit_utilization_summaries_request: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either + BenefitUtilizationSummariesOperationStatus or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.costmanagement.models.BenefitUtilizationSummariesOperationStatus] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_generate_benefit_utilization_summaries_report( + self, + billing_account_id: str, + benefit_utilization_summaries_request: Union[_models.BenefitUtilizationSummariesRequest, IO], + **kwargs: Any + ) -> LROPoller[_models.BenefitUtilizationSummariesOperationStatus]: + """Triggers generation of a benefit utilization summaries report for the provided billing account. + This API supports only enrollment accounts. + + .. seealso:: + - https://docs.microsoft.com/rest/api/cost-management/ + + :param billing_account_id: Billing account ID. Required. + :type billing_account_id: str + :param benefit_utilization_summaries_request: Async Benefit Utilization Summary report to be + created. Is either a BenefitUtilizationSummariesRequest type or a IO type. Required. + :type benefit_utilization_summaries_request: + ~azure.mgmt.costmanagement.models.BenefitUtilizationSummariesRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either + BenefitUtilizationSummariesOperationStatus or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.costmanagement.models.BenefitUtilizationSummariesOperationStatus] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.BenefitUtilizationSummariesOperationStatus] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._generate_benefit_utilization_summaries_report_initial( + billing_account_id=billing_account_id, + benefit_utilization_summaries_request=benefit_utilization_summaries_request, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("BenefitUtilizationSummariesOperationStatus", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_generate_benefit_utilization_summaries_report.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.CostManagement/generateBenefitUtilizationSummariesReport" + } diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_billing_profile_scope_operations.py b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_billing_profile_scope_operations.py new file mode 100644 index 000000000000..fc2c2293dfcf --- /dev/null +++ b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_billing_profile_scope_operations.py @@ -0,0 +1,336 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request, _format_url_section + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_generate_benefit_utilization_summaries_report_request( + billing_account_id: str, billing_profile_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/providers/Microsoft.CostManagement/generateBenefitUtilizationSummariesReport", + ) # pylint: disable=line-too-long + path_format_arguments = { + "billingAccountId": _SERIALIZER.url("billing_account_id", billing_account_id, "str"), + "billingProfileId": _SERIALIZER.url("billing_profile_id", billing_profile_id, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +class BillingProfileScopeOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.costmanagement.CostManagementClient`'s + :attr:`billing_profile_scope` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + def _generate_benefit_utilization_summaries_report_initial( + self, + billing_account_id: str, + billing_profile_id: str, + benefit_utilization_summaries_request: Union[_models.BenefitUtilizationSummariesRequest, IO], + **kwargs: Any + ) -> Optional[_models.BenefitUtilizationSummariesOperationStatus]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.BenefitUtilizationSummariesOperationStatus]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(benefit_utilization_summaries_request, (IOBase, bytes)): + _content = benefit_utilization_summaries_request + else: + _json = self._serialize.body(benefit_utilization_summaries_request, "BenefitUtilizationSummariesRequest") + + request = build_generate_benefit_utilization_summaries_report_request( + billing_account_id=billing_account_id, + billing_profile_id=billing_profile_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._generate_benefit_utilization_summaries_report_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseAutoGenerated, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("BenefitUtilizationSummariesOperationStatus", pipeline_response) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _generate_benefit_utilization_summaries_report_initial.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/providers/Microsoft.CostManagement/generateBenefitUtilizationSummariesReport" + } + + @overload + def begin_generate_benefit_utilization_summaries_report( + self, + billing_account_id: str, + billing_profile_id: str, + benefit_utilization_summaries_request: _models.BenefitUtilizationSummariesRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.BenefitUtilizationSummariesOperationStatus]: + """Triggers generation of a benefit utilization summaries report for the provided billing account + and billing profile. + + .. seealso:: + - https://docs.microsoft.com/rest/api/cost-management/ + + :param billing_account_id: Billing account ID. Required. + :type billing_account_id: str + :param billing_profile_id: Billing profile ID. Required. + :type billing_profile_id: str + :param benefit_utilization_summaries_request: Async Benefit Utilization Summary report to be + created. Required. + :type benefit_utilization_summaries_request: + ~azure.mgmt.costmanagement.models.BenefitUtilizationSummariesRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either + BenefitUtilizationSummariesOperationStatus or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.costmanagement.models.BenefitUtilizationSummariesOperationStatus] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_generate_benefit_utilization_summaries_report( + self, + billing_account_id: str, + billing_profile_id: str, + benefit_utilization_summaries_request: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.BenefitUtilizationSummariesOperationStatus]: + """Triggers generation of a benefit utilization summaries report for the provided billing account + and billing profile. + + .. seealso:: + - https://docs.microsoft.com/rest/api/cost-management/ + + :param billing_account_id: Billing account ID. Required. + :type billing_account_id: str + :param billing_profile_id: Billing profile ID. Required. + :type billing_profile_id: str + :param benefit_utilization_summaries_request: Async Benefit Utilization Summary report to be + created. Required. + :type benefit_utilization_summaries_request: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either + BenefitUtilizationSummariesOperationStatus or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.costmanagement.models.BenefitUtilizationSummariesOperationStatus] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_generate_benefit_utilization_summaries_report( + self, + billing_account_id: str, + billing_profile_id: str, + benefit_utilization_summaries_request: Union[_models.BenefitUtilizationSummariesRequest, IO], + **kwargs: Any + ) -> LROPoller[_models.BenefitUtilizationSummariesOperationStatus]: + """Triggers generation of a benefit utilization summaries report for the provided billing account + and billing profile. + + .. seealso:: + - https://docs.microsoft.com/rest/api/cost-management/ + + :param billing_account_id: Billing account ID. Required. + :type billing_account_id: str + :param billing_profile_id: Billing profile ID. Required. + :type billing_profile_id: str + :param benefit_utilization_summaries_request: Async Benefit Utilization Summary report to be + created. Is either a BenefitUtilizationSummariesRequest type or a IO type. Required. + :type benefit_utilization_summaries_request: + ~azure.mgmt.costmanagement.models.BenefitUtilizationSummariesRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either + BenefitUtilizationSummariesOperationStatus or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.costmanagement.models.BenefitUtilizationSummariesOperationStatus] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.BenefitUtilizationSummariesOperationStatus] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._generate_benefit_utilization_summaries_report_initial( + billing_account_id=billing_account_id, + billing_profile_id=billing_profile_id, + benefit_utilization_summaries_request=benefit_utilization_summaries_request, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("BenefitUtilizationSummariesOperationStatus", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_generate_benefit_utilization_summaries_report.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/providers/Microsoft.CostManagement/generateBenefitUtilizationSummariesReport" + } diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_dimensions_operations.py b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_dimensions_operations.py index 9a94e4e524e3..4abc96802e66 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_dimensions_operations.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_dimensions_operations.py @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union import urllib.parse @@ -30,10 +29,6 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -53,7 +48,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) # type: Literal["2022-10-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -62,7 +57,7 @@ def build_list_request( "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -94,7 +89,7 @@ def build_by_external_cloud_provider_type_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) # type: Literal["2022-10-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -109,7 +104,7 @@ def build_by_external_cloud_provider_type_request( "externalCloudProviderId": _SERIALIZER.url("external_cloud_provider_id", external_cloud_provider_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -159,6 +154,9 @@ def list( ) -> Iterable["_models.Dimension"]: """Lists the dimensions by the defined scope. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :param scope: The scope associated with dimension operations. This includes '/subscriptions/{subscriptionId}/' for subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, @@ -199,10 +197,8 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.DimensionsListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.DimensionsListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -227,7 +223,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -243,7 +239,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -251,14 +247,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("DimensionsListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -271,7 +268,7 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/dimensions"} # type: ignore + list.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/dimensions"} @distributed_trace def by_external_cloud_provider_type( @@ -286,6 +283,9 @@ def by_external_cloud_provider_type( ) -> Iterable["_models.Dimension"]: """Lists the dimensions by the external cloud provider type. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :param external_cloud_provider_type: The external cloud provider type associated with dimension/query operations. This includes 'externalSubscriptions' for linked account and 'externalBillingAccounts' for consolidated account. Known values are: "externalSubscriptions" @@ -319,10 +319,8 @@ def by_external_cloud_provider_type( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.DimensionsListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.DimensionsListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -348,7 +346,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -364,7 +362,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -372,14 +370,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("DimensionsListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -392,4 +391,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - by_external_cloud_provider_type.metadata = {"url": "/providers/Microsoft.CostManagement/{externalCloudProviderType}/{externalCloudProviderId}/dimensions"} # type: ignore + by_external_cloud_provider_type.metadata = { + "url": "/providers/Microsoft.CostManagement/{externalCloudProviderType}/{externalCloudProviderId}/dimensions" + } diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_exports_operations.py b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_exports_operations.py index 958ac4bdb38d..a5a98e7c3836 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_exports_operations.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_exports_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -28,10 +28,6 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -43,7 +39,7 @@ def build_list_request(scope: str, *, expand: Optional[str] = None, **kwargs: An _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) # type: Literal["2022-10-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -52,7 +48,7 @@ def build_list_request(scope: str, *, expand: Optional[str] = None, **kwargs: An "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -69,7 +65,7 @@ def build_get_request(scope: str, export_name: str, *, expand: Optional[str] = N _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) # type: Literal["2022-10-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -79,7 +75,7 @@ def build_get_request(scope: str, export_name: str, *, expand: Optional[str] = N "exportName": _SERIALIZER.url("export_name", export_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -96,8 +92,8 @@ def build_create_or_update_request(scope: str, export_name: str, **kwargs: Any) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) # type: Literal["2022-10-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -107,7 +103,7 @@ def build_create_or_update_request(scope: str, export_name: str, **kwargs: Any) "exportName": _SERIALIZER.url("export_name", export_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -124,7 +120,7 @@ def build_delete_request(scope: str, export_name: str, **kwargs: Any) -> HttpReq _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) # type: Literal["2022-10-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -134,7 +130,7 @@ def build_delete_request(scope: str, export_name: str, **kwargs: Any) -> HttpReq "exportName": _SERIALIZER.url("export_name", export_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -149,7 +145,7 @@ def build_execute_request(scope: str, export_name: str, **kwargs: Any) -> HttpRe _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) # type: Literal["2022-10-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -159,7 +155,7 @@ def build_execute_request(scope: str, export_name: str, **kwargs: Any) -> HttpRe "exportName": _SERIALIZER.url("export_name", export_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -174,7 +170,7 @@ def build_get_execution_history_request(scope: str, export_name: str, **kwargs: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) # type: Literal["2022-10-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -184,7 +180,7 @@ def build_get_execution_history_request(scope: str, export_name: str, **kwargs: "exportName": _SERIALIZER.url("export_name", export_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -218,6 +214,9 @@ def __init__(self, *args, **kwargs): def list(self, scope: str, expand: Optional[str] = None, **kwargs: Any) -> _models.ExportListResult: """The operation to list all exports at the given scope. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :param scope: The scope associated with export operations. This includes '/subscriptions/{subscriptionId}/' for subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, @@ -255,10 +254,8 @@ def list(self, scope: str, expand: Optional[str] = None, **kwargs: Any) -> _mode _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ExportListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ExportListResult] = kwargs.pop("cls", None) request = build_list_request( scope=scope, @@ -269,10 +266,11 @@ def list(self, scope: str, expand: Optional[str] = None, **kwargs: Any) -> _mode params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -289,12 +287,15 @@ def list(self, scope: str, expand: Optional[str] = None, **kwargs: Any) -> _mode return deserialized - list.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/exports"} # type: ignore + list.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/exports"} @distributed_trace def get(self, scope: str, export_name: str, expand: Optional[str] = None, **kwargs: Any) -> _models.Export: """The operation to get the export for the defined scope by export name. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :param scope: The scope associated with export operations. This includes '/subscriptions/{subscriptionId}/' for subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, @@ -334,10 +335,8 @@ def get(self, scope: str, export_name: str, expand: Optional[str] = None, **kwar _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Export] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.Export] = kwargs.pop("cls", None) request = build_get_request( scope=scope, @@ -349,10 +348,11 @@ def get(self, scope: str, export_name: str, expand: Optional[str] = None, **kwar params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -369,7 +369,7 @@ def get(self, scope: str, export_name: str, expand: Optional[str] = None, **kwar return deserialized - get.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/exports/{exportName}"} # type: ignore + get.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/exports/{exportName}"} @overload def create_or_update( @@ -385,6 +385,9 @@ def create_or_update( the request. You may obtain the latest eTag by performing a get operation. Create operation does not require eTag. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :param scope: The scope associated with export operations. This includes '/subscriptions/{subscriptionId}/' for subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, @@ -423,6 +426,9 @@ def create_or_update( the request. You may obtain the latest eTag by performing a get operation. Create operation does not require eTag. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :param scope: The scope associated with export operations. This includes '/subscriptions/{subscriptionId}/' for subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, @@ -461,6 +467,9 @@ def create_or_update( the request. You may obtain the latest eTag by performing a get operation. Create operation does not require eTag. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :param scope: The scope associated with export operations. This includes '/subscriptions/{subscriptionId}/' for subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, @@ -481,7 +490,7 @@ def create_or_update( :param export_name: Export Name. Required. :type export_name: str :param parameters: Parameters supplied to the CreateOrUpdate Export operation. Is either a - model type or a IO type. Required. + Export type or a IO type. Required. :type parameters: ~azure.mgmt.costmanagement.models.Export or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -502,16 +511,14 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.Export] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Export] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "Export") @@ -528,10 +535,11 @@ def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -548,11 +556,11 @@ def create_or_update( deserialized = self._deserialize("Export", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/exports/{exportName}"} # type: ignore + create_or_update.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/exports/{exportName}"} @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -560,6 +568,9 @@ def delete( # pylint: disable=inconsistent-return-statements ) -> None: """The operation to delete a export. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :param scope: The scope associated with export operations. This includes '/subscriptions/{subscriptionId}/' for subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, @@ -595,10 +606,8 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( scope=scope, @@ -609,10 +618,11 @@ def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -625,7 +635,7 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/exports/{exportName}"} # type: ignore + delete.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/exports/{exportName}"} @distributed_trace def execute( # pylint: disable=inconsistent-return-statements @@ -633,6 +643,9 @@ def execute( # pylint: disable=inconsistent-return-statements ) -> None: """The operation to run an export. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :param scope: The scope associated with export operations. This includes '/subscriptions/{subscriptionId}/' for subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, @@ -668,10 +681,8 @@ def execute( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_execute_request( scope=scope, @@ -682,10 +693,11 @@ def execute( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -698,12 +710,15 @@ def execute( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - execute.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/exports/{exportName}/run"} # type: ignore + execute.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/exports/{exportName}/run"} @distributed_trace def get_execution_history(self, scope: str, export_name: str, **kwargs: Any) -> _models.ExportExecutionListResult: """The operation to get the run history of an export for the defined scope and export name. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :param scope: The scope associated with export operations. This includes '/subscriptions/{subscriptionId}/' for subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, @@ -739,10 +754,8 @@ def get_execution_history(self, scope: str, export_name: str, **kwargs: Any) -> _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ExportExecutionListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ExportExecutionListResult] = kwargs.pop("cls", None) request = build_get_execution_history_request( scope=scope, @@ -753,10 +766,11 @@ def get_execution_history(self, scope: str, export_name: str, **kwargs: Any) -> params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -773,4 +787,6 @@ def get_execution_history(self, scope: str, export_name: str, **kwargs: Any) -> return deserialized - get_execution_history.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/exports/{exportName}/runHistory"} # type: ignore + get_execution_history.metadata = { + "url": "/{scope}/providers/Microsoft.CostManagement/exports/{exportName}/runHistory" + } diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_forecast_operations.py b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_forecast_operations.py index 87053c2968cf..8e83ff6e65b0 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_forecast_operations.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_forecast_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -28,10 +28,6 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -43,8 +39,8 @@ def build_usage_request(scope: str, *, filter: Optional[str] = None, **kwargs: A _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) # type: Literal["2022-10-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -53,7 +49,7 @@ def build_usage_request(scope: str, *, filter: Optional[str] = None, **kwargs: A "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -78,8 +74,8 @@ def build_external_cloud_provider_usage_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) # type: Literal["2022-10-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -94,7 +90,7 @@ def build_external_cloud_provider_usage_request( "externalCloudProviderId": _SERIALIZER.url("external_cloud_provider_id", external_cloud_provider_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters if filter is not None: @@ -140,6 +136,9 @@ def usage( ) -> Optional[_models.ForecastResult]: """Lists the forecast charges for scope defined. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :param scope: The scope associated with forecast operations. This includes '/subscriptions/{subscriptionId}/' for subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, @@ -185,6 +184,9 @@ def usage( ) -> Optional[_models.ForecastResult]: """Lists the forecast charges for scope defined. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :param scope: The scope associated with forecast operations. This includes '/subscriptions/{subscriptionId}/' for subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, @@ -224,6 +226,9 @@ def usage( ) -> Optional[_models.ForecastResult]: """Lists the forecast charges for scope defined. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :param scope: The scope associated with forecast operations. This includes '/subscriptions/{subscriptionId}/' for subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, @@ -242,7 +247,7 @@ def usage( specific for partners. Required. :type scope: str :param parameters: Parameters supplied to the CreateOrUpdate Forecast Config operation. Is - either a model type or a IO type. Required. + either a ForecastDefinition type or a IO type. Required. :type parameters: ~azure.mgmt.costmanagement.models.ForecastDefinition or IO :param filter: May be used to filter forecasts by properties/usageDate (Utc time), properties/chargeType or properties/grain. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', @@ -267,16 +272,14 @@ def usage( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.ForecastResult]] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.ForecastResult]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "ForecastDefinition") @@ -293,10 +296,11 @@ def usage( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -315,7 +319,7 @@ def usage( return deserialized - usage.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/forecast"} # type: ignore + usage.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/forecast"} @overload def external_cloud_provider_usage( @@ -330,6 +334,9 @@ def external_cloud_provider_usage( ) -> _models.ForecastResult: """Lists the forecast charges for external cloud provider type defined. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :param external_cloud_provider_type: The external cloud provider type associated with dimension/query operations. This includes 'externalSubscriptions' for linked account and 'externalBillingAccounts' for consolidated account. Known values are: "externalSubscriptions" @@ -369,6 +376,9 @@ def external_cloud_provider_usage( ) -> _models.ForecastResult: """Lists the forecast charges for external cloud provider type defined. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :param external_cloud_provider_type: The external cloud provider type associated with dimension/query operations. This includes 'externalSubscriptions' for linked account and 'externalBillingAccounts' for consolidated account. Known values are: "externalSubscriptions" @@ -406,6 +416,9 @@ def external_cloud_provider_usage( ) -> _models.ForecastResult: """Lists the forecast charges for external cloud provider type defined. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :param external_cloud_provider_type: The external cloud provider type associated with dimension/query operations. This includes 'externalSubscriptions' for linked account and 'externalBillingAccounts' for consolidated account. Known values are: "externalSubscriptions" @@ -417,7 +430,7 @@ def external_cloud_provider_usage( Required. :type external_cloud_provider_id: str :param parameters: Parameters supplied to the CreateOrUpdate Forecast Config operation. Is - either a model type or a IO type. Required. + either a ForecastDefinition type or a IO type. Required. :type parameters: ~azure.mgmt.costmanagement.models.ForecastDefinition or IO :param filter: May be used to filter forecasts by properties/usageDate (Utc time), properties/chargeType or properties/grain. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', @@ -442,16 +455,14 @@ def external_cloud_provider_usage( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ForecastResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ForecastResult] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "ForecastDefinition") @@ -469,10 +480,11 @@ def external_cloud_provider_usage( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -489,4 +501,6 @@ def external_cloud_provider_usage( return deserialized - external_cloud_provider_usage.metadata = {"url": "/providers/Microsoft.CostManagement/{externalCloudProviderType}/{externalCloudProviderId}/forecast"} # type: ignore + external_cloud_provider_usage.metadata = { + "url": "/providers/Microsoft.CostManagement/{externalCloudProviderType}/{externalCloudProviderId}/forecast" + } diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_generate_cost_details_report_operations.py b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_generate_cost_details_report_operations.py index abb85608f83d..3f7f1a2f8d07 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_generate_cost_details_report_operations.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_generate_cost_details_report_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload from azure.core.exceptions import ( @@ -30,10 +30,6 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,8 +41,8 @@ def build_create_operation_request(scope: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) # type: Literal["2022-10-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -55,7 +51,7 @@ def build_create_operation_request(scope: str, **kwargs: Any) -> HttpRequest: "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -72,7 +68,7 @@ def build_get_operation_results_request(scope: str, operation_id: str, **kwargs: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) # type: Literal["2022-10-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -84,7 +80,7 @@ def build_get_operation_results_request(scope: str, operation_id: str, **kwargs: "operationId": _SERIALIZER.url("operation_id", operation_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -128,16 +124,14 @@ def _create_operation_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.CostDetailsOperationResults]] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.CostDetailsOperationResults]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "GenerateCostDetailsReportRequestDefinition") @@ -153,15 +147,16 @@ def _create_operation_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 202]: + if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize( _models.GenerateCostDetailsReportErrorResponse, pipeline_response @@ -182,7 +177,9 @@ def _create_operation_initial( return deserialized - _create_operation_initial.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/generateCostDetailsReport"} # type: ignore + _create_operation_initial.metadata = { + "url": "/{scope}/providers/Microsoft.CostManagement/generateCostDetailsReport" + } @overload def begin_create_operation( @@ -202,7 +199,12 @@ def begin_create_operation( will provide a 202 response with a 'Location' header if the operation is still in progress. Once the report generation operation completes, the polling endpoint will provide a 200 response along with details on the report blob(s) that are available for download. The details - on the file(s) available for download will be available in the polling response body. + on the file(s) available for download will be available in the polling response body. To + Understand cost details (formerly known as usage details) fields found in files ,see + https://learn.microsoft.com/en-us/azure/cost-management-billing/automate/understand-usage-details-fields. + + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ :param scope: The ARM Resource ID for subscription, resource group, billing account, or other billing scopes. For details, see https://aka.ms/costmgmt/scopes. Required. @@ -240,7 +242,12 @@ def begin_create_operation( will provide a 202 response with a 'Location' header if the operation is still in progress. Once the report generation operation completes, the polling endpoint will provide a 200 response along with details on the report blob(s) that are available for download. The details - on the file(s) available for download will be available in the polling response body. + on the file(s) available for download will be available in the polling response body. To + Understand cost details (formerly known as usage details) fields found in files ,see + https://learn.microsoft.com/en-us/azure/cost-management-billing/automate/understand-usage-details-fields. + + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ :param scope: The ARM Resource ID for subscription, resource group, billing account, or other billing scopes. For details, see https://aka.ms/costmgmt/scopes. Required. @@ -278,13 +285,18 @@ def begin_create_operation( will provide a 202 response with a 'Location' header if the operation is still in progress. Once the report generation operation completes, the polling endpoint will provide a 200 response along with details on the report blob(s) that are available for download. The details - on the file(s) available for download will be available in the polling response body. + on the file(s) available for download will be available in the polling response body. To + Understand cost details (formerly known as usage details) fields found in files ,see + https://learn.microsoft.com/en-us/azure/cost-management-billing/automate/understand-usage-details-fields. + + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ :param scope: The ARM Resource ID for subscription, resource group, billing account, or other billing scopes. For details, see https://aka.ms/costmgmt/scopes. Required. :type scope: str - :param parameters: Parameters supplied to the Create cost details operation. Is either a model - type or a IO type. Required. + :param parameters: Parameters supplied to the Create cost details operation. Is either a + GenerateCostDetailsReportRequestDefinition type or a IO type. Required. :type parameters: ~azure.mgmt.costmanagement.models.GenerateCostDetailsReportRequestDefinition or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -307,16 +319,14 @@ def begin_create_operation( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CostDetailsOperationResults] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CostDetailsOperationResults] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._create_operation_initial( # type: ignore + raw_result = self._create_operation_initial( scope=scope, parameters=parameters, api_version=api_version, @@ -335,9 +345,9 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast( + polling_method: PollingMethod = cast( PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) # type: PollingMethod + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -349,9 +359,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create_operation.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/generateCostDetailsReport"} # type: ignore + begin_create_operation.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/generateCostDetailsReport"} def _get_operation_results_initial( self, scope: str, operation_id: str, **kwargs: Any @@ -367,10 +377,8 @@ def _get_operation_results_initial( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.CostDetailsOperationResults]] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Optional[_models.CostDetailsOperationResults]] = kwargs.pop("cls", None) request = build_get_operation_results_request( scope=scope, @@ -381,10 +389,11 @@ def _get_operation_results_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -403,7 +412,9 @@ def _get_operation_results_initial( return deserialized - _get_operation_results_initial.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/costDetailsOperationResults/{operationId}"} # type: ignore + _get_operation_results_initial.metadata = { + "url": "/{scope}/providers/Microsoft.CostManagement/costDetailsOperationResults/{operationId}" + } @distributed_trace def begin_get_operation_results( @@ -434,15 +445,13 @@ def begin_get_operation_results( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CostDetailsOperationResults] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.CostDetailsOperationResults] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._get_operation_results_initial( # type: ignore + raw_result = self._get_operation_results_initial( scope=scope, operation_id=operation_id, api_version=api_version, @@ -460,9 +469,9 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast( + polling_method: PollingMethod = cast( PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) # type: PollingMethod + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -474,6 +483,8 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_get_operation_results.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/costDetailsOperationResults/{operationId}"} # type: ignore + begin_get_operation_results.metadata = { + "url": "/{scope}/providers/Microsoft.CostManagement/costDetailsOperationResults/{operationId}" + } diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_generate_detailed_cost_report_operation_results_operations.py b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_generate_detailed_cost_report_operation_results_operations.py index 0cc2d0a6b70c..147422c099ca 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_generate_detailed_cost_report_operation_results_operations.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_generate_detailed_cost_report_operation_results_operations.py @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.exceptions import ( @@ -30,10 +29,6 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +40,7 @@ def build_get_request(operation_id: str, scope: str, **kwargs: Any) -> HttpReque _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) # type: Literal["2022-10-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -55,7 +50,7 @@ def build_get_request(operation_id: str, scope: str, **kwargs: Any) -> HttpReque "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -99,10 +94,8 @@ def _get_initial( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.GenerateDetailedCostReportOperationResult]] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Optional[_models.GenerateDetailedCostReportOperationResult]] = kwargs.pop("cls", None) request = build_get_request( operation_id=operation_id, @@ -113,10 +106,11 @@ def _get_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -135,7 +129,7 @@ def _get_initial( return deserialized - _get_initial.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/operationResults/{operationId}"} # type: ignore + _get_initial.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/operationResults/{operationId}"} @distributed_trace def begin_get( @@ -166,15 +160,13 @@ def begin_get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.GenerateDetailedCostReportOperationResult] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.GenerateDetailedCostReportOperationResult] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._get_initial( # type: ignore + raw_result = self._get_initial( operation_id=operation_id, scope=scope, api_version=api_version, @@ -192,7 +184,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -204,6 +196,6 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_get.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/operationResults/{operationId}"} # type: ignore + begin_get.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/operationResults/{operationId}"} diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_generate_detailed_cost_report_operation_status_operations.py b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_generate_detailed_cost_report_operation_status_operations.py index 9e9300779dc7..16030dd425dc 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_generate_detailed_cost_report_operation_status_operations.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_generate_detailed_cost_report_operation_status_operations.py @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -28,10 +27,6 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -43,7 +38,7 @@ def build_get_request(operation_id: str, scope: str, **kwargs: Any) -> HttpReque _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) # type: Literal["2022-10-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -53,7 +48,7 @@ def build_get_request(operation_id: str, scope: str, **kwargs: Any) -> HttpReque "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -109,10 +104,8 @@ def get(self, operation_id: str, scope: str, **kwargs: Any) -> _models.GenerateD _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.GenerateDetailedCostReportOperationStatuses] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.GenerateDetailedCostReportOperationStatuses] = kwargs.pop("cls", None) request = build_get_request( operation_id=operation_id, @@ -123,10 +116,11 @@ def get(self, operation_id: str, scope: str, **kwargs: Any) -> _models.GenerateD params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -143,4 +137,4 @@ def get(self, operation_id: str, scope: str, **kwargs: Any) -> _models.GenerateD return deserialized - get.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/operationStatus/{operationId}"} # type: ignore + get.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/operationStatus/{operationId}"} diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_generate_detailed_cost_report_operations.py b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_generate_detailed_cost_report_operations.py index d1aa61e8aef0..76be86eb13b2 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_generate_detailed_cost_report_operations.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_generate_detailed_cost_report_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload from azure.core.exceptions import ( @@ -30,10 +30,6 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,8 +41,8 @@ def build_create_operation_request(scope: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) # type: Literal["2022-10-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -55,7 +51,7 @@ def build_create_operation_request(scope: str, **kwargs: Any) -> HttpRequest: "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -101,16 +97,14 @@ def _create_operation_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.GenerateDetailedCostReportOperationResult]] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.GenerateDetailedCostReportOperationResult]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "GenerateDetailedCostReportDefinition") @@ -126,10 +120,11 @@ def _create_operation_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -161,7 +156,9 @@ def _create_operation_initial( return deserialized - _create_operation_initial.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/generateDetailedCostReport"} # type: ignore + _create_operation_initial.metadata = { + "url": "/{scope}/providers/Microsoft.CostManagement/generateDetailedCostReport" + } @overload def begin_create_operation( @@ -178,6 +175,9 @@ def begin_create_operation( operation will provide the status and if the operation is completed the blob file where generated detailed cost report is being stored. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :param scope: The ARM Resource ID for subscription, resource group, billing account, or other billing scopes. For details, see https://aka.ms/costmgmt/scopes. Required. :type scope: str @@ -211,6 +211,9 @@ def begin_create_operation( operation will provide the status and if the operation is completed the blob file where generated detailed cost report is being stored. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :param scope: The ARM Resource ID for subscription, resource group, billing account, or other billing scopes. For details, see https://aka.ms/costmgmt/scopes. Required. :type scope: str @@ -244,11 +247,14 @@ def begin_create_operation( operation will provide the status and if the operation is completed the blob file where generated detailed cost report is being stored. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :param scope: The ARM Resource ID for subscription, resource group, billing account, or other billing scopes. For details, see https://aka.ms/costmgmt/scopes. Required. :type scope: str :param parameters: Parameters supplied to the Create detailed cost report operation. Is either - a model type or a IO type. Required. + a GenerateDetailedCostReportDefinition type or a IO type. Required. :type parameters: ~azure.mgmt.costmanagement.models.GenerateDetailedCostReportDefinition or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -270,16 +276,14 @@ def begin_create_operation( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.GenerateDetailedCostReportOperationResult] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.GenerateDetailedCostReportOperationResult] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._create_operation_initial( # type: ignore + raw_result = self._create_operation_initial( scope=scope, parameters=parameters, api_version=api_version, @@ -298,9 +302,9 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast( + polling_method: PollingMethod = cast( PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) # type: PollingMethod + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -312,6 +316,6 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create_operation.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/generateDetailedCostReport"} # type: ignore + begin_create_operation.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/generateDetailedCostReport"} diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_generate_reservation_details_report_operations.py b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_generate_reservation_details_report_operations.py index fe00d3275649..221eb4ef6f06 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_generate_reservation_details_report_operations.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_generate_reservation_details_report_operations.py @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.exceptions import ( @@ -30,10 +29,6 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -47,7 +42,7 @@ def build_by_billing_account_id_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) # type: Literal["2022-10-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -59,7 +54,7 @@ def build_by_billing_account_id_request( "billingAccountId": _SERIALIZER.url("billing_account_id", billing_account_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["startDate"] = _SERIALIZER.query("start_date", start_date, "str") @@ -78,7 +73,7 @@ def build_by_billing_profile_id_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) # type: Literal["2022-10-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -91,7 +86,7 @@ def build_by_billing_profile_id_request( "billingProfileId": _SERIALIZER.url("billing_profile_id", billing_profile_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["startDate"] = _SERIALIZER.query("start_date", start_date, "str") @@ -137,10 +132,8 @@ def _by_billing_account_id_initial( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.OperationStatus]] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Optional[_models.OperationStatus]] = kwargs.pop("cls", None) request = build_by_billing_account_id_request( billing_account_id=billing_account_id, @@ -152,10 +145,11 @@ def _by_billing_account_id_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -179,7 +173,9 @@ def _by_billing_account_id_initial( return deserialized - _by_billing_account_id_initial.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.CostManagement/generateReservationDetailsReport"} # type: ignore + _by_billing_account_id_initial.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.CostManagement/generateReservationDetailsReport" + } @distributed_trace def begin_by_billing_account_id( @@ -190,6 +186,9 @@ def begin_by_billing_account_id( For more details on the roles see, https://docs.microsoft.com/en-us/azure/cost-management-billing/manage/understand-ea-roles#usage-and-costs-access-by-role. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :param billing_account_id: Enrollment ID (Legacy BillingAccount ID). Required. :type billing_account_id: str :param start_date: Start Date. Required. @@ -212,15 +211,13 @@ def begin_by_billing_account_id( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationStatus] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.OperationStatus] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._by_billing_account_id_initial( # type: ignore + raw_result = self._by_billing_account_id_initial( billing_account_id=billing_account_id, start_date=start_date, end_date=end_date, @@ -239,9 +236,9 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast( + polling_method: PollingMethod = cast( PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) # type: PollingMethod + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -253,9 +250,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_by_billing_account_id.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.CostManagement/generateReservationDetailsReport"} # type: ignore + begin_by_billing_account_id.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.CostManagement/generateReservationDetailsReport" + } def _by_billing_profile_id_initial( self, billing_account_id: str, billing_profile_id: str, start_date: str, end_date: str, **kwargs: Any @@ -271,10 +270,8 @@ def _by_billing_profile_id_initial( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.OperationStatus]] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Optional[_models.OperationStatus]] = kwargs.pop("cls", None) request = build_by_billing_profile_id_request( billing_account_id=billing_account_id, @@ -287,10 +284,11 @@ def _by_billing_profile_id_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -314,7 +312,9 @@ def _by_billing_profile_id_initial( return deserialized - _by_billing_profile_id_initial.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/providers/Microsoft.CostManagement/generateReservationDetailsReport"} # type: ignore + _by_billing_profile_id_initial.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/providers/Microsoft.CostManagement/generateReservationDetailsReport" + } @distributed_trace def begin_by_billing_profile_id( @@ -325,6 +325,9 @@ def begin_by_billing_profile_id( default. For more details on the roles see, https://docs.microsoft.com/en-us/azure/cost-management-billing/reservations/reservation-utilization#view-utilization-in-the-azure-portal-with-azure-rbac-access. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :param billing_account_id: Billing account ID. Required. :type billing_account_id: str :param billing_profile_id: Billing profile ID. Required. @@ -349,15 +352,13 @@ def begin_by_billing_profile_id( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationStatus] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.OperationStatus] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._by_billing_profile_id_initial( # type: ignore + raw_result = self._by_billing_profile_id_initial( billing_account_id=billing_account_id, billing_profile_id=billing_profile_id, start_date=start_date, @@ -377,9 +378,9 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast( + polling_method: PollingMethod = cast( PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) # type: PollingMethod + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -391,6 +392,8 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_by_billing_profile_id.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/providers/Microsoft.CostManagement/generateReservationDetailsReport"} # type: ignore + begin_by_billing_profile_id.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/providers/Microsoft.CostManagement/generateReservationDetailsReport" + } diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_operations.py b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_operations.py index 35d797e55af8..afc9178d7276 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_operations.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_operations.py @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse @@ -30,10 +29,6 @@ from .._serialization import Serializer from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +40,7 @@ def build_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) # type: Literal["2022-10-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -92,10 +87,8 @@ def list(self, **kwargs: Any) -> Iterable["_models.CostManagementOperation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -115,7 +108,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -131,7 +124,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -139,14 +132,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("OperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -159,4 +153,4 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/providers/Microsoft.CostManagement/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.CostManagement/operations"} diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_price_sheet_operations.py b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_price_sheet_operations.py index e283527e8af8..dbf6610846c5 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_price_sheet_operations.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_price_sheet_operations.py @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.exceptions import ( @@ -30,10 +29,6 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -47,7 +42,7 @@ def build_download_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) # type: Literal["2022-10-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -68,7 +63,7 @@ def build_download_request( "invoiceName": _SERIALIZER.url("invoice_name", invoice_name, "str", pattern=r"[A-Za-z0-9]+"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -85,7 +80,7 @@ def build_download_by_billing_profile_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) # type: Literal["2022-10-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -105,7 +100,7 @@ def build_download_by_billing_profile_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -149,10 +144,8 @@ def _download_initial( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.DownloadURL]] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Optional[_models.DownloadURL]] = kwargs.pop("cls", None) request = build_download_request( billing_account_name=billing_account_name, @@ -164,10 +157,11 @@ def _download_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -192,7 +186,9 @@ def _download_initial( return deserialized - _download_initial.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoices/{invoiceName}/providers/Microsoft.CostManagement/pricesheets/default/download"} # type: ignore + _download_initial.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoices/{invoiceName}/providers/Microsoft.CostManagement/pricesheets/default/download" + } @distributed_trace def begin_download( @@ -223,15 +219,13 @@ def begin_download( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.DownloadURL] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.DownloadURL] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._download_initial( # type: ignore + raw_result = self._download_initial( billing_account_name=billing_account_name, billing_profile_name=billing_profile_name, invoice_name=invoice_name, @@ -250,9 +244,9 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast( + polling_method: PollingMethod = cast( PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) # type: PollingMethod + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -264,9 +258,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_download.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoices/{invoiceName}/providers/Microsoft.CostManagement/pricesheets/default/download"} # type: ignore + begin_download.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoices/{invoiceName}/providers/Microsoft.CostManagement/pricesheets/default/download" + } def _download_by_billing_profile_initial( self, billing_account_name: str, billing_profile_name: str, **kwargs: Any @@ -282,10 +278,8 @@ def _download_by_billing_profile_initial( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.DownloadURL]] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Optional[_models.DownloadURL]] = kwargs.pop("cls", None) request = build_download_by_billing_profile_request( billing_account_name=billing_account_name, @@ -296,10 +290,11 @@ def _download_by_billing_profile_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -324,7 +319,9 @@ def _download_by_billing_profile_initial( return deserialized - _download_by_billing_profile_initial.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/providers/Microsoft.CostManagement/pricesheets/default/download"} # type: ignore + _download_by_billing_profile_initial.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/providers/Microsoft.CostManagement/pricesheets/default/download" + } @distributed_trace def begin_download_by_billing_profile( @@ -356,15 +353,13 @@ def begin_download_by_billing_profile( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.DownloadURL] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.DownloadURL] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._download_by_billing_profile_initial( # type: ignore + raw_result = self._download_by_billing_profile_initial( billing_account_name=billing_account_name, billing_profile_name=billing_profile_name, api_version=api_version, @@ -382,9 +377,9 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast( + polling_method: PollingMethod = cast( PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) # type: PollingMethod + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -396,6 +391,8 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_download_by_billing_profile.metadata = {"url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/providers/Microsoft.CostManagement/pricesheets/default/download"} # type: ignore + begin_download_by_billing_profile.metadata = { + "url": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/providers/Microsoft.CostManagement/pricesheets/default/download" + } diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_query_operations.py b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_query_operations.py index 0941b5681a4a..14fc2ffd5a26 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_query_operations.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_query_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -28,10 +28,6 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -43,8 +39,8 @@ def build_usage_request(scope: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) # type: Literal["2022-10-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -53,7 +49,7 @@ def build_usage_request(scope: str, **kwargs: Any) -> HttpRequest: "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -74,8 +70,8 @@ def build_usage_by_external_cloud_provider_type_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) # type: Literal["2022-10-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -90,7 +86,7 @@ def build_usage_by_external_cloud_provider_type_request( "externalCloudProviderId": _SERIALIZER.url("external_cloud_provider_id", external_cloud_provider_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -128,6 +124,9 @@ def usage( ) -> Optional[_models.QueryResult]: """Query the usage data for scope defined. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :param scope: The scope associated with query and export operations. This includes '/subscriptions/{subscriptionId}/' for subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, @@ -162,6 +161,9 @@ def usage( ) -> Optional[_models.QueryResult]: """Query the usage data for scope defined. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :param scope: The scope associated with query and export operations. This includes '/subscriptions/{subscriptionId}/' for subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, @@ -196,6 +198,9 @@ def usage( ) -> Optional[_models.QueryResult]: """Query the usage data for scope defined. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :param scope: The scope associated with query and export operations. This includes '/subscriptions/{subscriptionId}/' for subscription scope, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, @@ -214,7 +219,7 @@ def usage( specific for partners. Required. :type scope: str :param parameters: Parameters supplied to the CreateOrUpdate Query Config operation. Is either - a model type or a IO type. Required. + a QueryDefinition type or a IO type. Required. :type parameters: ~azure.mgmt.costmanagement.models.QueryDefinition or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -235,16 +240,14 @@ def usage( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.QueryResult]] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.QueryResult]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "QueryDefinition") @@ -260,10 +263,11 @@ def usage( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -282,7 +286,7 @@ def usage( return deserialized - usage.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/query"} # type: ignore + usage.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/query"} @overload def usage_by_external_cloud_provider_type( @@ -296,6 +300,9 @@ def usage_by_external_cloud_provider_type( ) -> _models.QueryResult: """Query the usage data for external cloud provider type defined. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :param external_cloud_provider_type: The external cloud provider type associated with dimension/query operations. This includes 'externalSubscriptions' for linked account and 'externalBillingAccounts' for consolidated account. Known values are: "externalSubscriptions" @@ -329,6 +336,9 @@ def usage_by_external_cloud_provider_type( ) -> _models.QueryResult: """Query the usage data for external cloud provider type defined. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :param external_cloud_provider_type: The external cloud provider type associated with dimension/query operations. This includes 'externalSubscriptions' for linked account and 'externalBillingAccounts' for consolidated account. Known values are: "externalSubscriptions" @@ -360,6 +370,9 @@ def usage_by_external_cloud_provider_type( ) -> _models.QueryResult: """Query the usage data for external cloud provider type defined. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :param external_cloud_provider_type: The external cloud provider type associated with dimension/query operations. This includes 'externalSubscriptions' for linked account and 'externalBillingAccounts' for consolidated account. Known values are: "externalSubscriptions" @@ -371,7 +384,7 @@ def usage_by_external_cloud_provider_type( Required. :type external_cloud_provider_id: str :param parameters: Parameters supplied to the CreateOrUpdate Query Config operation. Is either - a model type or a IO type. Required. + a QueryDefinition type or a IO type. Required. :type parameters: ~azure.mgmt.costmanagement.models.QueryDefinition or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -392,16 +405,14 @@ def usage_by_external_cloud_provider_type( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.QueryResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.QueryResult] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "QueryDefinition") @@ -418,10 +429,11 @@ def usage_by_external_cloud_provider_type( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -438,4 +450,6 @@ def usage_by_external_cloud_provider_type( return deserialized - usage_by_external_cloud_provider_type.metadata = {"url": "/providers/Microsoft.CostManagement/{externalCloudProviderType}/{externalCloudProviderId}/query"} # type: ignore + usage_by_external_cloud_provider_type.metadata = { + "url": "/providers/Microsoft.CostManagement/{externalCloudProviderType}/{externalCloudProviderId}/query" + } diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_reservation_order_scope_operations.py b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_reservation_order_scope_operations.py new file mode 100644 index 000000000000..5f576ac107b3 --- /dev/null +++ b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_reservation_order_scope_operations.py @@ -0,0 +1,323 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request, _format_url_section + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_generate_benefit_utilization_summaries_report_request( + reservation_order_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/providers/Microsoft.Capacity/reservationorders/{reservationOrderId}/providers/Microsoft.CostManagement/generateBenefitUtilizationSummariesReport", + ) # pylint: disable=line-too-long + path_format_arguments = { + "reservationOrderId": _SERIALIZER.url("reservation_order_id", reservation_order_id, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +class ReservationOrderScopeOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.costmanagement.CostManagementClient`'s + :attr:`reservation_order_scope` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + def _generate_benefit_utilization_summaries_report_initial( + self, + reservation_order_id: str, + benefit_utilization_summaries_request: Union[_models.BenefitUtilizationSummariesRequest, IO], + **kwargs: Any + ) -> Optional[_models.BenefitUtilizationSummariesOperationStatus]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.BenefitUtilizationSummariesOperationStatus]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(benefit_utilization_summaries_request, (IOBase, bytes)): + _content = benefit_utilization_summaries_request + else: + _json = self._serialize.body(benefit_utilization_summaries_request, "BenefitUtilizationSummariesRequest") + + request = build_generate_benefit_utilization_summaries_report_request( + reservation_order_id=reservation_order_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._generate_benefit_utilization_summaries_report_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseAutoGenerated, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("BenefitUtilizationSummariesOperationStatus", pipeline_response) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _generate_benefit_utilization_summaries_report_initial.metadata = { + "url": "/providers/Microsoft.Capacity/reservationorders/{reservationOrderId}/providers/Microsoft.CostManagement/generateBenefitUtilizationSummariesReport" + } + + @overload + def begin_generate_benefit_utilization_summaries_report( + self, + reservation_order_id: str, + benefit_utilization_summaries_request: _models.BenefitUtilizationSummariesRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.BenefitUtilizationSummariesOperationStatus]: + """Triggers generation of a benefit utilization summaries report for the provided reservation + order. + + .. seealso:: + - https://docs.microsoft.com/rest/api/cost-management/ + + :param reservation_order_id: Reservation Order ID. Required. + :type reservation_order_id: str + :param benefit_utilization_summaries_request: Async Benefit Utilization Summary report to be + created. Required. + :type benefit_utilization_summaries_request: + ~azure.mgmt.costmanagement.models.BenefitUtilizationSummariesRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either + BenefitUtilizationSummariesOperationStatus or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.costmanagement.models.BenefitUtilizationSummariesOperationStatus] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_generate_benefit_utilization_summaries_report( + self, + reservation_order_id: str, + benefit_utilization_summaries_request: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.BenefitUtilizationSummariesOperationStatus]: + """Triggers generation of a benefit utilization summaries report for the provided reservation + order. + + .. seealso:: + - https://docs.microsoft.com/rest/api/cost-management/ + + :param reservation_order_id: Reservation Order ID. Required. + :type reservation_order_id: str + :param benefit_utilization_summaries_request: Async Benefit Utilization Summary report to be + created. Required. + :type benefit_utilization_summaries_request: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either + BenefitUtilizationSummariesOperationStatus or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.costmanagement.models.BenefitUtilizationSummariesOperationStatus] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_generate_benefit_utilization_summaries_report( + self, + reservation_order_id: str, + benefit_utilization_summaries_request: Union[_models.BenefitUtilizationSummariesRequest, IO], + **kwargs: Any + ) -> LROPoller[_models.BenefitUtilizationSummariesOperationStatus]: + """Triggers generation of a benefit utilization summaries report for the provided reservation + order. + + .. seealso:: + - https://docs.microsoft.com/rest/api/cost-management/ + + :param reservation_order_id: Reservation Order ID. Required. + :type reservation_order_id: str + :param benefit_utilization_summaries_request: Async Benefit Utilization Summary report to be + created. Is either a BenefitUtilizationSummariesRequest type or a IO type. Required. + :type benefit_utilization_summaries_request: + ~azure.mgmt.costmanagement.models.BenefitUtilizationSummariesRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either + BenefitUtilizationSummariesOperationStatus or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.costmanagement.models.BenefitUtilizationSummariesOperationStatus] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.BenefitUtilizationSummariesOperationStatus] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._generate_benefit_utilization_summaries_report_initial( + reservation_order_id=reservation_order_id, + benefit_utilization_summaries_request=benefit_utilization_summaries_request, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("BenefitUtilizationSummariesOperationStatus", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_generate_benefit_utilization_summaries_report.metadata = { + "url": "/providers/Microsoft.Capacity/reservationorders/{reservationOrderId}/providers/Microsoft.CostManagement/generateBenefitUtilizationSummariesReport" + } diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_reservation_scope_operations.py b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_reservation_scope_operations.py new file mode 100644 index 000000000000..4df66130ee36 --- /dev/null +++ b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_reservation_scope_operations.py @@ -0,0 +1,333 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request, _format_url_section + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_generate_benefit_utilization_summaries_report_request( + reservation_order_id: str, reservation_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/providers/Microsoft.Capacity/reservationorders/{reservationOrderId}/reservations/{reservationId}/providers/Microsoft.CostManagement/generateBenefitUtilizationSummariesReport", + ) # pylint: disable=line-too-long + path_format_arguments = { + "reservationOrderId": _SERIALIZER.url("reservation_order_id", reservation_order_id, "str"), + "reservationId": _SERIALIZER.url("reservation_id", reservation_id, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +class ReservationScopeOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.costmanagement.CostManagementClient`'s + :attr:`reservation_scope` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + def _generate_benefit_utilization_summaries_report_initial( + self, + reservation_order_id: str, + reservation_id: str, + benefit_utilization_summaries_request: Union[_models.BenefitUtilizationSummariesRequest, IO], + **kwargs: Any + ) -> Optional[_models.BenefitUtilizationSummariesOperationStatus]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.BenefitUtilizationSummariesOperationStatus]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(benefit_utilization_summaries_request, (IOBase, bytes)): + _content = benefit_utilization_summaries_request + else: + _json = self._serialize.body(benefit_utilization_summaries_request, "BenefitUtilizationSummariesRequest") + + request = build_generate_benefit_utilization_summaries_report_request( + reservation_order_id=reservation_order_id, + reservation_id=reservation_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._generate_benefit_utilization_summaries_report_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseAutoGenerated, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("BenefitUtilizationSummariesOperationStatus", pipeline_response) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _generate_benefit_utilization_summaries_report_initial.metadata = { + "url": "/providers/Microsoft.Capacity/reservationorders/{reservationOrderId}/reservations/{reservationId}/providers/Microsoft.CostManagement/generateBenefitUtilizationSummariesReport" + } + + @overload + def begin_generate_benefit_utilization_summaries_report( + self, + reservation_order_id: str, + reservation_id: str, + benefit_utilization_summaries_request: _models.BenefitUtilizationSummariesRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.BenefitUtilizationSummariesOperationStatus]: + """Triggers generation of a benefit utilization summaries report for the provided reservation. + + .. seealso:: + - https://docs.microsoft.com/rest/api/cost-management/ + + :param reservation_order_id: Reservation Order ID. Required. + :type reservation_order_id: str + :param reservation_id: Reservation ID. Required. + :type reservation_id: str + :param benefit_utilization_summaries_request: Async Benefit Utilization Summary report to be + created. Required. + :type benefit_utilization_summaries_request: + ~azure.mgmt.costmanagement.models.BenefitUtilizationSummariesRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either + BenefitUtilizationSummariesOperationStatus or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.costmanagement.models.BenefitUtilizationSummariesOperationStatus] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_generate_benefit_utilization_summaries_report( + self, + reservation_order_id: str, + reservation_id: str, + benefit_utilization_summaries_request: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.BenefitUtilizationSummariesOperationStatus]: + """Triggers generation of a benefit utilization summaries report for the provided reservation. + + .. seealso:: + - https://docs.microsoft.com/rest/api/cost-management/ + + :param reservation_order_id: Reservation Order ID. Required. + :type reservation_order_id: str + :param reservation_id: Reservation ID. Required. + :type reservation_id: str + :param benefit_utilization_summaries_request: Async Benefit Utilization Summary report to be + created. Required. + :type benefit_utilization_summaries_request: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either + BenefitUtilizationSummariesOperationStatus or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.costmanagement.models.BenefitUtilizationSummariesOperationStatus] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_generate_benefit_utilization_summaries_report( + self, + reservation_order_id: str, + reservation_id: str, + benefit_utilization_summaries_request: Union[_models.BenefitUtilizationSummariesRequest, IO], + **kwargs: Any + ) -> LROPoller[_models.BenefitUtilizationSummariesOperationStatus]: + """Triggers generation of a benefit utilization summaries report for the provided reservation. + + .. seealso:: + - https://docs.microsoft.com/rest/api/cost-management/ + + :param reservation_order_id: Reservation Order ID. Required. + :type reservation_order_id: str + :param reservation_id: Reservation ID. Required. + :type reservation_id: str + :param benefit_utilization_summaries_request: Async Benefit Utilization Summary report to be + created. Is either a BenefitUtilizationSummariesRequest type or a IO type. Required. + :type benefit_utilization_summaries_request: + ~azure.mgmt.costmanagement.models.BenefitUtilizationSummariesRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either + BenefitUtilizationSummariesOperationStatus or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.costmanagement.models.BenefitUtilizationSummariesOperationStatus] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.BenefitUtilizationSummariesOperationStatus] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._generate_benefit_utilization_summaries_report_initial( + reservation_order_id=reservation_order_id, + reservation_id=reservation_id, + benefit_utilization_summaries_request=benefit_utilization_summaries_request, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("BenefitUtilizationSummariesOperationStatus", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_generate_benefit_utilization_summaries_report.metadata = { + "url": "/providers/Microsoft.Capacity/reservationorders/{reservationOrderId}/reservations/{reservationId}/providers/Microsoft.CostManagement/generateBenefitUtilizationSummariesReport" + } diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_savings_plan_order_scope_operations.py b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_savings_plan_order_scope_operations.py new file mode 100644 index 000000000000..903dc8528e5a --- /dev/null +++ b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_savings_plan_order_scope_operations.py @@ -0,0 +1,323 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request, _format_url_section + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_generate_benefit_utilization_summaries_report_request( + savings_plan_order_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/providers/Microsoft.BillingBenefits/savingsPlanOrders/{savingsPlanOrderId}/providers/Microsoft.CostManagement/generateBenefitUtilizationSummariesReport", + ) # pylint: disable=line-too-long + path_format_arguments = { + "savingsPlanOrderId": _SERIALIZER.url("savings_plan_order_id", savings_plan_order_id, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +class SavingsPlanOrderScopeOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.costmanagement.CostManagementClient`'s + :attr:`savings_plan_order_scope` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + def _generate_benefit_utilization_summaries_report_initial( + self, + savings_plan_order_id: str, + benefit_utilization_summaries_request: Union[_models.BenefitUtilizationSummariesRequest, IO], + **kwargs: Any + ) -> Optional[_models.BenefitUtilizationSummariesOperationStatus]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.BenefitUtilizationSummariesOperationStatus]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(benefit_utilization_summaries_request, (IOBase, bytes)): + _content = benefit_utilization_summaries_request + else: + _json = self._serialize.body(benefit_utilization_summaries_request, "BenefitUtilizationSummariesRequest") + + request = build_generate_benefit_utilization_summaries_report_request( + savings_plan_order_id=savings_plan_order_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._generate_benefit_utilization_summaries_report_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseAutoGenerated, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("BenefitUtilizationSummariesOperationStatus", pipeline_response) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _generate_benefit_utilization_summaries_report_initial.metadata = { + "url": "/providers/Microsoft.BillingBenefits/savingsPlanOrders/{savingsPlanOrderId}/providers/Microsoft.CostManagement/generateBenefitUtilizationSummariesReport" + } + + @overload + def begin_generate_benefit_utilization_summaries_report( + self, + savings_plan_order_id: str, + benefit_utilization_summaries_request: _models.BenefitUtilizationSummariesRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.BenefitUtilizationSummariesOperationStatus]: + """Triggers generation of a benefit utilization summaries report for the provided savings plan + order. + + .. seealso:: + - https://docs.microsoft.com/rest/api/cost-management/ + + :param savings_plan_order_id: Savings plan order ID. Required. + :type savings_plan_order_id: str + :param benefit_utilization_summaries_request: Async Benefit Utilization Summary report to be + created. Required. + :type benefit_utilization_summaries_request: + ~azure.mgmt.costmanagement.models.BenefitUtilizationSummariesRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either + BenefitUtilizationSummariesOperationStatus or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.costmanagement.models.BenefitUtilizationSummariesOperationStatus] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_generate_benefit_utilization_summaries_report( + self, + savings_plan_order_id: str, + benefit_utilization_summaries_request: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.BenefitUtilizationSummariesOperationStatus]: + """Triggers generation of a benefit utilization summaries report for the provided savings plan + order. + + .. seealso:: + - https://docs.microsoft.com/rest/api/cost-management/ + + :param savings_plan_order_id: Savings plan order ID. Required. + :type savings_plan_order_id: str + :param benefit_utilization_summaries_request: Async Benefit Utilization Summary report to be + created. Required. + :type benefit_utilization_summaries_request: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either + BenefitUtilizationSummariesOperationStatus or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.costmanagement.models.BenefitUtilizationSummariesOperationStatus] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_generate_benefit_utilization_summaries_report( + self, + savings_plan_order_id: str, + benefit_utilization_summaries_request: Union[_models.BenefitUtilizationSummariesRequest, IO], + **kwargs: Any + ) -> LROPoller[_models.BenefitUtilizationSummariesOperationStatus]: + """Triggers generation of a benefit utilization summaries report for the provided savings plan + order. + + .. seealso:: + - https://docs.microsoft.com/rest/api/cost-management/ + + :param savings_plan_order_id: Savings plan order ID. Required. + :type savings_plan_order_id: str + :param benefit_utilization_summaries_request: Async Benefit Utilization Summary report to be + created. Is either a BenefitUtilizationSummariesRequest type or a IO type. Required. + :type benefit_utilization_summaries_request: + ~azure.mgmt.costmanagement.models.BenefitUtilizationSummariesRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either + BenefitUtilizationSummariesOperationStatus or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.costmanagement.models.BenefitUtilizationSummariesOperationStatus] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.BenefitUtilizationSummariesOperationStatus] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._generate_benefit_utilization_summaries_report_initial( + savings_plan_order_id=savings_plan_order_id, + benefit_utilization_summaries_request=benefit_utilization_summaries_request, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("BenefitUtilizationSummariesOperationStatus", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_generate_benefit_utilization_summaries_report.metadata = { + "url": "/providers/Microsoft.BillingBenefits/savingsPlanOrders/{savingsPlanOrderId}/providers/Microsoft.CostManagement/generateBenefitUtilizationSummariesReport" + } diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_savings_plan_scope_operations.py b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_savings_plan_scope_operations.py new file mode 100644 index 000000000000..4093e9cfd077 --- /dev/null +++ b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_savings_plan_scope_operations.py @@ -0,0 +1,333 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request, _format_url_section + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_generate_benefit_utilization_summaries_report_async_request( + savings_plan_order_id: str, savings_plan_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/providers/Microsoft.BillingBenefits/savingsPlanOrders/{savingsPlanOrderId}/savingsPlans/{savingsPlanId}/providers/Microsoft.CostManagement/generateBenefitUtilizationSummariesReport", + ) # pylint: disable=line-too-long + path_format_arguments = { + "savingsPlanOrderId": _SERIALIZER.url("savings_plan_order_id", savings_plan_order_id, "str"), + "savingsPlanId": _SERIALIZER.url("savings_plan_id", savings_plan_id, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +class SavingsPlanScopeOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.costmanagement.CostManagementClient`'s + :attr:`savings_plan_scope` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + def _generate_benefit_utilization_summaries_report_async_initial( + self, + savings_plan_order_id: str, + savings_plan_id: str, + benefit_utilization_summaries_request: Union[_models.BenefitUtilizationSummariesRequest, IO], + **kwargs: Any + ) -> Optional[_models.BenefitUtilizationSummariesOperationStatus]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.BenefitUtilizationSummariesOperationStatus]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(benefit_utilization_summaries_request, (IOBase, bytes)): + _content = benefit_utilization_summaries_request + else: + _json = self._serialize.body(benefit_utilization_summaries_request, "BenefitUtilizationSummariesRequest") + + request = build_generate_benefit_utilization_summaries_report_async_request( + savings_plan_order_id=savings_plan_order_id, + savings_plan_id=savings_plan_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._generate_benefit_utilization_summaries_report_async_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseAutoGenerated, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("BenefitUtilizationSummariesOperationStatus", pipeline_response) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _generate_benefit_utilization_summaries_report_async_initial.metadata = { + "url": "/providers/Microsoft.BillingBenefits/savingsPlanOrders/{savingsPlanOrderId}/savingsPlans/{savingsPlanId}/providers/Microsoft.CostManagement/generateBenefitUtilizationSummariesReport" + } + + @overload + def begin_generate_benefit_utilization_summaries_report_async( + self, + savings_plan_order_id: str, + savings_plan_id: str, + benefit_utilization_summaries_request: _models.BenefitUtilizationSummariesRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.BenefitUtilizationSummariesOperationStatus]: + """Triggers generation of a benefit utilization summaries report for the provided savings plan. + + .. seealso:: + - https://docs.microsoft.com/rest/api/cost-management/ + + :param savings_plan_order_id: Savings plan order ID. Required. + :type savings_plan_order_id: str + :param savings_plan_id: Savings plan ID. Required. + :type savings_plan_id: str + :param benefit_utilization_summaries_request: Async Benefit Utilization Summary report to be + created. Required. + :type benefit_utilization_summaries_request: + ~azure.mgmt.costmanagement.models.BenefitUtilizationSummariesRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either + BenefitUtilizationSummariesOperationStatus or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.costmanagement.models.BenefitUtilizationSummariesOperationStatus] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_generate_benefit_utilization_summaries_report_async( + self, + savings_plan_order_id: str, + savings_plan_id: str, + benefit_utilization_summaries_request: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.BenefitUtilizationSummariesOperationStatus]: + """Triggers generation of a benefit utilization summaries report for the provided savings plan. + + .. seealso:: + - https://docs.microsoft.com/rest/api/cost-management/ + + :param savings_plan_order_id: Savings plan order ID. Required. + :type savings_plan_order_id: str + :param savings_plan_id: Savings plan ID. Required. + :type savings_plan_id: str + :param benefit_utilization_summaries_request: Async Benefit Utilization Summary report to be + created. Required. + :type benefit_utilization_summaries_request: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either + BenefitUtilizationSummariesOperationStatus or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.costmanagement.models.BenefitUtilizationSummariesOperationStatus] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_generate_benefit_utilization_summaries_report_async( + self, + savings_plan_order_id: str, + savings_plan_id: str, + benefit_utilization_summaries_request: Union[_models.BenefitUtilizationSummariesRequest, IO], + **kwargs: Any + ) -> LROPoller[_models.BenefitUtilizationSummariesOperationStatus]: + """Triggers generation of a benefit utilization summaries report for the provided savings plan. + + .. seealso:: + - https://docs.microsoft.com/rest/api/cost-management/ + + :param savings_plan_order_id: Savings plan order ID. Required. + :type savings_plan_order_id: str + :param savings_plan_id: Savings plan ID. Required. + :type savings_plan_id: str + :param benefit_utilization_summaries_request: Async Benefit Utilization Summary report to be + created. Is either a BenefitUtilizationSummariesRequest type or a IO type. Required. + :type benefit_utilization_summaries_request: + ~azure.mgmt.costmanagement.models.BenefitUtilizationSummariesRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either + BenefitUtilizationSummariesOperationStatus or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.costmanagement.models.BenefitUtilizationSummariesOperationStatus] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.BenefitUtilizationSummariesOperationStatus] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._generate_benefit_utilization_summaries_report_async_initial( + savings_plan_order_id=savings_plan_order_id, + savings_plan_id=savings_plan_id, + benefit_utilization_summaries_request=benefit_utilization_summaries_request, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("BenefitUtilizationSummariesOperationStatus", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_generate_benefit_utilization_summaries_report_async.metadata = { + "url": "/providers/Microsoft.BillingBenefits/savingsPlanOrders/{savingsPlanOrderId}/savingsPlans/{savingsPlanId}/providers/Microsoft.CostManagement/generateBenefitUtilizationSummariesReport" + } diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_scheduled_actions_operations.py b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_scheduled_actions_operations.py index 4287dbd5a343..2eba457fda78 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_scheduled_actions_operations.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_scheduled_actions_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -30,10 +30,6 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +41,7 @@ def build_list_request(*, filter: Optional[str] = None, **kwargs: Any) -> HttpRe _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) # type: Literal["2022-10-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -66,7 +62,7 @@ def build_list_by_scope_request(scope: str, *, filter: Optional[str] = None, **k _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) # type: Literal["2022-10-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -75,7 +71,7 @@ def build_list_by_scope_request(scope: str, *, filter: Optional[str] = None, **k "scope": _SERIALIZER.url("scope", scope, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -88,12 +84,12 @@ def build_list_by_scope_request(scope: str, *, filter: Optional[str] = None, **k return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_create_or_update_request(name: str, **kwargs: Any) -> HttpRequest: +def build_create_or_update_request(name: str, *, if_match: Optional[str] = None, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) # type: Literal["2022-10-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -102,12 +98,14 @@ def build_create_or_update_request(name: str, **kwargs: Any) -> HttpRequest: "name": _SERIALIZER.url("name", name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers + if if_match is not None: + _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") if content_type is not None: _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -119,7 +117,7 @@ def build_get_request(name: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) # type: Literal["2022-10-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -128,7 +126,7 @@ def build_get_request(name: str, **kwargs: Any) -> HttpRequest: "name": _SERIALIZER.url("name", name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -143,7 +141,7 @@ def build_delete_request(name: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) # type: Literal["2022-10-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -152,7 +150,7 @@ def build_delete_request(name: str, **kwargs: Any) -> HttpRequest: "name": _SERIALIZER.url("name", name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -163,12 +161,14 @@ def build_delete_request(name: str, **kwargs: Any) -> HttpRequest: return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) -def build_create_or_update_by_scope_request(scope: str, name: str, **kwargs: Any) -> HttpRequest: +def build_create_or_update_by_scope_request( + scope: str, name: str, *, if_match: Optional[str] = None, **kwargs: Any +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) # type: Literal["2022-10-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -178,12 +178,14 @@ def build_create_or_update_by_scope_request(scope: str, name: str, **kwargs: Any "name": _SERIALIZER.url("name", name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers + if if_match is not None: + _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") if content_type is not None: _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -195,7 +197,7 @@ def build_get_by_scope_request(scope: str, name: str, **kwargs: Any) -> HttpRequ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) # type: Literal["2022-10-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -205,7 +207,7 @@ def build_get_by_scope_request(scope: str, name: str, **kwargs: Any) -> HttpRequ "name": _SERIALIZER.url("name", name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -220,7 +222,7 @@ def build_delete_by_scope_request(scope: str, name: str, **kwargs: Any) -> HttpR _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) # type: Literal["2022-10-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -230,7 +232,7 @@ def build_delete_by_scope_request(scope: str, name: str, **kwargs: Any) -> HttpR "name": _SERIALIZER.url("name", name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -245,7 +247,7 @@ def build_run_request(name: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) # type: Literal["2022-10-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -254,7 +256,7 @@ def build_run_request(name: str, **kwargs: Any) -> HttpRequest: "name": _SERIALIZER.url("name", name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -269,7 +271,7 @@ def build_run_by_scope_request(scope: str, name: str, **kwargs: Any) -> HttpRequ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) # type: Literal["2022-10-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -279,7 +281,7 @@ def build_run_by_scope_request(scope: str, name: str, **kwargs: Any) -> HttpRequ "name": _SERIALIZER.url("name", name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -294,8 +296,8 @@ def build_check_name_availability_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) # type: Literal["2022-10-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -316,8 +318,8 @@ def build_check_name_availability_by_scope_request(scope: str, **kwargs: Any) -> _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) # type: Literal["2022-10-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -326,7 +328,7 @@ def build_check_name_availability_by_scope_request(scope: str, **kwargs: Any) -> "scope": _SERIALIZER.url("scope", scope, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -362,6 +364,9 @@ def __init__(self, *args, **kwargs): def list(self, filter: Optional[str] = None, **kwargs: Any) -> Iterable["_models.ScheduledAction"]: """List all private scheduled actions. + .. seealso:: + - https://docs.microsoft.com/rest/api/cost-management/ + :param filter: May be used to filter scheduled actions by properties/viewId. Supported operator is 'eq'. Default value is None. :type filter: str @@ -373,10 +378,8 @@ def list(self, filter: Optional[str] = None, **kwargs: Any) -> Iterable["_models _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ScheduledActionListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ScheduledActionListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -397,7 +400,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -413,7 +416,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -421,27 +424,30 @@ def extract_data(pipeline_response): deserialized = self._deserialize("ScheduledActionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponseWithNestedDetails, pipeline_response + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/providers/Microsoft.CostManagement/scheduledActions"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.CostManagement/scheduledActions"} @distributed_trace def list_by_scope( @@ -449,6 +455,9 @@ def list_by_scope( ) -> Iterable["_models.ScheduledAction"]: """List all shared scheduled actions within the given scope. + .. seealso:: + - https://docs.microsoft.com/rest/api/cost-management/ + :param scope: The scope associated with scheduled action operations. This includes 'subscriptions/{subscriptionId}' for subscription scope, 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, @@ -478,10 +487,8 @@ def list_by_scope( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ScheduledActionListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ScheduledActionListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -503,7 +510,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -519,7 +526,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -527,33 +534,37 @@ def extract_data(pipeline_response): deserialized = self._deserialize("ScheduledActionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponseWithNestedDetails, pipeline_response + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response return ItemPaged(get_next, extract_data) - list_by_scope.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/scheduledActions"} # type: ignore + list_by_scope.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/scheduledActions"} @overload def create_or_update( self, name: str, scheduled_action: _models.ScheduledAction, + if_match: Optional[str] = None, *, content_type: str = "application/json", **kwargs: Any @@ -564,6 +575,10 @@ def create_or_update( :type name: str :param scheduled_action: Scheduled action to be created or updated. Required. :type scheduled_action: ~azure.mgmt.costmanagement.models.ScheduledAction + :param if_match: ETag of the Entity. Not required when creating an entity. Optional when + updating an entity and can be specified to achieve optimistic concurrency. Default value is + None. + :type if_match: str :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -575,7 +590,13 @@ def create_or_update( @overload def create_or_update( - self, name: str, scheduled_action: IO, *, content_type: str = "application/json", **kwargs: Any + self, + name: str, + scheduled_action: IO, + if_match: Optional[str] = None, + *, + content_type: str = "application/json", + **kwargs: Any ) -> _models.ScheduledAction: """Create or update a private scheduled action. @@ -583,6 +604,10 @@ def create_or_update( :type name: str :param scheduled_action: Scheduled action to be created or updated. Required. :type scheduled_action: IO + :param if_match: ETag of the Entity. Not required when creating an entity. Optional when + updating an entity and can be specified to achieve optimistic concurrency. Default value is + None. + :type if_match: str :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -594,15 +619,23 @@ def create_or_update( @distributed_trace def create_or_update( - self, name: str, scheduled_action: Union[_models.ScheduledAction, IO], **kwargs: Any + self, + name: str, + scheduled_action: Union[_models.ScheduledAction, IO], + if_match: Optional[str] = None, + **kwargs: Any ) -> _models.ScheduledAction: """Create or update a private scheduled action. :param name: Scheduled action name. Required. :type name: str - :param scheduled_action: Scheduled action to be created or updated. Is either a model type or a - IO type. Required. + :param scheduled_action: Scheduled action to be created or updated. Is either a ScheduledAction + type or a IO type. Required. :type scheduled_action: ~azure.mgmt.costmanagement.models.ScheduledAction or IO + :param if_match: ETag of the Entity. Not required when creating an entity. Optional when + updating an entity and can be specified to achieve optimistic concurrency. Default value is + None. + :type if_match: str :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. :paramtype content_type: str @@ -622,22 +655,21 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ScheduledAction] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ScheduledAction] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(scheduled_action, (IO, bytes)): + if isinstance(scheduled_action, (IOBase, bytes)): _content = scheduled_action else: _json = self._serialize.body(scheduled_action, "ScheduledAction") request = build_create_or_update_request( name=name, + if_match=if_match, api_version=api_version, content_type=content_type, json=_json, @@ -647,17 +679,18 @@ def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseWithNestedDetails, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -667,16 +700,19 @@ def create_or_update( deserialized = self._deserialize("ScheduledAction", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/providers/Microsoft.CostManagement/scheduledActions/{name}"} # type: ignore + create_or_update.metadata = {"url": "/providers/Microsoft.CostManagement/scheduledActions/{name}"} @distributed_trace def get(self, name: str, **kwargs: Any) -> _models.ScheduledAction: """Get the private scheduled action by name. + .. seealso:: + - https://docs.microsoft.com/rest/api/cost-management/ + :param name: Scheduled action name. Required. :type name: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -695,10 +731,8 @@ def get(self, name: str, **kwargs: Any) -> _models.ScheduledAction: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ScheduledAction] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ScheduledAction] = kwargs.pop("cls", None) request = build_get_request( name=name, @@ -708,17 +742,18 @@ def get(self, name: str, **kwargs: Any) -> _models.ScheduledAction: params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseWithNestedDetails, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("ScheduledAction", pipeline_response) @@ -728,12 +763,15 @@ def get(self, name: str, **kwargs: Any) -> _models.ScheduledAction: return deserialized - get.metadata = {"url": "/providers/Microsoft.CostManagement/scheduledActions/{name}"} # type: ignore + get.metadata = {"url": "/providers/Microsoft.CostManagement/scheduledActions/{name}"} @distributed_trace def delete(self, name: str, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements """Delete a private scheduled action. + .. seealso:: + - https://docs.microsoft.com/rest/api/cost-management/ + :param name: Scheduled action name. Required. :type name: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -752,10 +790,8 @@ def delete(self, name: str, **kwargs: Any) -> None: # pylint: disable=inconsist _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( name=name, @@ -765,23 +801,24 @@ def delete(self, name: str, **kwargs: Any) -> None: # pylint: disable=inconsist params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseWithNestedDetails, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/providers/Microsoft.CostManagement/scheduledActions/{name}"} # type: ignore + delete.metadata = {"url": "/providers/Microsoft.CostManagement/scheduledActions/{name}"} @overload def create_or_update_by_scope( @@ -789,6 +826,7 @@ def create_or_update_by_scope( scope: str, name: str, scheduled_action: _models.ScheduledAction, + if_match: Optional[str] = None, *, content_type: str = "application/json", **kwargs: Any @@ -817,6 +855,10 @@ def create_or_update_by_scope( :type name: str :param scheduled_action: Scheduled action to be created or updated. Required. :type scheduled_action: ~azure.mgmt.costmanagement.models.ScheduledAction + :param if_match: ETag of the Entity. Not required when creating an entity. Optional when + updating an entity and can be specified to achieve optimistic concurrency. Default value is + None. + :type if_match: str :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -828,7 +870,14 @@ def create_or_update_by_scope( @overload def create_or_update_by_scope( - self, scope: str, name: str, scheduled_action: IO, *, content_type: str = "application/json", **kwargs: Any + self, + scope: str, + name: str, + scheduled_action: IO, + if_match: Optional[str] = None, + *, + content_type: str = "application/json", + **kwargs: Any ) -> _models.ScheduledAction: """Create or update a shared scheduled action within the given scope. @@ -854,6 +903,10 @@ def create_or_update_by_scope( :type name: str :param scheduled_action: Scheduled action to be created or updated. Required. :type scheduled_action: IO + :param if_match: ETag of the Entity. Not required when creating an entity. Optional when + updating an entity and can be specified to achieve optimistic concurrency. Default value is + None. + :type if_match: str :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -865,7 +918,12 @@ def create_or_update_by_scope( @distributed_trace def create_or_update_by_scope( - self, scope: str, name: str, scheduled_action: Union[_models.ScheduledAction, IO], **kwargs: Any + self, + scope: str, + name: str, + scheduled_action: Union[_models.ScheduledAction, IO], + if_match: Optional[str] = None, + **kwargs: Any ) -> _models.ScheduledAction: """Create or update a shared scheduled action within the given scope. @@ -889,9 +947,13 @@ def create_or_update_by_scope( :type scope: str :param name: Scheduled action name. Required. :type name: str - :param scheduled_action: Scheduled action to be created or updated. Is either a model type or a - IO type. Required. + :param scheduled_action: Scheduled action to be created or updated. Is either a ScheduledAction + type or a IO type. Required. :type scheduled_action: ~azure.mgmt.costmanagement.models.ScheduledAction or IO + :param if_match: ETag of the Entity. Not required when creating an entity. Optional when + updating an entity and can be specified to achieve optimistic concurrency. Default value is + None. + :type if_match: str :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. :paramtype content_type: str @@ -911,16 +973,14 @@ def create_or_update_by_scope( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ScheduledAction] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ScheduledAction] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(scheduled_action, (IO, bytes)): + if isinstance(scheduled_action, (IOBase, bytes)): _content = scheduled_action else: _json = self._serialize.body(scheduled_action, "ScheduledAction") @@ -928,6 +988,7 @@ def create_or_update_by_scope( request = build_create_or_update_by_scope_request( scope=scope, name=name, + if_match=if_match, api_version=api_version, content_type=content_type, json=_json, @@ -937,17 +998,18 @@ def create_or_update_by_scope( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseWithNestedDetails, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -957,16 +1019,19 @@ def create_or_update_by_scope( deserialized = self._deserialize("ScheduledAction", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update_by_scope.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/scheduledActions/{name}"} # type: ignore + create_or_update_by_scope.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/scheduledActions/{name}"} @distributed_trace def get_by_scope(self, scope: str, name: str, **kwargs: Any) -> _models.ScheduledAction: """Get the shared scheduled action from the given scope by name. + .. seealso:: + - https://docs.microsoft.com/rest/api/cost-management/ + :param scope: The scope associated with scheduled action operations. This includes 'subscriptions/{subscriptionId}' for subscription scope, 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, @@ -1003,10 +1068,8 @@ def get_by_scope(self, scope: str, name: str, **kwargs: Any) -> _models.Schedule _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ScheduledAction] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ScheduledAction] = kwargs.pop("cls", None) request = build_get_by_scope_request( scope=scope, @@ -1017,17 +1080,18 @@ def get_by_scope(self, scope: str, name: str, **kwargs: Any) -> _models.Schedule params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseWithNestedDetails, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("ScheduledAction", pipeline_response) @@ -1037,7 +1101,7 @@ def get_by_scope(self, scope: str, name: str, **kwargs: Any) -> _models.Schedule return deserialized - get_by_scope.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/scheduledActions/{name}"} # type: ignore + get_by_scope.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/scheduledActions/{name}"} @distributed_trace def delete_by_scope( # pylint: disable=inconsistent-return-statements @@ -1045,6 +1109,9 @@ def delete_by_scope( # pylint: disable=inconsistent-return-statements ) -> None: """Delete a scheduled action within the given scope. + .. seealso:: + - https://docs.microsoft.com/rest/api/cost-management/ + :param scope: The scope associated with scheduled action operations. This includes 'subscriptions/{subscriptionId}' for subscription scope, 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, @@ -1081,10 +1148,8 @@ def delete_by_scope( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_by_scope_request( scope=scope, @@ -1095,23 +1160,24 @@ def delete_by_scope( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseWithNestedDetails, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - delete_by_scope.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/scheduledActions/{name}"} # type: ignore + delete_by_scope.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/scheduledActions/{name}"} @distributed_trace def run(self, name: str, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements @@ -1135,10 +1201,8 @@ def run(self, name: str, **kwargs: Any) -> None: # pylint: disable=inconsistent _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_run_request( name=name, @@ -1148,23 +1212,24 @@ def run(self, name: str, **kwargs: Any) -> None: # pylint: disable=inconsistent params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseWithNestedDetails, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - run.metadata = {"url": "/providers/Microsoft.CostManagement/scheduledActions/{name}/execute"} # type: ignore + run.metadata = {"url": "/providers/Microsoft.CostManagement/scheduledActions/{name}/execute"} @distributed_trace def run_by_scope( # pylint: disable=inconsistent-return-statements @@ -1208,10 +1273,8 @@ def run_by_scope( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_run_by_scope_request( scope=scope, @@ -1222,23 +1285,24 @@ def run_by_scope( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseWithNestedDetails, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - run_by_scope.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/scheduledActions/{name}/execute"} # type: ignore + run_by_scope.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/scheduledActions/{name}/execute"} @overload def check_name_availability( @@ -1286,7 +1350,7 @@ def check_name_availability( """Checks availability and correctness of the name for a scheduled action. :param check_name_availability_request: Scheduled action to be created or updated. Is either a - model type or a IO type. Required. + CheckNameAvailabilityRequest type or a IO type. Required. :type check_name_availability_request: ~azure.mgmt.costmanagement.models.CheckNameAvailabilityRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -1308,16 +1372,14 @@ def check_name_availability( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CheckNameAvailabilityResponse] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CheckNameAvailabilityResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(check_name_availability_request, (IO, bytes)): + if isinstance(check_name_availability_request, (IOBase, bytes)): _content = check_name_availability_request else: _json = self._serialize.body(check_name_availability_request, "CheckNameAvailabilityRequest") @@ -1332,17 +1394,18 @@ def check_name_availability( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseWithNestedDetails, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("CheckNameAvailabilityResponse", pipeline_response) @@ -1352,7 +1415,7 @@ def check_name_availability( return deserialized - check_name_availability.metadata = {"url": "/providers/Microsoft.CostManagement/checkNameAvailability"} # type: ignore + check_name_availability.metadata = {"url": "/providers/Microsoft.CostManagement/checkNameAvailability"} @overload def check_name_availability_by_scope( @@ -1458,7 +1521,7 @@ def check_name_availability_by_scope( Required. :type scope: str :param check_name_availability_request: Scheduled action to be created or updated. Is either a - model type or a IO type. Required. + CheckNameAvailabilityRequest type or a IO type. Required. :type check_name_availability_request: ~azure.mgmt.costmanagement.models.CheckNameAvailabilityRequest or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -1480,16 +1543,14 @@ def check_name_availability_by_scope( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CheckNameAvailabilityResponse] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CheckNameAvailabilityResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(check_name_availability_request, (IO, bytes)): + if isinstance(check_name_availability_request, (IOBase, bytes)): _content = check_name_availability_request else: _json = self._serialize.body(check_name_availability_request, "CheckNameAvailabilityRequest") @@ -1505,17 +1566,18 @@ def check_name_availability_by_scope( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseWithNestedDetails, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("CheckNameAvailabilityResponse", pipeline_response) @@ -1525,4 +1587,6 @@ def check_name_availability_by_scope( return deserialized - check_name_availability_by_scope.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/checkNameAvailability"} # type: ignore + check_name_availability_by_scope.metadata = { + "url": "/{scope}/providers/Microsoft.CostManagement/checkNameAvailability" + } diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_views_operations.py b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_views_operations.py index 598e85f13489..b0d3d009ea83 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_views_operations.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/operations/_views_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -30,10 +30,6 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +41,7 @@ def build_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) # type: Literal["2022-10-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -64,7 +60,7 @@ def build_list_by_scope_request(scope: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) # type: Literal["2022-10-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -73,7 +69,7 @@ def build_list_by_scope_request(scope: str, **kwargs: Any) -> HttpRequest: "scope": _SERIALIZER.url("scope", scope, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -88,7 +84,7 @@ def build_get_request(view_name: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) # type: Literal["2022-10-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -97,7 +93,7 @@ def build_get_request(view_name: str, **kwargs: Any) -> HttpRequest: "viewName": _SERIALIZER.url("view_name", view_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -112,8 +108,8 @@ def build_create_or_update_request(view_name: str, **kwargs: Any) -> HttpRequest _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) # type: Literal["2022-10-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -122,7 +118,7 @@ def build_create_or_update_request(view_name: str, **kwargs: Any) -> HttpRequest "viewName": _SERIALIZER.url("view_name", view_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -139,7 +135,7 @@ def build_delete_request(view_name: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) # type: Literal["2022-10-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -148,7 +144,7 @@ def build_delete_request(view_name: str, **kwargs: Any) -> HttpRequest: "viewName": _SERIALIZER.url("view_name", view_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -163,7 +159,7 @@ def build_get_by_scope_request(scope: str, view_name: str, **kwargs: Any) -> Htt _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) # type: Literal["2022-10-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -173,7 +169,7 @@ def build_get_by_scope_request(scope: str, view_name: str, **kwargs: Any) -> Htt "viewName": _SERIALIZER.url("view_name", view_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -188,8 +184,8 @@ def build_create_or_update_by_scope_request(scope: str, view_name: str, **kwargs _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) # type: Literal["2022-10-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -199,7 +195,7 @@ def build_create_or_update_by_scope_request(scope: str, view_name: str, **kwargs "viewName": _SERIALIZER.url("view_name", view_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -216,7 +212,7 @@ def build_delete_by_scope_request(scope: str, view_name: str, **kwargs: Any) -> _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) # type: Literal["2022-10-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -226,7 +222,7 @@ def build_delete_by_scope_request(scope: str, view_name: str, **kwargs: Any) -> "viewName": _SERIALIZER.url("view_name", view_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -260,6 +256,9 @@ def __init__(self, *args, **kwargs): def list(self, **kwargs: Any) -> Iterable["_models.View"]: """Lists all views by tenant and object. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either View or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.costmanagement.models.View] @@ -268,10 +267,8 @@ def list(self, **kwargs: Any) -> Iterable["_models.View"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ViewListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ViewListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -291,7 +288,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -307,7 +304,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -315,14 +312,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("ViewListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -335,12 +333,15 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/providers/Microsoft.CostManagement/views"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.CostManagement/views"} @distributed_trace def list_by_scope(self, scope: str, **kwargs: Any) -> Iterable["_models.View"]: """Lists all views at the given scope. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :param scope: The scope associated with view operations. This includes 'subscriptions/{subscriptionId}' for subscription scope, 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, @@ -367,10 +368,8 @@ def list_by_scope(self, scope: str, **kwargs: Any) -> Iterable["_models.View"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ViewListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ViewListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -391,7 +390,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -407,7 +406,7 @@ def prepare_request(next_link=None): "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -415,14 +414,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("ViewListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -435,12 +435,15 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_scope.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/views"} # type: ignore + list_by_scope.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/views"} @distributed_trace def get(self, view_name: str, **kwargs: Any) -> _models.View: """Gets the view by view name. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :param view_name: View name. Required. :type view_name: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -459,10 +462,8 @@ def get(self, view_name: str, **kwargs: Any) -> _models.View: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.View] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.View] = kwargs.pop("cls", None) request = build_get_request( view_name=view_name, @@ -472,10 +473,11 @@ def get(self, view_name: str, **kwargs: Any) -> _models.View: params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -492,7 +494,7 @@ def get(self, view_name: str, **kwargs: Any) -> _models.View: return deserialized - get.metadata = {"url": "/providers/Microsoft.CostManagement/views/{viewName}"} # type: ignore + get.metadata = {"url": "/providers/Microsoft.CostManagement/views/{viewName}"} @overload def create_or_update( @@ -502,6 +504,9 @@ def create_or_update( the request. You may obtain the latest eTag by performing a get operation. Create operation does not require eTag. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :param view_name: View name. Required. :type view_name: str :param parameters: Parameters supplied to the CreateOrUpdate View operation. Required. @@ -523,6 +528,9 @@ def create_or_update( the request. You may obtain the latest eTag by performing a get operation. Create operation does not require eTag. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :param view_name: View name. Required. :type view_name: str :param parameters: Parameters supplied to the CreateOrUpdate View operation. Required. @@ -542,9 +550,12 @@ def create_or_update(self, view_name: str, parameters: Union[_models.View, IO], the request. You may obtain the latest eTag by performing a get operation. Create operation does not require eTag. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :param view_name: View name. Required. :type view_name: str - :param parameters: Parameters supplied to the CreateOrUpdate View operation. Is either a model + :param parameters: Parameters supplied to the CreateOrUpdate View operation. Is either a View type or a IO type. Required. :type parameters: ~azure.mgmt.costmanagement.models.View or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -566,16 +577,14 @@ def create_or_update(self, view_name: str, parameters: Union[_models.View, IO], _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.View] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.View] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "View") @@ -591,10 +600,11 @@ def create_or_update(self, view_name: str, parameters: Union[_models.View, IO], params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -611,16 +621,19 @@ def create_or_update(self, view_name: str, parameters: Union[_models.View, IO], deserialized = self._deserialize("View", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update.metadata = {"url": "/providers/Microsoft.CostManagement/views/{viewName}"} # type: ignore + create_or_update.metadata = {"url": "/providers/Microsoft.CostManagement/views/{viewName}"} @distributed_trace def delete(self, view_name: str, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements """The operation to delete a view. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :param view_name: View name. Required. :type view_name: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -639,10 +652,8 @@ def delete(self, view_name: str, **kwargs: Any) -> None: # pylint: disable=inco _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( view_name=view_name, @@ -652,10 +663,11 @@ def delete(self, view_name: str, **kwargs: Any) -> None: # pylint: disable=inco params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -668,12 +680,15 @@ def delete(self, view_name: str, **kwargs: Any) -> None: # pylint: disable=inco if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/providers/Microsoft.CostManagement/views/{viewName}"} # type: ignore + delete.metadata = {"url": "/providers/Microsoft.CostManagement/views/{viewName}"} @distributed_trace def get_by_scope(self, scope: str, view_name: str, **kwargs: Any) -> _models.View: """Gets the view for the defined scope by view name. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :param scope: The scope associated with view operations. This includes 'subscriptions/{subscriptionId}' for subscription scope, 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, @@ -710,10 +725,8 @@ def get_by_scope(self, scope: str, view_name: str, **kwargs: Any) -> _models.Vie _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.View] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.View] = kwargs.pop("cls", None) request = build_get_by_scope_request( scope=scope, @@ -724,10 +737,11 @@ def get_by_scope(self, scope: str, view_name: str, **kwargs: Any) -> _models.Vie params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -744,7 +758,7 @@ def get_by_scope(self, scope: str, view_name: str, **kwargs: Any) -> _models.Vie return deserialized - get_by_scope.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/views/{viewName}"} # type: ignore + get_by_scope.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/views/{viewName}"} @overload def create_or_update_by_scope( @@ -760,6 +774,9 @@ def create_or_update_by_scope( the request. You may obtain the latest eTag by performing a get operation. Create operation does not require eTag. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :param scope: The scope associated with view operations. This includes 'subscriptions/{subscriptionId}' for subscription scope, 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, @@ -799,6 +816,9 @@ def create_or_update_by_scope( the request. You may obtain the latest eTag by performing a get operation. Create operation does not require eTag. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :param scope: The scope associated with view operations. This includes 'subscriptions/{subscriptionId}' for subscription scope, 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, @@ -838,6 +858,9 @@ def create_or_update_by_scope( the request. You may obtain the latest eTag by performing a get operation. Create operation does not require eTag. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :param scope: The scope associated with view operations. This includes 'subscriptions/{subscriptionId}' for subscription scope, 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, @@ -858,7 +881,7 @@ def create_or_update_by_scope( :type scope: str :param view_name: View name. Required. :type view_name: str - :param parameters: Parameters supplied to the CreateOrUpdate View operation. Is either a model + :param parameters: Parameters supplied to the CreateOrUpdate View operation. Is either a View type or a IO type. Required. :type parameters: ~azure.mgmt.costmanagement.models.View or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -880,16 +903,14 @@ def create_or_update_by_scope( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.View] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.View] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "View") @@ -906,10 +927,11 @@ def create_or_update_by_scope( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -926,11 +948,11 @@ def create_or_update_by_scope( deserialized = self._deserialize("View", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - create_or_update_by_scope.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/views/{viewName}"} # type: ignore + create_or_update_by_scope.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/views/{viewName}"} @distributed_trace def delete_by_scope( # pylint: disable=inconsistent-return-statements @@ -938,6 +960,9 @@ def delete_by_scope( # pylint: disable=inconsistent-return-statements ) -> None: """The operation to delete a view. + .. seealso:: + - https://docs.microsoft.com/en-us/rest/api/costmanagement/ + :param scope: The scope associated with view operations. This includes 'subscriptions/{subscriptionId}' for subscription scope, 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, @@ -974,10 +999,8 @@ def delete_by_scope( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-10-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_by_scope_request( scope=scope, @@ -988,10 +1011,11 @@ def delete_by_scope( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1004,4 +1028,4 @@ def delete_by_scope( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete_by_scope.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/views/{viewName}"} # type: ignore + delete_by_scope.metadata = {"url": "/{scope}/providers/Microsoft.CostManagement/views/{viewName}"} diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/benefit_recommendations_billing_account_list.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/benefit_recommendations_by_billing_account.py similarity index 92% rename from sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/benefit_recommendations_billing_account_list.py rename to sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/benefit_recommendations_by_billing_account.py index 625abc9640d1..6b26836d3f67 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/benefit_recommendations_billing_account_list.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/benefit_recommendations_by_billing_account.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-costmanagement # USAGE - python benefit_recommendations_billing_account_list.py + python benefit_recommendations_by_billing_account.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -35,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/BenefitRecommendationsByBillingAccount.json +# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/BenefitRecommendationsByBillingAccount.json if __name__ == "__main__": main() diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/benefit_utilization_summaries/async/generate_benefit_utilization_summaries_report_by_billing_account.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/benefit_utilization_summaries/async/generate_benefit_utilization_summaries_report_by_billing_account.py new file mode 100644 index 000000000000..7e85ee34e1ed --- /dev/null +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/benefit_utilization_summaries/async/generate_benefit_utilization_summaries_report_by_billing_account.py @@ -0,0 +1,45 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.costmanagement import CostManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-costmanagement +# USAGE + python generate_benefit_utilization_summaries_report_by_billing_account.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CostManagementClient( + credential=DefaultAzureCredential(), + ) + + response = client.billing_account_scope.begin_generate_benefit_utilization_summaries_report( + billing_account_id="8099099", + benefit_utilization_summaries_request={ + "endDate": "2022-08-31T00:00:00Z", + "grain": "Daily", + "kind": "Reservation", + "startDate": "2022-06-01T00:00:00Z", + }, + ).result() + print(response) + + +# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/BenefitUtilizationSummaries/Async/GenerateBenefitUtilizationSummariesReportByBillingAccount.json +if __name__ == "__main__": + main() diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/benefit_utilization_summaries/async/generate_benefit_utilization_summaries_report_by_billing_profile.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/benefit_utilization_summaries/async/generate_benefit_utilization_summaries_report_by_billing_profile.py new file mode 100644 index 000000000000..d45424fd379a --- /dev/null +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/benefit_utilization_summaries/async/generate_benefit_utilization_summaries_report_by_billing_profile.py @@ -0,0 +1,46 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.costmanagement import CostManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-costmanagement +# USAGE + python generate_benefit_utilization_summaries_report_by_billing_profile.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CostManagementClient( + credential=DefaultAzureCredential(), + ) + + response = client.billing_profile_scope.begin_generate_benefit_utilization_summaries_report( + billing_account_id="00000000-0000-0000-0000-000000000000", + billing_profile_id="CZSFR-SDFXC-DSDF", + benefit_utilization_summaries_request={ + "endDate": "2022-08-31T00:00:00Z", + "grain": "Daily", + "kind": "Reservation", + "startDate": "2022-06-01T00:00:00Z", + }, + ).result() + print(response) + + +# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/BenefitUtilizationSummaries/Async/GenerateBenefitUtilizationSummariesReportByBillingProfile.json +if __name__ == "__main__": + main() diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/benefit_utilization_summaries/async/generate_benefit_utilization_summaries_report_by_reservation.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/benefit_utilization_summaries/async/generate_benefit_utilization_summaries_report_by_reservation.py new file mode 100644 index 000000000000..e2c4ae58be2e --- /dev/null +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/benefit_utilization_summaries/async/generate_benefit_utilization_summaries_report_by_reservation.py @@ -0,0 +1,45 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.costmanagement import CostManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-costmanagement +# USAGE + python generate_benefit_utilization_summaries_report_by_reservation.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CostManagementClient( + credential=DefaultAzureCredential(), + ) + + response = client.reservation_scope.begin_generate_benefit_utilization_summaries_report( + reservation_order_id="00000000-0000-0000-0000-000000000000", + reservation_id="00000000-0000-0000-0000-000000000000", + benefit_utilization_summaries_request={ + "endDate": "2022-08-31T00:00:00Z", + "grain": "Daily", + "startDate": "2022-06-01T00:00:00Z", + }, + ).result() + print(response) + + +# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/BenefitUtilizationSummaries/Async/GenerateBenefitUtilizationSummariesReportByReservation.json +if __name__ == "__main__": + main() diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/benefit_utilization_summaries/async/generate_benefit_utilization_summaries_report_by_reservation_order.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/benefit_utilization_summaries/async/generate_benefit_utilization_summaries_report_by_reservation_order.py new file mode 100644 index 000000000000..e61365ddfab8 --- /dev/null +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/benefit_utilization_summaries/async/generate_benefit_utilization_summaries_report_by_reservation_order.py @@ -0,0 +1,44 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.costmanagement import CostManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-costmanagement +# USAGE + python generate_benefit_utilization_summaries_report_by_reservation_order.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CostManagementClient( + credential=DefaultAzureCredential(), + ) + + response = client.reservation_order_scope.begin_generate_benefit_utilization_summaries_report( + reservation_order_id="00000000-0000-0000-0000-000000000000", + benefit_utilization_summaries_request={ + "endDate": "2022-08-31T00:00:00Z", + "grain": "Daily", + "startDate": "2022-06-01T00:00:00Z", + }, + ).result() + print(response) + + +# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/BenefitUtilizationSummaries/Async/GenerateBenefitUtilizationSummariesReportByReservationOrder.json +if __name__ == "__main__": + main() diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/benefit_utilization_summaries/async/generate_benefit_utilization_summaries_report_by_savings_plan.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/benefit_utilization_summaries/async/generate_benefit_utilization_summaries_report_by_savings_plan.py new file mode 100644 index 000000000000..918d63609abf --- /dev/null +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/benefit_utilization_summaries/async/generate_benefit_utilization_summaries_report_by_savings_plan.py @@ -0,0 +1,45 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.costmanagement import CostManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-costmanagement +# USAGE + python generate_benefit_utilization_summaries_report_by_savings_plan.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CostManagementClient( + credential=DefaultAzureCredential(), + ) + + response = client.savings_plan_scope.begin_generate_benefit_utilization_summaries_report_async( + savings_plan_order_id="00000000-0000-0000-0000-000000000000", + savings_plan_id="00000000-0000-0000-0000-000000000000", + benefit_utilization_summaries_request={ + "endDate": "2022-08-31T00:00:00Z", + "grain": "Daily", + "startDate": "2022-06-01T00:00:00Z", + }, + ).result() + print(response) + + +# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/BenefitUtilizationSummaries/Async/GenerateBenefitUtilizationSummariesReportBySavingsPlan.json +if __name__ == "__main__": + main() diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/benefit_utilization_summaries/async/generate_benefit_utilization_summaries_report_by_savings_plan_order.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/benefit_utilization_summaries/async/generate_benefit_utilization_summaries_report_by_savings_plan_order.py new file mode 100644 index 000000000000..db5492e73aaa --- /dev/null +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/benefit_utilization_summaries/async/generate_benefit_utilization_summaries_report_by_savings_plan_order.py @@ -0,0 +1,44 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.costmanagement import CostManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-costmanagement +# USAGE + python generate_benefit_utilization_summaries_report_by_savings_plan_order.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CostManagementClient( + credential=DefaultAzureCredential(), + ) + + response = client.savings_plan_order_scope.begin_generate_benefit_utilization_summaries_report( + savings_plan_order_id="00000000-0000-0000-0000-000000000000", + benefit_utilization_summaries_request={ + "endDate": "2022-08-31T00:00:00Z", + "grain": "Daily", + "startDate": "2022-06-01T00:00:00Z", + }, + ).result() + print(response) + + +# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/BenefitUtilizationSummaries/Async/GenerateBenefitUtilizationSummariesReportBySavingsPlanOrder.json +if __name__ == "__main__": + main() diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/savings_plan_utilization_summaries_billing_account.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/benefit_utilization_summaries/savings_plan_billing_account.py similarity index 91% rename from sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/savings_plan_utilization_summaries_billing_account.py rename to sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/benefit_utilization_summaries/savings_plan_billing_account.py index 7c1b071290df..f9233477bb25 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/savings_plan_utilization_summaries_billing_account.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/benefit_utilization_summaries/savings_plan_billing_account.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-costmanagement # USAGE - python savings_plan_utilization_summaries_billing_account.py + python savings_plan_billing_account.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -35,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/BenefitUtilizationSummaries/SavingsPlan-BillingAccount.json +# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/BenefitUtilizationSummaries/SavingsPlan-BillingAccount.json if __name__ == "__main__": main() diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/savings_plan_utilization_summaries_billing_profile.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/benefit_utilization_summaries/savings_plan_billing_profile.py similarity index 92% rename from sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/savings_plan_utilization_summaries_billing_profile.py rename to sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/benefit_utilization_summaries/savings_plan_billing_profile.py index ec5ccd3453db..570066e81a87 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/savings_plan_utilization_summaries_billing_profile.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/benefit_utilization_summaries/savings_plan_billing_profile.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-costmanagement # USAGE - python savings_plan_utilization_summaries_billing_profile.py + python savings_plan_billing_profile.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/BenefitUtilizationSummaries/SavingsPlan-BillingProfile.json +# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/BenefitUtilizationSummaries/SavingsPlan-BillingProfile.json if __name__ == "__main__": main() diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/savings_plan_utilization_summaries_monthly_with_savings_plan_id.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/benefit_utilization_summaries/savings_plan_savings_plan_id_monthly.py similarity index 91% rename from sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/savings_plan_utilization_summaries_monthly_with_savings_plan_id.py rename to sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/benefit_utilization_summaries/savings_plan_savings_plan_id_monthly.py index 6b75daf0eb01..3e49487cd545 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/savings_plan_utilization_summaries_monthly_with_savings_plan_id.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/benefit_utilization_summaries/savings_plan_savings_plan_id_monthly.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-costmanagement # USAGE - python savings_plan_utilization_summaries_monthly_with_savings_plan_id.py + python savings_plan_savings_plan_id_monthly.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/BenefitUtilizationSummaries/SavingsPlan-SavingsPlanId-Monthly.json +# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/BenefitUtilizationSummaries/SavingsPlan-SavingsPlanId-Monthly.json if __name__ == "__main__": main() diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/savings_plan_utilization_summaries_daily.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/benefit_utilization_summaries/savings_plan_savings_plan_order_id_daily.py similarity index 92% rename from sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/savings_plan_utilization_summaries_daily.py rename to sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/benefit_utilization_summaries/savings_plan_savings_plan_order_id_daily.py index d925c8e02a7a..95558e7ce4bf 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/savings_plan_utilization_summaries_daily.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/benefit_utilization_summaries/savings_plan_savings_plan_order_id_daily.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-costmanagement # USAGE - python savings_plan_utilization_summaries_daily.py + python savings_plan_savings_plan_order_id_daily.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -35,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/BenefitUtilizationSummaries/SavingsPlan-SavingsPlanOrderId-Daily.json +# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/BenefitUtilizationSummaries/SavingsPlan-SavingsPlanOrderId-Daily.json if __name__ == "__main__": main() diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/billing_account_alerts.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/billing_account_alerts.py index b5bb07a53325..d3ba7ba8bbea 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/billing_account_alerts.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/billing_account_alerts.py @@ -34,6 +34,6 @@ def main(): print(response) -# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/BillingAccountAlerts.json +# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/BillingAccountAlerts.json if __name__ == "__main__": main() diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/billing_account_dimensions_list_legacy.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/billing_account_dimensions_list.py similarity index 92% rename from sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/billing_account_dimensions_list_legacy.py rename to sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/billing_account_dimensions_list.py index 9b783373c3ff..368f3244fdfe 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/billing_account_dimensions_list_legacy.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/billing_account_dimensions_list.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-costmanagement # USAGE - python billing_account_dimensions_list_legacy.py + python billing_account_dimensions_list.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -35,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/BillingAccountDimensionsList.json +# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/BillingAccountDimensionsList.json if __name__ == "__main__": main() diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/billing_account_dimensions_list_expand_and_top_legacy.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/billing_account_dimensions_list_expand_and_top.py similarity index 91% rename from sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/billing_account_dimensions_list_expand_and_top_legacy.py rename to sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/billing_account_dimensions_list_expand_and_top.py index f13c043cc3ab..745a0d07eccd 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/billing_account_dimensions_list_expand_and_top_legacy.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/billing_account_dimensions_list_expand_and_top.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-costmanagement # USAGE - python billing_account_dimensions_list_expand_and_top_legacy.py + python billing_account_dimensions_list_expand_and_top.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -35,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/BillingAccountDimensionsListExpandAndTop.json +# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/BillingAccountDimensionsListExpandAndTop.json if __name__ == "__main__": main() diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/billing_account_dimensions_list_with_filter_legacy.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/billing_account_dimensions_list_with_filter.py similarity index 91% rename from sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/billing_account_dimensions_list_with_filter_legacy.py rename to sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/billing_account_dimensions_list_with_filter.py index 67b139a555d6..7aab707f1915 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/billing_account_dimensions_list_with_filter_legacy.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/billing_account_dimensions_list_with_filter.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-costmanagement # USAGE - python billing_account_dimensions_list_with_filter_legacy.py + python billing_account_dimensions_list_with_filter.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -35,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/BillingAccountDimensionsListWithFilter.json +# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/BillingAccountDimensionsListWithFilter.json if __name__ == "__main__": main() diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/billing_account_forecast.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/billing_account_forecast.py index 1b4628647f41..9951ae6023d9 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/billing_account_forecast.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/billing_account_forecast.py @@ -62,6 +62,6 @@ def main(): print(response) -# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/BillingAccountForecast.json +# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/BillingAccountForecast.json if __name__ == "__main__": main() diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/billing_account_query_legacy.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/billing_account_query.py similarity index 95% rename from sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/billing_account_query_legacy.py rename to sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/billing_account_query.py index 52ab82ffe603..f9c7536e4949 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/billing_account_query_legacy.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/billing_account_query.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-costmanagement # USAGE - python billing_account_query_legacy.py + python billing_account_query.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -58,6 +58,6 @@ def main(): print(response) -# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/BillingAccountQuery.json +# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/BillingAccountQuery.json if __name__ == "__main__": main() diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/billing_account_query_grouping_legacy.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/billing_account_query_grouping.py similarity index 93% rename from sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/billing_account_query_grouping_legacy.py rename to sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/billing_account_query_grouping.py index fbc06c135d76..f6d706ab3913 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/billing_account_query_grouping_legacy.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/billing_account_query_grouping.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-costmanagement # USAGE - python billing_account_query_grouping_legacy.py + python billing_account_query_grouping.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -43,6 +43,6 @@ def main(): print(response) -# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/BillingAccountQueryGrouping.json +# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/BillingAccountQueryGrouping.json if __name__ == "__main__": main() diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/billing_profile_alerts.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/billing_profile_alerts.py index e3d0e291e3a4..424d60f77e6b 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/billing_profile_alerts.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/billing_profile_alerts.py @@ -34,6 +34,6 @@ def main(): print(response) -# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/BillingProfileAlerts.json +# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/BillingProfileAlerts.json if __name__ == "__main__": main() diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/billing_profile_forecast.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/billing_profile_forecast.py index 887aafbcf15e..8e68f5dfd7bc 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/billing_profile_forecast.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/billing_profile_forecast.py @@ -62,6 +62,6 @@ def main(): print(response) -# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/BillingProfileForecast.json +# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/BillingProfileForecast.json if __name__ == "__main__": main() diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/get_details_of_the_operation_result.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/cost_details_operation_results_by_subscription_scope.py similarity index 92% rename from sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/get_details_of_the_operation_result.py rename to sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/cost_details_operation_results_by_subscription_scope.py index ae8aff59026d..1a7981ad646f 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/get_details_of_the_operation_result.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/cost_details_operation_results_by_subscription_scope.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-costmanagement # USAGE - python get_details_of_the_operation_result.py + python cost_details_operation_results_by_subscription_scope.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -35,6 +35,6 @@ def main(): print(response) -# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/CostDetailsOperationResultsBySubscriptionScope.json +# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/CostDetailsOperationResultsBySubscriptionScope.json if __name__ == "__main__": main() diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/department_alerts.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/department_alerts.py index 88c238b30566..a934c3545bd1 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/department_alerts.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/department_alerts.py @@ -34,6 +34,6 @@ def main(): print(response) -# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/DepartmentAlerts.json +# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/DepartmentAlerts.json if __name__ == "__main__": main() diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/department_dimensions_list_legacy.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/department_dimensions_list.py similarity index 92% rename from sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/department_dimensions_list_legacy.py rename to sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/department_dimensions_list.py index 8e4903cf4ade..232ab56a6380 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/department_dimensions_list_legacy.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/department_dimensions_list.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-costmanagement # USAGE - python department_dimensions_list_legacy.py + python department_dimensions_list.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -35,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/DepartmentDimensionsList.json +# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/DepartmentDimensionsList.json if __name__ == "__main__": main() diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/department_dimensions_list_expand_and_top_legacy.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/department_dimensions_list_expand_and_top.py similarity index 91% rename from sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/department_dimensions_list_expand_and_top_legacy.py rename to sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/department_dimensions_list_expand_and_top.py index 5e642afe4c34..e8d93a12e4fa 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/department_dimensions_list_expand_and_top_legacy.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/department_dimensions_list_expand_and_top.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-costmanagement # USAGE - python department_dimensions_list_expand_and_top_legacy.py + python department_dimensions_list_expand_and_top.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -35,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/DepartmentDimensionsListExpandAndTop.json +# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/DepartmentDimensionsListExpandAndTop.json if __name__ == "__main__": main() diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/department_dimensions_list_with_filter_legacy.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/department_dimensions_list_with_filter.py similarity index 92% rename from sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/department_dimensions_list_with_filter_legacy.py rename to sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/department_dimensions_list_with_filter.py index 006cc534aea9..0fa44afd77d4 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/department_dimensions_list_with_filter_legacy.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/department_dimensions_list_with_filter.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-costmanagement # USAGE - python department_dimensions_list_with_filter_legacy.py + python department_dimensions_list_with_filter.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -35,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/DepartmentDimensionsListWithFilter.json +# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/DepartmentDimensionsListWithFilter.json if __name__ == "__main__": main() diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/department_forecast.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/department_forecast.py index 15b69c4b5200..8027a82d83cc 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/department_forecast.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/department_forecast.py @@ -62,6 +62,6 @@ def main(): print(response) -# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/DepartmentForecast.json +# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/DepartmentForecast.json if __name__ == "__main__": main() diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/department_query_legacy.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/department_query.py similarity index 95% rename from sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/department_query_legacy.py rename to sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/department_query.py index 90e9f5d78123..104df65e1ecc 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/department_query_legacy.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/department_query.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-costmanagement # USAGE - python department_query_legacy.py + python department_query.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -58,6 +58,6 @@ def main(): print(response) -# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/DepartmentQuery.json +# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/DepartmentQuery.json if __name__ == "__main__": main() diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/department_query_grouping_legacy.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/department_query_grouping.py similarity index 94% rename from sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/department_query_grouping_legacy.py rename to sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/department_query_grouping.py index 749034add892..d07bff82c2ff 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/department_query_grouping_legacy.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/department_query_grouping.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-costmanagement # USAGE - python department_query_grouping_legacy.py + python department_query_grouping.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -43,6 +43,6 @@ def main(): print(response) -# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/DepartmentQueryGrouping.json +# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/DepartmentQueryGrouping.json if __name__ == "__main__": main() diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/patch_resource_group_alerts.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/dismiss_resource_group_alerts.py similarity index 93% rename from sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/patch_resource_group_alerts.py rename to sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/dismiss_resource_group_alerts.py index 2ac6755fa379..7958b045a2cf 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/patch_resource_group_alerts.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/dismiss_resource_group_alerts.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-costmanagement # USAGE - python patch_resource_group_alerts.py + python dismiss_resource_group_alerts.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/DismissResourceGroupAlerts.json +# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/DismissResourceGroupAlerts.json if __name__ == "__main__": main() diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/patch_subscription_alerts.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/dismiss_subscription_alerts.py similarity index 93% rename from sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/patch_subscription_alerts.py rename to sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/dismiss_subscription_alerts.py index f9c4741ea35b..a3acfc91260b 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/patch_subscription_alerts.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/dismiss_subscription_alerts.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-costmanagement # USAGE - python patch_subscription_alerts.py + python dismiss_subscription_alerts.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/DismissSubscriptionAlerts.json +# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/DismissSubscriptionAlerts.json if __name__ == "__main__": main() diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/enrollment_account_alerts.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/enrollment_account_alerts.py index 1e246acd55bb..4cc37eca4f8e 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/enrollment_account_alerts.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/enrollment_account_alerts.py @@ -34,6 +34,6 @@ def main(): print(response) -# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/EnrollmentAccountAlerts.json +# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/EnrollmentAccountAlerts.json if __name__ == "__main__": main() diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/enrollment_account_dimensions_list_legacy.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/enrollment_account_dimensions_list.py similarity index 92% rename from sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/enrollment_account_dimensions_list_legacy.py rename to sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/enrollment_account_dimensions_list.py index a1e0f832dd55..d8834dec4117 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/enrollment_account_dimensions_list_legacy.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/enrollment_account_dimensions_list.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-costmanagement # USAGE - python enrollment_account_dimensions_list_legacy.py + python enrollment_account_dimensions_list.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -35,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/EnrollmentAccountDimensionsList.json +# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/EnrollmentAccountDimensionsList.json if __name__ == "__main__": main() diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/enrollment_account_dimensions_list_expand_and_top_legacy.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/enrollment_account_dimensions_list_expand_and_top.py similarity index 91% rename from sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/enrollment_account_dimensions_list_expand_and_top_legacy.py rename to sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/enrollment_account_dimensions_list_expand_and_top.py index 9f185bbf54ea..e0151e8698c2 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/enrollment_account_dimensions_list_expand_and_top_legacy.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/enrollment_account_dimensions_list_expand_and_top.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-costmanagement # USAGE - python enrollment_account_dimensions_list_expand_and_top_legacy.py + python enrollment_account_dimensions_list_expand_and_top.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -35,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/EnrollmentAccountDimensionsListExpandAndTop.json +# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/EnrollmentAccountDimensionsListExpandAndTop.json if __name__ == "__main__": main() diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/enrollment_account_dimensions_list_with_filter_legacy.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/enrollment_account_dimensions_list_with_filter.py similarity index 91% rename from sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/enrollment_account_dimensions_list_with_filter_legacy.py rename to sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/enrollment_account_dimensions_list_with_filter.py index 0f8601ded405..75e428e10435 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/enrollment_account_dimensions_list_with_filter_legacy.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/enrollment_account_dimensions_list_with_filter.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-costmanagement # USAGE - python enrollment_account_dimensions_list_with_filter_legacy.py + python enrollment_account_dimensions_list_with_filter.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -35,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/EnrollmentAccountDimensionsListWithFilter.json +# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/EnrollmentAccountDimensionsListWithFilter.json if __name__ == "__main__": main() diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/enrollment_account_forecast.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/enrollment_account_forecast.py index a418aca1b8b4..078f754a5fac 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/enrollment_account_forecast.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/enrollment_account_forecast.py @@ -62,6 +62,6 @@ def main(): print(response) -# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/EnrollmentAccountForecast.json +# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/EnrollmentAccountForecast.json if __name__ == "__main__": main() diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/enrollment_account_query_legacy.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/enrollment_account_query.py similarity index 95% rename from sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/enrollment_account_query_legacy.py rename to sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/enrollment_account_query.py index a050b8d77006..b325d99749dd 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/enrollment_account_query_legacy.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/enrollment_account_query.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-costmanagement # USAGE - python enrollment_account_query_legacy.py + python enrollment_account_query.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -58,6 +58,6 @@ def main(): print(response) -# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/EnrollmentAccountQuery.json +# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/EnrollmentAccountQuery.json if __name__ == "__main__": main() diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/enrollment_account_query_grouping_legacy.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/enrollment_account_query_grouping.py similarity index 93% rename from sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/enrollment_account_query_grouping_legacy.py rename to sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/enrollment_account_query_grouping.py index 1a9a0f056274..b9a84958eff2 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/enrollment_account_query_grouping_legacy.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/enrollment_account_query_grouping.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-costmanagement # USAGE - python enrollment_account_query_grouping_legacy.py + python enrollment_account_query_grouping.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -43,6 +43,6 @@ def main(): print(response) -# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/EnrollmentAccountQueryGrouping.json +# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/EnrollmentAccountQueryGrouping.json if __name__ == "__main__": main() diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/export_create_or_update_by_billing_account.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/export_create_or_update_by_billing_account.py index 24a9fdabca78..b75d6758fa9d 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/export_create_or_update_by_billing_account.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/export_create_or_update_by_billing_account.py @@ -60,6 +60,6 @@ def main(): print(response) -# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExportCreateOrUpdateByBillingAccount.json +# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/ExportCreateOrUpdateByBillingAccount.json if __name__ == "__main__": main() diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/export_create_or_update_by_department.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/export_create_or_update_by_department.py index ae5adf8565d1..d1510460be18 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/export_create_or_update_by_department.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/export_create_or_update_by_department.py @@ -60,6 +60,6 @@ def main(): print(response) -# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExportCreateOrUpdateByDepartment.json +# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/ExportCreateOrUpdateByDepartment.json if __name__ == "__main__": main() diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/export_create_or_update_by_enrollment_account.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/export_create_or_update_by_enrollment_account.py index 259dd8f62917..500e0f769b3a 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/export_create_or_update_by_enrollment_account.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/export_create_or_update_by_enrollment_account.py @@ -60,6 +60,6 @@ def main(): print(response) -# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExportCreateOrUpdateByEnrollmentAccount.json +# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/ExportCreateOrUpdateByEnrollmentAccount.json if __name__ == "__main__": main() diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/export_create_or_update_by_management_group.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/export_create_or_update_by_management_group.py index a69690f9e8c2..6acca4a269cc 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/export_create_or_update_by_management_group.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/export_create_or_update_by_management_group.py @@ -60,6 +60,6 @@ def main(): print(response) -# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExportCreateOrUpdateByManagementGroup.json +# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/ExportCreateOrUpdateByManagementGroup.json if __name__ == "__main__": main() diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/export_create_or_update_by_resource_group.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/export_create_or_update_by_resource_group.py index c8fa59257795..20faa1432386 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/export_create_or_update_by_resource_group.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/export_create_or_update_by_resource_group.py @@ -60,6 +60,6 @@ def main(): print(response) -# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExportCreateOrUpdateByResourceGroup.json +# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/ExportCreateOrUpdateByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/export_create_or_update_by_subscription.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/export_create_or_update_by_subscription.py index 997f926419db..59e5dffd793a 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/export_create_or_update_by_subscription.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/export_create_or_update_by_subscription.py @@ -60,6 +60,6 @@ def main(): print(response) -# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExportCreateOrUpdateBySubscription.json +# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/ExportCreateOrUpdateBySubscription.json if __name__ == "__main__": main() diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/export_delete_by_billing_account.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/export_delete_by_billing_account.py index 8b8ca4c5d943..46099ca88b64 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/export_delete_by_billing_account.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/export_delete_by_billing_account.py @@ -28,13 +28,12 @@ def main(): credential=DefaultAzureCredential(), ) - response = client.exports.delete( + client.exports.delete( scope="providers/Microsoft.Billing/billingAccounts/123456", export_name="TestExport", ) - print(response) -# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExportDeleteByBillingAccount.json +# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/ExportDeleteByBillingAccount.json if __name__ == "__main__": main() diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/export_delete_by_department.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/export_delete_by_department.py index 13999bc0febc..ddc24e1d5289 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/export_delete_by_department.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/export_delete_by_department.py @@ -28,13 +28,12 @@ def main(): credential=DefaultAzureCredential(), ) - response = client.exports.delete( + client.exports.delete( scope="providers/Microsoft.Billing/billingAccounts/12/departments/1234", export_name="TestExport", ) - print(response) -# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExportDeleteByDepartment.json +# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/ExportDeleteByDepartment.json if __name__ == "__main__": main() diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/export_delete_by_enrollment_account.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/export_delete_by_enrollment_account.py index a98aa17281a1..e98c232b5961 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/export_delete_by_enrollment_account.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/export_delete_by_enrollment_account.py @@ -28,13 +28,12 @@ def main(): credential=DefaultAzureCredential(), ) - response = client.exports.delete( + client.exports.delete( scope="providers/Microsoft.Billing/billingAccounts/100/enrollmentAccounts/456", export_name="TestExport", ) - print(response) -# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExportDeleteByEnrollmentAccount.json +# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/ExportDeleteByEnrollmentAccount.json if __name__ == "__main__": main() diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/export_delete_by_management_group.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/export_delete_by_management_group.py index 44aff58c1874..1dc88f1b78b9 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/export_delete_by_management_group.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/export_delete_by_management_group.py @@ -28,13 +28,12 @@ def main(): credential=DefaultAzureCredential(), ) - response = client.exports.delete( + client.exports.delete( scope="providers/Microsoft.Management/managementGroups/TestMG", export_name="TestExport", ) - print(response) -# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExportDeleteByManagementGroup.json +# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/ExportDeleteByManagementGroup.json if __name__ == "__main__": main() diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/export_delete_by_resource_group.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/export_delete_by_resource_group.py index def28d98d213..747a7e899d52 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/export_delete_by_resource_group.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/export_delete_by_resource_group.py @@ -28,13 +28,12 @@ def main(): credential=DefaultAzureCredential(), ) - response = client.exports.delete( + client.exports.delete( scope="subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG", export_name="TestExport", ) - print(response) -# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExportDeleteByResourceGroup.json +# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/ExportDeleteByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/export_delete_by_subscription.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/export_delete_by_subscription.py index b10f8824b741..1334b12881d9 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/export_delete_by_subscription.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/export_delete_by_subscription.py @@ -28,13 +28,12 @@ def main(): credential=DefaultAzureCredential(), ) - response = client.exports.delete( + client.exports.delete( scope="subscriptions/00000000-0000-0000-0000-000000000000", export_name="TestExport", ) - print(response) -# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExportDeleteBySubscription.json +# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/ExportDeleteBySubscription.json if __name__ == "__main__": main() diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/export_get_by_billing_account.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/export_get_by_billing_account.py index 8266b9a594d2..cac5fc8be90c 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/export_get_by_billing_account.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/export_get_by_billing_account.py @@ -35,6 +35,6 @@ def main(): print(response) -# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExportGetByBillingAccount.json +# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/ExportGetByBillingAccount.json if __name__ == "__main__": main() diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/export_get_by_department.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/export_get_by_department.py index e6aa15d5361c..3b175f63bbeb 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/export_get_by_department.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/export_get_by_department.py @@ -35,6 +35,6 @@ def main(): print(response) -# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExportGetByDepartment.json +# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/ExportGetByDepartment.json if __name__ == "__main__": main() diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/export_get_by_enrollment_account.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/export_get_by_enrollment_account.py index 4960c604686d..dabd212ab749 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/export_get_by_enrollment_account.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/export_get_by_enrollment_account.py @@ -35,6 +35,6 @@ def main(): print(response) -# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExportGetByEnrollmentAccount.json +# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/ExportGetByEnrollmentAccount.json if __name__ == "__main__": main() diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/export_get_by_management_group.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/export_get_by_management_group.py index ac2e541426fc..c6bef1fe8898 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/export_get_by_management_group.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/export_get_by_management_group.py @@ -35,6 +35,6 @@ def main(): print(response) -# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExportGetByManagementGroup.json +# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/ExportGetByManagementGroup.json if __name__ == "__main__": main() diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/export_get_by_resource_group.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/export_get_by_resource_group.py index 307fb98bd806..cd1bead88fd5 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/export_get_by_resource_group.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/export_get_by_resource_group.py @@ -35,6 +35,6 @@ def main(): print(response) -# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExportGetByResourceGroup.json +# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/ExportGetByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/export_get_by_subscription.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/export_get_by_subscription.py index efbd1e8048b7..7286b6444644 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/export_get_by_subscription.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/export_get_by_subscription.py @@ -35,6 +35,6 @@ def main(): print(response) -# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExportGetBySubscription.json +# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/ExportGetBySubscription.json if __name__ == "__main__": main() diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/export_run_by_billing_account.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/export_run_by_billing_account.py index a63c606016f2..16e9679b031e 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/export_run_by_billing_account.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/export_run_by_billing_account.py @@ -28,13 +28,12 @@ def main(): credential=DefaultAzureCredential(), ) - response = client.exports.execute( + client.exports.execute( scope="providers/Microsoft.Billing/billingAccounts/123456", export_name="TestExport", ) - print(response) -# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExportRunByBillingAccount.json +# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/ExportRunByBillingAccount.json if __name__ == "__main__": main() diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/export_run_by_department.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/export_run_by_department.py index 540d70bfb5b3..8e53f817b70e 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/export_run_by_department.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/export_run_by_department.py @@ -28,13 +28,12 @@ def main(): credential=DefaultAzureCredential(), ) - response = client.exports.execute( + client.exports.execute( scope="providers/Microsoft.Billing/billingAccounts/12/departments/1234", export_name="TestExport", ) - print(response) -# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExportRunByDepartment.json +# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/ExportRunByDepartment.json if __name__ == "__main__": main() diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/export_run_by_enrollment_account.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/export_run_by_enrollment_account.py index 77a3fccda67e..9793f0bde953 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/export_run_by_enrollment_account.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/export_run_by_enrollment_account.py @@ -28,13 +28,12 @@ def main(): credential=DefaultAzureCredential(), ) - response = client.exports.execute( + client.exports.execute( scope="providers/Microsoft.Billing/billingAccounts/100/enrollmentAccounts/456", export_name="TestExport", ) - print(response) -# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExportRunByEnrollmentAccount.json +# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/ExportRunByEnrollmentAccount.json if __name__ == "__main__": main() diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/export_run_by_management_group.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/export_run_by_management_group.py index ab206641adf1..bbf681d62745 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/export_run_by_management_group.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/export_run_by_management_group.py @@ -28,13 +28,12 @@ def main(): credential=DefaultAzureCredential(), ) - response = client.exports.execute( + client.exports.execute( scope="providers/Microsoft.Management/managementGroups/TestMG", export_name="TestExport", ) - print(response) -# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExportRunByManagementGroup.json +# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/ExportRunByManagementGroup.json if __name__ == "__main__": main() diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/export_run_by_resource_group.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/export_run_by_resource_group.py index 27240ad02a34..f0c0f56ff3ec 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/export_run_by_resource_group.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/export_run_by_resource_group.py @@ -28,13 +28,12 @@ def main(): credential=DefaultAzureCredential(), ) - response = client.exports.execute( + client.exports.execute( scope="subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG", export_name="TestExport", ) - print(response) -# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExportRunByResourceGroup.json +# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/ExportRunByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/export_run_by_subscription.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/export_run_by_subscription.py index c73bc6d7f76c..f8b2130f9046 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/export_run_by_subscription.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/export_run_by_subscription.py @@ -28,13 +28,12 @@ def main(): credential=DefaultAzureCredential(), ) - response = client.exports.execute( + client.exports.execute( scope="subscriptions/00000000-0000-0000-0000-000000000000", export_name="TestExport", ) - print(response) -# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExportRunBySubscription.json +# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/ExportRunBySubscription.json if __name__ == "__main__": main() diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/export_run_history_get_by_billing_account.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/export_run_history_get_by_billing_account.py index 199740876c6b..e2733cbec994 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/export_run_history_get_by_billing_account.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/export_run_history_get_by_billing_account.py @@ -35,6 +35,6 @@ def main(): print(response) -# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExportRunHistoryGetByBillingAccount.json +# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/ExportRunHistoryGetByBillingAccount.json if __name__ == "__main__": main() diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/export_run_history_get_by_department.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/export_run_history_get_by_department.py index 380019a2e8e1..25cc48d81c6e 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/export_run_history_get_by_department.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/export_run_history_get_by_department.py @@ -35,6 +35,6 @@ def main(): print(response) -# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExportRunHistoryGetByDepartment.json +# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/ExportRunHistoryGetByDepartment.json if __name__ == "__main__": main() diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/export_run_history_get_by_enrollment_account.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/export_run_history_get_by_enrollment_account.py index 79922afbc76d..26c2880b4ff4 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/export_run_history_get_by_enrollment_account.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/export_run_history_get_by_enrollment_account.py @@ -35,6 +35,6 @@ def main(): print(response) -# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExportRunHistoryGetByEnrollmentAccount.json +# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/ExportRunHistoryGetByEnrollmentAccount.json if __name__ == "__main__": main() diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/export_run_history_get_by_management_group.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/export_run_history_get_by_management_group.py index 37d279c1cd97..332a7ca937e6 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/export_run_history_get_by_management_group.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/export_run_history_get_by_management_group.py @@ -35,6 +35,6 @@ def main(): print(response) -# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExportRunHistoryGetByManagementGroup.json +# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/ExportRunHistoryGetByManagementGroup.json if __name__ == "__main__": main() diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/export_run_history_get_by_resource_group.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/export_run_history_get_by_resource_group.py index 494201812bf2..e23d1e37fa89 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/export_run_history_get_by_resource_group.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/export_run_history_get_by_resource_group.py @@ -35,6 +35,6 @@ def main(): print(response) -# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExportRunHistoryGetByResourceGroup.json +# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/ExportRunHistoryGetByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/export_run_history_get_by_subscription.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/export_run_history_get_by_subscription.py index 4565b72e9911..fac5545dae57 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/export_run_history_get_by_subscription.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/export_run_history_get_by_subscription.py @@ -35,6 +35,6 @@ def main(): print(response) -# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExportRunHistoryGetBySubscription.json +# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/ExportRunHistoryGetBySubscription.json if __name__ == "__main__": main() diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/exports_get_by_billing_account.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/exports_get_by_billing_account.py index 6562d9dddf91..b99c2f624a17 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/exports_get_by_billing_account.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/exports_get_by_billing_account.py @@ -34,6 +34,6 @@ def main(): print(response) -# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExportsGetByBillingAccount.json +# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/ExportsGetByBillingAccount.json if __name__ == "__main__": main() diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/exports_get_by_department.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/exports_get_by_department.py index e5f7c4444277..ee8af6e07f9c 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/exports_get_by_department.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/exports_get_by_department.py @@ -34,6 +34,6 @@ def main(): print(response) -# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExportsGetByDepartment.json +# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/ExportsGetByDepartment.json if __name__ == "__main__": main() diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/exports_get_by_enrollment_account.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/exports_get_by_enrollment_account.py index de0b8d7490a8..9b3af8af0fa0 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/exports_get_by_enrollment_account.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/exports_get_by_enrollment_account.py @@ -34,6 +34,6 @@ def main(): print(response) -# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExportsGetByEnrollmentAccount.json +# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/ExportsGetByEnrollmentAccount.json if __name__ == "__main__": main() diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/exports_get_by_management_group.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/exports_get_by_management_group.py index 8b78725d765d..3521df5887ca 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/exports_get_by_management_group.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/exports_get_by_management_group.py @@ -34,6 +34,6 @@ def main(): print(response) -# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExportsGetByManagementGroup.json +# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/ExportsGetByManagementGroup.json if __name__ == "__main__": main() diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/exports_get_by_resource_group.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/exports_get_by_resource_group.py index b9662dd0ff45..2d62864615c3 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/exports_get_by_resource_group.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/exports_get_by_resource_group.py @@ -34,6 +34,6 @@ def main(): print(response) -# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExportsGetByResourceGroup.json +# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/ExportsGetByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/exports_get_by_subscription.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/exports_get_by_subscription.py index 37fcdbd45b49..9e651317e231 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/exports_get_by_subscription.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/exports_get_by_subscription.py @@ -34,6 +34,6 @@ def main(): print(response) -# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExportsGetBySubscription.json +# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/ExportsGetBySubscription.json if __name__ == "__main__": main() diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/external_billing_account_alerts.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/external_billing_account_alerts.py index 779eb2320f80..b50b43c9ea82 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/external_billing_account_alerts.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/external_billing_account_alerts.py @@ -35,6 +35,6 @@ def main(): print(response) -# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExternalBillingAccountAlerts.json +# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/ExternalBillingAccountAlerts.json if __name__ == "__main__": main() diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/external_billing_account_forecast.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/external_billing_account_forecast.py index dc1bb420b118..0b27be130ce5 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/external_billing_account_forecast.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/external_billing_account_forecast.py @@ -61,6 +61,6 @@ def main(): print(response) -# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExternalBillingAccountForecast.json +# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/ExternalBillingAccountForecast.json if __name__ == "__main__": main() diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/external_billing_account_dimension_list.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/external_billing_accounts_dimensions.py similarity index 92% rename from sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/external_billing_account_dimension_list.py rename to sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/external_billing_accounts_dimensions.py index cfd8376e447b..061c7348389e 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/external_billing_account_dimension_list.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/external_billing_accounts_dimensions.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-costmanagement # USAGE - python external_billing_account_dimension_list.py + python external_billing_accounts_dimensions.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExternalBillingAccountsDimensions.json +# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/ExternalBillingAccountsDimensions.json if __name__ == "__main__": main() diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/external_billing_account_query_list.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/external_billing_accounts_query.py similarity index 95% rename from sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/external_billing_account_query_list.py rename to sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/external_billing_accounts_query.py index dd9b1d56b757..29dd700f3f80 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/external_billing_account_query_list.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/external_billing_accounts_query.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-costmanagement # USAGE - python external_billing_account_query_list.py + python external_billing_accounts_query.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -59,6 +59,6 @@ def main(): print(response) -# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExternalBillingAccountsQuery.json +# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/ExternalBillingAccountsQuery.json if __name__ == "__main__": main() diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/external_subscription_alerts.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/external_subscription_alerts.py index 24103f6c6562..2201ef9143fc 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/external_subscription_alerts.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/external_subscription_alerts.py @@ -35,6 +35,6 @@ def main(): print(response) -# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExternalSubscriptionAlerts.json +# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/ExternalSubscriptionAlerts.json if __name__ == "__main__": main() diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/external_subscription_forecast.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/external_subscription_forecast.py index 39a6ed464e0f..37d12b4b22e8 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/external_subscription_forecast.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/external_subscription_forecast.py @@ -61,6 +61,6 @@ def main(): print(response) -# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExternalSubscriptionForecast.json +# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/ExternalSubscriptionForecast.json if __name__ == "__main__": main() diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/external_subscription_dimension_list.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/external_subscriptions_dimensions.py similarity index 92% rename from sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/external_subscription_dimension_list.py rename to sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/external_subscriptions_dimensions.py index 82f50d54bc88..06f57ca86628 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/external_subscription_dimension_list.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/external_subscriptions_dimensions.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-costmanagement # USAGE - python external_subscription_dimension_list.py + python external_subscriptions_dimensions.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExternalSubscriptionsDimensions.json +# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/ExternalSubscriptionsDimensions.json if __name__ == "__main__": main() diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/external_subscriptions_query.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/external_subscriptions_query.py index 5879a5230481..9d878cea1834 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/external_subscriptions_query.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/external_subscriptions_query.py @@ -59,6 +59,6 @@ def main(): print(response) -# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ExternalSubscriptionsQuery.json +# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/ExternalSubscriptionsQuery.json if __name__ == "__main__": main() diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/generate_cost_details_report_by_billing_account_enterprise_agreement_customer_and_billing_period.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/generate_cost_details_report_by_billing_account_enterprise_agreement_customer_and_billing_period.py index 8fc7ecb2911b..c8525df20396 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/generate_cost_details_report_by_billing_account_enterprise_agreement_customer_and_billing_period.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/generate_cost_details_report_by_billing_account_enterprise_agreement_customer_and_billing_period.py @@ -35,6 +35,6 @@ def main(): print(response) -# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/GenerateCostDetailsReportByBillingAccountEnterpriseAgreementCustomerAndBillingPeriod.json +# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/GenerateCostDetailsReportByBillingAccountEnterpriseAgreementCustomerAndBillingPeriod.json if __name__ == "__main__": main() diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/generate_cost_details_report_by_billing_profile_and_invoice_id.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/generate_cost_details_report_by_billing_profile_and_invoice_id.py index 3cc8d1ae18e2..09f8c734ad24 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/generate_cost_details_report_by_billing_profile_and_invoice_id.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/generate_cost_details_report_by_billing_profile_and_invoice_id.py @@ -35,6 +35,6 @@ def main(): print(response) -# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/GenerateCostDetailsReportByBillingProfileAndInvoiceId.json +# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/GenerateCostDetailsReportByBillingProfileAndInvoiceId.json if __name__ == "__main__": main() diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/generate_cost_details_report_by_billing_profile_and_invoice_id_and_customer_id.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/generate_cost_details_report_by_billing_profile_and_invoice_id_and_customer_id.py index 7e38e26e351f..4df9544894df 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/generate_cost_details_report_by_billing_profile_and_invoice_id_and_customer_id.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/generate_cost_details_report_by_billing_profile_and_invoice_id_and_customer_id.py @@ -35,6 +35,6 @@ def main(): print(response) -# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/GenerateCostDetailsReportByBillingProfileAndInvoiceIdAndCustomerId.json +# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/GenerateCostDetailsReportByBillingProfileAndInvoiceIdAndCustomerId.json if __name__ == "__main__": main() diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/generate_cost_details_report_by_customer_and_time_period.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/generate_cost_details_report_by_customer_and_time_period.py index 1d9fb4013da7..8161dc3ae481 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/generate_cost_details_report_by_customer_and_time_period.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/generate_cost_details_report_by_customer_and_time_period.py @@ -35,6 +35,6 @@ def main(): print(response) -# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/GenerateCostDetailsReportByCustomerAndTimePeriod.json +# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/GenerateCostDetailsReportByCustomerAndTimePeriod.json if __name__ == "__main__": main() diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/generate_cost_details_report_by_departments_and_time_period.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/generate_cost_details_report_by_departments_and_time_period.py index b7fd59c2d6f0..482b880ba1fb 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/generate_cost_details_report_by_departments_and_time_period.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/generate_cost_details_report_by_departments_and_time_period.py @@ -35,6 +35,6 @@ def main(): print(response) -# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/GenerateCostDetailsReportByDepartmentsAndTimePeriod.json +# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/GenerateCostDetailsReportByDepartmentsAndTimePeriod.json if __name__ == "__main__": main() diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/generate_cost_details_report_by_enrollment_accounts_and_time_period.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/generate_cost_details_report_by_enrollment_accounts_and_time_period.py index 05857cda0b19..8b0ddbaba0a0 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/generate_cost_details_report_by_enrollment_accounts_and_time_period.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/generate_cost_details_report_by_enrollment_accounts_and_time_period.py @@ -35,6 +35,6 @@ def main(): print(response) -# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/GenerateCostDetailsReportByEnrollmentAccountsAndTimePeriod.json +# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/GenerateCostDetailsReportByEnrollmentAccountsAndTimePeriod.json if __name__ == "__main__": main() diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/generate_cost_details_report_by_subscription_and_time_period.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/generate_cost_details_report_by_subscription_and_time_period.py index fa959fac4317..eea578a54383 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/generate_cost_details_report_by_subscription_and_time_period.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/generate_cost_details_report_by_subscription_and_time_period.py @@ -35,6 +35,6 @@ def main(): print(response) -# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/GenerateCostDetailsReportBySubscriptionAndTimePeriod.json +# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/GenerateCostDetailsReportBySubscriptionAndTimePeriod.json if __name__ == "__main__": main() diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/generate_detailed_cost_report_by_billing_account_legacy_and_billing_period.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/generate_detailed_cost_report_by_billing_account_legacy_and_billing_period.py index 6c9aba183fb6..c2c0493910d9 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/generate_detailed_cost_report_by_billing_account_legacy_and_billing_period.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/generate_detailed_cost_report_by_billing_account_legacy_and_billing_period.py @@ -35,6 +35,6 @@ def main(): print(response) -# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/GenerateDetailedCostReportByBillingAccountLegacyAndBillingPeriod.json +# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/GenerateDetailedCostReportByBillingAccountLegacyAndBillingPeriod.json if __name__ == "__main__": main() diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/generate_detailed_cost_report_by_billing_profile_and_invoice_id.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/generate_detailed_cost_report_by_billing_profile_and_invoice_id.py index 171adc5bea17..98c56909c630 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/generate_detailed_cost_report_by_billing_profile_and_invoice_id.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/generate_detailed_cost_report_by_billing_profile_and_invoice_id.py @@ -35,6 +35,6 @@ def main(): print(response) -# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/GenerateDetailedCostReportByBillingProfileAndInvoiceId.json +# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/GenerateDetailedCostReportByBillingProfileAndInvoiceId.json if __name__ == "__main__": main() diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/generate_detailed_cost_report_by_billing_profile_and_invoice_id_and_customer_id.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/generate_detailed_cost_report_by_billing_profile_and_invoice_id_and_customer_id.py index 66e8751344e3..0ab930da8295 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/generate_detailed_cost_report_by_billing_profile_and_invoice_id_and_customer_id.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/generate_detailed_cost_report_by_billing_profile_and_invoice_id_and_customer_id.py @@ -35,6 +35,6 @@ def main(): print(response) -# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/GenerateDetailedCostReportByBillingProfileAndInvoiceIdAndCustomerId.json +# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/GenerateDetailedCostReportByBillingProfileAndInvoiceIdAndCustomerId.json if __name__ == "__main__": main() diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/generate_detailed_cost_report_by_customer_and_time_period.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/generate_detailed_cost_report_by_customer_and_time_period.py index 6b4c1c570c67..5f039f7f7268 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/generate_detailed_cost_report_by_customer_and_time_period.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/generate_detailed_cost_report_by_customer_and_time_period.py @@ -35,6 +35,6 @@ def main(): print(response) -# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/GenerateDetailedCostReportByCustomerAndTimePeriod.json +# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/GenerateDetailedCostReportByCustomerAndTimePeriod.json if __name__ == "__main__": main() diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/generate_detailed_cost_report_by_subscription_and_time_period.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/generate_detailed_cost_report_by_subscription_and_time_period.py index 002c901d4c44..efe671880f50 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/generate_detailed_cost_report_by_subscription_and_time_period.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/generate_detailed_cost_report_by_subscription_and_time_period.py @@ -35,6 +35,6 @@ def main(): print(response) -# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/GenerateDetailedCostReportBySubscriptionAndTimePeriod.json +# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/GenerateDetailedCostReportBySubscriptionAndTimePeriod.json if __name__ == "__main__": main() diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/generate_detailed_cost_report_operation_results_by_subscription_scope.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/generate_detailed_cost_report_operation_results_by_subscription_scope.py new file mode 100644 index 000000000000..b6f3e5ddd79d --- /dev/null +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/generate_detailed_cost_report_operation_results_by_subscription_scope.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.costmanagement import CostManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-costmanagement +# USAGE + python generate_detailed_cost_report_operation_results_by_subscription_scope.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CostManagementClient( + credential=DefaultAzureCredential(), + ) + + response = client.generate_detailed_cost_report_operation_results.begin_get( + operation_id="00000000-0000-0000-0000-000000000000", + scope="subscriptions/00000000-0000-0000-0000-000000000000", + ).result() + print(response) + + +# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/GenerateDetailedCostReportOperationResultsBySubscriptionScope.json +if __name__ == "__main__": + main() diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/get_details_of_the_operation_status.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/generate_detailed_cost_report_operation_status_by_subscription_scope.py similarity index 91% rename from sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/get_details_of_the_operation_status.py rename to sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/generate_detailed_cost_report_operation_status_by_subscription_scope.py index 34a7e2786535..d7323dd22724 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/get_details_of_the_operation_status.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/generate_detailed_cost_report_operation_status_by_subscription_scope.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-costmanagement # USAGE - python get_details_of_the_operation_status.py + python generate_detailed_cost_report_operation_status_by_subscription_scope.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -35,6 +35,6 @@ def main(): print(response) -# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/GenerateDetailedCostReportOperationStatusBySubscriptionScope.json +# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/GenerateDetailedCostReportOperationStatusBySubscriptionScope.json if __name__ == "__main__": main() diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/reservation_details.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/generate_reservation_details_report_by_billing_account.py similarity index 91% rename from sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/reservation_details.py rename to sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/generate_reservation_details_report_by_billing_account.py index 8fe21d7aa2b8..1c6a66f96924 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/reservation_details.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/generate_reservation_details_report_by_billing_account.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-costmanagement # USAGE - python reservation_details.py + python generate_reservation_details_report_by_billing_account.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/GenerateReservationDetailsReportByBillingAccount.json +# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/GenerateReservationDetailsReportByBillingAccount.json if __name__ == "__main__": main() diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/generate_reservation_details_report_by_billing_profile.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/generate_reservation_details_report_by_billing_profile.py new file mode 100644 index 000000000000..0a317aef5965 --- /dev/null +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/generate_reservation_details_report_by_billing_profile.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.costmanagement import CostManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-costmanagement +# USAGE + python generate_reservation_details_report_by_billing_profile.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CostManagementClient( + credential=DefaultAzureCredential(), + ) + + response = client.generate_reservation_details_report.begin_by_billing_profile_id( + billing_account_id="00000000-0000-0000-0000-000000000000", + billing_profile_id="CZSFR-SDFXC-DSDF", + start_date="2020-01-01", + end_date="2020-01-30", + ).result() + print(response) + + +# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/GenerateReservationDetailsReportByBillingProfile.json +if __name__ == "__main__": + main() diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/invoice_section_alerts.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/invoice_section_alerts.py index 24be92520b5e..68adab436ae5 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/invoice_section_alerts.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/invoice_section_alerts.py @@ -34,6 +34,6 @@ def main(): print(response) -# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/InvoiceSectionAlerts.json +# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/InvoiceSectionAlerts.json if __name__ == "__main__": main() diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/invoice_section_forecast.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/invoice_section_forecast.py index 5ca0635445f2..e6b0508c4123 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/invoice_section_forecast.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/invoice_section_forecast.py @@ -62,6 +62,6 @@ def main(): print(response) -# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/InvoiceSectionForecast.json +# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/InvoiceSectionForecast.json if __name__ == "__main__": main() diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/management_group_dimensions_list_legacy.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/management_group_dimensions_list.py similarity index 92% rename from sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/management_group_dimensions_list_legacy.py rename to sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/management_group_dimensions_list.py index df07d8a00487..fd7cb4badc40 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/management_group_dimensions_list_legacy.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/management_group_dimensions_list.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-costmanagement # USAGE - python management_group_dimensions_list_legacy.py + python management_group_dimensions_list.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -35,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ManagementGroupDimensionsList.json +# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/ManagementGroupDimensionsList.json if __name__ == "__main__": main() diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/management_group_dimensions_list_expand_and_top_legacy.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/management_group_dimensions_list_expand_and_top.py similarity index 91% rename from sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/management_group_dimensions_list_expand_and_top_legacy.py rename to sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/management_group_dimensions_list_expand_and_top.py index 63ffe448c71a..4b2f3e1d6de5 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/management_group_dimensions_list_expand_and_top_legacy.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/management_group_dimensions_list_expand_and_top.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-costmanagement # USAGE - python management_group_dimensions_list_expand_and_top_legacy.py + python management_group_dimensions_list_expand_and_top.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -35,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ManagementGroupDimensionsListExpandAndTop.json +# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/ManagementGroupDimensionsListExpandAndTop.json if __name__ == "__main__": main() diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/management_group_dimensions_list_with_filter_legacy.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/management_group_dimensions_list_with_filter.py similarity index 91% rename from sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/management_group_dimensions_list_with_filter_legacy.py rename to sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/management_group_dimensions_list_with_filter.py index 1ce215fa7568..60b627a03fa3 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/management_group_dimensions_list_with_filter_legacy.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/management_group_dimensions_list_with_filter.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-costmanagement # USAGE - python management_group_dimensions_list_with_filter_legacy.py + python management_group_dimensions_list_with_filter.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -35,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ManagementGroupDimensionsListWithFilter.json +# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/ManagementGroupDimensionsListWithFilter.json if __name__ == "__main__": main() diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/management_group_query_legacy.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/management_group_query.py similarity index 95% rename from sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/management_group_query_legacy.py rename to sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/management_group_query.py index 28fc66ee84cb..f78b04d800fb 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/management_group_query_legacy.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/management_group_query.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-costmanagement # USAGE - python management_group_query_legacy.py + python management_group_query.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -58,6 +58,6 @@ def main(): print(response) -# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ManagementGroupQuery.json +# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/ManagementGroupQuery.json if __name__ == "__main__": main() diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/management_group_query_grouping_legacy.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/management_group_query_grouping.py similarity index 93% rename from sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/management_group_query_grouping_legacy.py rename to sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/management_group_query_grouping.py index c2d9318c5f2a..1a5a3c0a140d 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/management_group_query_grouping_legacy.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/management_group_query_grouping.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-costmanagement # USAGE - python management_group_query_grouping_legacy.py + python management_group_query_grouping.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -43,6 +43,6 @@ def main(): print(response) -# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ManagementGroupQueryGrouping.json +# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/ManagementGroupQueryGrouping.json if __name__ == "__main__": main() diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/billing_account_dimensions_list_mca.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/mca_billing_account_dimensions_list.py similarity index 92% rename from sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/billing_account_dimensions_list_mca.py rename to sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/mca_billing_account_dimensions_list.py index 4a909d49f2c4..136aed7ae054 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/billing_account_dimensions_list_mca.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/mca_billing_account_dimensions_list.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-costmanagement # USAGE - python billing_account_dimensions_list_mca.py + python mca_billing_account_dimensions_list.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -35,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/MCABillingAccountDimensionsList.json +# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/MCABillingAccountDimensionsList.json if __name__ == "__main__": main() diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/billing_account_dimensions_list_expand_and_top_mca.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/mca_billing_account_dimensions_list_expand_and_top.py similarity index 91% rename from sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/billing_account_dimensions_list_expand_and_top_mca.py rename to sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/mca_billing_account_dimensions_list_expand_and_top.py index b36c0023b616..b96c195ccdd2 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/billing_account_dimensions_list_expand_and_top_mca.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/mca_billing_account_dimensions_list_expand_and_top.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-costmanagement # USAGE - python billing_account_dimensions_list_expand_and_top_mca.py + python mca_billing_account_dimensions_list_expand_and_top.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -35,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/MCABillingAccountDimensionsListExpandAndTop.json +# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/MCABillingAccountDimensionsListExpandAndTop.json if __name__ == "__main__": main() diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/billing_account_dimensions_list_with_filter_mca.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/mca_billing_account_dimensions_list_with_filter.py similarity index 92% rename from sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/billing_account_dimensions_list_with_filter_mca.py rename to sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/mca_billing_account_dimensions_list_with_filter.py index 18aa8a51e66e..71e10a3fa01a 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/billing_account_dimensions_list_with_filter_mca.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/mca_billing_account_dimensions_list_with_filter.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-costmanagement # USAGE - python billing_account_dimensions_list_with_filter_mca.py + python mca_billing_account_dimensions_list_with_filter.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -35,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/MCABillingAccountDimensionsListWithFilter.json +# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/MCABillingAccountDimensionsListWithFilter.json if __name__ == "__main__": main() diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/billing_account_query_mca.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/mca_billing_account_query.py similarity index 95% rename from sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/billing_account_query_mca.py rename to sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/mca_billing_account_query.py index 0906ec936fdf..e7ce1abb0c2e 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/billing_account_query_mca.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/mca_billing_account_query.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-costmanagement # USAGE - python billing_account_query_mca.py + python mca_billing_account_query.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -58,6 +58,6 @@ def main(): print(response) -# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/MCABillingAccountQuery.json +# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/MCABillingAccountQuery.json if __name__ == "__main__": main() diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/billing_account_query_grouping_mca.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/mca_billing_account_query_grouping.py similarity index 93% rename from sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/billing_account_query_grouping_mca.py rename to sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/mca_billing_account_query_grouping.py index bf0c9c6ebcdc..5a26817a0a4a 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/billing_account_query_grouping_mca.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/mca_billing_account_query_grouping.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-costmanagement # USAGE - python billing_account_query_grouping_mca.py + python mca_billing_account_query_grouping.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -43,6 +43,6 @@ def main(): print(response) -# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/MCABillingAccountQueryGrouping.json +# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/MCABillingAccountQueryGrouping.json if __name__ == "__main__": main() diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/billing_profile_dimensions_list_mca.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/mca_billing_profile_dimensions_list.py similarity index 92% rename from sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/billing_profile_dimensions_list_mca.py rename to sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/mca_billing_profile_dimensions_list.py index b4551d052232..25540effe100 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/billing_profile_dimensions_list_mca.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/mca_billing_profile_dimensions_list.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-costmanagement # USAGE - python billing_profile_dimensions_list_mca.py + python mca_billing_profile_dimensions_list.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -35,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/MCABillingProfileDimensionsList.json +# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/MCABillingProfileDimensionsList.json if __name__ == "__main__": main() diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/billing_profile_dimensions_list_expand_and_top_mca.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/mca_billing_profile_dimensions_list_expand_and_top.py similarity index 92% rename from sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/billing_profile_dimensions_list_expand_and_top_mca.py rename to sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/mca_billing_profile_dimensions_list_expand_and_top.py index e28d1ab0f174..4d5fcb37d570 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/billing_profile_dimensions_list_expand_and_top_mca.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/mca_billing_profile_dimensions_list_expand_and_top.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-costmanagement # USAGE - python billing_profile_dimensions_list_expand_and_top_mca.py + python mca_billing_profile_dimensions_list_expand_and_top.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -35,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/MCABillingProfileDimensionsListExpandAndTop.json +# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/MCABillingProfileDimensionsListExpandAndTop.json if __name__ == "__main__": main() diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/billing_profile_dimensions_list_with_filter_mca.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/mca_billing_profile_dimensions_list_with_filter.py similarity index 92% rename from sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/billing_profile_dimensions_list_with_filter_mca.py rename to sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/mca_billing_profile_dimensions_list_with_filter.py index 26cf5ef67fa2..00ff06ad5cb3 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/billing_profile_dimensions_list_with_filter_mca.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/mca_billing_profile_dimensions_list_with_filter.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-costmanagement # USAGE - python billing_profile_dimensions_list_with_filter_mca.py + python mca_billing_profile_dimensions_list_with_filter.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -35,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/MCABillingProfileDimensionsListWithFilter.json +# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/MCABillingProfileDimensionsListWithFilter.json if __name__ == "__main__": main() diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/billing_profile_query_mca.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/mca_billing_profile_query.py similarity index 95% rename from sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/billing_profile_query_mca.py rename to sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/mca_billing_profile_query.py index 57d7ec2310fa..068972e2b4ab 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/billing_profile_query_mca.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/mca_billing_profile_query.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-costmanagement # USAGE - python billing_profile_query_mca.py + python mca_billing_profile_query.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -58,6 +58,6 @@ def main(): print(response) -# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/MCABillingProfileQuery.json +# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/MCABillingProfileQuery.json if __name__ == "__main__": main() diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/billing_profile_query_grouping_mca.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/mca_billing_profile_query_grouping.py similarity index 94% rename from sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/billing_profile_query_grouping_mca.py rename to sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/mca_billing_profile_query_grouping.py index 82459da672fb..8e8b2ca4493b 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/billing_profile_query_grouping_mca.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/mca_billing_profile_query_grouping.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-costmanagement # USAGE - python billing_profile_query_grouping_mca.py + python mca_billing_profile_query_grouping.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -43,6 +43,6 @@ def main(): print(response) -# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/MCABillingProfileQueryGrouping.json +# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/MCABillingProfileQueryGrouping.json if __name__ == "__main__": main() diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/customer_dimensions_list_mca.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/mca_customer_dimensions_list.py similarity index 93% rename from sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/customer_dimensions_list_mca.py rename to sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/mca_customer_dimensions_list.py index 473ceb5317fe..b6cdb3fd2c44 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/customer_dimensions_list_mca.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/mca_customer_dimensions_list.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-costmanagement # USAGE - python customer_dimensions_list_mca.py + python mca_customer_dimensions_list.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -35,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/MCACustomerDimensionsList.json +# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/MCACustomerDimensionsList.json if __name__ == "__main__": main() diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/customer_dimensions_list_expand_and_top_mca.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/mca_customer_dimensions_list_expand_and_top.py similarity index 92% rename from sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/customer_dimensions_list_expand_and_top_mca.py rename to sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/mca_customer_dimensions_list_expand_and_top.py index 0b9df1f03006..988f17349d73 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/customer_dimensions_list_expand_and_top_mca.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/mca_customer_dimensions_list_expand_and_top.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-costmanagement # USAGE - python customer_dimensions_list_expand_and_top_mca.py + python mca_customer_dimensions_list_expand_and_top.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -35,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/MCACustomerDimensionsListExpandAndTop.json +# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/MCACustomerDimensionsListExpandAndTop.json if __name__ == "__main__": main() diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/customer_dimensions_list_with_filter_mca.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/mca_customer_dimensions_list_with_filter.py similarity index 92% rename from sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/customer_dimensions_list_with_filter_mca.py rename to sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/mca_customer_dimensions_list_with_filter.py index a3904170e9fa..23edcc84e697 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/customer_dimensions_list_with_filter_mca.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/mca_customer_dimensions_list_with_filter.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-costmanagement # USAGE - python customer_dimensions_list_with_filter_mca.py + python mca_customer_dimensions_list_with_filter.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -35,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/MCACustomerDimensionsListWithFilter.json +# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/MCACustomerDimensionsListWithFilter.json if __name__ == "__main__": main() diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/customer_query_mca.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/mca_customer_query.py similarity index 96% rename from sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/customer_query_mca.py rename to sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/mca_customer_query.py index d747fd1fd25b..7bc674f87b73 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/customer_query_mca.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/mca_customer_query.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-costmanagement # USAGE - python customer_query_mca.py + python mca_customer_query.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -58,6 +58,6 @@ def main(): print(response) -# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/MCACustomerQuery.json +# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/MCACustomerQuery.json if __name__ == "__main__": main() diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/customer_query_grouping_mca.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/mca_customer_query_grouping.py similarity index 94% rename from sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/customer_query_grouping_mca.py rename to sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/mca_customer_query_grouping.py index 370c57b3598f..8625e6ce4e86 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/customer_query_grouping_mca.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/mca_customer_query_grouping.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-costmanagement # USAGE - python customer_query_grouping_mca.py + python mca_customer_query_grouping.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -43,6 +43,6 @@ def main(): print(response) -# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/MCACustomerQueryGrouping.json +# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/MCACustomerQueryGrouping.json if __name__ == "__main__": main() diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/invoice_section_dimensions_list_mca.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/mca_invoice_section_dimensions_list.py similarity index 92% rename from sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/invoice_section_dimensions_list_mca.py rename to sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/mca_invoice_section_dimensions_list.py index c4a07725f82c..57f155d3de04 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/invoice_section_dimensions_list_mca.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/mca_invoice_section_dimensions_list.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-costmanagement # USAGE - python invoice_section_dimensions_list_mca.py + python mca_invoice_section_dimensions_list.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -35,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/MCAInvoiceSectionDimensionsList.json +# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/MCAInvoiceSectionDimensionsList.json if __name__ == "__main__": main() diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/invoice_section_dimensions_list_expand_and_top_mca.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/mca_invoice_section_dimensions_list_expand_and_top.py similarity index 92% rename from sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/invoice_section_dimensions_list_expand_and_top_mca.py rename to sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/mca_invoice_section_dimensions_list_expand_and_top.py index e05d46b14db1..93014b3ed58c 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/invoice_section_dimensions_list_expand_and_top_mca.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/mca_invoice_section_dimensions_list_expand_and_top.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-costmanagement # USAGE - python invoice_section_dimensions_list_expand_and_top_mca.py + python mca_invoice_section_dimensions_list_expand_and_top.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -35,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/MCAInvoiceSectionDimensionsListExpandAndTop.json +# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/MCAInvoiceSectionDimensionsListExpandAndTop.json if __name__ == "__main__": main() diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/invoice_section_dimensions_list_with_filter_mca.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/mca_invoice_section_dimensions_list_with_filter.py similarity index 92% rename from sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/invoice_section_dimensions_list_with_filter_mca.py rename to sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/mca_invoice_section_dimensions_list_with_filter.py index 4b31258e0748..1e2835ada154 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/invoice_section_dimensions_list_with_filter_mca.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/mca_invoice_section_dimensions_list_with_filter.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-costmanagement # USAGE - python invoice_section_dimensions_list_with_filter_mca.py + python mca_invoice_section_dimensions_list_with_filter.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -35,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/MCAInvoiceSectionDimensionsListWithFilter.json +# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/MCAInvoiceSectionDimensionsListWithFilter.json if __name__ == "__main__": main() diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/invoice_section_query_mca.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/mca_invoice_section_query.py similarity index 95% rename from sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/invoice_section_query_mca.py rename to sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/mca_invoice_section_query.py index 2806276c3bc4..e69ba9978d1e 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/invoice_section_query_mca.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/mca_invoice_section_query.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-costmanagement # USAGE - python invoice_section_query_mca.py + python mca_invoice_section_query.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -58,6 +58,6 @@ def main(): print(response) -# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/MCAInvoiceSectionQuery.json +# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/MCAInvoiceSectionQuery.json if __name__ == "__main__": main() diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/invoice_section_query_grouping_mca.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/mca_invoice_section_query_grouping.py similarity index 94% rename from sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/invoice_section_query_grouping_mca.py rename to sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/mca_invoice_section_query_grouping.py index 3a2c41c46e53..d02cf3342425 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/invoice_section_query_grouping_mca.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/mca_invoice_section_query_grouping.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-costmanagement # USAGE - python invoice_section_query_grouping_mca.py + python mca_invoice_section_query_grouping.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -43,6 +43,6 @@ def main(): print(response) -# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/MCAInvoiceSectionQueryGrouping.json +# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/MCAInvoiceSectionQueryGrouping.json if __name__ == "__main__": main() diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/operation_list.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/operation_list.py index 6c325487a5b9..addf578b8972 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/operation_list.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/operation_list.py @@ -33,6 +33,6 @@ def main(): print(item) -# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/OperationList.json +# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/OperationList.json if __name__ == "__main__": main() diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/pricesheet_download.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/pricesheet_download.py index 2450cd629150..0a7fcd1da870 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/pricesheet_download.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/pricesheet_download.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/PricesheetDownload.json +# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/PricesheetDownload.json if __name__ == "__main__": main() diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/pricesheet_download_by_billing_profile.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/pricesheet_download_by_billing_profile.py index e6a64be2fa83..79b40190de3a 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/pricesheet_download_by_billing_profile.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/pricesheet_download_by_billing_profile.py @@ -35,6 +35,6 @@ def main(): print(response) -# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/PricesheetDownloadByBillingProfile.json +# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/PricesheetDownloadByBillingProfile.json if __name__ == "__main__": main() diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/private_view.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/private_view.py index 506133cc0ef2..f41cc16af71c 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/private_view.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/private_view.py @@ -34,6 +34,6 @@ def main(): print(response) -# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/PrivateView.json +# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/PrivateView.json if __name__ == "__main__": main() diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/create_or_update_private_view.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/private_view_create_or_update.py similarity index 96% rename from sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/create_or_update_private_view.py rename to sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/private_view_create_or_update.py index e09871ae27bc..4d451c409f01 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/create_or_update_private_view.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/private_view_create_or_update.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-costmanagement # USAGE - python create_or_update_private_view.py + python private_view_create_or_update.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -66,6 +66,6 @@ def main(): print(response) -# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/PrivateViewCreateOrUpdate.json +# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/PrivateViewCreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/delete_private_view.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/private_view_delete.py similarity index 89% rename from sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/delete_private_view.py rename to sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/private_view_delete.py index e350deadd5e2..46e985b79b58 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/delete_private_view.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/private_view_delete.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-costmanagement # USAGE - python delete_private_view.py + python private_view_delete.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -28,12 +28,11 @@ def main(): credential=DefaultAzureCredential(), ) - response = client.views.delete( + client.views.delete( view_name="TestView", ) - print(response) -# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/PrivateViewDelete.json +# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/PrivateViewDelete.json if __name__ == "__main__": main() diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/private_view_list.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/private_view_list.py index ff5ce767ac30..df70f36bbcf7 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/private_view_list.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/private_view_list.py @@ -33,6 +33,6 @@ def main(): print(item) -# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/PrivateViewList.json +# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/PrivateViewList.json if __name__ == "__main__": main() diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/resource_group_alerts.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/resource_group_alerts.py index 4d2c8998f9a0..33a40cd97bac 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/resource_group_alerts.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/resource_group_alerts.py @@ -34,6 +34,6 @@ def main(): print(response) -# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ResourceGroupAlerts.json +# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/ResourceGroupAlerts.json if __name__ == "__main__": main() diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/resource_group_dimensions_list_legacy.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/resource_group_dimensions_list.py similarity index 92% rename from sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/resource_group_dimensions_list_legacy.py rename to sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/resource_group_dimensions_list.py index 0751066e2ecd..edd578993f84 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/resource_group_dimensions_list_legacy.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/resource_group_dimensions_list.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-costmanagement # USAGE - python resource_group_dimensions_list_legacy.py + python resource_group_dimensions_list.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -35,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ResourceGroupDimensionsList.json +# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/ResourceGroupDimensionsList.json if __name__ == "__main__": main() diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/resource_group_forecast.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/resource_group_forecast.py index 4c7ea0276418..0ac28e7372d3 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/resource_group_forecast.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/resource_group_forecast.py @@ -62,6 +62,6 @@ def main(): print(response) -# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ResourceGroupForecast.json +# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/ResourceGroupForecast.json if __name__ == "__main__": main() diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/resource_group_query_legacy.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/resource_group_query.py similarity index 95% rename from sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/resource_group_query_legacy.py rename to sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/resource_group_query.py index 720819019ae1..bcbff4a926e7 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/resource_group_query_legacy.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/resource_group_query.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-costmanagement # USAGE - python resource_group_query_legacy.py + python resource_group_query.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -58,6 +58,6 @@ def main(): print(response) -# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ResourceGroupQuery.json +# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/ResourceGroupQuery.json if __name__ == "__main__": main() diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/resource_group_query_grouping_legacy.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/resource_group_query_grouping.py similarity index 93% rename from sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/resource_group_query_grouping_legacy.py rename to sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/resource_group_query_grouping.py index dccb30a3b80b..ece871e7c4f6 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/resource_group_query_grouping_legacy.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/resource_group_query_grouping.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-costmanagement # USAGE - python resource_group_query_grouping_legacy.py + python resource_group_query_grouping.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -43,6 +43,6 @@ def main(): print(response) -# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ResourceGroupQueryGrouping.json +# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/ResourceGroupQueryGrouping.json if __name__ == "__main__": main() diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/scheduled_action_check_name_availability.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/scheduled_actions/check_name_availabilityprivatescheduled_action.py similarity index 92% rename from sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/scheduled_action_check_name_availability.py rename to sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/scheduled_actions/check_name_availabilityprivatescheduled_action.py index 8b9234d05831..871d05f94412 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/scheduled_action_check_name_availability.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/scheduled_actions/check_name_availabilityprivatescheduled_action.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-costmanagement # USAGE - python scheduled_action_check_name_availability.py + python check_name_availabilityprivatescheduled_action.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -34,6 +34,6 @@ def main(): print(response) -# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/scheduledActions/checkNameAvailability-private-scheduledAction.json +# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/scheduledActions/checkNameAvailability-private-scheduledAction.json if __name__ == "__main__": main() diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/scheduled_action_check_name_availability_by_scope.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/scheduled_actions/check_name_availabilitysharedscheduled_action.py similarity index 92% rename from sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/scheduled_action_check_name_availability_by_scope.py rename to sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/scheduled_actions/check_name_availabilitysharedscheduled_action.py index b4143d3fec08..10de23cf0376 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/scheduled_action_check_name_availability_by_scope.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/scheduled_actions/check_name_availabilitysharedscheduled_action.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-costmanagement # USAGE - python scheduled_action_check_name_availability_by_scope.py + python check_name_availabilitysharedscheduled_action.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -35,6 +35,6 @@ def main(): print(response) -# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/scheduledActions/checkNameAvailability-shared-scheduledAction.json +# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/scheduledActions/checkNameAvailability-shared-scheduledAction.json if __name__ == "__main__": main() diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/create_or_update_private_scheduled_action.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/scheduled_actions/scheduled_actioncreate_or_updateprivate.py similarity index 94% rename from sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/create_or_update_private_scheduled_action.py rename to sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/scheduled_actions/scheduled_actioncreate_or_updateprivate.py index bcdc140924c3..8c4d4d859b96 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/create_or_update_private_scheduled_action.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/scheduled_actions/scheduled_actioncreate_or_updateprivate.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-costmanagement # USAGE - python create_or_update_private_scheduled_action.py + python scheduled_actioncreate_or_updateprivate.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -51,6 +51,6 @@ def main(): print(response) -# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/scheduledActions/scheduledAction-createOrUpdate-private.json +# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/scheduledActions/scheduledAction-createOrUpdate-private.json if __name__ == "__main__": main() diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/create_or_update_scheduled_action_by_scope.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/scheduled_actions/scheduled_actioncreate_or_updateshared.py similarity index 95% rename from sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/create_or_update_scheduled_action_by_scope.py rename to sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/scheduled_actions/scheduled_actioncreate_or_updateshared.py index 695c27d7ee9e..0339141d3a39 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/create_or_update_scheduled_action_by_scope.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/scheduled_actions/scheduled_actioncreate_or_updateshared.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-costmanagement # USAGE - python create_or_update_scheduled_action_by_scope.py + python scheduled_actioncreate_or_updateshared.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -53,6 +53,6 @@ def main(): print(response) -# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/scheduledActions/scheduledAction-createOrUpdate-shared.json +# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/scheduledActions/scheduledAction-createOrUpdate-shared.json if __name__ == "__main__": main() diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/private_scheduled_action_delete.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/scheduled_actions/scheduled_actiondeleteprivate.py similarity index 88% rename from sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/private_scheduled_action_delete.py rename to sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/scheduled_actions/scheduled_actiondeleteprivate.py index 430d92a77b88..cf04e3d6c7c5 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/private_scheduled_action_delete.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/scheduled_actions/scheduled_actiondeleteprivate.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-costmanagement # USAGE - python private_scheduled_action_delete.py + python scheduled_actiondeleteprivate.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -28,12 +28,11 @@ def main(): credential=DefaultAzureCredential(), ) - response = client.scheduled_actions.delete( + client.scheduled_actions.delete( name="monthlyCostByResource", ) - print(response) -# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/scheduledActions/scheduledAction-delete-private.json +# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/scheduledActions/scheduledAction-delete-private.json if __name__ == "__main__": main() diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/scheduled_action_delete_by_scope.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/scheduled_actions/scheduled_actiondeleteshared.py similarity index 88% rename from sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/scheduled_action_delete_by_scope.py rename to sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/scheduled_actions/scheduled_actiondeleteshared.py index 16475554ac21..feae5e7ec6f0 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/scheduled_action_delete_by_scope.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/scheduled_actions/scheduled_actiondeleteshared.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-costmanagement # USAGE - python scheduled_action_delete_by_scope.py + python scheduled_actiondeleteshared.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -28,13 +28,12 @@ def main(): credential=DefaultAzureCredential(), ) - response = client.scheduled_actions.delete_by_scope( + client.scheduled_actions.delete_by_scope( scope="subscriptions/00000000-0000-0000-0000-000000000000", name="monthlyCostByResource", ) - print(response) -# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/scheduledActions/scheduledAction-delete-shared.json +# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/scheduledActions/scheduledAction-delete-shared.json if __name__ == "__main__": main() diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/private_scheduled_action.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/scheduled_actions/scheduled_actiongetprivate.py similarity index 93% rename from sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/private_scheduled_action.py rename to sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/scheduled_actions/scheduled_actiongetprivate.py index b8a398bb6e47..bac15a0d429c 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/private_scheduled_action.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/scheduled_actions/scheduled_actiongetprivate.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-costmanagement # USAGE - python private_scheduled_action.py + python scheduled_actiongetprivate.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -34,6 +34,6 @@ def main(): print(response) -# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/scheduledActions/scheduledAction-get-private.json +# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/scheduledActions/scheduledAction-get-private.json if __name__ == "__main__": main() diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/scheduled_action_by_scope.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/scheduled_actions/scheduled_actiongetshared.py similarity index 93% rename from sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/scheduled_action_by_scope.py rename to sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/scheduled_actions/scheduled_actiongetshared.py index 66e919a9c25c..a39a9873080d 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/scheduled_action_by_scope.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/scheduled_actions/scheduled_actiongetshared.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-costmanagement # USAGE - python scheduled_action_by_scope.py + python scheduled_actiongetshared.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -35,6 +35,6 @@ def main(): print(response) -# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/scheduledActions/scheduledAction-get-shared.json +# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/scheduledActions/scheduledAction-get-shared.json if __name__ == "__main__": main() diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/create_or_update_insight_alert_scheduled_action_by_scope.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/scheduled_actions/scheduled_actioninsight_alertcreate_or_updateshared.py similarity index 94% rename from sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/create_or_update_insight_alert_scheduled_action_by_scope.py rename to sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/scheduled_actions/scheduled_actioninsight_alertcreate_or_updateshared.py index b7ac0ac4ce37..68379f54f0e8 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/create_or_update_insight_alert_scheduled_action_by_scope.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/scheduled_actions/scheduled_actioninsight_alertcreate_or_updateshared.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-costmanagement # USAGE - python create_or_update_insight_alert_scheduled_action_by_scope.py + python scheduled_actioninsight_alertcreate_or_updateshared.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -52,6 +52,6 @@ def main(): print(response) -# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/scheduledActions/scheduledAction-insightAlert-createOrUpdate-shared.json +# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/scheduledActions/scheduledAction-insightAlert-createOrUpdate-shared.json if __name__ == "__main__": main() diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/scheduled_action_send_now.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/scheduled_actions/scheduled_actionsend_nowprivate.py similarity index 88% rename from sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/scheduled_action_send_now.py rename to sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/scheduled_actions/scheduled_actionsend_nowprivate.py index 74503ffeab06..b346b6581b92 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/scheduled_action_send_now.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/scheduled_actions/scheduled_actionsend_nowprivate.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-costmanagement # USAGE - python scheduled_action_send_now.py + python scheduled_actionsend_nowprivate.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -28,12 +28,11 @@ def main(): credential=DefaultAzureCredential(), ) - response = client.scheduled_actions.run( + client.scheduled_actions.run( name="monthlyCostByResource", ) - print(response) -# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/scheduledActions/scheduledAction-sendNow-private.json +# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/scheduledActions/scheduledAction-sendNow-private.json if __name__ == "__main__": main() diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/scheduled_action_run_by_scope.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/scheduled_actions/scheduled_actionsend_nowshared.py similarity index 88% rename from sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/scheduled_action_run_by_scope.py rename to sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/scheduled_actions/scheduled_actionsend_nowshared.py index d24de12f2a17..d25de3b4f803 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/scheduled_action_run_by_scope.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/scheduled_actions/scheduled_actionsend_nowshared.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-costmanagement # USAGE - python scheduled_action_run_by_scope.py + python scheduled_actionsend_nowshared.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -28,13 +28,12 @@ def main(): credential=DefaultAzureCredential(), ) - response = client.scheduled_actions.run_by_scope( + client.scheduled_actions.run_by_scope( scope="subscriptions/00000000-0000-0000-0000-000000000000", name="monthlyCostByResource", ) - print(response) -# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/scheduledActions/scheduledAction-sendNow-shared.json +# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/scheduledActions/scheduledAction-sendNow-shared.json if __name__ == "__main__": main() diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/private_scheduled_actions_list_filter_by_view_id.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/scheduled_actions/scheduled_actionslist_with_filterprivate.py similarity index 91% rename from sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/private_scheduled_actions_list_filter_by_view_id.py rename to sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/scheduled_actions/scheduled_actionslist_with_filterprivate.py index 6814e9ba13ae..f8b8f7d3c620 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/private_scheduled_actions_list_filter_by_view_id.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/scheduled_actions/scheduled_actionslist_with_filterprivate.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-costmanagement # USAGE - python private_scheduled_actions_list_filter_by_view_id.py + python scheduled_actionslist_with_filterprivate.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -33,6 +33,6 @@ def main(): print(item) -# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/scheduledActions/scheduledActions-listWithFilter-private.json +# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/scheduledActions/scheduledActions-listWithFilter-private.json if __name__ == "__main__": main() diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/scheduled_actions_list_by_scope_filter_by_view_id.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/scheduled_actions/scheduled_actionslist_with_filtershared.py similarity index 92% rename from sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/scheduled_actions_list_by_scope_filter_by_view_id.py rename to sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/scheduled_actions/scheduled_actionslist_with_filtershared.py index 1707a00ae03d..c0d92b8d3f17 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/scheduled_actions_list_by_scope_filter_by_view_id.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/scheduled_actions/scheduled_actionslist_with_filtershared.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-costmanagement # USAGE - python scheduled_actions_list_by_scope_filter_by_view_id.py + python scheduled_actionslist_with_filtershared.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -35,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/scheduledActions/scheduledActions-listWithFilter-shared.json +# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/scheduledActions/scheduledActions-listWithFilter-shared.json if __name__ == "__main__": main() diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/private_scheduled_actions_list.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/scheduled_actions/scheduled_actionslistprivate.py similarity index 92% rename from sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/private_scheduled_actions_list.py rename to sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/scheduled_actions/scheduled_actionslistprivate.py index efd002ebf1b2..00f615112623 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/private_scheduled_actions_list.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/scheduled_actions/scheduled_actionslistprivate.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-costmanagement # USAGE - python private_scheduled_actions_list.py + python scheduled_actionslistprivate.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -33,6 +33,6 @@ def main(): print(item) -# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/scheduledActions/scheduledActions-list-private.json +# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/scheduledActions/scheduledActions-list-private.json if __name__ == "__main__": main() diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/scheduled_actions_list_by_scope.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/scheduled_actions/scheduled_actionslistshared.py similarity index 93% rename from sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/scheduled_actions_list_by_scope.py rename to sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/scheduled_actions/scheduled_actionslistshared.py index 64d591648bd6..b0f34e560c95 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/scheduled_actions_list_by_scope.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/scheduled_actions/scheduled_actionslistshared.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-costmanagement # USAGE - python scheduled_actions_list_by_scope.py + python scheduled_actionslistshared.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -35,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/scheduledActions/scheduledActions-list-shared.json +# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/scheduledActions/scheduledActions-list-shared.json if __name__ == "__main__": main() diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/single_resource_group_alerts.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/single_resource_group_alert.py similarity index 93% rename from sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/single_resource_group_alerts.py rename to sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/single_resource_group_alert.py index c5e02e62edcc..e6d0647d38a9 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/single_resource_group_alerts.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/single_resource_group_alert.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-costmanagement # USAGE - python single_resource_group_alerts.py + python single_resource_group_alert.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -35,6 +35,6 @@ def main(): print(response) -# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/SingleResourceGroupAlert.json +# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/SingleResourceGroupAlert.json if __name__ == "__main__": main() diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/single_subscription_alerts.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/single_subscription_alert.py similarity index 93% rename from sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/single_subscription_alerts.py rename to sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/single_subscription_alert.py index f3d53894a833..81ee0ddaa6e3 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/single_subscription_alerts.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/single_subscription_alert.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-costmanagement # USAGE - python single_subscription_alerts.py + python single_subscription_alert.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -35,6 +35,6 @@ def main(): print(response) -# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/SingleSubscriptionAlert.json +# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/SingleSubscriptionAlert.json if __name__ == "__main__": main() diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/subscription_alerts.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/subscription_alerts.py index 3402e29b0f72..d46ed96574ae 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/subscription_alerts.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/subscription_alerts.py @@ -34,6 +34,6 @@ def main(): print(response) -# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/SubscriptionAlerts.json +# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/SubscriptionAlerts.json if __name__ == "__main__": main() diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/subscription_dimensions_list_legacy.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/subscription_dimensions_list.py similarity index 92% rename from sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/subscription_dimensions_list_legacy.py rename to sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/subscription_dimensions_list.py index 33c508bb1abc..12e63d7e3c97 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/subscription_dimensions_list_legacy.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/subscription_dimensions_list.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-costmanagement # USAGE - python subscription_dimensions_list_legacy.py + python subscription_dimensions_list.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -35,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/SubscriptionDimensionsList.json +# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/SubscriptionDimensionsList.json if __name__ == "__main__": main() diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/subscription_forecast.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/subscription_forecast.py index 63c6ba54de7c..5711fe5f8b0a 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/subscription_forecast.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/subscription_forecast.py @@ -62,6 +62,6 @@ def main(): print(response) -# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/SubscriptionForecast.json +# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/SubscriptionForecast.json if __name__ == "__main__": main() diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/subscription_query_legacy.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/subscription_query.py similarity index 95% rename from sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/subscription_query_legacy.py rename to sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/subscription_query.py index e3a8e45fdcb5..3e48ec9b072c 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/subscription_query_legacy.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/subscription_query.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-costmanagement # USAGE - python subscription_query_legacy.py + python subscription_query.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -58,6 +58,6 @@ def main(): print(response) -# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/SubscriptionQuery.json +# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/SubscriptionQuery.json if __name__ == "__main__": main() diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/subscription_query_grouping_legacy.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/subscription_query_grouping.py similarity index 93% rename from sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/subscription_query_grouping_legacy.py rename to sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/subscription_query_grouping.py index eed3d3246164..5dc7989af24d 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/subscription_query_grouping_legacy.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/subscription_query_grouping.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-costmanagement # USAGE - python subscription_query_grouping_legacy.py + python subscription_query_grouping.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -43,6 +43,6 @@ def main(): print(response) -# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/SubscriptionQueryGrouping.json +# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/SubscriptionQueryGrouping.json if __name__ == "__main__": main() diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/resource_group_view.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/view_by_resource_group.py similarity index 93% rename from sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/resource_group_view.py rename to sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/view_by_resource_group.py index e9fcfb3a18e2..0c0fab542bd1 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/resource_group_view.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/view_by_resource_group.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-costmanagement # USAGE - python resource_group_view.py + python view_by_resource_group.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -35,6 +35,6 @@ def main(): print(response) -# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ViewByResourceGroup.json +# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/ViewByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/resource_group_create_or_update_view.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/view_create_or_update_by_resource_group.py similarity index 96% rename from sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/resource_group_create_or_update_view.py rename to sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/view_create_or_update_by_resource_group.py index ddb41feb5c8f..cdea60d7da0e 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/resource_group_create_or_update_view.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/view_create_or_update_by_resource_group.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-costmanagement # USAGE - python resource_group_create_or_update_view.py + python view_create_or_update_by_resource_group.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -67,6 +67,6 @@ def main(): print(response) -# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ViewCreateOrUpdateByResourceGroup.json +# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/ViewCreateOrUpdateByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/resource_group_delete_view.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/view_delete_by_resource_group.py similarity index 89% rename from sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/resource_group_delete_view.py rename to sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/view_delete_by_resource_group.py index 3e11c6382498..8cbed941aa7e 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/resource_group_delete_view.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/view_delete_by_resource_group.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-costmanagement # USAGE - python resource_group_delete_view.py + python view_delete_by_resource_group.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -28,13 +28,12 @@ def main(): credential=DefaultAzureCredential(), ) - response = client.views.delete_by_scope( + client.views.delete_by_scope( scope="subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG", view_name="TestView", ) - print(response) -# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ViewDeleteByResourceGroup.json +# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/ViewDeleteByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/resource_group_view_list.py b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/view_list_by_resource_group.py similarity index 93% rename from sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/resource_group_view_list.py rename to sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/view_list_by_resource_group.py index 369b82d349b3..9a5dc63084cb 100644 --- a/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/resource_group_view_list.py +++ b/sdk/costmanagement/azure-mgmt-costmanagement/generated_samples/view_list_by_resource_group.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-costmanagement # USAGE - python resource_group_view_list.py + python view_list_by_resource_group.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -35,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2022-10-01/examples/ViewListByResourceGroup.json +# x-ms-original-file: specification/cost-management/resource-manager/Microsoft.CostManagement/stable/2023-03-01/examples/ViewListByResourceGroup.json if __name__ == "__main__": main()